1 /* src/vmcore/primitivecore.c - core functions for primitive types
3 Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
35 #include "vm/global.h"
36 #include "vm/primitive.h"
38 #include "vmcore/class.h"
39 #include "vmcore/utf8.h"
42 /* primitivetype_table *********************************************************
44 Structure for primitive classes: contains the class for wrapping
45 the primitive type, the primitive class, the name of the class for
46 wrapping, the one character type signature and the name of the
49 CAUTION: Don't change the order of the types. This table is indexed
50 by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
52 *******************************************************************************/
54 primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
55 { "int" , NULL, NULL, NULL, "java/lang/Integer", 'I', "[I", NULL },
56 { "long" , NULL, NULL, NULL, "java/lang/Long", 'J', "[J", NULL },
57 { "float" , NULL, NULL, NULL, "java/lang/Float", 'F', "[F", NULL },
58 { "double" , NULL, NULL, NULL, "java/lang/Double", 'D', "[D", NULL },
59 { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
60 { "byte" , NULL, NULL, NULL, "java/lang/Byte", 'B', "[B", NULL },
61 { "char" , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL },
62 { "short" , NULL, NULL, NULL, "java/lang/Short", 'S', "[S", NULL },
63 { "boolean" , NULL, NULL, NULL, "java/lang/Boolean", 'Z', "[Z", NULL },
64 { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
65 #if defined(ENABLE_JAVASE)
66 { "void" , NULL, NULL, NULL, "java/lang/Void", 'V', NULL, NULL }
68 { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
73 /* primitive_init **************************************************************
75 Create classes representing primitive types.
77 *******************************************************************************/
79 bool primitive_init(void)
86 for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
89 if (primitivetype_table[i].cname == NULL)
92 /* create UTF-8 name */
94 name = utf_new_char(primitivetype_table[i].cname);
96 primitivetype_table[i].name = name;
98 /* create primitive class */
100 c = class_create_classinfo(name);
102 /* primitive classes don't have a super class */
106 /* set flags and mark it as primitive class */
108 c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
110 /* prevent loader from loading primitive class */
112 c->state |= CLASS_LOADED;
114 /* INFO: don't put primitive classes into the classcache */
119 primitivetype_table[i].class_primitive = c;
121 /* create class for wrapping the primitive type */
123 u = utf_new_char(primitivetype_table[i].wrapname);
124 c = load_class_bootstrap(u);
129 primitivetype_table[i].class_wrap = c;
131 /* create the primitive array class */
133 if (primitivetype_table[i].arrayname) {
134 u = utf_new_char(primitivetype_table[i].arrayname);
135 c = class_create_classinfo(u);
136 c = load_newly_created_array(c, NULL);
141 primitivetype_table[i].arrayclass = c;
143 assert(c->state & CLASS_LOADED);
145 if (!(c->state & CLASS_LINKED))
156 * These are local overrides for various environment variables in Emacs.
157 * Please do not remove this and leave it at the end of the file, where
158 * Emacs will automagically detect them.
159 * ---------------------------------------------------------------------
162 * indent-tabs-mode: t
166 * vim:noexpandtab:sw=4:ts=4: