* src/vm/jit/replace.c (replace_create_replacement_points): Don't use
[cacao.git] / src / vm / loader.h
index 57686b0845b3cdcfea460c2d755836bdc48c2eae..412553a531f1a5754a985c7ce67a279aa7e118cd 100644 (file)
-/******************************* loader.h **************************************
+/* src/vm/loader.h - class loader header
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Contains the prototypes for the class loader.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Author:  Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1997/11/14
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Contact: cacao@cacaojvm.org
+
+   Authors: Reinhard Grafl
+
+   Changes: Christian Thalinger
+
+   $Id: loader.h 4490 2006-02-12 16:02:43Z edwin $
+*/
+
+
+#ifndef _LOADER_H
+#define _LOADER_H
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include "vm/types.h"
+
+
+/* forward typedefs ***********************************************************/
+
+typedef struct classbuffer classbuffer;
+
+
+#include "vm/class.h"
+#include "vm/descriptor.h"
+#include "vm/global.h"
+#include "vm/references.h"
+#include "vm/method.h"
+#include "vm/utf8.h"
+
+
+/* constant pool entries *******************************************************
+
+       All constant pool entries need a data structure which contain the entrys
+       value. In some cases this structure exist already, in the remaining cases
+       this structure must be generated:
+
+               kind                      structure                     generated?
+       ----------------------------------------------------------------------
+    CONSTANT_Class               classinfo                           no   XXX this will change
+    CONSTANT_Fieldref            constant_FMIref                    yes
+    CONSTANT_Methodref           constant_FMIref                    yes
+    CONSTANT_InterfaceMethodref  constant_FMIref                    yes
+    CONSTANT_String              unicode                             no
+    CONSTANT_Integer             constant_integer                   yes
+    CONSTANT_Float               constant_float                     yes
+    CONSTANT_Long                constant_long                      yes
+    CONSTANT_Double              constant_double                    yes
+    CONSTANT_NameAndType         constant_nameandtype               yes
+    CONSTANT_Utf8                unicode                             no
+    CONSTANT_UNUSED              -
 
 *******************************************************************************/
 
+typedef struct {            /* Integer                                        */
+       s4 value;
+} constant_integer;
+
+       
+typedef struct {            /* Float                                          */
+       float value;
+} constant_float;
+
+
+typedef struct {            /* Long                                           */
+       s8 value;
+} constant_long;
+       
+
+typedef struct {            /* Double                                         */
+       double value;
+} constant_double;
+
+
+typedef struct {            /* NameAndType (Field or Method)                  */
+       utf *name;              /* field/method name                              */
+       utf *descriptor;        /* field/method type descriptor string            */
+} constant_nameandtype;
 
-/************************* program switches ***********************************/
 
-extern bool loadverbose;         /* Debug-Meldungen beim Laden ausgeben */
-extern bool linkverbose;
-extern bool initverbose;         /* Meldungen ausgeben, wenn Klasse 
-                                   initialisiert wird */
-extern bool makeinitializations; /* Klassen automatisch initialisieren */
+/* classbuffer ****************************************************************/
 
-extern bool getloadingtime;
-extern long int loadingtime;     /* CPU-Zeit f"urs Laden der Klassen */
+struct classbuffer {
+       classinfo *class;                   /* pointer to classinfo structure     */
+       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)       */
+};
 
-extern list linkedclasses;       /* Liste aller fertig gelinkten Klassen */
 
+/* export variables ***********************************************************/
 
-/************************ prototypes ******************************************/
+#if defined(USE_THREADS)
+extern int blockInts;
+#endif
 
-void loader_init ();
-void loader_close ();
 
-classinfo *loader_load (unicode *topname);
-void loader_initclasses ();
-void loader_compute_subclasses ();
+/* function prototypes ********************************************************/
 
-classinfo *class_get (unicode *name);
-voidptr class_getconstant (classinfo *class, u4 pos, u4 ctype);
-u4 class_constanttype (classinfo *class, u4 pos);
+/* initialize loader, load important systemclasses */
+bool loader_init(u1 *stackbottom);
 
-fieldinfo *class_findfield (classinfo *c, unicode *name, unicode *desc);
-methodinfo *class_findmethod (classinfo *c, unicode *name, unicode *desc);
+void loader_load_all_classes(void);
 
-methodinfo *class_resolvemethod (classinfo *c, unicode *name, unicode *dest);
+/* free resources */
+void loader_close(void);
 
-bool class_issubclass (classinfo *sub, classinfo *super);
+/* class loading functions */
+classinfo *load_class_from_sysloader(utf *name);
+classinfo *load_class_from_classloader(utf *name, java_objectheader *cl);
+classinfo *load_class_bootstrap(utf *name);
 
-void class_init (classinfo *c);
+/* (don't use the following directly) */
+classinfo *load_class_from_classbuffer(classbuffer *cb);
+classinfo *load_newly_created_array(classinfo *c,java_objectheader *loader);
 
-void class_showmethods (classinfo *c);
-void class_showconstantpool (classinfo *c);
+#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
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */