* src/native/native.c: Moved to .cpp.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 29 Aug 2008 10:53:48 +0000 (12:53 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 29 Aug 2008 10:53:48 +0000 (12:53 +0200)
* src/native/native.h: Likewise.
* src/native/native.cpp: New file.
* src/native/native.hpp: Likewise.
* src/cacao/cacao.cpp,
src/mm/memory.c,
src/native/Makefile.am,
src/native/jni.cpp,
src/native/jvmti/jvmti.c,
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.c,
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/nativevm.c,
src/native/vm/openjdk/hpi.c,
src/native/vm/openjdk/jvm.cpp,
src/native/vm/reflection.cpp,
src/native/vm/reflection.hpp,
src/native/vm/sun_misc_Unsafe.cpp,
src/threads/posix/thread-posix.cpp,
src/threads/thread.cpp,
src/toolbox/avl.h,
src/vm/exceptions.cpp,
src/vm/jit/alpha/codegen.c,
src/vm/jit/alpha/patcher.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/arm/patcher.c,
src/vm/jit/codegen-common.cpp,
src/vm/jit/i386/codegen.c,
src/vm/jit/i386/patcher.c,
src/vm/jit/intrp/codegen.c,
src/vm/jit/intrp/patcher.c,
src/vm/jit/jit.cpp,
src/vm/jit/m68k/codegen.c,
src/vm/jit/m68k/patcher.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/mips/patcher.c,
src/vm/jit/parse.c,
src/vm/jit/patcher-common.cpp,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc/patcher.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/powerpc64/patcher.c,
src/vm/jit/s390/codegen.c,
src/vm/jit/s390/patcher.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/sparc64/patcher.c,
src/vm/jit/stack.c,
src/vm/jit/verify/typecheck-typeinferer.c,
src/vm/jit/verify/typecheck.c,
src/vm/jit/x86_64/codegen.c,
src/vm/jit/x86_64/patcher.c,
src/vm/linker.c,
src/vm/os.cpp,
src/vm/os.hpp,
src/vm/vm.cpp: Related changes.

89 files changed:
src/cacao/cacao.cpp
src/mm/memory.c
src/native/Makefile.am
src/native/jni.cpp
src/native/jvmti/jvmti.c
src/native/native.c [deleted file]
src/native/native.cpp [new file with mode: 0644]
src/native/native.h [deleted file]
src/native/native.hpp [new file with mode: 0644]
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.c
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/nativevm.c
src/native/vm/openjdk/hpi.c
src/native/vm/openjdk/jvm.cpp
src/native/vm/reflection.cpp
src/native/vm/reflection.hpp
src/native/vm/sun_misc_Unsafe.cpp
src/threads/posix/thread-posix.cpp
src/threads/thread.cpp
src/toolbox/avl.h
src/vm/exceptions.cpp
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/patcher.c
src/vm/jit/arm/codegen.c
src/vm/jit/arm/patcher.c
src/vm/jit/codegen-common.cpp
src/vm/jit/i386/codegen.c
src/vm/jit/i386/patcher.c
src/vm/jit/intrp/codegen.c
src/vm/jit/intrp/patcher.c
src/vm/jit/jit.cpp
src/vm/jit/m68k/codegen.c
src/vm/jit/m68k/patcher.c
src/vm/jit/mips/codegen.c
src/vm/jit/mips/patcher.c
src/vm/jit/parse.c
src/vm/jit/patcher-common.cpp
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/patcher.c
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/patcher.c
src/vm/jit/s390/codegen.c
src/vm/jit/s390/patcher.c
src/vm/jit/sparc64/codegen.c
src/vm/jit/sparc64/patcher.c
src/vm/jit/stack.c
src/vm/jit/verify/typecheck-typeinferer.c
src/vm/jit/verify/typecheck.c
src/vm/jit/x86_64/codegen.c
src/vm/jit/x86_64/patcher.c
src/vm/linker.c
src/vm/os.cpp
src/vm/os.hpp
src/vm/vm.cpp

index 08a0ff8952018dcd32a1b3febf045590e18b7800..276d1fc1cf67ed70c152ebaab766275aa9aecd88 100644 (file)
@@ -39,7 +39,7 @@
 #include "vm/types.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JVMTI)
 # include "native/jvmti/jvmti.h"
index d2c5f586a806dd18809d55314cabf866941c5885..0774aee016228547abfe7b8d919478d22a72dc4a 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 #include "threads/thread.hpp"
index f18f9c2d4732fc3356d389633943f2fa559ea6b4..aae7be3c9642a32e7ac89edf96e37aebce064d76 100644 (file)
@@ -47,8 +47,8 @@ libnative_la_SOURCES = \
        $(JNI_SOURCES) \
        llni.c \
        llni.h \
-       native.c \
-       native.h
+       native.cpp \
+       native.hpp
 
 libnative_la_LIBADD = \
        vm/libnativevm.la \
index 1f4c521e0d01229ca8dd715a0f7da59060a844d4..41aad483e0d5bd74ebb6ef6439a70b6d33013b2c 100644 (file)
@@ -37,7 +37,7 @@
 #include "native/jni.hpp"
 #include "native/llni.h"
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JVMTI)
 # include "native/jvmti/cacaodbg.h"
index 8548b8dbabedf8e07a9bc2a28c86d9fe498b6ac6..42aa02492bb9e4e41e499c8ebca54f06838624f0 100644 (file)
@@ -37,7 +37,7 @@
 #include <sched.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 #include "native/jvmti/cacaodbg.h"
 #include "native/jvmti/jvmti.h"
 #include "vm/jit/stacktrace.hpp"
diff --git a/src/native/native.c b/src/native/native.c
deleted file mode 100644 (file)
index 4d12091..0000000
+++ /dev/null
@@ -1,1009 +0,0 @@
-/* src/native/native.c - native library support
-
-   Copyright (C) 1996-2005, 2006, 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 <assert.h>
-#include <ctype.h>
-
-#include <stdint.h>
-
-#include "vm/types.h"
-
-#include "mm/memory.h"
-
-#include "native/jni.hpp"
-#include "native/native.h"
-
-#include "native/vm/nativevm.h"
-
-#include "threads/mutex.hpp"
-
-#include "toolbox/avl.h"
-#include "toolbox/hashtable.h"
-#include "toolbox/logging.h"
-
-#include "vm/jit/builtin.hpp"
-#include "vm/exceptions.hpp"
-#include "vm/global.h"
-#include "vm/globals.hpp"
-#include "vm/loader.hpp"
-#include "vm/options.h"
-#include "vm/os.hpp"
-#include "vm/resolve.h"
-#include "vm/string.hpp"
-#include "vm/vm.hpp"
-
-#include "vm/jit/asmpart.h"
-#include "vm/jit/jit.hpp"
-
-#if defined(ENABLE_JVMTI)
-#include "native/jvmti/cacaodbg.h"
-#endif
-
-
-/* global variables ***********************************************************/
-
-static avl_tree_t *tree_native_methods;
-
-#if defined(ENABLE_DL)
-static hashtable *hashtable_library;
-#endif
-
-
-/* prototypes *****************************************************************/
-
-static s4 native_tree_native_methods_comparator(const void *treenode, const void *node);
-
-
-/* native_init *****************************************************************
-
-   Initializes the native subsystem.
-
-*******************************************************************************/
-
-bool native_init(void)
-{
-       TRACESUBSYSTEMINITIALIZATION("native_init");
-
-#if defined(ENABLE_DL)
-       /* initialize library hashtable, 10 entries should be enough */
-
-       hashtable_library = NEW(hashtable);
-
-       hashtable_create(hashtable_library, 10);
-#endif
-
-       /* initialize the native methods table */
-
-       tree_native_methods = avl_create(&native_tree_native_methods_comparator);
-
-       /* everything's ok */
-
-       return true;
-}
-
-
-/* native_tree_native_methods_comparator ***************************************
-
-   Comparison function for AVL tree of native methods.
-
-   IN:
-       treenode....node in the tree
-          node........node to compare with tree-node
-
-   RETURN VALUE:
-       -1, 0, +1
-
-*******************************************************************************/
-
-static s4 native_tree_native_methods_comparator(const void *treenode, const void *node)
-{
-       const native_methods_node_t *treenmn;
-       const native_methods_node_t *nmn;
-
-       treenmn = treenode;
-       nmn     = node;
-
-       /* these are for walking the tree */
-
-       if (treenmn->classname < nmn->classname)
-               return -1;
-       else if (treenmn->classname > nmn->classname)
-               return 1;
-
-       if (treenmn->name < nmn->name)
-               return -1;
-       else if (treenmn->name > nmn->name)
-               return 1;
-
-       if (treenmn->descriptor < nmn->descriptor)
-               return -1;
-       else if (treenmn->descriptor > nmn->descriptor)
-               return 1;
-
-       /* all pointers are equal, we have found the entry */
-
-       return 0;
-}
-
-
-/* native_make_overloaded_function *********************************************
-
-   XXX
-
-*******************************************************************************/
-
-static utf *native_make_overloaded_function(utf *name, utf *descriptor)
-{
-       char *newname;
-       s4    namelen;
-       char *utf_ptr;
-       u2    c;
-       s4    i;
-       utf  *u;
-
-       utf_ptr = descriptor->text;
-       namelen = strlen(name->text) + strlen("__") + strlen("0");
-
-       /* calculate additional length */
-
-       while ((c = utf_nextu2(&utf_ptr)) != ')') {
-               switch (c) {
-               case 'Z':
-               case 'B':
-               case 'C':
-               case 'S':
-               case 'I':
-               case 'J':
-               case 'F':
-               case 'D':
-                       namelen++;
-                       break;
-               case '[':
-                       namelen += 2;
-                       break;
-               case 'L':
-                       namelen++;
-                       while (utf_nextu2(&utf_ptr) != ';')
-                               namelen++;
-                       namelen += 2;
-                       break;
-               case '(':
-                       break;
-               default:
-                       assert(0);
-               }
-       }
-
-       /* reallocate memory */
-
-       i = strlen(name->text);
-
-       newname = MNEW(char, namelen);
-       MCOPY(newname, name->text, char, i);
-
-       utf_ptr = descriptor->text;
-
-       newname[i++] = '_';
-       newname[i++] = '_';
-
-       while ((c = utf_nextu2(&utf_ptr)) != ')') {
-               switch (c) {
-               case 'Z':
-               case 'B':
-               case 'C':
-               case 'S':
-               case 'J':
-               case 'I':
-               case 'F':
-               case 'D':
-                       newname[i++] = c;
-                       break;
-               case '[':
-                       newname[i++] = '_';
-                       newname[i++] = '3';
-                       break;
-               case 'L':
-                       newname[i++] = 'L';
-                       while ((c = utf_nextu2(&utf_ptr)) != ';')
-                               if (((c >= 'a') && (c <= 'z')) ||
-                                       ((c >= 'A') && (c <= 'Z')) ||
-                                       ((c >= '0') && (c <= '9')))
-                                       newname[i++] = c;
-                               else
-                                       newname[i++] = '_';
-                       newname[i++] = '_';
-                       newname[i++] = '2';
-                       break;
-               case '(':
-                       break;
-               default:
-                       assert(0);
-               }
-       }
-
-       /* close string */
-
-       newname[i] = '\0';
-
-       /* make a utf-string */
-
-       u = utf_new_char(newname);
-
-       /* release memory */
-
-       MFREE(newname, char, namelen);
-
-       return u;
-}
-
-
-/* native_insert_char **********************************************************
-
-   Inserts the passed UTF character into the native method name.  If
-   necessary it is escaped properly.
-
-*******************************************************************************/
-
-static s4 native_insert_char(char *name, u4 pos, u2 c)
-{
-       s4 val;
-       s4 i;
-
-       switch (c) {
-       case '/':
-       case '.':
-               /* replace '/' or '.' with '_' */
-               name[pos] = '_';
-               break;
-
-       case '_':
-               /* escape sequence for '_' is '_1' */
-               name[pos]   = '_';
-               name[++pos] = '1';
-               break;
-
-       case ';':
-               /* escape sequence for ';' is '_2' */
-               name[pos]   = '_';
-               name[++pos] = '2';
-               break;
-
-       case '[':
-               /* escape sequence for '[' is '_1' */
-               name[pos]   = '_';
-               name[++pos] = '3';
-               break;
-
-       default:
-               if (isalnum(c))
-                       name[pos] = c;
-               else {
-                       /* unicode character */
-                       name[pos]   = '_';
-                       name[++pos] = '0';
-
-                       for (i = 0; i < 4; ++i) {
-                               val = c & 0x0f;
-                               name[pos + 4 - i] = (val > 10) ? ('a' + val - 10) : ('0' + val);
-                               c >>= 4;
-                       }
-
-                       pos += 4;
-               }
-               break;
-       }
-
-       /* return the new buffer index */
-
-       return pos;
-}
-
-
-/* native_method_symbol ********************************************************
-
-   Generate a method-symbol string out of the class name and the
-   method name.
-
-*******************************************************************************/
-
-static utf *native_method_symbol(utf *classname, utf *methodname)
-{
-       char *name;
-       s4    namelen;
-       char *utf_ptr;
-       char *utf_endptr;
-       u2    c;
-       u4    pos;
-       utf  *u;
-
-       /* Calculate length of native function name.  We multiply the
-          class and method name length by 6 as this is the maxium
-          escape-sequence that can be generated (unicode). */
-
-       namelen =
-               strlen("Java_") +
-               utf_get_number_of_u2s(classname) * 6 +
-               strlen("_") +
-               utf_get_number_of_u2s(methodname) * 6 +
-               strlen("0");
-
-       /* allocate memory */
-
-       name = MNEW(char, namelen);
-
-       /* generate name of native functions */
-
-       strcpy(name, "Java_");
-       pos = strlen("Java_");
-
-       utf_ptr    = classname->text;
-       utf_endptr = UTF_END(classname);
-
-       for (; utf_ptr < utf_endptr; utf_ptr++, pos++) {
-               c   = *utf_ptr;
-               pos = native_insert_char(name, pos, c);
-       }
-
-       /* seperator between class and method */
-
-       name[pos++] = '_';
-
-       utf_ptr    = methodname->text;
-       utf_endptr = UTF_END(methodname);
-
-       for (; utf_ptr < utf_endptr; utf_ptr++, pos++) {
-               c   = *utf_ptr;
-               pos = native_insert_char(name, pos, c);
-       }
-
-       /* close string */
-
-       name[pos] = '\0';
-
-       /* check for an buffer overflow */
-
-       assert(pos <= namelen);
-
-       /* make a utf-string */
-
-       u = utf_new_char(name);
-
-       /* release memory */
-
-       MFREE(name, char, namelen);
-
-       return u;
-}
-
-
-/* native_method_register ******************************************************
-
-   Register a native method in the native method table.
-
-*******************************************************************************/
-
-void native_method_register(utf *classname, const JNINativeMethod *methods,
-                                                       int32_t count)
-{
-       native_methods_node_t *nmn;
-       utf                   *name;
-       utf                   *descriptor;
-       int32_t                i;
-
-       /* insert all methods passed */
-
-       for (i = 0; i < count; i++) {
-               if (opt_verbosejni) {
-                       printf("[Registering JNI native method ");
-                       utf_display_printable_ascii_classname(classname);
-                       printf(".%s]\n", methods[i].name);
-               }
-
-               /* generate the utf8 names */
-
-               name       = utf_new_char(methods[i].name);
-               descriptor = utf_new_char(methods[i].signature);
-
-               /* allocate a new tree node */
-
-               nmn = NEW(native_methods_node_t);
-
-               nmn->classname  = classname;
-               nmn->name       = name;
-               nmn->descriptor = descriptor;
-               nmn->function   = (functionptr) (ptrint) methods[i].fnPtr;
-
-               /* insert the method into the tree */
-
-               avl_insert(tree_native_methods, nmn);
-       }
-}
-
-
-/* native_method_find **********************************************************
-
-   Find a native method in the native method table.
-
-*******************************************************************************/
-
-static functionptr native_method_find(methodinfo *m)
-{
-       native_methods_node_t  tmpnmn;
-       native_methods_node_t *nmn;
-
-       /* fill the temporary structure used for searching the tree */
-
-       tmpnmn.classname  = m->clazz->name;
-       tmpnmn.name       = m->name;
-       tmpnmn.descriptor = m->descriptor;
-
-       /* find the entry in the AVL-tree */
-
-       nmn = avl_find(tree_native_methods, &tmpnmn);
-
-       if (nmn == NULL)
-               return NULL;
-
-       return nmn->function;
-}
-
-
-/* native_method_resolve *******************************************************
-
-   Resolves a native method, maybe from a dynamic library.
-
-   IN:
-       m ... methodinfo of the native Java method to resolve
-
-   RESULT:
-       pointer to the resolved method (symbol)
-
-*******************************************************************************/
-
-functionptr native_method_resolve(methodinfo *m)
-{
-       utf                            *name;
-       utf                            *newname;
-       functionptr                     f;
-#if defined(ENABLE_DL)
-       classloader_t                  *cl;
-       hashtable_library_loader_entry *le;
-       hashtable_library_name_entry   *ne;
-       u4                              key;    /* hashkey                        */
-       u4                              slot;   /* slot in hashtable              */
-#endif
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-       methodinfo                     *method_findNative;
-       java_handle_t                  *s;
-#endif
-
-       /* verbose output */
-
-       if (opt_verbosejni) {
-               printf("[Dynamic-linking native method ");
-               utf_display_printable_ascii_classname(m->clazz->name);
-               printf(".");
-               utf_display_printable_ascii(m->name);
-               printf(" ... ");
-       }
-
-       /* generate method symbol string */
-
-       name = native_method_symbol(m->clazz->name, m->name);
-
-       /* generate overloaded function (having the types in it's name)           */
-
-       newname = native_make_overloaded_function(name, m->descriptor);
-
-       /* check the library hash entries of the classloader of the
-          methods's class  */
-
-       f = NULL;
-
-#if defined(ENABLE_DL)
-       /* Get the classloader. */
-
-       cl = class_get_classloader(m->clazz);
-
-       /* normally addresses are aligned to 4, 8 or 16 bytes */
-
-       key  = ((u4) (ptrint) cl) >> 4;                       /* align to 16-byte */
-       slot = key & (hashtable_library->size - 1);
-       le   = hashtable_library->ptr[slot];
-
-       /* iterate through loaders in this hash slot */
-
-       while ((le != NULL) && (f == NULL)) {
-               /* iterate through names in this loader */
-
-               ne = le->namelink;
-                       
-               while ((ne != NULL) && (f == NULL)) {
-                       f = (functionptr) (ptrint) os_dlsym(ne->handle, name->text);
-
-                       if (f == NULL)
-                               f = (functionptr) (ptrint) os_dlsym(ne->handle, newname->text);
-
-                       ne = ne->hashlink;
-               }
-
-               le = le->hashlink;
-       }
-
-# if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-       if (f == NULL) {
-               /* We can resolve the function directly from
-                  java.lang.ClassLoader as it's a static function. */
-               /* XXX should be done in native_init */
-
-               method_findNative =
-                       class_resolveclassmethod(class_java_lang_ClassLoader,
-                                                                        utf_findNative,
-                                                                        utf_java_lang_ClassLoader_java_lang_String__J,
-                                                                        class_java_lang_ClassLoader,
-                                                                        true);
-
-               if (method_findNative == NULL)
-                       return NULL;
-
-               /* try the normal name */
-
-               s = javastring_new(name);
-
-               f = (functionptr) (intptr_t) vm_call_method_long(method_findNative,
-                                                                                                                NULL, cl, s);
-
-               /* if not found, try the mangled name */
-
-               if (f == NULL) {
-                       s = javastring_new(newname);
-
-                       f = (functionptr) (intptr_t) vm_call_method_long(method_findNative,
-                                                                                                                        NULL, cl, s);
-               }
-       }
-# endif
-
-       if (f != NULL)
-               if (opt_verbosejni)
-                       printf("JNI ]\n");
-#endif
-
-       /* If not found, try to find the native function symbol in the
-          main program. */
-
-       if (f == NULL) {
-               f = native_method_find(m);
-
-               if (f != NULL)
-                       if (opt_verbosejni)
-                               printf("internal ]\n");
-       }
-
-#if defined(ENABLE_JVMTI)
-       /* fire Native Method Bind event */
-       if (jvmti) jvmti_NativeMethodBind(m, f, &f);
-#endif
-
-       /* no symbol found? throw exception */
-
-       if (f == NULL) {
-               if (opt_verbosejni)
-                       printf("failed ]\n");
-
-               exceptions_throw_unsatisfiedlinkerror(m->name);
-       }
-
-       return f;
-}
-
-
-/* native_library_open *********************************************************
-
-   Open a native library with the given utf8 name.
-
-   IN:
-       filename ... filename of the library to open
-
-   RETURN:
-       handle of the opened library
-
-*******************************************************************************/
-
-#if defined(ENABLE_DL)
-void* native_library_open(utf *filename)
-{
-       void* handle;
-
-       if (opt_verbosejni) {
-               printf("[Loading native library ");
-               utf_display_printable_ascii(filename);
-               printf(" ... ");
-       }
-
-       /* try to open the library */
-
-       handle = os_dlopen(filename->text, RTLD_LAZY);
-
-       if (handle == NULL) {
-               if (opt_verbosejni)
-                       printf("failed ]\n");
-
-               if (opt_verbose) {
-                       log_start();
-                       log_print("native_library_open: os_dlopen failed: ");
-                       log_print(dlerror());
-                       log_finish();
-               }
-
-               return NULL;
-       }
-
-       if (opt_verbosejni)
-               printf("OK ]\n");
-
-       return handle;
-}
-#endif
-
-
-/* native_library_close ********************************************************
-
-   Close the native library of the given handle.
-
-   IN:
-       handle ... handle of the open library
-
-*******************************************************************************/
-
-#if defined(ENABLE_DL)
-void native_library_close(void* handle)
-{
-       int result;
-
-       if (opt_verbosejni) {
-               printf("[Unloading native library ");
-/*             utf_display_printable_ascii(filename); */
-               printf(" ... ");
-       }
-
-       /* Close the library. */
-
-       result = os_dlclose(handle);
-
-       if (result != 0) {
-               if (opt_verbose) {
-                       log_start();
-                       log_print("native_library_close: os_dlclose failed: ");
-                       log_print(dlerror());
-                       log_finish();
-               }
-       }
-}
-#endif
-
-
-/* native_library_add **********************************************************
-
-   Adds an entry to the native library hashtable.
-
-*******************************************************************************/
-
-#if defined(ENABLE_DL)
-void native_library_add(utf *filename, classloader_t *loader, void* handle)
-{
-       hashtable_library_loader_entry *le;
-       hashtable_library_name_entry   *ne; /* library name                       */
-       u4   key;                           /* hashkey                            */
-       u4   slot;                          /* slot in hashtable                  */
-
-       Mutex_lock(hashtable_library->mutex);
-
-       /* normally addresses are aligned to 4, 8 or 16 bytes */
-
-       key  = ((u4) (ptrint) loader) >> 4;        /* align to 16-byte boundaries */
-       slot = key & (hashtable_library->size - 1);
-       le   = hashtable_library->ptr[slot];
-
-       /* search external hash chain for the entry */
-
-       while (le) {
-               if (le->loader == loader)
-                       break;
-
-               le = le->hashlink;                  /* next element in external chain */
-       }
-
-       /* no loader found? create a new entry */
-
-       if (le == NULL) {
-               le = NEW(hashtable_library_loader_entry);
-
-               le->loader   = loader;
-               le->namelink = NULL;
-
-               /* insert entry into hashtable */
-
-               le->hashlink =
-                       (hashtable_library_loader_entry *) hashtable_library->ptr[slot];
-               hashtable_library->ptr[slot] = le;
-
-               /* update number of hashtable-entries */
-
-               hashtable_library->entries++;
-       }
-
-
-       /* search for library name */
-
-       ne = le->namelink;
-
-       while (ne) {
-               if (ne->name == filename) {
-                       Mutex_unlock(hashtable_library->mutex);
-
-                       return;
-               }
-
-               ne = ne->hashlink;                  /* next element in external chain */
-       }
-
-       /* not found? add the library name to the classloader */
-
-       ne = NEW(hashtable_library_name_entry);
-
-       ne->name   = filename;
-       ne->handle = handle;
-
-       /* insert entry into external chain */
-
-       ne->hashlink = le->namelink;
-       le->namelink = ne;
-
-       Mutex_unlock(hashtable_library->mutex);
-}
-#endif
-
-
-/* native_library_find *********************************************************
-
-   Find an entry in the native library hashtable.
-
-*******************************************************************************/
-
-#if defined(ENABLE_DL)
-hashtable_library_name_entry *native_library_find(utf *filename,
-                                                                                                 classloader_t *loader)
-{
-       hashtable_library_loader_entry *le;
-       hashtable_library_name_entry   *ne; /* library name                       */
-       u4   key;                           /* hashkey                            */
-       u4   slot;                          /* slot in hashtable                  */
-
-       /* normally addresses are aligned to 4, 8 or 16 bytes */
-
-       key  = ((u4) (ptrint) loader) >> 4;        /* align to 16-byte boundaries */
-       slot = key & (hashtable_library->size - 1);
-       le   = hashtable_library->ptr[slot];
-
-       /* search external hash chain for the entry */
-
-       while (le) {
-               if (le->loader == loader)
-                       break;
-
-               le = le->hashlink;                  /* next element in external chain */
-       }
-
-       /* no loader found? return NULL */
-
-       if (le == NULL)
-               return NULL;
-
-       /* search for library name */
-
-       ne = le->namelink;
-
-       while (ne) {
-               if (ne->name == filename)
-                       return ne;
-
-               ne = ne->hashlink;                  /* next element in external chain */
-       }
-
-       /* return entry, if no entry was found, ne is NULL */
-
-       return ne;
-}
-#endif
-
-
-/* native_library_load *********************************************************
-
-   Load a native library and initialize it, if possible.
-
-   IN:
-       name ... name of the library
-          cl ..... classloader which loads this library
-
-   RETURN:
-       1 ... library loaded successfully
-       0 ... error
-
-*******************************************************************************/
-
-int native_library_load(JNIEnv *env, utf *name, classloader_t *cl)
-{
-#if defined(ENABLE_DL)
-       void*   handle;
-# if defined(ENABLE_JNI)
-       void*   onload;
-       int32_t version;
-# endif
-
-       if (name == NULL) {
-               exceptions_throw_nullpointerexception();
-               return 0;
-       }
-
-       /* Is the library already loaded? */
-
-       if (native_library_find(name, cl) != NULL)
-               return 1;
-
-       /* Open the library. */
-
-       handle = native_library_open(name);
-
-       if (handle == NULL)
-               return 0;
-
-# if defined(ENABLE_JNI)
-       /* Resolve JNI_OnLoad function. */
-
-       onload = os_dlsym(handle, "JNI_OnLoad");
-
-       if (onload != NULL) {
-               JNIEXPORT int32_t (JNICALL *JNI_OnLoad) (JavaVM *, void *);
-               JavaVM *vm;
-
-               JNI_OnLoad = (JNIEXPORT int32_t (JNICALL *)(JavaVM *, void *)) (ptrint) onload;
-
-               (*env)->GetJavaVM(env, &vm);
-
-               version = JNI_OnLoad(vm, NULL);
-
-               /* If the version is not 1.2 and not 1.4 the library cannot be
-                  loaded. */
-
-               if ((version != JNI_VERSION_1_2) && (version != JNI_VERSION_1_4)) {
-                       os_dlclose(handle);
-                       return 0;
-               }
-       }
-# endif
-
-       /* Insert the library name into the library hash. */
-
-       native_library_add(name, cl, handle);
-
-       return 1;
-#else
-       vm_abort("native_library_load: not available");
-
-       /* Keep compiler happy. */
-
-       return 0;
-#endif
-}
-
-
-/* native_new_and_init *********************************************************
-
-   Creates a new object on the heap and calls the initializer.
-   Returns the object pointer or NULL if memory is exhausted.
-                       
-*******************************************************************************/
-
-java_handle_t *native_new_and_init(classinfo *c)
-{
-       methodinfo    *m;
-       java_handle_t *o;
-
-       if (c == NULL)
-               vm_abort("native_new_and_init: c == NULL");
-
-       /* create object */
-
-       o = builtin_new(c);
-       
-       if (o == NULL)
-               return NULL;
-
-       /* try to find the initializer */
-
-       m = class_findmethod(c, utf_init, utf_void__void);
-                                                     
-       /* ATTENTION: returning the object here is ok, since the class may
-       not have an initializer */
-
-       if (m == NULL)
-               return o;
-
-       /* call initializer */
-
-       (void) vm_call_method(m, o);
-
-       return o;
-}
-
-
-java_handle_t *native_new_and_init_string(classinfo *c, java_handle_t *s)
-{
-       methodinfo    *m;
-       java_handle_t *o;
-
-       if (c == NULL)
-               vm_abort("native_new_and_init_string: c == NULL");
-
-       /* create object */
-
-       o = builtin_new(c);
-
-       if (o == NULL)
-               return NULL;
-
-       /* find initializer */
-
-       m = class_findmethod(c, utf_init, utf_java_lang_String__void);
-
-       /* initializer not found */
-
-       if (m == NULL)
-               return NULL;
-
-       /* call initializer */
-
-       (void) vm_call_method(m, o, s);
-
-       return o;
-}
-
-
-/*
- * 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/native/native.cpp b/src/native/native.cpp
new file mode 100644 (file)
index 0000000..62516b7
--- /dev/null
@@ -0,0 +1,1008 @@
+/* src/native/native.cpp - native library support
+
+   Copyright (C) 1996-2005, 2006, 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 <assert.h>
+#include <ctype.h>
+
+#include <stdint.h>
+
+#include "vm/types.h"
+
+#include "mm/memory.h"
+
+#include "native/jni.hpp"
+#include "native/native.hpp"
+
+#include "native/vm/nativevm.h"
+
+#include "threads/mutex.hpp"
+
+#include "toolbox/avl.h"
+#include "toolbox/hashtable.h"
+#include "toolbox/logging.h"
+
+#include "vm/jit/builtin.hpp"
+#include "vm/exceptions.hpp"
+#include "vm/global.h"
+#include "vm/globals.hpp"
+#include "vm/loader.hpp"
+#include "vm/options.h"
+#include "vm/os.hpp"
+#include "vm/resolve.h"
+#include "vm/string.hpp"
+#include "vm/vm.hpp"
+
+#include "vm/jit/asmpart.h"
+#include "vm/jit/jit.hpp"
+
+#if defined(ENABLE_JVMTI)
+#include "native/jvmti/cacaodbg.h"
+#endif
+
+
+/* global variables ***********************************************************/
+
+static avl_tree_t *tree_native_methods;
+
+#if defined(ENABLE_DL)
+static hashtable *hashtable_library;
+#endif
+
+
+/* prototypes *****************************************************************/
+
+static s4 native_tree_native_methods_comparator(const void *treenode, const void *node);
+
+
+/* native_init *****************************************************************
+
+   Initializes the native subsystem.
+
+*******************************************************************************/
+
+bool native_init(void)
+{
+       TRACESUBSYSTEMINITIALIZATION("native_init");
+
+#if defined(ENABLE_DL)
+       /* initialize library hashtable, 10 entries should be enough */
+
+       hashtable_library = NEW(hashtable);
+
+       hashtable_create(hashtable_library, 10);
+#endif
+
+       /* initialize the native methods table */
+
+       tree_native_methods = avl_create(&native_tree_native_methods_comparator);
+
+       /* everything's ok */
+
+       return true;
+}
+
+
+/* native_tree_native_methods_comparator ***************************************
+
+   Comparison function for AVL tree of native methods.
+
+   IN:
+       treenode....node in the tree
+          node........node to compare with tree-node
+
+   RETURN VALUE:
+       -1, 0, +1
+
+*******************************************************************************/
+
+static s4 native_tree_native_methods_comparator(const void *treenode, const void *node)
+{
+       const native_methods_node_t *treenmn;
+       const native_methods_node_t *nmn;
+
+       treenmn = (native_methods_node_t*) treenode;
+       nmn     = (native_methods_node_t*) node;
+
+       /* these are for walking the tree */
+
+       if (treenmn->classname < nmn->classname)
+               return -1;
+       else if (treenmn->classname > nmn->classname)
+               return 1;
+
+       if (treenmn->name < nmn->name)
+               return -1;
+       else if (treenmn->name > nmn->name)
+               return 1;
+
+       if (treenmn->descriptor < nmn->descriptor)
+               return -1;
+       else if (treenmn->descriptor > nmn->descriptor)
+               return 1;
+
+       /* all pointers are equal, we have found the entry */
+
+       return 0;
+}
+
+
+/* native_make_overloaded_function *********************************************
+
+   XXX
+
+*******************************************************************************/
+
+static utf *native_make_overloaded_function(utf *name, utf *descriptor)
+{
+       char *newname;
+       s4    namelen;
+       char *utf_ptr;
+       u2    c;
+       s4    i;
+       utf  *u;
+
+       utf_ptr = descriptor->text;
+       namelen = strlen(name->text) + strlen("__") + strlen("0");
+
+       /* calculate additional length */
+
+       while ((c = utf_nextu2(&utf_ptr)) != ')') {
+               switch (c) {
+               case 'Z':
+               case 'B':
+               case 'C':
+               case 'S':
+               case 'I':
+               case 'J':
+               case 'F':
+               case 'D':
+                       namelen++;
+                       break;
+               case '[':
+                       namelen += 2;
+                       break;
+               case 'L':
+                       namelen++;
+                       while (utf_nextu2(&utf_ptr) != ';')
+                               namelen++;
+                       namelen += 2;
+                       break;
+               case '(':
+                       break;
+               default:
+                       assert(0);
+               }
+       }
+
+       /* reallocate memory */
+
+       i = strlen(name->text);
+
+       newname = MNEW(char, namelen);
+       MCOPY(newname, name->text, char, i);
+
+       utf_ptr = descriptor->text;
+
+       newname[i++] = '_';
+       newname[i++] = '_';
+
+       while ((c = utf_nextu2(&utf_ptr)) != ')') {
+               switch (c) {
+               case 'Z':
+               case 'B':
+               case 'C':
+               case 'S':
+               case 'J':
+               case 'I':
+               case 'F':
+               case 'D':
+                       newname[i++] = c;
+                       break;
+               case '[':
+                       newname[i++] = '_';
+                       newname[i++] = '3';
+                       break;
+               case 'L':
+                       newname[i++] = 'L';
+                       while ((c = utf_nextu2(&utf_ptr)) != ';')
+                               if (((c >= 'a') && (c <= 'z')) ||
+                                       ((c >= 'A') && (c <= 'Z')) ||
+                                       ((c >= '0') && (c <= '9')))
+                                       newname[i++] = c;
+                               else
+                                       newname[i++] = '_';
+                       newname[i++] = '_';
+                       newname[i++] = '2';
+                       break;
+               case '(':
+                       break;
+               default:
+                       assert(0);
+               }
+       }
+
+       /* close string */
+
+       newname[i] = '\0';
+
+       /* make a utf-string */
+
+       u = utf_new_char(newname);
+
+       /* release memory */
+
+       MFREE(newname, char, namelen);
+
+       return u;
+}
+
+
+/* native_insert_char **********************************************************
+
+   Inserts the passed UTF character into the native method name.  If
+   necessary it is escaped properly.
+
+*******************************************************************************/
+
+static s4 native_insert_char(char *name, u4 pos, u2 c)
+{
+       s4 val;
+       s4 i;
+
+       switch (c) {
+       case '/':
+       case '.':
+               /* replace '/' or '.' with '_' */
+               name[pos] = '_';
+               break;
+
+       case '_':
+               /* escape sequence for '_' is '_1' */
+               name[pos]   = '_';
+               name[++pos] = '1';
+               break;
+
+       case ';':
+               /* escape sequence for ';' is '_2' */
+               name[pos]   = '_';
+               name[++pos] = '2';
+               break;
+
+       case '[':
+               /* escape sequence for '[' is '_1' */
+               name[pos]   = '_';
+               name[++pos] = '3';
+               break;
+
+       default:
+               if (isalnum(c))
+                       name[pos] = c;
+               else {
+                       /* unicode character */
+                       name[pos]   = '_';
+                       name[++pos] = '0';
+
+                       for (i = 0; i < 4; ++i) {
+                               val = c & 0x0f;
+                               name[pos + 4 - i] = (val > 10) ? ('a' + val - 10) : ('0' + val);
+                               c >>= 4;
+                       }
+
+                       pos += 4;
+               }
+               break;
+       }
+
+       /* return the new buffer index */
+
+       return pos;
+}
+
+
+/* native_method_symbol ********************************************************
+
+   Generate a method-symbol string out of the class name and the
+   method name.
+
+*******************************************************************************/
+
+static utf *native_method_symbol(utf *classname, utf *methodname)
+{
+       char *name;
+       s4    namelen;
+       char *utf_ptr;
+       char *utf_endptr;
+       u2    c;
+       u4    pos;
+       utf  *u;
+
+       /* Calculate length of native function name.  We multiply the
+          class and method name length by 6 as this is the maxium
+          escape-sequence that can be generated (unicode). */
+
+       namelen =
+               strlen("Java_") +
+               utf_get_number_of_u2s(classname) * 6 +
+               strlen("_") +
+               utf_get_number_of_u2s(methodname) * 6 +
+               strlen("0");
+
+       /* allocate memory */
+
+       name = MNEW(char, namelen);
+
+       /* generate name of native functions */
+
+       strcpy(name, "Java_");
+       pos = strlen("Java_");
+
+       utf_ptr    = classname->text;
+       utf_endptr = UTF_END(classname);
+
+       for (; utf_ptr < utf_endptr; utf_ptr++, pos++) {
+               c   = *utf_ptr;
+               pos = native_insert_char(name, pos, c);
+       }
+
+       /* seperator between class and method */
+
+       name[pos++] = '_';
+
+       utf_ptr    = methodname->text;
+       utf_endptr = UTF_END(methodname);
+
+       for (; utf_ptr < utf_endptr; utf_ptr++, pos++) {
+               c   = *utf_ptr;
+               pos = native_insert_char(name, pos, c);
+       }
+
+       /* close string */
+
+       name[pos] = '\0';
+
+       /* check for an buffer overflow */
+
+       assert((int32_t) pos <= namelen);
+
+       /* make a utf-string */
+
+       u = utf_new_char(name);
+
+       /* release memory */
+
+       MFREE(name, char, namelen);
+
+       return u;
+}
+
+
+/* native_method_register ******************************************************
+
+   Register a native method in the native method table.
+
+*******************************************************************************/
+
+void native_method_register(utf *classname, const JNINativeMethod *methods,
+                                                       int32_t count)
+{
+       native_methods_node_t *nmn;
+       utf                   *name;
+       utf                   *descriptor;
+       int32_t                i;
+
+       /* insert all methods passed */
+
+       for (i = 0; i < count; i++) {
+               if (opt_verbosejni) {
+                       printf("[Registering JNI native method ");
+                       utf_display_printable_ascii_classname(classname);
+                       printf(".%s]\n", methods[i].name);
+               }
+
+               /* generate the utf8 names */
+
+               name       = utf_new_char(methods[i].name);
+               descriptor = utf_new_char(methods[i].signature);
+
+               /* allocate a new tree node */
+
+               nmn = NEW(native_methods_node_t);
+
+               nmn->classname  = classname;
+               nmn->name       = name;
+               nmn->descriptor = descriptor;
+               nmn->function   = (functionptr) (ptrint) methods[i].fnPtr;
+
+               /* insert the method into the tree */
+
+               avl_insert(tree_native_methods, nmn);
+       }
+}
+
+
+/* native_method_find **********************************************************
+
+   Find a native method in the native method table.
+
+*******************************************************************************/
+
+static functionptr native_method_find(methodinfo *m)
+{
+       native_methods_node_t  tmpnmn;
+       native_methods_node_t *nmn;
+
+       /* fill the temporary structure used for searching the tree */
+
+       tmpnmn.classname  = m->clazz->name;
+       tmpnmn.name       = m->name;
+       tmpnmn.descriptor = m->descriptor;
+
+       /* find the entry in the AVL-tree */
+
+       nmn = (native_methods_node_t*) avl_find(tree_native_methods, &tmpnmn);
+
+       if (nmn == NULL)
+               return NULL;
+
+       return nmn->function;
+}
+
+
+/* native_method_resolve *******************************************************
+
+   Resolves a native method, maybe from a dynamic library.
+
+   IN:
+       m ... methodinfo of the native Java method to resolve
+
+   RESULT:
+       pointer to the resolved method (symbol)
+
+*******************************************************************************/
+
+functionptr native_method_resolve(methodinfo *m)
+{
+       utf                            *name;
+       utf                            *newname;
+       functionptr                     f;
+#if defined(ENABLE_DL)
+       classloader_t                  *cl;
+       hashtable_library_loader_entry *le;
+       hashtable_library_name_entry   *ne;
+       u4                              key;    /* hashkey                        */
+       u4                              slot;   /* slot in hashtable              */
+#endif
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       methodinfo                     *method_findNative;
+       java_handle_t                  *s;
+#endif
+
+       /* verbose output */
+
+       if (opt_verbosejni) {
+               printf("[Dynamic-linking native method ");
+               utf_display_printable_ascii_classname(m->clazz->name);
+               printf(".");
+               utf_display_printable_ascii(m->name);
+               printf(" ... ");
+       }
+
+       /* generate method symbol string */
+
+       name = native_method_symbol(m->clazz->name, m->name);
+
+       /* generate overloaded function (having the types in it's name)           */
+
+       newname = native_make_overloaded_function(name, m->descriptor);
+
+       /* check the library hash entries of the classloader of the
+          methods's class  */
+
+       f = NULL;
+
+#if defined(ENABLE_DL)
+       /* Get the classloader. */
+
+       cl = class_get_classloader(m->clazz);
+
+       /* normally addresses are aligned to 4, 8 or 16 bytes */
+
+       key  = ((u4) (ptrint) cl) >> 4;                       /* align to 16-byte */
+       slot = key & (hashtable_library->size - 1);
+       le   = (hashtable_library_loader_entry*) hashtable_library->ptr[slot];
+
+       /* iterate through loaders in this hash slot */
+
+       while ((le != NULL) && (f == NULL)) {
+               /* iterate through names in this loader */
+
+               ne = le->namelink;
+                       
+               while ((ne != NULL) && (f == NULL)) {
+                       f = (functionptr) (ptrint) os::dlsym(ne->handle, name->text);
+
+                       if (f == NULL)
+                               f = (functionptr) (ptrint) os::dlsym(ne->handle, newname->text);
+
+                       ne = ne->hashlink;
+               }
+
+               le = le->hashlink;
+       }
+
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       if (f == NULL) {
+               /* We can resolve the function directly from
+                  java.lang.ClassLoader as it's a static function. */
+               /* XXX should be done in native_init */
+
+               method_findNative =
+                       class_resolveclassmethod(class_java_lang_ClassLoader,
+                                                                        utf_findNative,
+                                                                        utf_java_lang_ClassLoader_java_lang_String__J,
+                                                                        class_java_lang_ClassLoader,
+                                                                        true);
+
+               if (method_findNative == NULL)
+                       return NULL;
+
+               /* try the normal name */
+
+               s = javastring_new(name);
+
+               f = (functionptr) (intptr_t) vm_call_method_long(method_findNative,
+                                                                                                                NULL, cl, s);
+
+               /* if not found, try the mangled name */
+
+               if (f == NULL) {
+                       s = javastring_new(newname);
+
+                       f = (functionptr) (intptr_t) vm_call_method_long(method_findNative,
+                                                                                                                        NULL, cl, s);
+               }
+       }
+# endif
+
+       if (f != NULL)
+               if (opt_verbosejni)
+                       printf("JNI ]\n");
+#endif
+
+       /* If not found, try to find the native function symbol in the
+          main program. */
+
+       if (f == NULL) {
+               f = native_method_find(m);
+
+               if (f != NULL)
+                       if (opt_verbosejni)
+                               printf("internal ]\n");
+       }
+
+#if defined(ENABLE_JVMTI)
+       /* fire Native Method Bind event */
+       if (jvmti) jvmti_NativeMethodBind(m, f, &f);
+#endif
+
+       /* no symbol found? throw exception */
+
+       if (f == NULL) {
+               if (opt_verbosejni)
+                       printf("failed ]\n");
+
+               exceptions_throw_unsatisfiedlinkerror(m->name);
+       }
+
+       return f;
+}
+
+
+/* native_library_open *********************************************************
+
+   Open a native library with the given utf8 name.
+
+   IN:
+       filename ... filename of the library to open
+
+   RETURN:
+       handle of the opened library
+
+*******************************************************************************/
+
+#if defined(ENABLE_DL)
+void* native_library_open(utf *filename)
+{
+       void* handle;
+
+       if (opt_verbosejni) {
+               printf("[Loading native library ");
+               utf_display_printable_ascii(filename);
+               printf(" ... ");
+       }
+
+       /* try to open the library */
+
+       handle = os::dlopen(filename->text, RTLD_LAZY);
+
+       if (handle == NULL) {
+               if (opt_verbosejni)
+                       printf("failed ]\n");
+
+               if (opt_verbose) {
+                       log_start();
+                       log_print("native_library_open: os::dlopen failed: ");
+                       log_print(dlerror());
+                       log_finish();
+               }
+
+               return NULL;
+       }
+
+       if (opt_verbosejni)
+               printf("OK ]\n");
+
+       return handle;
+}
+#endif
+
+
+/* native_library_close ********************************************************
+
+   Close the native library of the given handle.
+
+   IN:
+       handle ... handle of the open library
+
+*******************************************************************************/
+
+#if defined(ENABLE_DL)
+void native_library_close(void* handle)
+{
+       int result;
+
+       if (opt_verbosejni) {
+               printf("[Unloading native library ");
+/*             utf_display_printable_ascii(filename); */
+               printf(" ... ");
+       }
+
+       /* Close the library. */
+
+       result = os::dlclose(handle);
+
+       if (result != 0) {
+               if (opt_verbose) {
+                       log_start();
+                       log_print("native_library_close: os::dlclose failed: ");
+                       log_print(dlerror());
+                       log_finish();
+               }
+       }
+}
+#endif
+
+
+/* native_library_add **********************************************************
+
+   Adds an entry to the native library hashtable.
+
+*******************************************************************************/
+
+#if defined(ENABLE_DL)
+void native_library_add(utf *filename, classloader_t *loader, void* handle)
+{
+       hashtable_library_loader_entry *le;
+       hashtable_library_name_entry   *ne; /* library name                       */
+       u4   key;                           /* hashkey                            */
+       u4   slot;                          /* slot in hashtable                  */
+
+       hashtable_library->mutex->lock();
+
+       /* normally addresses are aligned to 4, 8 or 16 bytes */
+
+       key  = ((u4) (ptrint) loader) >> 4;        /* align to 16-byte boundaries */
+       slot = key & (hashtable_library->size - 1);
+       le   = (hashtable_library_loader_entry*) hashtable_library->ptr[slot];
+
+       /* search external hash chain for the entry */
+
+       while (le) {
+               if (le->loader == loader)
+                       break;
+
+               le = le->hashlink;                  /* next element in external chain */
+       }
+
+       /* no loader found? create a new entry */
+
+       if (le == NULL) {
+               le = NEW(hashtable_library_loader_entry);
+
+               le->loader   = loader;
+               le->namelink = NULL;
+
+               /* insert entry into hashtable */
+
+               le->hashlink =
+                       (hashtable_library_loader_entry *) hashtable_library->ptr[slot];
+               hashtable_library->ptr[slot] = le;
+
+               /* update number of hashtable-entries */
+
+               hashtable_library->entries++;
+       }
+
+
+       /* search for library name */
+
+       ne = le->namelink;
+
+       while (ne) {
+               if (ne->name == filename) {
+                       hashtable_library->mutex->unlock();
+                       return;
+               }
+
+               ne = ne->hashlink;                  /* next element in external chain */
+       }
+
+       /* not found? add the library name to the classloader */
+
+       ne = NEW(hashtable_library_name_entry);
+
+       ne->name   = filename;
+       ne->handle = handle;
+
+       /* insert entry into external chain */
+
+       ne->hashlink = le->namelink;
+       le->namelink = ne;
+
+       hashtable_library->mutex->unlock();
+}
+#endif
+
+
+/* native_library_find *********************************************************
+
+   Find an entry in the native library hashtable.
+
+*******************************************************************************/
+
+#if defined(ENABLE_DL)
+hashtable_library_name_entry *native_library_find(utf *filename,
+                                                                                                 classloader_t *loader)
+{
+       hashtable_library_loader_entry *le;
+       hashtable_library_name_entry   *ne; /* library name                       */
+       u4   key;                           /* hashkey                            */
+       u4   slot;                          /* slot in hashtable                  */
+
+       /* normally addresses are aligned to 4, 8 or 16 bytes */
+
+       key  = ((u4) (ptrint) loader) >> 4;        /* align to 16-byte boundaries */
+       slot = key & (hashtable_library->size - 1);
+       le   = (hashtable_library_loader_entry*) hashtable_library->ptr[slot];
+
+       /* search external hash chain for the entry */
+
+       while (le) {
+               if (le->loader == loader)
+                       break;
+
+               le = le->hashlink;                  /* next element in external chain */
+       }
+
+       /* no loader found? return NULL */
+
+       if (le == NULL)
+               return NULL;
+
+       /* search for library name */
+
+       ne = le->namelink;
+
+       while (ne) {
+               if (ne->name == filename)
+                       return ne;
+
+               ne = ne->hashlink;                  /* next element in external chain */
+       }
+
+       /* return entry, if no entry was found, ne is NULL */
+
+       return ne;
+}
+#endif
+
+
+/* native_library_load *********************************************************
+
+   Load a native library and initialize it, if possible.
+
+   IN:
+       name ... name of the library
+          cl ..... classloader which loads this library
+
+   RETURN:
+       1 ... library loaded successfully
+       0 ... error
+
+*******************************************************************************/
+
+int native_library_load(JNIEnv *env, utf *name, classloader_t *cl)
+{
+#if defined(ENABLE_DL)
+       void*   handle;
+# if defined(ENABLE_JNI)
+       void*   onload;
+       int32_t version;
+# endif
+
+       if (name == NULL) {
+               exceptions_throw_nullpointerexception();
+               return 0;
+       }
+
+       /* Is the library already loaded? */
+
+       if (native_library_find(name, cl) != NULL)
+               return 1;
+
+       /* Open the library. */
+
+       handle = native_library_open(name);
+
+       if (handle == NULL)
+               return 0;
+
+# if defined(ENABLE_JNI)
+       /* Resolve JNI_OnLoad function. */
+
+       onload = os::dlsym(handle, "JNI_OnLoad");
+
+       if (onload != NULL) {
+               JNIEXPORT int32_t (JNICALL *JNI_OnLoad) (JavaVM *, void *);
+               JavaVM *vm;
+
+               JNI_OnLoad = (JNIEXPORT int32_t (JNICALL *)(JavaVM *, void *)) (ptrint) onload;
+
+               env->GetJavaVM(&vm);
+
+               version = JNI_OnLoad(vm, NULL);
+
+               /* If the version is not 1.2 and not 1.4 the library cannot be
+                  loaded. */
+
+               if ((version != JNI_VERSION_1_2) && (version != JNI_VERSION_1_4)) {
+                       os::dlclose(handle);
+                       return 0;
+               }
+       }
+# endif
+
+       /* Insert the library name into the library hash. */
+
+       native_library_add(name, cl, handle);
+
+       return 1;
+#else
+       vm_abort("native_library_load: not available");
+
+       /* Keep compiler happy. */
+
+       return 0;
+#endif
+}
+
+
+/* native_new_and_init *********************************************************
+
+   Creates a new object on the heap and calls the initializer.
+   Returns the object pointer or NULL if memory is exhausted.
+                       
+*******************************************************************************/
+
+java_handle_t *native_new_and_init(classinfo *c)
+{
+       methodinfo    *m;
+       java_handle_t *o;
+
+       if (c == NULL)
+               vm_abort("native_new_and_init: c == NULL");
+
+       /* create object */
+
+       o = builtin_new(c);
+       
+       if (o == NULL)
+               return NULL;
+
+       /* try to find the initializer */
+
+       m = class_findmethod(c, utf_init, utf_void__void);
+                                                     
+       /* ATTENTION: returning the object here is ok, since the class may
+       not have an initializer */
+
+       if (m == NULL)
+               return o;
+
+       /* call initializer */
+
+       (void) vm_call_method(m, o);
+
+       return o;
+}
+
+
+java_handle_t *native_new_and_init_string(classinfo *c, java_handle_t *s)
+{
+       methodinfo    *m;
+       java_handle_t *o;
+
+       if (c == NULL)
+               vm_abort("native_new_and_init_string: c == NULL");
+
+       /* create object */
+
+       o = builtin_new(c);
+
+       if (o == NULL)
+               return NULL;
+
+       /* find initializer */
+
+       m = class_findmethod(c, utf_init, utf_java_lang_String__void);
+
+       /* initializer not found */
+
+       if (m == NULL)
+               return NULL;
+
+       /* call initializer */
+
+       (void) vm_call_method(m, o, s);
+
+       return o;
+}
+
+
+/*
+ * 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/native/native.h b/src/native/native.h
deleted file mode 100644 (file)
index d795b28..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/* src/native/native.h - native library support
-
-   Copyright (C) 1996-2005, 2006, 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 _NATIVE_H
-#define _NATIVE_H
-
-#include "config.h"
-
-#include <stdint.h>
-
-#include "native/jni.hpp"
-
-#include "vm/class.h"
-#include "vm/global.h"
-#include "vm/loader.hpp"
-#include "vm/method.h"
-#include "vm/os.hpp"
-#include "vm/utf8.h"
-
-
-/* defines ********************************************************************/
-
-#define NATIVE_METHODS_COUNT    sizeof(methods) / sizeof(JNINativeMethod)
-
-
-#define NATIVE_LIBRARY_PREFIX     "lib"
-
-#if defined(__DARWIN__)
-# define NATIVE_LIBRARY_SUFFIX    ".dylib"
-#else
-# define NATIVE_LIBRARY_SUFFIX    ".so"
-#endif
-
-
-/* native_methods_node_t ******************************************************/
-
-typedef struct native_methods_node_t native_methods_node_t;
-
-struct native_methods_node_t {
-       utf         *classname;             /* class name                         */
-       utf         *name;                  /* method name                        */
-       utf         *descriptor;            /* descriptor name                    */
-       functionptr  function;              /* pointer to the implementation      */
-};
-
-
-/* hashtable_library_loader_entry *********************************************/
-
-#if defined(ENABLE_DL)
-typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
-typedef struct hashtable_library_name_entry   hashtable_library_name_entry;
-
-struct hashtable_library_loader_entry {
-       classloader_t                  *loader;  /* class loader                  */
-       hashtable_library_name_entry   *namelink;/* libs loaded by this loader    */
-       hashtable_library_loader_entry *hashlink;/* link for external chaining    */
-};
-#endif
-
-
-/* hashtable_library_name_entry ***********************************************/
-
-#if defined(ENABLE_DL)
-struct hashtable_library_name_entry {
-       utf                          *name;      /* library name                  */
-       void*                         handle;    /* libtool library handle        */
-       hashtable_library_name_entry *hashlink;  /* link for external chaining    */
-};
-#endif
-
-
-/* function prototypes ********************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-bool native_init(void);
-
-void        native_method_register(utf *classname, const JNINativeMethod *methods, int32_t count);
-functionptr native_method_resolve(methodinfo *m);
-
-#if defined(ENABLE_DL)
-void*       native_library_open(utf *filename);
-void        native_library_close(void* handle);
-void        native_library_add(utf *filename, classloader_t *loader, void *handle);
-hashtable_library_name_entry *native_library_find(utf *filename, classloader_t *loader);
-int         native_library_load(JNIEnv *env, utf *name, classloader_t *cl);
-#endif
-
-java_handle_t *native_new_and_init(classinfo *c);
-java_handle_t *native_new_and_init_string(classinfo *c, java_handle_t *s);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NATIVE_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:
- */
diff --git a/src/native/native.hpp b/src/native/native.hpp
new file mode 100644 (file)
index 0000000..19b9f69
--- /dev/null
@@ -0,0 +1,133 @@
+/* src/native/native.hpp - native library support
+
+   Copyright (C) 1996-2005, 2006, 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 _NATIVE_HPP
+#define _NATIVE_HPP
+
+#include <stdint.h>
+
+#include "native/jni.hpp"
+
+#include "vm/class.h"
+#include "vm/global.h"
+#include "vm/loader.hpp"
+#include "vm/method.h"
+#include "vm/os.hpp"
+#include "vm/utf8.h"
+
+
+/* defines ********************************************************************/
+
+#define NATIVE_METHODS_COUNT    sizeof(methods) / sizeof(JNINativeMethod)
+
+
+#define NATIVE_LIBRARY_PREFIX     "lib"
+
+#if defined(__DARWIN__)
+# define NATIVE_LIBRARY_SUFFIX    ".dylib"
+#else
+# define NATIVE_LIBRARY_SUFFIX    ".so"
+#endif
+
+
+/* native_methods_node_t ******************************************************/
+
+typedef struct native_methods_node_t native_methods_node_t;
+
+struct native_methods_node_t {
+       utf         *classname;             /* class name                         */
+       utf         *name;                  /* method name                        */
+       utf         *descriptor;            /* descriptor name                    */
+       functionptr  function;              /* pointer to the implementation      */
+};
+
+
+/* hashtable_library_loader_entry *********************************************/
+
+#if defined(ENABLE_DL)
+typedef struct hashtable_library_loader_entry hashtable_library_loader_entry;
+typedef struct hashtable_library_name_entry   hashtable_library_name_entry;
+
+struct hashtable_library_loader_entry {
+       classloader_t                  *loader;  /* class loader                  */
+       hashtable_library_name_entry   *namelink;/* libs loaded by this loader    */
+       hashtable_library_loader_entry *hashlink;/* link for external chaining    */
+};
+#endif
+
+
+/* hashtable_library_name_entry ***********************************************/
+
+#if defined(ENABLE_DL)
+struct hashtable_library_name_entry {
+       utf                          *name;      /* library name                  */
+       void*                         handle;    /* libtool library handle        */
+       hashtable_library_name_entry *hashlink;  /* link for external chaining    */
+};
+#endif
+
+
+/* function prototypes ********************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool native_init(void);
+
+void        native_method_register(utf *classname, const JNINativeMethod *methods, int32_t count);
+functionptr native_method_resolve(methodinfo *m);
+
+#if defined(ENABLE_DL)
+void*       native_library_open(utf *filename);
+void        native_library_close(void* handle);
+void        native_library_add(utf *filename, classloader_t *loader, void *handle);
+hashtable_library_name_entry *native_library_find(utf *filename, classloader_t *loader);
+int         native_library_load(JNIEnv *env, utf *name, classloader_t *cl);
+#endif
+
+java_handle_t *native_new_and_init(classinfo *c);
+java_handle_t *native_new_and_init_string(classinfo *c, java_handle_t *s);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _NATIVE_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:
+ */
index 328a39d13d4370f6618b10b48dc645d51c31ad36..75ca9c21e924186a33bb36e51ff3c0f4aa7cdedc 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/com_sun_cldc_io_ResourceInputStream.h"
index 9d2058b5ac058f83bfbe6192b5ddf1c2669ae090..2776de22b2aabacfc5a312ac71b8d0bb2617fa29 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/com_sun_cldc_io_j2me_socket_Protocol.h"
index d3b4b1c2de9be73da2be83f0e1ce7031fb86ae99..448c75f02d3df827e127691631dfc73a6359ae25 100644 (file)
@@ -31,7 +31,7 @@
 #include "vm/types.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/com_sun_cldchi_io_ConsoleOutputStream.h"
index 02399192c56674260dd70f1c11f672f23c4ba99c..3e0b45434836372092329326a3ebd413b173e394 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/com_sun_cldchi_jvm_JVM.h"
index cdfe87c5677d3171a1e4c1bb4425b8feed71ebfc..90ed82147800c6a373d1e87ea5f17c0c0e19e57a 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Class.h"
index 19146e44c184a7b1696d1cb1a9e49bd1a3c985ea..594e8a265e236f43b23b45a284d2c1969ce1f5fb 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Double.h"
index 0d98b2833219f725e88cb711ee959e36d7ee9859..ab49dda7bb0c958f235fd5b095543da826ad7d05 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Float.h"
index 8ca741ecb18d3f269f8868c6dcc109cca8ba7827..a5827b97b2720848d1df7d18325d8f91a9bbc837 100644 (file)
@@ -30,7 +30,7 @@
 #include "fdlibm/fdlibm.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Math.h"
index c207903e763b5fd228022365d199037e3e6c3e5b..9df64c167b198ce6c36333f767c0f5cf9011ead9 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Object.h"
index 62c6c48fb9cf731cf60c9196f218093713895068..9e93c0825ce633af9ac10e498cd3f2f3c350627a 100644 (file)
@@ -30,7 +30,7 @@
 #include "mm/gc.hpp"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Runtime.h"
index 921ae0d7086c3542c142a2f9a3c08667bf193d23..e93d25af43f3bbdff1576a2ee8043ac29ce10166 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_String.h"
index ec1ce50c7f57cbdad81a467852828e331de47a30..e47c3c15bbd100771962d8defba1114cf3d19a8f 100644 (file)
@@ -31,7 +31,7 @@
 #include "mm/memory.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_System.h"
index 75f8f20d6bfbaaf1ada04f15589bbc9193fd6dbc..9863574e1354dc0ccff244528bb6b27aa7d021a6 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Thread.h"
index d839f09c42c7e7b38f258d550275b390a68175ec..785e9677dd7a397583838a27423ac453701930a9 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Throwable.h"
index b36eaeea482b0b5281002a98290428e7ad6315b9..ee8becd8c52cb00b39d032ba97ae81c631b3dfc9 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/gnu_classpath_VMStackWalker.h"
index 76e766592913f7f976b75d596e6195f741d009ce..7b14b4329ebb639a3e3504eac2978c85469073e3 100644 (file)
@@ -33,7 +33,7 @@
 #include "mm/memory.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/gnu_classpath_VMSystemProperties.h"
index de6aa0e6d922f2e4d0d484e9b55914c5bc2f7564..90f92c89f778e138aa350c78e67acde602d8e6a2 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/gnu_java_lang_VMCPStringBuilder.h"
index d13cc78d9fdb0da0bc6c6f78cbc36cc45312e029..7008efccf1c867c8fe7c963a239a258b74d153b0 100644 (file)
@@ -30,7 +30,7 @@
 #include "mm/gc.hpp"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/gnu_java_lang_management_VMClassLoadingMXBeanImpl.h"
