1 /* src/vmcore/loader.h - class loader header
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 /* forward typedefs ***********************************************************/
31 typedef struct classbuffer classbuffer;
40 #include "vm/global.h"
42 #include "vmcore/descriptor.h"
43 #include "vmcore/class.h"
44 #include "vmcore/method.h"
45 #include "vmcore/references.h"
46 #include "vmcore/utf8.h"
49 /* constant pool entries *******************************************************
51 All constant pool entries need a data structure which contain the entrys
52 value. In some cases this structure exist already, in the remaining cases
53 this structure must be generated:
55 kind structure generated?
56 ----------------------------------------------------------------------
57 CONSTANT_Class constant_classref yes
58 CONSTANT_Fieldref constant_FMIref yes
59 CONSTANT_Methodref constant_FMIref yes
60 CONSTANT_InterfaceMethodref constant_FMIref yes
61 CONSTANT_String unicode no
62 CONSTANT_Integer constant_integer yes
63 CONSTANT_Float constant_float yes
64 CONSTANT_Long constant_long yes
65 CONSTANT_Double constant_double yes
66 CONSTANT_NameAndType constant_nameandtype yes
67 CONSTANT_Utf8 unicode no
70 *******************************************************************************/
72 typedef struct { /* Integer */
77 typedef struct { /* Float */
82 typedef struct { /* Long */
87 typedef struct { /* Double */
92 typedef struct { /* NameAndType (Field or Method) */
93 utf *name; /* field/method name */
94 utf *descriptor; /* field/method type descriptor string */
95 } constant_nameandtype;
98 /* classbuffer ****************************************************************/
101 classinfo *clazz; /* pointer to classinfo structure */
102 uint8_t *data; /* pointer to byte code */
103 int32_t size; /* size of the byte code */
104 uint8_t *pos; /* current read position */
105 char *path; /* path to file (for debugging) */
109 /* hashtable_classloader_entry *************************************************
111 ATTENTION: The pointer to the classloader object needs to be the
112 first field of the entry, so that it can be used as an indirection
113 cell. This is checked by gc_init() during startup.
115 *******************************************************************************/
117 typedef struct hashtable_classloader_entry hashtable_classloader_entry;
119 struct hashtable_classloader_entry {
120 java_object_t *object;
121 hashtable_classloader_entry *hashlink;
125 /* classloader *****************************************************************
127 [!ENABLE_HANDLES]: The classloader is a Java Object which cannot move.
128 [ENABLE_HANDLES] : The classloader entry itself is a static handle for a
129 given classloader (use loader_hashtable_classloader_foo).
131 *******************************************************************************/
133 #if defined(ENABLE_HANDLES)
134 typedef hashtable_classloader_entry classloader_t;
136 typedef java_object_t classloader_t;
140 /* function prototypes ********************************************************/
142 void loader_preinit(void);
143 void loader_init(void);
145 /* classloader management functions */
146 classloader_t *loader_hashtable_classloader_add(java_handle_t *cl);
147 classloader_t *loader_hashtable_classloader_find(java_handle_t *cl);
149 void loader_load_all_classes(void);
151 bool loader_skip_attribute_body(classbuffer *cb);
153 #if defined(ENABLE_JAVASE)
154 bool loader_load_attribute_signature(classbuffer *cb, utf **signature);
158 void loader_close(void);
160 /* class loading functions */
161 classinfo *load_class_from_sysloader(utf *name);
162 classinfo *load_class_from_classloader(utf *name, classloader_t *cl);
163 classinfo *load_class_bootstrap(utf *name);
165 /* (don't use the following directly) */
166 classinfo *load_class_from_classbuffer(classbuffer *cb);
167 classinfo *load_newly_created_array(classinfo *c, classloader_t *loader);
169 #endif /* _LOADER_H */
172 * These are local overrides for various environment variables in Emacs.
173 * Please do not remove this and leave it at the end of the file, where
174 * Emacs will automagically detect them.
175 * ---------------------------------------------------------------------
178 * indent-tabs-mode: t
182 * vim:noexpandtab:sw=4:ts=4: