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: RFC: Make gnu.classpath.Pointer work


>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:

Gary> Is this patch all that's needed to make gnu.classpath.Pointer an
Gary> analogue of gnu.gcj.RawData?

I don't think Pointer works like RawData, and without extra work on
the JNI code, this patch will result in bugs.  Furthermore I think it
would probably be more trouble than benefit to actually do this work
on the JNI code, since it would mean keeping a divergence around
forever.

Pointer is a base class with 2 concrete subclasses: Pointer32 and
Pointer64.  The Classpath JNI code creates an instance of one of these
subclasses depending on the system it is running on.  Each of the
subclasses is just a plain old Java class, and each wraps a value
(either int or long) which is a cast C pointer.  When a real C pointer
is needed, the value is extracted and cast back.  See jni/classpath/jcl.c.

RawData on the other hand is basically like a 'void*'.  A RawData
field does not point to a Java object at all.

If this patch goes in I think we will see bugs where a Pointer is
collected but then later dereferenced by the JNI code.

Tom


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