1 /* src/native/vm/nativevm.c - register the native functions
3 Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 #if defined(WITH_CLASSPATH_SUN)
36 #include "native/vm/nativevm.h"
38 #include "vmcore/method.h"
40 #if defined(WITH_CLASSPATH_SUN)
41 # include "mm/memory.h"
43 # include "native/native.h"
45 # include "vm/properties.h"
48 # include "vmcore/class.h"
49 # include "vmcore/utf8.h"
53 /* nativevm_preinit ************************************************************
55 Pre-initialize the implementation specific native stuff.
57 *******************************************************************************/
59 bool nativevm_preinit(void)
61 /* register native methods of all classes implemented */
63 #if defined(ENABLE_JAVASE)
65 # if defined(WITH_CLASSPATH_GNU)
67 _Jv_gnu_classpath_VMStackWalker_init();
68 _Jv_gnu_classpath_VMSystemProperties_init();
69 _Jv_gnu_java_lang_management_VMClassLoadingMXBeanImpl_init();
70 _Jv_gnu_java_lang_management_VMMemoryMXBeanImpl_init();
71 _Jv_gnu_java_lang_management_VMRuntimeMXBeanImpl_init();
72 _Jv_gnu_java_lang_management_VMThreadMXBeanImpl_init();
73 _Jv_java_lang_VMClass_init();
74 _Jv_java_lang_VMClassLoader_init();
75 _Jv_java_lang_VMObject_init();
76 _Jv_java_lang_VMRuntime_init();
77 _Jv_java_lang_VMSystem_init();
78 _Jv_java_lang_VMString_init();
79 _Jv_java_lang_VMThread_init();
80 _Jv_java_lang_VMThrowable_init();
81 _Jv_java_lang_management_VMManagementFactory_init();
82 _Jv_java_lang_reflect_Constructor_init();
83 _Jv_java_lang_reflect_Field_init();
84 _Jv_java_lang_reflect_Method_init();
85 _Jv_java_lang_reflect_VMProxy_init();
86 _Jv_java_security_VMAccessController_init();
87 _Jv_java_util_concurrent_atomic_AtomicLong_init();
88 _Jv_sun_misc_Unsafe_init();
90 #if defined(ENABLE_ANNOTATIONS)
91 _Jv_sun_reflect_ConstantPool_init();
94 # elif defined(WITH_CLASSPATH_SUN)
96 char *boot_library_path;
102 boot_library_path = properties_get("sun.boot.library.path");
105 strlen(boot_library_path) +
106 strlen("/libjava.so") +
111 strcpy(p, boot_library_path);
112 strcat(p, "/libjava.so");
118 handle = native_library_open(u);
119 native_library_add(u, NULL, handle);
121 _Jv_sun_misc_Unsafe_init();
125 # error unknown classpath configuration
129 #elif defined(ENABLE_JAVAME_CLDC1_1)
131 _Jv_com_sun_cldc_io_ResourceInputStream_init();
132 _Jv_com_sun_cldc_io_j2me_socket_Protocol_init();
133 _Jv_com_sun_cldchi_io_ConsoleOutputStream_init();
134 _Jv_com_sun_cldchi_jvm_JVM_init();
135 _Jv_java_lang_Class_init();
136 _Jv_java_lang_Double_init();
137 _Jv_java_lang_Float_init();
138 _Jv_java_lang_Math_init();
139 _Jv_java_lang_Object_init();
140 _Jv_java_lang_Runtime_init();
141 _Jv_java_lang_String_init();
142 _Jv_java_lang_System_init();
143 _Jv_java_lang_Thread_init();
144 _Jv_java_lang_Throwable_init();
148 # error unknown Java configuration
152 /* everything's ok */
158 /* nativevm_init ***************************************************************
160 Initialize the implementation specific native stuff.
162 *******************************************************************************/
164 bool nativevm_init(void)
166 #if defined(ENABLE_JAVASE)
168 # if defined(WITH_CLASSPATH_GNU)
172 # elif defined(WITH_CLASSPATH_SUN)
176 m = class_resolveclassmethod(class_java_lang_System,
177 utf_new_char("initializeSystemClass"),
179 class_java_lang_Object,
185 (void) vm_call_method(m, NULL);
189 # error unknown classpath configuration
193 #elif defined(ENABLE_JAVAME_CLDC1_1)
199 # error unknown Java configuration
203 /* everything's ok */
210 * These are local overrides for various environment variables in Emacs.
211 * Please do not remove this and leave it at the end of the file, where
212 * Emacs will automagically detect them.
213 * ---------------------------------------------------------------------
216 * indent-tabs-mode: t