* src/vm/builtin.c: Moved to .cpp.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 22 Aug 2008 07:58:10 +0000 (09:58 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 22 Aug 2008 07:58:10 +0000 (09:58 +0200)
* src/vm/builtin.h: Likewise.
* src/vm/builtintable.inc: Likewise.
* src/vm/jit/builtin.cpp: New file.
* src/vm/jit/builtin.hpp: Likewise.
* src/vm/jit/builtintable.inc: Likewise.
* src/mm/gc-boehm.cpp,
src/mm/gc-none.cpp,
src/native/jni.cpp,
src/native/jvmti/cacaodbg.c,
src/native/jvmti/jvmti.c,
src/native/native.c,
src/native/vm/cldc1.1/com_sun_cldc_io_ResourceInputStream.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_System.cpp,
src/native/vm/cldc1.1/java_lang_Thread.cpp,
src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.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/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_VMSystem.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_VMField.cpp,
src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp,
src/native/vm/openjdk/jvm.cpp,
src/native/vm/reflection.cpp,
src/native/vm/sun_misc_Unsafe.cpp,
src/threads/none/thread-none.h,
src/threads/posix/thread-posix.cpp,
src/threads/thread.cpp,
src/vm/Makefile.am,
src/vm/access.c,
src/vm/annotation.c,
src/vm/class.c,
src/vm/exceptions.cpp,
src/vm/field.c,
src/vm/finalizer.c,
src/vm/initialize.c,
src/vm/javaobjects.cpp,
src/vm/jit/Makefile.am,
src/vm/jit/allocator/liveness.c,
src/vm/jit/allocator/lsra.c,
src/vm/jit/allocator/simplereg.c,
src/vm/jit/alpha/codegen.c,
src/vm/jit/alpha/linux/md-os.c,
src/vm/jit/alpha/patcher.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/arm/patcher.c,
src/vm/jit/codegen-common.c,
src/vm/jit/codegen-common.h,
src/vm/jit/i386/codegen.c,
src/vm/jit/i386/darwin/md-os.c,
src/vm/jit/i386/linux/md-os.c,
src/vm/jit/i386/patcher.c,
src/vm/jit/i386/solaris/md-os.c,
src/vm/jit/inline/inline.c,
src/vm/jit/intrp/asmpart.c,
src/vm/jit/intrp/codegen.c,
src/vm/jit/intrp/engine.c,
src/vm/jit/intrp/patcher.c,
src/vm/jit/loop/tracing.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/m68k/emit.c,
src/vm/jit/m68k/patcher.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/mips/emit.c,
src/vm/jit/mips/patcher.c,
src/vm/jit/optimizing/lifetimes.c,
src/vm/jit/optimizing/profile.c,
src/vm/jit/optimizing/recompile.c,
src/vm/jit/optimizing/ssa.c,
src/vm/jit/optimizing/ssa_phi.c,
src/vm/jit/optimizing/ssa_rename.c,
src/vm/jit/parse.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc/darwin/md-os.c,
src/vm/jit/powerpc/linux/md-os.c,
src/vm/jit/powerpc/patcher.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/powerpc64/linux/md-os.c,
src/vm/jit/powerpc64/patcher.c,
src/vm/jit/s390/codegen.c,
src/vm/jit/s390/emit.c,
src/vm/jit/s390/patcher.c,
src/vm/jit/show.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/sparc64/emit.c,
src/vm/jit/sparc64/patcher.c,
src/vm/jit/stack.c,
src/vm/jit/stacktrace.cpp,
src/vm/jit/verify/typecheck-stackbased.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/linux/md-os.c,
src/vm/jit/x86_64/patcher.c,
src/vm/jit/x86_64/solaris/md-os.c,
src/vm/loader.c,
src/vm/method.c,
src/vm/method.h,
src/vm/primitive.cpp,
src/vm/string.cpp,
src/vm/vm.cpp: Changed include and other related changes.

--HG--
rename : src/vm/builtin.c => src/vm/jit/builtin.cpp
rename : src/vm/builtin.h => src/vm/jit/builtin.hpp
rename : src/vm/builtintable.inc => src/vm/jit/builtintable.inc

107 files changed:
src/mm/gc-boehm.cpp
src/mm/gc-none.cpp
src/native/jni.cpp
src/native/jvmti/cacaodbg.c
src/native/jvmti/jvmti.c
src/native/native.c
src/native/vm/cldc1.1/com_sun_cldc_io_ResourceInputStream.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_System.cpp
src/native/vm/cldc1.1/java_lang_Thread.cpp
src/native/vm/gnuclasspath/gnu_java_lang_VMCPStringBuilder.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/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_VMSystem.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_VMField.cpp
src/native/vm/gnuclasspath/java_lang_reflect_VMMethod.cpp
src/native/vm/openjdk/jvm.cpp
src/native/vm/reflection.cpp
src/native/vm/sun_misc_Unsafe.cpp
src/threads/none/thread-none.h
src/threads/posix/thread-posix.cpp
src/threads/thread.cpp
src/vm/Makefile.am
src/vm/access.c
src/vm/annotation.c
src/vm/builtin.c [deleted file]
src/vm/builtin.h [deleted file]
src/vm/builtintable.inc [deleted file]
src/vm/class.c
src/vm/exceptions.cpp
src/vm/field.c
src/vm/finalizer.c
src/vm/initialize.c
src/vm/javaobjects.cpp
src/vm/jit/Makefile.am
src/vm/jit/allocator/liveness.c
src/vm/jit/allocator/lsra.c
src/vm/jit/allocator/simplereg.c
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/linux/md-os.c
src/vm/jit/alpha/patcher.c
src/vm/jit/arm/codegen.c
src/vm/jit/arm/patcher.c
src/vm/jit/builtin.cpp [new file with mode: 0644]
src/vm/jit/builtin.hpp [new file with mode: 0644]
src/vm/jit/builtintable.inc [new file with mode: 0644]
src/vm/jit/codegen-common.c
src/vm/jit/codegen-common.h
src/vm/jit/i386/codegen.c
src/vm/jit/i386/darwin/md-os.c
src/vm/jit/i386/linux/md-os.c
src/vm/jit/i386/patcher.c
src/vm/jit/i386/solaris/md-os.c
src/vm/jit/inline/inline.c
src/vm/jit/intrp/asmpart.c
src/vm/jit/intrp/codegen.c
src/vm/jit/intrp/engine.c
src/vm/jit/intrp/patcher.c
src/vm/jit/loop/tracing.c
src/vm/jit/m68k/codegen.c
src/vm/jit/m68k/emit.c
src/vm/jit/m68k/patcher.c
src/vm/jit/mips/codegen.c
src/vm/jit/mips/emit.c
src/vm/jit/mips/patcher.c
src/vm/jit/optimizing/lifetimes.c
src/vm/jit/optimizing/profile.c
src/vm/jit/optimizing/recompile.c
src/vm/jit/optimizing/ssa.c
src/vm/jit/optimizing/ssa_phi.c
src/vm/jit/optimizing/ssa_rename.c
src/vm/jit/parse.c
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/darwin/md-os.c
src/vm/jit/powerpc/linux/md-os.c
src/vm/jit/powerpc/patcher.c
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/linux/md-os.c
src/vm/jit/powerpc64/patcher.c
src/vm/jit/s390/codegen.c
src/vm/jit/s390/emit.c
src/vm/jit/s390/patcher.c
src/vm/jit/show.c
src/vm/jit/sparc64/codegen.c
src/vm/jit/sparc64/emit.c
src/vm/jit/sparc64/patcher.c
src/vm/jit/stack.c
src/vm/jit/stacktrace.cpp
src/vm/jit/verify/typecheck-stackbased.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/linux/md-os.c
src/vm/jit/x86_64/patcher.c
src/vm/jit/x86_64/solaris/md-os.c
src/vm/loader.c
src/vm/method.c
src/vm/method.h
src/vm/primitive.cpp
src/vm/string.cpp
src/vm/vm.cpp

index f76473ee0a02f9adbb622576fdb1cfdd092b35ea..ed3e20923ba422a4ae03b64bf5fff0a8e7a3424f 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/finalizer.h"
 #include "vm/global.h"
index 01209e0d619153b3edd1a9267d27796eda709d4e..101acfd0e2fd39cc96747e6ce7277ef69ccac6f4 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
 #include "vm/options.h"
index 7789aeb62822c38549d028e044e691ddb95da054..b5d21081be0be919963a0906780675195f048bba 100644 (file)
@@ -49,7 +49,7 @@
 #include "toolbox/logging.h"
 
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index ced10d58fa02060213e106d1e08615432943296e..f48c2a49da14fbe2e59684380b6a4c3a489e41a9 100644 (file)
@@ -29,7 +29,7 @@
 #include "vm/vm.hpp"
 #include "vm/loader.h"
 #include "vm/exceptions.hpp"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/jit/asmpart.h"
 #include "vm/string.hpp"
 #include "toolbox/logging.h"
index 1023e385e5c908b37028fe5c61fd600ccaa9e8da..24e6318217cd209fbe04112a1cacf2288ed0a625 100644 (file)
@@ -43,7 +43,7 @@
 #include "vm/jit/stacktrace.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/jit/asmpart.h"
 #include "vm/class.h"
 #include "vm/classcache.h"
index d9cbffd71d96fcfce52b4f0fd1bc3338abee0370..e92d078e3ad36174ba93f935368f032a7a7ae670 100644 (file)
@@ -45,7 +45,7 @@
 #include "toolbox/hashtable.h"
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index 0297755d5a8380e04e98a3c06d2eeda95e78074f..9bf34ad9919f83728b338ecd4887c250ddf3f302 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/javaobjects.hpp"
 #include "vm/string.hpp"
index 2f5903c04d957f4820f435e3b632cf90dd67dcb1..19146e44c184a7b1696d1cb1a9e49bd1a3c985ea 100644 (file)
@@ -34,7 +34,7 @@
 # include "native/include/java_lang_Double.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 
 
 // Native functions are exported as C functions.
index 709c11a6434847cf0264bf9cf03059b7832fbda0..0d98b2833219f725e88cb711ee959e36d7ee9859 100644 (file)
@@ -34,7 +34,7 @@
 # include "native/include/java_lang_Float.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 
 
 // Native functions are exported as C functions.
index 7ed1e7563ae71d9562fc7c8b3f887db920011e04..d0d922ab3bedd728ac1876e6920dd8ba6933fa93 100644 (file)
@@ -37,7 +37,7 @@
 # include "native/include/java_lang_System.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/properties.h"
 #include "vm/string.hpp"
 
index 4b60d0989d7f14d8d30422410d913daac3295eb4..75f8f20d6bfbaaf1ada04f15589bbc9193fd6dbc 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/javaobjects.hpp"
 
 
index 38b04b5e0b3c68e3640c73077490badb478c17c3..de6aa0e6d922f2e4d0d484e9b55914c5bc2f7564 100644 (file)
@@ -35,7 +35,7 @@
 # include "native/vm/include/gnu_java_lang_VMCPStringBuilder.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/globals.hpp"
 #include "vm/javaobjects.hpp"
index 13a1d7775b09d0516233403cdb0061f27e19a056..076bc44357a00749ccb5f3da9f7dc8fffcff5dbd 100644 (file)
@@ -36,7 +36,7 @@
 # include "native/vm/include/gnu_java_lang_management_VMMemoryMXBeanImpl.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/global.h"
 #include "vm/loader.h"               /* XXX only for load_class_bootstrap */
index 347934be704d5017af22c80329f1af0ca017f755..673645eda713081270e87e07aeb8e42c4a614542 100644 (file)
@@ -34,7 +34,7 @@
 # include "native/vm/include/gnu_java_lang_management_VMRuntimeMXBeanImpl.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
 #include "vm/utf8.h"
index 57f22a8c6398864b844df19ebccdd30956da3069..60d9ee0da8ab771b113b97e52f80752ecd1b57f4 100644 (file)
@@ -46,7 +46,7 @@
 #include "vm/assertion.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/classcache.h"
 #include "vm/exceptions.hpp"
index b5af0cdefafeb5d236c3e2a28c29bc8b9de02be9..69459ba9441aab412a9a20e68123f8dcd9624dcd 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/javaobjects.hpp"
 #include "vm/utf8.h"
index 43d65b56ac5f930072c80039c21dac45d9ee0f4b..3ad67e4620c981528ade3a4e17582439bec605d9 100644 (file)
@@ -49,7 +49,7 @@
 # include "native/vm/include/java_lang_VMRuntime.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/os.hpp"
 #include "vm/string.hpp"
index 180914bea4ae82c54959567d55bdb6da6bff7d64..8334ebfead2770ce5137b0f7a352c133a9f1aa79 100644 (file)
@@ -38,7 +38,7 @@
 # include "native/vminclude/java_lang_VMSystem.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/javaobjects.hpp"
 
 
index e8a7f32ac7d3023875c1b6d9c532390b1d847b2e..7ada5b1c35f82e66fe125406f74a94e3e0d9c917 100644 (file)
@@ -39,7 +39,7 @@
 #endif
 
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/globals.hpp"
 #include "vm/javaobjects.hpp"
index fa4b6dc4d58e9437cf5990042d26fbe624868afa..b92404a43ea41a2983c843af72f99545809ff044 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/globals.hpp"
 
 
index 4762379361a25a31e3e79d01f9afa46b377d5d1d..f3e798c286738399b20db26d444509a14a6824a9 100644 (file)
@@ -42,7 +42,7 @@
 #endif
 
 #include "vm/access.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/initialize.h"
index 7be27fd6bac4ef2c365dfe7c836616016c0501ff..23435edc63fc8ae63d386cb51f9499f26dbef680 100644 (file)
@@ -42,7 +42,7 @@
 #include "native/vm/reflection.hpp"
 
 #include "vm/access.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index 1141307c12ade018754eec8cb7b3f76de235d15e..43dc98f03f32f6cd7213fe01f91578a657091d3e 100644 (file)
@@ -65,7 +65,7 @@
 #include "vm/assertion.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/classcache.h"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index 7377ddf74a191aab1450ac424a8250e1303a4f84..14ba348a2879d137e9e1c22eb1e0b599af231a56 100644 (file)
@@ -37,7 +37,7 @@
 #include "native/vm/reflection.hpp"
 
 #include "vm/access.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index b705e64cb51ac58f9fa73b12db1d2c12e4606e89..ba4ca65c8bf4d3d3dd4acd838fe241f102d22ea1 100644 (file)
@@ -40,7 +40,7 @@
 # include "native/include/sun_misc_Unsafe.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/initialize.h"
 #include "vm/javaobjects.hpp"
index 5083443c2cddcd43f2cbcb3d94118821567fc56c..21b3bee53b8cf73403718484afa884855ea1f336 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "vm/types.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/globals.hpp"
 
 #include "vm/jit/stacktrace.hpp"
index 7be3cc39023826b079ed965441c79bd7e5ced1c9..34a62958e10f1fab952bd307e755bd0b0ba6ba6b 100644 (file)
@@ -60,7 +60,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index fe00af5d0e5a7d1467952c2d489174e4df1096c9..195ac6fa844926e05c6d50f714ef15a1295f9b0c 100644 (file)
@@ -46,7 +46,7 @@
 #include "threads/threadlist.h"
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/globals.hpp"
index 5949d7d43de12903eaf9ab0335621648a3730188..5a5cff801cc94abf5790acd77484669f3a007487 100644 (file)
@@ -83,9 +83,6 @@ libvm_la_SOURCES = \
        array.c \
        array.h \
        $(ASSERTION_SOURCES) \
-       builtin.c \
-       builtin.h \
-       builtintable.inc \
        class.c \
        class.h \
        classcache.c \
index eb67440337ddd7acab9ddfd80ac403568f572172..07b7131db69a73453c125168401a05574afd31ed 100644 (file)
@@ -35,7 +35,7 @@
 #include "native/llni.h"
 
 #include "vm/access.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/field.h"
index 5b3c9ce470ebddc67c95be864a67f2d850929033..7a3ae9b5a9a9e824ccaa4cc7a95b00a1b02c0ee7 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "vm/annotation.h"
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/loader.h"
 #include "vm/primitive.hpp"
diff --git a/src/vm/builtin.c b/src/vm/builtin.c
deleted file mode 100644 (file)
index 9e0b45d..0000000
+++ /dev/null
@@ -1,2439 +0,0 @@
-/* src/vm/builtin.c - functions for unsupported operations
-
-   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.
-
-   Contains C functions for JavaVM Instructions that cannot be
-   translated to machine language directly. Consequently, the
-   generated machine code for these instructions contains function
-   calls instead of machine instructions, using the C calling
-   convention.
-
-*/
-
-
-#include "config.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include "vm/types.h"
-
-#include "arch.h"
-#include "md-abi.h"
-
-#include "fdlibm/fdlibm.h"
-#if defined(__CYGWIN__) && defined(Bias)
-# undef Bias
-#endif
-
-#include "mm/gc.hpp"
-#include "mm/memory.h"
-
-#include "native/llni.h"
-
-#include "threads/lock-common.h"
-#include "threads/mutex.hpp"
-#include "threads/thread.hpp"
-
-#include "toolbox/logging.h"
-#include "toolbox/util.h"
-
-#include "vm/array.h"
-#include "vm/builtin.h"
-#include "vm/class.h"
-#include "vm/cycles-stats.h"
-#include "vm/exceptions.hpp"
-#include "vm/global.h"
-#include "vm/globals.hpp"
-#include "vm/initialize.h"
-#include "vm/linker.h"
-#include "vm/loader.h"
-#include "vm/options.h"
-#include "vm/primitive.hpp"
-#include "vm/rt-timing.h"
-#include "vm/string.hpp"
-
-#include "vm/jit/asmpart.h"
-#include "vm/jit/stubs.hpp"
-#include "vm/jit/trace.hpp"
-
-#if defined(ENABLE_VMLOG)
-#include <vmlog_cacao.h>
-#endif
-
-
-/* include builtin tables *****************************************************/
-
-#include "vm/builtintable.inc"
-
-
-CYCLES_STATS_DECLARE(builtin_new         ,100,5)
-CYCLES_STATS_DECLARE(builtin_overhead    , 80,1)
-
-
-/*============================================================================*/
-/* BUILTIN TABLE MANAGEMENT FUNCTIONS                                         */
-/*============================================================================*/
-
-/* builtintable_init ***********************************************************
-
-   Parse the descriptors of builtin functions and create the parsed
-   descriptors.
-
-*******************************************************************************/
-
-static bool builtintable_init(void)
-{
-       descriptor_pool    *descpool;
-       builtintable_entry *bte;
-       methodinfo         *m;
-       int32_t             dumpmarker;
-
-       /* mark start of dump memory area */
-
-       DMARKER;
-
-       /* create a new descriptor pool */
-
-       descpool = descriptor_pool_new(class_java_lang_Object);
-
-       /* add some entries we need */
-
-       if (!descriptor_pool_add_class(descpool, utf_java_lang_Object))
-               return false;
-
-       if (!descriptor_pool_add_class(descpool, utf_java_lang_Class))
-               return false;
-
-       /* first add all descriptors to the pool */
-
-       for (bte = builtintable_internal; bte->fp != NULL; bte++) {
-               bte->name       = utf_new_char(bte->cname);
-               bte->descriptor = utf_new_char(bte->cdescriptor);
-
-               if (!descriptor_pool_add(descpool, bte->descriptor, NULL)) {
-                       /* release dump area */
-
-                       DRELEASE;
-
-                       return false;
-               }
-       }
-
-       for (bte = builtintable_automatic; bte->fp != NULL; bte++) {
-               bte->descriptor = utf_new_char(bte->cdescriptor);
-
-               if (!descriptor_pool_add(descpool, bte->descriptor, NULL)) {
-                       DRELEASE;
-                       return false;
-               }
-       }
-
-       for (bte = builtintable_function; bte->fp != NULL; bte++) {
-               bte->classname  = utf_new_char(bte->cclassname);
-               bte->name       = utf_new_char(bte->cname);
-               bte->descriptor = utf_new_char(bte->cdescriptor);
-
-               if (!descriptor_pool_add(descpool, bte->descriptor, NULL)) {
-                       DRELEASE;
-                       return false;
-               }
-       }
-
-       /* create the class reference table */
-
-       (void) descriptor_pool_create_classrefs(descpool, NULL);
-
-       /* allocate space for the parsed descriptors */
-
-       descriptor_pool_alloc_parsed_descriptors(descpool);
-
-       /* Now parse all descriptors.  NOTE: builtin-functions are treated
-          like static methods (no `this' pointer). */
-
-       for (bte = builtintable_internal; bte->fp != NULL; bte++) {
-               bte->md =
-                       descriptor_pool_parse_method_descriptor(descpool,
-                                                                                                       bte->descriptor,
-                                                                                                       ACC_STATIC | ACC_METHOD_BUILTIN,
-                                                                                                       NULL);
-
-               /* generate a builtin stub if we need one */
-
-               if (bte->flags & BUILTINTABLE_FLAG_STUB) {
-                       m = method_new_builtin(bte);
-                       BuiltinStub_generate(m, bte);
-               }
-       }
-
-       for (bte = builtintable_automatic; bte->fp != NULL; bte++) {
-               bte->md =
-                       descriptor_pool_parse_method_descriptor(descpool,
-                                                                                                       bte->descriptor,
-                                                                                                       ACC_STATIC | ACC_METHOD_BUILTIN,
-                                                                                                       NULL);
-
-               /* no stubs should be needed for this table */
-
-               assert(!bte->flags & BUILTINTABLE_FLAG_STUB);
-       }
-
-       for (bte = builtintable_function; bte->fp != NULL; bte++) {
-               bte->md =
-                       descriptor_pool_parse_method_descriptor(descpool,
-                                                                                                       bte->descriptor,
-                                                                                                       ACC_STATIC | ACC_METHOD_BUILTIN,
-                                                                                                       NULL);
-
-               /* generate a builtin stub if we need one */
-
-               if (bte->flags & BUILTINTABLE_FLAG_STUB) {
-                       m = method_new_builtin(bte);
-                       BuiltinStub_generate(m, bte);
-               }
-       }
-
-       /* release dump area */
-
-       DRELEASE;
-
-       return true;
-}
-
-
-/* builtintable_comparator *****************************************************
-
-   qsort comparator for the automatic builtin table.
-
-*******************************************************************************/
-
-static int builtintable_comparator(const void *a, const void *b)
-{
-       builtintable_entry *bte1;
-       builtintable_entry *bte2;
-
-       bte1 = (builtintable_entry *) a;
-       bte2 = (builtintable_entry *) b;
-
-       return (bte1->opcode < bte2->opcode) ? -1 : (bte1->opcode > bte2->opcode);
-}
-
-
-/* builtintable_sort_automatic *************************************************
-
-   Sorts the automatic builtin table.
-
-*******************************************************************************/
-
-static void builtintable_sort_automatic(void)
-{
-       s4 entries;
-
-       /* calculate table size statically (`- 1' comment see builtintable.inc) */
-
-       entries = sizeof(builtintable_automatic) / sizeof(builtintable_entry) - 1;
-
-       qsort(builtintable_automatic, entries, sizeof(builtintable_entry),
-                 builtintable_comparator);
-}
-
-
-/* builtin_init ****************************************************************
-
-   Initialize the global table of builtin functions.
-
-*******************************************************************************/
-
-bool builtin_init(void)
-{
-       TRACESUBSYSTEMINITIALIZATION("builtin_init");
-
-       /* initialize the builtin tables */
-
-       if (!builtintable_init())
-               return false;
-
-       /* sort builtin tables */
-
-       builtintable_sort_automatic();
-
-       return true;
-}
-
-
-/* builtintable_get_internal ***************************************************
-
-   Finds an entry in the builtintable for internal functions and
-   returns the a pointer to the structure.
-
-*******************************************************************************/
-
-builtintable_entry *builtintable_get_internal(functionptr fp)
-{
-       builtintable_entry *bte;
-
-       for (bte = builtintable_internal; bte->fp != NULL; bte++) {
-               if (bte->fp == fp)
-                       return bte;
-       }
-
-       return NULL;
-}
-
-
-/* builtintable_get_automatic **************************************************
-
-   Finds an entry in the builtintable for functions which are replaced
-   automatically and returns the a pointer to the structure.
-
-*******************************************************************************/
-
-builtintable_entry *builtintable_get_automatic(s4 opcode)
-{
-       builtintable_entry *first;
-       builtintable_entry *last;
-       builtintable_entry *middle;
-       s4                  half;
-       s4                  entries;
-
-       /* calculate table size statically (`- 1' comment see builtintable.inc) */
-
-       entries = sizeof(builtintable_automatic) / sizeof(builtintable_entry) - 1;
-
-       first = builtintable_automatic;
-       last = builtintable_automatic + entries;
-
-       while (entries > 0) {
-               half = entries / 2;
-               middle = first + half;
-
-               if (middle->opcode < opcode) {
-                       first = middle + 1;
-                       entries -= half + 1;
-               }
-               else
-                       entries = half;
-       }
-
-       return (first != last ? first : NULL);
-}
-
-
-/* builtintable_replace_function ***********************************************
-
-   XXX
-
-*******************************************************************************/
-
-#if defined(ENABLE_JIT)
-bool builtintable_replace_function(void *iptr_)
-{
-       constant_FMIref    *mr;
-       builtintable_entry *bte;
-       instruction        *iptr;
-
-       iptr = (instruction *) iptr_; /* twisti will kill me ;) */
-
-       /* get name and descriptor of the function */
-
-       switch (iptr->opc) {
-       case ICMD_INVOKESTATIC:
-               /* The instruction MUST be resolved, otherwise we run into
-                  lazy loading troubles.  Anyway, we should/can only replace
-                  very VM-close functions. */
-
-               if (INSTRUCTION_IS_UNRESOLVED(iptr))
-                       return false;
-
-               mr = iptr->sx.s23.s3.fmiref;
-               break;  
-
-       default:
-               return false;
-       }
-
-       /* search the function table */
-
-       for (bte = builtintable_function; bte->fp != NULL; bte++) {
-               if ((METHODREF_CLASSNAME(mr) == bte->classname) &&
-                       (mr->name                == bte->name) &&
-                       (mr->descriptor          == bte->descriptor)) {
-
-                       /* set the values in the instruction */
-
-                       iptr->opc           = bte->opcode;
-                       iptr->sx.s23.s3.bte = bte;
-
-                       if (bte->flags & BUILTINTABLE_FLAG_EXCEPTION)
-                               iptr->flags.bits |= INS_FLAG_CHECK;
-                       else
-                               iptr->flags.bits &= ~INS_FLAG_CHECK;
-
-                       return true;
-               }
-       }
-
-       return false;
-}
-#endif /* defined(ENABLE_JIT) */
-
-
-/*============================================================================*/
-/* INTERNAL BUILTIN FUNCTIONS                                                 */
-/*============================================================================*/
-
-/* builtin_instanceof **********************************************************
-
-   Checks if an object is an instance of some given class (or subclass
-   of that class). If class is an interface, checks if the interface
-   is implemented.
-
-   RETURN VALUE:
-     1......o is an instance of class or implements the interface
-     0......otherwise or if o == NULL
-
-   NOTE: This builtin can be called from NATIVE code only.
-
-*******************************************************************************/
-
-bool builtin_instanceof(java_handle_t *o, classinfo *c)
-{
-       classinfo *oc;
-
-       if (o == NULL)
-               return 0;
-
-       LLNI_class_get(o, oc);
-
-       return class_isanysubclass(oc, c);
-}
-
-
-
-/* builtin_checkcast ***********************************************************
-
-   The same as builtin_instanceof but with the exception
-   that 1 is returned when (o == NULL).
-
-   NOTE: This builtin can be called from NATIVE code only.
-
-*******************************************************************************/
-
-bool builtin_checkcast(java_handle_t *o, classinfo *c)
-{
-       classinfo *oc;
-
-       if (o == NULL)
-               return 1;
-
-       LLNI_class_get(o, oc);
-
-       if (class_isanysubclass(oc, c))
-               return 1;
-
-       return 0;
-}
-
-
-/* builtin_descriptorscompatible ***********************************************
-
-   Checks if two array type descriptors are assignment compatible.
-
-   RETURN VALUE:
-      1......target = desc is possible
-      0......otherwise
-                       
-*******************************************************************************/
-
-static bool builtin_descriptorscompatible(arraydescriptor *desc, arraydescriptor *target)
-{
-       if (desc == target)
-               return 1;
-
-       if (desc->arraytype != target->arraytype)
-               return 0;
-
-       if (desc->arraytype != ARRAYTYPE_OBJECT)
-               return 1;
-       
-       /* {both arrays are arrays of references} */
-
-       if (desc->dimension == target->dimension) {
-               if (!desc->elementvftbl)
-                       return 0;
-               /* an array which contains elements of interface types is
-           allowed to be casted to Object (JOWENN)*/
-
-               if ((desc->elementvftbl->baseval < 0) &&
-                       (target->elementvftbl->baseval == 1))
-                       return 1;
-
-               return class_isanysubclass(desc->elementvftbl->clazz,
-                                                                  target->elementvftbl->clazz);
-       }
-
-       if (desc->dimension < target->dimension)
-               return 0;
-
-       /* {desc has higher dimension than target} */
-
-       return class_isanysubclass(pseudo_class_Arraystub,
-                                                          target->elementvftbl->clazz);
-}
-
-
-/* builtin_arraycheckcast ******************************************************
-
-   Checks if an object is really a subtype of the requested array
-   type.  The object has to be an array to begin with. For simple
-   arrays (int, short, double, etc.) the types have to match exactly.
-   For arrays of objects, the type of elements in the array has to be
-   a subtype (or the same type) of the requested element type. For
-   arrays of arrays (which in turn can again be arrays of arrays), the
-   types at the lowest level have to satisfy the corresponding sub
-   class relation.
-
-   NOTE: This is a FAST builtin and can be called from JIT code only.
-
-*******************************************************************************/
-
-bool builtin_fast_arraycheckcast(java_object_t *o, classinfo *targetclass)
-{
-       arraydescriptor *desc;
-
-       if (o == NULL)
-               return 1;
-
-       desc = o->vftbl->arraydesc;
-
-       if (desc == NULL)
-               return 0;
-       return builtin_descriptorscompatible(desc, targetclass->vftbl->arraydesc);
-}
-
-
-/* builtin_fast_arrayinstanceof ************************************************
-
-   NOTE: This is a FAST builtin and can be called from JIT code only.
-
-*******************************************************************************/
-
-bool builtin_fast_arrayinstanceof(java_object_t *o, classinfo *targetclass)
-{
-       if (o == NULL)
-               return 0;
-
-       return builtin_fast_arraycheckcast(o, targetclass);
-}
-
-
-/* builtin_arrayinstanceof *****************************************************
-
-   NOTE: This builtin can be called from NATIVE code only.
-
-*******************************************************************************/
-
-bool builtin_arrayinstanceof(java_handle_t *h, classinfo *targetclass)
-{
-       bool result;
-
-       LLNI_CRITICAL_START;
-
-       result = builtin_fast_arrayinstanceof(LLNI_UNWRAP(h), targetclass);
-
-       LLNI_CRITICAL_END;
-
-       return result;
-}
-
-
-/* builtin_throw_exception *****************************************************
-
-   Sets the exception pointer with the thrown exception and prints some
-   debugging information.
-   
-   NOTE: This is a FAST builtin and can be called from JIT code,
-   or from asm_vm_call_method.
-
-*******************************************************************************/
-
-void *builtin_throw_exception(java_object_t *xptr)
-{
-#if !defined(NDEBUG)
-       /* print exception trace */
-
-       if (opt_TraceExceptions)
-               trace_exception_builtin(xptr);
-#endif /* !defined(NDEBUG) */
-
-       /* actually set the exception */
-
-       exceptions_set_exception(LLNI_QUICKWRAP(xptr));
-
-       /* Return a NULL pointer.  This is required for vm_call_method to
-          check for an exception.  This is for convenience. */
-
-       return NULL;
-}
-
-
-/* builtin_retrieve_exception **************************************************
-
-   Gets and clears the exception pointer of the current thread.
-
-   RETURN VALUE:
-      the exception object, or NULL if no exception was thrown.
-
-   NOTE: This is a FAST builtin and can be called from JIT code,
-   or from the signal handlers.
-
-*******************************************************************************/
-
-java_object_t *builtin_retrieve_exception(void)
-{
-       java_handle_t *h;
-       java_object_t *o;
-
-       /* actually get and clear the exception */
-
-       h = exceptions_get_and_clear_exception();
-       o = LLNI_UNWRAP(h);
-
-       return o;
-}
-
-
-/* builtin_canstore ************************************************************
-
-   Checks, if an object can be stored in an array.
-
-   RETURN VALUE:
-      1......possible
-      0......otherwise (throws an ArrayStoreException)
-
-   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
-
-*******************************************************************************/
-
-bool builtin_canstore(java_handle_objectarray_t *oa, java_handle_t *o)
-{
-       bool result;
-
-       LLNI_CRITICAL_START;
-
-       result = builtin_fast_canstore(LLNI_DIRECT(oa), LLNI_UNWRAP(o));
-
-       LLNI_CRITICAL_END;
-
-       /* if not possible, throw an exception */
-
-       if (result == 0)
-               exceptions_throw_arraystoreexception();
-
-       return result;
-}
-
-
-/* builtin_fast_canstore *******************************************************
-
-   Checks, if an object can be stored in an array.
-
-   RETURN VALUE:
-      1......possible
-      0......otherwise (no exception thrown!)
-
-   NOTE: This is a FAST builtin and can be called from JIT code only.
-
-*******************************************************************************/
-
-bool builtin_fast_canstore(java_objectarray_t *oa, java_object_t *o)
-{
-       arraydescriptor *desc;
-       arraydescriptor *valuedesc;
-       vftbl_t         *componentvftbl;
-       vftbl_t         *valuevftbl;
-       int32_t          baseval;
-       uint32_t         diffval;
-       bool             result;
-
-       if (o == NULL)
-               return 1;
-
-       /* The following is guaranteed (by verifier checks):
-        *
-        *     *) oa->...vftbl->arraydesc != NULL
-        *     *) oa->...vftbl->arraydesc->componentvftbl != NULL
-        *     *) o->vftbl is not an interface vftbl
-        */
-
-       desc           = oa->header.objheader.vftbl->arraydesc;
-       componentvftbl = desc->componentvftbl;
-       valuevftbl     = o->vftbl;
-       valuedesc      = valuevftbl->arraydesc;
-
-       if ((desc->dimension - 1) == 0) {
-               /* {oa is a one-dimensional array} */
-               /* {oa is an array of references} */
-               
-               if (valuevftbl == componentvftbl)
-                       return 1;
-
-               Mutex_lock(linker_classrenumber_mutex);
-
-               baseval = componentvftbl->baseval;
-
-               if (baseval <= 0) {
-                       /* an array of interface references */
-
-                       result = ((valuevftbl->interfacetablelength > -baseval) &&
-                                         (valuevftbl->interfacetable[baseval] != NULL));
-               }
-               else {
-                       diffval = valuevftbl->baseval - componentvftbl->baseval;
-                       result  = diffval <= (uint32_t) componentvftbl->diffval;
-               }
-
-               Mutex_unlock(linker_classrenumber_mutex);
-       }
-       else if (valuedesc == NULL) {
-               /* {oa has dimension > 1} */
-               /* {componentvftbl->arraydesc != NULL} */
-
-               /* check if o is an array */
-
-               return 0;
-       }
-       else {
-               /* {o is an array} */
-
-               result = builtin_descriptorscompatible(valuedesc, componentvftbl->arraydesc);
-       }
-
-       /* return result */
-
-       return result;
-}
-
-
-/* This is an optimized version where a is guaranteed to be one-dimensional */
-bool builtin_fast_canstore_onedim(java_objectarray_t *a, java_object_t *o)
-{
-       arraydescriptor *desc;
-       vftbl_t         *elementvftbl;
-       vftbl_t         *valuevftbl;
-       int32_t          baseval;
-       uint32_t         diffval;
-       bool             result;
-       
-       if (o == NULL)
-               return 1;
-
-       /* The following is guaranteed (by verifier checks):
-        *
-        *     *) a->...vftbl->arraydesc != NULL
-        *     *) a->...vftbl->arraydesc->elementvftbl != NULL
-        *     *) a->...vftbl->arraydesc->dimension == 1
-        *     *) o->vftbl is not an interface vftbl
-        */
-
-       desc = a->header.objheader.vftbl->arraydesc;
-    elementvftbl = desc->elementvftbl;
-       valuevftbl = o->vftbl;
-
-       /* {a is a one-dimensional array} */
-       
-       if (valuevftbl == elementvftbl)
-               return 1;
-
-       Mutex_lock(linker_classrenumber_mutex);
-
-       baseval = elementvftbl->baseval;
-
-       if (baseval <= 0) {
-               /* an array of interface references */
-               result = ((valuevftbl->interfacetablelength > -baseval) &&
-                                 (valuevftbl->interfacetable[baseval] != NULL));
-       }
-       else {
-               diffval = valuevftbl->baseval - elementvftbl->baseval;
-               result  = diffval <= (uint32_t) elementvftbl->diffval;
-       }
-
-       Mutex_unlock(linker_classrenumber_mutex);
-
-       return result;
-}
-
-
-/* This is an optimized version where a is guaranteed to be a
- * one-dimensional array of a class type */
-bool builtin_fast_canstore_onedim_class(java_objectarray_t *a, java_object_t *o)
-{
-       vftbl_t  *elementvftbl;
-       vftbl_t  *valuevftbl;
-       uint32_t  diffval;
-       bool      result;
-       
-       if (o == NULL)
-               return 1;
-
-       /* The following is guaranteed (by verifier checks):
-        *
-        *     *) a->...vftbl->arraydesc != NULL
-        *     *) a->...vftbl->arraydesc->elementvftbl != NULL
-        *     *) a->...vftbl->arraydesc->elementvftbl is not an interface vftbl
-        *     *) a->...vftbl->arraydesc->dimension == 1
-        *     *) o->vftbl is not an interface vftbl
-        */
-
-    elementvftbl = a->header.objheader.vftbl->arraydesc->elementvftbl;
-       valuevftbl = o->vftbl;
-
-       /* {a is a one-dimensional array} */
-       
-       if (valuevftbl == elementvftbl)
-               return 1;
-
-       Mutex_lock(linker_classrenumber_mutex);
-
-       diffval = valuevftbl->baseval - elementvftbl->baseval;
-       result  = diffval <= (uint32_t) elementvftbl->diffval;
-
-       Mutex_unlock(linker_classrenumber_mutex);
-
-       return result;
-}
-
-
-/* builtin_new *****************************************************************
-
-   Creates a new instance of class c on the heap.
-
-   RETURN VALUE:
-      pointer to the object, or NULL if no memory is available
-
-   NOTE: This builtin can be called from NATIVE code only.
-
-*******************************************************************************/
-
-java_handle_t *builtin_new(classinfo *c)
-{
-       java_handle_t *o;
-#if defined(ENABLE_RT_TIMING)
-       struct timespec time_start, time_end;
-#endif
-#if defined(ENABLE_CYCLES_STATS)
-       u8 cycles_start, cycles_end;
-#endif
-
-       RT_TIMING_GET_TIME(time_start);
-       CYCLES_STATS_GET(cycles_start);
-
-       /* is the class loaded */
-
-       assert(c->state & CLASS_LOADED);
-
-       /* check if we can instantiate this class */
-
-       if (c->flags & ACC_ABSTRACT) {
-               exceptions_throw_instantiationerror(c);
-               return NULL;
-       }
-
-       /* is the class linked */
-
-       if (!(c->state & CLASS_LINKED))
-               if (!link_class(c))
-                       return NULL;
-
-       if (!(c->state & CLASS_INITIALIZED)) {
-#if !defined(NDEBUG)
-               if (initverbose)
-                       log_message_class("Initialize class (from builtin_new): ", c);
-#endif
-
-               if (!initialize_class(c))
-                       return NULL;
-       }
-
-       o = heap_alloc(c->instancesize, c->flags & ACC_CLASS_HAS_POINTERS,
-                                  c->finalizer, true);
-
-       if (!o)
-               return NULL;
-
-#if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
-       /* XXX this is only a dirty hack to make Boehm work with handles */
-
-       o = LLNI_WRAP((java_object_t *) o);
-#endif
-
-       LLNI_vftbl_direct(o) = c->vftbl;
-
-#if defined(ENABLE_THREADS)
-       lock_init_object_lock(LLNI_DIRECT(o));
-#endif
-
-       CYCLES_STATS_GET(cycles_end);
-       RT_TIMING_GET_TIME(time_end);
-
-       CYCLES_STATS_COUNT(builtin_new,cycles_end - cycles_start);
-       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_OBJECT);
-
-       return o;
-}
-
-#if defined(ENABLE_ESCAPE_REASON)
-java_handle_t *builtin_escape_reason_new(classinfo *c) {
-       print_escape_reasons();
-       return builtin_java_new(c);
-}
-#endif
-
-#if defined(ENABLE_TLH)
-java_handle_t *builtin_tlh_new(classinfo *c)
-{
-       java_handle_t *o;
-# if defined(ENABLE_RT_TIMING)
-       struct timespec time_start, time_end;
-# endif
-# if defined(ENABLE_CYCLES_STATS)
-       u8 cycles_start, cycles_end;
-# endif
-
-       RT_TIMING_GET_TIME(time_start);
-       CYCLES_STATS_GET(cycles_start);
-
-       /* is the class loaded */
-
-       assert(c->state & CLASS_LOADED);
-
-       /* check if we can instantiate this class */
-
-       if (c->flags & ACC_ABSTRACT) {
-               exceptions_throw_instantiationerror(c);
-               return NULL;
-       }
-
-       /* is the class linked */
-
-       if (!(c->state & CLASS_LINKED))
-               if (!link_class(c))
-                       return NULL;
-
-       if (!(c->state & CLASS_INITIALIZED)) {
-# if !defined(NDEBUG)
-               if (initverbose)
-                       log_message_class("Initialize class (from builtin_new): ", c);
-# endif
-
-               if (!initialize_class(c))
-                       return NULL;
-       }
-
-       /*
-       o = tlh_alloc(&(THREADOBJECT->tlh), c->instancesize);
-       */
-       o = NULL;
-
-       if (o == NULL) {
-               o = heap_alloc(c->instancesize, c->flags & ACC_CLASS_HAS_POINTERS,
-                                          c->finalizer, true);
-       }
-
-       if (!o)
-               return NULL;
-
-# if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
-       /* XXX this is only a dirty hack to make Boehm work with handles */
-
-       o = LLNI_WRAP((java_object_t *) o);
-# endif
-
-       LLNI_vftbl_direct(o) = c->vftbl;
-
-# if defined(ENABLE_THREADS)
-       lock_init_object_lock(LLNI_DIRECT(o));
-# endif
-
-       CYCLES_STATS_GET(cycles_end);
-       RT_TIMING_GET_TIME(time_end);
-
-/*
-       CYCLES_STATS_COUNT(builtin_new,cycles_end - cycles_start);
-       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_OBJECT);
-*/
-
-       return o;
-}
-#endif
-
-
-/* builtin_java_new ************************************************************
-
-   NOTE: This is a SLOW builtin and can be called from JIT code only.
-
-*******************************************************************************/
-
-java_handle_t *builtin_java_new(java_handle_t *clazz)
-{
-       return builtin_new(LLNI_classinfo_unwrap(clazz));
-}
-
-
-/* builtin_fast_new ************************************************************
-
-   Creates a new instance of class c on the heap.
-
-   RETURN VALUE:
-      pointer to the object, or NULL if no fast return
-      is possible for any reason.
-
-   NOTE: This is a FAST builtin and can be called from JIT code only.
-
-*******************************************************************************/
-
-java_object_t *builtin_fast_new(classinfo *c)
-{
-       java_object_t *o;
-#if defined(ENABLE_RT_TIMING)
-       struct timespec time_start, time_end;
-#endif
-#if defined(ENABLE_CYCLES_STATS)
-       u8 cycles_start, cycles_end;
-#endif
-
-       RT_TIMING_GET_TIME(time_start);
-       CYCLES_STATS_GET(cycles_start);
-
-       /* is the class loaded */
-
-       assert(c->state & CLASS_LOADED);
-
-       /* check if we can instantiate this class */
-
-       if (c->flags & ACC_ABSTRACT)
-               return NULL;
-
-       /* is the class linked */
-
-       if (!(c->state & CLASS_LINKED))
-               return NULL;
-
-       if (!(c->state & CLASS_INITIALIZED))
-               return NULL;
-
-       o = heap_alloc(c->instancesize, c->flags & ACC_CLASS_HAS_POINTERS,
-                                  c->finalizer, false);
-
-       if (!o)
-               return NULL;
-
-       o->vftbl = c->vftbl;
-
-#if defined(ENABLE_THREADS)
-       lock_init_object_lock(o);
-#endif
-
-       CYCLES_STATS_GET(cycles_end);
-       RT_TIMING_GET_TIME(time_end);
-
-       CYCLES_STATS_COUNT(builtin_new,cycles_end - cycles_start);
-       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_OBJECT);
-
-       return o;
-}
-
-
-/* builtin_newarray ************************************************************
-
-   Creates an array with the given vftbl on the heap. This function
-   takes as class argument an array class.
-
-   RETURN VALUE:
-      pointer to the array or NULL if no memory is available
-
-   NOTE: This builtin can be called from NATIVE code only.
-
-*******************************************************************************/
-
-java_handle_t *builtin_newarray(int32_t size, classinfo *arrayclass)
-{
-       arraydescriptor *desc;
-       s4               dataoffset;
-       s4               componentsize;
-       s4               actualsize;
-       java_handle_t   *a;
-#if defined(ENABLE_RT_TIMING)
-       struct timespec time_start, time_end;
-#endif
-
-       RT_TIMING_GET_TIME(time_start);
-
-       desc          = arrayclass->vftbl->arraydesc;
-       dataoffset    = desc->dataoffset;
-       componentsize = desc->componentsize;
-
-       if (size < 0) {
-               exceptions_throw_negativearraysizeexception();
-               return NULL;
-       }
-
-       actualsize = dataoffset + size * componentsize;
-
-       /* check for overflow */
-
-       if (((u4) actualsize) < ((u4) size)) {
-               exceptions_throw_outofmemoryerror();
-               return NULL;
-       }
-
-       a = heap_alloc(actualsize, (desc->arraytype == ARRAYTYPE_OBJECT), NULL, true);
-
-       if (a == NULL)
-               return NULL;
-
-#if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
-       /* XXX this is only a dirty hack to make Boehm work with handles */
-
-       a = LLNI_WRAP((java_object_t *) a);
-#endif
-
-       LLNI_vftbl_direct(a) = arrayclass->vftbl;
-
-#if defined(ENABLE_THREADS)
-       lock_init_object_lock(LLNI_DIRECT(a));
-#endif
-
-       LLNI_array_size(a) = size;
-
-       RT_TIMING_GET_TIME(time_end);
-       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_ARRAY);
-
-       return a;
-}
-
-
-/* builtin_java_newarray *******************************************************
-
-   NOTE: This is a SLOW builtin and can be called from JIT code only.
-
-*******************************************************************************/
-
-java_handle_t *builtin_java_newarray(int32_t size, java_handle_t *arrayclazz)
-{
-       return builtin_newarray(size, LLNI_classinfo_unwrap(arrayclazz));
-}
-
-
-/* builtin_anewarray ***********************************************************
-
-   Creates an array of references to the given class type on the heap.
-
-   RETURN VALUE:
-      pointer to the array or NULL if no memory is
-      available
-
-   NOTE: This builtin can be called from NATIVE code only.
-
-*******************************************************************************/
-
-java_handle_objectarray_t *builtin_anewarray(int32_t size, classinfo *componentclass)
-{
-       classinfo *arrayclass;
-       
-       /* is class loaded */
-
-       assert(componentclass->state & CLASS_LOADED);
-
-       /* is class linked */
-
-       if (!(componentclass->state & CLASS_LINKED))
-               if (!link_class(componentclass))
-                       return NULL;
-
-       arrayclass = class_array_of(componentclass, true);
-
-       if (!arrayclass)
-               return NULL;
-
-       return (java_handle_objectarray_t *) builtin_newarray(size, arrayclass);
-}
-
-
-/* builtin_newarray_type ****************************************************
-
-   Creates an array of [type]s on the heap.
-       
-   RETURN VALUE:
-      pointer to the array or NULL if no memory is available
-
-   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
-
-*******************************************************************************/
-
-#define BUILTIN_NEWARRAY_TYPE(type, arraytype)                             \
-java_handle_##type##array_t *builtin_newarray_##type(int32_t size)              \
-{                                                                          \
-       return (java_handle_##type##array_t *)                                 \
-               builtin_newarray(size, primitivetype_table[arraytype].arrayclass); \
-}
-
-BUILTIN_NEWARRAY_TYPE(boolean, ARRAYTYPE_BOOLEAN)
-BUILTIN_NEWARRAY_TYPE(byte,    ARRAYTYPE_BYTE)
-BUILTIN_NEWARRAY_TYPE(char,    ARRAYTYPE_CHAR)
-BUILTIN_NEWARRAY_TYPE(short,   ARRAYTYPE_SHORT)
-BUILTIN_NEWARRAY_TYPE(int,     ARRAYTYPE_INT)
-BUILTIN_NEWARRAY_TYPE(long,    ARRAYTYPE_LONG)
-BUILTIN_NEWARRAY_TYPE(float,   ARRAYTYPE_FLOAT)
-BUILTIN_NEWARRAY_TYPE(double,  ARRAYTYPE_DOUBLE)
-
-
-/* builtin_multianewarray_intern ***********************************************
-
-   Creates a multi-dimensional array on the heap. The dimensions are
-   passed in an array of longs.
-
-   ARGUMENTS:
-      n.............number of dimensions to create
-      arrayclass....the array class
-      dims..........array containing the size of each dimension to create
-
-   RETURN VALUE:
-      pointer to the array or NULL if no memory is available
-
-******************************************************************************/
-
-static java_handle_t *builtin_multianewarray_intern(int n,
-                                                                                                       classinfo *arrayclass,
-                                                                                                       long *dims)
-{
-       s4             size;
-       java_handle_t *a;
-       classinfo     *componentclass;
-       s4             i;
-
-       /* create this dimension */
-
-       size = (s4) dims[0];
-       a = builtin_newarray(size, arrayclass);
-
-       if (!a)
-               return NULL;
-
-       /* if this is the last dimension return */
-
-       if (!--n)
-               return a;
-
-       /* get the class of the components to create */
-
-       componentclass = arrayclass->vftbl->arraydesc->componentvftbl->clazz;
-
-       /* The verifier guarantees that the dimension count is in the range. */
-
-       /* create the component arrays */
-
-       for (i = 0; i < size; i++) {
-               java_handle_t *ea =
-#if defined(__MIPS__) && (SIZEOF_VOID_P == 4)
-                       /* we save an s4 to a s8 slot, 8-byte aligned */
-
-                       builtin_multianewarray_intern(n, componentclass, dims + 2);
-#else
-                       builtin_multianewarray_intern(n, componentclass, dims + 1);
-#endif
-
-               if (!ea)
-                       return NULL;
-
-               array_objectarray_element_set((java_handle_objectarray_t *) a, i, ea);
-       }
-
-       return a;
-}
-
-
-/* builtin_multianewarray ******************************************************
-
-   Wrapper for builtin_multianewarray_intern which checks all
-   dimensions before we start allocating.
-
-   NOTE: This is a SLOW builtin and can be called from JIT code only.
-
-******************************************************************************/
-
-java_handle_objectarray_t *builtin_multianewarray(int n,
-                                                                                                 java_handle_t *arrayclazz,
-                                                                                                 long *dims)
-{
-       classinfo *c;
-       s4         i;
-       s4         size;
-
-       /* check all dimensions before doing anything */
-
-       for (i = 0; i < n; i++) {
-#if defined(__MIPS__) && (SIZEOF_VOID_P == 4)
-               /* we save an s4 to a s8 slot, 8-byte aligned */
-               size = (s4) dims[i * 2];
-#else
-               size = (s4) dims[i];
-#endif
-
-               if (size < 0) {
-                       exceptions_throw_negativearraysizeexception();
-                       return NULL;
-               }
-       }
-
-       c = LLNI_classinfo_unwrap(arrayclazz);
-
-       /* now call the real function */
-
-       return (java_handle_objectarray_t *)
-               builtin_multianewarray_intern(n, c, dims);
-}
-
-
-/* builtin_verbosecall_enter ***************************************************
-
-   Print method call with arguments for -verbose:call.
-
-   XXX: Remove mew once all archs use the new tracer!
-
-*******************************************************************************/
-
-#if !defined(NDEBUG)
-#ifdef TRACE_ARGS_NUM
-void builtin_verbosecall_enter(s8 a0, s8 a1,
-# if TRACE_ARGS_NUM >= 4
-                                                          s8 a2, s8 a3,
-# endif
-# if TRACE_ARGS_NUM >= 6
-                                                          s8 a4, s8 a5,
-# endif
-# if TRACE_ARGS_NUM == 8
-                                                          s8 a6, s8 a7,
-# endif
-                                                          methodinfo *m)
-{
-       log_text("builtin_verbosecall_enter: Do not call me anymore!");
-}
-#endif
-#endif /* !defined(NDEBUG) */
-
-
-/* builtin_verbosecall_exit ****************************************************
-
-   Print method exit for -verbose:call.
-
-   XXX: Remove mew once all archs use the new tracer!
-
-*******************************************************************************/
-
-#if !defined(NDEBUG)
-void builtin_verbosecall_exit(s8 l, double d, float f, methodinfo *m)
-{
-       log_text("builtin_verbosecall_exit: Do not call me anymore!");
-}
-#endif /* !defined(NDEBUG) */
-
-
-/*============================================================================*/
-/* MISCELLANEOUS MATHEMATICAL HELPER FUNCTIONS                                */
-/*============================================================================*/
-
-/*********** Functions for integer divisions *****************************
-       On some systems (eg. DEC ALPHA), integer division is not supported by the
-       CPU. These helper functions implement the missing functionality.
-
-******************************************************************************/
-
-#if !SUPPORT_DIVISION || defined(DISABLE_GC)
-s4 builtin_idiv(s4 a, s4 b)
-{
-       s4 c;
-
-       c = a / b;
-
-       return c;
-}
-
-s4 builtin_irem(s4 a, s4 b)
-{
-       s4 c;
-
-       c = a % b;
-
-       return c;
-}
-#endif /* !SUPPORT_DIVISION || defined(DISABLE_GC) */
-
-
-/* functions for long arithmetics **********************************************
-
-   On systems where 64 bit Integers are not supported by the CPU,
-   these functions are needed.
-
-******************************************************************************/
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
-s8 builtin_ladd(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a + b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lsub(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a - b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lneg(s8 a)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = -a;
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
-
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
-s8 builtin_lmul(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a * b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_MUL) */
-
-
-#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) || defined (DISABLE_GC)
-s8 builtin_ldiv(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a / b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lrem(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a % b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-#endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
-
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
-s8 builtin_lshl(s8 a, s4 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a << (b & 63);
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lshr(s8 a, s4 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a >> (b & 63);
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lushr(s8 a, s4 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = ((u8) a) >> (b & 63);
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
-
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
-s8 builtin_land(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a & b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lor(s8 a, s8 b)
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a | b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-
-s8 builtin_lxor(s8 a, s8 b) 
-{
-       s8 c;
-
-#if U8_AVAILABLE
-       c = a ^ b; 
-#else
-       c = builtin_i2l(0);
-#endif
-
-       return c;
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
-
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
-s4 builtin_lcmp(s8 a, s8 b)
-{ 
-#if U8_AVAILABLE
-       if (a < b)
-               return -1;
-
-       if (a > b)
-               return 1;
-
-       return 0;
-#else
-       return 0;
-#endif
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_CMP) */
-
-
-/* functions for unsupported floating instructions ****************************/
-
-/* used to convert FLT_xxx defines into float values */
-
-static inline float intBitsToFloat(s4 i)
-{
-       imm_union imb;
-
-       imb.i = i;
-       return imb.f;
-}
-
-
-/* used to convert DBL_xxx defines into double values */
-
-static inline float longBitsToDouble(s8 l)
-{
-       imm_union imb;
-
-       imb.l = l;
-       return imb.d;
-}
-
-
-#if !SUPPORT_FLOAT
-float builtin_fadd(float a, float b)
-{
-       if (isnanf(a)) return intBitsToFloat(FLT_NAN);
-       if (isnanf(b)) return intBitsToFloat(FLT_NAN);
-       if (finitef(a)) {
-               if (finitef(b))
-                       return a + b;
-               else
-                       return b;
-       }
-       else {
-               if (finitef(b))
-                       return a;
-               else {
-                       if (copysignf(1.0, a) == copysignf(1.0, b))
-                               return a;
-                       else
-                               return intBitsToFloat(FLT_NAN);
-               }
-       }
-}
-
-
-float builtin_fsub(float a, float b)
-{
-       return builtin_fadd(a, builtin_fneg(b));
-}
-
-
-float builtin_fmul(float a, float b)
-{
-       if (isnanf(a)) return intBitsToFloat(FLT_NAN);
-       if (isnanf(b)) return intBitsToFloat(FLT_NAN);
-       if (finitef(a)) {
-               if (finitef(b)) return a * b;
-               else {
-                       if (a == 0) return intBitsToFloat(FLT_NAN);
-                       else return copysignf(b, copysignf(1.0, b)*a);
-               }
-       }
-       else {
-               if (finitef(b)) {
-                       if (b == 0) return intBitsToFloat(FLT_NAN);
-                       else return copysignf(a, copysignf(1.0, a)*b);
-               }
-               else {
-                       return copysignf(a, copysignf(1.0, a)*copysignf(1.0, b));
-               }
-       }
-}
-
-
-/* builtin_ddiv ****************************************************************
-
-   Implementation as described in VM Spec.
-
-*******************************************************************************/
-
-float builtin_fdiv(float a, float b)
-{
-       if (finitef(a)) {
-               if (finitef(b)) {
-                       /* If neither value1' nor value2' is NaN, the sign of the result */
-                       /* is positive if both values have the same sign, negative if the */
-                       /* values have different signs. */
-
-                       return a / b;
-
-               } else {
-                       if (isnanf(b)) {
-                               /* If either value1' or value2' is NaN, the result is NaN. */
-
-                               return intBitsToFloat(FLT_NAN);
-
-                       } else {
-                               /* Division of a finite value by an infinity results in a */
-                               /* signed zero, with the sign-producing rule just given. */
-
-                               /* is sign equal? */
-
-                               if (copysignf(1.0, a) == copysignf(1.0, b))
-                                       return 0.0;
-                               else
-                                       return -0.0;
-                       }
-               }
-
-       } else {
-               if (isnanf(a)) {
-                       /* If either value1' or value2' is NaN, the result is NaN. */
-
-                       return intBitsToFloat(FLT_NAN);
-
-               } else if (finitef(b)) {
-                       /* Division of an infinity by a finite value results in a signed */
-                       /* infinity, with the sign-producing rule just given. */
-
-                       /* is sign equal? */
-
-                       if (copysignf(1.0, a) == copysignf(1.0, b))
-                               return intBitsToFloat(FLT_POSINF);
-                       else
-                               return intBitsToFloat(FLT_NEGINF);
-
-               } else {
-                       /* Division of an infinity by an infinity results in NaN. */
-
-                       return intBitsToFloat(FLT_NAN);
-               }
-       }
-}
-
-
-float builtin_fneg(float a)
-{
-       if (isnanf(a)) return a;
-       else {
-               if (finitef(a)) return -a;
-               else return copysignf(a, -copysignf(1.0, a));
-       }
-}
-#endif /* !SUPPORT_FLOAT */
-
-
-#if !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP || defined(ENABLE_INTRP)
-s4 builtin_fcmpl(float a, float b)
-{
-       if (isnanf(a))
-               return -1;
-
-       if (isnanf(b))
-               return -1;
-
-       if (!finitef(a) || !finitef(b)) {
-               a = finitef(a) ? 0 : copysignf(1.0,     a);
-               b = finitef(b) ? 0 : copysignf(1.0, b);
-       }
-
-       if (a > b)
-               return 1;
-
-       if (a == b)
-               return 0;
-
-       return -1;
-}
-
-
-s4 builtin_fcmpg(float a, float b)
-{
-       if (isnanf(a)) return 1;
-       if (isnanf(b)) return 1;
-       if (!finitef(a) || !finitef(b)) {
-               a = finitef(a) ? 0 : copysignf(1.0, a);
-               b = finitef(b) ? 0 : copysignf(1.0, b);
-       }
-       if (a > b) return 1;
-       if (a == b) return 0;
-       return -1;
-}
-#endif /* !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP || defined(ENABLE_INTRP) */
-
-
-float builtin_frem(float a, float b)
-{
-       return fmodf(a, b);
-}
-
-
-/* functions for unsupported double instructions ******************************/
-
-#if !SUPPORT_DOUBLE
-double builtin_dadd(double a, double b)
-{
-       if (isnan(a)) return longBitsToDouble(DBL_NAN);
-       if (isnan(b)) return longBitsToDouble(DBL_NAN);
-       if (finite(a)) {
-               if (finite(b)) return a + b;
-               else return b;
-       }
-       else {
-               if (finite(b)) return a;
-               else {
-                       if (copysign(1.0, a)==copysign(1.0, b)) return a;
-                       else return longBitsToDouble(DBL_NAN);
-               }
-       }
-}
-
-
-double builtin_dsub(double a, double b)
-{
-       return builtin_dadd(a, builtin_dneg(b));
-}
-
-
-double builtin_dmul(double a, double b)
-{
-       if (isnan(a)) return longBitsToDouble(DBL_NAN);
-       if (isnan(b)) return longBitsToDouble(DBL_NAN);
-       if (finite(a)) {
-               if (finite(b)) return a * b;
-               else {
-                       if (a == 0) return longBitsToDouble(DBL_NAN);
-                       else return copysign(b, copysign(1.0, b) * a);
-               }
-       }
-       else {
-               if (finite(b)) {
-                       if (b == 0) return longBitsToDouble(DBL_NAN);
-                       else return copysign(a, copysign(1.0, a) * b);
-               }
-               else {
-                       return copysign(a, copysign(1.0, a) * copysign(1.0, b));
-               }
-       }
-}
-
-
-/* builtin_ddiv ****************************************************************
-
-   Implementation as described in VM Spec.
-
-*******************************************************************************/
-
-double builtin_ddiv(double a, double b)
-{
-       if (finite(a)) {
-               if (finite(b)) {
-                       /* If neither value1' nor value2' is NaN, the sign of the result */
-                       /* is positive if both values have the same sign, negative if the */
-                       /* values have different signs. */
-
-                       return a / b;
-
-               } else {
-                       if (isnan(b)) {
-                               /* If either value1' or value2' is NaN, the result is NaN. */
-
-                               return longBitsToDouble(DBL_NAN);
-
-                       } else {
-                               /* Division of a finite value by an infinity results in a */
-                               /* signed zero, with the sign-producing rule just given. */
-
-                               /* is sign equal? */
-
-                               if (copysign(1.0, a) == copysign(1.0, b))
-                                       return 0.0;
-                               else
-                                       return -0.0;
-                       }
-               }
-
-       } else {
-               if (isnan(a)) {
-                       /* If either value1' or value2' is NaN, the result is NaN. */
-
-                       return longBitsToDouble(DBL_NAN);
-
-               } else if (finite(b)) {
-                       /* Division of an infinity by a finite value results in a signed */
-                       /* infinity, with the sign-producing rule just given. */
-
-                       /* is sign equal? */
-
-                       if (copysign(1.0, a) == copysign(1.0, b))
-                               return longBitsToDouble(DBL_POSINF);
-                       else
-                               return longBitsToDouble(DBL_NEGINF);
-
-               } else {
-                       /* Division of an infinity by an infinity results in NaN. */
-
-                       return longBitsToDouble(DBL_NAN);
-               }
-       }
-}
-
-
-/* builtin_dneg ****************************************************************
-
-   Implemented as described in VM Spec.
-
-*******************************************************************************/
-
-double builtin_dneg(double a)
-{
-       if (isnan(a)) {
-               /* If the operand is NaN, the result is NaN (recall that NaN has no */
-               /* sign). */
-
-               return a;
-
-       } else {
-               if (finite(a)) {
-                       /* If the operand is a zero, the result is the zero of opposite */
-                       /* sign. */
-
-                       return -a;
-
-               } else {
-                       /* If the operand is an infinity, the result is the infinity of */
-                       /* opposite sign. */
-
-                       return copysign(a, -copysign(1.0, a));
-               }
-       }
-}
-#endif /* !SUPPORT_DOUBLE */
-
-
-#if !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP || defined(ENABLE_INTRP)
-s4 builtin_dcmpl(double a, double b)
-{
-       if (isnan(a))
-               return -1;
-
-       if (isnan(b))
-               return -1;
-
-       if (!finite(a) || !finite(b)) {
-               a = finite(a) ? 0 : copysign(1.0, a);
-               b = finite(b) ? 0 : copysign(1.0, b);
-       }
-
-       if (a > b)
-               return 1;
-
-       if (a == b)
-               return 0;
-
-       return -1;
-}
-
-
-s4 builtin_dcmpg(double a, double b)
-{
-       if (isnan(a))
-               return 1;
-
-       if (isnan(b))
-               return 1;
-
-       if (!finite(a) || !finite(b)) {
-               a = finite(a) ? 0 : copysign(1.0, a);
-               b = finite(b) ? 0 : copysign(1.0, b);
-       }
-
-       if (a > b)
-               return 1;
-
-       if (a == b)
-               return 0;
-
-       return -1;
-}
-#endif /* !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP || defined(ENABLE_INTRP) */
-
-
-double builtin_drem(double a, double b)
-{
-       return fmod(a, b);
-}
-
-
-/* conversion operations ******************************************************/
-
-#if 0
-s8 builtin_i2l(s4 i)
-{
-#if U8_AVAILABLE
-       return i;
-#else
-       s8 v;
-       v.high = 0;
-       v.low = i;
-       return v;
-#endif
-}
-
-s4 builtin_l2i(s8 l)
-{
-#if U8_AVAILABLE
-       return (s4) l;
-#else
-       return l.low;
-#endif
-}
-#endif
-
-
-#if !(SUPPORT_FLOAT && SUPPORT_I2F)
-float builtin_i2f(s4 a)
-{
-       float f = (float) a;
-       return f;
-}
-#endif /* !(SUPPORT_FLOAT && SUPPORT_I2F) */
-
-
-#if !(SUPPORT_DOUBLE && SUPPORT_I2D)
-double builtin_i2d(s4 a)
-{
-       double d = (double) a;
-       return d;
-}
-#endif /* !(SUPPORT_DOUBLE && SUPPORT_I2D) */
-
-
-#if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F)
-float builtin_l2f(s8 a)
-{
-#if U8_AVAILABLE
-       float f = (float) a;
-       return f;
-#else
-       return 0.0;
-#endif
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F) */
-
-
-#if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D)
-double builtin_l2d(s8 a)
-{
-#if U8_AVAILABLE
-       double d = (double) a;
-       return d;
-#else
-       return 0.0;
-#endif
-}
-#endif /* !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D) */
-
-
-#if !(SUPPORT_FLOAT && SUPPORT_F2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
-s4 builtin_f2i(float a) 
-{
-       s4 i;
-
-       i = builtin_d2i((double) a);
-
-       return i;
-
-       /*      float f;
-       
-               if (isnanf(a))
-               return 0;
-               if (finitef(a)) {
-               if (a > 2147483647)
-               return 2147483647;
-               if (a < (-2147483648))
-               return (-2147483648);
-               return (s4) a;
-               }
-               f = copysignf((float) 1.0, a);
-               if (f > 0)
-               return 2147483647;
-               return (-2147483648); */
-}
-#endif /* !(SUPPORT_FLOAT && SUPPORT_F2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC) */
-
-
-#if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L) || defined(DISABLE_GC)
-s8 builtin_f2l(float a)
-{
-       s8 l;
-
-       l = builtin_d2l((double) a);
-
-       return l;
-
-       /*      float f;
-       
-               if (finitef(a)) {
-               if (a > 9223372036854775807L)
-               return 9223372036854775807L;
-               if (a < (-9223372036854775808L))
-               return (-9223372036854775808L);
-               return (s8) a;
-               }
-               if (isnanf(a))
-               return 0;
-               f = copysignf((float) 1.0, a);
-               if (f > 0)
-               return 9223372036854775807L;
-               return (-9223372036854775808L); */
-}
-#endif /* !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L) */
-
-
-#if !(SUPPORT_DOUBLE && SUPPORT_D2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
-s4 builtin_d2i(double a) 
-{ 
-       double d;
-       
-       if (finite(a)) {
-               if (a >= 2147483647)
-                       return 2147483647;
-               if (a <= (-2147483647-1))
-                       return (-2147483647-1);
-               return (s4) a;
-       }
-       if (isnan(a))
-               return 0;
-       d = copysign(1.0, a);
-       if (d > 0)
-               return 2147483647;
-       return (-2147483647-1);
-}
-#endif /* !(SUPPORT_DOUBLE && SUPPORT_D2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC) */
-
-
-#if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L) || defined(DISABLE_GC)
-s8 builtin_d2l(double a)
-{
-       double d;
-       
-       if (finite(a)) {
-               if (a >= 9223372036854775807LL)
-                       return 9223372036854775807LL;
-               if (a <= (-9223372036854775807LL-1))
-                       return (-9223372036854775807LL-1);
-               return (s8) a;
-       }
-       if (isnan(a))
-               return 0;
-       d = copysign(1.0, a);
-       if (d > 0)
-               return 9223372036854775807LL;
-       return (-9223372036854775807LL-1);
-}
-#endif /* !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L) */
-
-
-#if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
-double builtin_f2d(float a)
-{
-       if (finitef(a)) return (double) a;
-       else {
-               if (isnanf(a))
-                       return longBitsToDouble(DBL_NAN);
-               else
-                       return copysign(longBitsToDouble(DBL_POSINF), (double) copysignf(1.0, a) );
-       }
-}
-
-float builtin_d2f(double a)
-{
-       if (finite(a))
-               return (float) a;
-       else {
-               if (isnan(a))
-                       return intBitsToFloat(FLT_NAN);
-               else
-                       return copysignf(intBitsToFloat(FLT_POSINF), (float) copysign(1.0, a));
-       }
-}
-#endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
-
-
-/*============================================================================*/
-/* AUTOMATICALLY REPLACED FUNCTIONS                                           */
-/*============================================================================*/
-
-/* builtin_arraycopy ***********************************************************
-
-   Builtin for java.lang.System.arraycopy.
-
-   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
-
-*******************************************************************************/
-
-void builtin_arraycopy(java_handle_t *src, s4 srcStart,
-                                          java_handle_t *dest, s4 destStart, s4 len)
-{
-       arraydescriptor *sdesc;
-       arraydescriptor *ddesc;
-       s4               i;
-
-       if ((src == NULL) || (dest == NULL)) {
-               exceptions_throw_nullpointerexception();
-               return;
-       }
-
-       sdesc = LLNI_vftbl_direct(src)->arraydesc;
-       ddesc = LLNI_vftbl_direct(dest)->arraydesc;
-
-       if (!sdesc || !ddesc || (sdesc->arraytype != ddesc->arraytype)) {
-               exceptions_throw_arraystoreexception();
-               return;
-       }
-
-       // Check if offsets and length are positive.
-       if ((srcStart < 0) || (destStart < 0) || (len < 0)) {
-               exceptions_throw_arrayindexoutofboundsexception();
-               return;
-       }
-
-       // Check if ranges are valid.
-       if ((((uint32_t) srcStart  + (uint32_t) len) > (uint32_t) LLNI_array_size(src)) ||
-               (((uint32_t) destStart + (uint32_t) len) > (uint32_t) LLNI_array_size(dest))) {
-               exceptions_throw_arrayindexoutofboundsexception();
-               return;
-       }
-
-       // Special case.
-       if (len == 0) {
-               return;
-       }
-
-       if (sdesc->componentvftbl == ddesc->componentvftbl) {
-               /* We copy primitive values or references of exactly the same type */
-
-               s4 dataoffset = sdesc->dataoffset;
-               s4 componentsize = sdesc->componentsize;
-
-               LLNI_CRITICAL_START;
-
-               MMOVE(((u1 *) LLNI_DIRECT(dest)) + dataoffset + componentsize * destStart,
-                         ((u1 *) LLNI_DIRECT(src))  + dataoffset + componentsize * srcStart,
-                         u1, (size_t) len * componentsize);
-
-               LLNI_CRITICAL_END;
-       }
-       else {
-               /* We copy references of different type */
-
-               java_handle_objectarray_t *oas = (java_handle_objectarray_t *) src;
-               java_handle_objectarray_t *oad = (java_handle_objectarray_t *) dest;
-               if (destStart <= srcStart) {
-                       for (i = 0; i < len; i++) {
-                               java_handle_t *o;
-
-                               o = array_objectarray_element_get(oas, srcStart + i);
-
-                               if (!builtin_canstore(oad, o))
-                                       return;
-
-                               array_objectarray_element_set(oad, destStart + i, o);
-                       }
-               }
-               else {
-                       /* XXX this does not completely obey the specification!
-                          If an exception is thrown only the elements above the
-                          current index have been copied. The specification
-                          requires that only the elements *below* the current
-                          index have been copied before the throw. */
-
-                       for (i = len - 1; i >= 0; i--) {
-                               java_handle_t *o;
-
-                               o = array_objectarray_element_get(oas, srcStart + i);
-
-                               if (!builtin_canstore(oad, o))
-                                       return;
-
-                               array_objectarray_element_set(oad, destStart + i, o);
-                       }
-               }
-       }
-}
-
-
-/* builtin_nanotime ************************************************************
-
-   Return the current time in nanoseconds.
-
-*******************************************************************************/
-
-s8 builtin_nanotime(void)
-{
-       struct timeval tv;
-       s8             usecs;
-
-       if (gettimeofday(&tv, NULL) == -1)
-               vm_abort("gettimeofday failed: %s", strerror(errno));
-
-       usecs = (s8) tv.tv_sec * (1000 * 1000) + (s8) tv.tv_usec;
-
-       return usecs * 1000;
-}
-
-
-/* builtin_currenttimemillis ***************************************************
-
-   Return the current time in milliseconds.
-
-*******************************************************************************/
-
-s8 builtin_currenttimemillis(void)
-{
-       s8 msecs;
-
-       msecs = builtin_nanotime() / 1000 / 1000;
-
-       return msecs;
-}
-
-
-/* builtin_clone ***************************************************************
-
-   Function for cloning objects or arrays.
-
-   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
-
-*******************************************************************************/
-
-java_handle_t *builtin_clone(void *env, java_handle_t *o)
-{
-       arraydescriptor *ad;
-       u4               size;
-       classinfo       *c;
-       java_handle_t   *co;                /* cloned object header               */
-
-       /* get the array descriptor */
-
-       ad = LLNI_vftbl_direct(o)->arraydesc;
-
-       /* we are cloning an array */
-
-       if (ad != NULL) {
-               size = ad->dataoffset + ad->componentsize * LLNI_array_size(o);
-        
-               co = heap_alloc(size, (ad->arraytype == ARRAYTYPE_OBJECT), NULL, true);
-
-               if (co == NULL)
-                       return NULL;
-
-#if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
-               /* XXX this is only a dirty hack to make Boehm work with handles */
-
-               co = LLNI_WRAP((java_object_t *) co);
-#endif
-
-               LLNI_CRITICAL_START;
-
-               MCOPY(LLNI_DIRECT(co), LLNI_DIRECT(o), u1, size);
-
-#if defined(ENABLE_GC_CACAO)
-               heap_init_objectheader(LLNI_DIRECT(co), size);
-#endif
-
-#if defined(ENABLE_THREADS)
-               lock_init_object_lock(LLNI_DIRECT(co));
-#endif
-
-               LLNI_CRITICAL_END;
-
-               return co;
-       }
-    
-    /* we are cloning a non-array */
-
-    if (!builtin_instanceof(o, class_java_lang_Cloneable)) {
-        exceptions_throw_clonenotsupportedexception();
-        return NULL;
-    }
-
-       /* get the class of the object */
-
-       LLNI_class_get(o, c);
-
-       /* create new object */
-
-    co = builtin_new(c);
-
-    if (co == NULL)
-        return NULL;
-
-       LLNI_CRITICAL_START;
-
-       MCOPY(LLNI_DIRECT(co), LLNI_DIRECT(o), u1, c->instancesize);
-
-#if defined(ENABLE_GC_CACAO)
-       heap_init_objectheader(LLNI_DIRECT(co), c->instancesize);
-#endif
-
-#if defined(ENABLE_THREADS)
-       lock_init_object_lock(LLNI_DIRECT(co));
-#endif
-
-       LLNI_CRITICAL_END;
-
-    return co;
-}
-
-
-#if defined(ENABLE_CYCLES_STATS)
-void builtin_print_cycles_stats(FILE *file)
-{
-       fprintf(file,"builtin cylce count statistics:\n");
-
-       CYCLES_STATS_PRINT_OVERHEAD(builtin_overhead,file);
-       CYCLES_STATS_PRINT(builtin_new         ,file);
-
-       fprintf(file,"\n");
-}
-#endif /* defined(ENABLE_CYCLES_STATS) */
-
-
-#if defined(ENABLE_VMLOG)
-#define NDEBUG
-#include <vmlog_cacao.c>
-#endif
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
diff --git a/src/vm/builtin.h b/src/vm/builtin.h
deleted file mode 100644 (file)
index 48bec63..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-/* src/vm/builtin.h - prototypes of builtin functions
-
-   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 _BUILTIN_H
-#define _BUILTIN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* forward typedefs ***********************************************************/
-
-typedef struct builtintable_entry builtintable_entry;
-
-#include "config.h"
-#include "vm/types.h"
-
-#include "arch.h"
-#include "md-abi.h"
-
-#include "toolbox/logging.h"
-
-#include "vm/descriptor.h"
-#include "vm/utf8.h"
-
-
-/* define infinity for floating point numbers */
-
-#define FLT_NAN     0x7fc00000
-#define FLT_POSINF  0x7f800000
-#define FLT_NEGINF  0xff800000
-
-/* define infinity for double floating point numbers */
-
-#define DBL_NAN     0x7ff8000000000000LL
-#define DBL_POSINF  0x7ff0000000000000LL
-#define DBL_NEGINF  0xfff0000000000000LL
-
-
-/* float versions are not defined in GNU classpath's fdlibm */
-
-#define copysignf    copysign
-#define finitef      finite
-#define fmodf        fmod
-#define isnanf       isnan
-
-
-/* builtin functions table ****************************************************/
-
-struct builtintable_entry {
-       s4           opcode;                /* opcode which is replaced           */
-       u4           flags;                 /* e.g. check for exception           */
-       functionptr  fp;                    /* function pointer of builtin        */
-       u1          *stub;                  /* pointer to builtin stub code       */
-       char        *cclassname;            /* char name of the class             */
-       char        *cname;                 /* char name of the function          */
-       char        *cdescriptor;           /* char name of the descriptor        */
-       utf         *classname;             /* class of the function              */
-       utf         *name;                  /* name of the function               */
-       utf         *descriptor;            /* descriptor of the function         */
-       methoddesc  *md;
-};
-
-
-/* builtin table flag defines *************************************************/
-
-#define BUILTINTABLE_FLAG_STUB         0x0001 /* builtin needs a stub         */
-#define BUILTINTABLE_FLAG_EXCEPTION    0x0002 /* check for excepion on return */
-
-
-/* function prototypes ********************************************************/
-
-bool builtin_init(void);
-
-builtintable_entry *builtintable_get_internal(functionptr fp);
-builtintable_entry *builtintable_get_automatic(s4 opcode);
-
-bool builtintable_replace_function(void *iptr);
-
-
-/**********************************************************************/
-/* BUILTIN FUNCTIONS                                                  */
-/**********************************************************************/
-
-/* NOTE: Builtin functions which are used in the BUILTIN* opcodes must
- * have a BUILTIN_... macro defined as seen below. In code dealing
- * with the BUILTIN* opcodes the functions may only be addressed by
- * these macros, never by their actual name! (This helps to make this
- * code more portable.)
- *
- * C and assembler code which does not deal with the BUILTIN* opcodes,
- * can use the builtin functions normally (like all other functions).
- *
- * IMPORTANT:
- * For each builtin function which is used in a BUILTIN* opcode there
- * must be an entry in the builtin_desc table in jit/jit.c.
- *
- * Below each prototype is either the BUILTIN_ macro definition or a
- * comment specifiying that this function is not used in BUILTIN*
- * opcodes.
- *
- * (The BUILTIN* opcodes are ICMD_BUILTIN1, ICMD_BUILTIN2 and
- * ICMD_BUILTIN3.)
- */
-
-bool builtin_instanceof(java_handle_t *obj, classinfo *c);
-/* NOT AN OP */
-bool builtin_checkcast(java_handle_t *obj, classinfo *c);
-/* NOT AN OP */
-bool builtin_arrayinstanceof(java_handle_t *h, classinfo *targetclass);
-/* NOT AN OP */
-bool builtin_fast_arrayinstanceof(java_object_t *o, classinfo *targetclass);
-#define BUILTIN_arrayinstanceof (functionptr) builtin_fast_arrayinstanceof
-bool builtin_fast_arraycheckcast(java_object_t *o, classinfo *targetclass);
-#define BUILTIN_arraycheckcast (functionptr) builtin_fast_arraycheckcast
-
-bool builtin_canstore(java_handle_objectarray_t *oa, java_handle_t *o);
-/* NOT AN OP */
-bool builtin_fast_canstore(java_objectarray_t *oa, java_object_t *o);
-#define BUILTIN_FAST_canstore (functionptr) builtin_fast_canstore
-
-void *builtin_throw_exception(java_object_t *exception);
-/* NOT AN OP */
-java_object_t *builtin_retrieve_exception(void);
-/* NOT AN OP */
-
-java_handle_t *builtin_new(classinfo *c);
-/* NOT AN OP */
-java_handle_t *builtin_java_new(java_handle_t *c);
-#define BUILTIN_new (functionptr) builtin_java_new
-
-#if defined(ENABLE_TLH)
-#define BUILTIN_tlh_new (functionptr) builtin_tlh_new
-java_handle_t *builtin_tlh_new(classinfo *c);
-#endif
-
-#if defined(ENABLE_ESCAPE_REASON)
-#define BUILTIN_escape_reason_new (functionptr)builtin_escape_reason_new
-java_handle_t *builtin_escape_reason_new(classinfo *c);
-#endif
-
-java_object_t *builtin_fast_new(classinfo *c);
-#define BUILTIN_FAST_new (functionptr) builtin_fast_new
-
-java_handle_t *builtin_newarray(int32_t size, classinfo *arrayclass);
-/* NOT AN OP */
-java_handle_t *builtin_java_newarray(int32_t size, java_handle_t *arrayclass);
-#define BUILTIN_newarray (functionptr) builtin_java_newarray
-
-java_handle_objectarray_t *builtin_anewarray(int32_t size, classinfo *componentclass);
-/* NOT AN OP */
-
-java_handle_booleanarray_t *builtin_newarray_boolean(int32_t size);
-#define BUILTIN_newarray_boolean (functionptr) builtin_newarray_boolean
-java_handle_chararray_t *builtin_newarray_char(int32_t size);
-#define BUILTIN_newarray_char (functionptr) builtin_newarray_char
-java_handle_floatarray_t *builtin_newarray_float(int32_t size);
-#define BUILTIN_newarray_float (functionptr) builtin_newarray_float
-java_handle_doublearray_t *builtin_newarray_double(int32_t size);
-#define BUILTIN_newarray_double (functionptr) builtin_newarray_double
-java_handle_bytearray_t *builtin_newarray_byte(int32_t size);
-#define BUILTIN_newarray_byte (functionptr) builtin_newarray_byte
-java_handle_shortarray_t *builtin_newarray_short(int32_t size);
-#define BUILTIN_newarray_short (functionptr) builtin_newarray_short
-java_handle_intarray_t *builtin_newarray_int(int32_t size);
-#define BUILTIN_newarray_int (functionptr) builtin_newarray_int
-java_handle_longarray_t *builtin_newarray_long(int32_t size);
-#define BUILTIN_newarray_long (functionptr) builtin_newarray_long
-
-java_handle_objectarray_t *builtin_multianewarray(int n,
-                                                                                                 java_handle_t *arrayclass,
-                                                                                                 long *dims);
-#define BUILTIN_multianewarray (functionptr) builtin_multianewarray
-
-#if defined(TRACE_ARGS_NUM)
-void builtin_verbosecall_enter(s8 a0, s8 a1,
-# if TRACE_ARGS_NUM >= 4
-                                                          s8 a2, s8 a3,
-# endif
-# if TRACE_ARGS_NUM >= 6
-                                                          s8 a4, s8 a5,
-# endif
-# if TRACE_ARGS_NUM == 8
-                                                          s8 a6, s8 a7,
-# endif
-                                                          methodinfo *m);
-/* NOT AN OP */
-#endif /* defined(TRACE_ARGS_NUM) */
-
-void builtin_verbosecall_exit(s8 l, double d, float f, methodinfo *m);
-/* NOT AN OP */
-
-s4 builtin_idiv(s4 a, s4 b);
-#define BUILTIN_idiv (functionptr) builtin_idiv
-s4 builtin_irem(s4 a, s4 b);
-#define BUILTIN_irem (functionptr) builtin_irem
-
-s8 builtin_ladd(s8 a, s8 b);
-#define BUILTIN_ladd (functionptr) builtin_ladd
-s8 builtin_lsub(s8 a, s8 b);
-#define BUILTIN_lsub (functionptr) builtin_lsub
-s8 builtin_lmul(s8 a, s8 b);
-#define BUILTIN_lmul (functionptr) builtin_lmul
-
-s8 builtin_ldiv(s8 a, s8 b);
-#define BUILTIN_ldiv (functionptr) builtin_ldiv
-s8 builtin_lrem(s8 a, s8 b);
-#define BUILTIN_lrem (functionptr) builtin_lrem
-
-s8 builtin_lshl(s8 a, s4 b);
-#define BUILTIN_lshl (functionptr) builtin_lshl
-s8 builtin_lshr(s8 a, s4 b);
-#define BUILTIN_lshr (functionptr) builtin_lshr
-s8 builtin_lushr(s8 a, s4 b);
-#define BUILTIN_lushr (functionptr) builtin_lushr
-s8 builtin_land(s8 a, s8 b);
-#define BUILTIN_land (functionptr) builtin_land
-s8 builtin_lor(s8 a, s8 b);
-#define BUILTIN_lor (functionptr) builtin_lor
-s8 builtin_lxor(s8 a, s8 b);
-#define BUILTIN_lxor (functionptr) builtin_lxor
-s8 builtin_lneg(s8 a);
-#define BUILTIN_lneg (functionptr) builtin_lneg
-s4 builtin_lcmp(s8 a, s8 b);
-#define BUILTIN_lcmp (functionptr) builtin_lcmp
-
-float builtin_fadd(float a, float b);
-#define BUILTIN_fadd (functionptr) builtin_fadd
-float builtin_fsub(float a, float b);
-#define BUILTIN_fsub (functionptr) builtin_fsub
-float builtin_fmul(float a, float b);
-#define BUILTIN_fmul (functionptr) builtin_fmul
-float builtin_fdiv(float a, float b);
-#define BUILTIN_fdiv (functionptr) builtin_fdiv
-float builtin_fneg(float a);         
-#define BUILTIN_fneg (functionptr) builtin_fneg
-s4 builtin_fcmpl(float a, float b);  
-#define BUILTIN_fcmpl (functionptr) builtin_fcmpl
-s4 builtin_fcmpg(float a, float b);  
-#define BUILTIN_fcmpg (functionptr) builtin_fcmpg
-float builtin_frem(float a, float b);
-#define BUILTIN_frem (functionptr) builtin_frem
-
-double builtin_dadd(double a, double b);
-#define BUILTIN_dadd (functionptr) builtin_dadd
-double builtin_dsub(double a, double b);
-#define BUILTIN_dsub (functionptr) builtin_dsub
-double builtin_dmul(double a, double b);
-#define BUILTIN_dmul (functionptr) builtin_dmul
-double builtin_ddiv(double a, double b);
-#define BUILTIN_ddiv (functionptr) builtin_ddiv
-double builtin_dneg(double a);          
-#define BUILTIN_dneg (functionptr) builtin_dneg
-s4 builtin_dcmpl(double a, double b);   
-#define BUILTIN_dcmpl (functionptr) builtin_dcmpl
-s4 builtin_dcmpg(double a, double b);   
-#define BUILTIN_dcmpg (functionptr) builtin_dcmpg
-double builtin_drem(double a, double b);
-#define BUILTIN_drem (functionptr) builtin_drem
-
-s8       builtin_i2l(s4 i);
-/* NOT AN OP */
-float    builtin_i2f(s4 i);
-#define BUILTIN_i2f (functionptr) builtin_i2f
-double   builtin_i2d(s4 i);
-#define BUILTIN_i2d (functionptr) builtin_i2d
-s4       builtin_l2i(s8 l);
-/* NOT AN OP */
-float    builtin_l2f(s8 l);
-#define BUILTIN_l2f (functionptr) builtin_l2f
-double   builtin_l2d(s8 l);
-#define BUILTIN_l2d (functionptr) builtin_l2d
-
-s4       builtin_f2i(float a);
-#define BUILTIN_f2i (functionptr) builtin_f2i
-s4       asm_builtin_f2i(float a);
-/* NOT AN OP */
-s8       builtin_f2l(float a);
-#define BUILTIN_f2l (functionptr) builtin_f2l
-s8       asm_builtin_f2l(float a);
-/* NOT AN OP */
-
-double   builtin_f2d(float a);
-#define BUILTIN_f2d (functionptr) builtin_f2d
-
-s4       builtin_d2i(double a);
-#define BUILTIN_d2i (functionptr) builtin_d2i
-s4       asm_builtin_d2i(double a);
-/* NOT AN OP */
-s8       builtin_d2l(double a);
-#define BUILTIN_d2l (functionptr) builtin_d2l
-s8       asm_builtin_d2l(double a);
-/* NOT AN OP */
-
-float    builtin_d2f(double a);
-#define BUILTIN_d2f (functionptr) builtin_d2f
-
-java_handle_t *builtin_clone(void *env, java_handle_t *o);
-#define BUILTIN_clone (functionptr) builtin_clone
-
-void builtin_arraycopy(java_handle_t *src, s4 srcStart,
-                                          java_handle_t *dest, s4 destStart, s4 len);
-#define BUILTIN_arraycopy (functionptr) builtin_arraycopy
-
-s8 builtin_nanotime(void);
-s8 builtin_currenttimemillis(void);
-#define BUILTIN_currenttimemillis (functionptr) builtin_currenttimemillis
-
-#if defined(ENABLE_CYCLES_STATS)
-void builtin_print_cycles_stats(FILE *file);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BUILTIN_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/vm/builtintable.inc b/src/vm/builtintable.inc
deleted file mode 100644 (file)
index 3280f02..0000000
+++ /dev/null
@@ -1,1109 +0,0 @@
-/* src/vm/builtintable.inc - tables of builtin functions
-
-   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 "arch.h"
-
-#include "threads/lock-common.h"
-
-#include "vm/builtin.h"
-
-#include "vm/jit/jit.hpp"
-
-
-/* internal and not automatically replaced functions **************************/
-
-static builtintable_entry builtintable_internal[] = {
-
-#if defined(__ALPHA__) || defined(DISABLE_GC)
-       {
-               ICMD_F2L,
-               0,
-               BUILTIN_f2l,
-               NULL,
-               NULL,
-               "f2l",
-               "(F)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_D2L,
-               0,
-               BUILTIN_d2l,
-               NULL,
-               NULL,
-               "d2l",
-               "(D)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_F2I,
-               0,
-               BUILTIN_f2i,
-               NULL,
-               NULL,
-               "f2i",
-               "(F)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_D2I,
-               0,
-               BUILTIN_d2i,
-               NULL,
-               NULL,
-               "d2i",
-               "(D)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !SUPPORT_DIVISION || defined(DISABLE_GC)
-       {
-               ICMD_IDIV,
-               0,
-               BUILTIN_idiv,
-               NULL,
-               NULL,
-               "idiv",
-               "(II)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_IREM,
-               0,
-               BUILTIN_irem,
-               NULL,
-               NULL,
-               "irem",
-               "(II)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) || defined(DISABLE_GC)
-       {
-               ICMD_LDIV,
-               0,
-               BUILTIN_ldiv,
-               NULL,
-               NULL,
-               "ldiv",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LREM,
-               0,
-               BUILTIN_lrem,
-               NULL,
-               NULL,
-               "lrem",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-       {
-               ICMD_FREM,
-               0,
-               BUILTIN_frem,
-               NULL,
-               NULL,
-               "frem",
-               "(FF)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_DREM,
-               0,
-               BUILTIN_drem,
-               NULL,
-               NULL,
-               "drem",
-               "(DD)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-
-
-       /* internal functions *****************************************************/
-
-       {
-               ICMD_NEW,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_new,
-               NULL,
-               NULL,
-               "new",
-               "(Ljava/lang/Class;)Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-
-#if defined(ENABLE_TLH)
-       {
-               ICMD_NEW,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_tlh_new,
-               NULL,
-               NULL,
-               "tlh_new",
-               "(Ljava/lang/Class;)Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if defined(ENABLE_ESCAPE_REASON)
-       {
-               ICMD_NEW,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_escape_reason_new,
-               NULL,
-               NULL,
-               "escape_reason_new",
-               "(Ljava/lang/Class;)Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-       {
-               ICMD_NEW,
-               0,
-               BUILTIN_FAST_new,
-               NULL,
-               NULL,
-               "fast-new",
-               "(Ljava/lang/Class;)Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_ANEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray,
-               NULL,
-               NULL,
-               "newarray",
-               "(ILjava/lang/Class;)[Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_boolean,
-               NULL,
-               NULL,
-               "newarray_boolean",
-               "(I)[Z",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_byte,
-               NULL,
-               NULL,
-               "newarray_byte",
-               "(I)[B",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_char,
-               NULL,
-               NULL,
-               "newarray_char",
-               "(I)[C",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_short,
-               NULL,
-               NULL,
-               "newarray_short",
-               "(I)[S",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_int,
-               NULL,
-               NULL,
-               "newarray_int",
-               "(I)[I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_long,
-               NULL,
-               NULL,
-               "newarray_long",
-               "(I)[J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_float,
-               NULL,
-               NULL,
-               "newarray_float",
-               "(I)[F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_NEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_newarray_double,
-               NULL,
-               NULL,
-               "newarray_double",
-               "(I)[D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_MULTIANEWARRAY,
-               BUILTINTABLE_FLAG_STUB,
-               BUILTIN_multianewarray,
-               NULL,
-               NULL,
-               "multianewarray",
-               /* XXX it should be: "(ILjava/lang/Class;[I)[Ljava/lang/Object;", */
-               "(ILjava/lang/Class;I)[Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_CHECKCAST,
-               0,
-               BUILTIN_arraycheckcast,
-               NULL,
-               NULL,
-               "arraycheckcast",
-               "([Ljava/lang/Object;[Ljava/lang/Object;)[Ljava/lang/Object;",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_INSTANCEOF,
-               0,
-               BUILTIN_arrayinstanceof,
-               NULL,
-               NULL,
-               "arrayinstanceof",
-               "([Ljava/lang/Object;[Ljava/lang/Object;)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_AASTORE,
-               0,
-               BUILTIN_FAST_canstore,
-               NULL,
-               NULL,
-               "fast-canstore",
-               "([Ljava/lang/Object;Ljava/lang/Object;)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-
-#if defined(ENABLE_THREADS)
-       {
-               ICMD_MONITORENTER,
-               BUILTINTABLE_FLAG_STUB,
-               LOCK_monitor_enter,
-               NULL,
-               NULL,
-               "monitorenter",
-               "(Ljava/lang/Object;)V",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_MONITOREXIT,
-               BUILTINTABLE_FLAG_STUB,
-               LOCK_monitor_exit,
-               NULL,
-               NULL,
-               "monitorexit",
-               "(Ljava/lang/Object;)V",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-
-       /* stop entry */
-
-       {
-               255,
-               0,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-};
-
-
-/* automatically replaced functions *******************************************/
-
-static builtintable_entry builtintable_automatic[] = {
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
-       {
-               ICMD_LCMP,
-               0,
-               BUILTIN_lcmp,
-               NULL,
-               NULL,
-               "lcmp",
-               "(JJ)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
-       {
-               ICMD_LAND,
-               0,
-               BUILTIN_land,
-               NULL,
-               NULL,
-               "land",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LOR,
-               0,
-               BUILTIN_lor,
-               NULL,
-               NULL,
-               "lor",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LXOR,
-               0,
-               BUILTIN_lxor,
-               NULL,
-               NULL,
-               "lxor",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
-       {
-               ICMD_LSHL,
-               0,
-               BUILTIN_lshl,
-               NULL,
-               NULL,
-               "lshl",
-               "(JI)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LSHR,
-               0,
-               BUILTIN_lshr,
-               NULL,
-               NULL,
-               "lshr",
-               "(JI)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LUSHR,
-               0,
-               BUILTIN_lushr,
-               NULL,
-               NULL,
-               "lushr",
-               "(JI)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
-       {
-               ICMD_LADD,
-               0,
-               BUILTIN_ladd,
-               NULL,
-               NULL,
-               "ladd",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LSUB,
-               0,
-               BUILTIN_lsub,
-               NULL,
-               NULL,
-               "lsub",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_LNEG,
-               0,
-               BUILTIN_lneg,
-               NULL,
-               NULL,
-               "lneg",
-               "(J)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
-
-#if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
-       {
-               ICMD_LMUL,
-               0,
-               BUILTIN_lmul,
-               NULL,
-               NULL,
-               "lmul",
-               "(JJ)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_FLOAT && SUPPORT_I2F)
-       {
-               ICMD_I2F,
-               0,
-               BUILTIN_i2f,
-               NULL,
-               NULL,
-               "i2f",
-               "(I)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_DOUBLE && SUPPORT_I2D)
-       {
-               ICMD_I2D,
-               0,
-               BUILTIN_i2d,
-               NULL,
-               NULL,
-               "i2d",
-               "(I)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F)
-       {
-               ICMD_L2F,
-               0,
-               BUILTIN_l2f,
-               NULL,
-               NULL,
-               "l2f",
-               "(J)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D)
-       {
-               ICMD_L2D,
-               0,
-               BUILTIN_l2d,
-               NULL,
-               NULL,
-               "l2d",
-               "(J)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_FLOAT && SUPPORT_F2I)
-       {
-               ICMD_F2I,
-               0,
-               BUILTIN_f2i,
-               NULL,
-               NULL,
-               "f2i",
-               "(F)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L)
-       {
-               ICMD_F2L,
-               0,
-               BUILTIN_f2l,
-               NULL,
-               NULL,
-               "f2l",
-               "(F)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_DOUBLE && SUPPORT_D2I)
-       {
-               ICMD_D2I,
-               0,
-               BUILTIN_d2i,
-               NULL,
-               NULL,
-               "d2i",
-               "(D)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-#if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L)
-       {
-               ICMD_D2L,
-               0,
-               BUILTIN_d2l,
-               NULL,
-               NULL,
-               "d2l",
-               "(D)J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-
-       /* float functions ********************************************************/
-
-#if !SUPPORT_FLOAT
-       {
-               ICMD_FADD,
-               0,
-               BUILTIN_fadd,
-               NULL,
-               NULL,
-               "fadd",
-               "(FF)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_FSUB,
-               0,
-               BUILTIN_fsub,
-               NULL,
-               NULL,
-               "fsub",
-               "(FF)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_FMUL,
-               0,
-               BUILTIN_fmul,
-               NULL,
-               NULL,
-               "fmul",
-               "(FF)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_FDIV,
-               0,
-               BUILTIN_fdiv,
-               NULL,
-               NULL,
-               "fdiv",
-               "(FF)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_FNEG,
-               0,
-               BUILTIN_fneg,
-               NULL,
-               NULL,
-               "fneg",
-               "(F)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !SUPPORT_FLOAT */
-
-#if !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP
-       {
-               ICMD_FCMPL,
-               0,
-               BUILTIN_fcmpl,
-               NULL,
-               NULL,
-               "fcmpl",
-               "(FF)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_FCMPG,
-               0,
-               BUILTIN_fcmpg,
-               NULL,
-               NULL,
-               "fcmpg",
-               "(FF)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP */
-
-
-       /* double functions *******************************************************/
-
-#if !SUPPORT_DOUBLE
-       {
-               ICMD_DADD,
-               0,
-               BUILTIN_dadd,
-               NULL,
-               NULL,
-               "dadd",
-               "(DD)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_DSUB,
-               0,
-               BUILTIN_dsub,
-               NULL,
-               NULL,
-               "dsub",
-               "(DD)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_DMUL,
-               0,
-               BUILTIN_dmul,
-               NULL,
-               NULL,
-               "dmul",
-               "(DD)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_DDIV,
-               0,
-               BUILTIN_ddiv,
-               NULL,
-               NULL,
-               "ddiv",
-               "(DD)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_DNEG,
-               0,
-               BUILTIN_dneg,
-               NULL,
-               NULL,
-               "dneg",
-               "(D)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !SUPPORT_DOUBLE */
-
-#if !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP
-       {
-               ICMD_DCMPL,
-               0,
-               BUILTIN_dcmpl,
-               NULL,
-               NULL,
-               "dcmpl",
-               "(DD)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_DCMPG,
-               0,
-               BUILTIN_dcmpg,
-               NULL,
-               NULL,
-               "dcmpg",
-               "(DD)I",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP */
-
-
-       /* float/double functions *************************************************/
-
-#if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
-       {
-               ICMD_F2D,
-               0,
-               BUILTIN_f2d,
-               NULL,
-               NULL,
-               "f2d",
-               "(F)D",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-       {
-               ICMD_D2F,
-               0,
-               BUILTIN_d2f,
-               NULL,
-               NULL,
-               "d2f",
-               "(D)F",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
-
-
-       /* prevent a compiler warning if everything is supported (e.g. i386) */
-
-       {
-               255,
-               0,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-};
-
-
-/* automatically replaced functions *******************************************/
-
-static builtintable_entry builtintable_function[] = {
-#if defined(ENABLE_JIT)
-
-       /* java.lang.VMSystem.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V STATIC NATIVE */
-
-       {
-               ICMD_BUILTIN,
-               BUILTINTABLE_FLAG_STUB | BUILTINTABLE_FLAG_EXCEPTION,
-               BUILTIN_arraycopy,
-               NULL,
-               "java/lang/VMSystem",
-               "arraycopy",
-               "(Ljava/lang/Object;ILjava/lang/Object;II)V",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-
-       /* java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V PUBLIC STATIC */
-
-#if 0
-       /* We disable this one until we have a fix for the stacktrace
-          issue. */
-
-       {
-               ICMD_BUILTIN,
-               BUILTINTABLE_FLAG_STUB | BUILTINTABLE_FLAG_EXCEPTION,
-               BUILTIN_arraycopy,
-               NULL,
-               "java/lang/System",
-               "arraycopy",
-               "(Ljava/lang/Object;ILjava/lang/Object;II)V",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-#endif
-
-       /* java.lang.VMSystem.currentTimeMillis()J PUBLIC STATIC */
-
-       {
-               ICMD_BUILTIN,
-               0,
-               BUILTIN_currenttimemillis,
-               NULL,
-               "java/lang/VMSystem",
-               "currentTimeMillis",
-               "()J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-
-       /* java.lang.System.currentTimeMillis()J PUBLIC STATIC */
-
-       {
-               ICMD_BUILTIN,
-               0,
-               BUILTIN_currenttimemillis,
-               NULL,
-               "java/lang/System",
-               "currentTimeMillis",
-               "()J",
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-
-#endif /* defined(ENABLE_JIT) */
-
-       /* stop entry */
-
-       {
-               255,
-               0,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL
-       },
-};
-
-
-/*
- * 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 8000fa5546802bf1608a39dcf4a3c3b36f061b37..6f6d8e94ab5b993b0e2ee936af05c0cc59c1a47a 100644 (file)
@@ -44,7 +44,7 @@
 #include "toolbox/logging.h"
 
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/classcache.h"
 #include "vm/exceptions.hpp"
index a8b5ddb87a98be418ca2f1f640577169d1dfbfde..fcfe94d30f1472e9f7ddb5e9f44f4227e97f6c9f 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "toolbox/util.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index a304f31a070c59f8ccb2f5e5cd25533076185358..19f92b54e55779949973383269d5441d81108491 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "vm/annotation.h"
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/descriptor.h"
 #include "vm/exceptions.hpp"
index 270d7eb46fbc8120b0f14387f6bc047aa871abb4..b96743ed40a4c6a4629cf8b386ef2d408c011652 100644 (file)
@@ -34,7 +34,7 @@
 #include "threads/lock-common.h"
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/options.h"
index 82d9a749e72b762cbb241cc90813a143793ec0ff..320c5b94dec782a730cd7e86ecccf365c2671520 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index 904063fa7089677b3a58187fb1110e72367cf0b6..cc82bdc6e9a79f7659f784438b60bc216f64b8e1 100644 (file)
@@ -29,7 +29,7 @@
 #include "native/vm/reflection.hpp"
 
 #include "vm/access.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
 #include "vm/initialize.h"
index 50ed6d5051e81daf45f4e19c252c3a699721bdf0..3e9b34e4cc862b79cea5da263eb64b9d190c60f7 100644 (file)
@@ -150,6 +150,9 @@ noinst_LTLIBRARIES = \
 libjit_la_SOURCES = \
        argument.c \
        argument.h \
+       builtin.cpp \
+       builtin.hpp \
+       builtintable.inc \
        code.c \
        code.h \
        codegen-common.c \
index e91ff170d99ed6b83439b3121abbdadae9af5423..0b638f2bb0b2fb1ff6a250a509acebb790edc86d 100644 (file)
@@ -35,7 +35,7 @@
 #include "toolbox/logging.h"
 #include "toolbox/worklist.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/method.h"
index d8b122157b698e4ea4b458186e51342ca0c10e14..83b64c81c00b3578b2b06e9ab60cf490fb76b8c5 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/resolve.h"
 #include "vm/options.h"
index d8ccdfa092731464d45867a3a78bc38760371f51..ba7b565d47c8776d8822e566a1140ba4e8c81b0e 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "mm/memory.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/method.h"
 #include "vm/options.h"
index f176d8bba03802e8d1435e4964db4c60812a1d01..9726a4fb8a4a609694f9556e9fae022174b5b4e3 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 50bde44f44c1e9781fdd5754c40d76c0285cb510..bb5d17bbe57721e66a2c2edcc6389d6f4c1df713 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 #include "vm/os.hpp"
 
index 41006bdaf5f84154563e5c240e7082feb0789ccf..9af3e4449eb4bfb4d487aaeb46ea94e9a2fb9b8b 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 7d9bf2fd7b9cc286b513eb807e1e73b20049d3d4..b6346bb78fdd64fa3f9fda96526ea1ceef274f8d 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 1b0e9929ed824d3f0c5cbcf5b75b71d01502f650..2357374c586f8e1d4bf19b733b312f5a1992caa9 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
diff --git a/src/vm/jit/builtin.cpp b/src/vm/jit/builtin.cpp
new file mode 100644 (file)
index 0000000..61c5251
--- /dev/null
@@ -0,0 +1,2439 @@
+/* src/vm/jit/builtin.cpp - functions for unsupported operations
+
+   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.
+
+   Contains C functions for JavaVM Instructions that cannot be
+   translated to machine language directly. Consequently, the
+   generated machine code for these instructions contains function
+   calls instead of machine instructions, using the C calling
+   convention.
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "vm/types.h"
+
+#include "arch.h"
+#include "md-abi.h"
+
+#include "fdlibm/fdlibm.h"
+#if defined(__CYGWIN__) && defined(Bias)
+# undef Bias
+#endif
+
+#include "mm/gc.hpp"
+#include "mm/memory.h"
+
+#include "native/llni.h"
+
+#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
+#include "threads/thread.hpp"
+
+#include "toolbox/logging.h"
+#include "toolbox/util.h"
+
+#include "vm/array.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.h"
+#include "vm/cycles-stats.h"
+#include "vm/exceptions.hpp"
+#include "vm/global.h"
+#include "vm/globals.hpp"
+#include "vm/initialize.h"
+#include "vm/linker.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/primitive.hpp"
+#include "vm/rt-timing.h"
+#include "vm/string.hpp"
+
+#include "vm/jit/asmpart.h"
+#include "vm/jit/stubs.hpp"
+#include "vm/jit/trace.hpp"
+
+#if defined(ENABLE_VMLOG)
+#include <vmlog_cacao.h>
+#endif
+
+
+/* include builtin tables *****************************************************/
+
+#include "vm/jit/builtintable.inc"
+
+
+CYCLES_STATS_DECLARE(builtin_new         ,100,5)
+CYCLES_STATS_DECLARE(builtin_overhead    , 80,1)
+
+
+/*============================================================================*/
+/* BUILTIN TABLE MANAGEMENT FUNCTIONS                                         */
+/*============================================================================*/
+
+/* builtintable_init ***********************************************************
+
+   Parse the descriptors of builtin functions and create the parsed
+   descriptors.
+
+*******************************************************************************/
+
+static bool builtintable_init(void)
+{
+       descriptor_pool    *descpool;
+       builtintable_entry *bte;
+       methodinfo         *m;
+       int32_t             dumpmarker;
+
+       /* mark start of dump memory area */
+
+       DMARKER;
+
+       /* create a new descriptor pool */
+
+       descpool = descriptor_pool_new(class_java_lang_Object);
+
+       /* add some entries we need */
+
+       if (!descriptor_pool_add_class(descpool, utf_java_lang_Object))
+               return false;
+
+       if (!descriptor_pool_add_class(descpool, utf_java_lang_Class))
+               return false;
+
+       /* first add all descriptors to the pool */
+
+       for (bte = builtintable_internal; bte->fp != NULL; bte++) {
+               bte->name       = utf_new_char(bte->cname);
+               bte->descriptor = utf_new_char(bte->cdescriptor);
+
+               if (!descriptor_pool_add(descpool, bte->descriptor, NULL)) {
+                       /* release dump area */
+
+                       DRELEASE;
+
+                       return false;
+               }
+       }
+
+       for (bte = builtintable_automatic; bte->fp != NULL; bte++) {
+               bte->descriptor = utf_new_char(bte->cdescriptor);
+
+               if (!descriptor_pool_add(descpool, bte->descriptor, NULL)) {
+                       DRELEASE;
+                       return false;
+               }
+       }
+
+       for (bte = builtintable_function; bte->fp != NULL; bte++) {
+               bte->classname  = utf_new_char(bte->cclassname);
+               bte->name       = utf_new_char(bte->cname);
+               bte->descriptor = utf_new_char(bte->cdescriptor);
+
+               if (!descriptor_pool_add(descpool, bte->descriptor, NULL)) {
+                       DRELEASE;
+                       return false;
+               }
+       }
+
+       /* create the class reference table */
+
+       (void) descriptor_pool_create_classrefs(descpool, NULL);
+
+       /* allocate space for the parsed descriptors */
+
+       descriptor_pool_alloc_parsed_descriptors(descpool);
+
+       /* Now parse all descriptors.  NOTE: builtin-functions are treated
+          like static methods (no `this' pointer). */
+
+       for (bte = builtintable_internal; bte->fp != NULL; bte++) {
+               bte->md =
+                       descriptor_pool_parse_method_descriptor(descpool,
+                                                                                                       bte->descriptor,
+                                                                                                       ACC_STATIC | ACC_METHOD_BUILTIN,
+                                                                                                       NULL);
+
+               /* generate a builtin stub if we need one */
+
+               if (bte->flags & BUILTINTABLE_FLAG_STUB) {
+                       m = method_new_builtin(bte);
+                       BuiltinStub::generate(m, bte);
+               }
+       }
+
+       for (bte = builtintable_automatic; bte->fp != NULL; bte++) {
+               bte->md =
+                       descriptor_pool_parse_method_descriptor(descpool,
+                                                                                                       bte->descriptor,
+                                                                                                       ACC_STATIC | ACC_METHOD_BUILTIN,
+                                                                                                       NULL);
+
+               /* no stubs should be needed for this table */
+
+               assert(!bte->flags & BUILTINTABLE_FLAG_STUB);
+       }
+
+       for (bte = builtintable_function; bte->fp != NULL; bte++) {
+               bte->md =
+                       descriptor_pool_parse_method_descriptor(descpool,
+                                                                                                       bte->descriptor,
+                                                                                                       ACC_STATIC | ACC_METHOD_BUILTIN,
+                                                                                                       NULL);
+
+               /* generate a builtin stub if we need one */
+
+               if (bte->flags & BUILTINTABLE_FLAG_STUB) {
+                       m = method_new_builtin(bte);
+                       BuiltinStub::generate(m, bte);
+               }
+       }
+
+       /* release dump area */
+
+       DRELEASE;
+
+       return true;
+}
+
+
+/* builtintable_comparator *****************************************************
+
+   qsort comparator for the automatic builtin table.
+
+*******************************************************************************/
+
+static int builtintable_comparator(const void *a, const void *b)
+{
+       builtintable_entry *bte1;
+       builtintable_entry *bte2;
+
+       bte1 = (builtintable_entry *) a;
+       bte2 = (builtintable_entry *) b;
+
+       return (bte1->opcode < bte2->opcode) ? -1 : (bte1->opcode > bte2->opcode);
+}
+
+
+/* builtintable_sort_automatic *************************************************
+
+   Sorts the automatic builtin table.
+
+*******************************************************************************/
+
+static void builtintable_sort_automatic(void)
+{
+       s4 entries;
+
+       /* calculate table size statically (`- 1' comment see builtintable.inc) */
+
+       entries = sizeof(builtintable_automatic) / sizeof(builtintable_entry) - 1;
+
+       qsort(builtintable_automatic, entries, sizeof(builtintable_entry),
+                 builtintable_comparator);
+}
+
+
+/* builtin_init ****************************************************************
+
+   Initialize the global table of builtin functions.
+
+*******************************************************************************/
+
+bool builtin_init(void)
+{
+       TRACESUBSYSTEMINITIALIZATION("builtin_init");
+
+       /* initialize the builtin tables */
+
+       if (!builtintable_init())
+               return false;
+
+       /* sort builtin tables */
+
+       builtintable_sort_automatic();
+
+       return true;
+}
+
+
+/* builtintable_get_internal ***************************************************
+
+   Finds an entry in the builtintable for internal functions and
+   returns the a pointer to the structure.
+
+*******************************************************************************/
+
+builtintable_entry *builtintable_get_internal(functionptr fp)
+{
+       builtintable_entry *bte;
+
+       for (bte = builtintable_internal; bte->fp != NULL; bte++) {
+               if (bte->fp == fp)
+                       return bte;
+       }
+
+       return NULL;
+}
+
+
+/* builtintable_get_automatic **************************************************
+
+   Finds an entry in the builtintable for functions which are replaced
+   automatically and returns the a pointer to the structure.
+
+*******************************************************************************/
+
+builtintable_entry *builtintable_get_automatic(s4 opcode)
+{
+       builtintable_entry *first;
+       builtintable_entry *last;
+       builtintable_entry *middle;
+       s4                  half;
+       s4                  entries;
+
+       /* calculate table size statically (`- 1' comment see builtintable.inc) */
+
+       entries = sizeof(builtintable_automatic) / sizeof(builtintable_entry) - 1;
+
+       first = builtintable_automatic;
+       last = builtintable_automatic + entries;
+
+       while (entries > 0) {
+               half = entries / 2;
+               middle = first + half;
+
+               if (middle->opcode < opcode) {
+                       first = middle + 1;
+                       entries -= half + 1;
+               }
+               else
+                       entries = half;
+       }
+
+       return (first != last ? first : NULL);
+}
+
+
+/* builtintable_replace_function ***********************************************
+
+   XXX
+
+*******************************************************************************/
+
+#if defined(ENABLE_JIT)
+bool builtintable_replace_function(void *iptr_)
+{
+       constant_FMIref    *mr;
+       builtintable_entry *bte;
+       instruction        *iptr;
+
+       iptr = (instruction *) iptr_; /* twisti will kill me ;) */
+
+       /* get name and descriptor of the function */
+
+       switch (iptr->opc) {
+       case ICMD_INVOKESTATIC:
+               /* The instruction MUST be resolved, otherwise we run into
+                  lazy loading troubles.  Anyway, we should/can only replace
+                  very VM-close functions. */
+
+               if (INSTRUCTION_IS_UNRESOLVED(iptr))
+                       return false;
+
+               mr = iptr->sx.s23.s3.fmiref;
+               break;  
+
+       default:
+               return false;
+       }
+
+       /* search the function table */
+
+       for (bte = builtintable_function; bte->fp != NULL; bte++) {
+               if ((METHODREF_CLASSNAME(mr) == bte->classname) &&
+                       (mr->name                == bte->name) &&
+                       (mr->descriptor          == bte->descriptor)) {
+
+                       /* set the values in the instruction */
+
+                       iptr->opc           = bte->opcode;
+                       iptr->sx.s23.s3.bte = bte;
+
+                       if (bte->flags & BUILTINTABLE_FLAG_EXCEPTION)
+                               iptr->flags.bits |= INS_FLAG_CHECK;
+                       else
+                               iptr->flags.bits &= ~INS_FLAG_CHECK;
+
+                       return true;
+               }
+       }
+
+       return false;
+}
+#endif /* defined(ENABLE_JIT) */
+
+
+/*============================================================================*/
+/* INTERNAL BUILTIN FUNCTIONS                                                 */
+/*============================================================================*/
+
+/* builtin_instanceof **********************************************************
+
+   Checks if an object is an instance of some given class (or subclass
+   of that class). If class is an interface, checks if the interface
+   is implemented.
+
+   RETURN VALUE:
+     1......o is an instance of class or implements the interface
+     0......otherwise or if o == NULL
+
+   NOTE: This builtin can be called from NATIVE code only.
+
+*******************************************************************************/
+
+bool builtin_instanceof(java_handle_t *o, classinfo *c)
+{
+       classinfo *oc;
+
+       if (o == NULL)
+               return 0;
+
+       LLNI_class_get(o, oc);
+
+       return class_isanysubclass(oc, c);
+}
+
+
+
+/* builtin_checkcast ***********************************************************
+
+   The same as builtin_instanceof but with the exception
+   that 1 is returned when (o == NULL).
+
+   NOTE: This builtin can be called from NATIVE code only.
+
+*******************************************************************************/
+
+bool builtin_checkcast(java_handle_t *o, classinfo *c)
+{
+       classinfo *oc;
+
+       if (o == NULL)
+               return 1;
+
+       LLNI_class_get(o, oc);
+
+       if (class_isanysubclass(oc, c))
+               return 1;
+
+       return 0;
+}
+
+
+/* builtin_descriptorscompatible ***********************************************
+
+   Checks if two array type descriptors are assignment compatible.
+
+   RETURN VALUE:
+      1......target = desc is possible
+      0......otherwise
+                       
+*******************************************************************************/
+
+static bool builtin_descriptorscompatible(arraydescriptor *desc, arraydescriptor *target)
+{
+       if (desc == target)
+               return 1;
+
+       if (desc->arraytype != target->arraytype)
+               return 0;
+
+       if (desc->arraytype != ARRAYTYPE_OBJECT)
+               return 1;
+       
+       /* {both arrays are arrays of references} */
+
+       if (desc->dimension == target->dimension) {
+               if (!desc->elementvftbl)
+                       return 0;
+               /* an array which contains elements of interface types is
+           allowed to be casted to Object (JOWENN)*/
+
+               if ((desc->elementvftbl->baseval < 0) &&
+                       (target->elementvftbl->baseval == 1))
+                       return 1;
+
+               return class_isanysubclass(desc->elementvftbl->clazz,
+                                                                  target->elementvftbl->clazz);
+       }
+
+       if (desc->dimension < target->dimension)
+               return 0;
+
+       /* {desc has higher dimension than target} */
+
+       return class_isanysubclass(pseudo_class_Arraystub,
+                                                          target->elementvftbl->clazz);
+}
+
+
+/* builtin_arraycheckcast ******************************************************
+
+   Checks if an object is really a subtype of the requested array
+   type.  The object has to be an array to begin with. For simple
+   arrays (int, short, double, etc.) the types have to match exactly.
+   For arrays of objects, the type of elements in the array has to be
+   a subtype (or the same type) of the requested element type. For
+   arrays of arrays (which in turn can again be arrays of arrays), the
+   types at the lowest level have to satisfy the corresponding sub
+   class relation.
+
+   NOTE: This is a FAST builtin and can be called from JIT code only.
+
+*******************************************************************************/
+
+bool builtin_fast_arraycheckcast(java_object_t *o, classinfo *targetclass)
+{
+       arraydescriptor *desc;
+
+       if (o == NULL)
+               return 1;
+
+       desc = o->vftbl->arraydesc;
+
+       if (desc == NULL)
+               return 0;
+       return builtin_descriptorscompatible(desc, targetclass->vftbl->arraydesc);
+}
+
+
+/* builtin_fast_arrayinstanceof ************************************************
+
+   NOTE: This is a FAST builtin and can be called from JIT code only.
+
+*******************************************************************************/
+
+bool builtin_fast_arrayinstanceof(java_object_t *o, classinfo *targetclass)
+{
+       if (o == NULL)
+               return 0;
+
+       return builtin_fast_arraycheckcast(o, targetclass);
+}
+
+
+/* builtin_arrayinstanceof *****************************************************
+
+   NOTE: This builtin can be called from NATIVE code only.
+
+*******************************************************************************/
+
+bool builtin_arrayinstanceof(java_handle_t *h, classinfo *targetclass)
+{
+       bool result;
+
+       LLNI_CRITICAL_START;
+
+       result = builtin_fast_arrayinstanceof(LLNI_UNWRAP(h), targetclass);
+
+       LLNI_CRITICAL_END;
+
+       return result;
+}
+
+
+/* builtin_throw_exception *****************************************************
+
+   Sets the exception pointer with the thrown exception and prints some
+   debugging information.
+   
+   NOTE: This is a FAST builtin and can be called from JIT code,
+   or from asm_vm_call_method.
+
+*******************************************************************************/
+
+void *builtin_throw_exception(java_object_t *xptr)
+{
+#if !defined(NDEBUG)
+       /* print exception trace */
+
+       if (opt_TraceExceptions)
+               trace_exception_builtin(xptr);
+#endif /* !defined(NDEBUG) */
+
+       /* actually set the exception */
+
+       exceptions_set_exception(LLNI_QUICKWRAP(xptr));
+
+       /* Return a NULL pointer.  This is required for vm_call_method to
+          check for an exception.  This is for convenience. */
+
+       return NULL;
+}
+
+
+/* builtin_retrieve_exception **************************************************
+
+   Gets and clears the exception pointer of the current thread.
+
+   RETURN VALUE:
+      the exception object, or NULL if no exception was thrown.
+
+   NOTE: This is a FAST builtin and can be called from JIT code,
+   or from the signal handlers.
+
+*******************************************************************************/
+
+java_object_t *builtin_retrieve_exception(void)
+{
+       java_handle_t *h;
+       java_object_t *o;
+
+       /* actually get and clear the exception */
+
+       h = exceptions_get_and_clear_exception();
+       o = LLNI_UNWRAP(h);
+
+       return o;
+}
+
+
+/* builtin_canstore ************************************************************
+
+   Checks, if an object can be stored in an array.
+
+   RETURN VALUE:
+      1......possible
+      0......otherwise (throws an ArrayStoreException)
+
+   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
+
+*******************************************************************************/
+
+bool builtin_canstore(java_handle_objectarray_t *oa, java_handle_t *o)
+{
+       bool result;
+
+       LLNI_CRITICAL_START;
+
+       result = builtin_fast_canstore(LLNI_DIRECT(oa), LLNI_UNWRAP(o));
+
+       LLNI_CRITICAL_END;
+
+       /* if not possible, throw an exception */
+
+       if (result == 0)
+               exceptions_throw_arraystoreexception();
+
+       return result;
+}
+
+
+/* builtin_fast_canstore *******************************************************
+
+   Checks, if an object can be stored in an array.
+
+   RETURN VALUE:
+      1......possible
+      0......otherwise (no exception thrown!)
+
+   NOTE: This is a FAST builtin and can be called from JIT code only.
+
+*******************************************************************************/
+
+bool builtin_fast_canstore(java_objectarray_t *oa, java_object_t *o)
+{
+       arraydescriptor *desc;
+       arraydescriptor *valuedesc;
+       vftbl_t         *componentvftbl;
+       vftbl_t         *valuevftbl;
+       int32_t          baseval;
+       uint32_t         diffval;
+       bool             result;
+
+       if (o == NULL)
+               return 1;
+
+       /* The following is guaranteed (by verifier checks):
+        *
+        *     *) oa->...vftbl->arraydesc != NULL
+        *     *) oa->...vftbl->arraydesc->componentvftbl != NULL
+        *     *) o->vftbl is not an interface vftbl
+        */
+
+       desc           = oa->header.objheader.vftbl->arraydesc;
+       componentvftbl = desc->componentvftbl;
+       valuevftbl     = o->vftbl;
+       valuedesc      = valuevftbl->arraydesc;
+
+       if ((desc->dimension - 1) == 0) {
+               /* {oa is a one-dimensional array} */
+               /* {oa is an array of references} */
+               
+               if (valuevftbl == componentvftbl)
+                       return 1;
+
+               linker_classrenumber_mutex->lock();
+
+               baseval = componentvftbl->baseval;
+
+               if (baseval <= 0) {
+                       /* an array of interface references */
+
+                       result = ((valuevftbl->interfacetablelength > -baseval) &&
+                                         (valuevftbl->interfacetable[baseval] != NULL));
+               }
+               else {
+                       diffval = valuevftbl->baseval - componentvftbl->baseval;
+                       result  = diffval <= (uint32_t) componentvftbl->diffval;
+               }
+
+               linker_classrenumber_mutex->unlock();
+       }
+       else if (valuedesc == NULL) {
+               /* {oa has dimension > 1} */
+               /* {componentvftbl->arraydesc != NULL} */
+
+               /* check if o is an array */
+
+               return 0;
+       }
+       else {
+               /* {o is an array} */
+
+               result = builtin_descriptorscompatible(valuedesc, componentvftbl->arraydesc);
+       }
+
+       /* return result */
+
+       return result;
+}
+
+
+/* This is an optimized version where a is guaranteed to be one-dimensional */
+bool builtin_fast_canstore_onedim(java_objectarray_t *a, java_object_t *o)
+{
+       arraydescriptor *desc;
+       vftbl_t         *elementvftbl;
+       vftbl_t         *valuevftbl;
+       int32_t          baseval;
+       uint32_t         diffval;
+       bool             result;
+       
+       if (o == NULL)
+               return 1;
+
+       /* The following is guaranteed (by verifier checks):
+        *
+        *     *) a->...vftbl->arraydesc != NULL
+        *     *) a->...vftbl->arraydesc->elementvftbl != NULL
+        *     *) a->...vftbl->arraydesc->dimension == 1
+        *     *) o->vftbl is not an interface vftbl
+        */
+
+       desc = a->header.objheader.vftbl->arraydesc;
+    elementvftbl = desc->elementvftbl;
+       valuevftbl = o->vftbl;
+
+       /* {a is a one-dimensional array} */
+       
+       if (valuevftbl == elementvftbl)
+               return 1;
+
+       linker_classrenumber_mutex->lock();
+
+       baseval = elementvftbl->baseval;
+
+       if (baseval <= 0) {
+               /* an array of interface references */
+               result = ((valuevftbl->interfacetablelength > -baseval) &&
+                                 (valuevftbl->interfacetable[baseval] != NULL));
+       }
+       else {
+               diffval = valuevftbl->baseval - elementvftbl->baseval;
+               result  = diffval <= (uint32_t) elementvftbl->diffval;
+       }
+
+       linker_classrenumber_mutex->unlock();
+
+       return result;
+}
+
+
+/* This is an optimized version where a is guaranteed to be a
+ * one-dimensional array of a class type */
+bool builtin_fast_canstore_onedim_class(java_objectarray_t *a, java_object_t *o)
+{
+       vftbl_t  *elementvftbl;
+       vftbl_t  *valuevftbl;
+       uint32_t  diffval;
+       bool      result;
+       
+       if (o == NULL)
+               return 1;
+
+       /* The following is guaranteed (by verifier checks):
+        *
+        *     *) a->...vftbl->arraydesc != NULL
+        *     *) a->...vftbl->arraydesc->elementvftbl != NULL
+        *     *) a->...vftbl->arraydesc->elementvftbl is not an interface vftbl
+        *     *) a->...vftbl->arraydesc->dimension == 1
+        *     *) o->vftbl is not an interface vftbl
+        */
+
+    elementvftbl = a->header.objheader.vftbl->arraydesc->elementvftbl;
+       valuevftbl = o->vftbl;
+
+       /* {a is a one-dimensional array} */
+       
+       if (valuevftbl == elementvftbl)
+               return 1;
+
+       linker_classrenumber_mutex->lock();
+
+       diffval = valuevftbl->baseval - elementvftbl->baseval;
+       result  = diffval <= (uint32_t) elementvftbl->diffval;
+
+       linker_classrenumber_mutex->unlock();
+
+       return result;
+}
+
+
+/* builtin_new *****************************************************************
+
+   Creates a new instance of class c on the heap.
+
+   RETURN VALUE:
+      pointer to the object, or NULL if no memory is available
+
+   NOTE: This builtin can be called from NATIVE code only.
+
+*******************************************************************************/
+
+java_handle_t *builtin_new(classinfo *c)
+{
+       java_handle_t *o;
+#if defined(ENABLE_RT_TIMING)
+       struct timespec time_start, time_end;
+#endif
+#if defined(ENABLE_CYCLES_STATS)
+       u8 cycles_start, cycles_end;
+#endif
+
+       RT_TIMING_GET_TIME(time_start);
+       CYCLES_STATS_GET(cycles_start);
+
+       /* is the class loaded */
+
+       assert(c->state & CLASS_LOADED);
+
+       /* check if we can instantiate this class */
+
+       if (c->flags & ACC_ABSTRACT) {
+               exceptions_throw_instantiationerror(c);
+               return NULL;
+       }
+
+       /* is the class linked */
+
+       if (!(c->state & CLASS_LINKED))
+               if (!link_class(c))
+                       return NULL;
+
+       if (!(c->state & CLASS_INITIALIZED)) {
+#if !defined(NDEBUG)
+               if (initverbose)
+                       log_message_class("Initialize class (from builtin_new): ", c);
+#endif
+
+               if (!initialize_class(c))
+                       return NULL;
+       }
+
+       o = (java_handle_t*) heap_alloc(c->instancesize, c->flags & ACC_CLASS_HAS_POINTERS,
+                                                                       c->finalizer, true);
+
+       if (!o)
+               return NULL;
+
+#if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
+       /* XXX this is only a dirty hack to make Boehm work with handles */
+
+       o = LLNI_WRAP((java_object_t *) o);
+#endif
+
+       LLNI_vftbl_direct(o) = c->vftbl;
+
+#if defined(ENABLE_THREADS)
+       lock_init_object_lock(LLNI_DIRECT(o));
+#endif
+
+       CYCLES_STATS_GET(cycles_end);
+       RT_TIMING_GET_TIME(time_end);
+
+       CYCLES_STATS_COUNT(builtin_new,cycles_end - cycles_start);
+       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_OBJECT);
+
+       return o;
+}
+
+#if defined(ENABLE_ESCAPE_REASON)
+java_handle_t *builtin_escape_reason_new(classinfo *c) {
+       print_escape_reasons();
+       return builtin_java_new(c);
+}
+#endif
+
+#if defined(ENABLE_TLH)
+java_handle_t *builtin_tlh_new(classinfo *c)
+{
+       java_handle_t *o;
+# if defined(ENABLE_RT_TIMING)
+       struct timespec time_start, time_end;
+# endif
+# if defined(ENABLE_CYCLES_STATS)
+       u8 cycles_start, cycles_end;
+# endif
+
+       RT_TIMING_GET_TIME(time_start);
+       CYCLES_STATS_GET(cycles_start);
+
+       /* is the class loaded */
+
+       assert(c->state & CLASS_LOADED);
+
+       /* check if we can instantiate this class */
+
+       if (c->flags & ACC_ABSTRACT) {
+               exceptions_throw_instantiationerror(c);
+               return NULL;
+       }
+
+       /* is the class linked */
+
+       if (!(c->state & CLASS_LINKED))
+               if (!link_class(c))
+                       return NULL;
+
+       if (!(c->state & CLASS_INITIALIZED)) {
+# if !defined(NDEBUG)
+               if (initverbose)
+                       log_message_class("Initialize class (from builtin_new): ", c);
+# endif
+
+               if (!initialize_class(c))
+                       return NULL;
+       }
+
+       /*
+       o = tlh_alloc(&(THREADOBJECT->tlh), c->instancesize);
+       */
+       o = NULL;
+
+       if (o == NULL) {
+               o = (java_handle_t*) heap_alloc(c->instancesize, c->flags & ACC_CLASS_HAS_POINTERS,
+                                                                               c->finalizer, true);
+       }
+
+       if (!o)
+               return NULL;
+
+# if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
+       /* XXX this is only a dirty hack to make Boehm work with handles */
+
+       o = LLNI_WRAP((java_object_t *) o);
+# endif
+
+       LLNI_vftbl_direct(o) = c->vftbl;
+
+# if defined(ENABLE_THREADS)
+       lock_init_object_lock(LLNI_DIRECT(o));
+# endif
+
+       CYCLES_STATS_GET(cycles_end);
+       RT_TIMING_GET_TIME(time_end);
+
+/*
+       CYCLES_STATS_COUNT(builtin_new,cycles_end - cycles_start);
+       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_OBJECT);
+*/
+
+       return o;
+}
+#endif
+
+
+/* builtin_java_new ************************************************************
+
+   NOTE: This is a SLOW builtin and can be called from JIT code only.
+
+*******************************************************************************/
+
+java_handle_t *builtin_java_new(java_handle_t *clazz)
+{
+       return builtin_new(LLNI_classinfo_unwrap(clazz));
+}
+
+
+/* builtin_fast_new ************************************************************
+
+   Creates a new instance of class c on the heap.
+
+   RETURN VALUE:
+      pointer to the object, or NULL if no fast return
+      is possible for any reason.
+
+   NOTE: This is a FAST builtin and can be called from JIT code only.
+
+*******************************************************************************/
+
+java_object_t *builtin_fast_new(classinfo *c)
+{
+       java_object_t *o;
+#if defined(ENABLE_RT_TIMING)
+       struct timespec time_start, time_end;
+#endif
+#if defined(ENABLE_CYCLES_STATS)
+       u8 cycles_start, cycles_end;
+#endif
+
+       RT_TIMING_GET_TIME(time_start);
+       CYCLES_STATS_GET(cycles_start);
+
+       /* is the class loaded */
+
+       assert(c->state & CLASS_LOADED);
+
+       /* check if we can instantiate this class */
+
+       if (c->flags & ACC_ABSTRACT)
+               return NULL;
+
+       /* is the class linked */
+
+       if (!(c->state & CLASS_LINKED))
+               return NULL;
+
+       if (!(c->state & CLASS_INITIALIZED))
+               return NULL;
+
+       o = (java_handle_t*) heap_alloc(c->instancesize, c->flags & ACC_CLASS_HAS_POINTERS,
+                                                                       c->finalizer, false);
+
+       if (!o)
+               return NULL;
+
+       o->vftbl = c->vftbl;
+
+#if defined(ENABLE_THREADS)
+       lock_init_object_lock(o);
+#endif
+
+       CYCLES_STATS_GET(cycles_end);
+       RT_TIMING_GET_TIME(time_end);
+
+       CYCLES_STATS_COUNT(builtin_new,cycles_end - cycles_start);
+       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_OBJECT);
+
+       return o;
+}
+
+
+/* builtin_newarray ************************************************************
+
+   Creates an array with the given vftbl on the heap. This function
+   takes as class argument an array class.
+
+   RETURN VALUE:
+      pointer to the array or NULL if no memory is available
+
+   NOTE: This builtin can be called from NATIVE code only.
+
+*******************************************************************************/
+
+java_handle_t *builtin_newarray(int32_t size, classinfo *arrayclass)
+{
+       arraydescriptor *desc;
+       s4               dataoffset;
+       s4               componentsize;
+       s4               actualsize;
+       java_handle_t   *a;
+#if defined(ENABLE_RT_TIMING)
+       struct timespec time_start, time_end;
+#endif
+
+       RT_TIMING_GET_TIME(time_start);
+
+       desc          = arrayclass->vftbl->arraydesc;
+       dataoffset    = desc->dataoffset;
+       componentsize = desc->componentsize;
+
+       if (size < 0) {
+               exceptions_throw_negativearraysizeexception();
+               return NULL;
+       }
+
+       actualsize = dataoffset + size * componentsize;
+
+       /* check for overflow */
+
+       if (((u4) actualsize) < ((u4) size)) {
+               exceptions_throw_outofmemoryerror();
+               return NULL;
+       }
+
+       a = (java_handle_t*) heap_alloc(actualsize, (desc->arraytype == ARRAYTYPE_OBJECT), NULL, true);
+
+       if (a == NULL)
+               return NULL;
+
+#if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
+       /* XXX this is only a dirty hack to make Boehm work with handles */
+
+       a = LLNI_WRAP((java_object_t *) a);
+#endif
+
+       LLNI_vftbl_direct(a) = arrayclass->vftbl;
+
+#if defined(ENABLE_THREADS)
+       lock_init_object_lock(LLNI_DIRECT(a));
+#endif
+
+       LLNI_array_size(a) = size;
+
+       RT_TIMING_GET_TIME(time_end);
+       RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_NEW_ARRAY);
+
+       return a;
+}
+
+
+/* builtin_java_newarray *******************************************************
+
+   NOTE: This is a SLOW builtin and can be called from JIT code only.
+
+*******************************************************************************/
+
+java_handle_t *builtin_java_newarray(int32_t size, java_handle_t *arrayclazz)
+{
+       return builtin_newarray(size, LLNI_classinfo_unwrap(arrayclazz));
+}
+
+
+/* builtin_anewarray ***********************************************************
+
+   Creates an array of references to the given class type on the heap.
+
+   RETURN VALUE:
+      pointer to the array or NULL if no memory is
+      available
+
+   NOTE: This builtin can be called from NATIVE code only.
+
+*******************************************************************************/
+
+java_handle_objectarray_t *builtin_anewarray(int32_t size, classinfo *componentclass)
+{
+       classinfo *arrayclass;
+       
+       /* is class loaded */
+
+       assert(componentclass->state & CLASS_LOADED);
+
+       /* is class linked */
+
+       if (!(componentclass->state & CLASS_LINKED))
+               if (!link_class(componentclass))
+                       return NULL;
+
+       arrayclass = class_array_of(componentclass, true);
+
+       if (!arrayclass)
+               return NULL;
+
+       return (java_handle_objectarray_t *) builtin_newarray(size, arrayclass);
+}
+
+
+/* builtin_newarray_type ****************************************************
+
+   Creates an array of [type]s on the heap.
+       
+   RETURN VALUE:
+      pointer to the array or NULL if no memory is available
+
+   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
+
+*******************************************************************************/
+
+#define BUILTIN_NEWARRAY_TYPE(type, arraytype)                             \
+java_handle_##type##array_t *builtin_newarray_##type(int32_t size)              \
+{                                                                          \
+       return (java_handle_##type##array_t *)                                 \
+               builtin_newarray(size, primitivetype_table[arraytype].arrayclass); \
+}
+
+BUILTIN_NEWARRAY_TYPE(boolean, ARRAYTYPE_BOOLEAN)
+BUILTIN_NEWARRAY_TYPE(byte,    ARRAYTYPE_BYTE)
+BUILTIN_NEWARRAY_TYPE(char,    ARRAYTYPE_CHAR)
+BUILTIN_NEWARRAY_TYPE(short,   ARRAYTYPE_SHORT)
+BUILTIN_NEWARRAY_TYPE(int,     ARRAYTYPE_INT)
+BUILTIN_NEWARRAY_TYPE(long,    ARRAYTYPE_LONG)
+BUILTIN_NEWARRAY_TYPE(float,   ARRAYTYPE_FLOAT)
+BUILTIN_NEWARRAY_TYPE(double,  ARRAYTYPE_DOUBLE)
+
+
+/* builtin_multianewarray_intern ***********************************************
+
+   Creates a multi-dimensional array on the heap. The dimensions are
+   passed in an array of longs.
+
+   ARGUMENTS:
+      n.............number of dimensions to create
+      arrayclass....the array class
+      dims..........array containing the size of each dimension to create
+
+   RETURN VALUE:
+      pointer to the array or NULL if no memory is available
+
+******************************************************************************/
+
+static java_handle_t *builtin_multianewarray_intern(int n,
+                                                                                                       classinfo *arrayclass,
+                                                                                                       long *dims)
+{
+       s4             size;
+       java_handle_t *a;
+       classinfo     *componentclass;
+       s4             i;
+
+       /* create this dimension */
+
+       size = (s4) dims[0];
+       a = builtin_newarray(size, arrayclass);
+
+       if (!a)
+               return NULL;
+
+       /* if this is the last dimension return */
+
+       if (!--n)
+               return a;
+
+       /* get the class of the components to create */
+
+       componentclass = arrayclass->vftbl->arraydesc->componentvftbl->clazz;
+
+       /* The verifier guarantees that the dimension count is in the range. */
+
+       /* create the component arrays */
+
+       for (i = 0; i < size; i++) {
+               java_handle_t *ea =
+#if defined(__MIPS__) && (SIZEOF_VOID_P == 4)
+                       /* we save an s4 to a s8 slot, 8-byte aligned */
+
+                       builtin_multianewarray_intern(n, componentclass, dims + 2);
+#else
+                       builtin_multianewarray_intern(n, componentclass, dims + 1);
+#endif
+
+               if (!ea)
+                       return NULL;
+
+               array_objectarray_element_set((java_handle_objectarray_t *) a, i, ea);
+       }
+
+       return a;
+}
+
+
+/* builtin_multianewarray ******************************************************
+
+   Wrapper for builtin_multianewarray_intern which checks all
+   dimensions before we start allocating.
+
+   NOTE: This is a SLOW builtin and can be called from JIT code only.
+
+******************************************************************************/
+
+java_handle_objectarray_t *builtin_multianewarray(int n,
+                                                                                                 java_handle_t *arrayclazz,
+                                                                                                 long *dims)
+{
+       classinfo *c;
+       s4         i;
+       s4         size;
+
+       /* check all dimensions before doing anything */
+
+       for (i = 0; i < n; i++) {
+#if defined(__MIPS__) && (SIZEOF_VOID_P == 4)
+               /* we save an s4 to a s8 slot, 8-byte aligned */
+               size = (s4) dims[i * 2];
+#else
+               size = (s4) dims[i];
+#endif
+
+               if (size < 0) {
+                       exceptions_throw_negativearraysizeexception();
+                       return NULL;
+               }
+       }
+
+       c = LLNI_classinfo_unwrap(arrayclazz);
+
+       /* now call the real function */
+
+       return (java_handle_objectarray_t *)
+               builtin_multianewarray_intern(n, c, dims);
+}
+
+
+/* builtin_verbosecall_enter ***************************************************
+
+   Print method call with arguments for -verbose:call.
+
+   XXX: Remove mew once all archs use the new tracer!
+
+*******************************************************************************/
+
+#if !defined(NDEBUG)
+#ifdef TRACE_ARGS_NUM
+void builtin_verbosecall_enter(s8 a0, s8 a1,
+# if TRACE_ARGS_NUM >= 4
+                                                          s8 a2, s8 a3,
+# endif
+# if TRACE_ARGS_NUM >= 6
+                                                          s8 a4, s8 a5,
+# endif
+# if TRACE_ARGS_NUM == 8
+                                                          s8 a6, s8 a7,
+# endif
+                                                          methodinfo *m)
+{
+       log_text("builtin_verbosecall_enter: Do not call me anymore!");
+}
+#endif
+#endif /* !defined(NDEBUG) */
+
+
+/* builtin_verbosecall_exit ****************************************************
+
+   Print method exit for -verbose:call.
+
+   XXX: Remove mew once all archs use the new tracer!
+
+*******************************************************************************/
+
+#if !defined(NDEBUG)
+void builtin_verbosecall_exit(s8 l, double d, float f, methodinfo *m)
+{
+       log_text("builtin_verbosecall_exit: Do not call me anymore!");
+}
+#endif /* !defined(NDEBUG) */
+
+
+/*============================================================================*/
+/* MISCELLANEOUS MATHEMATICAL HELPER FUNCTIONS                                */
+/*============================================================================*/
+
+/*********** Functions for integer divisions *****************************
+       On some systems (eg. DEC ALPHA), integer division is not supported by the
+       CPU. These helper functions implement the missing functionality.
+
+******************************************************************************/
+
+#if !SUPPORT_DIVISION || defined(DISABLE_GC)
+s4 builtin_idiv(s4 a, s4 b)
+{
+       s4 c;
+
+       c = a / b;
+
+       return c;
+}
+
+s4 builtin_irem(s4 a, s4 b)
+{
+       s4 c;
+
+       c = a % b;
+
+       return c;
+}
+#endif /* !SUPPORT_DIVISION || defined(DISABLE_GC) */
+
+
+/* functions for long arithmetics **********************************************
+
+   On systems where 64 bit Integers are not supported by the CPU,
+   these functions are needed.
+
+******************************************************************************/
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
+s8 builtin_ladd(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a + b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lsub(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a - b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lneg(s8 a)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = -a;
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
+
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
+s8 builtin_lmul(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a * b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_MUL) */
+
+
+#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) || defined (DISABLE_GC)
+s8 builtin_ldiv(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a / b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lrem(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a % b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+#endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
+
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
+s8 builtin_lshl(s8 a, s4 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a << (b & 63);
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lshr(s8 a, s4 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a >> (b & 63);
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lushr(s8 a, s4 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = ((u8) a) >> (b & 63);
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
+
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
+s8 builtin_land(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a & b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lor(s8 a, s8 b)
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a | b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+
+s8 builtin_lxor(s8 a, s8 b) 
+{
+       s8 c;
+
+#if U8_AVAILABLE
+       c = a ^ b; 
+#else
+       c = builtin_i2l(0);
+#endif
+
+       return c;
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
+
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
+s4 builtin_lcmp(s8 a, s8 b)
+{ 
+#if U8_AVAILABLE
+       if (a < b)
+               return -1;
+
+       if (a > b)
+               return 1;
+
+       return 0;
+#else
+       return 0;
+#endif
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_CMP) */
+
+
+/* functions for unsupported floating instructions ****************************/
+
+/* used to convert FLT_xxx defines into float values */
+
+static inline float intBitsToFloat(s4 i)
+{
+       imm_union imb;
+
+       imb.i = i;
+       return imb.f;
+}
+
+
+/* used to convert DBL_xxx defines into double values */
+
+static inline float longBitsToDouble(s8 l)
+{
+       imm_union imb;
+
+       imb.l = l;
+       return imb.d;
+}
+
+
+#if !SUPPORT_FLOAT
+float builtin_fadd(float a, float b)
+{
+       if (isnanf(a)) return intBitsToFloat(FLT_NAN);
+       if (isnanf(b)) return intBitsToFloat(FLT_NAN);
+       if (finitef(a)) {
+               if (finitef(b))
+                       return a + b;
+               else
+                       return b;
+       }
+       else {
+               if (finitef(b))
+                       return a;
+               else {
+                       if (copysignf(1.0, a) == copysignf(1.0, b))
+                               return a;
+                       else
+                               return intBitsToFloat(FLT_NAN);
+               }
+       }
+}
+
+
+float builtin_fsub(float a, float b)
+{
+       return builtin_fadd(a, builtin_fneg(b));
+}
+
+
+float builtin_fmul(float a, float b)
+{
+       if (isnanf(a)) return intBitsToFloat(FLT_NAN);
+       if (isnanf(b)) return intBitsToFloat(FLT_NAN);
+       if (finitef(a)) {
+               if (finitef(b)) return a * b;
+               else {
+                       if (a == 0) return intBitsToFloat(FLT_NAN);
+                       else return copysignf(b, copysignf(1.0, b)*a);
+               }
+       }
+       else {
+               if (finitef(b)) {
+                       if (b == 0) return intBitsToFloat(FLT_NAN);
+                       else return copysignf(a, copysignf(1.0, a)*b);
+               }
+               else {
+                       return copysignf(a, copysignf(1.0, a)*copysignf(1.0, b));
+               }
+       }
+}
+
+
+/* builtin_ddiv ****************************************************************
+
+   Implementation as described in VM Spec.
+
+*******************************************************************************/
+
+float builtin_fdiv(float a, float b)
+{
+       if (finitef(a)) {
+               if (finitef(b)) {
+                       /* If neither value1' nor value2' is NaN, the sign of the result */
+                       /* is positive if both values have the same sign, negative if the */
+                       /* values have different signs. */
+
+                       return a / b;
+
+               } else {
+                       if (isnanf(b)) {
+                               /* If either value1' or value2' is NaN, the result is NaN. */
+
+                               return intBitsToFloat(FLT_NAN);
+
+                       } else {
+                               /* Division of a finite value by an infinity results in a */
+                               /* signed zero, with the sign-producing rule just given. */
+
+                               /* is sign equal? */
+
+                               if (copysignf(1.0, a) == copysignf(1.0, b))
+                                       return 0.0;
+                               else
+                                       return -0.0;
+                       }
+               }
+
+       } else {
+               if (isnanf(a)) {
+                       /* If either value1' or value2' is NaN, the result is NaN. */
+
+                       return intBitsToFloat(FLT_NAN);
+
+               } else if (finitef(b)) {
+                       /* Division of an infinity by a finite value results in a signed */
+                       /* infinity, with the sign-producing rule just given. */
+
+                       /* is sign equal? */
+
+                       if (copysignf(1.0, a) == copysignf(1.0, b))
+                               return intBitsToFloat(FLT_POSINF);
+                       else
+                               return intBitsToFloat(FLT_NEGINF);
+
+               } else {
+                       /* Division of an infinity by an infinity results in NaN. */
+
+                       return intBitsToFloat(FLT_NAN);
+               }
+       }
+}
+
+
+float builtin_fneg(float a)
+{
+       if (isnanf(a)) return a;
+       else {
+               if (finitef(a)) return -a;
+               else return copysignf(a, -copysignf(1.0, a));
+       }
+}
+#endif /* !SUPPORT_FLOAT */
+
+
+#if !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP || defined(ENABLE_INTRP)
+s4 builtin_fcmpl(float a, float b)
+{
+       if (isnanf(a))
+               return -1;
+
+       if (isnanf(b))
+               return -1;
+
+       if (!finitef(a) || !finitef(b)) {
+               a = finitef(a) ? 0 : copysignf(1.0,     a);
+               b = finitef(b) ? 0 : copysignf(1.0, b);
+       }
+
+       if (a > b)
+               return 1;
+
+       if (a == b)
+               return 0;
+
+       return -1;
+}
+
+
+s4 builtin_fcmpg(float a, float b)
+{
+       if (isnanf(a)) return 1;
+       if (isnanf(b)) return 1;
+       if (!finitef(a) || !finitef(b)) {
+               a = finitef(a) ? 0 : copysignf(1.0, a);
+               b = finitef(b) ? 0 : copysignf(1.0, b);
+       }
+       if (a > b) return 1;
+       if (a == b) return 0;
+       return -1;
+}
+#endif /* !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP || defined(ENABLE_INTRP) */
+
+
+float builtin_frem(float a, float b)
+{
+       return fmodf(a, b);
+}
+
+
+/* functions for unsupported double instructions ******************************/
+
+#if !SUPPORT_DOUBLE
+double builtin_dadd(double a, double b)
+{
+       if (isnan(a)) return longBitsToDouble(DBL_NAN);
+       if (isnan(b)) return longBitsToDouble(DBL_NAN);
+       if (finite(a)) {
+               if (finite(b)) return a + b;
+               else return b;
+       }
+       else {
+               if (finite(b)) return a;
+               else {
+                       if (copysign(1.0, a)==copysign(1.0, b)) return a;
+                       else return longBitsToDouble(DBL_NAN);
+               }
+       }
+}
+
+
+double builtin_dsub(double a, double b)
+{
+       return builtin_dadd(a, builtin_dneg(b));
+}
+
+
+double builtin_dmul(double a, double b)
+{
+       if (isnan(a)) return longBitsToDouble(DBL_NAN);
+       if (isnan(b)) return longBitsToDouble(DBL_NAN);
+       if (finite(a)) {
+               if (finite(b)) return a * b;
+               else {
+                       if (a == 0) return longBitsToDouble(DBL_NAN);
+                       else return copysign(b, copysign(1.0, b) * a);
+               }
+       }
+       else {
+               if (finite(b)) {
+                       if (b == 0) return longBitsToDouble(DBL_NAN);
+                       else return copysign(a, copysign(1.0, a) * b);
+               }
+               else {
+                       return copysign(a, copysign(1.0, a) * copysign(1.0, b));
+               }
+       }
+}
+
+
+/* builtin_ddiv ****************************************************************
+
+   Implementation as described in VM Spec.
+
+*******************************************************************************/
+
+double builtin_ddiv(double a, double b)
+{
+       if (finite(a)) {
+               if (finite(b)) {
+                       /* If neither value1' nor value2' is NaN, the sign of the result */
+                       /* is positive if both values have the same sign, negative if the */
+                       /* values have different signs. */
+
+                       return a / b;
+
+               } else {
+                       if (isnan(b)) {
+                               /* If either value1' or value2' is NaN, the result is NaN. */
+
+                               return longBitsToDouble(DBL_NAN);
+
+                       } else {
+                               /* Division of a finite value by an infinity results in a */
+                               /* signed zero, with the sign-producing rule just given. */
+
+                               /* is sign equal? */
+
+                               if (copysign(1.0, a) == copysign(1.0, b))
+                                       return 0.0;
+                               else
+                                       return -0.0;
+                       }
+               }
+
+       } else {
+               if (isnan(a)) {
+                       /* If either value1' or value2' is NaN, the result is NaN. */
+
+                       return longBitsToDouble(DBL_NAN);
+
+               } else if (finite(b)) {
+                       /* Division of an infinity by a finite value results in a signed */
+                       /* infinity, with the sign-producing rule just given. */
+
+                       /* is sign equal? */
+
+                       if (copysign(1.0, a) == copysign(1.0, b))
+                               return longBitsToDouble(DBL_POSINF);
+                       else
+                               return longBitsToDouble(DBL_NEGINF);
+
+               } else {
+                       /* Division of an infinity by an infinity results in NaN. */
+
+                       return longBitsToDouble(DBL_NAN);
+               }
+       }
+}
+
+
+/* builtin_dneg ****************************************************************
+
+   Implemented as described in VM Spec.
+
+*******************************************************************************/
+
+double builtin_dneg(double a)
+{
+       if (isnan(a)) {
+               /* If the operand is NaN, the result is NaN (recall that NaN has no */
+               /* sign). */
+
+               return a;
+
+       } else {
+               if (finite(a)) {
+                       /* If the operand is a zero, the result is the zero of opposite */
+                       /* sign. */
+
+                       return -a;
+
+               } else {
+                       /* If the operand is an infinity, the result is the infinity of */
+                       /* opposite sign. */
+
+                       return copysign(a, -copysign(1.0, a));
+               }
+       }
+}
+#endif /* !SUPPORT_DOUBLE */
+
+
+#if !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP || defined(ENABLE_INTRP)
+s4 builtin_dcmpl(double a, double b)
+{
+       if (isnan(a))
+               return -1;
+
+       if (isnan(b))
+               return -1;
+
+       if (!finite(a) || !finite(b)) {
+               a = finite(a) ? 0 : copysign(1.0, a);
+               b = finite(b) ? 0 : copysign(1.0, b);
+       }
+
+       if (a > b)
+               return 1;
+
+       if (a == b)
+               return 0;
+
+       return -1;
+}
+
+
+s4 builtin_dcmpg(double a, double b)
+{
+       if (isnan(a))
+               return 1;
+
+       if (isnan(b))
+               return 1;
+
+       if (!finite(a) || !finite(b)) {
+               a = finite(a) ? 0 : copysign(1.0, a);
+               b = finite(b) ? 0 : copysign(1.0, b);
+       }
+
+       if (a > b)
+               return 1;
+
+       if (a == b)
+               return 0;
+
+       return -1;
+}
+#endif /* !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP || defined(ENABLE_INTRP) */
+
+
+double builtin_drem(double a, double b)
+{
+       return fmod(a, b);
+}
+
+
+/* conversion operations ******************************************************/
+
+#if 0
+s8 builtin_i2l(s4 i)
+{
+#if U8_AVAILABLE
+       return i;
+#else
+       s8 v;
+       v.high = 0;
+       v.low = i;
+       return v;
+#endif
+}
+
+s4 builtin_l2i(s8 l)
+{
+#if U8_AVAILABLE
+       return (s4) l;
+#else
+       return l.low;
+#endif
+}
+#endif
+
+
+#if !(SUPPORT_FLOAT && SUPPORT_I2F)
+float builtin_i2f(s4 a)
+{
+       float f = (float) a;
+       return f;
+}
+#endif /* !(SUPPORT_FLOAT && SUPPORT_I2F) */
+
+
+#if !(SUPPORT_DOUBLE && SUPPORT_I2D)
+double builtin_i2d(s4 a)
+{
+       double d = (double) a;
+       return d;
+}
+#endif /* !(SUPPORT_DOUBLE && SUPPORT_I2D) */
+
+
+#if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F)
+float builtin_l2f(s8 a)
+{
+#if U8_AVAILABLE
+       float f = (float) a;
+       return f;
+#else
+       return 0.0;
+#endif
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F) */
+
+
+#if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D)
+double builtin_l2d(s8 a)
+{
+#if U8_AVAILABLE
+       double d = (double) a;
+       return d;
+#else
+       return 0.0;
+#endif
+}
+#endif /* !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D) */
+
+
+#if !(SUPPORT_FLOAT && SUPPORT_F2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
+s4 builtin_f2i(float a) 
+{
+       s4 i;
+
+       i = builtin_d2i((double) a);
+
+       return i;
+
+       /*      float f;
+       
+               if (isnanf(a))
+               return 0;
+               if (finitef(a)) {
+               if (a > 2147483647)
+               return 2147483647;
+               if (a < (-2147483648))
+               return (-2147483648);
+               return (s4) a;
+               }
+               f = copysignf((float) 1.0, a);
+               if (f > 0)
+               return 2147483647;
+               return (-2147483648); */
+}
+#endif /* !(SUPPORT_FLOAT && SUPPORT_F2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC) */
+
+
+#if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L) || defined(DISABLE_GC)
+s8 builtin_f2l(float a)
+{
+       s8 l;
+
+       l = builtin_d2l((double) a);
+
+       return l;
+
+       /*      float f;
+       
+               if (finitef(a)) {
+               if (a > 9223372036854775807L)
+               return 9223372036854775807L;
+               if (a < (-9223372036854775808L))
+               return (-9223372036854775808L);
+               return (s8) a;
+               }
+               if (isnanf(a))
+               return 0;
+               f = copysignf((float) 1.0, a);
+               if (f > 0)
+               return 9223372036854775807L;
+               return (-9223372036854775808L); */
+}
+#endif /* !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L) */
+
+
+#if !(SUPPORT_DOUBLE && SUPPORT_D2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
+s4 builtin_d2i(double a) 
+{ 
+       double d;
+       
+       if (finite(a)) {
+               if (a >= 2147483647)
+                       return 2147483647;
+               if (a <= (-2147483647-1))
+                       return (-2147483647-1);
+               return (s4) a;
+       }
+       if (isnan(a))
+               return 0;
+       d = copysign(1.0, a);
+       if (d > 0)
+               return 2147483647;
+       return (-2147483647-1);
+}
+#endif /* !(SUPPORT_DOUBLE && SUPPORT_D2I) || defined(ENABLE_INTRP) || defined(DISABLE_GC) */
+
+
+#if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L) || defined(DISABLE_GC)
+s8 builtin_d2l(double a)
+{
+       double d;
+       
+       if (finite(a)) {
+               if (a >= 9223372036854775807LL)
+                       return 9223372036854775807LL;
+               if (a <= (-9223372036854775807LL-1))
+                       return (-9223372036854775807LL-1);
+               return (s8) a;
+       }
+       if (isnan(a))
+               return 0;
+       d = copysign(1.0, a);
+       if (d > 0)
+               return 9223372036854775807LL;
+       return (-9223372036854775807LL-1);
+}
+#endif /* !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L) */
+
+
+#if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
+double builtin_f2d(float a)
+{
+       if (finitef(a)) return (double) a;
+       else {
+               if (isnanf(a))
+                       return longBitsToDouble(DBL_NAN);
+               else
+                       return copysign(longBitsToDouble(DBL_POSINF), (double) copysignf(1.0, a) );
+       }
+}
+
+float builtin_d2f(double a)
+{
+       if (finite(a))
+               return (float) a;
+       else {
+               if (isnan(a))
+                       return intBitsToFloat(FLT_NAN);
+               else
+                       return copysignf(intBitsToFloat(FLT_POSINF), (float) copysign(1.0, a));
+       }
+}
+#endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
+
+
+/*============================================================================*/
+/* AUTOMATICALLY REPLACED FUNCTIONS                                           */
+/*============================================================================*/
+
+/* builtin_arraycopy ***********************************************************
+
+   Builtin for java.lang.System.arraycopy.
+
+   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
+
+*******************************************************************************/
+
+void builtin_arraycopy(java_handle_t *src, s4 srcStart,
+                                          java_handle_t *dest, s4 destStart, s4 len)
+{
+       arraydescriptor *sdesc;
+       arraydescriptor *ddesc;
+       s4               i;
+
+       if ((src == NULL) || (dest == NULL)) {
+               exceptions_throw_nullpointerexception();
+               return;
+       }
+
+       sdesc = LLNI_vftbl_direct(src)->arraydesc;
+       ddesc = LLNI_vftbl_direct(dest)->arraydesc;
+
+       if (!sdesc || !ddesc || (sdesc->arraytype != ddesc->arraytype)) {
+               exceptions_throw_arraystoreexception();
+               return;
+       }
+
+       // Check if offsets and length are positive.
+       if ((srcStart < 0) || (destStart < 0) || (len < 0)) {
+               exceptions_throw_arrayindexoutofboundsexception();
+               return;
+       }
+
+       // Check if ranges are valid.
+       if ((((uint32_t) srcStart  + (uint32_t) len) > (uint32_t) LLNI_array_size(src)) ||
+               (((uint32_t) destStart + (uint32_t) len) > (uint32_t) LLNI_array_size(dest))) {
+               exceptions_throw_arrayindexoutofboundsexception();
+               return;
+       }
+
+       // Special case.
+       if (len == 0) {
+               return;
+       }
+
+       if (sdesc->componentvftbl == ddesc->componentvftbl) {
+               /* We copy primitive values or references of exactly the same type */
+
+               s4 dataoffset = sdesc->dataoffset;
+               s4 componentsize = sdesc->componentsize;
+
+               LLNI_CRITICAL_START;
+
+               MMOVE(((u1 *) LLNI_DIRECT(dest)) + dataoffset + componentsize * destStart,
+                         ((u1 *) LLNI_DIRECT(src))  + dataoffset + componentsize * srcStart,
+                         u1, (size_t) len * componentsize);
+
+               LLNI_CRITICAL_END;
+       }
+       else {
+               /* We copy references of different type */
+
+               java_handle_objectarray_t *oas = (java_handle_objectarray_t *) src;
+               java_handle_objectarray_t *oad = (java_handle_objectarray_t *) dest;
+               if (destStart <= srcStart) {
+                       for (i = 0; i < len; i++) {
+                               java_handle_t *o;
+
+                               o = array_objectarray_element_get(oas, srcStart + i);
+
+                               if (!builtin_canstore(oad, o))
+                                       return;
+
+                               array_objectarray_element_set(oad, destStart + i, o);
+                       }
+               }
+               else {
+                       /* XXX this does not completely obey the specification!
+                          If an exception is thrown only the elements above the
+                          current index have been copied. The specification
+                          requires that only the elements *below* the current
+                          index have been copied before the throw. */
+
+                       for (i = len - 1; i >= 0; i--) {
+                               java_handle_t *o;
+
+                               o = array_objectarray_element_get(oas, srcStart + i);
+
+                               if (!builtin_canstore(oad, o))
+                                       return;
+
+                               array_objectarray_element_set(oad, destStart + i, o);
+                       }
+               }
+       }
+}
+
+
+/* builtin_nanotime ************************************************************
+
+   Return the current time in nanoseconds.
+
+*******************************************************************************/
+
+s8 builtin_nanotime(void)
+{
+       struct timeval tv;
+       s8             usecs;
+
+       if (gettimeofday(&tv, NULL) == -1)
+               vm_abort("gettimeofday failed: %s", strerror(errno));
+
+       usecs = (s8) tv.tv_sec * (1000 * 1000) + (s8) tv.tv_usec;
+
+       return usecs * 1000;
+}
+
+
+/* builtin_currenttimemillis ***************************************************
+
+   Return the current time in milliseconds.
+
+*******************************************************************************/
+
+s8 builtin_currenttimemillis(void)
+{
+       s8 msecs;
+
+       msecs = builtin_nanotime() / 1000 / 1000;
+
+       return msecs;
+}
+
+
+/* builtin_clone ***************************************************************
+
+   Function for cloning objects or arrays.
+
+   NOTE: This is a SLOW builtin and can be called from JIT & NATIVE code.
+
+*******************************************************************************/
+
+java_handle_t *builtin_clone(void *env, java_handle_t *o)
+{
+       arraydescriptor *ad;
+       u4               size;
+       classinfo       *c;
+       java_handle_t   *co;                /* cloned object header               */
+
+       /* get the array descriptor */
+
+       ad = LLNI_vftbl_direct(o)->arraydesc;
+
+       /* we are cloning an array */
+
+       if (ad != NULL) {
+               size = ad->dataoffset + ad->componentsize * LLNI_array_size(o);
+        
+               co = (java_handle_t*) heap_alloc(size, (ad->arraytype == ARRAYTYPE_OBJECT), NULL, true);
+
+               if (co == NULL)
+                       return NULL;
+
+#if !defined(ENABLE_GC_CACAO) && defined(ENABLE_HANDLES)
+               /* XXX this is only a dirty hack to make Boehm work with handles */
+
+               co = LLNI_WRAP((java_object_t *) co);
+#endif
+
+               LLNI_CRITICAL_START;
+
+               MCOPY(LLNI_DIRECT(co), LLNI_DIRECT(o), u1, size);
+
+#if defined(ENABLE_GC_CACAO)
+               heap_init_objectheader(LLNI_DIRECT(co), size);
+#endif
+
+#if defined(ENABLE_THREADS)
+               lock_init_object_lock(LLNI_DIRECT(co));
+#endif
+
+               LLNI_CRITICAL_END;
+
+               return co;
+       }
+    
+    /* we are cloning a non-array */
+
+    if (!builtin_instanceof(o, class_java_lang_Cloneable)) {
+        exceptions_throw_clonenotsupportedexception();
+        return NULL;
+    }
+
+       /* get the class of the object */
+
+       LLNI_class_get(o, c);
+
+       /* create new object */
+
+    co = builtin_new(c);
+
+    if (co == NULL)
+        return NULL;
+
+       LLNI_CRITICAL_START;
+
+       MCOPY(LLNI_DIRECT(co), LLNI_DIRECT(o), u1, c->instancesize);
+
+#if defined(ENABLE_GC_CACAO)
+       heap_init_objectheader(LLNI_DIRECT(co), c->instancesize);
+#endif
+
+#if defined(ENABLE_THREADS)
+       lock_init_object_lock(LLNI_DIRECT(co));
+#endif
+
+       LLNI_CRITICAL_END;
+
+    return co;
+}
+
+
+#if defined(ENABLE_CYCLES_STATS)
+void builtin_print_cycles_stats(FILE *file)
+{
+       fprintf(file,"builtin cylce count statistics:\n");
+
+       CYCLES_STATS_PRINT_OVERHEAD(builtin_overhead,file);
+       CYCLES_STATS_PRINT(builtin_new         ,file);
+
+       fprintf(file,"\n");
+}
+#endif /* defined(ENABLE_CYCLES_STATS) */
+
+
+#if defined(ENABLE_VMLOG)
+#define NDEBUG
+#include <vmlog_cacao.c>
+#endif
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
diff --git a/src/vm/jit/builtin.hpp b/src/vm/jit/builtin.hpp
new file mode 100644 (file)
index 0000000..017e87c
--- /dev/null
@@ -0,0 +1,354 @@
+/* src/vm/jit/builtin.hpp - prototypes of builtin functions
+
+   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 _BUILTIN_HPP
+#define _BUILTIN_HPP
+
+/* forward typedefs ***********************************************************/
+
+typedef struct builtintable_entry builtintable_entry;
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "arch.h"
+#include "md-abi.h"
+
+#include "toolbox/logging.h"
+
+#include "vm/descriptor.h"
+#include "vm/utf8.h"
+
+
+/* define infinity for floating point numbers */
+
+#define FLT_NAN     0x7fc00000
+#define FLT_POSINF  0x7f800000
+#define FLT_NEGINF  0xff800000
+
+/* define infinity for double floating point numbers */
+
+#define DBL_NAN     0x7ff8000000000000LL
+#define DBL_POSINF  0x7ff0000000000000LL
+#define DBL_NEGINF  0xfff0000000000000LL
+
+
+/* float versions are not defined in GNU classpath's fdlibm */
+
+#define copysignf    copysign
+#define finitef      finite
+#define fmodf        fmod
+#define isnanf       isnan
+
+
+/* builtin functions table ****************************************************/
+
+struct builtintable_entry {
+       s4           opcode;                /* opcode which is replaced           */
+       u4           flags;                 /* e.g. check for exception           */
+       functionptr  fp;                    /* function pointer of builtin        */
+       u1          *stub;                  /* pointer to builtin stub code       */
+       const char*  cclassname;            /* char name of the class             */
+       const char*  cname;                 /* char name of the function          */
+       const char*  cdescriptor;           /* char name of the descriptor        */
+       utf         *classname;             /* class of the function              */
+       utf         *name;                  /* name of the function               */
+       utf         *descriptor;            /* descriptor of the function         */
+       methoddesc  *md;
+};
+
+
+/* builtin table flag defines *************************************************/
+
+#define BUILTINTABLE_FLAG_STUB         0x0001 /* builtin needs a stub         */
+#define BUILTINTABLE_FLAG_EXCEPTION    0x0002 /* check for excepion on return */
+
+
+/* function prototypes ********************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool builtin_init(void);
+
+builtintable_entry *builtintable_get_internal(functionptr fp);
+builtintable_entry *builtintable_get_automatic(s4 opcode);
+
+bool builtintable_replace_function(void *iptr);
+
+
+/**********************************************************************/
+/* BUILTIN FUNCTIONS                                                  */
+/**********************************************************************/
+
+/* NOTE: Builtin functions which are used in the BUILTIN* opcodes must
+ * have a BUILTIN_... macro defined as seen below. In code dealing
+ * with the BUILTIN* opcodes the functions may only be addressed by
+ * these macros, never by their actual name! (This helps to make this
+ * code more portable.)
+ *
+ * C and assembler code which does not deal with the BUILTIN* opcodes,
+ * can use the builtin functions normally (like all other functions).
+ *
+ * IMPORTANT:
+ * For each builtin function which is used in a BUILTIN* opcode there
+ * must be an entry in the builtin_desc table in jit/jit.c.
+ *
+ * Below each prototype is either the BUILTIN_ macro definition or a
+ * comment specifiying that this function is not used in BUILTIN*
+ * opcodes.
+ *
+ * (The BUILTIN* opcodes are ICMD_BUILTIN1, ICMD_BUILTIN2 and
+ * ICMD_BUILTIN3.)
+ */
+
+bool builtin_instanceof(java_handle_t *obj, classinfo *c);
+/* NOT AN OP */
+bool builtin_checkcast(java_handle_t *obj, classinfo *c);
+/* NOT AN OP */
+bool builtin_arrayinstanceof(java_handle_t *h, classinfo *targetclass);
+/* NOT AN OP */
+bool builtin_fast_arrayinstanceof(java_object_t *o, classinfo *targetclass);
+#define BUILTIN_arrayinstanceof (functionptr) builtin_fast_arrayinstanceof
+bool builtin_fast_arraycheckcast(java_object_t *o, classinfo *targetclass);
+#define BUILTIN_arraycheckcast (functionptr) builtin_fast_arraycheckcast
+
+bool builtin_canstore(java_handle_objectarray_t *oa, java_handle_t *o);
+/* NOT AN OP */
+bool builtin_fast_canstore(java_objectarray_t *oa, java_object_t *o);
+#define BUILTIN_FAST_canstore (functionptr) builtin_fast_canstore
+
+void *builtin_throw_exception(java_object_t *exception);
+/* NOT AN OP */
+java_object_t *builtin_retrieve_exception(void);
+/* NOT AN OP */
+
+java_handle_t *builtin_new(classinfo *c);
+/* NOT AN OP */
+java_handle_t *builtin_java_new(java_handle_t *c);
+#define BUILTIN_new (functionptr) builtin_java_new
+
+#if defined(ENABLE_TLH)
+#define BUILTIN_tlh_new (functionptr) builtin_tlh_new
+java_handle_t *builtin_tlh_new(classinfo *c);
+#endif
+
+#if defined(ENABLE_ESCAPE_REASON)
+#define BUILTIN_escape_reason_new (functionptr)builtin_escape_reason_new
+java_handle_t *builtin_escape_reason_new(classinfo *c);
+#endif
+
+java_object_t *builtin_fast_new(classinfo *c);
+#define BUILTIN_FAST_new (functionptr) builtin_fast_new
+
+java_handle_t *builtin_newarray(int32_t size, classinfo *arrayclass);
+/* NOT AN OP */
+java_handle_t *builtin_java_newarray(int32_t size, java_handle_t *arrayclass);
+#define BUILTIN_newarray (functionptr) builtin_java_newarray
+
+java_handle_objectarray_t *builtin_anewarray(int32_t size, classinfo *componentclass);
+/* NOT AN OP */
+
+java_handle_booleanarray_t *builtin_newarray_boolean(int32_t size);
+#define BUILTIN_newarray_boolean (functionptr) builtin_newarray_boolean
+java_handle_chararray_t *builtin_newarray_char(int32_t size);
+#define BUILTIN_newarray_char (functionptr) builtin_newarray_char
+java_handle_floatarray_t *builtin_newarray_float(int32_t size);
+#define BUILTIN_newarray_float (functionptr) builtin_newarray_float
+java_handle_doublearray_t *builtin_newarray_double(int32_t size);
+#define BUILTIN_newarray_double (functionptr) builtin_newarray_double
+java_handle_bytearray_t *builtin_newarray_byte(int32_t size);
+#define BUILTIN_newarray_byte (functionptr) builtin_newarray_byte
+java_handle_shortarray_t *builtin_newarray_short(int32_t size);
+#define BUILTIN_newarray_short (functionptr) builtin_newarray_short
+java_handle_intarray_t *builtin_newarray_int(int32_t size);
+#define BUILTIN_newarray_int (functionptr) builtin_newarray_int
+java_handle_longarray_t *builtin_newarray_long(int32_t size);
+#define BUILTIN_newarray_long (functionptr) builtin_newarray_long
+
+java_handle_objectarray_t *builtin_multianewarray(int n,
+                                                                                                 java_handle_t *arrayclass,
+                                                                                                 long *dims);
+#define BUILTIN_multianewarray (functionptr) builtin_multianewarray
+
+#if defined(TRACE_ARGS_NUM)
+void builtin_verbosecall_enter(s8 a0, s8 a1,
+# if TRACE_ARGS_NUM >= 4
+                                                          s8 a2, s8 a3,
+# endif
+# if TRACE_ARGS_NUM >= 6
+                                                          s8 a4, s8 a5,
+# endif
+# if TRACE_ARGS_NUM == 8
+                                                          s8 a6, s8 a7,
+# endif
+                                                          methodinfo *m);
+/* NOT AN OP */
+#endif /* defined(TRACE_ARGS_NUM) */
+
+void builtin_verbosecall_exit(s8 l, double d, float f, methodinfo *m);
+/* NOT AN OP */
+
+s4 builtin_idiv(s4 a, s4 b);
+#define BUILTIN_idiv (functionptr) builtin_idiv
+s4 builtin_irem(s4 a, s4 b);
+#define BUILTIN_irem (functionptr) builtin_irem
+
+s8 builtin_ladd(s8 a, s8 b);
+#define BUILTIN_ladd (functionptr) builtin_ladd
+s8 builtin_lsub(s8 a, s8 b);
+#define BUILTIN_lsub (functionptr) builtin_lsub
+s8 builtin_lmul(s8 a, s8 b);
+#define BUILTIN_lmul (functionptr) builtin_lmul
+
+s8 builtin_ldiv(s8 a, s8 b);
+#define BUILTIN_ldiv (functionptr) builtin_ldiv
+s8 builtin_lrem(s8 a, s8 b);
+#define BUILTIN_lrem (functionptr) builtin_lrem
+
+s8 builtin_lshl(s8 a, s4 b);
+#define BUILTIN_lshl (functionptr) builtin_lshl
+s8 builtin_lshr(s8 a, s4 b);
+#define BUILTIN_lshr (functionptr) builtin_lshr
+s8 builtin_lushr(s8 a, s4 b);
+#define BUILTIN_lushr (functionptr) builtin_lushr
+s8 builtin_land(s8 a, s8 b);
+#define BUILTIN_land (functionptr) builtin_land
+s8 builtin_lor(s8 a, s8 b);
+#define BUILTIN_lor (functionptr) builtin_lor
+s8 builtin_lxor(s8 a, s8 b);
+#define BUILTIN_lxor (functionptr) builtin_lxor
+s8 builtin_lneg(s8 a);
+#define BUILTIN_lneg (functionptr) builtin_lneg
+s4 builtin_lcmp(s8 a, s8 b);
+#define BUILTIN_lcmp (functionptr) builtin_lcmp
+
+float builtin_fadd(float a, float b);
+#define BUILTIN_fadd (functionptr) builtin_fadd
+float builtin_fsub(float a, float b);
+#define BUILTIN_fsub (functionptr) builtin_fsub
+float builtin_fmul(float a, float b);
+#define BUILTIN_fmul (functionptr) builtin_fmul
+float builtin_fdiv(float a, float b);
+#define BUILTIN_fdiv (functionptr) builtin_fdiv
+float builtin_fneg(float a);         
+#define BUILTIN_fneg (functionptr) builtin_fneg
+s4 builtin_fcmpl(float a, float b);  
+#define BUILTIN_fcmpl (functionptr) builtin_fcmpl
+s4 builtin_fcmpg(float a, float b);  
+#define BUILTIN_fcmpg (functionptr) builtin_fcmpg
+float builtin_frem(float a, float b);
+#define BUILTIN_frem (functionptr) builtin_frem
+
+double builtin_dadd(double a, double b);
+#define BUILTIN_dadd (functionptr) builtin_dadd
+double builtin_dsub(double a, double b);
+#define BUILTIN_dsub (functionptr) builtin_dsub
+double builtin_dmul(double a, double b);
+#define BUILTIN_dmul (functionptr) builtin_dmul
+double builtin_ddiv(double a, double b);
+#define BUILTIN_ddiv (functionptr) builtin_ddiv
+double builtin_dneg(double a);          
+#define BUILTIN_dneg (functionptr) builtin_dneg
+s4 builtin_dcmpl(double a, double b);   
+#define BUILTIN_dcmpl (functionptr) builtin_dcmpl
+s4 builtin_dcmpg(double a, double b);   
+#define BUILTIN_dcmpg (functionptr) builtin_dcmpg
+double builtin_drem(double a, double b);
+#define BUILTIN_drem (functionptr) builtin_drem
+
+s8       builtin_i2l(s4 i);
+/* NOT AN OP */
+float    builtin_i2f(s4 i);
+#define BUILTIN_i2f (functionptr) builtin_i2f
+double   builtin_i2d(s4 i);
+#define BUILTIN_i2d (functionptr) builtin_i2d
+s4       builtin_l2i(s8 l);
+/* NOT AN OP */
+float    builtin_l2f(s8 l);
+#define BUILTIN_l2f (functionptr) builtin_l2f
+double   builtin_l2d(s8 l);
+#define BUILTIN_l2d (functionptr) builtin_l2d
+
+s4       builtin_f2i(float a);
+#define BUILTIN_f2i (functionptr) builtin_f2i
+s4       asm_builtin_f2i(float a);
+/* NOT AN OP */
+s8       builtin_f2l(float a);
+#define BUILTIN_f2l (functionptr) builtin_f2l
+s8       asm_builtin_f2l(float a);
+/* NOT AN OP */
+
+double   builtin_f2d(float a);
+#define BUILTIN_f2d (functionptr) builtin_f2d
+
+s4       builtin_d2i(double a);
+#define BUILTIN_d2i (functionptr) builtin_d2i
+s4       asm_builtin_d2i(double a);
+/* NOT AN OP */
+s8       builtin_d2l(double a);
+#define BUILTIN_d2l (functionptr) builtin_d2l
+s8       asm_builtin_d2l(double a);
+/* NOT AN OP */
+
+float    builtin_d2f(double a);
+#define BUILTIN_d2f (functionptr) builtin_d2f
+
+java_handle_t *builtin_clone(void *env, java_handle_t *o);
+#define BUILTIN_clone (functionptr) builtin_clone
+
+void builtin_arraycopy(java_handle_t *src, s4 srcStart,
+                                          java_handle_t *dest, s4 destStart, s4 len);
+#define BUILTIN_arraycopy (functionptr) builtin_arraycopy
+
+s8 builtin_nanotime(void);
+s8 builtin_currenttimemillis(void);
+#define BUILTIN_currenttimemillis (functionptr) builtin_currenttimemillis
+
+#if defined(ENABLE_CYCLES_STATS)
+void builtin_print_cycles_stats(FILE *file);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _BUILTIN_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:
+ */
diff --git a/src/vm/jit/builtintable.inc b/src/vm/jit/builtintable.inc
new file mode 100644 (file)
index 0000000..28d6921
--- /dev/null
@@ -0,0 +1,1108 @@
+/* src/vm/jit/builtintable.inc - tables of builtin functions
+
+   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 "arch.h"
+
+#include "threads/lock-common.h"
+
+#include "vm/jit/builtin.hpp"
+#include "vm/jit/jit.hpp"
+
+
+/* internal and not automatically replaced functions **************************/
+
+static builtintable_entry builtintable_internal[] = {
+
+#if defined(__ALPHA__) || defined(DISABLE_GC)
+       {
+               ICMD_F2L,
+               0,
+               BUILTIN_f2l,
+               NULL,
+               NULL,
+               "f2l",
+               "(F)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_D2L,
+               0,
+               BUILTIN_d2l,
+               NULL,
+               NULL,
+               "d2l",
+               "(D)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_F2I,
+               0,
+               BUILTIN_f2i,
+               NULL,
+               NULL,
+               "f2i",
+               "(F)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_D2I,
+               0,
+               BUILTIN_d2i,
+               NULL,
+               NULL,
+               "d2i",
+               "(D)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !SUPPORT_DIVISION || defined(DISABLE_GC)
+       {
+               ICMD_IDIV,
+               0,
+               BUILTIN_idiv,
+               NULL,
+               NULL,
+               "idiv",
+               "(II)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_IREM,
+               0,
+               BUILTIN_irem,
+               NULL,
+               NULL,
+               "irem",
+               "(II)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) || defined(DISABLE_GC)
+       {
+               ICMD_LDIV,
+               0,
+               BUILTIN_ldiv,
+               NULL,
+               NULL,
+               "ldiv",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LREM,
+               0,
+               BUILTIN_lrem,
+               NULL,
+               NULL,
+               "lrem",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+       {
+               ICMD_FREM,
+               0,
+               BUILTIN_frem,
+               NULL,
+               NULL,
+               "frem",
+               "(FF)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_DREM,
+               0,
+               BUILTIN_drem,
+               NULL,
+               NULL,
+               "drem",
+               "(DD)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+
+
+       /* internal functions *****************************************************/
+
+       {
+               ICMD_NEW,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_new,
+               NULL,
+               NULL,
+               "new",
+               "(Ljava/lang/Class;)Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+
+#if defined(ENABLE_TLH)
+       {
+               ICMD_NEW,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_tlh_new,
+               NULL,
+               NULL,
+               "tlh_new",
+               "(Ljava/lang/Class;)Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if defined(ENABLE_ESCAPE_REASON)
+       {
+               ICMD_NEW,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_escape_reason_new,
+               NULL,
+               NULL,
+               "escape_reason_new",
+               "(Ljava/lang/Class;)Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+       {
+               ICMD_NEW,
+               0,
+               BUILTIN_FAST_new,
+               NULL,
+               NULL,
+               "fast-new",
+               "(Ljava/lang/Class;)Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_ANEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray,
+               NULL,
+               NULL,
+               "newarray",
+               "(ILjava/lang/Class;)[Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_boolean,
+               NULL,
+               NULL,
+               "newarray_boolean",
+               "(I)[Z",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_byte,
+               NULL,
+               NULL,
+               "newarray_byte",
+               "(I)[B",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_char,
+               NULL,
+               NULL,
+               "newarray_char",
+               "(I)[C",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_short,
+               NULL,
+               NULL,
+               "newarray_short",
+               "(I)[S",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_int,
+               NULL,
+               NULL,
+               "newarray_int",
+               "(I)[I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_long,
+               NULL,
+               NULL,
+               "newarray_long",
+               "(I)[J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_float,
+               NULL,
+               NULL,
+               "newarray_float",
+               "(I)[F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_NEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_newarray_double,
+               NULL,
+               NULL,
+               "newarray_double",
+               "(I)[D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_MULTIANEWARRAY,
+               BUILTINTABLE_FLAG_STUB,
+               BUILTIN_multianewarray,
+               NULL,
+               NULL,
+               "multianewarray",
+               /* XXX it should be: "(ILjava/lang/Class;[I)[Ljava/lang/Object;", */
+               "(ILjava/lang/Class;I)[Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_CHECKCAST,
+               0,
+               BUILTIN_arraycheckcast,
+               NULL,
+               NULL,
+               "arraycheckcast",
+               "([Ljava/lang/Object;[Ljava/lang/Object;)[Ljava/lang/Object;",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_INSTANCEOF,
+               0,
+               BUILTIN_arrayinstanceof,
+               NULL,
+               NULL,
+               "arrayinstanceof",
+               "([Ljava/lang/Object;[Ljava/lang/Object;)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_AASTORE,
+               0,
+               BUILTIN_FAST_canstore,
+               NULL,
+               NULL,
+               "fast-canstore",
+               "([Ljava/lang/Object;Ljava/lang/Object;)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+
+#if defined(ENABLE_THREADS)
+       {
+               ICMD_MONITORENTER,
+               BUILTINTABLE_FLAG_STUB,
+               LOCK_monitor_enter,
+               NULL,
+               NULL,
+               "monitorenter",
+               "(Ljava/lang/Object;)V",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_MONITOREXIT,
+               BUILTINTABLE_FLAG_STUB,
+               LOCK_monitor_exit,
+               NULL,
+               NULL,
+               "monitorexit",
+               "(Ljava/lang/Object;)V",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+
+       /* stop entry */
+
+       {
+               255,
+               0,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+};
+
+
+/* automatically replaced functions *******************************************/
+
+static builtintable_entry builtintable_automatic[] = {
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
+       {
+               ICMD_LCMP,
+               0,
+               BUILTIN_lcmp,
+               NULL,
+               NULL,
+               "lcmp",
+               "(JJ)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
+       {
+               ICMD_LAND,
+               0,
+               BUILTIN_land,
+               NULL,
+               NULL,
+               "land",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LOR,
+               0,
+               BUILTIN_lor,
+               NULL,
+               NULL,
+               "lor",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LXOR,
+               0,
+               BUILTIN_lxor,
+               NULL,
+               NULL,
+               "lxor",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
+       {
+               ICMD_LSHL,
+               0,
+               BUILTIN_lshl,
+               NULL,
+               NULL,
+               "lshl",
+               "(JI)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LSHR,
+               0,
+               BUILTIN_lshr,
+               NULL,
+               NULL,
+               "lshr",
+               "(JI)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LUSHR,
+               0,
+               BUILTIN_lushr,
+               NULL,
+               NULL,
+               "lushr",
+               "(JI)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
+       {
+               ICMD_LADD,
+               0,
+               BUILTIN_ladd,
+               NULL,
+               NULL,
+               "ladd",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LSUB,
+               0,
+               BUILTIN_lsub,
+               NULL,
+               NULL,
+               "lsub",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_LNEG,
+               0,
+               BUILTIN_lneg,
+               NULL,
+               NULL,
+               "lneg",
+               "(J)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
+
+#if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
+       {
+               ICMD_LMUL,
+               0,
+               BUILTIN_lmul,
+               NULL,
+               NULL,
+               "lmul",
+               "(JJ)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_FLOAT && SUPPORT_I2F)
+       {
+               ICMD_I2F,
+               0,
+               BUILTIN_i2f,
+               NULL,
+               NULL,
+               "i2f",
+               "(I)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_DOUBLE && SUPPORT_I2D)
+       {
+               ICMD_I2D,
+               0,
+               BUILTIN_i2d,
+               NULL,
+               NULL,
+               "i2d",
+               "(I)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F)
+       {
+               ICMD_L2F,
+               0,
+               BUILTIN_l2f,
+               NULL,
+               NULL,
+               "l2f",
+               "(J)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D)
+       {
+               ICMD_L2D,
+               0,
+               BUILTIN_l2d,
+               NULL,
+               NULL,
+               "l2d",
+               "(J)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_FLOAT && SUPPORT_F2I)
+       {
+               ICMD_F2I,
+               0,
+               BUILTIN_f2i,
+               NULL,
+               NULL,
+               "f2i",
+               "(F)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L)
+       {
+               ICMD_F2L,
+               0,
+               BUILTIN_f2l,
+               NULL,
+               NULL,
+               "f2l",
+               "(F)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_DOUBLE && SUPPORT_D2I)
+       {
+               ICMD_D2I,
+               0,
+               BUILTIN_d2i,
+               NULL,
+               NULL,
+               "d2i",
+               "(D)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+#if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L)
+       {
+               ICMD_D2L,
+               0,
+               BUILTIN_d2l,
+               NULL,
+               NULL,
+               "d2l",
+               "(D)J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+
+       /* float functions ********************************************************/
+
+#if !SUPPORT_FLOAT
+       {
+               ICMD_FADD,
+               0,
+               BUILTIN_fadd,
+               NULL,
+               NULL,
+               "fadd",
+               "(FF)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_FSUB,
+               0,
+               BUILTIN_fsub,
+               NULL,
+               NULL,
+               "fsub",
+               "(FF)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_FMUL,
+               0,
+               BUILTIN_fmul,
+               NULL,
+               NULL,
+               "fmul",
+               "(FF)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_FDIV,
+               0,
+               BUILTIN_fdiv,
+               NULL,
+               NULL,
+               "fdiv",
+               "(FF)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_FNEG,
+               0,
+               BUILTIN_fneg,
+               NULL,
+               NULL,
+               "fneg",
+               "(F)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !SUPPORT_FLOAT */
+
+#if !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP
+       {
+               ICMD_FCMPL,
+               0,
+               BUILTIN_fcmpl,
+               NULL,
+               NULL,
+               "fcmpl",
+               "(FF)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_FCMPG,
+               0,
+               BUILTIN_fcmpg,
+               NULL,
+               NULL,
+               "fcmpg",
+               "(FF)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !SUPPORT_FLOAT || !SUPPORT_FLOAT_CMP */
+
+
+       /* double functions *******************************************************/
+
+#if !SUPPORT_DOUBLE
+       {
+               ICMD_DADD,
+               0,
+               BUILTIN_dadd,
+               NULL,
+               NULL,
+               "dadd",
+               "(DD)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_DSUB,
+               0,
+               BUILTIN_dsub,
+               NULL,
+               NULL,
+               "dsub",
+               "(DD)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_DMUL,
+               0,
+               BUILTIN_dmul,
+               NULL,
+               NULL,
+               "dmul",
+               "(DD)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_DDIV,
+               0,
+               BUILTIN_ddiv,
+               NULL,
+               NULL,
+               "ddiv",
+               "(DD)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_DNEG,
+               0,
+               BUILTIN_dneg,
+               NULL,
+               NULL,
+               "dneg",
+               "(D)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !SUPPORT_DOUBLE */
+
+#if !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP
+       {
+               ICMD_DCMPL,
+               0,
+               BUILTIN_dcmpl,
+               NULL,
+               NULL,
+               "dcmpl",
+               "(DD)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_DCMPG,
+               0,
+               BUILTIN_dcmpg,
+               NULL,
+               NULL,
+               "dcmpg",
+               "(DD)I",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !SUPPORT_DOUBLE || !SUPPORT_DOUBLE_CMP */
+
+
+       /* float/double functions *************************************************/
+
+#if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
+       {
+               ICMD_F2D,
+               0,
+               BUILTIN_f2d,
+               NULL,
+               NULL,
+               "f2d",
+               "(F)D",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+       {
+               ICMD_D2F,
+               0,
+               BUILTIN_d2f,
+               NULL,
+               NULL,
+               "d2f",
+               "(D)F",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
+
+
+       /* prevent a compiler warning if everything is supported (e.g. i386) */
+
+       {
+               255,
+               0,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+};
+
+
+/* automatically replaced functions *******************************************/
+
+static builtintable_entry builtintable_function[] = {
+#if defined(ENABLE_JIT)
+
+       /* java.lang.VMSystem.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V STATIC NATIVE */
+
+       {
+               ICMD_BUILTIN,
+               BUILTINTABLE_FLAG_STUB | BUILTINTABLE_FLAG_EXCEPTION,
+               BUILTIN_arraycopy,
+               NULL,
+               "java/lang/VMSystem",
+               "arraycopy",
+               "(Ljava/lang/Object;ILjava/lang/Object;II)V",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+
+       /* java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V PUBLIC STATIC */
+
+#if 0
+       /* We disable this one until we have a fix for the stacktrace
+          issue. */
+
+       {
+               ICMD_BUILTIN,
+               BUILTINTABLE_FLAG_STUB | BUILTINTABLE_FLAG_EXCEPTION,
+               BUILTIN_arraycopy,
+               NULL,
+               "java/lang/System",
+               "arraycopy",
+               "(Ljava/lang/Object;ILjava/lang/Object;II)V",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+#endif
+
+       /* java.lang.VMSystem.currentTimeMillis()J PUBLIC STATIC */
+
+       {
+               ICMD_BUILTIN,
+               0,
+               BUILTIN_currenttimemillis,
+               NULL,
+               "java/lang/VMSystem",
+               "currentTimeMillis",
+               "()J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+
+       /* java.lang.System.currentTimeMillis()J PUBLIC STATIC */
+
+       {
+               ICMD_BUILTIN,
+               0,
+               BUILTIN_currenttimemillis,
+               NULL,
+               "java/lang/System",
+               "currentTimeMillis",
+               "()J",
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+
+#endif /* defined(ENABLE_JIT) */
+
+       /* stop entry */
+
+       {
+               255,
+               0,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL,
+               NULL
+       },
+};
+
+
+/*
+ * 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 0f2dd7419ab1699d011b223d5f9ad0711b354ef0..6c006a9a321572c498973037716fb09f9f916d3e 100644 (file)
@@ -63,7 +63,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/method.h"
 #include "vm/options.h"
index 5235d149a359fd07254bd5b68f420a23a2770dfd..f037e5bf3bf7c177a54b554cc56f7707acf05b58 100644 (file)
@@ -40,7 +40,7 @@ typedef struct linenumberref          linenumberref;
 #include "config.h"
 #include "vm/types.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/descriptor.h"
 #include "vm/global.h"
 #include "vm/method.h"
index 48a7758bbb5a254e669abcfbeac851fa25921a39..43ebe288f42951fc3c19f8d9ef3573f3411e3d15 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 3737b0144f1dcb3800e9338aa7a190e0e17026ab..89514f4b8f287e0741f63b2693a68f0e98b68542 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/signallocal.h"
 
index 97c362f4e081e0b8c3cfe7b7384189958926bb95..deac6bc698d69c583e84c6acbd0da6aeda865f5d 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 
 #include "vm/jit/asmpart.h"
index 61d853bf38f29b339269f59e16c429b4c67ecaad..6778854fe50f597898fceee2ca9d310572cddc90 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index bc95947bb7a16f270eab300f7733cd80d39e3759..7e9e0e40ec23dd53785b29b37feb4d642ec1286d 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 
 #include "vm/jit/asmpart.h"
index dfb63a10c455c8166f5b52f8f146d3361992dd2f..69fbf60217cbd229fecc2924d44971145523ff23 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/global.h"
 #include "vm/initialize.h"
index 35cec22935251ea7eb093af0d98f2c89cfc2ee9e..1bcaafabdeee2935805489ab499538db5e0822b2 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/linker.h"
 #include "vm/loader.h"
index 3534b5ab48c3f4289d7431161794de68b1674a4e..8e288486e770286e2948f54330dc465cd8854590 100644 (file)
@@ -47,7 +47,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index e3b2c4772b4f0f2428137d8664309fff5a5e7281..202860ccab2082a31a7b549fe8791709584d5924 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/loader.h"
 #include "vm/options.h"
 
index e51fb76c47a14ec356e05132cae19183ee5b438f..4c14aa5ee4a36da70b9f6e4dc102d477ed98a87b 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 13df1e949bc33f7854deb4d3e7771a603546fe02..83e273e7dffeab92286ba9403d4263a6b6287d1e 100644 (file)
@@ -35,7 +35,7 @@
 
 
 #include "mm/memory.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/resolve.h"
 #include "vm/jit/loop/loop.h"
 #include "vm/jit/loop/tracing.h"
index 960d33fec6fc6e5ac2ab0c84011bd062e72e44c4..59e9619daa5593dec0ad82b52fd1ecec56db4390 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index c6002a36b500379f8f6f4617fb5c2b59a1fd0f06..258fa6f17f729939d7c7d321609c8edcfe5e9c94 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "mm/memory.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 
 #include "vm/jit/asmpart.h"
 #include "vm/jit/emit-common.h"
index 36344a73ce3e7611f940dce86e927437d2665f7f..5ebb95395ce6ef621f30bbcf435261fa5e6dcfe5 100644 (file)
@@ -34,7 +34,7 @@
 #include "mm/memory.h"
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 04aa489949dfce6487605658ccc51fc299a567d3..57b6002931b8f2f62cf5130ab110bf182a9ebe9c 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/options.h"
index e1f2c2652ea0d341d95454dc340352e60eaa4071..917733138144181f1a7bfa876c24481dd9411257 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/options.h"
 
 #include "vm/jit/abi.h"
index 76da9b2e1a6ec4e632d64294459441047ed9552b..de6c2418184472c3479b4b638fe9ddecae547dd1 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 4bc5fc36b5ad9906d9437bca351565b784bb9d75..d8f8d349f85cc7d84e88595ead45fd68317b95a9 100644 (file)
@@ -33,7 +33,7 @@
 #include "toolbox/bitvector.h"
 #include "toolbox/worklist.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/resolve.h"
 #include "vm/exceptions.hpp"
 #include "vm/string.hpp"
index 466776097ad45a1dce02413a36b77bab4252a6be..541c019e8da6d5f1bcc151240cc6076aa50d0937 100644 (file)
@@ -35,7 +35,7 @@
 #include "threads/threadlist.h"
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/classcache.h"
 #include "vm/method.h"
index 520992b78bbfec6f1ee7e09aa059b2a3abbe7f85..39e75a5e7bdda5b6a3f1ba84b9b19f90164cdfe4 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "toolbox/list.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/classcache.h"
 #include "vm/exceptions.hpp"
 #include "vm/options.h"
index d3c9b82864ecbdc6612672eb9fbd03bf0821f310..3daafd6f6f5da3e881511d993545d916f1443630 100644 (file)
@@ -33,7 +33,7 @@
 #include "toolbox/bitvector.h"
 #include "toolbox/worklist.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 
 #include "vm/jit/jit.hpp" /* icmd_table */
 
index 88dd6a90495bce129fbbead02134d50d0ab4d094..709560e19865d0ff9073a4e675a1ec5fcced1fa3 100644 (file)
@@ -33,7 +33,7 @@
 #include "toolbox/bitvector.h"
 #include "toolbox/worklist.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 
 #include "vm/jit/jit.hpp" /* icmd_table */
 
index 26fe8ff83af7afea89f14c977b5a5cdf29279fda..504a667475ddf695f5b4bb8d2d4cb9e4db36a5bd 100644 (file)
@@ -33,7 +33,7 @@
 #include "toolbox/bitvector.h"
 #include "toolbox/worklist.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 
 #include "vm/jit/jit.hpp" /* icmd_table */
 
index e616f3cf55f5440ff3cac8bb9d5a27d0577fefc4..b5cf81a48b9966bff65a1056ed45c52535b85473 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/linker.h"
index c22682d8081395fa0ce3cc3d4b9211045df91a53..339d0dc3d332a09e67135bc25a84c99b79aede92 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 1f026257b055ac7161263a768bb9dd0f4039b6ca..d2e6bf2313e963153948df503ede60f17255d6aa 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/signallocal.h"
 
index cfa9704080fe6fd00a7d7f4c709e8a7d92ef5ef9..02c95b6d431b4a802661d665b7172d673b1ae59d 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 #include "vm/os.hpp"
 
index d7ef9bc431ffe0f656d007f7ff6e2a92e36d4744..581833fdcfadbc0cf83468372fb2583c353fb235 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 97606fb885b674453009dba772fce929db72c0de..62767c17e7365056411ad389ecd04ca03ed48afb 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index e3821b7d01af5400daec2c7680d78373f9d52000..977992e33b2c4439eb3c50ea5f416cdec376527b 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 #include "vm/os.hpp"
 
index 660adfd959cd23dc0835ea23d6a136db1bdf8190..8d79587ae62f33b53079419cbaaa5987d51cdac1 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 88b8ad4d4729e2127759296403f1bbb18103d7c7..acf4e6dae314fd5328ecd54974f5f12008b5a249 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 25a7d3bb4ea2216d18674c8b7766c9d85805e7fa..46ffbc4303df94a8cfcddb895218b2b31c20592e 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/global.h"
 #include "vm/types.h"
 #include "vm/options.h"
index 57533fd8202f6782ab1cd386eaa4e283f7fbe4d3..bd9c5e2e8770d426109dcc12ef17b0c569316ff0 100644 (file)
@@ -31,7 +31,7 @@
 #include "mm/memory.h"
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index bcaa323818ab92826bb61c8e796a5f0c7840cf48..3c52ed352092328ce36a2ce1ab3ae14be593d9d3 100644 (file)
@@ -35,7 +35,7 @@
 #include "threads/lock-common.h"
 
 #include "vm/global.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/options.h"
 #include "vm/string.hpp"
 #include "vm/vm.hpp"
index 2457cae337c6fd633322173300360f23f8917dba..6ac7e7b9aac3bd235ee561baa15627c48dc95d9b 100644 (file)
@@ -42,7 +42,7 @@
 #include "native/localref.h"
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 9eedcb3290ec2388dda1f5b8e0333c33d525cd6b..0b4f66491a762a6104fc6e2c2a174b36e14a307e 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "mm/memory.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/options.h"
 
 #include "vm/jit/abi.h"
index 56536ee1425a69894df1ee3bbe6b47dee8c92e4c..b1510a72aeeae8aa58c7b215fc4c94098694e980 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/field.h"
index 71998ccde71fe7a196c8916ebd288c7af635acc1..8931c8a3a2923ae58dc67877e652c4ae88b92315 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/options.h"
index 8a6f44d17a04cf0f5236c2a3c20928a3b3f0ffe1..96177983309195662414136b718852343bc5da21 100644 (file)
@@ -46,7 +46,7 @@
 #include "toolbox/logging.h"
 
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/cycles-stats.h"
 #include "vm/exceptions.hpp"
index 90c693094bb84e235e8c1a259ccefc921ecb7a16..5ce3d5008c6b6614394f7ff5dd4e5d0880a04246 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "vm/types.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "mm/memory.h"
 
 #include "vm/array.h"
index 3bda890361dce6e68bbd31de14ba72c89f0d7010..ef2c24eb5c7905dbcfde70c86197fd320c6bf222 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "vm/access.h"
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/globals.hpp"
 #include "vm/loader.h"
index c18c1eb536fb1ba58bf84398de0d08185efd7510..fd58773856f4d0f79881bddc703604648de14bec 100644 (file)
@@ -149,7 +149,7 @@ error reporting.
 
 #include "vm/access.h"
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index 3667689aff3122e109bd1b4186e4ce06ce43a25b..dcf2c287ec1c4f7fc209828e87a46feb1ba69504 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "threads/lock-common.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
 #include "vm/loader.h"
index 38d1306e6c953e700a2850379f96c728b9421cb2..4f3b27585c301b7f86b9100855e7c9692d12baae 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 
 #include "vm/jit/asmpart.h"
index 02f362470595aea7c81080bbf9ffa0aca5c6a71c..3c8a813393bd7ffc3115c7edec41ed8b470d059d 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/field.h"
 #include "vm/initialize.h"
index 5619c9b04087be24fc6b891aa3a27512ba3052b1..14824a49e62a305f34c122b52b9873e24abb0b4e 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "threads/thread.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/signallocal.h"
 
 #include "vm/jit/asmpart.h"
index 46c403c228d22012c4c56dfd1368be418a20081c..3a97b34e0802d248b00a82fc67d550f98f1ac85b 100644 (file)
@@ -40,7 +40,7 @@
 #include "toolbox/hashtable.h"
 #include "toolbox/logging.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/classcache.h"
 #include "vm/exceptions.hpp"
 #include "vm/field.h"
index 016ba715c9cd81da6809e43cb93a8195bb9a3e93..d5c2842120c2c7803f3dafea3a16f27e6bc6cfc2 100644 (file)
@@ -38,7 +38,7 @@
 #include "threads/lock-common.h"
 
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
index 076b25a5ca79cf02561e4356042b92200fe51fb1..868d41c957a99eaef4f68409243acc2849e2d197 100644 (file)
@@ -42,7 +42,7 @@ typedef struct codeinfo            codeinfo;
 #include "config.h"
 #include "vm/types.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/descriptor.h"
 #include "vm/global.h"
 #include "vm/linker.h"
index 824e21e5265c9f45c12cff3399b0aceece4fe2cd..7a393b610535ee40e71fa6e522fda0a619a68a1e 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "native/llni.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
 #include "vm/global.h"
 #include "vm/globals.hpp"
index 3267c9285ad98acbe007e9ca9abba9910d148971..67f28268e974ff9e91cf5671c0544bb72e07cdfe 100644 (file)
@@ -40,7 +40,7 @@
 #include "threads/lock-common.h"
 
 #include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/globals.hpp"
 #include "vm/javaobjects.hpp"
index a7636ccb85db4dd89b7c9ad46d9da6cab773ec47..93c154abb43fb3e6e8532fc88d9b3c9c802e048f 100644 (file)
@@ -63,7 +63,7 @@
 #include "vm/assertion.h"
 #endif
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/classcache.h"
 #include "vm/exceptions.hpp"
 #include "vm/finalizer.h"