This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]