> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> Chris Toshok
> Sent: Saturday, November 07, 1998 2:02 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: native state (again)
>
>
> ok. i've come around (thanks to paul's gentle yet persistent prodding
> :)
>
> I've added the following two calls to japhar:
>
> extern void* NSA_GetNativeState(japhar_obj object_ref);
> extern void NSA_SetNativeState(japhar_obj object_ref, void*
> native_state);
>
> japhar_obj is the same as jobject in JNI code, and permits both jobjects
> and jclasses (since jclasses are really jobjects.)
>
Woohoo! Thanks!
This means we can remove all private_data fields from Class, Method,
Constructor, Field, and Thread--and you or I can change the patch so that it
uses this. It also eliminates your need for that predefined field in
initialize_class_class() for Sun's version!
And, *very* importantly, it nullifies the argument we were having earlier
about me caching those fields. First, private_data will go away, and
second, as long as those other fields are initialized to null automatically
(which I'm not sure of, since you call new_object_no_init), there is no need
to set them to NULL explicitly.
> So, to get instance data, send a jobject and to get static data send the
> jclass.
>
Better not ... every *instance* of Class needs a native state pointer so
that it can point to the ClazzFile.
If you want to associate static native data, have another couple of
functions:
extern void* NSA_GetStaticNativeState(ClazzFile * clazz);
extern void NSA_SetStaticNativeState(ClazzFile * clazz, void*
native_state);
This will clearly distinguish the two.
Later it'll be good to optimize it so that only classes that use the void*
actually get it in every instance, for memory savings, but for now leaving
it like this is best.
--John Keiser