* src/native/vm/nativevm.h: Likewise.
* src/native/vm/nativevm.cpp: New file.
* src/native/vm/nativevm.hpp: Likewise.
* src/native/native.cpp,
src/native/vm/cldc1.1/com_sun_cldc_io_ResourceInputStream.cpp,
src/native/vm/cldc1.1/com_sun_cldc_io_j2me_socket_Protocol.cpp,
src/native/vm/cldc1.1/com_sun_cldchi_io_ConsoleOutputStream.cpp,
src/native/vm/cldc1.1/com_sun_cldchi_jvm_JVM.cpp,
src/native/vm/cldc1.1/java_lang_Class.cpp,
src/native/vm/cldc1.1/java_lang_Double.cpp,
src/native/vm/cldc1.1/java_lang_Float.cpp,
src/native/vm/cldc1.1/java_lang_Math.cpp,
src/native/vm/cldc1.1/java_lang_Object.cpp,
src/native/vm/cldc1.1/java_lang_Runtime.cpp,
src/native/vm/cldc1.1/java_lang_String.cpp,
src/native/vm/cldc1.1/java_lang_System.cpp,
src/native/vm/cldc1.1/java_lang_Thread.cpp,
src/native/vm/cldc1.1/java_lang_Throwable.cpp,
src/native/vm/gnuclasspath/gnu_classpath_VMStackWalker.cpp,
src/native/vm/gnuclasspath/gnu_classpath_VMSystemProperties.cpp,
src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.cpp,
src/native/vm/gnuclasspath/gnu_java_lang_management_VMClassLoadingMXBeanImpl.cpp,
src/native/vm/gnuclasspath/gnu_java_lang_management_VMMemoryMXBeanImpl.cpp,
src/native/vm/gnuclasspath/gnu_java_lang_management_VMRuntimeMXBeanImpl.cpp,
src/native/vm/gnuclasspath/gnu_java_lang_management_VMThreadMXBeanImpl.cpp,
src/native/vm/gnuclasspath/java_lang_VMClass.cpp,
src/native/vm/gnuclasspath/java_lang_VMClassLoader.cpp,
src/native/vm/gnuclasspath/java_lang_VMObject.cpp,
src/native/vm/gnuclasspath/java_lang_VMRuntime.cpp,
src/native/vm/gnuclasspath/java_lang_VMString.cpp,
src/native/vm/gnuclasspath/java_lang_VMSystem.cpp,
src/native/vm/gnuclasspath/java_lang_VMThread.cpp,
src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp,
src/native/vm/gnuclasspath/java_lang_management_VMManagementFactory.cpp,
src/native/vm/gnuclasspath/java_lang_reflect_VMConstructor.cpp,
src/native/vm/gnuclasspath/java_lang_reflect_VMField.cpp,
src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp,
src/native/vm/gnuclasspath/java_lang_reflect_VMProxy.c,
src/native/vm/gnuclasspath/java_security_VMAccessController.cpp,
src/native/vm/gnuclasspath/java_util_concurrent_atomic_AtomicLong.cpp,
src/native/vm/gnuclasspath/sun_reflect_ConstantPool.cpp,
src/native/vm/sun_misc_Unsafe.cpp,
src/vm/vm.cpp: Related changes.
--HG--
rename : src/native/vm/nativevm.c => src/native/vm/nativevm.cpp
rename : src/native/vm/nativevm.h => src/native/vm/nativevm.hpp
#include "native/jni.hpp"
#include "native/native.hpp"
-#include "native/vm/nativevm.h"
-
#include "threads/mutex.hpp"
#include "toolbox/avl.h"
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_com_sun_cldc_io_ResourceInputStream_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_com_sun_cldc_io_j2me_socket_Protocol_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_com_sun_cldchi_io_ConsoleOutputStream_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_com_sun_cldchi_jvm_JVM_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
{ (char*) "getName", (char*) "()Ljava/lang/String;", (void*) (uintptr_t) &Java_java_lang_Class_getName },
};
+
/* _Jv_java_lang_Class_init ****************************************************
Register native functions.
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Class_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Double_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Float_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Math_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Object_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Runtime_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_String_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_System_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Thread_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_Throwable_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_classpath_VMStackWalker_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_classpath_VMSystemProperties_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_java_lang_VMCPStringBuilder_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_java_lang_management_VMMemoryMXBeanImpl_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_java_lang_management_VMRuntimeMXBeanImpl_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_gnu_java_lang_management_VMThreadMXBeanImpl_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMClass_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMClassLoader_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMObject_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMRuntime_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMString_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMSystem_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_VMThread_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-extern "C" {
void _Jv_java_lang_VMThrowable_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_management_VMManagementFactory_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-extern "C" {
void _Jv_java_lang_reflect_VMConstructor_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_reflect_VMField_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_lang_reflect_VMMethod_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
+#if 0
void _Jv_java_lang_reflect_VMProxy_init(void)
{
-#if 0
utf *u;
u = utf_new_char("java/lang/reflect/VMProxy");
native_method_register(u, methods, NATIVE_METHODS_COUNT);
-#endif
}
+#endif
#if 0
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_security_VMAccessController_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_java_util_concurrent_atomic_AtomicLong_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
/*
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_sun_reflect_ConstantPool_init(void)
{
native_method_register(utf_new_char("sun/reflect/ConstantPool"), methods, NATIVE_METHODS_COUNT);
}
-}
/*
+++ /dev/null
-/* src/native/vm/nativevm.c - register the native functions
-
- Copyright (C) 2007, 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 <stdint.h>
-
-#include "native/vm/nativevm.h"
-
-#include "vm/class.h"
-#include "vm/initialize.h"
-#include "vm/method.h"
-#include "vm/options.h"
-#include "vm/os.hpp"
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-# include "mm/memory.h"
-
-# include "native/native.hpp"
-
-# include "native/vm/openjdk/hpi.hpp"
-
-# include "vm/globals.hpp"
-# include "vm/properties.hpp"
-# include "vm/utf8.h"
-# include "vm/vm.hpp"
-#endif
-
-
-/* nativevm_preinit ************************************************************
-
- Pre-initialize the implementation specific native stuff.
-
-*******************************************************************************/
-
-void nativevm_preinit(void)
-{
- /* Register native methods of all classes implemented. */
-
-#if defined(ENABLE_JAVASE)
-# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
-
- TRACESUBSYSTEMINITIALIZATION("nativevm_preinit");
-
- _Jv_gnu_classpath_VMStackWalker_init();
- _Jv_gnu_classpath_VMSystemProperties_init();
- _Jv_gnu_java_lang_VMCPStringBuilder_init();
- _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init();
- _Jv_gnu_java_lang_management_VMMemoryMXBeanImpl_init();
- _Jv_gnu_java_lang_management_VMRuntimeMXBeanImpl_init();
- _Jv_gnu_java_lang_management_VMThreadMXBeanImpl_init();
- _Jv_java_lang_VMClass_init();
- _Jv_java_lang_VMClassLoader_init();
- _Jv_java_lang_VMObject_init();
- _Jv_java_lang_VMRuntime_init();
- _Jv_java_lang_VMSystem_init();
- _Jv_java_lang_VMString_init();
- _Jv_java_lang_VMThread_init();
- _Jv_java_lang_VMThrowable_init();
- _Jv_java_lang_management_VMManagementFactory_init();
- _Jv_java_lang_reflect_VMConstructor_init();
- _Jv_java_lang_reflect_VMField_init();
- _Jv_java_lang_reflect_VMMethod_init();
- _Jv_java_lang_reflect_VMProxy_init();
- _Jv_java_security_VMAccessController_init();
- _Jv_java_util_concurrent_atomic_AtomicLong_init();
- _Jv_sun_misc_Unsafe_init();
-
-#if defined(ENABLE_ANNOTATIONS)
- _Jv_sun_reflect_ConstantPool_init();
-#endif
-
-# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-
- const char* boot_library_path;
- int len;
- char* p;
- utf* u;
- void* handle;
-
- TRACESUBSYSTEMINITIALIZATION("nativevm_preinit");
-
- /* Load libjava.so */
-
- boot_library_path = Properties_get("sun.boot.library.path");
-
- len =
- os_strlen(boot_library_path) +
- os_strlen("/libjava.so") +
- os_strlen("0");
-
- p = MNEW(char, len);
-
- os_strcpy(p, boot_library_path);
- os_strcat(p, "/libjava.so");
-
- u = utf_new_char(p);
-
- handle = native_library_open(u);
-
- if (handle == NULL)
- vm_abort("nativevm_init: failed to open libjava.so at: %s", p);
-
- MFREE(p, char, len);
-
- native_library_add(u, NULL, handle);
-
- /* Initialize the HPI. */
-
- HPI_initialize();
-
- _Jv_sun_misc_Unsafe_init();
-
-# else
-# error unknown classpath configuration
-# endif
-
-#elif defined(ENABLE_JAVAME_CLDC1_1)
-
- TRACESUBSYSTEMINITIALIZATION("nativevm_preinit");
-
- _Jv_com_sun_cldc_io_ResourceInputStream_init();
- _Jv_com_sun_cldc_io_j2me_socket_Protocol_init();
- _Jv_com_sun_cldchi_io_ConsoleOutputStream_init();
- _Jv_com_sun_cldchi_jvm_JVM_init();
- _Jv_java_lang_Class_init();
- _Jv_java_lang_Double_init();
- _Jv_java_lang_Float_init();
- _Jv_java_lang_Math_init();
- _Jv_java_lang_Object_init();
- _Jv_java_lang_Runtime_init();
- _Jv_java_lang_String_init();
- _Jv_java_lang_System_init();
- _Jv_java_lang_Thread_init();
- _Jv_java_lang_Throwable_init();
-
-#else
-# error unknown Java configuration
-#endif
-}
-
-
-/* nativevm_init ***************************************************************
-
- Initialize the implementation specific native stuff.
-
-*******************************************************************************/
-
-void nativevm_init(void)
-{
-#if defined(ENABLE_JAVASE)
-
-# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
-
- TRACESUBSYSTEMINITIALIZATION("nativevm_init");
-
- /* nothing to do */
-
-# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-
- methodinfo *m;
-
- TRACESUBSYSTEMINITIALIZATION("nativevm_init");
-
- m = class_resolveclassmethod(class_java_lang_System,
- utf_new_char("initializeSystemClass"),
- utf_void__void,
- class_java_lang_Object,
- false);
-
- if (m == NULL)
- vm_abort("nativevm_init: Error resolving java.lang.System.initializeSystemClass()");
-
- (void) vm_call_method(m, NULL);
-
-# else
-# error unknown classpath configuration
-# endif
-
-#elif defined(ENABLE_JAVAME_CLDC1_1)
-
- TRACESUBSYSTEMINITIALIZATION("nativevm_init");
-
- /* nothing to do */
-
-#else
-# error unknown Java configuration
-#endif
-}
-
-
-/*
- * 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:
- */
--- /dev/null
+/* src/native/vm/nativevm.cpp - Register native VM interface functions.
+
+ Copyright (C) 2007, 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 <stdint.h>
+
+#include "native/vm/nativevm.hpp"
+
+#include "vm/class.h"
+#include "vm/initialize.h"
+#include "vm/method.h"
+#include "vm/options.h"
+#include "vm/os.hpp"
+
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+# include "mm/memory.h"
+
+# include "native/native.hpp"
+
+# include "native/vm/openjdk/hpi.hpp"
+
+# include "vm/globals.hpp"
+# include "vm/properties.hpp"
+# include "vm/utf8.h"
+# include "vm/vm.hpp"
+#endif
+
+
+/* nativevm_preinit ************************************************************
+
+ Pre-initialize the implementation specific native stuff.
+
+*******************************************************************************/
+
+void nativevm_preinit(void)
+{
+ TRACESUBSYSTEMINITIALIZATION("nativevm_preinit");
+
+ /* Register native methods of all classes implemented. */
+
+#if defined(ENABLE_JAVASE)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+
+ _Jv_gnu_classpath_VMStackWalker_init();
+ _Jv_gnu_classpath_VMSystemProperties_init();
+ _Jv_gnu_java_lang_VMCPStringBuilder_init();
+ _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init();
+ _Jv_gnu_java_lang_management_VMMemoryMXBeanImpl_init();
+ _Jv_gnu_java_lang_management_VMRuntimeMXBeanImpl_init();
+ _Jv_gnu_java_lang_management_VMThreadMXBeanImpl_init();
+ _Jv_java_lang_VMClass_init();
+ _Jv_java_lang_VMClassLoader_init();
+ _Jv_java_lang_VMObject_init();
+ _Jv_java_lang_VMRuntime_init();
+ _Jv_java_lang_VMSystem_init();
+ _Jv_java_lang_VMString_init();
+ _Jv_java_lang_VMThread_init();
+ _Jv_java_lang_VMThrowable_init();
+ _Jv_java_lang_management_VMManagementFactory_init();
+ _Jv_java_lang_reflect_VMConstructor_init();
+ _Jv_java_lang_reflect_VMField_init();
+ _Jv_java_lang_reflect_VMMethod_init();
+ //_Jv_java_lang_reflect_VMProxy_init();
+ _Jv_java_security_VMAccessController_init();
+ _Jv_java_util_concurrent_atomic_AtomicLong_init();
+ _Jv_sun_misc_Unsafe_init();
+
+#if defined(ENABLE_ANNOTATIONS)
+ _Jv_sun_reflect_ConstantPool_init();
+#endif
+
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+
+ // Load libjava.so
+ VM* vm = VM::get_current();
+ Properties& properties = vm->get_properties();
+ const char* boot_library_path = properties.get("sun.boot.library.path");
+
+ size_t len =
+ os::strlen(boot_library_path) +
+ os::strlen("/libjava.so") +
+ os::strlen("0");
+
+ char* p = MNEW(char, len);
+
+ os::strcpy(p, boot_library_path);
+ os::strcat(p, "/libjava.so");
+
+ utf* u = utf_new_char(p);
+
+ void* handle = native_library_open(u);
+
+ if (handle == NULL)
+ vm_abort("nativevm_init: failed to open libjava.so at: %s", p);
+
+ MFREE(p, char, len);
+
+ native_library_add(u, NULL, handle);
+
+ // Initialize the HPI.
+ HPI& hpi = vm->get_hpi();
+ hpi.initialize();
+
+ _Jv_sun_misc_Unsafe_init();
+
+# else
+# error unknown classpath configuration
+# endif
+
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+
+ _Jv_com_sun_cldc_io_ResourceInputStream_init();
+ _Jv_com_sun_cldc_io_j2me_socket_Protocol_init();
+ _Jv_com_sun_cldchi_io_ConsoleOutputStream_init();
+ _Jv_com_sun_cldchi_jvm_JVM_init();
+ _Jv_java_lang_Class_init();
+ _Jv_java_lang_Double_init();
+ _Jv_java_lang_Float_init();
+ _Jv_java_lang_Math_init();
+ _Jv_java_lang_Object_init();
+ _Jv_java_lang_Runtime_init();
+ _Jv_java_lang_String_init();
+ _Jv_java_lang_System_init();
+ _Jv_java_lang_Thread_init();
+ _Jv_java_lang_Throwable_init();
+
+#else
+# error unknown Java configuration
+#endif
+}
+
+
+/* nativevm_init ***************************************************************
+
+ Initialize the implementation specific native stuff.
+
+*******************************************************************************/
+
+void nativevm_init(void)
+{
+ TRACESUBSYSTEMINITIALIZATION("nativevm_init");
+
+#if defined(ENABLE_JAVASE)
+
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+
+ // Nothing to do.
+
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+
+ methodinfo* m = class_resolveclassmethod(class_java_lang_System,
+ utf_new_char("initializeSystemClass"),
+ utf_void__void,
+ class_java_lang_Object,
+ false);
+
+ if (m == NULL)
+ os::abort("nativevm_init: Error resolving java.lang.System.initializeSystemClass()");
+
+ (void) vm_call_method(m, NULL);
+
+# else
+# error unknown classpath configuration
+# endif
+
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+
+ // Nothing to do.
+
+#else
+# error unknown Java configuration
+#endif
+}
+
+
+/*
+ * 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/native/vm/nativevm.h - register the native functions
-
- Copyright (C) 2007, 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 _NATIVEVM_H
-#define _NATIVEVM_H
-
-#include "config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "vm/types.h"
-
-#include "vm/global.h"
-
-
-/* function prototypes ********************************************************/
-
-void nativevm_preinit(void);
-void nativevm_init(void);
-
-#if defined(ENABLE_JAVASE)
-# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
-
-void _Jv_gnu_classpath_VMStackWalker_init();
-void _Jv_gnu_classpath_VMSystemProperties_init();
-void _Jv_gnu_java_lang_VMCPStringBuilder_init();
-void _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init();
-void _Jv_gnu_java_lang_management_VMMemoryMXBeanImpl_init();
-void _Jv_gnu_java_lang_management_VMRuntimeMXBeanImpl_init();
-void _Jv_gnu_java_lang_management_VMThreadMXBeanImpl_init();
-void _Jv_java_lang_VMClass_init();
-void _Jv_java_lang_VMClassLoader_init();
-void _Jv_java_lang_VMObject_init();
-void _Jv_java_lang_VMRuntime_init();
-void _Jv_java_lang_VMString_init();
-void _Jv_java_lang_VMSystem_init();
-void _Jv_java_lang_VMThread_init();
-void _Jv_java_lang_VMThrowable_init();
-void _Jv_java_lang_management_VMManagementFactory_init();
-void _Jv_java_lang_reflect_VMConstructor_init();
-void _Jv_java_lang_reflect_VMField_init();
-void _Jv_java_lang_reflect_VMMethod_init();
-void _Jv_java_lang_reflect_VMProxy_init();
-void _Jv_java_security_VMAccessController_init();
-void _Jv_java_util_concurrent_atomic_AtomicLong_init();
-void _Jv_sun_misc_Unsafe_init();
-
-#if defined(ENABLE_ANNOTATIONS)
-void _Jv_sun_reflect_ConstantPool_init();
-#endif
-
-# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-
-void _Jv_sun_misc_Unsafe_init();
-
-# else
-# error unknown classpath configuration
-# endif
-
-#elif defined(ENABLE_JAVAME_CLDC1_1)
-
-void _Jv_com_sun_cldc_io_ResourceInputStream_init();
-void _Jv_com_sun_cldc_io_j2me_socket_Protocol_init();
-void _Jv_com_sun_cldchi_io_ConsoleOutputStream_init();
-void _Jv_com_sun_cldchi_jvm_JVM_init();
-void _Jv_java_lang_Class_init();
-void _Jv_java_lang_Double_init();
-void _Jv_java_lang_Float_init();
-void _Jv_java_lang_Math_init();
-void _Jv_java_lang_Object_init();
-void _Jv_java_lang_Runtime_init();
-void _Jv_java_lang_String_init();
-void _Jv_java_lang_System_init();
-void _Jv_java_lang_Thread_init();
-void _Jv_java_lang_Throwable_init();
-
-#else
-# error unknown Java configuration
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NATIVEVM_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:
- */
--- /dev/null
+/* src/native/vm/nativevm.hpp - Register native VM interface functions.
+
+ Copyright (C) 2007, 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 _NATIVEVM_HPP
+#define _NATIVEVM_HPP
+
+#include "config.h"
+
+/* function prototypes ********************************************************/
+
+void nativevm_preinit(void);
+void nativevm_init(void);
+
+#if defined(ENABLE_JAVASE)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+
+void _Jv_gnu_classpath_VMStackWalker_init();
+void _Jv_gnu_classpath_VMSystemProperties_init();
+void _Jv_gnu_java_lang_VMCPStringBuilder_init();
+void _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init();
+void _Jv_gnu_java_lang_management_VMMemoryMXBeanImpl_init();
+void _Jv_gnu_java_lang_management_VMRuntimeMXBeanImpl_init();
+void _Jv_gnu_java_lang_management_VMThreadMXBeanImpl_init();
+void _Jv_java_lang_VMClass_init();
+void _Jv_java_lang_VMClassLoader_init();
+void _Jv_java_lang_VMObject_init();
+void _Jv_java_lang_VMRuntime_init();
+void _Jv_java_lang_VMString_init();
+void _Jv_java_lang_VMSystem_init();
+void _Jv_java_lang_VMThread_init();
+void _Jv_java_lang_VMThrowable_init();
+void _Jv_java_lang_management_VMManagementFactory_init();
+void _Jv_java_lang_reflect_VMConstructor_init();
+void _Jv_java_lang_reflect_VMField_init();
+void _Jv_java_lang_reflect_VMMethod_init();
+void _Jv_java_lang_reflect_VMProxy_init();
+void _Jv_java_security_VMAccessController_init();
+void _Jv_java_util_concurrent_atomic_AtomicLong_init();
+void _Jv_sun_misc_Unsafe_init();
+
+#if defined(ENABLE_ANNOTATIONS)
+void _Jv_sun_reflect_ConstantPool_init();
+#endif
+
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+
+void _Jv_sun_misc_Unsafe_init();
+
+# else
+# error unknown classpath configuration
+# endif
+
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+
+void _Jv_com_sun_cldc_io_ResourceInputStream_init();
+void _Jv_com_sun_cldc_io_j2me_socket_Protocol_init();
+void _Jv_com_sun_cldchi_io_ConsoleOutputStream_init();
+void _Jv_com_sun_cldchi_jvm_JVM_init();
+void _Jv_java_lang_Class_init();
+void _Jv_java_lang_Double_init();
+void _Jv_java_lang_Float_init();
+void _Jv_java_lang_Math_init();
+void _Jv_java_lang_Object_init();
+void _Jv_java_lang_Runtime_init();
+void _Jv_java_lang_String_init();
+void _Jv_java_lang_System_init();
+void _Jv_java_lang_Thread_init();
+void _Jv_java_lang_Throwable_init();
+
+#else
+# error unknown Java configuration
+#endif
+
+#endif // _NATIVEVM_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:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_sun_misc_Unsafe_init(void)
{
utf *u;
native_method_register(u, methods, NATIVE_METHODS_COUNT);
}
-}
+
/*
* These are local overrides for various environment variables in Emacs.
* c-basic-offset: 4
* tab-width: 4
* End:
+ * vim:noexpandtab:sw=4:ts=4:
*/
#include "native/localref.hpp"
#include "native/native.hpp"
-#include "native/vm/nativevm.h"
+#include "native/vm/nativevm.hpp"
#include "threads/lock.hpp"
#include "threads/thread.hpp"