index 30e576a69e3205097e9fb77f05a7dee7baa0bc36..b7440e8e019fec4d6a583176c63f05ef05ca6fab 100644 (file)
@@ -30,7 +30,7 @@
 #include "mm/gc.hpp"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/gnu_java_lang_management_VMMemoryMXBeanImpl.h"
index 673645eda713081270e87e07aeb8e42c4a614542..daeee412030de6dc677b0b3ca1c7740bab8f395c 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/gnu_java_lang_management_VMRuntimeMXBeanImpl.h"
index e8a600899edfda23e1c99eae66cb188e65361657..85be25bfc2181718877f5f869a483ec3314b2b9d 100644 (file)
@@ -30,7 +30,7 @@
 #include "mm/gc.hpp"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/gnu_java_lang_management_VMThreadMXBeanImpl.h"
index 9298bbc17edab82055e2467ea7c04291b17bcb7c..95d712d0626a597476ff0a82735070f2dde0547f 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMClass.h"
index 63bb7774bccfcec5ec034617022c07460f83dd19..32bc1660e90f0785846d6a48cacb657d649c5f53 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMClassLoader.h"
index 168a2b482a457731b2e3e6411930ee1c21964cfb..48353ad35edbe11556d1037cc2ca5f93cfd6f013 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMObject.h"
index ba23fcc7e0b617072f4df84b8561f581edc8ed99..4e7a39ee0d830c8b8a981dcaaab8ad344e7e513b 100644 (file)
@@ -43,7 +43,7 @@
 #include "mm/gc.hpp"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMRuntime.h"
index 6b1dd3d1726787044dc1ecbe708cf6d6706cb7e9..80f06722520a63714d0bbe7129a2537f5d01aa0b 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMString.h"
index 8334ebfead2770ce5137b0f7a352c133a9f1aa79..a8f4b334c7306af1948e4f6aee4455299599b96e 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vminclude/java_lang_VMSystem.h"
index 470cf627f80a6933621dd0c4c6a302cb6d51e657..84d5c41d323c699583734825333d45514b94c735 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMThread.h"
index 6eedf4b4cfe04de795e6aa4e4c0bb74244a00492..7513be2779ea30e82b189878434df39563f90fd3 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_VMThrowable.h"
index b92404a43ea41a2983c843af72f99545809ff044..8f4a20444d2ff159cb250d17165dd816c1b29f9c 100644 (file)
@@ -30,7 +30,7 @@
 #include "vm/types.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_management_VMManagementFactory.h"
index ffb0bb737a20afdcc57a15d799de5eb25ad94126..ffd97f2b9bfd98c5e8b7df66621eb17f6fab8460 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_reflect_VMConstructor.h"
index d595cfc45f9900d0b6b25cbb2458224d744c34e6..e89c7edf5b4bff801ebd9181fcff3cc60fa7a7a3 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_reflect_VMField.h"
index 23435edc63fc8ae63d386cb51f9499f26dbef680..16b34aab3373245f89ba40a8f89644ce73496df5 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_lang_reflect_VMMethod.h"
index da0c62bc4039b5257d8a57ab75e89a7b1f1d2789..e52de0e350bcad030b8e557d2ea4e19081ca1554 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdlib.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 // FIXME
 //#include "native/include/java_lang_reflect_VMProxy.h"
index 4ad6e3c7e66ca02c398276dca368d91a77a935c6..90cd29a5457477d77e9db4d45e1641b3e3449208 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/vm/include/java_security_VMAccessController.h"
index 26ef8a4e4f4ccd72794b71f32ff7d21cd76d47c1..940559cc2a063026d6ca03af38f7cda993115e36 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_util_concurrent_atomic_AtomicLong.h"
index 3b54046650f1ec36e8959c151bd9a4e4f696e021..eb063169e1e77dd3e8f4e3a23bdcd360f88b677a 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 // FIXME
 //#include "native/include/sun_reflect_ConstantPool.h"
index 7558d1040e138a9b3e6e74ada53f5edbc86639e4..9f9880f47afd1817f5c31a5bb4156138217255b9 100644 (file)
@@ -38,7 +38,7 @@
 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
 # include "mm/memory.h"
 
-# include "native/native.h"
+# include "native/native.hpp"
 
 # include "native/vm/openjdk/hpi.h"
 
index d0d0d1f01090987bdd400295f51480d61faff737..50cdab47226f0ebc1e6b171b97fffe37b4067b86 100644 (file)
@@ -34,7 +34,7 @@
 #include "mm/memory.h"
 
 #include "native/jni.hpp"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "native/vm/openjdk/hpi.h"
 
index 081f86f25d01bd4cc7c1498c5d3fcb87f81625c5..21dca2942ece02fd17b216d34e5fec165017ce40 100644 (file)
@@ -47,7 +47,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "native/vm/reflection.hpp"
 
