* src/vmcore/primitive.h: Likewise.
* src/vmcore/Makefile.am (libvmcore_la_SOURCES): Removed
primitive.[ch].
* src/vmcore/primitivecore.c: New file.
* src/vm/primitive.c: Likwise.
* src/vm/primitive.h: Likewise.
* src/vm/Makefile.am (libvm_la_SOURCES): Added primitive.[ch].
* src/cacaoh/dummy.c (vm/primitive.h): Added.
(primitive_class_get_by_type): New function.
(primitive_class_get_by_char): Likewise.
* src/native/jni.c,
src/native/vm/gnu/java_lang_VMClassLoader.c,
src/native/vm/gnu/java_lang_reflect_Field.c,
src/native/vm/java_lang_Class.c,
src/native/vm/sun/jvm.c,
src/vm/builtin.c,
src/vm/jit/verify/typecheck-stackbased.c,
src/vm/jit/verify/typecheck-typeinferer.c,
src/vm/jit/verify/typecheck.c,
src/vm/jit/verify/typeinfo.c,
src/vm/resolve.c,
src/vm/string.c,
src/vm/vm.c,
src/vmcore/descriptor.c,
src/vmcore/field.c,
src/vmcore/linker.c,
src/vmcore/loader.c: Changed primitive.h include.
--HG--
rename : src/vmcore/primitive.c => src/vmcore/primitivecore.c
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: dummy.c 8236 2007-07-27 10:18:17Z twisti $
+ $Id: dummy.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "toolbox/logging.h"
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/vm.h"
#include "vmcore/class.h"
}
+/* primitive ******************************************************************/
+
+classinfo *primitive_class_get_by_type(int type)
+{
+ abort();
+ return NULL;
+}
+
+classinfo *primitive_class_get_by_char(char ch)
+{
+ abort();
+ return NULL;
+}
+
+
/* properties *****************************************************************/
void properties_add(char *key, char *value)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.c 8287 2007-08-10 15:10:29Z twisti $
+ $Id: jni.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMClassLoader.c 8062 2007-06-11 08:12:14Z twisti $
+ $Id: java_lang_VMClassLoader.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/linker.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
#include "vmcore/suck.h"
#include "vmcore/zip.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Field.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: java_lang_reflect_Field.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vm/jit/stacktrace.h"
#include "vmcore/loader.h"
-#include "vmcore/primitive.h"
#include "vmcore/utf8.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: java_lang_Class.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vmcore/class.h"
#include "vmcore/loader.h"
-#include "vmcore/primitive.h"
#if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
#include "vmcore/annotation.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jvm.c 8262 2007-08-06 12:44:01Z panzi $
+ $Id: jvm.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/properties.h"
+#include "vm/resolve.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
-#include "vm/resolve.h"
#include "vm/jit/stacktrace.h"
#include "vmcore/classcache.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
/* debugging macro ************************************************************/
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
-## $Id: Makefile.am 7869 2007-05-05 08:08:49Z pm $
+## $Id: Makefile.am 8288 2007-08-10 15:12:00Z twisti $
## Process this file with automake to produce Makefile.in
initialize.c \
initialize.h \
jit_interface.h \
+ primitive.c \
+ primitive.h \
properties.c \
properties.h \
resolve.c \
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: builtin.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/stringlocal.h"
#include "vm/jit/asmpart.h"
#include "vmcore/linker.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/rt-timing.h"
#if defined(ENABLE_VMLOG)
#include "mm/memory.h"
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/jit/parse.h"
#include "vm/jit/show.h"
#include "vm/jit/stack.h"
#include "vm/jit/verify/typecheck-common.h"
-#include "vmcore/primitive.h"
-
/* this #if runs over the whole file: */
#if defined(ENABLE_VERIFIER)
#include "vm/access.h"
#include "vm/builtin.h"
#include "vm/exceptions.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/vm.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#define TYPECHECK_NO_STATISTICS
#include <typecheck-common.h>
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: typecheck.c 8159 2007-06-28 00:31:31Z michi $
+ $Id: typecheck.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/jit/jit.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include <typecheck-common.h>
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: typeinfo.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: typeinfo.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "toolbox/logging.h"
#include "vm/exceptions.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/jit/jit.h"
#include "vmcore/class.h"
#include "vmcore/descriptor.h"
#include "vmcore/loader.h"
-#include "vmcore/primitive.h"
/* check if a linked class is an array class. Only use for linked classes! */
--- /dev/null
+/* src/vm/primitive.c - primitive types
+
+ Copyright (C) 2007 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
+
+ This file is part of CACAO.
+
+ 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.
+
+ 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.
+
+ 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.
+
+ $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+#include <stdint.h>
+
+#include "vm/global.h"
+#include "vm/primitive.h"
+
+#include "vmcore/class.h"
+#include "vmcore/utf8.h"
+
+
+/* primitive_class_get_by_name *************************************************
+
+ Returns the primitive class of the given class name.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_name(utf *name)
+{
+ int i;
+
+ /* search table of primitive classes */
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+ if (primitivetype_table[i].name == name)
+ return primitivetype_table[i].class_primitive;
+
+ /* keep compiler happy */
+
+ return NULL;
+}
+
+
+/* primitive_class_get_by_type *************************************************
+
+ Returns the primitive class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_type(int type)
+{
+ return primitivetype_table[type].class_primitive;
+}
+
+
+/* primitive_class_get_by_char *************************************************
+
+ Returns the primitive class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_class_get_by_char(char ch)
+{
+ int index;
+
+ switch (ch) {
+ case 'I':
+ index = PRIMITIVETYPE_INT;
+ break;
+ case 'J':
+ index = PRIMITIVETYPE_LONG;
+ break;
+ case 'F':
+ index = PRIMITIVETYPE_FLOAT;
+ break;
+ case 'D':
+ index = PRIMITIVETYPE_DOUBLE;
+ break;
+ case 'B':
+ index = PRIMITIVETYPE_BYTE;
+ break;
+ case 'C':
+ index = PRIMITIVETYPE_CHAR;
+ break;
+ case 'S':
+ index = PRIMITIVETYPE_SHORT;
+ break;
+ case 'Z':
+ index = PRIMITIVETYPE_BOOLEAN;
+ break;
+ case 'V':
+ index = PRIMITIVETYPE_VOID;
+ break;
+ default:
+ return NULL;
+ }
+
+ return primitivetype_table[index].class_primitive;
+}
+
+
+/* primitive_arrayclass_get_by_name ********************************************
+
+ Returns the primitive array-class of the given primitive class
+ name.
+
+*******************************************************************************/
+
+classinfo *primitive_arrayclass_get_by_name(utf *name)
+{
+ int i;
+
+ /* search table of primitive classes */
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+ if (primitivetype_table[i].name == name)
+ return primitivetype_table[i].arrayclass;
+
+ /* keep compiler happy */
+
+ return NULL;
+}
+
+
+/* primitive_arrayclass_get_by_type ********************************************
+
+ Returns the primitive array-class of the given type.
+
+*******************************************************************************/
+
+classinfo *primitive_arrayclass_get_by_type(int type)
+{
+ return primitivetype_table[type].arrayclass;
+}
+
+
+/*
+ * 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:
+ */
--- /dev/null
+/* src/vm/primitive.c - primitive types
+
+ Copyright (C) 2007 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
+
+ This file is part of CACAO.
+
+ 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.
+
+ 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.
+
+ 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.
+
+ $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#ifndef _PRIMITIVE_H
+#define _PRIMITIVE_H
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "vm/global.h"
+
+#include "vmcore/class.h"
+#include "vmcore/linker.h"
+#include "vmcore/utf8.h"
+
+
+/* primitive data types *******************************************************/
+
+/* These values are used in parsed descriptors and in some other
+ places were the different types handled internally as TYPE_INT have
+ to be distinguished. */
+
+#define PRIMITIVETYPE_COUNT 11 /* number of primitive types (+ dummies) */
+
+/* CAUTION: Don't change the numerical values! These constants are
+ used as indices into the primitive type table. */
+
+#define PRIMITIVETYPE_INT TYPE_INT
+#define PRIMITIVETYPE_LONG TYPE_LNG
+#define PRIMITIVETYPE_FLOAT TYPE_FLT
+#define PRIMITIVETYPE_DOUBLE TYPE_DBL
+#define PRIMITIVETYPE_DUMMY1 TYPE_ADR /* not used! */
+#define PRIMITIVETYPE_BYTE 5
+#define PRIMITIVETYPE_CHAR 6
+#define PRIMITIVETYPE_SHORT 7
+#define PRIMITIVETYPE_BOOLEAN 8
+#define PRIMITIVETYPE_DUMMY2 9 /* not used! */
+#define PRIMITIVETYPE_VOID TYPE_VOID
+
+
+/* CAUTION: Don't change the numerical values! These constants (with
+ the exception of ARRAYTYPE_OBJECT) are used as indices in the
+ primitive type table. */
+
+#define ARRAYTYPE_INT PRIMITIVETYPE_INT
+#define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
+#define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
+#define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
+#define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
+#define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
+#define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
+#define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
+#define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
+
+
+/* primitivetypeinfo **********************************************************/
+
+struct primitivetypeinfo {
+ char *cname; /* char name of primitive class */
+ utf *name; /* name of primitive class */
+ classinfo *class_wrap; /* class for wrapping primitive type */
+ classinfo *class_primitive; /* primitive class */
+ char *wrapname; /* name of class for wrapping */
+ char typesig; /* one character type signature */
+ char *arrayname; /* name of primitive array class */
+ classinfo *arrayclass; /* primitive array class */
+};
+
+
+/* global variables ***********************************************************/
+
+/* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
+ constants (except ARRAYTYPE_OBJECT). */
+
+extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
+
+
+/* function prototypes ********************************************************/
+
+/* this function is in src/vmcore/primitivecore.c */
+bool primitive_init(void);
+
+classinfo *primitive_class_get_by_name(utf *name);
+classinfo *primitive_class_get_by_type(int type);
+classinfo *primitive_class_get_by_char(char ch);
+classinfo *primitive_arrayclass_get_by_name(utf *name);
+classinfo *primitive_arrayclass_get_by_type(int type);
+
+#endif /* _PRIMITIVE_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:
+ */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: resolve.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: resolve.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/access.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/resolve.h"
#include "vm/jit/jit.h"
#include "vmcore/linker.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
/******************************************************************************/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: string.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: string.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/builtin.h"
#include "vm/exceptions.h"
+#include "vm/primitive.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
#include "vmcore/utf8.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: vm.c 8284 2007-08-10 08:58:39Z michi $
+ $Id: vm.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/finalizer.h"
#include "vm/global.h"
#include "vm/initialize.h"
+#include "vm/primitive.h"
#include "vm/properties.h"
#include "vm/signallocal.h"
#include "vm/stringlocal.h"
#include "vmcore/classcache.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/statistics.h"
#include "vmcore/suck.h"
method.h \
options.c \
options.h \
- primitive.c \
- primitive.h \
+ primitivecore.c \
references.h \
$(RT_TIMING_SOURCES) \
$(STACKMAP_SOURCES) \
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: descriptor.c 8233 2007-07-25 15:11:20Z twisti $
+ $Id: descriptor.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/exceptions.h"
#include "vm/jit_interface.h"
+#include "vm/primitive.h"
#include "vm/vm.h"
#include "vmcore/descriptor.h"
-#include "vmcore/primitive.h"
#include "vmcore/options.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: field.c 8268 2007-08-07 13:24:43Z twisti $
+ $Id: field.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/field.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/references.h"
#include "vmcore/suck.h"
#include "vmcore/utf8.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.c 8286 2007-08-10 10:46:17Z michi $
+ $Id: linker.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/access.h"
#include "vm/exceptions.h"
+#include "vm/primitive.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/classcache.h"
#include "vmcore/loader.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/rt-timing.h"
/* #include "vm/resolve.h" */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: loader.c 8268 2007-08-07 13:24:43Z twisti $
+ $Id: loader.c 8288 2007-08-10 15:12:00Z twisti $
*/
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/global.h"
+#include "vm/primitive.h"
#include "vm/stringlocal.h"
#include "vm/vm.h"
#include "vmcore/loader.h"
#include "vmcore/method.h"
#include "vmcore/options.h"
-#include "vmcore/primitive.h"
#include "vmcore/rt-timing.h"
#if defined(ENABLE_STATISTICS)
+++ /dev/null
-/* src/vmcore/primitive.c - primitive types
-
- Copyright (C) 2007 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
-
- This file is part of CACAO.
-
- 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.
-
- 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.
-
- 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.
-
- $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
-
-*/
-
-
-#include "config.h"
-
-#include <assert.h>
-#include <stdint.h>
-
-#include "vm/global.h"
-
-#include "vmcore/class.h"
-#include "vmcore/primitive.h"
-#include "vmcore/utf8.h"
-
-
-/* primitivetype_table *********************************************************
-
- Structure for primitive classes: contains the class for wrapping
- the primitive type, the primitive class, the name of the class for
- wrapping, the one character type signature and the name of the
- primitive class.
-
- CAUTION: Don't change the order of the types. This table is indexed
- by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
-
-*******************************************************************************/
-
-primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
- { "int" , NULL, NULL, NULL, "java/lang/Integer", 'I', "[I", NULL },
- { "long" , NULL, NULL, NULL, "java/lang/Long", 'J', "[J", NULL },
- { "float" , NULL, NULL, NULL, "java/lang/Float", 'F', "[F", NULL },
- { "double" , NULL, NULL, NULL, "java/lang/Double", 'D', "[D", NULL },
- { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
- { "byte" , NULL, NULL, NULL, "java/lang/Byte", 'B', "[B", NULL },
- { "char" , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL },
- { "short" , NULL, NULL, NULL, "java/lang/Short", 'S', "[S", NULL },
- { "boolean" , NULL, NULL, NULL, "java/lang/Boolean", 'Z', "[Z", NULL },
- { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
-#if defined(ENABLE_JAVASE)
- { "void" , NULL, NULL, NULL, "java/lang/Void", 'V', NULL, NULL }
-#else
- { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
-#endif
-};
-
-
-/* primitive_init **************************************************************
-
- Create classes representing primitive types.
-
-*******************************************************************************/
-
-bool primitive_init(void)
-{
- utf *name;
- classinfo *c;
- utf *u;
- int i;
-
- for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
- /* skip dummies */
-
- if (primitivetype_table[i].cname == NULL)
- continue;
-
- /* create UTF-8 name */
-
- name = utf_new_char(primitivetype_table[i].cname);
-
- primitivetype_table[i].name = name;
-
- /* create primitive class */
-
- c = class_create_classinfo(name);
-
- /* primitive classes don't have a super class */
-
- c->super.any = NULL;
-
- /* set flags and mark it as primitive class */
-
- c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
-
- /* prevent loader from loading primitive class */
-
- c->state |= CLASS_LOADED;
-
- /* INFO: don't put primitive classes into the classcache */
-
- if (!link_class(c))
- return false;
-
- primitivetype_table[i].class_primitive = c;
-
- /* create class for wrapping the primitive type */
-
- u = utf_new_char(primitivetype_table[i].wrapname);
- c = load_class_bootstrap(u);
-
- if (c == NULL)
- return false;
-
- primitivetype_table[i].class_wrap = c;
-
- /* create the primitive array class */
-
- if (primitivetype_table[i].arrayname) {
- u = utf_new_char(primitivetype_table[i].arrayname);
- c = class_create_classinfo(u);
- c = load_newly_created_array(c, NULL);
-
- if (c == NULL)
- return false;
-
- primitivetype_table[i].arrayclass = c;
-
- assert(c->state & CLASS_LOADED);
-
- if (!(c->state & CLASS_LINKED))
- if (!link_class(c))
- return false;
- }
- }
-
- return true;
-}
-
-
-/* primitive_class_get_by_name *************************************************
-
- Returns the primitive class of the given class name.
-
-*******************************************************************************/
-
-classinfo *primitive_class_get_by_name(utf *name)
-{
- int i;
-
- /* search table of primitive classes */
-
- for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
- if (primitivetype_table[i].name == name)
- return primitivetype_table[i].class_primitive;
-
- /* keep compiler happy */
-
- return NULL;
-}
-
-
-/* primitive_class_get_by_type *************************************************
-
- Returns the primitive class of the given type.
-
-*******************************************************************************/
-
-classinfo *primitive_class_get_by_type(int32_t type)
-{
- return primitivetype_table[type].class_primitive;
-}
-
-
-/* primitive_class_get_by_char *************************************************
-
- Returns the primitive class of the given type.
-
-*******************************************************************************/
-
-classinfo *primitive_class_get_by_char(char ch)
-{
- int32_t index;
-
- switch (ch) {
- case 'I':
- index = PRIMITIVETYPE_INT;
- break;
- case 'J':
- index = PRIMITIVETYPE_LONG;
- break;
- case 'F':
- index = PRIMITIVETYPE_FLOAT;
- break;
- case 'D':
- index = PRIMITIVETYPE_DOUBLE;
- break;
- case 'B':
- index = PRIMITIVETYPE_BYTE;
- break;
- case 'C':
- index = PRIMITIVETYPE_CHAR;
- break;
- case 'S':
- index = PRIMITIVETYPE_SHORT;
- break;
- case 'Z':
- index = PRIMITIVETYPE_BOOLEAN;
- break;
- case 'V':
- index = PRIMITIVETYPE_VOID;
- break;
- default:
- return NULL;
- }
-
- return primitivetype_table[index].class_primitive;
-}
-
-
-/* primitive_arrayclass_get_by_name ********************************************
-
- Returns the primitive array-class of the given primitive class
- name.
-
-*******************************************************************************/
-
-classinfo *primitive_arrayclass_get_by_name(utf *name)
-{
- int i;
-
- /* search table of primitive classes */
-
- for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
- if (primitivetype_table[i].name == name)
- return primitivetype_table[i].arrayclass;
-
- /* keep compiler happy */
-
- return NULL;
-}
-
-
-/* primitive_arrayclass_get_by_type ********************************************
-
- Returns the primitive array-class of the given type.
-
-*******************************************************************************/
-
-classinfo *primitive_arrayclass_get_by_type(int32_t type)
-{
- return primitivetype_table[type].arrayclass;
-}
-
-
-/*
- * 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:
- */
+++ /dev/null
-/* src/vmcore/primitive.c - primitive types
-
- Copyright (C) 2007 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
-
- This file is part of CACAO.
-
- 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.
-
- 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.
-
- 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.
-
- $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
-
-*/
-
-
-#ifndef _PRIMITIVE_H
-#define _PRIMITIVE_H
-
-#include "config.h"
-
-#include <stdint.h>
-
-#include "vm/global.h"
-
-#include "vmcore/class.h"
-#include "vmcore/linker.h"
-#include "vmcore/utf8.h"
-
-
-/* primitive data types *******************************************************/
-
-/* These values are used in parsed descriptors and in some other
- places were the different types handled internally as TYPE_INT have
- to be distinguished. */
-
-#define PRIMITIVETYPE_COUNT 11 /* number of primitive types (+ dummies) */
-
-/* CAUTION: Don't change the numerical values! These constants are
- used as indices into the primitive type table. */
-
-#define PRIMITIVETYPE_INT TYPE_INT
-#define PRIMITIVETYPE_LONG TYPE_LNG
-#define PRIMITIVETYPE_FLOAT TYPE_FLT
-#define PRIMITIVETYPE_DOUBLE TYPE_DBL
-#define PRIMITIVETYPE_DUMMY1 TYPE_ADR /* not used! */
-#define PRIMITIVETYPE_BYTE 5
-#define PRIMITIVETYPE_CHAR 6
-#define PRIMITIVETYPE_SHORT 7
-#define PRIMITIVETYPE_BOOLEAN 8
-#define PRIMITIVETYPE_DUMMY2 9 /* not used! */
-#define PRIMITIVETYPE_VOID TYPE_VOID
-
-
-/* CAUTION: Don't change the numerical values! These constants (with
- the exception of ARRAYTYPE_OBJECT) are used as indices in the
- primitive type table. */
-
-#define ARRAYTYPE_INT PRIMITIVETYPE_INT
-#define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
-#define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
-#define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
-#define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
-#define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
-#define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
-#define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
-#define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
-
-
-/* primitivetypeinfo **********************************************************/
-
-struct primitivetypeinfo {
- char *cname; /* char name of primitive class */
- utf *name; /* name of primitive class */
- classinfo *class_wrap; /* class for wrapping primitive type */
- classinfo *class_primitive; /* primitive class */
- char *wrapname; /* name of class for wrapping */
- char typesig; /* one character type signature */
- char *arrayname; /* name of primitive array class */
- classinfo *arrayclass; /* primitive array class */
-};
-
-
-/* global variables ***********************************************************/
-
-/* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
- constants (except ARRAYTYPE_OBJECT). */
-
-extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
-
-
-/* function prototypes ********************************************************/
-
-bool primitive_init(void);
-classinfo *primitive_class_get_by_name(utf *name);
-classinfo *primitive_class_get_by_type(int32_t type);
-classinfo *primitive_class_get_by_char(char ch);
-classinfo *primitive_arrayclass_get_by_name(utf *name);
-classinfo *primitive_arrayclass_get_by_type(int32_t type);
-
-#endif /* _PRIMITIVE_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:
- */
--- /dev/null
+/* src/vmcore/primitivecore.c - core functions for primitive types
+
+ Copyright (C) 2007 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
+
+ This file is part of CACAO.
+
+ 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.
+
+ 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.
+
+ 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.
+
+ $Id: linker.c 8042 2007-06-07 17:43:29Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+#include <stdint.h>
+
+#include "vm/global.h"
+#include "vm/primitive.h"
+
+#include "vmcore/class.h"
+#include "vmcore/utf8.h"
+
+
+/* primitivetype_table *********************************************************
+
+ Structure for primitive classes: contains the class for wrapping
+ the primitive type, the primitive class, the name of the class for
+ wrapping, the one character type signature and the name of the
+ primitive class.
+
+ CAUTION: Don't change the order of the types. This table is indexed
+ by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
+
+*******************************************************************************/
+
+primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
+ { "int" , NULL, NULL, NULL, "java/lang/Integer", 'I', "[I", NULL },
+ { "long" , NULL, NULL, NULL, "java/lang/Long", 'J', "[J", NULL },
+ { "float" , NULL, NULL, NULL, "java/lang/Float", 'F', "[F", NULL },
+ { "double" , NULL, NULL, NULL, "java/lang/Double", 'D', "[D", NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
+ { "byte" , NULL, NULL, NULL, "java/lang/Byte", 'B', "[B", NULL },
+ { "char" , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL },
+ { "short" , NULL, NULL, NULL, "java/lang/Short", 'S', "[S", NULL },
+ { "boolean" , NULL, NULL, NULL, "java/lang/Boolean", 'Z', "[Z", NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
+#if defined(ENABLE_JAVASE)
+ { "void" , NULL, NULL, NULL, "java/lang/Void", 'V', NULL, NULL }
+#else
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL },
+#endif
+};
+
+
+/* primitive_init **************************************************************
+
+ Create classes representing primitive types.
+
+*******************************************************************************/
+
+bool primitive_init(void)
+{
+ utf *name;
+ classinfo *c;
+ utf *u;
+ int i;
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
+ /* skip dummies */
+
+ if (primitivetype_table[i].cname == NULL)
+ continue;
+
+ /* create UTF-8 name */
+
+ name = utf_new_char(primitivetype_table[i].cname);
+
+ primitivetype_table[i].name = name;
+
+ /* create primitive class */
+
+ c = class_create_classinfo(name);
+
+ /* primitive classes don't have a super class */
+
+ c->super.any = NULL;
+
+ /* set flags and mark it as primitive class */
+
+ c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT | ACC_CLASS_PRIMITIVE;
+
+ /* prevent loader from loading primitive class */
+
+ c->state |= CLASS_LOADED;
+
+ /* INFO: don't put primitive classes into the classcache */
+
+ if (!link_class(c))
+ return false;
+
+ primitivetype_table[i].class_primitive = c;
+
+ /* create class for wrapping the primitive type */
+
+ u = utf_new_char(primitivetype_table[i].wrapname);
+ c = load_class_bootstrap(u);
+
+ if (c == NULL)
+ return false;
+
+ primitivetype_table[i].class_wrap = c;
+
+ /* create the primitive array class */
+
+ if (primitivetype_table[i].arrayname) {
+ u = utf_new_char(primitivetype_table[i].arrayname);
+ c = class_create_classinfo(u);
+ c = load_newly_created_array(c, NULL);
+
+ if (c == NULL)
+ return false;
+
+ primitivetype_table[i].arrayclass = c;
+
+ assert(c->state & CLASS_LOADED);
+
+ if (!(c->state & CLASS_LINKED))
+ if (!link_class(c))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+/*
+ * 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:
+ */