Martin Platter
Christian Thalinger
- $Id: jni.c 2183 2005-04-01 20:57:17Z edwin $
+ $Id: jni.c 2186 2005-04-02 00:43:25Z edwin $
*/
return &(c->fields[i]);
}
- if (c->super) return jclass_findfield(c->super,name,desc);
+ if (c->super.cls) return jclass_findfield(c->super.cls,name,desc);
return NULL;
}
{
classinfo *c;
- c = ((classinfo *) sub)->super;
+ c = ((classinfo *) sub)->super.cls;
if (!c)
return NULL;
jclass GetObjectClass(JNIEnv *env, jobject obj)
{
+ classinfo *c;
+
if (!obj || !obj->vftbl)
return NULL;
- classinfo *c = obj->vftbl->class;
-
+ c = obj->vftbl->class;
use_class_as_object(c);
-
return c;
}
Changes: Christian Thalinger
- $Id: native.c 2183 2005-04-01 20:57:17Z edwin $
+ $Id: native.c 2186 2005-04-02 00:43:25Z edwin $
*/
if (!resolve_class_from_typedesc(descr->paramtypes + i,false,
(classinfo **) (result->data + i)))
return NULL; /* exception */
+ use_class_as_object((classinfo*) result->data[i]);
}
return result;
if (!resolve_class_from_typedesc(&(m->parseddesc->returntype),false,&cls))
return NULL; /* exception */
+
+ use_class_as_object(cls);
return cls;
}
class_new(utf_new_char("java/lang/SecurityManager"));
if (size > 0) {
- if (start == class_java_lang_SecurityManager) {
+ if (*start == class_java_lang_SecurityManager) {
size--;
start--;
}
}
- tmpArray =
+ tmpArray = (java_objectarray*)
builtin_newarray(size, class_array_of(class_java_lang_Class)->vftbl);
for(i = 0, current = start; i < size; i++, current--) {
class_new(utf_new_char("java/lang/SecurityManager"));
if (size > 0) {
- if (start == class_java_lang_SecurityManager) {
+ if (*start == class_java_lang_SecurityManager) {
size--;
start--;
}
Changes: Joseph Wenninger
Christian Thalinger
- $Id: VMClass.c 2183 2005-04-01 20:57:17Z edwin $
+ $Id: VMClass.c 2186 2005-04-02 00:43:25Z edwin $
*/
java_lang_reflect_Field* cacao_getField0(JNIEnv *env, java_lang_Class *that, java_lang_String *name, s4 public_only)
{
classinfo *c;
- classinfo *fieldtype;
fieldinfo *f; /* the field to be represented */
java_lang_reflect_Field *o; /* result: field-object */
- utf *desc; /* the fielddescriptor */
int idx;
/* create Field object */
return NULL;
for (i = 0; i < c->interfacescount; i++) {
- use_class_as_object(c->interfaces[i]);
+ use_class_as_object(c->interfaces[i].cls);
- a->data[i] = (java_objectheader *) c->interfaces[i];
+ a->data[i] = (java_objectheader *) c->interfaces[i].cls;
}
return a;
JNIEXPORT java_lang_Class* JNICALL Java_java_lang_VMClass_getSuperclass(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
classinfo *cl = (classinfo *) that;
- classinfo *c = cl->super;
+ classinfo *c = cl->super.cls;
if (!c)
return NULL;
return 0;
}
- return builtin_isanysubclass(sup, that);
+ /* XXX this may be wrong for array classes */
+ return builtin_isanysubclass((classinfo*)sup, (classinfo*)that);
}
*/
JNIEXPORT s4 JNICALL Java_java_lang_VMClass_isInstance(JNIEnv *env, jclass clazz, java_lang_Class *that, java_lang_Object *obj)
{
- return builtin_instanceof(obj, that);
+ return builtin_instanceof((java_objectheader*)obj, (classinfo*)that);
}
/* set the classloader */
- c->classloader = classloader;
+ c->classloader = (java_objectheader*) classloader; /* XXX is this correct? */
use_class_as_object(c);
Andreas Krall
Christian Thalinger
- $Id: class.c 2181 2005-04-01 16:53:33Z edwin $
+ $Id: class.c 2186 2005-04-02 00:43:25Z edwin $
*/
c->classrefcount = 0;
c->parseddescs = NULL;
c->parseddescsize = 0;
- c->super = NULL;
+ c->super.any = NULL;
c->sub = NULL;
c->nextsub = NULL;
c->interfacescount = 0;
Changes:
- $Id: class.h 2181 2005-04-01 16:53:33Z edwin $
+ $Id: class.h 2186 2005-04-02 00:43:25Z edwin $
*/
s4 parseddescsize; /* size of the parsed descriptors block */
u1 *parseddescs; /* parsed descriptors */
- classinfo *super; /* super class pointer */
+ classref_or_classinfo super; /* super class */
classinfo *sub; /* sub class pointer */
classinfo *nextsub; /* pointer to next class in sub class list */
s4 interfacescount; /* number of interfaces */
- classinfo **interfaces; /* pointer to interfaces */
+ classref_or_classinfo *interfaces; /* superinterfaces */
s4 fieldscount; /* number of fields */
fieldinfo *fields; /* field table */
Changes:
- $Id: classcache.c 2181 2005-04-01 16:53:33Z edwin $
+ $Id: classcache.c 2186 2005-04-02 00:43:25Z edwin $
*/
/* DEBUG HELPERS */
/*============================================================================*/
+/*#define CLASSCACHE_VERBOSE*/
+
#ifndef NDEBUG
#define CLASSCACHE_DEBUG
#endif
CLASSCACHE_ASSERT(classname);
-#ifdef CLASSCACHE_DEBUG
- fprintf(stderr,"classcache_add_constraint(%p,%p,",a,b);
+#ifdef CLASSCACHE_VERBOSE
+ fprintf(stderr,"classcache_add_constraint(%p,%p,",(void*)a,(void*)b);
utf_fprint_classname(stderr,classname);
fprintf(stderr,")\n");
#endif
Changes:
- $Id: descriptor.c 2182 2005-04-01 20:56:33Z edwin $
+ $Id: descriptor.c 2186 2005-04-02 00:43:25Z edwin $
*/
fprintf(file,"classrefcount: %d\n",pool->classrefhash.entries);
fprintf(file,"descriptorsize: %d bytes\n",pool->descriptorsize);
fprintf(file,"classrefsize: %d bytes\n",
- (int)pool->classrefhash.entries * sizeof(constant_classref));
+ (int)(pool->classrefhash.entries * sizeof(constant_classref)));
fprintf(file,"class references:\n");
for (slot=0; slot<pool->classrefhash.size; ++slot) {
Authors: Carolyn Oates
- $Id: parseRT.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: parseRT.c 2186 2005-04-02 00:43:25Z edwin $
*/
count_methods_marked_used++;
#endif
METHINFOt(meth,info,RTA_DEBUGopcodes)
- if (meth->class->super != NULL) {
- CLASSNAME(meth->class->super,"\tsuper=",RTA_DEBUGr)
+ if (meth->class->super.cls != NULL) {
+ CLASSNAME(meth->class->super.cls,"\tsuper=",RTA_DEBUGr)
}
else {
if (RTA_DEBUGr) printf("\tsuper=NULL\n");}
/* add used interfaces methods to callgraph */
for (jj=0; jj < ci -> interfacescount; jj++) {
- classinfo *ici = ci -> interfaces [jj];
+ classinfo *ici = ci -> interfaces [jj].cls;
if (RTA_DEBUGinf) {
printf("BInterface used: ");fflush(stdout);
}
else { /*** ??? Should this be an else or ??? */
for (jj=0; jj < ci -> interfacescount; jj++) {
- classinfo *ici = ci -> interfaces [jj];
+ classinfo *ici = ci -> interfaces [jj].cls;
/* use resolve method....!!!! */
if (ici -> classUsed != NOTUSED) {
for (mm=0; mm< ici->methodscount; mm++) {
/*--- <init> ()V is equivalent to "new"
indicating a class is used = instaniated ---- */
if (utf_init==mi->name) {
- if ((m->class->super == mi->class)
+ if ((m->class->super.cls == mi->class)
&& (m->descriptor == utf_void__void) )
{
METHINFOt(mi,"SUPER INIT:",RTA_DEBUGopcodes);
Authors: Carolyn Oates
- $Id: parseRTstats.c 2017 2005-03-09 11:37:33Z twisti $
+ $Id: parseRTstats.c 2186 2005-04-02 00:43:25Z edwin $
*/
if (class == NULL) {return;}
CLASSINFO(class,"CLASS: ");
- for (s = class->super; s != NULL; s = s->super) {
+ for (s = class->super.cls; s != NULL; s = s->super.cls) {
CLASSINFO(s,"SUPER:: ");
}
Authors: Carolyn Oates
- $Id: parseXTA.c 2185 2005-04-01 21:24:49Z edwin $
+ $Id: parseXTA.c 2186 2005-04-02 00:43:25Z edwin $
*/
else { /* NOT XTA checked yet */
for (jj=0; jj < ci -> interfacescount; jj++) {
- classinfo *ici = ci -> interfaces [jj];
+ classinfo *ici = ci -> interfaces [jj].cls;
/* use resolve method....!!!! */
if (ici -> classUsed != NOTUSED) {
for (mm=0; mm< ici->methodscount; mm++) {
/* add used interfaces methods to callgraph */
for (jj=0; jj < ci -> interfacescount; jj++) {
- classinfo *ici = ci -> interfaces [jj];
+ classinfo *ici = ci -> interfaces [jj].cls;
if (XTA_DEBUGinf) {
printf("BInterface used: ");fflush(stdout);
/*--- <init> ()V is equivalent to "new"
indicating a class is used = instaniated ---- */
if (utf_init==mi->name) {
- if ((m->class->super == mi->class)
+ if ((m->class->super.cls == mi->class)
&& (m->descriptor == utf_void__void) )
{
METHINFOt(mi,"SUPER INIT:",XTA_DEBUGopcodes);
Authors: Edwin Steiner
- $Id: typecheck.c 2181 2005-04-01 16:53:33Z edwin $
+ $Id: typecheck.c 2186 2005-04-02 00:43:25Z edwin $
*/
if (!ins) {
TYPECHECK_ASSERT(initmethod);
/* must be <init> of current class or direct superclass */
- if (mi->class != m->class && mi->class != m->class->super)
+ if (mi->class != m->class && mi->class != m->class->super.cls)
panic("<init> calling <init> of the wrong class");
/* set our marker variable to type int */
Authors: Edwin Steiner
- $Id: typeinfo.c 2182 2005-04-01 20:56:33Z edwin $
+ $Id: typeinfo.c 2186 2005-04-02 00:43:25Z edwin $
*/
TYPEINFO_ASSERT(interf);
TYPEINFO_ASSERT((interf->flags & ACC_INTERFACE) != 0);
TYPEINFO_ASSERT((cls->flags & ACC_INTERFACE) != 0);
+ TYPEINFO_ASSERT(cls->linked);
/* first check direct superinterfaces */
for (i=0; i<cls->interfacescount; ++i) {
- if (cls->interfaces[i] == interf)
+ if (cls->interfaces[i].cls == interf)
return true;
}
/* check indirect superinterfaces */
for (i=0; i<cls->interfacescount; ++i) {
- if (interface_extends_interface(cls->interfaces[i],interf))
+ if (interface_extends_interface(cls->interfaces[i].cls,interf))
return true;
}
bool
typeinfo_merge_two(typeinfo *dest,classref_or_classinfo clsx,classref_or_classinfo clsy)
{
+ TYPEINFO_ASSERT(dest);
TYPEINFO_FREEMERGED_IF_ANY(dest->merged);
TYPEINFO_ALLOCMERGED(dest->merged,2);
dest->merged->count = 2;
TYPEINFO_ASSERT(x.cls != pseudo_class_New);
TYPEINFO_ASSERT(y.cls != pseudo_class_New);
-#ifdef XXX
- /* check clsx */
- if (!clsx->loaded)
- if (!load_class_bootstrap(clsx))
- return false;
-
- if (!clsx->linked)
- if (!link_class(clsx))
- return false;
-
- /* check clsy */
- if (!clsy->loaded)
- if (!load_class_bootstrap(clsy))
- return false;
-
- if (!clsy->linked)
- if (!link_class(clsy))
- return false;
-#endif
-
/*--------------------------------------------------*/
/* common cases */
/*--------------------------------------------------*/
/* non-trivial cases */
/*--------------------------------------------------*/
+ /* we may have to load the classes */
+ if (!IS_CLASSREF(x) && !x.cls->loaded)
+ load_class_bootstrap(x.cls); /* XXX */
+ if (!IS_CLASSREF(y) && !y.cls->loaded)
+ load_class_bootstrap(y.cls); /* XXX */
+
#ifdef TYPEINFO_VERBOSE
{
typeinfo dbgx,dbgy;
fprintf(stderr,"merge_nonarrays:\n");
+ fprintf(stderr," ");if(IS_CLASSREF(x))fprintf(stderr,"<ref>");utf_fprint(stderr,xname);fprintf(stderr,"\n");
+ fprintf(stderr," ");if(IS_CLASSREF(y))fprintf(stderr,"<ref>");utf_fprint(stderr,yname);fprintf(stderr,"\n");
+ fflush(stderr);
TYPEINFO_INIT_CLASSREF_OR_CLASSINFO(dbgx,x);
dbgx.merged = mergedx;
TYPEINFO_INIT_CLASSREF_OR_CLASSINFO(dbgy,y);
}
#endif
+ TYPEINFO_ASSERT(IS_CLASSREF(x) || x.cls->loaded);
+ TYPEINFO_ASSERT(IS_CLASSREF(y) || y.cls->loaded);
+
/* If y is unresolved or an interface, swap x and y. */
if (IS_CLASSREF(y) || (!IS_CLASSREF(x) && y.cls->flags & ACC_INTERFACE))
{
/* {We know: both x and y are resolved} */
/* {We know: If only one of x,y is an interface it is x.} */
+ TYPEINFO_ASSERT(!IS_CLASSREF(x) && !IS_CLASSREF(y));
+ TYPEINFO_ASSERT(x.cls->loaded);
+ TYPEINFO_ASSERT(y.cls->loaded);
+
/* Handle merging of interfaces: */
if (x.cls->flags & ACC_INTERFACE) {
/* {x.cls is an interface and mergedx == NULL.} */
x = y;
goto return_simple_x;
}
-
/* If the type y implements x then the result of the merge
* is x regardless of mergedy.
*/
+
+ /* we may have to link the classes */
+ if (!x.cls->linked)
+ link_class(x.cls); /* XXX */
+ if (!y.cls->linked)
+ link_class(y.cls); /* XXX */
+ TYPEINFO_ASSERT(x.cls->linked);
+ TYPEINFO_ASSERT(y.cls->linked);
+
if (CLASSINFO_IMPLEMENTS_INTERFACE(y.cls,x.cls->index)
|| mergedlist_implements_interface(mergedy,x.cls))
{
/* {We know: x and y are classes (not interfaces).} */
+ /* we may have to link the classes */
+ if (!x.cls->linked)
+ link_class(x.cls); /* XXX */
+ if (!y.cls->linked)
+ link_class(y.cls); /* XXX */
+
+ TYPEINFO_ASSERT(x.cls->linked);
+ TYPEINFO_ASSERT(y.cls->linked);
+
/* If *x is deeper in the inheritance hierarchy swap x and y. */
if (x.cls->index > y.cls->index) {
t = x; x = y; y = t;
common = x.cls;
tcls = y.cls;
while (tcls->index > common->index)
- tcls = tcls->super;
+ tcls = tcls->super.cls;
while (common != tcls) {
- common = common->super;
- tcls = tcls->super;
+ common = common->super.cls;
+ tcls = tcls->super.cls;
}
/* {common == nearest common anchestor of x and y.} */
Authors: Edwin Steiner
- $Id: typeinfo.h 2181 2005-04-01 16:53:33Z edwin $
+ $Id: typeinfo.h 2186 2005-04-02 00:43:25Z edwin $
*/
(info).elementtype = 0;} while(0)
#define TYPEINFO_INIT_NULLTYPE(info) \
- TYPEINFO_INIT_CLASSINFO(info,pseudo_class_Null)
+ TYPEINFO_INIT_NON_ARRAY_CLASSINFO(info,pseudo_class_Null)
#define TYPEINFO_INIT_NEWOBJECT(info,instr) \
do {(info).typeclass.cls = pseudo_class_New; \
Edwin Steiner
Christian Thalinger
- $Id: linker.c 2182 2005-04-01 20:56:33Z edwin $
+ $Id: linker.c 2186 2005-04-02 00:43:25Z edwin $
*/
/* pseudo class for Arraystubs (extends java.lang.Object) */
pseudo_class_Arraystub->loaded = true;
- pseudo_class_Arraystub->super = class_java_lang_Object;
+ pseudo_class_Arraystub->super.cls = class_java_lang_Object;
pseudo_class_Arraystub->interfacescount = 2;
- pseudo_class_Arraystub->interfaces = MNEW(classinfo*, 2);
- pseudo_class_Arraystub->interfaces[0] = class_java_lang_Cloneable;
- pseudo_class_Arraystub->interfaces[1] = class_java_io_Serializable;
+ pseudo_class_Arraystub->interfaces = MNEW(classref_or_classinfo, 2);
+ pseudo_class_Arraystub->interfaces[0].cls = class_java_lang_Cloneable;
+ pseudo_class_Arraystub->interfaces[1].cls = class_java_io_Serializable;
if (!link_class(pseudo_class_Arraystub))
return false;
/* pseudo class representing the null type */
pseudo_class_Null->loaded = true;
- pseudo_class_Null->super = class_java_lang_Object;
+ pseudo_class_Null->super.cls = class_java_lang_Object;
if (!link_class(pseudo_class_Null))
return false;
/* pseudo class representing new uninitialized objects */
pseudo_class_New->loaded = true;
- pseudo_class_New->linked = true;
- pseudo_class_New->super = class_java_lang_Object;
+ pseudo_class_New->linked = true; /* XXX is this allright? */
+ pseudo_class_New->super.cls = class_java_lang_Object;
/* create classes representing primitive types */
/* check interfaces */
for (i = 0; i < c->interfacescount; i++) {
- tc = c->interfaces[i];
+ tc = c->interfaces[i].cls;
/* detect circularity */
/* check super class */
- super = c->super;
+ super = c->super.cls;
if (super == NULL) { /* class java.lang.Object */
c->index = 0;
}
}
- tc = tc->super;
+ tc = tc->super.cls;
}
notfoundvftblindex:
abstractmethodscount = 0;
for (i = 0; i < c->interfacescount; i++) {
- ic = c->interfaces[i];
+ ic = c->interfaces[i].cls;
for (j = 0; j < ic->methodscount; j++) {
im = &(ic->methods[j]);
goto noabstractmethod;
}
- tc = tc->super;
+ tc = tc->super.cls;
}
abstractmethodscount++;
c->methodscount + abstractmethodscount);
for (i = 0; i < c->interfacescount; i++) {
- ic = c->interfaces[i];
+ ic = c->interfaces[i].cls;
for (j = 0; j < ic->methodscount; j++) {
im = &(ic->methods[j]);
goto noabstractmethod2;
}
- tc = tc->super;
+ tc = tc->super.cls;
}
am = &(c->methods[c->methodscount]);
tc = c;
while (tc) {
for (i = 0; i < tc->interfacescount; i++) {
- s4 h = class_highestinterface(tc->interfaces[i]) + 1;
+ s4 h = class_highestinterface(tc->interfaces[i].cls) + 1;
if (h > interfacetablelength)
interfacetablelength = h;
}
- tc = tc->super;
+ tc = tc->super.cls;
}
/* allocate virtual function table */
/* add interfaces */
- for (tc = c; tc != NULL; tc = tc->super)
+ for (tc = c; tc != NULL; tc = tc->super.cls)
for (i = 0; i < tc->interfacescount; i++)
- linker_addinterface(c, tc->interfaces[i]);
+ linker_addinterface(c, tc->interfaces[i].cls);
/* add finalizer method (not for java.lang.Object) */
c->sub = 0;
}
- if (!(c->flags & ACC_INTERFACE) && (c->super != NULL)) {
- c->nextsub = c->super->sub;
- c->super->sub = c;
+ if (!(c->flags & ACC_INTERFACE) && (c->super.any != NULL)) {
+ c->nextsub = c->super.cls->sub;
+ c->super.cls->sub = c;
}
classvalue = 0;
goto foundmethod;
}
}
- sc = sc->super;
+ sc = sc->super.cls;
}
foundmethod:
;
}
for (j = 0; j < ic->interfacescount; j++)
- linker_addinterface(c, ic->interfaces[j]);
+ linker_addinterface(c, ic->interfaces[j].cls);
}
h = c->index;
for (i = 0; i < c->interfacescount; i++) {
- h2 = class_highestinterface(c->interfaces[i]);
+ h2 = class_highestinterface(c->interfaces[i].cls);
if (h2 > h)
h = h2;
Edwin Steiner
Christian Thalinger
- $Id: loader.c 2182 2005-04-01 20:56:33Z edwin $
+ $Id: loader.c 2186 2005-04-02 00:43:25Z edwin $
*/
void printflags(u2 f)
{
- if ( f & ACC_PUBLIC ) printf (" PUBLIC");
- if ( f & ACC_PRIVATE ) printf (" PRIVATE");
- if ( f & ACC_PROTECTED ) printf (" PROTECTED");
- if ( f & ACC_STATIC ) printf (" STATIC");
- if ( f & ACC_FINAL ) printf (" FINAL");
- if ( f & ACC_SYNCHRONIZED ) printf (" SYNCHRONIZED");
- if ( f & ACC_VOLATILE ) printf (" VOLATILE");
- if ( f & ACC_TRANSIENT ) printf (" TRANSIENT");
- if ( f & ACC_NATIVE ) printf (" NATIVE");
- if ( f & ACC_INTERFACE ) printf (" INTERFACE");
- if ( f & ACC_ABSTRACT ) printf (" ABSTRACT");
+ fprintflags(stdout,f);
}
/* retrieve superclass */
if ((i = suck_u2(cb))) {
- if (!(c->super = class_getconstant(c, i, CONSTANT_Class)))
+ if (!(c->super.cls = class_getconstant(c, i, CONSTANT_Class)))
goto return_exception;
/* java.lang.Object may not have a super class. */
/* Interfaces must have java.lang.Object as super class. */
if ((c->flags & ACC_INTERFACE) &&
- c->super->name != utf_java_lang_Object) {
+ c->super.cls->name != utf_java_lang_Object) {
*exceptionptr =
new_exception_message(string_java_lang_ClassFormatError,
"Interfaces must have java.lang.Object as superclass");
}
} else {
- c->super = NULL;
+ c->super.any = NULL;
/* This is only allowed for java.lang.Object. */
if (c->name != utf_java_lang_Object) {
if (!check_classbuffer_size(cb, 2 * c->interfacescount))
goto return_exception;
- c->interfaces = MNEW(classinfo*, c->interfacescount);
+ c->interfaces = MNEW(classref_or_classinfo, c->interfacescount);
for (i = 0; i < c->interfacescount; i++) {
- if (!(c->interfaces[i] = class_getconstant(c, suck_u2(cb), CONSTANT_Class)))
+ if (!(c->interfaces[i].cls = class_getconstant(c, suck_u2(cb), CONSTANT_Class)))
goto return_exception;
}
}
/* Setup the array class */
- c->super = class_java_lang_Object;
+ c->super.cls = class_java_lang_Object;
c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT;
c->interfacescount = 2;
- c->interfaces = MNEW(classinfo*, 2);
+ c->interfaces = MNEW(classref_or_classinfo, 2);
if (opt_eager) {
classinfo *tc;
tc = class_java_lang_Cloneable;
load_class_bootstrap(tc);
list_addfirst(&unlinkedclasses, tc);
- c->interfaces[0] = tc;
+ c->interfaces[0].cls = tc;
tc = class_java_io_Serializable;
load_class_bootstrap(tc);
list_addfirst(&unlinkedclasses, tc);
- c->interfaces[1] = tc;
+ c->interfaces[1].cls = tc;
} else {
- c->interfaces[0] = class_java_lang_Cloneable;
- c->interfaces[1] = class_java_io_Serializable;
+ c->interfaces[0].cls = class_java_lang_Cloneable;
+ c->interfaces[1].cls = class_java_io_Serializable;
}
c->methodscount = 1;
/* try superinterfaces recursively */
for (i = 0; i < c->interfacescount; i++) {
- fi = class_resolvefield_int(c->interfaces[i], name, desc);
+ fi = class_resolvefield_int(c->interfaces[i].cls, name, desc);
if (fi)
return fi;
}
/* try superclass */
- if (c->super)
- return class_resolvefield_int(c->super, name, desc);
+ if (c->super.cls)
+ return class_resolvefield_int(c->super.cls, name, desc);
/* not found */
/* method found */
if (m) return m;
/* search superclass */
- c = c->super;
+ c = c->super.cls;
}
return NULL;
if (m)
return m;
- c = c->super;
+ c = c->super.cls;
}
return NULL;
/* try the superinterfaces */
for (i = 0; i < c->interfacescount; i++) {
- m = class_resolveinterfacemethod_intern(c->interfaces[i], name, desc);
+ m = class_resolveinterfacemethod_intern(c->interfaces[i].cls, name, desc);
if (m)
return m;
if (mi)
goto found;
- cls = cls->super;
+ cls = cls->super.cls;
}
/* try the superinterfaces */
for (i = 0; i < c->interfacescount; i++) {
- mi = class_resolveinterfacemethod_intern(c->interfaces[i], name, desc);
+ mi = class_resolveinterfacemethod_intern(c->interfaces[i].cls, name, desc);
if (mi)
goto found;
for (;;) {
if (!sub) return false;
if (sub == super) return true;
- sub = sub->super;
+ sub = sub->super.cls;
}
}
/* initialize super class */
- if (c->super) {
- if (!c->super->initialized) {
+ if (c->super.cls) {
+ if (!c->super.cls->initialized) {
if (initverbose) {
char logtext[MAXLOGTEXT];
sprintf(logtext, "Initialize super class ");
- utf_sprint_classname(logtext + strlen(logtext), c->super->name);
+ utf_sprint_classname(logtext + strlen(logtext), c->super.cls->name);
sprintf(logtext + strlen(logtext), " from ");
utf_sprint_classname(logtext + strlen(logtext), c->name);
log_text(logtext);
}
- if (!class_init(c->super))
+ if (!class_init(c->super.cls))
return NULL;
}
}
/* initialize interface classes */
for (i = 0; i < c->interfacescount; i++) {
- if (!c->interfaces[i]->initialized) {
+ if (!c->interfaces[i].cls->initialized) {
if (initverbose) {
char logtext[MAXLOGTEXT];
sprintf(logtext, "Initialize interface class ");
- utf_sprint_classname(logtext + strlen(logtext), c->interfaces[i]->name);
+ utf_sprint_classname(logtext + strlen(logtext), c->interfaces[i].cls->name);
sprintf(logtext + strlen(logtext), " from ");
utf_sprint_classname(logtext + strlen(logtext), c->name);
log_text(logtext);
}
- if (!class_init(c->interfaces[i]))
+ if (!class_init(c->interfaces[i].cls))
return NULL;
}
}
printf ("Flags: "); printflags (c->flags); printf ("\n");
printf ("This: "); utf_display (c->name); printf ("\n");
- if (c->super) {
- printf ("Super: "); utf_display (c->super->name); printf ("\n");
+ if (c->super.cls) {
+ printf ("Super: "); utf_display (c->super.cls->name); printf ("\n");
}
printf ("Index: %d\n", c->index);
printf ("interfaces:\n");
for (i=0; i < c-> interfacescount; i++) {
printf (" ");
- utf_display (c -> interfaces[i] -> name);
- printf (" (%d)\n", c->interfaces[i] -> index);
+ utf_display (c -> interfaces[i].cls -> name);
+ printf (" (%d)\n", c->interfaces[i].cls -> index);
}
printf ("fields:\n");
Authors: Reinhard Grafl
- $Id: loader.h 2182 2005-04-01 20:56:33Z edwin $
+ $Id: loader.h 2186 2005-04-02 00:43:25Z edwin $
*/
/* (used by class_new, don't use directly) */
void class_new_array(classinfo *c);
+/* debug helpers */
+void fprintflags(FILE *fp, u2 f);
+void printflags(u2 f);
+
#endif /* _LOADER_H */
Edwin Steiner
Christian Thalinger
- $Id: method.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: method.c 2186 2005-04-02 00:43:25Z edwin $
*/
#include "mm/memory.h"
#include "vm/method.h"
#include "vm/class.h"
+#include "vm/loader.h"
#include "vm/jit/codegen.inc.h"
Changes:
- $Id: resolve.c 2182 2005-04-01 20:56:33Z edwin $
+ $Id: resolve.c 2186 2005-04-02 00:43:25Z edwin $
*/
*result = NULL;
+#ifdef RESOLVE_VERBOSE
+ fprintf(stderr,"resolve_class_from_typedesc(");
+ descriptor_debug_print_typedesc(stderr,d);
+ fprintf(stderr,",%i)\n",link);
+#endif
+
if (d->classref) {
/* a reference type */
if (!resolve_classref_or_classinfo(NULL,CLASSREF_OR_CLASSINFO(d->classref),
else {
/* a primitive type */
cls = primitivetype_table[d->decltype].class_primitive;
+ RESOLVE_ASSERT(cls->loaded);
if (!cls->linked)
if (!link_class(cls))
return false; /* exception */
}
+ RESOLVE_ASSERT(cls);
+ RESOLVE_ASSERT(cls->loaded);
+ RESOLVE_ASSERT(!link || cls->linked);
+
+#ifdef RESOLVE_VERBOSE
+ fprintf(stderr," result = ");utf_fprint(stderr,cls->name);fprintf(stderr,"\n");
+#endif
*result = cls;
return true;