CNI changes (Was: Binary Compatibility)

Andrew Pinski pinskia@physics.uc.edu
Mon Aug 4 15:58:00 GMT 2003


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



More information about the Java mailing list