JNI and java.nio.ByteBuffer

Bryce McKinlay mckinlay@redhat.com
Mon Feb 14 17:06:00 GMT 2005


On 12-Feb-05, at 4:56 PM, Anthony Green wrote:
> On Thu, 2004年04月29日 at 18:34 -0400, Bryce McKinlay wrote:
>> The problem seems to be due to a bug in our JNI RegisterNatives
>> implementation.
>> The problem appears to be that RegisterNatives is being called with
> signatures like "(IILjava/nio/Buffer;I)", but the signatures in the
> _Jv_Method are recorded as "(IILjava.nio.Buffer;I)", so we never get a
> match.

Right. I think there is a PR for this.
> Should RegisterNatives handle this, or should the signatures have been
> munged already in the _Jv_Method?

The GCJ "dot" format is not valid for JNI and not accepted by other 
VMs. One option to fix this would be to change GCJ to use the JNI 
format everywhere, but I think would be a lot of work for not much gain 
(this would need to change in the compiler, breaking the ABI, as well 
as in the runtime). We'd gain a little efficiency in some areas, such 
as JNI, but lose in others. Its probably best to just have 
RegisterNatives do the conversion internally before searching for the 
method. This has the side-effect of making GCJ also accept names that 
arn't valid by the JNI spec, but we can fix that with a bit of 
additional validation.
Regards
Bryce


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /