From 1e451641cd73e49b235cfe9a844e4f0df268ac4e Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Fri, 18 Jul 2008 14:21:16 +0200 Subject: [PATCH] * src/vmcore/globals.cpp: New file. * src/vmcore/globals.hpp: Likewise. * src/vmcore/Makefile.am (libvmcore_la_SOURCES): Added globals.{cpp,hpp}. * src/vmcore/class.c: Moved global variables to globals. * src/vmcore/class.h: Likewise. * src/native/jni.cpp, src/native/native.c, src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.cpp, src/native/vm/gnuclasspath/gnu_java_lang_management_VMRuntimeMXBeanImpl.c, src/native/vm/gnuclasspath/java_lang_VMClass.cpp, src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp, src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp, src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.c, src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp, src/native/vm/nativevm.c, src/native/vm/openjdk/jvm.c, src/native/vm/reflect.c, src/threads/posix/thread-posix.c, src/threads/thread.c, src/vm/access.c, src/vm/builtin.c, src/vm/exceptions.c, src/vm/initialize.c, src/vm/jit/jit.c, src/vm/jit/replace.c, src/vm/jit/stacktrace.cpp, src/vm/jit/trace.c, src/vm/jit/verify/typecheck-common.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/primitive.cpp, src/vm/resolve.c, src/vm/string.c, src/vm/vm.cpp, src/vmcore/linker.c, src/vmcore/loader.c, src/vmcore/method.c, src/vmcore/primitivecore.c (globals.hpp): Added. --- src/native/jni.cpp | 1 + src/native/native.c | 1 + .../gnu_java_lang_VMCPStringBuilder.cpp | 2 + ...java_lang_management_VMRuntimeMXBeanImpl.c | 2 +- .../vm/gnuclasspath/java_lang_VMClass.cpp | 1 + .../gnuclasspath/java_lang_VMClassLoader.cpp | 1 + .../vm/gnuclasspath/java_lang_VMThrowable.cpp | 2 +- ...java_lang_management_VMManagementFactory.c | 10 +- .../java_lang_reflect_VMMethod.cpp | 1 + src/native/vm/nativevm.c | 1 + src/native/vm/openjdk/jvm.c | 1 + src/native/vm/reflect.c | 1 + src/threads/posix/thread-posix.c | 1 + src/threads/thread.c | 1 + src/vm/access.c | 1 + src/vm/builtin.c | 1 + src/vm/exceptions.c | 1 + src/vm/initialize.c | 1 + src/vm/jit/jit.c | 1 + src/vm/jit/replace.c | 6 +- src/vm/jit/stacktrace.cpp | 1 + src/vm/jit/trace.c | 1 + src/vm/jit/verify/typecheck-common.c | 3 + src/vm/jit/verify/typecheck-stackbased.c | 2 + src/vm/jit/verify/typecheck-typeinferer.c | 1 + src/vm/jit/verify/typecheck.c | 1 + src/vm/jit/verify/typeinfo.c | 1 + src/vm/primitive.cpp | 1 + src/vm/resolve.c | 1 + src/vm/string.c | 1 + src/vm/vm.cpp | 1 + src/vmcore/Makefile.am | 2 + src/vmcore/class.c | 81 +-------- src/vmcore/class.h | 103 ------------ src/vmcore/globals.cpp | 123 ++++++++++++++ src/vmcore/globals.hpp | 159 ++++++++++++++++++ src/vmcore/linker.c | 1 + src/vmcore/loader.c | 1 + src/vmcore/method.c | 1 + src/vmcore/primitivecore.c | 1 + 40 files changed, 330 insertions(+), 193 deletions(-) create mode 100644 src/vmcore/globals.cpp create mode 100644 src/vmcore/globals.hpp diff --git a/src/native/jni.cpp b/src/native/jni.cpp index 5f4a25ef6..9fe5703a8 100644 --- a/src/native/jni.cpp +++ b/src/native/jni.cpp @@ -115,6 +115,7 @@ struct java_lang_ClassLoader; #include "vm/jit/jit.h" #include "vm/jit/stacktrace.hpp" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/options.h" #include "vmcore/statistics.h" diff --git a/src/native/native.c b/src/native/native.c index 1c0ffd916..6888466c9 100644 --- a/src/native/native.c +++ b/src/native/native.c @@ -55,6 +55,7 @@ #include "vm/jit/asmpart.h" #include "vm/jit/jit.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/options.h" #include "vmcore/system.h" diff --git a/src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.cpp b/src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.cpp index 66cc7b81a..ae2c0ed8d 100644 --- a/src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.cpp +++ b/src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.cpp @@ -41,6 +41,8 @@ extern "C" { #include "vm/builtin.h" #include "vm/exceptions.h" +#include "vmcore/globals.hpp" + /* * Class: gnu/java/lang/VMCPStringBuilder diff --git a/src/native/vm/gnuclasspath/gnu_java_lang_management_VMRuntimeMXBeanImpl.c b/src/native/vm/gnuclasspath/gnu_java_lang_management_VMRuntimeMXBeanImpl.c index 13ebe25b9..2ea12777c 100644 --- a/src/native/vm/gnuclasspath/gnu_java_lang_management_VMRuntimeMXBeanImpl.c +++ b/src/native/vm/gnuclasspath/gnu_java_lang_management_VMRuntimeMXBeanImpl.c @@ -36,7 +36,7 @@ #include "vm/global.h" #include "vm/vm.hpp" -#include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/utf8.h" diff --git a/src/native/vm/gnuclasspath/java_lang_VMClass.cpp b/src/native/vm/gnuclasspath/java_lang_VMClass.cpp index c5ed15747..4009f4495 100644 --- a/src/native/vm/gnuclasspath/java_lang_VMClass.cpp +++ b/src/native/vm/gnuclasspath/java_lang_VMClass.cpp @@ -49,6 +49,7 @@ extern "C" { #include "vm/stringlocal.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #if defined(ENABLE_ANNOTATIONS) #include "native/include/sun_reflect_ConstantPool.h" diff --git a/src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp b/src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp index 5154f8be6..4fce49717 100644 --- a/src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp +++ b/src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp @@ -65,6 +65,7 @@ extern "C" { #include "vmcore/class.h" #include "vmcore/classcache.h" +#include "vmcore/globals.hpp" #include "vmcore/linker.h" #include "vmcore/loader.h" #include "vmcore/options.h" diff --git a/src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp b/src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp index 8b192e82b..9a4f6e883 100644 --- a/src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp +++ b/src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp @@ -54,7 +54,7 @@ extern "C" { #include "vm/jit/linenumbertable.h" #include "vm/jit/stacktrace.hpp" -#include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" diff --git a/src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.c b/src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.c index 62e1a8ff8..c5331d2bf 100644 --- a/src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.c +++ b/src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.c @@ -1,9 +1,7 @@ -/* src/native/vm/gnu/java_lang_management_VMManagementFactory.c +/* src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.c - Copyright (C) 1996-2005, 2006, 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 + Copyright (C) 1996-2005, 2006, 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -40,7 +38,7 @@ #include "vm/builtin.h" -#include "vmcore/class.h" +#include "vmcore/globals.hpp" /* native methods implemented by this file ************************************/ diff --git a/src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp b/src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp index cc9ba7f83..e699056e1 100644 --- a/src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp +++ b/src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp @@ -61,6 +61,7 @@ extern "C" { #include "vm/resolve.h" #include "vm/stringlocal.h" +#include "vmcore/globals.hpp" #include "vmcore/method.h" diff --git a/src/native/vm/nativevm.c b/src/native/vm/nativevm.c index aa46de416..e5e62eefc 100644 --- a/src/native/vm/nativevm.c +++ b/src/native/vm/nativevm.c @@ -46,6 +46,7 @@ # include "vm/properties.h" # include "vm/vm.hpp" +# include "vmcore/globals.hpp" # include "vmcore/utf8.h" #endif diff --git a/src/native/vm/openjdk/jvm.c b/src/native/vm/openjdk/jvm.c index b06b56b12..e74423e3a 100644 --- a/src/native/vm/openjdk/jvm.c +++ b/src/native/vm/openjdk/jvm.c @@ -92,6 +92,7 @@ #include "vm/jit/stacktrace.hpp" #include "vmcore/classcache.h" +#include "vmcore/globals.hpp" #include "vmcore/options.h" #include "vmcore/system.h" diff --git a/src/native/vm/reflect.c b/src/native/vm/reflect.c index 311cc543e..905ea4023 100644 --- a/src/native/vm/reflect.c +++ b/src/native/vm/reflect.c @@ -66,6 +66,7 @@ #include "vm/initialize.h" #include "vm/stringlocal.h" +#include "vmcore/globals.hpp" #include "vmcore/method.h" diff --git a/src/threads/posix/thread-posix.c b/src/threads/posix/thread-posix.c index 8e0e45650..9682eba01 100644 --- a/src/threads/posix/thread-posix.c +++ b/src/threads/posix/thread-posix.c @@ -83,6 +83,7 @@ #include "vm/jit/asmpart.h" +#include "vmcore/globals.hpp" #include "vmcore/options.h" #if defined(ENABLE_STATISTICS) diff --git a/src/threads/thread.c b/src/threads/thread.c index 133bb7e98..c857e007d 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -67,6 +67,7 @@ #include "vm/jit/stacktrace.hpp" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/method.h" #include "vmcore/options.h" diff --git a/src/vm/access.c b/src/vm/access.c index 99d22406b..ee02f786c 100644 --- a/src/vm/access.c +++ b/src/vm/access.c @@ -42,6 +42,7 @@ #include "vmcore/class.h" #include "vmcore/field.h" +#include "vmcore/globals.hpp" #include "vmcore/method.h" diff --git a/src/vm/builtin.c b/src/vm/builtin.c index a13fbf3ad..578ef8ed5 100644 --- a/src/vm/builtin.c +++ b/src/vm/builtin.c @@ -72,6 +72,7 @@ #include "vm/jit/trace.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/linker.h" #include "vmcore/loader.h" #include "vmcore/options.h" diff --git a/src/vm/exceptions.c b/src/vm/exceptions.c index 96badf145..5333ca586 100644 --- a/src/vm/exceptions.c +++ b/src/vm/exceptions.c @@ -65,6 +65,7 @@ #include "vm/jit/trace.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/method.h" #include "vmcore/options.h" diff --git a/src/vm/initialize.c b/src/vm/initialize.c index 36df049d1..01eba66a5 100644 --- a/src/vm/initialize.c +++ b/src/vm/initialize.c @@ -41,6 +41,7 @@ #include "vm/jit/asmpart.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/options.h" diff --git a/src/vm/jit/jit.c b/src/vm/jit/jit.c index 971a9dd75..e83e16886 100644 --- a/src/vm/jit/jit.c +++ b/src/vm/jit/jit.c @@ -90,6 +90,7 @@ #include "vm/jit/verify/typecheck.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/method.h" #include "vmcore/options.h" diff --git a/src/vm/jit/replace.c b/src/vm/jit/replace.c index 53c13c652..0c1b15072 100644 --- a/src/vm/jit/replace.c +++ b/src/vm/jit/replace.c @@ -54,10 +54,12 @@ #include "vm/jit/show.h" #include "vm/jit/stack.h" -#include "vmcore/options.h" #include "vmcore/classcache.h" +#include "vmcore/globals.hpp" +#include "vmcore/options.h" + #if defined(ENABLE_RT_TIMING) -#include "vmcore/rt-timing.h" +# include "vmcore/rt-timing.h" #endif #define REPLACE_PATCH_DYNAMIC_CALL diff --git a/src/vm/jit/stacktrace.cpp b/src/vm/jit/stacktrace.cpp index 005546784..bd4174f01 100644 --- a/src/vm/jit/stacktrace.cpp +++ b/src/vm/jit/stacktrace.cpp @@ -69,6 +69,7 @@ #include "vm/jit/methodtree.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/method.h" #include "vmcore/options.h" diff --git a/src/vm/jit/trace.c b/src/vm/jit/trace.c index ba7599937..95852344b 100644 --- a/src/vm/jit/trace.c +++ b/src/vm/jit/trace.c @@ -48,6 +48,7 @@ #include "vm/jit/trace.h" #include "vm/jit/show.h" +#include "vmcore/globals.hpp" #include "vmcore/options.h" #include "vmcore/utf8.h" diff --git a/src/vm/jit/verify/typecheck-common.c b/src/vm/jit/verify/typecheck-common.c index 5b559438a..ffbd1d286 100644 --- a/src/vm/jit/verify/typecheck-common.c +++ b/src/vm/jit/verify/typecheck-common.c @@ -31,6 +31,9 @@ #include #include + +#include "vmcore/globals.hpp" + #include /****************************************************************************/ diff --git a/src/vm/jit/verify/typecheck-stackbased.c b/src/vm/jit/verify/typecheck-stackbased.c index ed24ea78f..0aa5ca2b9 100644 --- a/src/vm/jit/verify/typecheck-stackbased.c +++ b/src/vm/jit/verify/typecheck-stackbased.c @@ -41,6 +41,8 @@ #include "vm/jit/stack.h" #include "vm/jit/verify/typecheck-common.h" +#include "vmcore/globals.hpp" + /* this #if runs over the whole file: */ #if defined(ENABLE_VERIFIER) diff --git a/src/vm/jit/verify/typecheck-typeinferer.c b/src/vm/jit/verify/typecheck-typeinferer.c index 7ba2c6e10..accf74569 100644 --- a/src/vm/jit/verify/typecheck-typeinferer.c +++ b/src/vm/jit/verify/typecheck-typeinferer.c @@ -49,6 +49,7 @@ #include "vm/jit/verify/typecheck-typeinferer.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/options.h" diff --git a/src/vm/jit/verify/typecheck.c b/src/vm/jit/verify/typecheck.c index f76e75226..f5377f21f 100644 --- a/src/vm/jit/verify/typecheck.c +++ b/src/vm/jit/verify/typecheck.c @@ -159,6 +159,7 @@ error reporting. #include "vm/jit/parse.h" #include "vm/jit/show.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/options.h" diff --git a/src/vm/jit/verify/typeinfo.c b/src/vm/jit/verify/typeinfo.c index a235941e7..17702de34 100644 --- a/src/vm/jit/verify/typeinfo.c +++ b/src/vm/jit/verify/typeinfo.c @@ -42,6 +42,7 @@ #include "vmcore/class.h" #include "vmcore/descriptor.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" diff --git a/src/vm/primitive.cpp b/src/vm/primitive.cpp index f40a263fc..1fe9e6d0b 100644 --- a/src/vm/primitive.cpp +++ b/src/vm/primitive.cpp @@ -46,6 +46,7 @@ #include "vm/vm.hpp" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/utf8.h" diff --git a/src/vm/resolve.c b/src/vm/resolve.c index 2506af917..8a9232186 100644 --- a/src/vm/resolve.c +++ b/src/vm/resolve.c @@ -42,6 +42,7 @@ #include "vmcore/classcache.h" #include "vmcore/descriptor.h" +#include "vmcore/globals.hpp" #include "vmcore/linker.h" #include "vmcore/loader.h" #include "vmcore/options.h" diff --git a/src/vm/string.c b/src/vm/string.c index cd283d02f..c05ea3af2 100644 --- a/src/vm/string.c +++ b/src/vm/string.c @@ -49,6 +49,7 @@ #include "vm/stringlocal.h" #include "vm/vm.hpp" +#include "vmcore/globals.hpp" #include "vmcore/options.h" #include "vmcore/statistics.h" #include "vmcore/utf8.h" diff --git a/src/vm/vm.cpp b/src/vm/vm.cpp index 6dd15885e..2e03a1e87 100644 --- a/src/vm/vm.cpp +++ b/src/vm/vm.cpp @@ -109,6 +109,7 @@ #include "vm/jit/trap.h" #include "vmcore/classcache.h" +#include "vmcore/globals.hpp" #include "vmcore/options.h" #include "vmcore/statistics.h" #include "vmcore/suck.h" diff --git a/src/vmcore/Makefile.am b/src/vmcore/Makefile.am index 1b288f401..06bd0fc99 100644 --- a/src/vmcore/Makefile.am +++ b/src/vmcore/Makefile.am @@ -70,6 +70,8 @@ libvmcore_la_SOURCES = \ descriptor.h \ field.c \ field.h \ + globals.cpp \ + globals.hpp \ linker.c \ linker.h \ loader.c \ diff --git a/src/vmcore/class.c b/src/vmcore/class.c index 53aa72702..7f5479a33 100644 --- a/src/vmcore/class.c +++ b/src/vmcore/class.c @@ -52,6 +52,7 @@ #include "vmcore/class.h" #include "vmcore/classcache.h" +#include "vmcore/globals.hpp" #include "vmcore/linker.h" #include "vmcore/loader.h" #include "vmcore/options.h" @@ -75,86 +76,6 @@ java_object_t *reflect_method_new(methodinfo *m); #endif -/* global variables ***********************************************************/ - -/* frequently used classes ****************************************************/ - -/* Important system classes. */ - -classinfo *class_java_lang_Object; -classinfo *class_java_lang_Class; -classinfo *class_java_lang_ClassLoader; -classinfo *class_java_lang_Cloneable; -classinfo *class_java_lang_SecurityManager; -classinfo *class_java_lang_String; -classinfo *class_java_lang_System; -classinfo *class_java_lang_Thread; -classinfo *class_java_lang_ThreadGroup; -classinfo *class_java_lang_Throwable; -classinfo *class_java_io_Serializable; - -#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) -classinfo *class_java_lang_VMSystem; -classinfo *class_java_lang_VMThread; -classinfo *class_java_lang_VMThrowable; -#endif - -/* Important system exceptions. */ - -classinfo *class_java_lang_Exception; -classinfo *class_java_lang_ClassNotFoundException; -classinfo *class_java_lang_RuntimeException; - -#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK) -classinfo *class_sun_reflect_MagicAccessorImpl; -#endif - -#if defined(ENABLE_JAVASE) -classinfo *class_java_lang_Void; -#endif -classinfo *class_java_lang_Boolean; -classinfo *class_java_lang_Byte; -classinfo *class_java_lang_Character; -classinfo *class_java_lang_Short; -classinfo *class_java_lang_Integer; -classinfo *class_java_lang_Long; -classinfo *class_java_lang_Float; -classinfo *class_java_lang_Double; - -/* some classes which may be used more often */ - -#if defined(ENABLE_JAVASE) -classinfo *class_java_lang_StackTraceElement; -classinfo *class_java_lang_reflect_Constructor; -classinfo *class_java_lang_reflect_Field; -classinfo *class_java_lang_reflect_Method; -classinfo *class_java_security_PrivilegedAction; -classinfo *class_java_util_Vector; -classinfo *class_java_util_HashMap; - -# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) -classinfo *class_java_lang_reflect_VMConstructor; -classinfo *class_java_lang_reflect_VMField; -classinfo *class_java_lang_reflect_VMMethod; -# endif - -classinfo *arrayclass_java_lang_Object; - -# if defined(ENABLE_ANNOTATIONS) -classinfo *class_sun_reflect_ConstantPool; -# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) -classinfo *class_sun_reflect_annotation_AnnotationParser; -# endif -# endif -#endif - -/* pseudo classes for the typechecker */ - -classinfo *pseudo_class_Arraystub; -classinfo *pseudo_class_Null; -classinfo *pseudo_class_New; - - /* class_set_packagename ******************************************************* Derive the package name from the class name and store it in the diff --git a/src/vmcore/class.h b/src/vmcore/class.h index 41949152b..a5bd01031 100644 --- a/src/vmcore/class.h +++ b/src/vmcore/class.h @@ -194,109 +194,6 @@ struct extra_classref { }; -/* global variables ***********************************************************/ - -/* frequently used classes ****************************************************/ - -/* Important system classes. */ - -extern classinfo *class_java_lang_Object; -extern classinfo *class_java_lang_Class; -extern classinfo *class_java_lang_ClassLoader; -extern classinfo *class_java_lang_Cloneable; -extern classinfo *class_java_lang_SecurityManager; -extern classinfo *class_java_lang_String; -extern classinfo *class_java_lang_System; -extern classinfo *class_java_lang_Thread; -extern classinfo *class_java_lang_ThreadGroup; -extern classinfo *class_java_lang_Throwable; -extern classinfo *class_java_io_Serializable; - -/* Important system exceptions. */ - -extern classinfo *class_java_lang_Exception; -extern classinfo *class_java_lang_ClassNotFoundException; -extern classinfo *class_java_lang_RuntimeException; - -#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) -extern classinfo *class_java_lang_VMSystem; -extern classinfo *class_java_lang_VMThread; -extern classinfo *class_java_lang_VMThrowable; -#endif - -#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK) -extern classinfo *class_sun_reflect_MagicAccessorImpl; -#endif - -#if defined(ENABLE_JAVASE) -extern classinfo *class_java_lang_Void; -#endif - -extern classinfo *class_java_lang_Boolean; -extern classinfo *class_java_lang_Byte; -extern classinfo *class_java_lang_Character; -extern classinfo *class_java_lang_Short; -extern classinfo *class_java_lang_Integer; -extern classinfo *class_java_lang_Long; -extern classinfo *class_java_lang_Float; -extern classinfo *class_java_lang_Double; - -/* some classes which may be used more often */ - -#if defined(ENABLE_JAVASE) -extern classinfo *class_java_lang_StackTraceElement; -extern classinfo *class_java_lang_reflect_Constructor; -extern classinfo *class_java_lang_reflect_Field; -extern classinfo *class_java_lang_reflect_Method; -extern classinfo *class_java_security_PrivilegedAction; -extern classinfo *class_java_util_Vector; -extern classinfo *class_java_util_HashMap; - -# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) -extern classinfo *class_java_lang_reflect_VMConstructor; -extern classinfo *class_java_lang_reflect_VMField; -extern classinfo *class_java_lang_reflect_VMMethod; -# endif - -extern classinfo *arrayclass_java_lang_Object; - -# if defined(ENABLE_ANNOTATIONS) -extern classinfo *class_sun_reflect_ConstantPool; -# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) -extern classinfo *class_sun_reflect_annotation_AnnotationParser; -# endif -# endif -#endif - - -/* pseudo classes for the type checker ****************************************/ - -/* - * pseudo_class_Arraystub - * (extends Object implements Cloneable, java.io.Serializable) - * - * If two arrays of incompatible component types are merged, - * the resulting reference has no accessible components. - * The result does, however, implement the interfaces Cloneable - * and java.io.Serializable. This pseudo class is used internally - * to represent such results. (They are *not* considered arrays!) - * - * pseudo_class_Null - * - * This pseudo class is used internally to represent the - * null type. - * - * pseudo_class_New - * - * This pseudo class is used internally to represent the - * the 'uninitialized object' type. - */ - -extern classinfo *pseudo_class_Arraystub; -extern classinfo *pseudo_class_Null; -extern classinfo *pseudo_class_New; - - /* inline functions ***********************************************************/ /** diff --git a/src/vmcore/globals.cpp b/src/vmcore/globals.cpp new file mode 100644 index 000000000..e9ae1e991 --- /dev/null +++ b/src/vmcore/globals.cpp @@ -0,0 +1,123 @@ +/* src/vmcore/globals.cpp - global variables + + Copyright (C) 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO + + 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. + +*/ + + +#include "config.h" + +#include + +#include "vmcore/class.h" + + +// Classes. + +/* Important system classes. */ + +classinfo *class_java_lang_Object; +classinfo *class_java_lang_Class; +classinfo *class_java_lang_ClassLoader; +classinfo *class_java_lang_Cloneable; +classinfo *class_java_lang_SecurityManager; +classinfo *class_java_lang_String; +classinfo *class_java_lang_System; +classinfo *class_java_lang_Thread; +classinfo *class_java_lang_ThreadGroup; +classinfo *class_java_lang_Throwable; +classinfo *class_java_io_Serializable; + +#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) +classinfo *class_java_lang_VMSystem; +classinfo *class_java_lang_VMThread; +classinfo *class_java_lang_VMThrowable; +#endif + +/* Important system exceptions. */ + +classinfo *class_java_lang_Exception; +classinfo *class_java_lang_ClassNotFoundException; +classinfo *class_java_lang_RuntimeException; + +#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK) +classinfo *class_sun_reflect_MagicAccessorImpl; +#endif + +#if defined(ENABLE_JAVASE) +classinfo *class_java_lang_Void; +#endif +classinfo *class_java_lang_Boolean; +classinfo *class_java_lang_Byte; +classinfo *class_java_lang_Character; +classinfo *class_java_lang_Short; +classinfo *class_java_lang_Integer; +classinfo *class_java_lang_Long; +classinfo *class_java_lang_Float; +classinfo *class_java_lang_Double; + +/* some classes which may be used more often */ + +#if defined(ENABLE_JAVASE) +classinfo *class_java_lang_StackTraceElement; +classinfo *class_java_lang_reflect_Constructor; +classinfo *class_java_lang_reflect_Field; +classinfo *class_java_lang_reflect_Method; +classinfo *class_java_security_PrivilegedAction; +classinfo *class_java_util_Vector; +classinfo *class_java_util_HashMap; + +# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) +classinfo *class_java_lang_reflect_VMConstructor; +classinfo *class_java_lang_reflect_VMField; +classinfo *class_java_lang_reflect_VMMethod; +# endif + +classinfo *arrayclass_java_lang_Object; + +# if defined(ENABLE_ANNOTATIONS) +classinfo *class_sun_reflect_ConstantPool; +# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) +classinfo *class_sun_reflect_annotation_AnnotationParser; +# endif +# endif +#endif + +/* pseudo classes for the typechecker */ + +classinfo *pseudo_class_Arraystub; +classinfo *pseudo_class_Null; +classinfo *pseudo_class_New; + + +/* + * 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: + */ diff --git a/src/vmcore/globals.hpp b/src/vmcore/globals.hpp new file mode 100644 index 000000000..b4457d157 --- /dev/null +++ b/src/vmcore/globals.hpp @@ -0,0 +1,159 @@ +/* src/vmcore/globals.hpp - global variables + + Copyright (C) 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO + + 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. + +*/ + + +#ifndef _GLOBALS_HPP +#define _GLOBALS_HPP + +#include "config.h" + +#include + +#include "vmcore/class.h" + + +// FIXME For now we export them a C symbols. +#ifdef __cplusplus +extern "C" { +#endif + +// Classes. + +/* Important system classes. */ + +extern classinfo *class_java_lang_Object; +extern classinfo *class_java_lang_Class; +extern classinfo *class_java_lang_ClassLoader; +extern classinfo *class_java_lang_Cloneable; +extern classinfo *class_java_lang_SecurityManager; +extern classinfo *class_java_lang_String; +extern classinfo *class_java_lang_System; +extern classinfo *class_java_lang_Thread; +extern classinfo *class_java_lang_ThreadGroup; +extern classinfo *class_java_lang_Throwable; +extern classinfo *class_java_io_Serializable; + +/* Important system exceptions. */ + +extern classinfo *class_java_lang_Exception; +extern classinfo *class_java_lang_ClassNotFoundException; +extern classinfo *class_java_lang_RuntimeException; + +#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) +extern classinfo *class_java_lang_VMSystem; +extern classinfo *class_java_lang_VMThread; +extern classinfo *class_java_lang_VMThrowable; +#endif + +#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK) +extern classinfo *class_sun_reflect_MagicAccessorImpl; +#endif + +#if defined(ENABLE_JAVASE) +extern classinfo *class_java_lang_Void; +#endif + +extern classinfo *class_java_lang_Boolean; +extern classinfo *class_java_lang_Byte; +extern classinfo *class_java_lang_Character; +extern classinfo *class_java_lang_Short; +extern classinfo *class_java_lang_Integer; +extern classinfo *class_java_lang_Long; +extern classinfo *class_java_lang_Float; +extern classinfo *class_java_lang_Double; + +/* some classes which may be used more often */ + +#if defined(ENABLE_JAVASE) +extern classinfo *class_java_lang_StackTraceElement; +extern classinfo *class_java_lang_reflect_Constructor; +extern classinfo *class_java_lang_reflect_Field; +extern classinfo *class_java_lang_reflect_Method; +extern classinfo *class_java_security_PrivilegedAction; +extern classinfo *class_java_util_Vector; +extern classinfo *class_java_util_HashMap; + +# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) +extern classinfo *class_java_lang_reflect_VMConstructor; +extern classinfo *class_java_lang_reflect_VMField; +extern classinfo *class_java_lang_reflect_VMMethod; +# endif + +extern classinfo *arrayclass_java_lang_Object; + +# if defined(ENABLE_ANNOTATIONS) +extern classinfo *class_sun_reflect_ConstantPool; +# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH) +extern classinfo *class_sun_reflect_annotation_AnnotationParser; +# endif +# endif +#endif + + +/* pseudo classes for the type checker ****************************************/ + +/* + * pseudo_class_Arraystub + * (extends Object implements Cloneable, java.io.Serializable) + * + * If two arrays of incompatible component types are merged, + * the resulting reference has no accessible components. + * The result does, however, implement the interfaces Cloneable + * and java.io.Serializable. This pseudo class is used internally + * to represent such results. (They are *not* considered arrays!) + * + * pseudo_class_Null + * + * This pseudo class is used internally to represent the + * null type. + * + * pseudo_class_New + * + * This pseudo class is used internally to represent the + * the 'uninitialized object' type. + */ + +extern classinfo *pseudo_class_Arraystub; +extern classinfo *pseudo_class_Null; +extern classinfo *pseudo_class_New; + +#ifdef __cplusplus +} +#endif + +#endif // _CLASS_HPP + + +/* + * 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: + */ diff --git a/src/vmcore/linker.c b/src/vmcore/linker.c index 625d81cad..9c1074456 100644 --- a/src/vmcore/linker.c +++ b/src/vmcore/linker.c @@ -49,6 +49,7 @@ #include "vmcore/class.h" #include "vmcore/classcache.h" +#include "vmcore/globals.hpp" #include "vmcore/loader.h" #include "vmcore/options.h" #include "vmcore/rt-timing.h" diff --git a/src/vmcore/loader.c b/src/vmcore/loader.c index a7935cdd9..3a844d579 100644 --- a/src/vmcore/loader.c +++ b/src/vmcore/loader.c @@ -58,6 +58,7 @@ #include "vmcore/classcache.h" #include "vmcore/field.h" +#include "vmcore/globals.hpp" #include "vmcore/linker.h" #include "vmcore/loader.h" #include "vmcore/method.h" diff --git a/src/vmcore/method.c b/src/vmcore/method.c index 61cfe429b..59ecbf4f7 100644 --- a/src/vmcore/method.c +++ b/src/vmcore/method.c @@ -50,6 +50,7 @@ #include "vm/jit_interface.h" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/linker.h" #include "vmcore/loader.h" #include "vmcore/method.h" diff --git a/src/vmcore/primitivecore.c b/src/vmcore/primitivecore.c index 5f4cac830..634ee6d07 100644 --- a/src/vmcore/primitivecore.c +++ b/src/vmcore/primitivecore.c @@ -33,6 +33,7 @@ #include "vm/vm.hpp" #include "vmcore/class.h" +#include "vmcore/globals.hpp" #include "vmcore/options.h" #include "vmcore/utf8.h" -- 2.25.1