java/4066: gcj -fjni generates thread-unsafe code

tromey@redhat.com tromey@redhat.com
Mon Aug 20 12:56:00 GMT 2001


>Number:         4066
>Category:       java
>Synopsis:       gcj -fjni generates thread-unsafe code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 20 12:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tom Tromey <tromey@redhat.com>
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
The stubs generated by `gcj -fjni' are not thread-safe.
I believe the code they generate to cache the JNI method
pointer can fail in some rare situations.
(This code relies on double-checked locking, which is
known to be bad.)

One fix would be to change _Jv_LookupJNIMethod so
that it takes an additional pointer.  This pointer would
point to the cache location.  _Jv_LookupJNIMethod would
then be responsible for updating the cache value, which 
it could do while holding a mutex.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list