index 14ba348a2879d137e9e1c22eb1e0b599af231a56..48c181a3fb226afadacc28a692056173a0bf26fe 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdint.h>
 
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_ANNOTATIONS) && defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
 # include "vm/vm.hpp"
index 4e4fbb4c7260767ce6e915319ee239a852ff330a..c4fe674e261db912eded548e089f848ebdd172d0 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <stdint.h>
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/field.hpp"
 #include "vm/method.h"
index ba4ca65c8bf4d3d3dd4acd838fe241f102d22ea1..ac68e24e3a78faf8eed6c3ebce4d96945319cf18 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/sun_misc_Unsafe.h"
index ec760be6ccf0b9bcfe748240da97f5b6fedd9469..e109ca40c14a3b4a0d11be615ef1ef3a027f4995 100644 (file)
@@ -50,7 +50,7 @@
 #endif
 
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/condition.hpp"
 #include "threads/lock.hpp"
index c5fb08e37cee8d88c09937c9cbc3ef6180f3b49d..93dcc4c8828206613f7666d4a39fce2052968344 100644 (file)
@@ -40,7 +40,7 @@
 #endif
 
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 #include "threads/threadlist.hpp"
index c968fa8a9e9d020800465b2044d998539f4beed4..c95513b30ea0312a43e77701b4452ab9046be80f 100644 (file)
@@ -73,6 +73,10 @@ struct avl_node_t {
 
 /* function prototypes ********************************************************/
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 avl_tree_t *avl_create(avl_comparator *comparator);
 bool        avl_insert(avl_tree_t *tree, void *data);
 void       *avl_find(avl_tree_t *tree, void *data);
@@ -81,6 +85,10 @@ void       *avl_find(avl_tree_t *tree, void *data);
 void        avl_dump(avl_node_t* node, s4 indent);
 #endif
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif /* _AVL_H */
 
 
index c1145940fa2748c9a3f2081fb66f8b8f5502a7f6..eb57f9e6c16e15700d2a83e75787f1b5ba2e08da 100644 (file)
@@ -38,7 +38,7 @@
 #include "mm/memory.h"
 
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 #include "threads/thread.hpp"
index 624586bfb0b4d97dc156e518a00ae5cc3c806e77..20819fe7f821ab2742673228b29461f82a4adfa2 100644 (file)
@@ -39,7 +39,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index 1f3a9342273fdcdd32c6632f1652a3a7f9ffc6c3..4490f2549391e2c753768ad8e0a19446af6b1d03 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 9e47068e4878e00dd17ea31cd7c353102c193a31..c60f89b9aa570b1a35a6703ff6474cc832a8575f 100644 (file)
@@ -38,7 +38,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index 7115d4f5d83bbef486286f76f366c84c114e5992..105fa094468ba9c607cdc72aa5a42d02f855bff6 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index df864923a91eaecb5a5c00f158e48ffd0b830b46..4f6b62418855870b28cab17aba9eb0cffaef74c0 100644 (file)
@@ -59,7 +59,7 @@
 
 #include "native/llni.h"
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/thread.hpp"
 
index f9caf4e844a91315f90357f65f0dc7cb1a29aa66..b96eccfe9f9a05ca219a6f2d36a7c3921bfdd565 100644 (file)
@@ -39,7 +39,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index b2146eae5672c4265838c89a9bc45497f8fcf6ea..47bd53ffbaa95926e63c2d599b10c72589567178 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index b732399e1502c3aa5fb586e48c371ee28d71a808..f404c8d5ea8ee7155025aa0d3d29a3bf3af3380f 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 2899588285fbd9c991101b54eb6ae0013f8f9322..191c562c2e5c64dc77cf5cd16011fd82ab84304e 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 5d77f88b447ca1a9f45cee5dbecf82da2b08129b..6852a963303b3bc177b118407ca0da0584d8aa50 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "toolbox/logging.h"
 
index 92a29af50558eb856281a9398303ddc4b859647f..d45f8ad2473f0379b7dab6028192f8ebdaa8d338 100644 (file)
@@ -37,7 +37,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index c9f55dfacf8bb1f3c9e089dc24c262f43e891bb2..d3f27b76f9e618e24da75e28248a66c92dbbfe3c 100644 (file)
@@ -32,7 +32,7 @@
 #include "vm/jit/m68k/md.h"
 
 #include "mm/memory.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index d236847d8451906f2e5dbf3549ac1523824a1355..e348d1a43471377331f2bf8ebbce7c59bbe7b7a9 100644 (file)
@@ -38,7 +38,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index 248635ba99131303d9e582e3f6e8bb67792544ad..a32f18b9f24b51578aec4681844fdd494220177b 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 9110e9c68557205ea26142b3cdb15964406c5f4d..7cd0cb658559552464d9b6298d14ac6a35cac1b6 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index e76ecfdc023071c2006e4c5e72a538df0d278f92..737631c9acb8370550fde1c4b1e6a590fad49c39 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "toolbox/list.hpp"
 #include "toolbox/logging.h"           /* XXX remove me! */
index 6cb313f397b3483d7ff666fe585b77a4f4835080..00f620136585263195e63a484df9fa87d641b9a1 100644 (file)
@@ -39,7 +39,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index 186131ee4ccaeb5425880050c73ac9523dd08595..d83e6b0f78b599e7be934c43f42a22beafd7aa5c 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index de0a1ac3a2fc901b6ceb012052f551e0173ee3a4..4b163f3fe37d2e6a471b982f0293bcc2e8af65db 100644 (file)
@@ -40,7 +40,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index 999ae7aae28b241ed162afbedb7e2c8e3295da4c..dfedbafda0b39c5bec7a7fa46e9930ab8dbca3c5 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 9b6209c808f9bbf35d16b0f4fdecddd5b90260ac..753550e268cfb425f8df969efd9f9cbc095711f4 100644 (file)
@@ -35,7 +35,7 @@
 #include "vm/jit/s390/md-abi.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "mm/memory.h"
 
index c5c0e6a3718f56aa2ccfb54341b1417e2d55d6a0..4fdd63ff11a6f915739bb15efe512003c035c637 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdint.h>
 
 #include "mm/memory.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 8534103202f024cfd4ba90c405aa7c481df35a18..5f09f8ed69c846d03a03d0b0521d32d4c2c9dbb9 100644 (file)
@@ -40,7 +40,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
index 2d9cc8da91bb3d2e1c0d18007ce8f03af68ef85b..b8d40910446b085835b2bd9f17e7b179227288cb 100644 (file)
@@ -36,7 +36,7 @@
 #include "vm/jit/sparc64/md.h"
 #include "vm/jit/sparc64/md-abi.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index 16bba39e18f888ff701c75df576e01f4fadbc52d..b5c15689c40d8c5ade946a28a35491de2996e94e 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "toolbox/logging.h"
 
index b14d4419432e5fe408bc7017eb72b1233d919572..67ca099ab08d7db09cb40bae81fb898f6391259b 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "toolbox/logging.h"
 
index 8ee015dbf10e2a3a469481e332413e2c1668491c..6d85fb6641c0635018c39b2b21e6a439341ae910 100644 (file)
@@ -143,7 +143,7 @@ error reporting.
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "toolbox/logging.h"
 
index f3d15b2c9c636f518bda1b17b4758c8a42bf7b1c..1c2ecb0cb283e69992b58dc7fa781a8d9e5ce0e8 100644 (file)
@@ -40,7 +40,7 @@
 #include "mm/memory.h"
 
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 
index 49a5d3f6abbd04cd355f7c5a0afe10453bf648fb..b4a3805ccc51af617020b2b55c0358c17d38193e 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "vm/jit/builtin.hpp"
 #include "vm/class.h"
index c9bc3a4b7049cde8b424c75bca1cb15bb3495325..64bbc0a12ad56d370973e5782e2d1e0992aa673d 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "mm/memory.h"
 
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "threads/lock.hpp"
 #include "threads/mutex.hpp"
index f581650dade66d263d886af0b37852f51ddb258e..296834f161c4aa0851e8371841a1053cdab50b8b 100644 (file)
@@ -265,9 +265,7 @@ extern "C" {
 #if defined(ENABLE_JRE_LAYOUT)
        char*  os_dirname(char* path) { return os::dirname(path); }
 #endif
-       int    os_dlclose(void* handle) { return os::dlclose(handle); }
        char*  os_dlerror(void) { return os::dlerror(); }
-       void*  os_dlopen(const char* filename, int flag) { return os::dlopen(filename, flag); }
        void*  os_dlsym(void* handle, const char* symbol) { return os::dlsym(handle, symbol); }
        int    os_fclose(FILE* fp) { return os::fclose(fp); }
        FILE*  os_fopen(const char* path, const char* mode) { return os::fopen(path, mode); }
index 966b08fa0e72dd8eedd1d62af62c186f5f0304a6..82f8c4811864fab25c974971025b70a3ecc2d16e 100644 (file)
@@ -644,9 +644,7 @@ int    os_access(const char* pathname, int mode);
 int    os_atoi(const char* nptr);
 void*  os_calloc(size_t nmemb, size_t size);
 char*  os_dirname(char* path);
-int    os_dlclose(void* handle);
 char*  os_dlerror(void);
-void*  os_dlopen(const char* filename, int flag);
 void*  os_dlsym(void* handle, const char* symbol);
 int    os_fclose(FILE* fp);
 FILE*  os_fopen(const char* path, const char* mode);
index 4da7f538253d0410f14a633cf3c5834b8650f28d..c273270a0a33064230faf5bd04d04983d19685a9 100644 (file)
@@ -48,7 +48,7 @@
 #include "native/jni.hpp"
 #include "native/llni.h"
 #include "native/localref.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #include "native/vm/nativevm.h"