classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classpath build process and VM-specific issues


From: Etienne Gagnon
Subject: Re: Classpath build process and VM-specific issues
Date: Mon, 05 Apr 2004 10:28:13 -0400
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.6) Gecko/20040402 Debian/1.6-4

I Agree with Andrew, regarding the reference JNI library code;  this code is
*NOT* the VM*.java interface, so it should be written to be compatible
with any JNI compliant JVM.  As far as I know, disguising a native
pointer into a Java reference is not portable across JVMs.

IMO, the cleanest approach is really the use of a byte array.  It allows
for *any* native pointer length, without making this length explicit in
any Java source code (assuming these arrays are allocated in the native
JNI parts).  The Garbage collector can move this array as it wishes, yet
the value will be preserved.

I oppose the use of long-term maintenance trouble things such as "int" or
"long".  As for performance, the additional indirection cost, to get the
byte array content value (e.g. the native pointer) is offset by the cost
of the JNI call itself.

Etienne
--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]