This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: CNI changes (Was: Binary Compatibility)
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Andrew Haley <aph at redhat dot com>, Anthony Green <green at redhat dot com>, <java at gcc dot gnu dot org>
- Date: Mon, 4 Aug 2003 11:54:06 -0400 (EDT)
- Subject: Re: CNI changes (Was: Binary Compatibility)
On 4 Aug 2003, Tom Tromey wrote:
> Andrew> What is wrong with the current scheme?
>
> We generate JNI stubs that look like:
>
> if (cached_function == NULL)
> cached_function = _Jv_LookupJNIMethod(...)
> (*cached_function) (...);
>
> I'm not sure that assignment is always atomic, which is why I sent in
> the PR. (If it is always atomic we can just close this.)
I don't know of any target that wouldn't do an atomic store of
cached_function. The usual problem with this double-checking idiom isn't
the assignment itself however but ordering of memory writes before and
after the assignment (i.e. side effects).
If _Jv_LookupJNIMethod has no important side effects here, my hunch is
that the PR should be closed. (Come to think of it... I wonder about
IA-64. I vaguely recall that a "function pointer" is really a gp/entry
pair on IA-64. That one may not be atomic after all, or I may be
confused.)
Jeff