1 /* src/vm/loader.hpp - 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/descriptor.hpp"
41 #include "vm/class.hpp"
42 #include "vm/global.h"
43 #include "vm/method.hpp"
44 #include "vm/references.h"
48 /* constant pool entries *******************************************************
50 All constant pool entries need a data structure which contain the entrys
51 value. In some cases this structure exist already, in the remaining cases
52 this structure must be generated:
54 kind structure generated?
55 ----------------------------------------------------------------------
56 CONSTANT_Class constant_classref yes
57 CONSTANT_Fieldref constant_FMIref yes
58 CONSTANT_Methodref constant_FMIref yes
59 CONSTANT_InterfaceMethodref constant_FMIref yes
60 CONSTANT_String unicode no
61 CONSTANT_Integer constant_integer yes
62 CONSTANT_Float constant_float yes
63 CONSTANT_Long constant_long yes
64 CONSTANT_Double constant_double yes
65 CONSTANT_NameAndType constant_nameandtype yes
66 CONSTANT_Utf8 unicode no
69 *******************************************************************************/
71 typedef struct { /* Integer */
76 typedef struct { /* Float */
81 typedef struct { /* Long */
86 typedef struct { /* Double */
91 typedef struct { /* NameAndType (Field or Method) */
92 utf *name; /* field/method name */
93 utf *descriptor; /* field/method type descriptor string */
94 } constant_nameandtype;
97 /* classbuffer ****************************************************************/
100 classinfo *clazz; /* pointer to classinfo structure */
101 uint8_t *data; /* pointer to byte code */
102 int32_t size; /* size of the byte code */
103 uint8_t *pos; /* current read position */
104 char *path; /* path to file (for debugging) */
108 /* hashtable_classloader_entry *************************************************
110 ATTENTION: The pointer to the classloader object needs to be the
111 first field of the entry, so that it can be used as an indirection
112 cell. This is checked by gc_init() during startup.
114 *******************************************************************************/
116 typedef struct hashtable_classloader_entry hashtable_classloader_entry;
118 struct hashtable_classloader_entry {
119 java_object_t *object;
120 hashtable_classloader_entry *hashlink;
124 /* classloader *****************************************************************
126 [!ENABLE_HANDLES]: The classloader is a Java Object which cannot move.
127 [ENABLE_HANDLES] : The classloader entry itself is a static handle for a
128 given classloader (use loader_hashtable_classloader_foo).
130 *******************************************************************************/
132 #if defined(ENABLE_HANDLES)
133 typedef hashtable_classloader_entry classloader_t;
135 typedef java_object_t classloader_t;
139 /* function prototypes ********************************************************/
145 void loader_preinit(void);
146 void loader_init(void);
148 /* classloader management functions */
149 classloader_t *loader_hashtable_classloader_add(java_handle_t *cl);
150 classloader_t *loader_hashtable_classloader_find(java_handle_t *cl);
152 void loader_load_all_classes(void);
154 bool loader_skip_attribute_body(classbuffer *cb);
156 #if defined(ENABLE_JAVASE)
157 bool loader_load_attribute_signature(classbuffer *cb, utf **signature);
161 void loader_close(void);
163 /* class loading functions */
164 classinfo *load_class_from_sysloader(utf *name);
165 classinfo *load_class_from_classloader(utf *name, classloader_t *cl);
166 classinfo *load_class_bootstrap(utf *name);
168 /* (don't use the following directly) */
169 classinfo *load_class_from_classbuffer(classbuffer *cb);
170 classinfo *load_newly_created_array(classinfo *c, classloader_t *loader);
176 #endif // _LOADER_HPP
180 * These are local overrides for various environment variables in Emacs.
181 * Please do not remove this and leave it at the end of the file, where
182 * Emacs will automagically detect them.
183 * ---------------------------------------------------------------------
186 * indent-tabs-mode: t
190 * vim:noexpandtab:sw=4:ts=4: