2009/7/1 Tomek Grabiec <tgrab...@gmail.com>: > > Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> > --- > include/vm/java_lang.h | 1 + > include/vm/object.h | 4 ---- > vm/class.c | 4 +++- > vm/jato.c | 5 ++++- > 4 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/include/vm/java_lang.h b/include/vm/java_lang.h > index e3e2a25..7a10325 100644 > --- a/include/vm/java_lang.h > +++ b/include/vm/java_lang.h > @@ -6,6 +6,7 @@ extern struct vm_class *vm_java_lang_Class; > extern struct vm_class *vm_java_lang_String; > extern struct vm_class *vm_java_lang_Throwable; > > +extern struct vm_field *vm_java_lang_Class_vmdata; > extern struct vm_field *vm_java_lang_String_offset; > extern struct vm_field *vm_java_lang_String_count; > extern struct vm_field *vm_java_lang_String_value; > diff --git a/include/vm/object.h b/include/vm/object.h > index 64472b2..dd0905d 100644 > --- a/include/vm/object.h > +++ b/include/vm/object.h > @@ -16,10 +16,6 @@ struct vm_object { > * this points to the (artificial) class named "[I". */ > struct vm_class *class; > > - /* For instances of java.lang.Class this points to the class > - represented by this java.lang.Class instance. */ > - struct vm_class *java_lang_Class_class; > - > pthread_mutex_t mutex; > > unsigned int array_length; > diff --git a/vm/class.c b/vm/class.c > index eaacbda..b48e43a 100644 > --- a/vm/class.c > +++ b/vm/class.c > @@ -38,6 +38,7 @@ > #include <vm/classloader.h> > #include <vm/die.h> > #include <vm/field.h> > +#include <vm/java_lang.h> > #include <vm/method.h> > #include <vm/object.h> > #include <vm/string.h> > @@ -276,7 +277,8 @@ int vm_class_init(struct vm_class *vmc) > return -1; > } > > - vmc->object->java_lang_Class_class = vmc; > + field_set_object(vmc->object, vm_java_lang_Class_vmdata, > + (struct vm_object *)vmc); > > if (vmc->class) { > /* XXX: Make sure there's at most one of these. */
Is there a reason why this isn't in vm_class_link? I'm also a bit scared about rogue Java code getting their hands on VMClass.vmdata, which would be a catastrophe since we're not storing a Java object reference there at all, but a struct vm_class *. Is there a way to help that? Otherwise, looks fine. Acked-by: Vegard Nossum <vegard.nos...@gmail.com> Vegard ------------------------------------------------------------------------------ _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel