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 Monday, Aug 4, 2003, at 11:54 US/Eastern, Jeff Sturm wrote:


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).

The call to cached_function is not always atomic. On the PPC at least it does a move to spr and then branch on the condition register(two separate instructions).

Thanks,
Andrew Pinski


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