* renamed CACAO_TYPECHECK to ENABLE_VERIFIER
[cacao.git] / src / vm / loader.h
index 52dd1f53f847dee4b634c5cb78d7fee81d66866e..1bd005f6f4202717d9f451e974a366fb4d6ec44a 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Reinhard Grafl
 
-   $Id: loader.h 2154 2005-03-30 20:03:06Z twisti $
+   $Id: loader.h 3501 2005-10-26 20:27:15Z twisti $
 */
 
 
@@ -42,13 +42,11 @@ typedef struct classbuffer classbuffer;
 typedef struct classpath_info classpath_info;
 
 
-#include "config.h"
-#include "types.h"
-#include "vm/class.h"
-#include "vm/descriptor.h"
 #include "vm/global.h"
-#include "vm/method.h"
 #include "vm/utf8.h"
+#include "vm/references.h"
+#include "vm/descriptor.h"
+#include "vm/method.h"
 
 #if defined(USE_ZLIB)
 # include "vm/unzip.h"
@@ -86,15 +84,6 @@ typedef struct classpath_info classpath_info;
 
 *******************************************************************************/
 
-typedef struct {            /* Fieldref, Methodref and InterfaceMethodref     */
-       classinfo *class;       /* class containing this field/method/intfmeth.   */ /* XXX remove */
-       constant_classref *classref;  /* class containing this field/meth./intfm. */
-       utf       *name;        /* field/method/interfacemethod name              */
-       utf       *descriptor;  /* field/method/intfmeth. type descriptor string  */
-       parseddesc parseddesc;  /* parsed descriptor                              */
-} constant_FMIref;
-
-
 typedef struct {            /* Integer                                        */
        s4 value;
 } constant_integer;
@@ -128,6 +117,7 @@ struct classbuffer {
        u1        *data;                    /* pointer to byte code               */
        s4         size;                    /* size of the byte code              */
        u1        *pos;                     /* current read position              */
+       char      *path;                    /* path to file (for debugging)       */
 };
 
 
@@ -166,7 +156,7 @@ extern classpath_info *classpath_entries;
 bool loader_init(u1 *stackbottom);
 
 void suck_init(char *cpath);
-void create_all_classes(void);
+void loader_load_all_classes(void);
 void suck_stop(classbuffer *cb);
 
 inline bool check_classbuffer_size(classbuffer *cb, s4 len);
@@ -179,69 +169,23 @@ inline u4 suck_u4(classbuffer *cb);
 void loader_close(void);
 
 /* class loading functions */
-classinfo *load_class_from_classloader(classinfo *c, java_objectheader *cl);
-classinfo *load_class_bootstrap(classinfo *c);
-classinfo *load_class_from_classbuffer(classbuffer *cb);
-
-
-/* retrieve constantpool element */
-voidptr class_getconstant(classinfo *class, u4 pos, u4 ctype);
-
-/* determine type of a constantpool element */
-u4 class_constanttype(classinfo *class, u4 pos);
+classinfo *load_class_from_sysloader(utf *name);
+classinfo *load_class_from_classloader(utf *name, java_objectheader *cl);
+classinfo *load_class_bootstrap(utf *name);
 
-/* search class for a field */
-fieldinfo *class_findfield(classinfo *c, utf *name, utf *desc);
-fieldinfo *class_resolvefield(classinfo *c, utf *name, utf *desc, classinfo *referer, bool except);
-
-/* search for a method with a specified name and descriptor */
-methodinfo *class_findmethod(classinfo *c, utf *name, utf *desc);
-methodinfo *class_fetchmethod(classinfo *c, utf *name, utf *desc);
-methodinfo *class_resolvemethod(classinfo *c, utf *name, utf *dest);
-methodinfo *class_resolveclassmethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool except);
-methodinfo *class_resolveinterfacemethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool except);
-
-/* search for a method with specified name and arguments (returntype ignored) */
-methodinfo *class_findmethod_approx(classinfo *c, utf *name, utf *desc);
-methodinfo *class_resolvemethod_approx(classinfo *c, utf *name, utf *dest);
-
-bool class_issubclass(classinfo *sub, classinfo *super);
-
-/* call initializer of class */
-classinfo *class_init(classinfo *c);
-
-/* debug purposes */
-void class_showmethods(classinfo *c);
-void class_showconstantpool(classinfo *c);
-void print_arraydescriptor(FILE *file, arraydescriptor *desc);
+/* (don't use the following directly) */
+classinfo *load_class_from_classbuffer(classbuffer *cb);
+classinfo *load_newly_created_array(classinfo *c,java_objectheader *loader);
 
 /* return the primitive class inidicated by the given signature character */
 classinfo *class_primitive_from_sig(char sig);
 
-
-/* return the class indicated by the given descriptor */
-/* (see loader.c for documentation) */
-#define CLASSLOAD_NEW           0      /* default */
-#define CLASSLOAD_LOAD          0x0001
-#define CLASSLOAD_SKIP          0x0002
-#define CLASSLOAD_PANIC         0      /* default */
-#define CLASSLOAD_NOPANIC       0x0010
-#define CLASSLOAD_PRIMITIVE     0      /* default */
-#define CLASSLOAD_NULLPRIMITIVE 0x0020
-#define CLASSLOAD_VOID          0      /* default */
-#define CLASSLOAD_NOVOID        0x0040
-#define CLASSLOAD_NOCHECKEND    0      /* default */
-#define CLASSLOAD_CHECKEND      0x1000
-
-classinfo *class_from_descriptor(char *utf_ptr,char *end_ptr,char **next,int mode);
-int type_from_descriptor(classinfo **cls,char *utf_ptr,char *end_ptr,char **next,int mode);
-
-/* (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 */
 
-
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where