Storing of native pointers

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

 



Hi there,

Am Dienstag, den 23.05.2006, 16:47 +0200 schrieb Robert Schuster:
> I make this to a general discussion.
> 
> >> Agreed, and I think we should replace existing NSA code with the
> >> simpler long field approach.  Ideally we could remove the NSA
> >> implementation altogether.  I'd also like to see
> >> Pointer/Pointer32/Pointer64 gone but they seem to be used in places
> >> other than the peers.
> Does that mean we simply store any native pointer as long in some field of a class?
> 
> If so, do we use JNI to set/get the fields or do we go the simpler way provide
> necessary pointers via argument list?
> 
> I vote for the second approach because I dislike nothing but these tedious JNI
> findClass, get fieldID and set field function stuff.
> 

My preferred approach is to store pointers as Object (and access some
field via index), which has the advantage that you can't fiddle with the
pointer from the Java-side in any way. Of course, using a long is
slightly more clear. For the access of the pointer I prefer to pass it
directly via the method arguments. This avoids all the find* blah stuff.
If this ain't possible for some reason it is advisable to only do the
findClass stuff once and store the indices in some variable (IMO).

/Roman

-- 
?Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.? - William Blake
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://developer.classpath.org/pipermail/classpath/attachments/20060524/8235c753/attachment.pgp

[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux