CNI changes (Was: Binary Compatibility)

Jeff Sturm
Mon Aug 4 15:54:00 GMT 2003

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


More information about the Java mailing list