Authors: Edwin Steiner
- $Id: typeinfo.c 887 2004-01-19 12:14:39Z edwin $
+ $Id: typeinfo.c 1296 2004-07-10 17:02:15Z stefan $
*/
#include "typeinfo.h"
#include "tables.h"
#include "loader.h"
-#include "toolbox/loging.h"
+#include "toolbox/logging.h"
#include "toolbox/memory.h"
#include "jit/jit.h" /* XXX move typeinfo.* into jit/ */
if (!v && separable) return true;
} while (v);
next_index:
+ ;
}
return false;
}
bool
classinfo_implements_interface(classinfo *cls,classinfo *interf)
{
+ if (!cls->loaded)
+ if (!class_load(cls))
+ return false;
+
+ if (!cls->linked)
+ if (!class_link(cls))
+ return false;
+
if (cls->flags & ACC_INTERFACE) {
/* cls is an interface */
if (cls == interf)
if (!cls || !dest)
return false;
+ /* maybe we need to load and link the class */
+ if (!cls->loaded)
+ class_load(cls);
+
+ if (!cls->linked)
+ class_link(cls);
+
#ifdef TYPEINFO_DEBUG
if (!dest->linked)
panic("Internal error: typeinfo_is_assignable_to_classinfo: unlinked class.");
| CLASSLOAD_NOVOID
| CLASSLOAD_CHECKEND);
- if (cls)
+ if (cls) {
+ if (!cls->loaded)
+ class_load(cls);
+
+ if (!cls->linked)
+ class_link(cls);
+
/* a class, interface or array descriptor */
TYPEINFO_INIT_CLASSINFO(*info,cls);
- else
+ } else {
/* a primitive type */
TYPEINFO_INIT_PRIMITIVE(*info);
+ }
}
int
| CLASSLOAD_NULLPRIMITIVE
| CLASSLOAD_NOVOID);
- if (cls)
- TYPEINFO_INIT_CLASSINFO(*infobuf,cls);
- else {
+ if (cls) {
+ if (!cls->loaded)
+ class_load(cls);
+
+ if (!cls->linked)
+ class_link(cls);
+
+ TYPEINFO_INIT_CLASSINFO(*infobuf, cls);
+
+ } else {
TYPEINFO_INIT_PRIMITIVE(*infobuf);
}
infobuf++;
CLASSLOAD_NULLPRIMITIVE
| CLASSLOAD_NEW
| CLASSLOAD_CHECKEND);
+
if (returntypeinfo) {
- if (cls)
- TYPEINFO_INIT_CLASSINFO(*returntypeinfo,cls);
- else
+ if (cls) {
+ if (!cls->loaded)
+ class_load(cls);
+
+ if (!cls->linked)
+ class_link(cls);
+
+ TYPEINFO_INIT_CLASSINFO(*returntypeinfo, cls);
+
+ } else {
TYPEINFO_INIT_PRIMITIVE(*returntypeinfo);
+ }
}
}
}
| CLASSLOAD_NULLPRIMITIVE
| CLASSLOAD_NOVOID);
- if (cls)
- TYPEINFO_INIT_CLASSINFO(td->info,cls);
- else {
+ if (cls) {
+ if (!cls->loaded)
+ class_load(cls);
+
+ if (!cls->linked)
+ class_link(cls);
+
+ TYPEINFO_INIT_CLASSINFO(td->info, cls);
+
+ } else {
TYPEINFO_INIT_PRIMITIVE(td->info);
}
td++;
CLASSLOAD_NULLPRIMITIVE
| CLASSLOAD_NEW
| CLASSLOAD_CHECKEND);
- if (cls)
+ if (cls) {
+ if (!cls->loaded)
+ class_load(cls);
+
+ if (!cls->linked)
+ class_link(cls);
+
TYPEINFO_INIT_CLASSINFO(returntype->info,cls);
- else
+
+ } else {
TYPEINFO_INIT_PRIMITIVE(returntype->info);
+ }
}
return args;
}
void
typeinfo_init_component(typeinfo *srcarray,typeinfo *dst)
{
- vftbl *comp = NULL;
+ vftbl_t *comp = NULL;
if (TYPEINFO_IS_NULLTYPE(*srcarray)) {
TYPEINFO_INIT_NULLTYPE(*dst);
#endif
*/
+ /* check clsx */
+ if (!clsx->loaded)
+ if (!class_load(clsx))
+ return false;
+
+ if (!clsx->linked)
+ if (!class_link(clsx))
+ return false;
+
+ /* check clsy */
+ if (!clsy->loaded)
+ if (!class_load(clsy))
+ return false;
+
+ if (!clsy->linked)
+ if (!class_link(clsy))
+ return false;
+
/* Common case: clsx == clsy */
/* (This case is very simple unless *both* x and y really represent
* merges of subclasses of clsx==clsy.)