changeset 2267:61d5e01c802e

Split arm assembler and Shark into different directories so that Shark is not copied for hs19 builds (hs19 includes Shark). 2010-09-22 Andrew John Hughes <ahughes@redhat.com> * ports/hotspot/make/linux/makefiles/shark.make, * ports/hotspot/src/cpu/zero/vm/asm_helper.cpp, * ports/hotspot/src/cpu/zero/vm/bytecodes_arm.def, * ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S, * ports/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp, * ports/hotspot/src/cpu/zero/vm/thumb2.cpp, * ports/hotspot/src/share/vm/includeDB_shark, * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp, * ports/hotspot/src/share/vm/shark/llvmValue.hpp, * ports/hotspot/src/share/vm/shark/sharkBlock.cpp, * ports/hotspot/src/share/vm/shark/sharkBlock.hpp, * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp, * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp, * ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp, * ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp, * ports/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp, * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp, * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp, * ports/hotspot/src/share/vm/shark/sharkConstant.cpp, * ports/hotspot/src/share/vm/shark/sharkConstant.hpp, * ports/hotspot/src/share/vm/shark/sharkContext.cpp, * ports/hotspot/src/share/vm/shark/sharkContext.hpp, * ports/hotspot/src/share/vm/shark/sharkEntry.hpp, * ports/hotspot/src/share/vm/shark/sharkFunction.cpp, * ports/hotspot/src/share/vm/shark/sharkFunction.hpp, * ports/hotspot/src/share/vm/shark/sharkInliner.cpp, * ports/hotspot/src/share/vm/shark/sharkInliner.hpp, * ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp, * ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp, * ports/hotspot/src/share/vm/shark/sharkInvariants.cpp, * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp, * ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp, * ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp, * ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp, * ports/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp, * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp, * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp, * ports/hotspot/src/share/vm/shark/sharkStack.cpp, * ports/hotspot/src/share/vm/shark/sharkStack.hpp, * ports/hotspot/src/share/vm/shark/sharkState.cpp, * ports/hotspot/src/share/vm/shark/sharkState.hpp, * ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp, * ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp, * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp, * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp, * ports/hotspot/src/share/vm/shark/sharkType.hpp, * ports/hotspot/src/share/vm/shark/sharkValue.cpp, * ports/hotspot/src/share/vm/shark/sharkValue.hpp, * ports/hotspot/src/share/vm/shark/shark_globals.cpp, * ports/hotspot/src/share/vm/shark/shark_globals.hpp, * ports/hotspot/tools/mkbc.c: Split into arm_port and shark directories. * Makefile.am: Only copy Shark when hs17 is built. hs19 includes Shark and the in-tree Shark fails to build with it. * arm_port/hotspot/src/cpu/zero/vm/asm_helper.cpp, * arm_port/hotspot/src/cpu/zero/vm/bytecodes_arm.def, * arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S, * arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp, * arm_port/hotspot/tools/mkbc.c: New location of arm assembler files. * shark/hotspot/make/linux/makefiles/shark.make, * shark/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp, * shark/hotspot/src/share/vm/includeDB_shark, * shark/hotspot/src/share/vm/shark/llvmHeaders.hpp, * shark/hotspot/src/share/vm/shark/llvmValue.hpp, * shark/hotspot/src/share/vm/shark/sharkBlock.cpp, * shark/hotspot/src/share/vm/shark/sharkBlock.hpp, * shark/hotspot/src/share/vm/shark/sharkBuilder.cpp, * shark/hotspot/src/share/vm/shark/sharkBuilder.hpp, * shark/hotspot/src/share/vm/shark/sharkCacheDecache.cpp, * shark/hotspot/src/share/vm/shark/sharkCacheDecache.hpp, * shark/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp, * shark/hotspot/src/share/vm/shark/sharkCompiler.cpp, * shark/hotspot/src/share/vm/shark/sharkCompiler.hpp, * shark/hotspot/src/share/vm/shark/sharkConstant.cpp, * shark/hotspot/src/share/vm/shark/sharkConstant.hpp, * shark/hotspot/src/share/vm/shark/sharkContext.cpp, * shark/hotspot/src/share/vm/shark/sharkContext.hpp, * shark/hotspot/src/share/vm/shark/sharkEntry.hpp, * shark/hotspot/src/share/vm/shark/sharkFunction.cpp, * shark/hotspot/src/share/vm/shark/sharkFunction.hpp, * shark/hotspot/src/share/vm/shark/sharkInliner.cpp, * shark/hotspot/src/share/vm/shark/sharkInliner.hpp, * shark/hotspot/src/share/vm/shark/sharkIntrinsics.cpp, * shark/hotspot/src/share/vm/shark/sharkIntrinsics.hpp, * shark/hotspot/src/share/vm/shark/sharkInvariants.cpp, * shark/hotspot/src/share/vm/shark/sharkInvariants.hpp, * shark/hotspot/src/share/vm/shark/sharkMemoryManager.cpp, * shark/hotspot/src/share/vm/shark/sharkMemoryManager.hpp, * shark/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp, * shark/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp, * shark/hotspot/src/share/vm/shark/sharkRuntime.cpp, * shark/hotspot/src/share/vm/shark/sharkRuntime.hpp, * shark/hotspot/src/share/vm/shark/sharkStack.cpp, * shark/hotspot/src/share/vm/shark/sharkStack.hpp, * shark/hotspot/src/share/vm/shark/sharkState.cpp, * shark/hotspot/src/share/vm/shark/sharkState.hpp, * shark/hotspot/src/share/vm/shark/sharkStateScanner.cpp, * shark/hotspot/src/share/vm/shark/sharkStateScanner.hpp, * shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp, * shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp, * shark/hotspot/src/share/vm/shark/sharkType.hpp, * shark/hotspot/src/share/vm/shark/sharkValue.cpp, * shark/hotspot/src/share/vm/shark/sharkValue.hpp, * shark/hotspot/src/share/vm/shark/shark_globals.cpp, * shark/hotspot/src/share/vm/shark/shark_globals.hpp: New location of Shark.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 22 Sep 2010 16:27:14 +0100
parents e4c712442cf1
children fd61403cdd41
files ChangeLog Makefile.am arm_port/hotspot/src/cpu/zero/vm/asm_helper.cpp arm_port/hotspot/src/cpu/zero/vm/bytecodes_arm.def arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp arm_port/hotspot/tools/mkbc.c ports/hotspot/make/linux/makefiles/shark.make ports/hotspot/src/cpu/zero/vm/asm_helper.cpp ports/hotspot/src/cpu/zero/vm/bytecodes_arm.def ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S ports/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp ports/hotspot/src/cpu/zero/vm/thumb2.cpp ports/hotspot/src/share/vm/includeDB_shark ports/hotspot/src/share/vm/shark/llvmHeaders.hpp ports/hotspot/src/share/vm/shark/llvmValue.hpp ports/hotspot/src/share/vm/shark/sharkBlock.cpp ports/hotspot/src/share/vm/shark/sharkBlock.hpp ports/hotspot/src/share/vm/shark/sharkBuilder.cpp ports/hotspot/src/share/vm/shark/sharkBuilder.hpp ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp ports/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp ports/hotspot/src/share/vm/shark/sharkCompiler.cpp ports/hotspot/src/share/vm/shark/sharkCompiler.hpp ports/hotspot/src/share/vm/shark/sharkConstant.cpp ports/hotspot/src/share/vm/shark/sharkConstant.hpp ports/hotspot/src/share/vm/shark/sharkContext.cpp ports/hotspot/src/share/vm/shark/sharkContext.hpp ports/hotspot/src/share/vm/shark/sharkEntry.hpp ports/hotspot/src/share/vm/shark/sharkFunction.cpp ports/hotspot/src/share/vm/shark/sharkFunction.hpp ports/hotspot/src/share/vm/shark/sharkInliner.cpp ports/hotspot/src/share/vm/shark/sharkInliner.hpp ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp ports/hotspot/src/share/vm/shark/sharkInvariants.cpp ports/hotspot/src/share/vm/shark/sharkInvariants.hpp ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp ports/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp ports/hotspot/src/share/vm/shark/sharkRuntime.cpp ports/hotspot/src/share/vm/shark/sharkRuntime.hpp ports/hotspot/src/share/vm/shark/sharkStack.cpp ports/hotspot/src/share/vm/shark/sharkStack.hpp ports/hotspot/src/share/vm/shark/sharkState.cpp ports/hotspot/src/share/vm/shark/sharkState.hpp ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp ports/hotspot/src/share/vm/shark/sharkType.hpp ports/hotspot/src/share/vm/shark/sharkValue.cpp ports/hotspot/src/share/vm/shark/sharkValue.hpp ports/hotspot/src/share/vm/shark/shark_globals.cpp ports/hotspot/src/share/vm/shark/shark_globals.hpp ports/hotspot/tools/mkbc.c shark/hotspot/make/linux/makefiles/shark.make shark/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp shark/hotspot/src/share/vm/includeDB_shark shark/hotspot/src/share/vm/shark/llvmHeaders.hpp shark/hotspot/src/share/vm/shark/llvmValue.hpp shark/hotspot/src/share/vm/shark/sharkBlock.cpp shark/hotspot/src/share/vm/shark/sharkBlock.hpp shark/hotspot/src/share/vm/shark/sharkBuilder.cpp shark/hotspot/src/share/vm/shark/sharkBuilder.hpp shark/hotspot/src/share/vm/shark/sharkCacheDecache.cpp shark/hotspot/src/share/vm/shark/sharkCacheDecache.hpp shark/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp shark/hotspot/src/share/vm/shark/sharkCompiler.cpp shark/hotspot/src/share/vm/shark/sharkCompiler.hpp shark/hotspot/src/share/vm/shark/sharkConstant.cpp shark/hotspot/src/share/vm/shark/sharkConstant.hpp shark/hotspot/src/share/vm/shark/sharkContext.cpp shark/hotspot/src/share/vm/shark/sharkContext.hpp shark/hotspot/src/share/vm/shark/sharkEntry.hpp shark/hotspot/src/share/vm/shark/sharkFunction.cpp shark/hotspot/src/share/vm/shark/sharkFunction.hpp shark/hotspot/src/share/vm/shark/sharkInliner.cpp shark/hotspot/src/share/vm/shark/sharkInliner.hpp shark/hotspot/src/share/vm/shark/sharkIntrinsics.cpp shark/hotspot/src/share/vm/shark/sharkIntrinsics.hpp shark/hotspot/src/share/vm/shark/sharkInvariants.cpp shark/hotspot/src/share/vm/shark/sharkInvariants.hpp shark/hotspot/src/share/vm/shark/sharkMemoryManager.cpp shark/hotspot/src/share/vm/shark/sharkMemoryManager.hpp shark/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp shark/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp shark/hotspot/src/share/vm/shark/sharkRuntime.cpp shark/hotspot/src/share/vm/shark/sharkRuntime.hpp shark/hotspot/src/share/vm/shark/sharkStack.cpp shark/hotspot/src/share/vm/shark/sharkStack.hpp shark/hotspot/src/share/vm/shark/sharkState.cpp shark/hotspot/src/share/vm/shark/sharkState.hpp shark/hotspot/src/share/vm/shark/sharkStateScanner.cpp shark/hotspot/src/share/vm/shark/sharkStateScanner.hpp shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp shark/hotspot/src/share/vm/shark/sharkType.hpp shark/hotspot/src/share/vm/shark/sharkValue.cpp shark/hotspot/src/share/vm/shark/sharkValue.hpp shark/hotspot/src/share/vm/shark/shark_globals.cpp shark/hotspot/src/share/vm/shark/shark_globals.hpp
diffstat 104 files changed, 34796 insertions(+), 34674 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 21 17:37:58 2010 +0200
+++ b/ChangeLog	Wed Sep 22 16:27:14 2010 +0100
@@ -1,3 +1,113 @@
+2010-09-22  Andrew John Hughes  <ahughes@redhat.com>
+
+	* ports/hotspot/make/linux/makefiles/shark.make,
+	* ports/hotspot/src/cpu/zero/vm/asm_helper.cpp,
+	* ports/hotspot/src/cpu/zero/vm/bytecodes_arm.def,
+	* ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S,
+	* ports/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp,
+	* ports/hotspot/src/cpu/zero/vm/thumb2.cpp,
+	* ports/hotspot/src/share/vm/includeDB_shark,
+	* ports/hotspot/src/share/vm/shark/llvmHeaders.hpp,
+	* ports/hotspot/src/share/vm/shark/llvmValue.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkBlock.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkBlock.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkCompiler.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkCompiler.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkConstant.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkConstant.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkContext.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkContext.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkEntry.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkFunction.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkFunction.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkInliner.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkInliner.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkInvariants.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkInvariants.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkStack.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkStack.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkState.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkState.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkType.hpp,
+	* ports/hotspot/src/share/vm/shark/sharkValue.cpp,
+	* ports/hotspot/src/share/vm/shark/sharkValue.hpp,
+	* ports/hotspot/src/share/vm/shark/shark_globals.cpp,
+	* ports/hotspot/src/share/vm/shark/shark_globals.hpp,
+	* ports/hotspot/tools/mkbc.c:
+	Split into arm_port and shark directories.
+	* Makefile.am: Only copy Shark when hs17 is built.
+	hs19 includes Shark and the in-tree Shark fails to build with it.
+	* arm_port/hotspot/src/cpu/zero/vm/asm_helper.cpp,
+	* arm_port/hotspot/src/cpu/zero/vm/bytecodes_arm.def,
+	* arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S,
+	* arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp,
+	* arm_port/hotspot/tools/mkbc.c:
+	New location of arm assembler files.
+	* shark/hotspot/make/linux/makefiles/shark.make,
+	* shark/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp,
+	* shark/hotspot/src/share/vm/includeDB_shark,
+	* shark/hotspot/src/share/vm/shark/llvmHeaders.hpp,
+	* shark/hotspot/src/share/vm/shark/llvmValue.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkBlock.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkBlock.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkBuilder.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkBuilder.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkCacheDecache.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkCacheDecache.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkCompiler.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkCompiler.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkConstant.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkConstant.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkContext.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkContext.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkEntry.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkFunction.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkFunction.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkInliner.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkInliner.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkIntrinsics.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkIntrinsics.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkInvariants.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkInvariants.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkMemoryManager.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkMemoryManager.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkRuntime.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkRuntime.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkStack.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkStack.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkState.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkState.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkStateScanner.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkStateScanner.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkType.hpp,
+	* shark/hotspot/src/share/vm/shark/sharkValue.cpp,
+	* shark/hotspot/src/share/vm/shark/sharkValue.hpp,
+	* shark/hotspot/src/share/vm/shark/shark_globals.cpp,
+	* shark/hotspot/src/share/vm/shark/shark_globals.hpp:
+	New location of Shark.
+
 2010-09-21  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* Makefile.am:
--- a/Makefile.am	Tue Sep 21 17:37:58 2010 +0200
+++ b/Makefile.am	Wed Sep 22 16:27:14 2010 +0100
@@ -524,7 +524,7 @@
 
 EXTRA_DIST = generated $(NETX_SRCDIR) \
 	$(abs_top_srcdir)/patches/* \
-	contrib ports \
+	contrib shark arm_port \
 	extra overlays \
 	javaws.png javaws.desktop \
 	jconsole.desktop policytool.desktop \
@@ -881,11 +881,11 @@
 
 # Copy ports sources into tree
 stamps/ports.stamp: stamps/replace-hotspot.stamp
-	for target in $(abs_top_srcdir)/ports/hotspot/make/*/makefiles/* \
-		      $(abs_top_srcdir)/ports/hotspot/tools \
-		      $(abs_top_srcdir)/ports/hotspot/src/*cpu/* \
-		      $(abs_top_srcdir)/ports/hotspot/src/share/vm/*; do \
-	  link=$$(dirname $$target | sed 's/^.*ports/openjdk/'); \
+if !WITH_ALT_HSBUILD
+	for target in $(abs_top_srcdir)/shark/hotspot/make/*/makefiles/* \
+		      $(abs_top_srcdir)/shark/hotspot/src/*cpu/* \
+		      $(abs_top_srcdir)/shark/hotspot/src/share/vm/*; do \
+	  link=$$(dirname $$target | sed 's/^.*shark/openjdk/'); \
 	  cp -rv $$target $$link; \
 	done
 	if ! test "x$(WITH_CACAO)" = "xno" ; then \
@@ -897,19 +897,31 @@
 	  ln -sf $(abs_top_builddir)/ergo.c \
 	    openjdk/jdk/src/solaris/bin/ergo_$(BUILD_ARCH_DIR).c; \
 	fi
+endif
+	for target in $(abs_top_srcdir)/arm_port/hotspot/tools \
+		      $(abs_top_srcdir)/arm_port/hotspot/src/*cpu/* ; do \
+	  link=$$(dirname $$target | sed 's/^.*arm_port/openjdk/'); \
+	  cp -rv $$target $$link; \
+	done
 	mkdir -p stamps
 	touch stamps/ports.stamp
 
 clean-ports:
-	for target in $(abs_top_srcdir)/ports/hotspot/make/*/makefiles/* \
-		      $(abs_top_srcdir)/ports/hotspot/tools \
-		      $(abs_top_srcdir)/ports/hotspot/src/*cpu/* \
-		      $(abs_top_srcdir)/ports/hotspot/src/share/vm/*; do \
-	  link=$$(echo $$target | sed 's/^.*ports/openjdk/'); \
+if !WITH_ALT_HSBUILD
+	for target in $(abs_top_srcdir)/shark/hotspot/make/*/makefiles/* \
+		      $(abs_top_srcdir)/shark/hotspot/src/*cpu/* \
+		      $(abs_top_srcdir)/shark/hotspot/src/share/vm/*; do \
+	  link=$$(dirname $$target | sed 's/^.*shark/openjdk/'); \
 	  rm -rf $$link; \
 	done
 	rm -f openjdk/jdk/src/solaris/bin/$(BUILD_ARCH_DIR)/jvm.cfg
 	rm -f openjdk/jdk/src/solaris/bin/ergo_$(BUILD_ARCH_DIR).c 
+endif
+	for target in $(abs_top_srcdir)/arm_port/hotspot/tools \
+		      $(abs_top_srcdir)/arm_port/hotspot/src/*cpu/* ; do \
+	  link=$$(dirname $$target | sed 's/^.*arm_port/openjdk/'); \
+	  rm -rf $$link; \
+	done
 	rm -f stamps/ports.stamp
 
 stamps/generated.stamp: stamps/ports.stamp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arm_port/hotspot/src/cpu/zero/vm/asm_helper.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,583 @@
+/*
+ * Copyright 2009, 2010 Edward Nevill
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define	ARCH_THUMBEE	(1<<16)
+#define ARCH_VFP	(1<<17)
+#define ARCH_CLZ	(1<<18)
+
+#ifndef STATIC_OFFSETS
+
+#include "incls/_bytecodeInterpreter.cpp.incl"
+
+#include <linux/auxvec.h>
+#include <asm/hwcap.h>
+
+#define VECBUFF_SIZE 64
+
+extern "C" unsigned hwcap(void)
+{
+  int fd;
+  unsigned vecs[VECBUFF_SIZE];
+  unsigned *p;
+  int i, n;
+  unsigned rc = 0;
+  unsigned arch = 4;
+ 
+  fd = open("/proc/self/auxv", O_RDONLY);
+  if (fd < 0) return 0;
+  do {
+    n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned));
+    p = vecs;
+    i = n/8;
+    while (--i >= 0) {
+      unsigned tag = *p++;
+      unsigned value = *p++;
+      if (tag == 0) goto fini;
+      if (tag == AT_HWCAP) {
+	if (value & HWCAP_THUMBEE) rc |= ARCH_THUMBEE;
+	if (value & HWCAP_VFP) rc |= ARCH_VFP;
+      } else if (tag == AT_PLATFORM) {
+	const char *s = (const char *)value;
+	int c;
+
+	if (*s++ == 'v') {
+	  arch = 0;
+	  while ((isdigit)(c = *s++)) arch = arch * 10 + c - '0';
+	}
+      }
+    }
+  } while (n == VECBUFF_SIZE * sizeof(unsigned));
+fini:
+  close(fd);
+//  printf("arch = %d, rc = 0x%08x\n", arch, rc);
+  if (arch >= 5) rc |= ARCH_CLZ;
+  if (arch >= 7) rc |= ARCH_THUMBEE;
+  return rc | (1<<arch);
+}
+
+/* Thease functions allow the ASM interpreter to call CPP virtual functions.
+ * Otherwise the ASM interpreter has to grup around in the VTABLE which is
+ * not very portable.
+ */
+extern "C" bool JavaThread_is_lock_owned(JavaThread *r0, address r1)
+{
+	return r0->is_lock_owned(r1);
+}
+
+extern "C" HeapWord **CollectedHeap_top_addr(CollectedHeap *r0)
+{
+	return r0->top_addr();
+}
+
+extern "C" HeapWord **CollectedHeap_end_addr(CollectedHeap *r0)
+{
+	return r0->end_addr();
+}
+
+extern "C" char *SharedRuntime_generate_class_cast_message(const char *name, const char *klass)
+{
+	return SharedRuntime::generate_class_cast_message(name, klass);
+}
+
+#define HELPER_THROW(thread, name, msg) Exceptions::_throw_msg(thread, __FILE__, __LINE__, name, msg)
+
+class VMStructs {
+public:
+	static inline klassOop klass_at_addr(constantPoolOop constants, u2 index) {
+	  return (klassOop) *constants->obj_at_addr(index);
+	}
+};
+
+extern "C" oop Helper_new(interpreterState istate, unsigned index)
+{
+    JavaThread *thread = istate->thread();
+
+    constantPoolOop constants = istate->method()->constants();
+    oop result = NULL;
+    if (!constants->tag_at(index).is_unresolved_klass()) {
+      // Make sure klass is initialized and doesn't have a finalizer
+      oop entry = VMStructs::klass_at_addr(constants, index);
+      klassOop k_entry = (klassOop) entry;
+      instanceKlass* ik = (instanceKlass*) k_entry->klass_part();
+      if ( ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
+	size_t obj_size = ik->size_helper();
+	// If the TLAB isn't pre-zeroed then we'll have to do it
+	bool need_zero = !ZeroTLAB;
+	if (UseTLAB) {
+	  result = (oop) thread->tlab().allocate(obj_size);
+	}
+	if (result == NULL) {
+	  need_zero = true;
+	  // Try allocate in shared eden
+    retry:
+	  HeapWord* compare_to = *Universe::heap()->top_addr();
+	  HeapWord* new_top = compare_to + obj_size;
+	  if (new_top <= *Universe::heap()->end_addr()) {
+	    if (Atomic::cmpxchg_ptr(new_top, Universe::heap()->top_addr(), compare_to) != compare_to) {
+	      goto retry;
+	    }
+	    result = (oop) compare_to;
+	  }
+	}
+	if (result != NULL) {
+	  // Initialize object (if nonzero size and need) and then the header
+	  if (need_zero ) {
+	    HeapWord* to_zero = (HeapWord*) result + sizeof(oopDesc) / oopSize;
+	    obj_size -= sizeof(oopDesc) / oopSize;
+	    if (obj_size > 0 ) {
+	      memset(to_zero, 0, obj_size * HeapWordSize);
+	    }
+	  }
+	  if (UseBiasedLocking) {
+	    result->set_mark(ik->prototype_header());
+	  } else {
+	    result->set_mark(markOopDesc::prototype());
+	  }
+	  result->set_klass_gap(0);
+	  result->set_klass(k_entry);
+	  return result;
+	}
+      }
+    }
+    // Slow case allocation
+    InterpreterRuntime::_new(thread, istate->method()->constants(), index);
+    result = thread->vm_result();
+    thread->set_vm_result(NULL);
+    return result;
+}
+
+extern "C" int Helper_instanceof(interpreterState istate, unsigned index, oop tos)
+{
+    if (tos == NULL) return 0;
+
+    // Constant pool may have actual klass or unresolved klass. If it is
+    // unresolved we must resolve it
+    if (istate->method()->constants()->tag_at(index).is_unresolved_klass()) {
+      InterpreterRuntime::quicken_io_cc(istate->thread());
+      if (istate->thread()->has_pending_exception()) return 0;
+    }
+    klassOop klassOf = VMStructs::klass_at_addr(istate->method()->constants(), index);
+    klassOop objKlassOop = tos->klass();
+    //
+    // Check for compatibilty. This check must not GC!!
+    // Seems way more expensive now that we must dispatch
+    //
+    return objKlassOop == klassOf || objKlassOop->klass_part()->is_subtype_of(klassOf);
+}
+
+extern "C" oop Helper_checkcast(interpreterState istate, unsigned index, oop tos)
+{
+    if (tos == NULL) return NULL;
+
+    // Constant pool may have actual klass or unresolved klass. If it is
+    // unresolved we must resolve it
+    if (istate->method()->constants()->tag_at(index).is_unresolved_klass()) {
+      oop except_oop;
+      InterpreterRuntime::quicken_io_cc(istate->thread());
+      if (except_oop = istate->thread()->pending_exception()) return except_oop;
+    }
+    klassOop klassOf = VMStructs::klass_at_addr(istate->method()->constants(), index);
+    klassOop objKlassOop = tos->klass(); //ebx
+    //
+    // Check for compatibilty. This check must not GC!!
+    // Seems way more expensive now that we must dispatch
+    //
+    if (objKlassOop != klassOf && !objKlassOop->klass_part()->is_subtype_of(klassOf)) {
+      ResourceMark rm(istate->thread());
+      const char* objName = Klass::cast(objKlassOop)->external_name();
+      const char* klassName = Klass::cast(klassOf)->external_name();
+      char* message = SharedRuntime::generate_class_cast_message(objName, klassName);
+      ThreadInVMfromJava trans(istate->thread());
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_ClassCastException(), message);
+    }
+    return istate->thread()->pending_exception();
+}
+
+extern "C" oop Helper_aastore(interpreterState istate, oop value, int index, arrayOop arrayref)
+{
+    if (arrayref == NULL) {
+      ThreadInVMfromJava trans(istate->thread());
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_NullPointerException(), "");
+    } else if ((uint32_t)index >= (uint32_t)arrayref->length()) {
+      char message[jintAsStringSize];
+      sprintf(message, "%d", index);
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
+    } else {
+      if (value != NULL) {
+	/* Check assignability of value into arrayref */
+	klassOop rhsKlassOop = value->klass(); // EBX (subclass)
+	klassOop elemKlassOop = ((objArrayKlass*) arrayref->klass()->klass_part())->element_klass();
+	//
+	// Check for compatibilty. This check must not GC!!
+	// Seems way more expensive now that we must dispatch
+	//
+	if (rhsKlassOop != elemKlassOop && !rhsKlassOop->klass_part()->is_subtype_of(elemKlassOop)) {
+	  HELPER_THROW(istate->thread(), vmSymbols::java_lang_ArrayStoreException(), "");
+	  goto handle_exception;
+	}
+      }
+      oop* elem_loc = (oop*)(((address) arrayref->base(T_OBJECT)) + index * sizeof(oop));
+      // *(oop*)(((address) arrayref->base(T_OBJECT)) + index * sizeof(oop)) = value;
+      *elem_loc = value;
+      // Mark the card
+      BarrierSet* bs = Universe::heap()->barrier_set();
+      static volatile jbyte* _byte_map_base = (volatile jbyte*)(((CardTableModRefBS*)bs)->byte_map_base);
+      OrderAccess::release_store(&_byte_map_base[(uintptr_t)elem_loc >> CardTableModRefBS::card_shift], 0);
+    }
+handle_exception:
+    return istate->thread()->pending_exception();
+}
+
+extern "C" void Helper_aputfield(oop obj)
+{
+      BarrierSet* bs = Universe::heap()->barrier_set();
+      static volatile jbyte* _byte_map_base = (volatile jbyte*)(((CardTableModRefBS*)bs)->byte_map_base);
+      OrderAccess::release_store(&_byte_map_base[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
+}
+
+extern "C" oop Helper_synchronized_enter(JavaThread *thread, BasicObjectLock *mon)
+{
+    BasicLock *lock = mon->lock();
+    markOop displaced = lock->displaced_header();
+
+    if (thread->is_lock_owned((address)displaced->clear_lock_bits()))
+      lock->set_displaced_header(NULL);
+    else
+      InterpreterRuntime::monitorenter(thread, mon);
+    return thread->pending_exception();
+}
+
+extern "C" oop Helper_synchronized_exit(JavaThread *thread, BasicObjectLock *mon)
+{
+    {
+      HandleMark __hm(thread);
+      if (mon->obj() == NULL)
+	InterpreterRuntime::throw_illegal_monitor_state_exception(thread);
+      else
+        InterpreterRuntime::monitorexit(thread, mon);
+    }
+    return thread->pending_exception();
+}
+
+extern "C" oop Helper_SafePoint(JavaThread *thread)
+{
+    {
+      HandleMarkCleaner __hmc(thread);
+    }
+    SafepointSynchronize::block(thread);
+    return thread->pending_exception();
+}
+
+extern "C" void Helper_RaiseArrayBoundException(JavaThread *thread, int index)
+{
+  char message[jintAsStringSize];
+  sprintf(message, "%d", index);
+  {
+       ThreadInVMfromJava trans(thread);
+       Exceptions::_throw_msg(thread, "[Bytecoce Interpreter]", 99,
+			vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
+  }
+}
+
+extern "C" void Helper_Raise(JavaThread *thread, symbolOopDesc *name, char const *msg)
+{
+   ThreadInVMfromJava trans(thread);
+   Exceptions::_throw_msg(thread, "[Bytecoce Interpreter]", 99, name, msg);
+}
+
+extern "C" void Helper_RaiseIllegalMonitorException(JavaThread *thread)
+{
+    HandleMark __hm(thread);
+    thread->clear_pending_exception();
+    InterpreterRuntime::throw_illegal_monitor_state_exception(thread);
+}
+
+extern "C" address Helper_HandleException(interpreterState istate, JavaThread *thread)
+{
+    HandleMarkCleaner __hmc(thread);
+    Handle except_oop(thread, thread->pending_exception());
+    HandleMark __hm(thread);
+    intptr_t continuation_bci;
+    intptr_t *topOfStack;
+    address pc;
+
+    thread->clear_pending_exception();
+    continuation_bci = (intptr_t)InterpreterRuntime::exception_handler_for_exception(thread, except_oop());
+    except_oop = (oop) thread->vm_result();
+    thread->set_vm_result(NULL);
+    if (continuation_bci >= 0) {
+      topOfStack = (intptr_t *)istate->stack();
+      *topOfStack-- = (intptr_t)except_oop();
+      istate->set_stack(topOfStack);
+      pc = istate->method()->code_base() + continuation_bci;
+#if 0
+        tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", Klass::cast(except_oop->klass())->external_name(), except_oop());
+        tty->print_cr(" thrown in interpreter method <%s>", istate->method()->name_and_sig_as_C_string());
+        tty->print_cr(" at bci %d, continuing at %d for thread " INTPTR_FORMAT,
+                      pc - (intptr_t)istate->method()->code_base(),
+                      continuation_bci, thread);
+#endif
+      return pc;
+    }
+#if 0
+      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", Klass::cast(except_oop->klass())->external_name(), except_oop());
+      tty->print_cr(" thrown in interpreter method <%s>", istate->method()->name_and_sig_as_C_string());
+      tty->print_cr(" at bci %d, unwinding for thread " INTPTR_FORMAT,
+                    pc  - (intptr_t) istate->method()->code_base(),
+                    thread);
+#endif
+    thread->set_pending_exception(except_oop(), NULL, 0);
+    return 0;
+}
+
+#endif // STATIC_OFFSETS
+
+#ifdef STATIC_OFFSETS
+
+#include "incls/_precompiled.incl"
+
+class VMStructs {
+public:
+	static void print_vm_offsets(void);
+};
+
+#define outfile	stdout
+
+void print_def(const char *s, int v)
+{
+	fprintf(outfile, "#undef %-40s\n", s);
+	fprintf(outfile, "#define %-40s 0x%02x\n", s, v);
+}
+
+void nl(void)
+{
+	fputc('\n', outfile);
+}
+
+// ZeroFrame is not friends with VMStructs, but it is with ZeroStackPrinter
+class ZeroStackPrinter {
+public:
+  static void print_vm_offsets(void);
+};
+
+void ZeroStackPrinter::print_vm_offsets(void)
+{
+    print_def("INTERPRETER_FRAME", ZeroFrame::INTERPRETER_FRAME);
+}
+
+void VMStructs::print_vm_offsets(void)
+{
+  print_def("ISTATE_THREAD",    offset_of(BytecodeInterpreter, _thread));
+  print_def("ISTATE_BCP",       offset_of(BytecodeInterpreter, _bcp));
+  print_def("ISTATE_LOCALS",    offset_of(BytecodeInterpreter, _locals));
+  print_def("ISTATE_CONSTANTS", offset_of(BytecodeInterpreter, _constants));
+  print_def("ISTATE_METHOD",    offset_of(BytecodeInterpreter, _method));
+  print_def("ISTATE_STACK",     offset_of(BytecodeInterpreter, _stack));
+  print_def("ISTATE_MSG",       offset_of(BytecodeInterpreter, _msg));
+  print_def("ISTATE_OOP_TEMP",	offset_of(BytecodeInterpreter, _oop_temp));
+  print_def("ISTATE_STACK_BASE",offset_of(BytecodeInterpreter, _stack_base));
+  print_def("ISTATE_STACK_LIMIT",offset_of(BytecodeInterpreter, _stack_limit));
+  print_def("ISTATE_MONITOR_BASE",offset_of(BytecodeInterpreter, _monitor_base));
+  print_def("ISTATE_SELF_LINK",	offset_of(BytecodeInterpreter, _self_link));
+  print_def("ISTATE_FRAME_TYPE", sizeof(BytecodeInterpreter) + 0);
+  print_def("ISTATE_NEXT_FRAME", sizeof(BytecodeInterpreter) + 4);
+  print_def("FRAME_SIZE", sizeof(BytecodeInterpreter) + 8);
+  nl();
+  ZeroStackPrinter::print_vm_offsets();
+  nl();
+  print_def("THREAD_PENDING_EXC", offset_of(JavaThread, _pending_exception));
+  print_def("THREAD_SUSPEND_FLAGS", offset_of(JavaThread, _suspend_flags));
+  print_def("THREAD_ACTIVE_HANDLES", offset_of(JavaThread, _active_handles));
+  print_def("THREAD_LAST_HANDLE_MARK", offset_of(JavaThread, _last_handle_mark));
+  print_def("THREAD_TLAB_TOP", offset_of(JavaThread, _tlab) + offset_of(ThreadLocalAllocBuffer, _top));
+  print_def("THREAD_TLAB_END", offset_of(JavaThread, _tlab) + offset_of(ThreadLocalAllocBuffer, _end));
+  print_def("THREAD_RESOURCEAREA", offset_of(JavaThread, _resource_area));
+  print_def("THREAD_HANDLE_AREA", offset_of(JavaThread, _handle_area));
+  print_def("THREAD_STACK_BASE", offset_of(JavaThread, _stack_base));
+  print_def("THREAD_STACK_SIZE", offset_of(JavaThread, _stack_size));
+  print_def("THREAD_LAST_JAVA_SP", offset_of(JavaThread, _anchor) + offset_of(JavaFrameAnchor, _last_Java_sp));
+  print_def("THREAD_JNI_ENVIRONMENT", offset_of(JavaThread, _jni_environment));
+  print_def("THREAD_VM_RESULT", offset_of(JavaThread, _vm_result));
+  print_def("THREAD_STATE", offset_of(JavaThread, _thread_state));
+  print_def("THREAD_DO_NOT_UNLOCK", offset_of(JavaThread, _do_not_unlock_if_synchronized));
+
+  print_def("THREAD_JAVA_STACK_BASE", offset_of(JavaThread, _zero_stack) + in_bytes(ZeroStack::base_offset()));
+  print_def("THREAD_JAVA_SP", offset_of(JavaThread, _zero_stack) + in_bytes(ZeroStack::sp_offset()));
+  print_def("THREAD_TOP_ZERO_FRAME", offset_of(JavaThread, _top_zero_frame));
+  print_def("THREAD_SPECIALRUNTIMEEXITCONDITION", offset_of(JavaThread, _special_runtime_exit_condition));
+  nl();
+  print_def("_thread_external_suspend",	Thread::_external_suspend);
+  print_def("_thread_ext_suspended",	Thread::_ext_suspended);
+  print_def("_thread_deopt_suspend",	Thread::_deopt_suspend);
+  nl();
+  print_def("METHOD_CONSTMETHOD", offset_of(methodOopDesc, _constMethod));
+  print_def("METHOD_CONSTANTS", offset_of(methodOopDesc, _constants));
+  print_def("METHOD_METHODDATA", offset_of(methodOopDesc, _method_data));
+  print_def("METHOD_INVOKECOUNT", offset_of(methodOopDesc, _interpreter_invocation_count));
+  print_def("METHOD_ACCESSFLAGS", offset_of(methodOopDesc, _access_flags));
+  print_def("METHOD_VTABLEINDEX", offset_of(methodOopDesc, _vtable_index));
+  print_def("METHOD_RESULTINDEX", offset_of(methodOopDesc, _result_index));
+  print_def("METHOD_METHODSIZE", offset_of(methodOopDesc, _method_size));
+  print_def("METHOD_MAXSTACK", offset_of(methodOopDesc, _max_stack));
+  print_def("METHOD_MAXLOCALS", offset_of(methodOopDesc, _max_locals));
+  print_def("METHOD_SIZEOFPARAMETERS", offset_of(methodOopDesc, _size_of_parameters));
+  print_def("METHOD_INVOCATIONCOUNTER", offset_of(methodOopDesc, _invocation_counter));
+  print_def("METHOD_BACKEDGECOUNTER", offset_of(methodOopDesc, _backedge_counter));
+  print_def("METHOD_FROM_INTERPRETED", offset_of(methodOopDesc, _from_interpreted_entry));
+  // ECN: These two appear to be just tagged onto the end of the class
+  print_def("METHOD_NATIVEHANDLER", sizeof(methodOopDesc));
+  print_def("METHOD_SIGNATUREHANDLER", sizeof(methodOopDesc)+4);
+  nl();
+  print_def("CONSTMETHOD_CODESIZE", offset_of(constMethodOopDesc, _code_size));
+  print_def("CONSTMETHOD_CODEOFFSET", sizeof(constMethodOopDesc));
+  nl();
+  print_def("JNIHANDLEBLOCK_TOP", offset_of(JNIHandleBlock, _top));
+  nl();
+  print_def("KLASS_PART", klassOopDesc::klass_part_offset_in_bytes());
+  print_def("KLASS_ACCESSFLAGS", offset_of(Klass, _access_flags));
+  print_def("KLASS_JAVA_MIRROR", offset_of(Klass, _java_mirror));
+  print_def("INSTANCEKLASS_INITSTATE", offset_of(instanceKlass, _init_state));
+  print_def("INSTANCEKLASS_VTABLE_LEN", offset_of(instanceKlass, _vtable_len));
+  print_def("INSTANCEKLASS_ITABLE_LEN", offset_of(instanceKlass, _itable_len));
+  print_def("INSTANCEKLASS_VTABLE_OFFSET", instanceKlass::vtable_start_offset() * sizeof(int *));
+  print_def("OBJARRAYKLASS_ELEMENTKLASS", offset_of(objArrayKlass, _element_klass));
+  nl();
+  print_def("CONSTANTPOOL_TAGS", offset_of(constantPoolOopDesc, _tags));
+  print_def("CONSTANTPOOL_CACHE", offset_of(constantPoolOopDesc, _cache));
+  print_def("CONSTANTPOOL_POOL_HOLDER", offset_of(constantPoolOopDesc, _pool_holder));
+  print_def("CONSTANTPOOL_BASE", sizeof(constantPoolOopDesc));
+  nl();
+  print_def("CP_OFFSET", in_bytes(constantPoolCacheOopDesc::base_offset()));
+  nl();
+  print_def("BASE_OFFSET_BYTE", arrayOopDesc::base_offset_in_bytes(T_BYTE));
+  print_def("BASE_OFFSET_SHORT", arrayOopDesc::base_offset_in_bytes(T_SHORT));
+  print_def("BASE_OFFSET_WORD", arrayOopDesc::base_offset_in_bytes(T_INT));
+  print_def("BASE_OFFSET_LONG", arrayOopDesc::base_offset_in_bytes(T_LONG));
+  nl();
+  print_def("SIZEOF_HANDLEMARK", sizeof(HandleMark));
+}
+
+int main(void)
+{
+	print_def("ARCH_VFP",			ARCH_VFP);
+	print_def("ARCH_THUMBEE",		ARCH_THUMBEE);
+	print_def("ARCH_CLZ",			ARCH_CLZ);
+	nl();
+	print_def("JVM_CONSTANT_Utf8",		JVM_CONSTANT_Utf8);
+	print_def("JVM_CONSTANT_Unicode",	JVM_CONSTANT_Unicode);
+	print_def("JVM_CONSTANT_Integer",	JVM_CONSTANT_Integer);
+	print_def("JVM_CONSTANT_Float",		JVM_CONSTANT_Float);
+	print_def("JVM_CONSTANT_Long",		JVM_CONSTANT_Long);
+	print_def("JVM_CONSTANT_Double",	JVM_CONSTANT_Double);
+	print_def("JVM_CONSTANT_Class",		JVM_CONSTANT_Class);
+	print_def("JVM_CONSTANT_String",	JVM_CONSTANT_String);
+	print_def("JVM_CONSTANT_Fieldref",	JVM_CONSTANT_Fieldref);
+	print_def("JVM_CONSTANT_Methodref",	JVM_CONSTANT_Methodref);
+	print_def("JVM_CONSTANT_InterfaceMethodref", JVM_CONSTANT_InterfaceMethodref);
+	print_def("JVM_CONSTANT_NameAndType",	JVM_CONSTANT_NameAndType);
+	nl();
+	print_def("JVM_CONSTANT_UnresolvedClass",	JVM_CONSTANT_UnresolvedClass);
+	print_def("JVM_CONSTANT_ClassIndex",		JVM_CONSTANT_ClassIndex);
+	print_def("JVM_CONSTANT_UnresolvedString",	JVM_CONSTANT_UnresolvedString);
+	print_def("JVM_CONSTANT_StringIndex",		JVM_CONSTANT_StringIndex);
+	print_def("JVM_CONSTANT_UnresolvedClassInError",JVM_CONSTANT_UnresolvedClassInError);
+	nl();
+	print_def("JVM_ACC_PUBLIC",	JVM_ACC_PUBLIC);
+	print_def("JVM_ACC_PRIVATE",	JVM_ACC_PRIVATE);
+	print_def("JVM_ACC_PROTECTED",	JVM_ACC_PROTECTED);
+	print_def("JVM_ACC_STATIC",	JVM_ACC_STATIC);
+	print_def("JVM_ACC_FINAL",	JVM_ACC_FINAL);
+	print_def("JVM_ACC_SYNCHRONIZED",	JVM_ACC_SYNCHRONIZED);
+	print_def("JVM_ACC_SUPER",	JVM_ACC_SUPER);
+	print_def("JVM_ACC_VOLATILE",	JVM_ACC_VOLATILE);
+	print_def("JVM_ACC_BRIDGE",	JVM_ACC_BRIDGE);
+	print_def("JVM_ACC_TRANSIENT",	JVM_ACC_TRANSIENT);
+	print_def("JVM_ACC_VARARGS",	JVM_ACC_VARARGS);
+	print_def("JVM_ACC_NATIVE",	JVM_ACC_NATIVE);
+	print_def("JVM_ACC_INTERFACE",	JVM_ACC_INTERFACE);
+	print_def("JVM_ACC_ABSTRACT",	JVM_ACC_ABSTRACT);
+	print_def("JVM_ACC_STRICT",	JVM_ACC_STRICT);
+	print_def("JVM_ACC_SYNTHETIC",	JVM_ACC_SYNTHETIC);
+	print_def("JVM_ACC_ANNOTATION",	JVM_ACC_ANNOTATION);
+	print_def("JVM_ACC_ENUM",	JVM_ACC_ENUM);
+	print_def("JVM_ACC_HAS_FINALIZER", JVM_ACC_HAS_FINALIZER);
+	nl();
+	print_def("T_BOOLEAN",	T_BOOLEAN);
+	print_def("T_CHAR",	T_CHAR);
+	print_def("T_FLOAT",	T_FLOAT);
+	print_def("T_DOUBLE",	T_DOUBLE);
+	print_def("T_BYTE",	T_BYTE);
+	print_def("T_SHORT",	T_SHORT);
+	print_def("T_INT",	T_INT);
+	print_def("T_LONG",	T_LONG);
+	print_def("T_OBJECT",	T_OBJECT);
+	print_def("T_ARRAY",	T_ARRAY);
+	print_def("T_VOID",	T_VOID);
+	nl();
+	print_def("tos_btos",	btos);
+	print_def("tos_ctos",	ctos);
+	print_def("tos_stos",	stos);
+	print_def("tos_itos",	itos);
+	print_def("tos_ltos",	ltos);
+	print_def("tos_ftos",	ftos);
+	print_def("tos_dtos",	dtos);
+	print_def("tos_atos",	atos);
+	nl();
+	print_def("_thread_uninitialized",	_thread_uninitialized);
+	print_def("_thread_new",		_thread_new);
+	print_def("_thread_new_trans",		_thread_new_trans);
+	print_def("_thread_in_native",		_thread_in_native);
+	print_def("_thread_in_native_trans",	_thread_in_native_trans);
+	print_def("_thread_in_vm",		_thread_in_vm);
+	print_def("_thread_in_vm_trans",	_thread_in_vm_trans);
+	print_def("_thread_in_Java",		_thread_in_Java);
+	print_def("_thread_in_Java_trans",	_thread_in_Java_trans);
+	print_def("_thread_blocked",		_thread_blocked);
+	print_def("_thread_blocked_trans",	_thread_blocked_trans);
+	print_def("_thread_max_state",		_thread_max_state);
+	nl();
+	print_def("class_unparsable_by_gc",	instanceKlass::unparsable_by_gc);
+	print_def("class_allocated",		instanceKlass::allocated);
+	print_def("class_loaded",		instanceKlass::loaded);
+	print_def("class_linked",		instanceKlass::linked);
+	print_def("class_being_initialized",	instanceKlass::being_initialized);
+	print_def("class_fully_initialized",	instanceKlass::fully_initialized);
+	print_def("class_init_error",		instanceKlass::initialization_error);
+	nl();
+	print_def("flag_methodInterface",	1 << ConstantPoolCacheEntry::methodInterface);
+	print_def("flag_volatileField",		1 << ConstantPoolCacheEntry::volatileField);
+	print_def("flag_vfinalMethod",		1 << ConstantPoolCacheEntry::vfinalMethod);
+	print_def("flag_finalField",		1 << ConstantPoolCacheEntry::finalField);
+	nl();
+	print_def("INVOCATIONCOUNTER_COUNTINCREMENT", InvocationCounter::count_increment);
+	nl();
+	VMStructs::print_vm_offsets();
+	nl();
+	print_def("VMSYMBOLS_ArithmeticException", vmSymbols::java_lang_ArithmeticException_enum);
+	print_def("VMSYMBOLS_ArrayIndexOutOfBounds", vmSymbols::java_lang_ArrayIndexOutOfBoundsException_enum);
+	print_def("VMSYMBOLS_ArrayStoreException", vmSymbols::java_lang_ArrayStoreException_enum);
+	print_def("VMSYMBOLS_ClassCastException", vmSymbols::java_lang_ClassCastException_enum);
+	print_def("VMSYMBOLS_NullPointerException", vmSymbols::java_lang_NullPointerException_enum);
+	print_def("VMSYMBOLS_AbstractMethodError", vmSymbols::java_lang_AbstractMethodError_enum);
+	print_def("VMSYMBOLS_IncompatibleClassChangeError", vmSymbols::java_lang_IncompatibleClassChangeError_enum);
+	print_def("VMSYMBOLS_InternalError", vmSymbols::java_lang_InternalError_enum);
+
+	return 0;
+}
+
+#endif // STATIC_OFFSETS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arm_port/hotspot/src/cpu/zero/vm/bytecodes_arm.def	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,7695 @@
+@ Copyright 2009, 2010 Edward Nevill
+@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+@
+@ This code is free software; you can redistribute it and/or modify it
+@ under the terms of the GNU General Public License version 2 only, as
+@ published by the Free Software Foundation.
+@
+@ This code 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
+@ version 2 for more details (a copy is included in the LICENSE file that
+@ accompanied this code).
+@
+@ You should have received a copy of the GNU General Public License version
+@ 2 along with this work; if not, write to the Free Software Foundation,
+@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#ifdef SHARK
+#define DISABLE_NOTICE_SAFEPOINTS
+#endif
+
+#ifndef DISABLE_HW_FP
+#define HW_FP
+#endif
+#ifndef DISABLE_NOTICE_SAFEPOINTS
+#define NOTICE_SAFEPOINTS
+#endif
+#ifndef DISABLE_FAST_BYTECODES
+#define FAST_BYTECODES
+#endif
+
+nop                  = 0x00, 1
+aconst_null          = 0x01, 1
+iconst_m1            = 0x02, 1
+iconst_0             = 0x03, 1
+iconst_1             = 0x04, 1
+iconst_2             = 0x05, 1
+iconst_3             = 0x06, 1
+iconst_4             = 0x07, 1
+iconst_5             = 0x08, 1
+lconst_0             = 0x09, 1
+lconst_1             = 0x0a, 1
+fconst_0             = 0x0b, 1
+fconst_1             = 0x0c, 1
+fconst_2             = 0x0d, 1
+dconst_0             = 0x0e, 1
+dconst_1             = 0x0f, 1
+bipush               = 0x10, 2
+sipush               = 0x11, 3
+ldc                  = 0x12, 2
+ldc_w                = 0x13, 3
+ldc2_w               = 0x14, 3
+iload                = 0x15, 2
+lload                = 0x16, 2
+fload                = 0x17, 2
+dload                = 0x18, 2
+aload                = 0x19, 2
+iload_0              = 0x1a, 1
+iload_1              = 0x1b, 1
+iload_2              = 0x1c, 1
+iload_3              = 0x1d, 1
+lload_0              = 0x1e, 1
+lload_1              = 0x1f, 1
+lload_2              = 0x20, 1
+lload_3              = 0x21, 1
+fload_0              = 0x22, 1
+fload_1              = 0x23, 1
+fload_2              = 0x24, 1
+fload_3              = 0x25, 1
+dload_0              = 0x26, 1
+dload_1              = 0x27, 1
+dload_2              = 0x28, 1
+dload_3              = 0x29, 1
+aload_0              = 0x2a, 1
+aload_1              = 0x2b, 1
+aload_2              = 0x2c, 1
+aload_3              = 0x2d, 1
+iaload               = 0x2e, 1
+laload               = 0x2f, 1
+faload               = 0x30, 1
+daload               = 0x31, 1
+aaload               = 0x32, 1
+baload               = 0x33, 1
+caload               = 0x34, 1
+saload               = 0x35, 1
+istore               = 0x36, 2
+lstore               = 0x37, 2
+fstore               = 0x38, 2
+dstore               = 0x39, 2
+astore               = 0x3a, 2
+istore_0             = 0x3b, 1
+istore_1             = 0x3c, 1
+istore_2             = 0x3d, 1
+istore_3             = 0x3e, 1
+lstore_0             = 0x3f, 1
+lstore_1             = 0x40, 1
+lstore_2             = 0x41, 1
+lstore_3             = 0x42, 1
+fstore_0             = 0x43, 1
+fstore_1             = 0x44, 1
+fstore_2             = 0x45, 1
+fstore_3             = 0x46, 1
+dstore_0             = 0x47, 1
+dstore_1             = 0x48, 1
+dstore_2             = 0x49, 1
+dstore_3             = 0x4a, 1
+astore_0             = 0x4b, 1
+astore_1             = 0x4c, 1
+astore_2             = 0x4d, 1
+astore_3             = 0x4e, 1
+iastore              = 0x4f, 1
+lastore              = 0x50, 1
+fastore              = 0x51, 1
+dastore              = 0x52, 1
+aastore              = 0x53, 1
+bastore              = 0x54, 1
+castore              = 0x55, 1
+sastore              = 0x56, 1
+pop                  = 0x57, 1
+pop2                 = 0x58, 1
+dup                  = 0x59, 1
+dup_x1               = 0x5a, 1
+dup_x2               = 0x5b, 1
+dup2                 = 0x5c, 1
+dup2_x1              = 0x5d, 1
+dup2_x2              = 0x5e, 1
+swap                 = 0x5f, 1
+iadd                 = 0x60, 1
+ladd                 = 0x61, 1
+fadd                 = 0x62, 1
+dadd                 = 0x63, 1
+isub                 = 0x64, 1
+lsub                 = 0x65, 1
+fsub                 = 0x66, 1
+dsub                 = 0x67, 1
+imul                 = 0x68, 1
+lmul                 = 0x69, 1
+fmul                 = 0x6a, 1
+dmul                 = 0x6b, 1
+idiv                 = 0x6c, 1
+ldiv                 = 0x6d, 1
+fdiv                 = 0x6e, 1
+ddiv                 = 0x6f, 1
+irem                 = 0x70, 1
+lrem                 = 0x71, 1
+frem                 = 0x72, 1
+drem                 = 0x73, 1
+ineg                 = 0x74, 1
+lneg                 = 0x75, 1
+fneg                 = 0x76, 1
+dneg                 = 0x77, 1
+ishl                 = 0x78, 1
+lshl                 = 0x79, 1
+ishr                 = 0x7a, 1
+lshr                 = 0x7b, 1
+iushr                = 0x7c, 1
+lushr                = 0x7d, 1
+iand                 = 0x7e, 1
+land                 = 0x7f, 1
+ior                  = 0x80, 1
+lor                  = 0x81, 1
+ixor                 = 0x82, 1
+lxor                 = 0x83, 1
+iinc                 = 0x84, 3
+i2l                  = 0x85, 1
+i2f                  = 0x86, 1
+i2d                  = 0x87, 1
+l2i                  = 0x88, 1
+l2f                  = 0x89, 1
+l2d                  = 0x8a, 1
+f2i                  = 0x8b, 1
+f2l                  = 0x8c, 1
+f2d                  = 0x8d, 1
+d2i                  = 0x8e, 1
+d2l                  = 0x8f, 1
+d2f                  = 0x90, 1
+i2b                  = 0x91, 1
+i2c                  = 0x92, 1
+i2s                  = 0x93, 1
+lcmp                 = 0x94, 1
+fcmpl                = 0x95, 1
+fcmpg                = 0x96, 1
+dcmpl                = 0x97, 1
+dcmpg                = 0x98, 1
+ifeq                 = 0x99, 0
+ifne                 = 0x9a, 0
+iflt                 = 0x9b, 0
+ifge                 = 0x9c, 0
+ifgt                 = 0x9d, 0
+ifle                 = 0x9e, 0
+if_icmpeq            = 0x9f, 0
+if_icmpne            = 0xa0, 0
+if_icmplt            = 0xa1, 0
+if_icmpge            = 0xa2, 0
+if_icmpgt            = 0xa3, 0
+if_icmple            = 0xa4, 0
+if_acmpeq            = 0xa5, 0
+if_acmpne            = 0xa6, 0
+goto                 = 0xa7, 0
+jsr                  = 0xa8, 0
+ret                  = 0xa9, 0
+tableswitch          = 0xaa, 0
+lookupswitch         = 0xab, 0
+ireturn              = 0xac, 0
+lreturn              = 0xad, 0
+freturn              = 0xae, 0
+dreturn              = 0xaf, 0
+areturn              = 0xb0, 0
+return               = 0xb1, 0
+getstatic            = 0xb2, 3
+putstatic            = 0xb3, 3
+getfield             = 0xb4, 3
+putfield             = 0xb5, 3
+invokevirtual        = 0xb6, 3
+invokespecial        = 0xb7, 3
+invokestatic         = 0xb8, 3
+invokeinterface      = 0xb9, 0
+new                  = 0xbb, 3
+newarray             = 0xbc, 2
+anewarray            = 0xbd, 3
+arraylength          = 0xbe, 1
+athrow               = 0xbf, 0
+checkcast            = 0xc0, 3
+instanceof           = 0xc1, 3
+monitorenter         = 0xc2, 1
+monitorexit          = 0xc3, 1
+wide                 = 0xc4, 1
+multianewarray       = 0xc5, 4
+ifnull               = 0xc6, 0
+ifnonnull            = 0xc7, 0
+goto_w               = 0xc8, 0
+jsr_w                = 0xc9, 0
+breakpoint           = 0xca, 0
+
+#ifdef FAST_BYTECODES
+
+@agetfield	= 0xcb, 3
+bgetfield	= 0xcc, 3
+cgetfield	= 0xcd, 3
+@dgetfield	= 0xce, 3
+@fgetfield	= 0xcf, 3
+igetfield	= 0xd0, 3
+lgetfield	= 0xd1, 3
+sgetfield	= 0xd2, 3
+
+aputfield	= 0xd3, 3
+bputfield	= 0xd4, 3
+cputfield	= 0xd5, 3
+@dputfield	= 0xd6, 3
+@fputfield	= 0xd7, 3
+iputfield	= 0xd8, 3
+lputfield	= 0xd9, 3
+@sputfield	= 0xda, 3
+
+iaccess_0	= 0xdb, 4
+iaccess_1	= 0xdc, 4
+iaccess_2	= 0xdd, 4
+iaccess_3	= 0xde, 4
+
+invokeresolved		= 0xdf, 3
+invokespecialresolved	= 0xe0, 3
+invokestaticresolved	= 0xe1, 3
+invokevfinal 		= 0xe2, 3
+
+iload_iload	= 0xe3, 4
+iload_iload_N	= 0xe4, 3
+
+@return_register_finalizer = 0xe5, 1
+
+iload_0_iconst_N        = 0xe7, 2
+iload_1_iconst_N        = 0xe8, 2
+iload_2_iconst_N        = 0xe9, 2
+iload_3_iconst_N        = 0xea, 2
+iload_iconst_N          = 0xeb, 3
+iadd_istore_N		= 0xec, 2
+isub_istore_N		= 0xed, 2
+iand_istore_N		= 0xee, 2
+ior_istore_N		= 0xef, 2
+ixor_istore_N		= 0xf0, 2
+iadd_u4store		= 0xf1, 3
+isub_u4store		= 0xf2, 3
+iand_u4store		= 0xf3, 3
+ior_u4store		= 0xf4, 3
+ixor_u4store		= 0xf5, 3
+iload_0_iload		= 0xf6, 3
+iload_1_iload		= 0xf7, 3
+iload_2_iload		= 0xf8, 3
+iload_3_iload		= 0xf9, 3
+iload_0_iload_N		= 0xfa, 2
+iload_1_iload_N		= 0xfb, 2
+iload_2_iload_N		= 0xfc, 2
+iload_3_iload_N		= 0xfd, 2
+
+#endif // FAST_BYTECODES
+
+return_register_finalizer = 0xe5, 1
+
+(nop) {
+	DISPATCH	\seq_len
+}
+
+(aconst_null,fconst_0) u4const_0 {
+	DISPATCH_START_R2
+        mov     lr, #0
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5) iconst_N {
+	sub	lr, r0, #opc_iconst_0
+	DISPATCH_START_R2
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(lconst_0,dconst_0) u8const_0 {
+	DISPATCH_START_R2
+        mov     tmp1, #0
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(lconst_1) lconst_1 {
+	DISPATCH_START_R2
+        mov     tmp2, #1
+	DISPATCH_NEXT
+        mov     tmp1, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(fconst_1) fconst_1 {
+	DISPATCH_START_R2
+        mov     tmp1, #0x3f800000
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(fconst_2) fconst_2 {
+	DISPATCH_START_R2
+        mov     r2, #0x40000000
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(dconst_1) dconst_1 {
+	DISPATCH_START_R2
+        mov     tmp1, #0x3f000000
+	DISPATCH_NEXT
+        orr     tmp1, tmp1, #0x00f00000
+	DISPATCH_NEXT
+        mov     tmp2, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(bipush) bipush {
+	DISPATCH_START	\seq_len
+	mov	tmp1, r2, lsl #24
+	DISPATCH_NEXT
+	mov	tmp1, tmp1, asr #24
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+@ r1 = [jpc, #2]
+(sipush) sipush {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	\seq_len
+	DISPATCH_NEXT
+	mov	r2, r2, lsl #24
+        orr     tmp1, r1, r2, asr #16
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,fload,aload) u4load {
+	DISPATCH_START	\seq_len
+	rsb	tmp1, r2, #0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(lload,dload) u8load {
+	DISPATCH_START	\seq_len
+	sub	r3, locals, r2, lsl #2
+	DISPATCH_NEXT
+	ldmda	r3, {tmp2, tmp1}
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(aload_0,aload_1,aload_2,aload_3) {
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3) {
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(fload_0,fload_1,fload_2,fload_3) {
+	rsb	tmp1, r0, #opc_fload_0
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(lload_0,dload_0) u8load_0 {
+	DISPATCH_START_R2
+        ldmda   locals, {tmp2-tmp1}
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lload_1,dload_1) u8load_1 {
+	DISPATCH_START_R2
+        ldmdb   locals, {tmp2-tmp1}
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lload_2,dload_2) u8load_2 {
+	DISPATCH_START_R2
+	ldr	tmp2, [locals, #-12]
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, #-8]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(lload_3,dload_3) u8load_3 {
+	DISPATCH_START_R2
+	ldr	tmp2, [locals, #-16]
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, #-12]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload) u4aload {
+	GET_STACK	1, r3
+	DISPATCH_START_R2_R0
+	POP	r2
+	DISPATCH_START_R2_JPC
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry5:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	DISPATCH_NEXT
+	ldr	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+}
+
+(laload,daload) u8aload {
+	GET_STACK	1, r3
+	DISPATCH_START_R2_R0
+	GET_STACK	0, r2
+	DISPATCH_START_R2_JPC
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry6:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #3
+	ldr	tmp2, [r3, #BASE_OFFSET_LONG]
+	DISPATCH_NEXT
+	ldr	tmp1, [r3, #20]
+	DISPATCH_NEXT
+	PUT_STACK	1, tmp1
+	PUT_STACK	0, tmp2
+	DISPATCH_FINISH
+}
+
+(baload) baload {
+	GET_STACK	1, r3
+	DISPATCH_START_R2_R0
+	POP	r2
+	DISPATCH_START_R2_JPC
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry7:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2
+	DISPATCH_NEXT
+	ldrsb	tmp1, [r3, #BASE_OFFSET_BYTE]
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+}
+
+(caload) caload {
+	GET_STACK	1, r3
+	DISPATCH_START_R2_R0
+	POP	r2
+	DISPATCH_START_R2_JPC
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry8:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #1
+	DISPATCH_NEXT
+	ldrh	tmp1, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+}
+
+(saload) saload {
+	GET_STACK	1, r3
+	DISPATCH_START_R2_R0
+	POP	r2
+	DISPATCH_START_R2_JPC
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry9:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #1
+	DISPATCH_NEXT
+	ldrsh	tmp1, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(astore,istore,fstore) u4store {
+	DISPATCH_START	\seq_len
+	rsb	tmp1, r2, #0
+	DISPATCH_NEXT
+	POP	r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(lstore,dstore) u8store {
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	sub	r3, locals, r2, lsl #2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	stmda	r3, {tmp2, tmp1}
+	DISPATCH_FINISH
+}
+
+(astore_0,istore_0,fstore_0) u4store_0 {
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	POP	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        str     tmp1, [locals, #0]
+	DISPATCH_FINISH
+}
+
+(astore_1,istore_1,fstore_1) u4store_1 {
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	POP	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        str     tmp1, [locals, #-4]
+	DISPATCH_FINISH
+}
+
+(astore_2,istore_2,fstore_2) u4store_2 {
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	POP	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        str     tmp1, [locals, #-8]
+	DISPATCH_FINISH
+}
+
+(astore_3,istore_3,fstore_3) u4store_3 {
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	POP	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        str     tmp1, [locals, #-12]
+	DISPATCH_FINISH
+}
+
+(lstore_0,dstore_0) u8store_0 {
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        stmda   locals, {tmp2, tmp1}
+	DISPATCH_FINISH
+}
+
+(lstore_1,dstore_1) u8store_1 {
+	DISPATCH_START_R2
+	DISPATCH_NEXT
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        stmdb   locals, {tmp2, tmp1}
+	DISPATCH_FINISH
+}
+
+(lstore_2,dstore_2) u8store_2 {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+        str     tmp2, [locals, #-12]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        str     tmp1, [locals, #-8]
+	DISPATCH_FINISH
+}
+
+(lstore_3,dstore_3) u8store_3 {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+        str     tmp2, [locals, #-16]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        str     tmp1, [locals, #-12]
+	DISPATCH_FINISH
+}
+
+(iastore,fastore) u4astore {
+	POP	r3, tmp2, tmp1		@ r3 = value, tmp2 = index, tmp1 = arrayref
+	DISPATCH_START_R2
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry10:
+	ldr	lr, [tmp1, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	tmp2, lr
+	bcs	array_bound_exception_jpc_1_tmp2
+	DISPATCH_NEXT
+	add	tmp1, tmp1, tmp2, lsl #2
+	DISPATCH_NEXT
+	str	r3, [tmp1, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(lastore,dastore) u8astore {
+	POP	r1, r3, tmp2, tmp1		@ r1,r3 = value, tmp2 = index, tmp1 = arrayref
+	DISPATCH_START_R2
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry11:
+	ldr	ip, [tmp1, #8]		@ ip = limit
+	cmp	tmp2, ip
+	DISPATCH_NEXT
+	bcs	array_bound_exception_jpc_1_tmp2
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2, lsl #3
+	str	r1, [tmp2, #BASE_OFFSET_LONG]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	r3, [tmp2, #20]
+	DISPATCH_FINISH
+}
+
+(bastore) bastore {
+	POP	r3, tmp2, tmp1		@ r3 = value, tmp2 = index, tmp1 = arrayref
+	DISPATCH_START_R2
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry12:
+	ldr	lr, [tmp1, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	tmp2, lr
+	bcs	array_bound_exception_jpc_1_tmp2
+	DISPATCH_NEXT
+	add	tmp1, tmp1, tmp2
+	DISPATCH_NEXT
+	strb	r3, [tmp1, #BASE_OFFSET_BYTE]
+	DISPATCH_FINISH
+}
+
+(castore,sastore) u2astore {
+	POP	r3, tmp2, tmp1		@ r3 = value, tmp2 = index, tmp1 = arrayref
+	DISPATCH_START_R2
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry13:
+	ldr	lr, [tmp1, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	tmp2, lr
+	bcs	array_bound_exception_jpc_1_tmp2
+	DISPATCH_NEXT
+	add	tmp1, tmp1, tmp2, lsl #1
+	DISPATCH_NEXT
+	strh	r3, [tmp1, #BASE_OFFSET_SHORT]
+	DISPATCH_FINISH
+}
+
+(pop) jpop {
+	DISPATCH_START_R2
+        add     stack, stack, #4
+	DISPATCH_FINISH
+}
+
+(pop2) jpop2 {
+	DISPATCH_START_R2
+        add     stack, stack, #8
+	DISPATCH_FINISH
+}
+
+(dup) dup {
+	DISPATCH_START_R2
+	ldr	lr, [stack, #4]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(dup_x1) dup_x1 {
+	DISPATCH_START_R2
+	POP	r2, r3
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(dup_x2) dup_x2 {
+	DISPATCH_START_R2
+	POP	r2, r3, lr
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_NEXT
+	PUSH	r2, r3, lr
+	DISPATCH_FINISH
+}
+
+(dup2) dup2 {
+	DISPATCH_START_R2
+	ldmib	stack, {r2, r3}
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(dup2_x1) dup2_x1 {
+	DISPATCH_START_R2
+	POP	r2, r3, lr
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_NEXT
+	PUSH	r2, r3, lr
+	DISPATCH_FINISH
+}
+
+(dup2_x2) dup2_x2 {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1, lr
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	PUSH	r2, r3, tmp1, lr
+	DISPATCH_FINISH
+}
+
+(swap) swap {
+	DISPATCH_START_R2
+	POP	r2, r3
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+
+(iadd) iadd {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	add	tmp2, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(ladd) ladd {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1, lr
+	DISPATCH_NEXT
+	adds	r2, r2, tmp1
+	adc	r3, r3, lr
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(isub) isub {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lsub) lsub {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1, lr
+	DISPATCH_NEXT
+	subs	r2, tmp1, r2
+	sbc	r3, lr, r3
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(imul) imul {
+	DISPATCH_START_R2
+	POP	r2, tmp1
+	DISPATCH_NEXT
+	mul	tmp2, r2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lmul) lmul {
+	POP	r1, tmp1, ip, lr
+        umull   r3, r0, ip, r1
+        mla     tmp1, ip, tmp1, r0
+	DISPATCH_START_R2
+        mla     tmp1, lr, r1, tmp1
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+(ldiv) ldiv {
+	POP	r2, r3
+	POP	r0, r1
+	orrs	lr, r2, r3
+	beq	.ldiv_0
+	bl	__aeabi_ldivmod
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(lrem) lrem {
+	POP	r2, r3
+	POP	r0, r1
+	orrs	lr, r2, r3
+	beq	.lrem_0
+	bl	__aeabi_ldivmod
+	PUSH	r2, r3
+	DISPATCH	\seq_len
+}
+
+(frem) frem {
+@ It must be possible to do better than this
+	POP	r0
+        bl      __aeabi_f2d
+	PUSH	r0, r1
+	GET_STACK	2, r0
+        bl      __aeabi_f2d
+	POP	r2, r3
+        bl      fmod
+        bl      __aeabi_d2f
+	PUT_STACK	0, r0
+	DISPATCH	\seq_len
+}
+
+(drem) drem {
+	POP	r2, r3
+	POP	r0, r1
+        bl      fmod
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(ineg) ineg {
+	DISPATCH_START_R2
+	POP	tmp1
+	DISPATCH_NEXT
+        rsb     tmp1, tmp1, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(lneg) lneg {
+	DISPATCH_START_R2
+	POP	r2, r3
+	DISPATCH_NEXT
+	rsbs	r2, r2, #0
+	rsc	r3, r3, #0
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(fneg) fneg {
+	DISPATCH_START_R2
+	POP	r2
+	DISPATCH_NEXT
+	eor	r2, r2, #0x80000000
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(dneg) dneg {
+	DISPATCH_START_R2
+	GET_STACK	1, r2
+	DISPATCH_NEXT
+	eor	r2, r2, #0x80000000
+	DISPATCH_NEXT
+	PUT_STACK	1, r2
+	DISPATCH_FINISH
+}
+
+(ishl) ishl {
+	DISPATCH_START_R2
+	POP	r2, r3
+	DISPATCH_NEXT
+	and	r2, r2, #31
+	mov	r2, r3, lsl r2
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(lshl) lshl {
+	DISPATCH_START_R2
+	POP	r2, r3, lr
+	DISPATCH_NEXT
+	tst	r2, #32
+	and	r2, r2, #31
+	movne	tmp1, #0
+	movne	lr, r3, lsl r2
+	moveq	tmp1, r3, lsl r2
+	moveq	lr, lr, lsl r2
+	rsbeq	r2, r2, #32
+	orreq	lr, lr, r3, lsr r2
+	PUSH	tmp1, lr
+	DISPATCH_FINISH
+}
+
+(ishr) ishr {
+	DISPATCH_START_R2
+	POP	r2, r3
+	DISPATCH_NEXT
+	and	r2, r2, #31
+	mov	r2, r3, asr r2
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(lshr) lshr {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	tst	r2, #32
+	and	r2, r2, #31
+	movne	lr, tmp1, asr #31
+	movne	r3, tmp1, asr r2
+	moveq	lr, tmp1, asr r2
+	moveq	r3, r3, lsr r2
+	rsbeq	r2, r2, #32
+	orreq	r3, r3, tmp1, lsl r2
+	PUSH	r3, lr
+	DISPATCH_FINISH
+}
+
+(iushr) iushr {
+	DISPATCH_START_R2
+	POP	r2, r3
+	DISPATCH_NEXT
+	and	r2, r2, #31
+	mov	r2, r3, lsr r2
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(lushr) lushr {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	tst	r2, #32
+	and	r2, r2, #31
+	movne	lr, #0
+	movne	r3, tmp1, lsr r2
+	moveq	lr, tmp1, lsr r2
+	moveq	r3, r3, lsr r2
+	rsbeq	r2, r2, #32
+	orreq	r3, r3, tmp1, lsl r2
+	PUSH	r3, lr
+	DISPATCH_FINISH
+}
+
+(iand) iand {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	and	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(land) land {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1, lr
+	DISPATCH_NEXT
+	and	r2, tmp1, r2
+	and	r3, lr, r3
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(ior) ior {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	orr	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lor) lor {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1, lr
+	DISPATCH_NEXT
+	orr	r2, tmp1, r2
+	orr	r3, lr, r3
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(ixor) ixor {
+	DISPATCH_START_R2
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	eor	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lxor) lxor {
+	DISPATCH_START_R2
+	POP	r2, r3, tmp1, lr
+	DISPATCH_NEXT
+	eor	r2, tmp1, r2
+	eor	r3, lr, r3
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iinc) iinc {
+	ldrsb	lr, [jpc, #2]
+	DISPATCH_START	\seq_len
+	rsb	tmp1, r2, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	add	r3, r3, lr
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(i2l) i2l {
+	DISPATCH_START_R2
+	POP	r2
+	DISPATCH_NEXT
+	mov	r3, r2, asr #31
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(i2f) i2f {
+	POP	r0
+        bl      __aeabi_i2f
+	PUSH	r0
+	DISPATCH	\seq_len
+}
+
+(i2d) i2d {
+	POP	r0
+        bl      __aeabi_i2d
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(l2i) l2i {
+	DISPATCH_START_R2
+	POP	r3
+	DISPATCH_NEXT
+	PUT_STACK	0, r3
+	DISPATCH_FINISH
+}
+
+(l2f) l2f {
+	POP	r0, r1
+        bl      __aeabi_l2f
+	PUSH	r0
+	DISPATCH	\seq_len
+}
+
+(l2d) l2d {
+	POP	r0, r1
+        bl      __aeabi_l2d
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(f2i) f2i {
+	POP	r0
+        bl      _ZN13SharedRuntime3f2iEf
+	PUSH	r0
+	DISPATCH	\seq_len
+}
+
+(f2l) f2l {
+	POP	r0
+        bl      _ZN13SharedRuntime3f2lEf
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(f2d) f2d {
+	POP	r0
+        bl      __aeabi_f2d
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(d2i) d2i {
+	POP	r0, r1
+        bl      _ZN13SharedRuntime3d2iEd
+	PUSH	r0
+	DISPATCH	\seq_len
+}
+
+(d2l) d2l {
+	POP	r0, r1
+        bl      _ZN13SharedRuntime3d2lEd
+	PUSH	r0, r1
+	DISPATCH	\seq_len
+}
+
+(d2f) d2f {
+	POP	r0, r1
+        bl      __aeabi_d2f
+	PUSH	r0
+	DISPATCH	\seq_len
+}
+
+(i2b) i2b {
+	DISPATCH_START_R2
+	POP	r3
+	DISPATCH_NEXT
+        mov     r3, r3, asl #24
+        mov     r3, r3, asr #24
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(i2c) i2c {
+	DISPATCH_START_R2
+	POP	r3
+	DISPATCH_NEXT
+        mov     r3, r3, asl #16
+        mov     r3, r3, lsr #16
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(i2s) i2s {
+	DISPATCH_START_R2
+	POP	r3
+	DISPATCH_NEXT
+        mov     r3, r3, asl #16
+        mov     r3, r3, asr #16
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(lcmp) lcmp {
+	POP	r1, r3, tmp1, lr
+	DISPATCH_START_R2
+	subs	r1, tmp1, r1
+	movne	r1, #1
+	sbcs	lr, lr, r3
+	DISPATCH_NEXT
+	movne	r1, #1
+	rsblt	r1, r1, #0
+	DISPATCH_NEXT
+	PUSH	r1
+	DISPATCH_FINISH
+}
+
+#ifdef NOTICE_SAFEPOINTS
+
+@ r2 = [jpc, #1]
+@ r1 = [jpc, #2]
+(ifeq,ifnull) ifeq_unsafe {
+	POP	r3
+	ldrb	r1, [jpc, #2]
+        cmp     r3, #0
+	beq	1f
+	DISPATCH 3
+1:
+	mov	r2, r2, lsl #24
+        orr     ip, r1, r2, asr #16
+        ldrb  r0, [jpc, ip]!
+	DISPATCH_BYTECODE
+}
+
+(ifne,ifnonnull) ifne_unsafe {
+	POP	r3
+	ldrb	r1, [jpc, #2]
+        cmp     r3, #0
+	bne	1f
+	DISPATCH 3
+1:
+	mov	r2, r2, lsl #24
+        orr     ip, r1, r2, asr #16
+        ldrb  r0, [jpc, ip]!
+	DISPATCH_BYTECODE
+}
+
+(iflt) iflt_unsafe {
+	POP	r3
+	ldrb	r1, [jpc, #2]
+        cmp     r3, #0
+	blt	1f
+	DISPATCH 3
+1:
+	mov	r2, r2, lsl #24
+        orr     ip, r1, r2, asr #16
+        ldrb  r0, [jpc, ip]!
+	DISPATCH_BYTECODE
+}
+
+(ifge) ifge_unsafe {
+	POP	r3
+	ldrb	r1, [jpc, #2]
+        cmp     r3, #0
+	bge	1f
+	DISPATCH 3
+1:
+	mov	r2, r2, lsl #24
+        orr     ip, r1, r2, asr #16
+        ldrb  r0, [jpc, ip]!
+	DISPATCH_BYTECODE
+}
+
+(ifgt) ifgt_unsafe {
+	POP	r3
+	ldrb	r1, [jpc, #2]
+        cmp     r3, #0
+	bgt	1f
+	DISPATCH 3
+1:
+	mov	r2, r2, lsl #24
+        orr     ip, r1, r2, asr #16
+        ldrb  r0, [jpc, ip]!
+	DISPATCH_BYTECODE
+}
+
+(ifle) ifle_unsafe {
+	POP	r3
+	ldrb	r1, [jpc, #2]
+        cmp     r3, #0
+	ble	1f
+	DISPATCH 3
+1:
+	mov	r2, r2, lsl #24
+        orr     ip, r1, r2, asr #16
+        ldrb  r0, [jpc, ip]!
+	DISPATCH_BYTECODE
+}
+
+(if_icmpeq,if_acmpeq) if_icmpeq_unsafe {
+	POP	r3, tmp1
+	ldrb	r1, [jpc, #2]
+        cmp     tmp1, r3
+	beq	branch_taken_unsafe
+	DISPATCH 3
+}
+
+(if_icmpne,if_acmpne) if_icmpne_unsafe {
+	POP	r3, tmp1
+	ldrb	r1, [jpc, #2]
+        cmp     tmp1, r3
+	bne	branch_taken_unsafe
+	DISPATCH 3
+}
+
+(if_icmplt) if_icmplt_unsafe {
+	POP	r3, tmp1
+	ldrb	r1, [jpc, #2]
+        cmp     tmp1, r3
+	blt	branch_taken_unsafe
+	DISPATCH 3
+}
+
+(if_icmpge) if_icmpge_unsafe {
+	POP	r3, tmp1
+	ldrb	r1, [jpc, #2]
+        cmp     tmp1, r3
+	bge	branch_taken_unsafe
+	DISPATCH 3
+}
+
+(if_icmpgt) if_icmpgt_unsafe {
+	POP	r3, tmp1
+	ldrb	r1, [jpc, #2]
+        cmp     tmp1, r3
+	bgt	branch_taken_unsafe
+	DISPATCH 3
+}
+
+(if_icmple) if_icmple_unsafe {
+	POP	r3, tmp1
+	ldrb	r1, [jpc, #2]
+        cmp     tmp1, r3
+	ble	branch_taken_unsafe
+	DISPATCH 3
+}
+
+(goto) goto_unsafe {
+	ldrb	r1, [jpc, #2]
+	mov	r2, r2, lsl #24
+        orr     tmp1, r1, r2, asr #16
+        DISPATCH_START_REG	tmp1
+  USEC  cmp     tmp1, #0
+  USEC  ble     do_backedge
+	DISPATCH_BYTECODE
+}
+
+#endif // NOTICE_SAFEPOINTS
+
+(jsr) jsr {
+	ldr	r3, [istate, #ISTATE_METHOD]
+	ldr	r1, [r3, #8]
+	rsb	r2, r1, jpc
+	sub	r2, r2, #45
+	PUSH	r2
+	b	do_goto
+}
+
+@ r2 = [jpc, #1]
+@ r1 = [jpc, #2]
+(ret) ret {
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [r0, #8]
+	ldr	r1, [locals, -r2, lsl #2]
+	add	jpc, r3, r1
+	DISPATCH	48
+}
+
+@ We dont do safe and unsafe versions of tableswitch and lookupswitch
+(tableswitch) tableswitch {
+	POP	a2
+        bic     a1, jpc, #3
+        ldr     a4,[a1,#8]
+@       BYTESEX_REVERSE a3, a4, a3
+
+        eor     a3, a4, a4, ror #16
+        bic     a3, a3, #0xff0000
+        mov     a4, a4, ror #8
+        eor     a3, a4, a3, lsr #8
+
+        ldr     a4,[a1,#12]
+@       BYTESEX_REVERSE a4, a4, ip
+
+        eor     ip, a4, a4, ror #16
+        bic     ip, ip, #0xff0000
+        mov     a4, a4, ror #8
+        eor     a4, a4, ip, lsr #8
+
+        sub     a2,a2,a3
+        sub     a4,a4,a3
+        cmp     a4,a2
+        ldrcc   a1,[a1,#4]
+        addcs   a1,a1,a2,LSL #2
+        ldrcs   a1,[a1,#16]
+@       BYTESEX_REVERSE a1, a1, a4
+
+        eor     a4, a1, a1, ror #16
+        bic     a4, a4, #0xff0000
+        mov     a1, a1, ror #8
+        eors    ip, a1, a4, lsr #8
+
+        DISPATCH_START_REG	ip
+	DISPATCH_BYTECODE
+}
+
+(lookupswitch) lookupswitch {
+	POP	a2
+        bic     a1, jpc, #3
+@       BYTESEX_REVERSE a2, a2, ip
+
+        eor     ip, a2, a2, ror #16
+        bic     ip, ip, #0xff0000
+        mov     a2, a2, ror #8
+        eor     a2, a2, ip, lsr #8
+
+        ldr     a3,[a1,#8]
+@       BYTESEX_REVERSE a3, a3, ip
+
+        eor     ip, a3, a3, ror #16
+        bic     ip, ip, #0xff0000
+        mov     a3, a3, ror #8
+        eor     a3, a3, ip, lsr #8
+
+        subs    a4,a3,#1
+        bmi     1f
+        add     a1, a1, #4
+0:
+        ldr      a3,[a1,#8]!
+        cmp     a3,a2
+        beq     2f
+        subs    a4,a4,#1
+        bpl     0b
+1:
+        bic     a1, jpc, #3
+2:
+        ldr      a2,[a1,#4]
+@       BYTESEX_REVERSE a2, a2, ip
+
+        eor     ip, a2, a2, ror #16
+        bic     ip, ip, #0xff0000
+        mov     a2, a2, ror #8
+        eors    ip, a2, ip, lsr #8
+
+        DISPATCH_START_REG	ip
+	DISPATCH_BYTECODE
+}
+
+#ifdef FAST_BYTECODES
+(igetfield) igetfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	tmp1
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry78:
+	ldr	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(bgetfield) bgetfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	tmp1
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry79:
+	ldrsb	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(cgetfield) cgetfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	tmp1
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry80:
+	ldrh	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(sgetfield) sgetfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	tmp1
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry81:
+	ldrsh	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(lgetfield) lgetfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	tmp1
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+.abortentry82:
+	ldmia	tmp2, {tmp2, tmp1}
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(iputfield) iputfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	r3, tmp1		@ r3 = value, tmp1 = object
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+.abortentry83:
+	str	r3, [tmp1, tmp2]
+	DISPATCH_FINISH
+}
+
+(cputfield) cputfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	r3, tmp1		@ r3 = value, tmp1 = object
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+.abortentry84:
+	strh	r3, [tmp1, tmp2]
+	DISPATCH_FINISH
+}
+
+(bputfield) bputfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	r3, tmp1		@ r3 = value, tmp1 = object
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+.abortentry85:
+	strb	r3, [tmp1, tmp2]
+	DISPATCH_FINISH
+}
+
+(aputfield) aputfield {
+	ldrb	r1, [jpc, #2]
+	POP	r3, tmp1		@ r3 = value, tmp1 = object
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+.abortentry113:
+	str	r3, [tmp1, tmp2]
+	mov	r0, tmp1
+	bl	Helper_aputfield
+	DISPATCH 3
+}
+
+(lputfield) lputfield {
+	ldrb	r1, [jpc, #2]
+	DISPATCH_START	3
+	POP	r3, tmp1, lr		@ r3, tmp1 = value, lr = object
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	add	tmp2, lr, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+.abortentry86:
+	stm	tmp2, {r3, tmp1}
+	DISPATCH_FINISH
+}
+
+#endif // FAST_BYTECODES
+
+@ r2 = [jpc, #1]
+@ r1 = [jpc, #2]
+(getstatic) getstatic {
+	ldrb	r1, [jpc, #2]
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+        ldr     r3, [tmp2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getstatic << 16
+	blne	resolve_get_put
+	ldr	r3, [tmp2, #CP_OFFSET+4]
+	ldr	r2, [tmp2, #CP_OFFSET+12]
+        ldr     lr, [tmp2, #CP_OFFSET+8]
+        movs    r2, r2, lsr #29
+	bhi	getstatic_w		@ C = 1, Z = 0 => R2 == 3, 5, 7
+	bcs	getstatic_h		@ C = 1 => R2 = 1
+	beq	getstatic_sb		@ Z = 1 => R2 = 0
+	tst	r2, #2
+	bne	getstatic_dw
+	b	getstatic_sh
+}
+
+@ r2 = [jpc, #1]
+@ r1 = [jpc, #2]
+(putstatic) putstatic {
+	ldrb	r1, [jpc, #2]
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+        ldr     r3, [tmp2, #CP_OFFSET]
+        and     r3, r3, #0xff000000
+        cmp     r3, #opc_putstatic << 24
+	blne	resolve_get_put
+	ldr	r3, [tmp2, #CP_OFFSET+4]		@ r3 = object
+        ldr     lr, [tmp2, #CP_OFFSET+12]           @ lr = tos_type
+        ldr     r2, [tmp2, #CP_OFFSET+8]            @ r2 = offset
+	movs	lr, lr, lsr #29
+	bhi	putstatic_w		@ C = 1, Z = 0 => R2 == 3, 5, 7
+	bcs	putstatic_h		@ C = 1 => R2 = 1
+	beq	putstatic_sb		@ Z = 1 => R2 = 0
+	tst	lr, #2
+	bne	putstatic_dw
+	b	putstatic_sh
+}
+
+#ifdef NOTICE_SAFEPOINTS
+
+(return) return_unsafe {
+
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+
+	cmp	tmp1, tmp2
+	bcc	1f
+2:
+	mov	r3, #0
+
+	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [r2, #0]
+	ldrh	r0, [r0, #40]
+	add	r1, r2, #4
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+
+	add	stack, r1, r0, lsl #2
+
+	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+1:
+	bl	return_check_monitors
+	b	2b
+}
+
+(ireturn,areturn,freturn) ireturn_unsafe {
+
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+
+	cmp	tmp1, tmp2
+	bcc	1f
+2:
+	mov	r3, #0
+
+	POP	r1					@ pop result before we lose stack
+
+	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [stack, #0]
+	ldrh	r0, [r0, #40]
+
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r1, [stack, r0, lsl #2]!
+
+	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+1:
+	bl	return_check_monitors
+	b	2b
+}
+
+(lreturn,dreturn) lreturn_unsafe {
+
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+	cmp	tmp1, tmp2
+	bcc	1f
+2:
+	mov	r3, #0
+
+	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [r2, #0]
+	ldrh	r0, [r0, #40]
+	add	r1, r2, #4
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+
+	POP	r2, r3
+
+	add	stack, r1, r0, lsl #2
+	stmdb	stack!, {r2, r3}
+
+	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+1:
+	bl	return_check_monitors
+	b	2b
+}
+
+#endif // NOTICE_SAFEPOINTS
+
+(ldc) ldc {
+	ldr	r3, [istate, #ISTATE_METHOD]			@ method
+	ldrb	lr, [jpc, #1]
+
+	ldr	tmp1, [r3, #METHOD_CONSTANTS]			@ constants
+
+	DISPATCH_START	\seq_len
+
+	ldr	r3, [tmp1, #8]
+	DISPATCH_NEXT
+	add	r3, r3, #12
+	ldrb	r3, [r3, lr]
+
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+
+	cmp	r3, #JVM_CONSTANT_Integer
+	cmpne	r3, #JVM_CONSTANT_Float
+	cmpne	r3, #JVM_CONSTANT_String
+	bne	1f
+
+	add	r3, tmp1, lr, lsl #2
+	ldr	r3, [r3, #CONSTANTPOOL_BASE]
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+1:
+	cmp	r3, #JVM_CONSTANT_Class
+	bne	2f
+	add	r0, tmp1, #CONSTANTPOOL_BASE
+	ldr	r0, [r0, lr, lsl #2]
+	ldr	r1, [r0, #60]
+	PUSH	r1
+	DISPATCH	0
+2:
+	sub	jpc, jpc, #\seq_len
+	ldr	r0, [istate, #ISTATE_THREAD]
+        DECACHE_JPC
+        DECACHE_STACK
+	mov	r1, #0
+        bl      _ZN18InterpreterRuntime3ldcEP10JavaThreadb
+	ldr	r0, [istate, #ISTATE_THREAD]			@ thread
+	CACHE_CP
+	ldr	r1, [r0, #THREAD_PENDING_EXC]
+	CACHE_JPC
+	cmp	r1, #0
+	bne	handle_exception
+	ldr	r3, [r0, #THREAD_VM_RESULT]
+	mov	r2, #0
+	PUSH	r3
+	str	r2, [r0, #THREAD_VM_RESULT]
+	DISPATCH	\seq_len
+}
+
+(ldc_w) ldc_w {
+	ldrb	lr, [jpc, #1]
+
+	ldr	r3, [istate, #ISTATE_METHOD]			@ method
+	ldrb	ip, [jpc, #2]
+	ldr	r2, [r3, #METHOD_CONSTANTS]			@ constants
+
+	DISPATCH_START	\seq_len
+
+	ldr	r3, [r2, #8]
+	orr	lr, ip, lr, lsl #8
+	add	r3, r3, #12
+	ldrb	r3, [r3, lr]
+
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+
+	cmp	r3, #JVM_CONSTANT_Integer
+	cmpne	r3, #JVM_CONSTANT_Float
+	cmpne	r3, #JVM_CONSTANT_String
+	bne	1f
+
+	add	r3, r2, lr, lsl #2
+	ldr	r3, [r3, #CONSTANTPOOL_BASE]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+1:
+	cmp	r3, #JVM_CONSTANT_Class
+	bne	2f
+	add	r0, r2, #CONSTANTPOOL_BASE
+	ldr	r0, [r0, lr, lsl #2]
+	ldr	r1, [r0, #60]
+	PUSH	r1
+	DISPATCH	0
+2:
+	sub	jpc, jpc, #\seq_len
+	ldr	r0, [istate, #ISTATE_THREAD]
+        DECACHE_JPC
+        DECACHE_STACK
+	mov	r1, #1
+        bl      _ZN18InterpreterRuntime3ldcEP10JavaThreadb
+	ldr	r0, [istate, #ISTATE_THREAD]			@ thread
+	CACHE_CP
+	ldr	r1, [r0, #THREAD_PENDING_EXC]
+	CACHE_JPC
+	cmp	r1, #0
+	ldr	r3, [r0, #THREAD_VM_RESULT]
+	bne	handle_exception
+	mov	r2, #0
+	PUSH	r3
+	str	r2, [r0, #THREAD_VM_RESULT]
+	DISPATCH	\seq_len
+}
+
+(ldc2_w) ldc2_w {
+	ldrb	r3, [jpc, #1]
+
+	ldr	tmp1, [istate, #ISTATE_METHOD]			@ method
+	ldrb	lr, [jpc, #2]
+	ldr	r2, [tmp1, #METHOD_CONSTANTS]			@ constants
+
+	DISPATCH_START	\seq_len
+
+	ldr	tmp1, [r2, #8]
+	orr	r3, lr, r3, lsl #8
+	add	tmp1, tmp1, #12
+	ldrb	tmp1, [tmp1, r3]
+
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+
+	cmp	tmp1, #JVM_CONSTANT_Long
+	cmpne	tmp1, #JVM_CONSTANT_Double
+	bne	vm_fatal_error
+
+	add	tmp1, r2, r3, lsl #2
+	ldr	r3, [tmp1, #CONSTANTPOOL_BASE]
+	ldr	tmp1, [tmp1, #CONSTANTPOOL_BASE+4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+#ifdef FAST_BYTECODES
+(iadd_u4store) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(isub_u4store) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iand_u4store) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	and	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(ior_u4store) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	orr	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(ixor_u4store) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	eor	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iadd_istore_N) {
+	ldrb	lr, [jpc, #1]
+	DISPATCH_START	\seq_len
+	DISPATCH_NEXT
+	rsb	r3, lr, #opc_istore_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(isub_istore_N) {
+	ldrb	lr, [jpc, #1]
+	DISPATCH_START	\seq_len
+	DISPATCH_NEXT
+	rsb	r3, lr, #opc_istore_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iand_istore_N) {
+	ldrb	lr, [jpc, #1]
+	DISPATCH_START	\seq_len
+	DISPATCH_NEXT
+	rsb	r3, lr, #opc_istore_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	and	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(ior_istore_N) {
+	ldrb	lr, [jpc, #1]
+	DISPATCH_START	\seq_len
+	DISPATCH_NEXT
+	rsb	r3, lr, #opc_istore_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	orr	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+(ixor_istore_N) {
+	ldrb	lr, [jpc, #1]
+	DISPATCH_START	\seq_len
+	DISPATCH_NEXT
+	rsb	r3, lr, #opc_istore_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	eor	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iconst_N)
+{
+        ldrb    r3, [jpc, #2]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+        DISPATCH_NEXT
+        sub     r3, r3, #opc_iconst_0
+        ldr     tmp1, [locals, r2, lsl #2]
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH   r3, tmp1
+        DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+        ldrb    r2, [jpc, #1-\seq_len]
+        DISPATCH_NEXT
+        ldr     tmp1, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        sub     tmp2, r2, #opc_iconst_0
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH   tmp2, tmp1
+        DISPATCH_FINISH
+}
+
+@ (aload_N)(getfield)
+(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
+{
+	ldrb	r2, [jpc, #3]
+	rsb	tmp1, r0, #opc_iaccess_0
+	ldrb	r3, [jpc, #2]
+	add	tmp2, constpool, r2, lsl #12
+	DISPATCH_START	4
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, r3, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry87:
+	ldr	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iload) fast_iload_iload
+{
+	ldrb	r3, [jpc, #3]
+	DISPATCH_START	\seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iload_N) fast_iload_iload_N
+{
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload) fast_iload_N_iload
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	DISPATCH_START	\seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N) fast_iload_N_iload_N
+{
+	rsb	r3, r0, #opc_iload_0_iload_N
+	DISPATCH_START	\seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	ldr	r3, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+#endif // FAST_BYTECODE
+
+#ifdef HW_FP
+
+(fadd) fadd_vfp {
+	DISPATCH_START_R2
+	vldr	s15, [stack, #8]
+	vldr	s14, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fadds	s15, s15, s14
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	s15, [stack, #8]
+	add	stack, stack, #4
+	DISPATCH_FINISH
+}
+
+(dadd) dadd_vfp {
+	DISPATCH_START_R2
+	vldr	d7, [stack, #12]
+	vldr	d6, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	faddd	d0, d7, d6
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	d0, [stack, #12]
+	add	stack, stack, #8
+	DISPATCH_FINISH
+}
+
+(fsub) fsub_vfp {
+	DISPATCH_START_R2
+	vldr	s15, [stack, #8]
+	vldr	s14, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fsubs	s15, s15, s14
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	s15, [stack, #8]
+	add	stack, stack, #4
+	DISPATCH_FINISH
+}
+
+(fmul) fmul_vfp {
+	DISPATCH_START_R2
+	vldr	s15, [stack, #8]
+	vldr	s14, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fmuls	s15, s15, s14
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	s15, [stack, #8]
+	add	stack, stack, #4
+	DISPATCH_FINISH
+}
+
+(dmul) dmul_vfp {
+	DISPATCH_START_R2
+	vldr	d7, [stack, #12]
+	vldr	d6, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fmuld	d0, d7, d6
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	d0, [stack, #12]
+	add	stack, stack, #8
+	DISPATCH_FINISH
+}
+
+(fdiv) fdiv_vfp {
+	DISPATCH_START_R2
+	vldr	s15, [stack, #8]
+	vldr	s14, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fdivs	s15, s15, s14
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	s15, [stack, #8]
+	add	stack, stack, #4
+	DISPATCH_FINISH
+}
+
+(ddiv) ddiv_vfp {
+	DISPATCH_START_R2
+	vldr	d7, [stack, #12]
+	vldr	d6, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fdivd	d0, d7, d6
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	vstr	d0, [stack, #12]
+	add	stack, stack, #8
+	DISPATCH_FINISH
+}
+
+(fcmpl) fcmpl_vfp {
+	DISPATCH_START_R2
+	flds	s14, [stack, #8]
+	flds	s15, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fcmpes	s14, s15
+	add	stack, stack, #8
+	fmstat
+	mvnmi	r3, #0
+	bmi	1f
+	movgt	r3, #1
+	bgt	1f
+	fcmps	s14, s15
+	fmstat
+	moveq	r3, #0
+	mvnne	r3, #0
+1:
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(fcmpg) fcmpg_vfp {
+	DISPATCH_START_R2
+	flds	s14, [stack, #8]
+	flds	s15, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fcmpes	s14, s15
+	add	stack, stack, #8
+	fmstat
+	mvnmi	r3, #0
+	bmi	1f
+	movgt	r3, #1
+	bgt	1f
+	fcmps	s14, s15
+	fmstat
+	moveq	r3, #0
+	movne	r3, #1
+1:
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(dcmpl) dcmpl_vfp {
+	DISPATCH_START_R2
+	fldd	d6, [stack, #12]
+	fldd	d7, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fcmped	d6, d7
+	fmstat
+	mvnmi	r3, #0
+	bmi	1f
+	movgt	r3, #1
+	bgt	1f
+	fcmpd	d6, d7
+	fmstat
+	moveq	r3, #0
+	mvnne	r3, #0
+1:
+	add	stack, stack, #16
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(dcmpg) dcmpg_vfp {
+	DISPATCH_START_R2
+	fldd	d6, [stack, #12]
+	fldd	d7, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	fcmped	d6, d7
+	fmstat
+	mvnmi	r3, #0
+	bmi	1f
+	movgt	r3, #1
+	bgt	1f
+	fcmpd	d6, d7
+	fmstat
+	moveq	r3, #0
+	movne	r3, #1
+1:
+	add	stack, stack, #16
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+#endif // HW_FP
+
+#ifdef FAST_BYTECODES
+
+@##############################################################################
+@ Optimised bytecode pairs
+@##############################################################################
+
+@ --- load; iaccess ------------------------------------------------------
+
+(iload_0,iload_1,iload_2,iload_3)
+(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
+{
+	rsb	lr, r0, #opc_iload_0
+	ldrb	r2, [jpc, #4]
+	rsb	tmp1, r1, #opc_iaccess_0
+	ldrb	r3, [jpc, #3]
+	ldr	lr, [locals, lr, lsl #2]
+	add	tmp2, constpool, r2, lsl #12
+	DISPATCH_START	\seq_len
+	PUSH	lr
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, r3, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry111:
+	ldr	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)
+(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
+{
+	rsb	lr, r2, #0
+	ldrb	r2, [jpc, #5]
+	rsb	tmp1, r1, #opc_iaccess_0
+	ldrb	r3, [jpc, #4]
+	ldr	lr, [locals, lr, lsl #2]
+	add	tmp2, constpool, r2, lsl #12
+	DISPATCH_START	\seq_len
+	PUSH	lr
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, r3, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry112:
+	ldr	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+@ --- load; load ---------------------------------------------------------
+
+(aload_0,aload_1,aload_2,aload_3)
+(aload_0,aload_1,aload_2,aload_3)
+{
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r1, #opc_aload_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r1, #opc_iload_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(aload_0,aload_1,aload_2,aload_3)
+{
+	rsb	tmp1, r0, #opc_iload_0
+        DISPATCH_START  \seq_len
+	rsb	tmp2, r1, #opc_aload_0
+        DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	cmp	r0, #opc_igetfield
+	ldr	tmp2, [locals, tmp2, lsl #2]
+        beq     1f
+2:
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+        DISPATCH_FINISH
+1:
+	ldrb	lr, [jpc, #-1]
+	add	lr, lr, #opc_iaccess_0-opc_aload_0
+	strb	lr, [jpc, #-1]
+	b	2b
+}
+
+@ 7 cycles
+(iload_0,iload_1,iload_2,iload_3)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	add	r0, r0, #opc_iload_0_iload_N-opc_iload_0
+	strb	r0, [jpc]
+	b	do_fast_iload_N_iload_N
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(iload,aload,fload)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(aload,fload)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(iload)
+{
+	add	r0, r0, #opc_iload_0_iload-opc_iload_0
+	strb	r0, [jpc]
+	b	do_fast_iload_N_iload
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)
+(aload_0,aload_1,aload_2,aload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r1, #opc_aload_0
+	DISPATCH_NEXT
+	rsb	tmp1, r2, #0
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	cmp	r0, #opc_igetfield
+	DISPATCH_NEXT
+	beq	1f
+2:
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+1:
+	ldrb	lr, [jpc, #-1]
+	add	lr, lr, #opc_iaccess_0-opc_aload_0
+	strb	lr, [jpc, #-1]
+	b	2b
+}
+
+@ r2 = [jpc, #1]
+(aload,fload)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r1, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp1, r2, #0
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	mov	r0, #opc_iload_iload_N
+	strb	r0, [jpc]
+	b	do_fast_iload_iload_N
+}
+
+@ r2 = [jpc, #1]
+(aload,fload)(iload,aload,fload) {
+	ldrb	tmp2, [jpc, #3]
+	rsb	tmp1, r2, #0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, tmp2, #0
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+(iload)(iload) {
+	mov	r0, #opc_iload_iload
+	strb	r0, [jpc]
+	b	do_fast_iload_iload
+}
+
+(iload)(aload,fload) {
+	ldrb	tmp2, [jpc, #3]
+	rsb	tmp1, r2, #0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, tmp2, #0
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2, tmp1
+	DISPATCH_FINISH
+}
+
+@ --- load; store --------------------------------------------------------
+
+(aload_0,aload_1,aload_2,aload_3)
+(astore_0,astore_1,astore_2,astore_3)
+{
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r1, #opc_astore_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp1, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(istore_0,istore_1,istore_2,istore_3)
+{
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r1, #opc_istore_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp1, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(astore,istore,fstore)
+{
+	ldrb	tmp2, [jpc, #2]
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, tmp2, #0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp1, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(astore,istore,fstore)
+{
+	ldrb	tmp2, [jpc, #2]
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, tmp2, #0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp1, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)
+(astore_0,astore_1,astore_2,astore_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	tmp1, r1, #opc_astore_0
+	DISPATCH_NEXT
+	rsb	tmp2, r2, #0
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)
+(istore_0,istore_1,istore_2,istore_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	tmp1, r1, #opc_istore_0
+	DISPATCH_NEXT
+	rsb	tmp2, r2, #0
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(astore,istore,fstore) {
+	ldrb	tmp1, [jpc, #3]
+	rsb	tmp2, r2, #0
+	DISPATCH_START	\seq_len
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	tmp2, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ --- load; const -------------------------------------------------------
+
+(aload_0,aload_1,aload_2,aload_3)
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
+{
+	rsb	tmp1, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	sub	tmp2, r1, #opc_iconst_0
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
+{
+        add     r0, r0, #opc_iload_0_iconst_N-opc_iload_0
+        strb    r0, [jpc]
+	b	do_iload_0_iconst_N
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
+{
+        cmp     r0, #opc_iload
+        DISPATCH_START  \seq_len
+        sub     r3, r1, #opc_iconst_0
+        DISPATCH_NEXT
+        ldr     tmp2, [locals, -r2, lsl #2]
+        DISPATCH_NEXT
+        beq     1f
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH   r3, tmp2
+        DISPATCH_FINISH
+1:
+        mov     tmp1, #opc_iload_iconst_N
+        strb    tmp1, [jpc, #-\seq_len]!
+	b	do_iload_iconst_N
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(bipush)
+{
+	ldrsb	r2, [jpc, #2]
+	rsb	r3, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(bipush)
+{
+	ldrsb	r2, [jpc, #2]
+	rsb	r3, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(sipush)
+{
+        ldrsb   r2, [jpc, #2]   @ zero_extendqisi2
+        ldrb    lr, [jpc, #3]   @ zero_extendqisi2
+	rsb	r3, r0, #opc_aload_0
+	DISPATCH_START	\seq_len
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        orr     r2, lr, r2, asl #8
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(sipush)
+{
+        ldrsb   r2, [jpc, #2]   @ zero_extendqisi2
+        ldrb    lr, [jpc, #3]   @ zero_extendqisi2
+	rsb	r3, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        orr     r2, lr, r2, asl #8
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(bipush) {
+	ldrsb	r3, [jpc, #3]
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r3, lr
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(sipush) {
+	ldrsb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #4]
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, -r2, lsl #2]
+        orr     r3, lr, r3, asl #8
+	DISPATCH_NEXT
+	PUSH	r3, tmp1
+	DISPATCH_FINISH
+}
+
+@ --- load; Xaload -------------------------------------------------------
+
+(iload_0,iload_1,iload_2,iload_3)
+(iaload,aaload,faload)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, r2, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry19:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2, lsl #2
+	ldr	lr, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(iaload,aaload,faload) {
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry20:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2, lsl #2
+	ldr	lr, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(baload)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, r2, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry21:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2
+	ldrsb	lr, [r3, #BASE_OFFSET_BYTE]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(caload)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, r2, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry22:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2, lsl #1
+	ldrh	lr, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(saload)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, r2, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry23:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2, lsl #1
+	ldrsh	lr, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(baload) {
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry24:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2
+	ldrsb	lr, [r3, #BASE_OFFSET_BYTE]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(caload) {
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry25:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2, lsl #1
+	ldrh	lr, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload,aload,fload)(saload) {
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry26:
+	ldr	lr, [r3, #8]		@ lr = length
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	add	r3, r3, r2, lsl #1
+	ldrsh	lr, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+@ --- load; Xastore -------------------------------------------------------
+
+(iload_0,iload_1,iload_2,iload_3)
+(iastore,fastore)
+{
+	POP	r2, r3
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry27:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(bastore)
+{
+	POP	r2, r3
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry28:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2
+	strb	tmp1, [r3, #BASE_OFFSET_BYTE]
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(castore,sastore)
+{
+	POP	r2, r3
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry29:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #1
+	strh	tmp1, [r3, #BASE_OFFSET_SHORT]
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(iastore,fastore) {
+	POP	r3, tmp1
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, -r2, lsl #2]
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry30:
+	ldr	lr, [tmp1, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r3, lr
+	bcs	array_bound_exception_jpc_1_r3
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r3, lsl #2
+	str	r2, [tmp1, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(bastore) {
+	POP	r3, tmp1
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, -r2, lsl #2]
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry31:
+	ldr	lr, [tmp1, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r3, lr
+	bcs	array_bound_exception_jpc_1_r3
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r3
+	strb	r2, [tmp1, #BASE_OFFSET_BYTE]
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(castore,sastore) {
+	POP	r3, tmp1
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, -r2, lsl #2]
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry32:
+	ldr	lr, [tmp1, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r3, lr
+	bcs	array_bound_exception_jpc_1_r3
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r3, lsl #1
+	strh	r2, [tmp1, #BASE_OFFSET_SHORT]
+	DISPATCH_FINISH
+}
+
+@ --- load; dataop -------------------------------------------------------
+
+(iload_0,iload_1,iload_2,iload_3)
+(iadd)
+{
+	POP	tmp2
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	add	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(iadd) {
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	POP	tmp1
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(isub)
+{
+	POP	tmp2
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	sub	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(isub) {
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	POP	tmp1
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(imul)
+{
+	POP	r2
+	rsb	lr, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	mul	r3, r2, lr
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(imul) {
+	DISPATCH_START	\seq_len
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+	mul	lr, r3, r2
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ineg)
+{
+	rsb	lr, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	rsb	lr, lr, #0
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(ineg) {
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+	rsb	r2, r2, #0
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ishl)
+{
+	POP	r2
+	rsb	lr, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	mov	lr, r2, lsl lr
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(ishl) {
+	DISPATCH_START	\seq_len
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+	mov	r2, r3, lsl r2
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ishr)
+{
+	POP	r2
+	rsb	lr, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	mov	lr, r2, asr lr
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(ishr) {
+	DISPATCH_START	\seq_len
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+	mov	r2, r3, asr r2
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(iushr)
+{
+	POP	r2
+	rsb	lr, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	mov	lr, r2, lsr lr
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(iushr) {
+	ldrb	r2, [jpc, #1]
+	DISPATCH_START	\seq_len
+	POP	r3
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+	mov	r2, r3, lsr r2
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(iand)
+{
+	POP	tmp2
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	and	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(iand) {
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	POP	tmp1
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	and	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ior)
+{
+	POP	tmp2
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	orr	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(ior) {
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	POP	tmp1
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	orr	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ixor)
+{
+	POP	tmp2
+	rsb	tmp1, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	eor	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(ixor) {
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	POP	tmp1
+	DISPATCH_NEXT
+	ldr	tmp2, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	eor	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(i2c)
+{
+	rsb	lr, r0, #opc_iload_0
+	DISPATCH_START	\seq_len
+	ldr	lr, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+        mov     lr, lr, asl #16
+        mov     lr, lr, lsr #16
+	PUSH	lr
+	DISPATCH_FINISH
+}
+
+(iload,aload,fload)(i2c) {
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, -r2, lsl #2]
+	DISPATCH_NEXT
+        mov     r2, r2, asl #16
+        mov     r2, r2, lsr #16
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+#ifdef NOTICE_SAFEPOINTS
+
+@ --- load; branch -------------------------------------------------------
+
+(iload_0,iload_1,iload_2,iload_3)
+(ifeq,ifnull)
+{
+	rsb	r3, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r3, [locals, r3, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, #0
+	beq	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(ifeq,ifnull) {
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r3, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, #0
+	beq	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ifne,ifnonnull)
+{
+	rsb	r3, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r3, [locals, r3, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, #0
+	bne	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(ifne,ifnonnull) {
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r3, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, #0
+	bne	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(iflt)
+{
+	rsb	r3, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r3, [locals, r3, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, #0
+	blt	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(iflt) {
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r3, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, #0
+	blt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ifge)
+{
+	rsb	r3, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r3, [locals, r3, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, #0
+	bge	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(ifge) {
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r3, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, #0
+	bge	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ifgt)
+{
+	rsb	r3, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r3, [locals, r3, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, #0
+	bgt	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(ifgt) {
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r3, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, #0
+	bgt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(ifle)
+{
+	rsb	r3, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r3, [locals, r3, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, #0
+	ble	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(ifle) {
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r3, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, #0
+	ble	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(if_icmpeq,if_acmpeq)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, r2
+	beq	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(if_icmpeq,if_acmpeq) {
+	POP	r3
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, r2
+	beq	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(if_icmpne,if_acmpne)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, r2
+	bne	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(if_icmpne,if_acmpne) {
+	POP	r3
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, r2
+	bne	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(if_icmplt)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, r2
+	blt	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(if_icmplt) {
+	POP	r3
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, r2
+	blt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(if_icmpge)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, r2
+	bge	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(if_icmpge) {
+	POP	r3
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, r2
+	bge	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(if_icmpgt)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, r2
+	bgt	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(if_icmpgt) {
+	POP	r3
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, r2
+	bgt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(if_icmple)
+{
+	POP	r3
+	rsb	r2, r0, #opc_iload_0
+        ldrsb   r1, [jpc, #2]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #3]
+        cmp     r3, r2
+	ble	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iload,aload,fload)(if_icmple) {
+	POP	r3
+	rsb	r2, r2, #0
+        ldrsb   r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+        ldrb    ip, [jpc, #4]
+        cmp     r3, r2
+	ble	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+@ --- load; return/invoke -------------------------------------------------
+
+(iload_0,iload_1,iload_2,iload_3)
+(ireturn,areturn,freturn)
+{
+	rsb	r0, r0, #opc_iload_0
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	r1, [locals, r0, lsl #2]
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+	cmp	tmp1, tmp2
+	bcc	1f
+2:
+	mov	r3, #0
+	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [stack, #0]
+	ldrh	r0, [r0, #40]
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r1, [stack, r0, lsl #2]!
+
+	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+1:
+	PUSH	r1
+	add	jpc, jpc, #1
+	bl	return_check_monitors
+	POP	r1
+	b	2b
+}
+
+(iload,aload,fload)(ireturn,areturn,freturn) {
+
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	r1, [locals, -r2, lsl #2]
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+	cmp	tmp1, tmp2
+	bcc	1f
+2:
+	mov	r3, #0
+	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [stack, #0]
+	ldrh	r0, [r0, #40]
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r1, [stack, r0, lsl #2]!
+
+	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+1:
+	PUSH	r1
+	add	jpc, jpc, #2
+	bl	return_check_monitors
+	POP	r1
+	b	2b
+}
+
+#endif // NOTICE_SAFEPOINTS
+
+(iload_0,iload_1,iload_2,iload_3)
+(invokeresolved)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_iload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeresolved
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(invokeresolved)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_aload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeresolved
+}
+
+(iload,aload,fload)(invokeresolved) {
+	ldr	r0, [locals, -r2, lsl #2]
+	add	jpc, jpc, #2
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeresolved
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(invokevfinal)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_iload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokevfinal
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(invokevfinal)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_aload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokevfinal
+}
+
+(iload,aload,fload)(invokevfinal) {
+	ldr	r0, [locals, -r2, lsl #2]
+	add	jpc, jpc, #2
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokevfinal
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(invokespecialresolved)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_iload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokespecialresolved
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(invokespecialresolved)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_aload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokespecialresolved
+}
+
+(iload,aload,fload)(invokespecialresolved) {
+	ldr	r0, [locals, -r2, lsl #2]
+	add	jpc, jpc, #2
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokespecialresolved
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(invokestaticresolved)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_iload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokestaticresolved
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(invokestaticresolved)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_aload_0
+	ldr	r0, [locals, r0, lsl #2]
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokestaticresolved
+}
+
+(iload,aload,fload)(invokestaticresolved) {
+	ldr	r0, [locals, -r2, lsl #2]
+	add	jpc, jpc, #2
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokestaticresolved
+
+}
+
+(iload_0,iload_1,iload_2,iload_3)
+(invokeinterface)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_iload_0
+	ldr	r0, [locals, r0, lsl #2]
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeinterface
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(invokeinterface)
+{
+	add	jpc, jpc, #1
+	rsb	r0, r0, #opc_aload_0
+	ldr	r0, [locals, r0, lsl #2]
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeinterface
+}
+
+(iload,aload,fload)(invokeinterface) {
+	ldr	r0, [locals, -r2, lsl #2]
+	add	jpc, jpc, #2
+        ldrb     r2, [jpc, #1]
+        ldrb     r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeinterface
+}
+
+(aload_0,aload_1,aload_2,aload_3)
+(igetfield)
+{
+	add	r0, r0, #opc_iaccess_0-opc_aload_0
+	strb	r0, [jpc]
+	DISPATCH_BYTECODE
+}
+
+@ 13 cycles
+(iload,aload,fload)(igetfield) {
+	ldrb	ip, [jpc, #4]
+	rsb	tmp1, r2, #0
+	ldrb	r3, [jpc, #3]
+	add	tmp2, constpool, ip, lsl #12
+	DISPATCH_START	5
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, r3, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry88:
+	ldr	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+@ --- iconst; store -------------------------------------------------
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
+(istore_0,istore_1,istore_2,istore_3)
+{
+	sub	r3, r0, #opc_iconst_0
+	DISPATCH_START	\seq_len
+	rsb	r2, r1, #opc_istore_0
+	str	r3, [locals, r2, lsl #2]
+	DISPATCH_BYTECODE
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(astore,istore,fstore) {
+	ldrb	r2, [jpc, #2]
+	sub	r3, r0, #opc_iconst_0
+	DISPATCH_START	\seq_len
+	str	r3, [locals, -r2, lsl #2]
+	DISPATCH_BYTECODE
+}
+
+@ --- iconst; dataop -------------------------------------------------
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(iadd) {
+	sub	tmp1, r0, #opc_iconst_0
+	DISPATCH_START	\seq_len
+	POP	tmp2
+	DISPATCH_NEXT
+	add	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(isub) {
+	sub	tmp1, r0, #opc_iconst_0
+	DISPATCH_START	\seq_len
+	POP	tmp2
+	DISPATCH_NEXT
+	sub	tmp1, tmp2, tmp1
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(idiv) {
+	subs	lr, r0, #opc_iconst_2
+	DISPATCH_START	\seq_len
+	POP	tmp1
+	DISPATCH_NEXT
+	beq	5f
+	bcc	3f
+	cmp	lr, #(opc_iconst_4-opc_iconst_2)
+	beq	4f
+	bcc	2f
+@ divide by 5
+1:
+	mvn	lr, #0x198		@ Form 0x66666667 in lr
+	bic	lr, lr, #0x9800
+	add	lr, lr, lr, lsl #16
+	smull	a3, a4, tmp1, lr
+	mov	a3, tmp1, asr #31
+	rsb	tmp1, a3, a4, asr #1
+	b	6f
+@ divide by 3
+2:
+	mvn	lr, #0xa9		@ Form 0x55555556 in lr
+	bic	lr, lr, #0xaa00
+	add	lr, lr, lr, lsl #16
+        smull   a3, a4, tmp1, lr
+        sub     tmp1, a4, tmp1, asr #31
+	b	6f
+3:
+	cmp	lr, #(opc_iconst_0-opc_iconst_2)
+	beq	div_zero_jpc_1
+	rsbcc	tmp1, tmp1, #0		@ Divide by -1 or 1
+	b	6f
+@ divide by 4
+4:	movs	a4, tmp1
+	addmi	a4, a4, #3
+	mov	tmp1, a4, asr #2
+	b	6f
+@ divide by 2
+5:
+	add	tmp1, tmp1, tmp1, lsr #31
+	mov	tmp1, tmp1, asr #1
+6:
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(ishl) {
+	sub	tmp1, r0, #opc_iconst_0
+	DISPATCH_START	\seq_len
+	POP	r2
+	DISPATCH_NEXT
+	mov	tmp1, r2, lsl tmp1
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@ --- iconst; branch -------------------------------------------------
+
+#ifdef NOTICE_SAFEPOINTS
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpeq) {
+	POP	r3
+	sub	r2, r0, #opc_iconst_0
+        ldrsb   r1, [jpc, #2]
+        cmp     r3, r2
+        ldrb    ip, [jpc, #3]
+	beq	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpne) {
+	POP	r3
+	sub	r2, r0, #opc_iconst_0
+        ldrsb   r1, [jpc, #2]
+        cmp     r3, r2
+        ldrb    ip, [jpc, #3]
+	bne	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmplt) {
+	POP	r3
+	sub	r2, r0, #opc_iconst_0
+        ldrsb   r1, [jpc, #2]
+        cmp     r3, r2
+        ldrb    ip, [jpc, #3]
+	blt	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpge) {
+	POP	r3
+	sub	r2, r0, #opc_iconst_0
+        ldrsb   r1, [jpc, #2]
+        cmp     r3, r2
+        ldrb    ip, [jpc, #3]
+	bge	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpgt) {
+	POP	r3
+	sub	r2, r0, #opc_iconst_0
+        ldrsb   r1, [jpc, #2]
+        cmp     r3, r2
+        ldrb    ip, [jpc, #3]
+	bgt	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmple) {
+	POP	r3
+	sub	r2, r0, #opc_iconst_0
+        ldrsb   r1, [jpc, #2]
+        cmp     r3, r2
+        ldrb    ip, [jpc, #3]
+	ble	branch_taken_unsafe_1
+	DISPATCH 4
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(ireturn) {
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	sub	r1, r0, #opc_iconst_0
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+	cmp	tmp1, tmp2
+	bcc	1f
+2:
+	mov	r3, #0
+	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [stack, #0]
+	ldrh	r0, [r0, #40]
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r1, [stack, r0, lsl #2]!
+
+	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+1:
+	PUSH	r1
+	add	jpc, jpc, #1
+	bl	return_check_monitors
+	POP	r1
+	b	2b
+}
+
+#endif // NOTICE_SAFEPOINTS
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokeresolved) {
+	add	jpc, jpc, #1
+	sub	r0, r0, #opc_iconst_0
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokeresolved
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokevfinal) {
+	add	jpc, jpc, #1
+	sub	r0, r0, #opc_iconst_0
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokevfinal
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokestaticresolved) {
+	add	jpc, jpc, #1
+	sub	r0, r0, #opc_iconst_0
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokestaticresolved
+}
+
+(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokespecialresolved) {
+	add	jpc, jpc, #1
+	sub	r0, r0, #opc_iconst_0
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]
+	PUSH	r0
+	b	do_invokespecialresolved
+}
+
+@# --- Bytecode sequences iaload; xxx -----------------------------------------------
+
+(iaload,faload,aaload)(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5) {
+	sub	r2, r1, #opc_iconst_0
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry38:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #12]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(bipush) {
+	ldrsb	r2, [jpc, #2]
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+.abortentry39:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_3_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #12]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(sipush) {
+	ldrsb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #3]
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	orr	r2, tmp1, r2, lsl #8
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_4
+.abortentry40:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_4_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #12]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(iload,fload,aload) {
+	ldrb	r2, [jpc, #2]
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, -r2, lsl #2]
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+.abortentry41:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_3_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	rsb	r2, r1, #opc_iload_0
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, r2, lsl #2]
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry42:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)
+(aload_0,aload_1,aload_2,aload_3)
+{
+	rsb	r2, r1, #opc_aload_0
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	ldr	r2, [locals, r2, lsl #2]
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry42_1:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	r2, r3
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(iaload,faload,aaload)
+{
+	POP	r2, r3			@ r2 = index, r3 = arrayref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_0
+.abortentry43:
+	ldr	tmp1, [r3, #8]		@ tmp1 = length
+	DISPATCH_START	\seq_len
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_2
+	add	r3, r3, r2, lsl #2
+	POP	lr			@ r2 = index, lr = arrayref
+	ldr	r2, [r3, #BASE_OFFSET_WORD]
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry44:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_1
+	add	lr, lr, r2, lsl #2
+	ldr	r2, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	r2
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(astore,istore,fstore) {
+	ldrb	r2, [jpc, #2]
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_3
+.abortentry45:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_3_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	str	r3, [locals, -r2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)
+(istore_0,istore_1,istore_2,istore_3) {
+	rsb	r2, r1, #opc_istore_0
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry46:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	r3, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	str	r3, [locals, r2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(iastore,fastore) {
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_0
+.abortentry47:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_START	\seq_len
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+
+	POP	r2, r3		@ tmp1 = value, r2 = index, r3 = arrayref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry48:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(bastore) {
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_0
+.abortentry49:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_START	\seq_len
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+
+	POP	r2, r3		@ tmp1 = value, r2 = index, r3 = arrayref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry50:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2
+	strb	tmp1, [r3, #BASE_OFFSET_BYTE]
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(castore,sastore) {
+	POP	r3, lr			@ r3 = index, lr = arrayref
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_0
+.abortentry51:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_START	\seq_len
+	cmp	r3, tmp1
+	bcs	array_bound_exception_jpc_2_r3
+	add	lr, lr, r3, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+
+	POP	r2, r3		@ tmp1 = value, r2 = index, r3 = arrayref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry52:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #1
+	strh	tmp1, [r3, #BASE_OFFSET_BYTE]
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(iand) {
+	POP	r2, r3			@ r2 = index, r3 = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry58:
+	ldr	tmp1, [r3, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_2
+	add	r3, r3, r2, lsl #2
+	ldr	tmp1, [r3, #BASE_OFFSET_WORD]		@ tmp1 = tos
+	POP	r2			@ r2 = tosm1
+	DISPATCH_NEXT
+	and	tmp1, r2, tmp1		@ tosm1 <dop> tos
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(ior) {
+	POP	r2, r3			@ r2 = index, r3 = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry59:
+	ldr	tmp1, [r3, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_2
+	add	r3, r3, r2, lsl #2
+	ldr	tmp1, [r3, #BASE_OFFSET_WORD]		@ tmp1 = tos
+	POP	r2			@ r2 = tosm1
+	DISPATCH_NEXT
+	orr	tmp1, r2, tmp1		@ tosm1 <dop> tos
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iaload,faload,aaload)(ixor) {
+	POP	r2, r3			@ r2 = index, r3 = arrayref
+	DISPATCH_START	\seq_len
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_2
+.abortentry60:
+	ldr	tmp1, [r3, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_2
+	add	r3, r3, r2, lsl #2
+	ldr	tmp1, [r3, #BASE_OFFSET_WORD]		@ tmp1 = tos
+	POP	r2			@ r2 = tosm1
+	DISPATCH_NEXT
+	eor	tmp1, r2, tmp1		@ tosm1 <dop> tos
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@ ---- iadd; xxx ------------------------------------------------------------
+
+(iadd)(iload,fload,aload) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(iadd)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	r3, r1, #opc_iload_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(iadd)(iaload,aaload,faload) {
+	POP	r2, r3, lr		@ lr = ref
+	DISPATCH_START	\seq_len
+	add	r2, r3, r2		@ r2 = index
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry73:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_1
+	add	lr, lr, r2, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iadd)(istore) {
+	mov	r0, #opc_iadd_u4store
+	strb	r0, [jpc]
+	b	do_iadd_u4store
+}
+
+(iadd)
+(istore_0,istore_1,istore_2,istore_3) {
+	mov	r0, #opc_iadd_istore_N
+	strb	r0, [jpc]
+	b	do_iadd_istore_N
+}
+
+(iadd)(iastore,fastore) {
+	POP	r2, r3
+	DISPATCH_START	\seq_len
+	add	tmp1, r3, r2		@ tmp1 = value
+	POP	r2, r3			@ r2, index, r3 = ref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry106:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(iadd)(iadd) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	add	tmp2, r3, r2
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iadd)(isub) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	add	tmp2, r3, r2
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iadd)(iinc) {
+	POP	tmp1, lr
+	DISPATCH_START	\seq_len
+	add	tmp1, lr, tmp1
+        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
+        ldrsb   r2, [jpc, #-1]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	ldr	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r2
+	str	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_FINISH
+}
+@ ---- sub; xxx ------------------------------------------------------------
+
+(isub)(iload,fload,aload) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(isub)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	r3, r1, #opc_iload_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(isub)(iaload,aaload,faload) {
+	POP	r2, r3, lr		@ lr = ref
+	DISPATCH_START	\seq_len
+	sub	r2, r3, r2		@ r2 = index
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry74:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_1
+	add	lr, lr, r2, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(isub)(istore) {
+	mov	r0, #opc_isub_u4store
+	strb	r0, [jpc]
+	b	do_isub_u4store
+}
+
+(isub)
+(istore_0,istore_1,istore_2,istore_3) {
+	mov	r0, #opc_isub_istore_N
+	strb	r0, [jpc]
+	b	do_isub_istore_N
+}
+
+(isub)(iastore,fastore) {
+	POP	r2, r3
+	DISPATCH_START	\seq_len
+	sub	tmp1, r3, r2		@ tmp1 = value
+	POP	r2, r3			@ r2, index, r3 = ref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry105:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(isub)(iadd) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	sub	tmp2, r3, r2
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(isub)(isub) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	sub	tmp2, r3, r2
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(isub)(iinc) {
+	POP	tmp1, lr
+	DISPATCH_START	\seq_len
+	sub	tmp1, lr, tmp1
+        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
+        ldrsb   r2, [jpc, #-1]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	ldr	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r2
+	str	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_FINISH
+}
+@ ---- iand; xxx ------------------------------------------------------------
+
+(iand)(iload,fload,aload) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	and	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(iand)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	r3, r1, #opc_iload_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	and	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(iand)(iaload,aaload,faload) {
+	POP	r2, r3, lr		@ lr = ref
+	DISPATCH_START	\seq_len
+	and	r2, r3, r2		@ r2 = index
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry75:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_1
+	add	lr, lr, r2, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iand)(istore) {
+	mov	r0, #opc_iand_u4store
+	strb	r0, [jpc]
+	b	do_iand_u4store
+}
+
+(iand)
+(istore_0,istore_1,istore_2,istore_3) {
+	mov	r0, #opc_iand_istore_N
+	strb	r0, [jpc]
+	b	do_iand_istore_N
+}
+
+(iand)(iastore,fastore) {
+	POP	r2, r3
+	DISPATCH_START	\seq_len
+	and	tmp1, r3, r2		@ tmp1 = value
+	POP	r2, r3			@ r2, index, r3 = ref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry107:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(iand)(iadd) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	and	tmp2, r3, r2
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iand)(isub) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	and	tmp2, r3, r2
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iand)(iinc) {
+	POP	tmp1, lr
+	DISPATCH_START	\seq_len
+	and	tmp1, lr, tmp1
+        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
+        ldrsb   r2, [jpc, #-1]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	ldr	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r2
+	str	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_FINISH
+}
+@ ---- ior; xxx ------------------------------------------------------------
+
+(ior)(iload,fload,aload) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	orr	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(ior)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	r3, r1, #opc_iload_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	orr	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(ior)(iaload,aaload,faload) {
+	POP	r2, r3, lr		@ lr = ref
+	DISPATCH_START	\seq_len
+	orr	r2, r3, r2		@ r2 = index
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry76:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_1
+	add	lr, lr, r2, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(ior)(istore) {
+	mov	r0, #opc_ior_u4store
+	strb	r0, [jpc]
+	b	do_ior_u4store
+}
+
+(ior)
+(istore_0,istore_1,istore_2,istore_3) {
+	mov	r0, #opc_ior_istore_N
+	strb	r0, [jpc]
+	b	do_ior_istore_N
+}
+
+(ior)(iastore,fastore) {
+	POP	r2, r3
+	DISPATCH_START	\seq_len
+	orr	tmp1, r3, r2		@ tmp1 = value
+	POP	r2, r3			@ r2, index, r3 = ref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry108:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(ior)(iadd) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	orr	tmp2, r3, r2
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(ior)(isub) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	orr	tmp2, r3, r2
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(ior)(iinc) {
+	POP	tmp1, lr
+	DISPATCH_START	\seq_len
+	orr	tmp1, lr, tmp1
+        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
+        ldrsb   r2, [jpc, #-1]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	ldr	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r2
+	str	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ ---- ixor; xxx ------------------------------------------------------------
+
+(ixor)(iload,fload,aload) {
+	ldrb	r3, [jpc, #2]
+	DISPATCH_START	\seq_len
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	eor	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(ixor)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	DISPATCH_START	\seq_len
+	rsb	r3, r1, #opc_iload_0
+	POP	tmp2, tmp1
+	DISPATCH_NEXT
+	ldr	r3, [locals, r3, lsl #2]
+	eor	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(ixor)(iaload,aaload,faload) {
+	POP	r2, r3, lr		@ lr = ref
+	DISPATCH_START	\seq_len
+	eor	r2, r3, r2		@ r2 = index
+	SW_NPC	cmp	lr, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry77:
+	ldr	tmp1, [lr, #8]		@ tmp1 = length
+	DISPATCH_NEXT
+	cmp	r2, tmp1
+	bcs	array_bound_exception_jpc_1
+	add	lr, lr, r2, lsl #2
+	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(ixor)(istore) {
+	mov	r0, #opc_ixor_u4store
+	strb	r0, [jpc]
+	b	do_ixor_u4store
+}
+
+(ixor)
+(istore_0,istore_1,istore_2,istore_3) {
+	mov	r0, #opc_ixor_istore_N
+	strb	r0, [jpc]
+	b	do_ixor_istore_N
+}
+
+(ixor)(iastore,fastore) {
+	POP	r2, r3
+	DISPATCH_START	\seq_len
+	eor	tmp1, r3, r2		@ tmp1 = value
+	POP	r2, r3			@ r2, index, r3 = ref
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry109:
+	ldr	lr, [r3, #8]		@ lr = limit
+	DISPATCH_NEXT
+	cmp	r2, lr
+	bcs	array_bound_exception_jpc_1
+	DISPATCH_NEXT
+	add	r3, r3, r2, lsl #2
+	str	tmp1, [r3, #BASE_OFFSET_WORD]
+	DISPATCH_FINISH
+}
+
+(ixor)(iadd) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	eor	tmp2, r3, r2
+	DISPATCH_NEXT
+	add	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+        DISPATCH_FINISH
+}
+
+(ixor)(isub) {
+	DISPATCH_START	\seq_len
+	POP	r2, r3, tmp1
+	DISPATCH_NEXT
+	eor	tmp2, r3, r2
+	DISPATCH_NEXT
+	sub	tmp2, tmp1, tmp2
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(ixor)(iinc) {
+	POP	tmp1, lr
+	DISPATCH_START	\seq_len
+	eor	tmp1, lr, tmp1
+        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
+        ldrsb   r2, [jpc, #-1]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	ldr	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_NEXT
+	add	tmp1, tmp1, r2
+	str	tmp1, [locals, -r3, lsl #2]
+	DISPATCH_FINISH
+}
+
+@ --- iinc; xxx --------------------------------------------------------------
+
+(iinc)(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5) {
+        ldrsb   tmp1, [jpc, #2]
+	sub	lr, r1, #opc_iconst_0
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	ldr	r3, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	add	r3, r3, tmp1
+	DISPATCH_NEXT
+	PUSH	lr
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iinc)(iload,aload,fload) {
+	ldrb	lr, [jpc, #4]
+        ldrsb   tmp1, [jpc, #2]
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	ldr	r3, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	rsb	lr, lr, #0
+	DISPATCH_NEXT
+	add	r3, r3, tmp1
+	DISPATCH_NEXT
+	str	r3, [locals, tmp2, lsl #2]
+	ldr	tmp1, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iinc)
+(iload_0,iload_1,iload_2,iload_3)
+{
+	rsb	lr, r1, #opc_iload_0
+        ldrsb   tmp1, [jpc, #2]
+	DISPATCH_START	\seq_len
+	rsb	tmp2, r2, #0
+	ldr	r3, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	add	r3, r3, tmp1
+	DISPATCH_NEXT
+	str	r3, [locals, tmp2, lsl #2]
+	DISPATCH_NEXT
+	ldr	tmp1, [locals, lr, lsl #2]
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@###############################################################################
+@# Optimised bytecode triples
+@###############################################################################
+
+(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
+(iload,fload,aload) {
+	ldrb	r2, [jpc, #3]
+	rsb	tmp1, r0, #opc_iaccess_0
+	ldrb	r3, [jpc, #2]
+	add	tmp2, constpool, r2, lsl #12
+	DISPATCH_START	6
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, r3, lsl #4
+	ldrb	r3, [jpc, #-1]
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_5
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	rsb	r3, r3, #0
+.abortentry89:
+	ldr	tmp2, [tmp1, tmp2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
+(iload_0,iload_1,iload_2,iload_3) {
+	ldrb	r2, [jpc, #3]
+	rsb	tmp1, r0, #opc_iaccess_0
+	ldrb	ip, [jpc, #2]
+	add	tmp2, constpool, r2, lsl #12
+	DISPATCH_START	5
+	rsb	r3, r1, #opc_iload_0
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, ip, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_4
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+.abortentry90:
+	ldr	tmp2, [tmp1, tmp2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	PUSH	r3, tmp2
+	DISPATCH_FINISH
+}
+
+(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
+(iadd) {
+	ldrb	r2, [jpc, #3]
+	rsb	tmp1, r0, #opc_iaccess_0
+	ldrb	ip, [jpc, #2]
+	add	tmp2, constpool, r2, lsl #12
+	DISPATCH_START	5
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	add	tmp2, ip, lsl #4
+	DISPATCH_NEXT
+	SW_NPC	cmp	tmp1, #0
+	SW_NPC	beq	null_ptr_exception_jpc_4
+	DISPATCH_NEXT
+        ldr     tmp2, [tmp2, #CP_OFFSET+8]
+	DISPATCH_NEXT
+	POP	r3
+.abortentry91:
+	ldr	tmp2, [tmp1, tmp2]
+	DISPATCH_NEXT
+	add	tmp2, tmp2, r3
+	PUSH	tmp2
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(iadd)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+        ldrb    r2, [jpc, #1-\seq_len]
+        DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        sub     tmp1, r2, #opc_iconst_0
+        DISPATCH_NEXT
+        add     r3, r3, tmp1
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(isub)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+        ldrb    r2, [jpc, #1-\seq_len]
+        DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        sub     tmp1, r2, #opc_iconst_0
+        DISPATCH_NEXT
+        sub     r3, r3, tmp1
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(iand)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+        ldrb    r2, [jpc, #1-\seq_len]
+        DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        sub     tmp1, r2, #opc_iconst_0
+        DISPATCH_NEXT
+        and     r3, r3, tmp1
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(ior)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+        ldrb    r2, [jpc, #1-\seq_len]
+        DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        sub     tmp1, r2, #opc_iconst_0
+        DISPATCH_NEXT
+        orr     r3, r3, tmp1
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(ixor)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+        ldrb    r2, [jpc, #1-\seq_len]
+        DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        sub     tmp1, r2, #opc_iconst_0
+        DISPATCH_NEXT
+        eor     r3, r3, tmp1
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(idiv)
+{
+	rsb	tmp1, r0, #opc_iload_0_iconst_N
+	subs	lr, r2, #opc_iconst_2
+	DISPATCH_START	\seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	DISPATCH_NEXT
+	beq	5f
+	bcc	3f
+	cmp	lr, #(opc_iconst_4-opc_iconst_2)
+	beq	4f
+	bcc	2f
+@ divide by 5
+1:
+	mvn	lr, #0x198		@ Form 0x66666667 in lr
+	bic	lr, lr, #0x9800
+	add	lr, lr, lr, lsl #16
+	smull	a3, a4, tmp1, lr
+	mov	a3, tmp1, asr #31
+	rsb	tmp1, a3, a4, asr #1
+	b	6f
+@ divide by 3
+2:
+	mvn	lr, #0xa9		@ Form 0x55555556 in lr
+	bic	lr, lr, #0xaa00
+	add	lr, lr, lr, lsl #16
+        smull   a3, a4, tmp1, lr
+        sub     tmp1, a4, tmp1, asr #31
+	b	6f
+3:
+	cmp	lr, #(opc_iconst_0-opc_iconst_2)
+	beq	div_zero_jpc_1
+	rsbcc	tmp1, tmp1, #0		@ Divide by -1 or 1
+	b	6f
+@ divide by 4
+4:	movs	a4, tmp1
+	addmi	a4, a4, #3
+	mov	tmp1, a4, asr #2
+	b	6f
+@ divide by 2
+5:
+	add	tmp1, tmp1, tmp1, lsr #31
+	mov	tmp1, tmp1, asr #1
+6:
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iconst_N)
+(iadd)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        DISPATCH_NEXT
+        ldr     r2, [locals, r2, lsl #2]
+        sub     r3, r3, #opc_iconst_0
+        DISPATCH_NEXT
+        add     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iconst_N)
+(isub)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        DISPATCH_NEXT
+        ldr     r2, [locals, r2, lsl #2]
+        sub     r3, r3, #opc_iconst_0
+        DISPATCH_NEXT
+        sub     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iconst_N)
+(iand)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        DISPATCH_NEXT
+        ldr     r2, [locals, r2, lsl #2]
+        sub     r3, r3, #opc_iconst_0
+        DISPATCH_NEXT
+        and     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iconst_N)
+(ior)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        DISPATCH_NEXT
+        ldr     r2, [locals, r2, lsl #2]
+        sub     r3, r3, #opc_iconst_0
+        DISPATCH_NEXT
+        orr     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+@ r2 = [jpc, #1]
+(iload_iconst_N)
+(ixor)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        DISPATCH_NEXT
+        ldr     r2, [locals, r2, lsl #2]
+        sub     r3, r3, #opc_iconst_0
+        DISPATCH_NEXT
+        eor     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(idiv)
+{
+	ldrb	lr, [jpc, #2]
+	rsb	tmp1, r2, #0
+        DISPATCH_START  \seq_len
+	ldr	tmp1, [locals, tmp1, lsl #2]
+	subs	lr, lr, #opc_iconst_2
+	DISPATCH_NEXT
+	beq	5f
+	bcc	3f
+	cmp	lr, #(opc_iconst_4-opc_iconst_2)
+	beq	4f
+	bcc	2f
+@ divide by 5
+1:
+	mvn	lr, #0x198		@ Form 0x66666667 in lr
+	bic	lr, lr, #0x9800
+	add	lr, lr, lr, lsl #16
+	smull	a3, a4, tmp1, lr
+	mov	a3, tmp1, asr #31
+	rsb	tmp1, a3, a4, asr #1
+	b	6f
+@ divide by 3
+2:
+	mvn	lr, #0xa9		@ Form 0x55555556 in lr
+	bic	lr, lr, #0xaa00
+	add	lr, lr, lr, lsl #16
+        smull   a3, a4, tmp1, lr
+        sub     tmp1, a4, tmp1, asr #31
+	b	6f
+3:
+	cmp	lr, #(opc_iconst_0-opc_iconst_2)
+	beq	div_zero_jpc_1
+	rsbcc	tmp1, tmp1, #0		@ Divide by -1 or 1
+	b	6f
+@ divide by 4
+4:	movs	a4, tmp1
+	addmi	a4, a4, #3
+	mov	tmp1, a4, asr #2
+	b	6f
+@ divide by 2
+5:
+	add	tmp1, tmp1, tmp1, lsr #31
+	mov	tmp1, tmp1, asr #1
+6:
+	DISPATCH_NEXT
+	PUSH	tmp1
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(iadd)
+{
+        ldrb    r3, [jpc, #3]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        add     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(iadd)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #opc_iload_0
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        add     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(iadd)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        add     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(iadd)
+{
+	rsb	r3, r2, #opc_iload_0
+	rsb	r2, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        add     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(isub)
+{
+        ldrb    r3, [jpc, #3]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        sub     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(isub)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #opc_iload_0
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        sub     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(isub)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        sub     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(isub)
+{
+	rsb	r3, r2, #opc_iload_0
+	rsb	r2, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        sub     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(iand)
+{
+        ldrb    r3, [jpc, #3]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        and     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(iand)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #opc_iload_0
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        and     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(iand)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        and     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(iand)
+{
+	rsb	r3, r2, #opc_iload_0
+	rsb	r2, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        and     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(ior)
+{
+        ldrb    r3, [jpc, #3]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        orr     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(ior)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #opc_iload_0
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        orr     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(ior)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        orr     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(ior)
+{
+	rsb	r3, r2, #opc_iload_0
+	rsb	r2, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+        ldr     r2, [locals, r2, lsl #2]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        orr     r3, r2, r3
+	DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(ixor)
+{
+        ldrb    r3, [jpc, #3]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        eor     r3, r2, r3
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(ixor)
+{
+        ldrb    r3, [jpc, #2]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #opc_iload_0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        eor     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(ixor)
+{
+        ldrb    r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+        DISPATCH_START  \seq_len
+        rsb     r3, r3, #0
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        eor     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+        DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(ixor)
+{
+	rsb	r3, r2, #opc_iload_0
+	rsb	r2, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+        ldr     r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        eor     r3, r2, r3
+        DISPATCH_NEXT
+        DISPATCH_NEXT
+        PUSH    r3
+	DISPATCH_FINISH
+}
+
+@ Former quads
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(iadd_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        add     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(iadd_u4store)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #5]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        add     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(iadd_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        add     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(iadd_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #4]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #opc_istore_0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        add     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(isub_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(isub_u4store)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #5]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(isub_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(isub_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #4]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #opc_istore_0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(iand_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        and     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(iand_u4store)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #5]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        and     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(iand_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        and     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(iand_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #4]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #opc_istore_0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        and     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(ior_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(ior_u4store)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #5]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(ior_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(ior_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #4]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #opc_istore_0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(ixor_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(ixor_u4store)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #5]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(ixor_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iconst_N
+        DISPATCH_START  \seq_len
+	sub	r2, r2, #opc_iconst_0
+	DISPATCH_NEXT
+        ldrb    tmp1, [jpc, #-1]
+        ldr     r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iconst_N)
+(ixor_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+        ldrb    lr, [jpc, #4]
+        rsb     r2, r2, #0
+        DISPATCH_START  \seq_len
+	sub	r3, r3, #opc_iconst_0
+	DISPATCH_NEXT
+        rsb     tmp2, lr, #opc_istore_0
+	DISPATCH_NEXT
+        ldr     tmp1, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+#ifdef NOTICE_SAFEPOINTS
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(if_icmpeq,if_acmpeq)
+{
+	ldrb	r3, [jpc, #1]
+	rsb	r2, r0, #opc_iload_0_iconst_N
+	ldrsb	r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	beq	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iconst_N)
+(if_icmpeq,if_acmpeq)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	beq	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(if_icmpne,if_acmpne)
+{
+	ldrb	r3, [jpc, #1]
+	rsb	r2, r0, #opc_iload_0_iconst_N
+	ldrsb	r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	bne	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iconst_N)
+(if_icmpne,if_acmpne)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bne	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(if_icmplt)
+{
+	ldrb	r3, [jpc, #1]
+	rsb	r2, r0, #opc_iload_0_iconst_N
+	ldrsb	r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	blt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iconst_N)
+(if_icmplt)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	blt	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(if_icmpge)
+{
+	ldrb	r3, [jpc, #1]
+	rsb	r2, r0, #opc_iload_0_iconst_N
+	ldrsb	r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	bge	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iconst_N)
+(if_icmpge)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bge	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(if_icmpgt)
+{
+	ldrb	r3, [jpc, #1]
+	rsb	r2, r0, #opc_iload_0_iconst_N
+	ldrsb	r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	bgt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iconst_N)
+(if_icmpgt)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bgt	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
+(if_icmple)
+{
+	ldrb	r3, [jpc, #1]
+	rsb	r2, r0, #opc_iload_0_iconst_N
+	ldrsb	r1, [jpc, #3]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	ble	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iconst_N)
+(if_icmple)
+{
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	ldr	r2, [locals, r2, lsl #2]
+	sub	r3, r3, #opc_iconst_0
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	ble	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+#endif // NOTICE_SAFEPOINTS
+
+(iload_iload)
+(iadd_istore_N)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	add	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(iadd_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #4]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	add	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(iadd_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #4]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        add     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(iadd_istore_N)
+{
+	ldrb	tmp1, [jpc, #3]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        add     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(isub_istore_N)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	sub	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(isub_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #4]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	sub	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(isub_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #4]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(isub_istore_N)
+{
+	ldrb	tmp1, [jpc, #3]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(iand_istore_N)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	and	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(iand_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #4]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	and	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(iand_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #4]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        and     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(iand_istore_N)
+{
+	ldrb	tmp1, [jpc, #3]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        and     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(ior_istore_N)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	orr	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(ior_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #4]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	orr	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(ior_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #4]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(ior_istore_N)
+{
+	ldrb	tmp1, [jpc, #3]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(ixor_istore_N)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	eor	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(ixor_istore_N)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #4]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #opc_istore_0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	eor	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(ixor_istore_N)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #4]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(ixor_istore_N)
+{
+	ldrb	tmp1, [jpc, #3]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #opc_istore_0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(iadd_u4store)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #6]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	add	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(iadd_u4store)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	add	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(iadd_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #5]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        add     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(iadd_u4store)
+{
+	ldrb	tmp1, [jpc, #4]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        add     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(isub_u4store)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #6]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	sub	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(isub_u4store)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	sub	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(isub_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #5]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(isub_u4store)
+{
+	ldrb	tmp1, [jpc, #4]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        sub     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(iand_u4store)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #6]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	and	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(iand_u4store)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	and	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(iand_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #5]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        and     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(iand_u4store)
+{
+	ldrb	tmp1, [jpc, #4]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        and     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(ior_u4store)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #6]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	orr	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(ior_u4store)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	orr	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(ior_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #5]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(ior_u4store)
+{
+	ldrb	tmp1, [jpc, #4]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        orr     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload)
+(ixor_u4store)
+{
+	ldrb	r3, [jpc, #3]
+	ldrb	lr, [jpc, #6]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	eor	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_iload_N)
+(ixor_u4store)
+{
+	ldrb	r3, [jpc, #2]
+	ldrb	lr, [jpc, #5]
+	rsb	r2, r2, #0
+        DISPATCH_START  \seq_len
+	rsb	r3, r3, #opc_iload_0
+	DISPATCH_NEXT
+	rsb	tmp2, lr, #0
+	ldr	tmp1, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	eor	r3, tmp1, r3
+	DISPATCH_NEXT
+        str     r3, [locals, tmp2, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(ixor_u4store)
+{
+        rsb     r3, r0, #opc_iload_0_iload
+	ldrb	r2, [jpc, #2]
+	ldrb	tmp1, [jpc, #5]
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(ixor_u4store)
+{
+	ldrb	tmp1, [jpc, #4]
+	rsb	r3, r0, #opc_iload_0_iload_N
+        DISPATCH_START  \seq_len
+	rsb	r2, r2, #opc_iload_0
+	DISPATCH_NEXT
+        ldr     r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	DISPATCH_NEXT
+        eor     r3, r3, r2
+	DISPATCH_NEXT
+	rsb	tmp1, tmp1, #0
+	DISPATCH_NEXT
+        str     r3, [locals, tmp1, lsl #2]
+	DISPATCH_FINISH
+}
+
+#ifdef NOTICE_SAFEPOINTS
+
+(iload_iload)
+(if_icmpeq,if_acmpeq) {
+	ldrb	r3, [jpc, #3]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #5]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #6]
+	cmp	r2, r3
+	beq	branch_taken_unsafe_4
+	DISPATCH 7
+}
+
+(iload_iload_N)
+(if_icmpeq,if_acmpeq) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #opc_iload_0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	beq	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(if_icmpeq,if_acmpeq) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	beq	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(if_icmpeq,if_acmpeq) {
+	rsb	r3, r2, #opc_iload_0
+	ldrsb	r1, [jpc, #3]
+	rsb	r2, r0, #opc_iload_0_iload_N
+	ldr	r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	beq	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iload)
+(if_icmpne,if_acmpne) {
+	ldrb	r3, [jpc, #3]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #5]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #6]
+	cmp	r2, r3
+	bne	branch_taken_unsafe_4
+	DISPATCH 7
+}
+
+(iload_iload_N)
+(if_icmpne,if_acmpne) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #opc_iload_0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bne	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(if_icmpne,if_acmpne) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bne	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(if_icmpne,if_acmpne) {
+	rsb	r3, r2, #opc_iload_0
+	ldrsb	r1, [jpc, #3]
+	rsb	r2, r0, #opc_iload_0_iload_N
+	ldr	r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	bne	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iload)
+(if_icmplt) {
+	ldrb	r3, [jpc, #3]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #5]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #6]
+	cmp	r2, r3
+	blt	branch_taken_unsafe_4
+	DISPATCH 7
+}
+
+(iload_iload_N)
+(if_icmplt) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #opc_iload_0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	blt	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(if_icmplt) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	blt	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(if_icmplt) {
+	rsb	r3, r2, #opc_iload_0
+	ldrsb	r1, [jpc, #3]
+	rsb	r2, r0, #opc_iload_0_iload_N
+	ldr	r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	blt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iload)
+(if_icmpge) {
+	ldrb	r3, [jpc, #3]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #5]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #6]
+	cmp	r2, r3
+	bge	branch_taken_unsafe_4
+	DISPATCH 7
+}
+
+(iload_iload_N)
+(if_icmpge) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #opc_iload_0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bge	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(if_icmpge) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bge	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(if_icmpge) {
+	rsb	r3, r2, #opc_iload_0
+	ldrsb	r1, [jpc, #3]
+	rsb	r2, r0, #opc_iload_0_iload_N
+	ldr	r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	bge	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iload)
+(if_icmpgt) {
+	ldrb	r3, [jpc, #3]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #5]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #6]
+	cmp	r2, r3
+	bgt	branch_taken_unsafe_4
+	DISPATCH 7
+}
+
+(iload_iload_N)
+(if_icmpgt) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #opc_iload_0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bgt	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(if_icmpgt) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	bgt	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(if_icmpgt) {
+	rsb	r3, r2, #opc_iload_0
+	ldrsb	r1, [jpc, #3]
+	rsb	r2, r0, #opc_iload_0_iload_N
+	ldr	r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	bgt	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+(iload_iload)
+(if_icmple) {
+	ldrb	r3, [jpc, #3]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #5]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #6]
+	cmp	r2, r3
+	ble	branch_taken_unsafe_4
+	DISPATCH 7
+}
+
+(iload_iload_N)
+(if_icmple) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r2, #0
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #opc_iload_0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	ble	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
+(if_icmple) {
+	ldrb	r3, [jpc, #2]
+	rsb	r2, r0, #opc_iload_0_iload
+	ldrsb	r1, [jpc, #4]
+	rsb	r3, r3, #0
+	ldr	r2, [locals, r2, lsl #2]
+	ldr	r3, [locals, r3, lsl #2]
+	ldrb	ip, [jpc, #5]
+	cmp	r2, r3
+	ble	branch_taken_unsafe_3
+	DISPATCH 6
+}
+
+(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
+(if_icmple) {
+	rsb	r3, r2, #opc_iload_0
+	ldrsb	r1, [jpc, #3]
+	rsb	r2, r0, #opc_iload_0_iload_N
+	ldr	r3, [locals, r3, lsl #2]
+	ldr	r2, [locals, r2, lsl #2]
+	ldrb	ip, [jpc, #4]
+	cmp	r2, r3
+	ble	branch_taken_unsafe_2
+	DISPATCH 5
+}
+
+#endif
+
+#endif // FAST_BYTECODES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,6336 @@
+@ Copyright 2009, 2010 Edward Nevill
+@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+@
+@ This code is free software; you can redistribute it and/or modify it
+@ under the terms of the GNU General Public License version 2 only, as
+@ published by the Free Software Foundation.
+@
+@ This code 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
+@ version 2 for more details (a copy is included in the LICENSE file that
+@ accompanied this code).
+@
+@ You should have received a copy of the GNU General Public License version
+@ 2 along with this work; if not, write to the Free Software Foundation,
+@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#undef THUMB2EE
+#if !defined(DISABLE_THUMB2) && defined(HOTSPOT_ASM) && !defined(SHARK)
+#define THUMB2EE
+#endif
+
+#ifdef HOTSPOT_ASM
+
+#define ARMv4
+
+#if defined(SHARK) || defined(THUMB2EE)
+
+#define USE_COMPILER
+
+#endif
+
+#ifdef USE_COMPILER
+
+#ifdef SHARK
+#define MP_COMPILE_THRESHOLD    0x10000         // 65536 - must be a single MOV constant
+#define UP_COMPILE_THRESHOLD    0x30000         // 196608 - must be a single MOV constant
+#else
+#define MP_COMPILE_THRESHOLD    0x2700		// 10000 - must be a single MOV constant
+#define UP_COMPILE_THRESHOLD    0x2700		// 10000 - must be a single MOV constant
+#endif
+
+#define MAX_FG_METHOD_SIZE      500
+
+#ifndef DISABLE_ON_STACK_REPLACEMENT
+#define ON_STACK_REPLACEMENT
+#endif
+#ifndef ENABLE_BG_COMP_ON_NON_MP
+#define DISABLE_BG_COMP_ON_NON_MP
+#endif
+
+#ifdef THUMB2EE
+#define FREQ_COUNT_OVERFLOW Thumb2_Compile
+#else
+#define FREQ_COUNT_OVERFLOW _ZN18InterpreterRuntime26frequency_counter_overflowEP10JavaThreadPh
+#endif
+
+#endif // USE_COMPILER
+
+#ifndef DISABLE_NOTICE_SAFEPOINTS
+#define NOTICE_SAFEPOINTS
+#endif
+#ifndef DISABLE_HW_NULL_PTR_CHECK
+#define HW_NULL_PTR_CHECK
+#endif
+#ifndef DISABLE_FAST_BYTECODES
+#define FAST_BYTECODES
+#endif
+#ifndef DISABLE_HW_FP
+#define HW_FP
+#endif
+
+#define LEAF_STACK_SIZE	200
+#define STACK_SPARE	40
+
+#define stack		r4
+#define	jpc		r5
+#define dispatch	r6
+#define locals		r7
+#define istate		r8
+#define constpool	r9
+#define arm_sp		r13
+
+#define tmp_xxx		r7
+#define tmp_yyy		r5
+#define tmp_vvv		r9
+
+#define tmp1		r11
+#define tmp2		r10
+
+#define regset		r4,r5,r6,r7,r9,r10,r11
+#define fast_regset	r8
+
+#include "offsets_arm.s"
+
+#define last_implemented_bytecode 201
+
+#define CODE_ALIGN_SIZE 64
+
+	.macro	ALIGN_CODE
+	.align	6
+	.endm
+
+	.macro	ALIGN_DATA
+	.align	6
+	.endm
+
+	.macro	ALIGN_OPCODE
+	.align	6
+	.endm
+
+	.macro	ALIGN_WORD
+	.align	2
+	.endm
+
+@------------------------------------------------
+@ Software NULL Pointer check macro.
+@ Usage:
+@	SW_NPC	cmp	obj, #0
+@	SW_NPC	beq	null_ptr_exception
+@------------------------------------------------
+	.macro	SW_NPC	p1, p2, p3, p4
+#ifndef HW_NULL_PTR_CHECK
+  .ifnes "\p4", ""
+	\p1 \p2, \p3, \p4
+  .else
+    .ifnes "\p3", ""
+	\p1 \p2, \p3
+    .else
+	\p1 \p2
+    .endif
+  .endif
+#endif // HW_NULL_PTR_CHECK
+	.endm
+
+	.macro	HW_NPC	p1, p2, p3, p4
+#ifdef HW_NULL_PTR_CHECK
+  .ifnes "\p4", ""
+	\p1 \p2, \p3, \p4
+  .else
+    .ifnes "\p3", ""
+	\p1 \p2, \p3
+    .else
+	\p1 \p2
+    .endif
+  .endif
+#endif // HW_NULL_PTR_CHECK
+	.endm
+
+@------------------------------------------------
+@ Fast Bytecode Macros FBC and NFBC
+@ Use to conditionalise code using fast bytecodes
+@ EG:
+@	FBC	mov	r0, #opc_invokeresolved
+@	FBC	b	rewrite_bytecode
+@	NFBC	code to handle slow case
+@	NFBC	...
+@------------------------------------------------
+	.macro	FBC	p1, p2, p3, p4, p5
+#ifdef FAST_BYTECODES
+  .ifnes "\p5", ""
+	  \p1 \p2, \p3, \p4, \p5
+  .else
+    .ifnes "\p4", ""
+	  \p1 \p2, \p3, \p4
+    .else
+      .ifnes "\p3", ""
+	  \p1 \p2, \p3
+      .else
+	  \p1 \p2
+      .endif
+    .endif
+  .endif
+#endif
+	.endm
+
+	.macro	NFBC	p1, p2, p3, p4
+#ifndef FAST_BYTECODES
+  .ifnes "\p4", ""
+	\p1 \p2, \p3, \p4
+  .else
+    .ifnes "\p3", ""
+	\p1 \p2, \p3
+    .else
+	\p1 \p2
+    .endif
+  .endif
+#endif
+	.endm
+
+@------------------------------------------------
+@ Notice Safepoints macro
+@ Usage:
+@	NSP	<notice safepoint specific code>
+@------------------------------------------------
+	.macro	NSP	p1, p2, p3, p4, p5
+#ifdef NOTICE_SAFEPOINTS
+  .ifnes "\p5", ""
+	  \p1 \p2, \p3, \p4, \p5
+  .else
+    .ifnes "\p4", ""
+	  \p1 \p2, \p3, \p4
+    .else
+      .ifnes "\p3", ""
+	  \p1 \p2, \p3
+      .else
+	  \p1 \p2
+      .endif
+    .endif
+  .endif
+#endif
+	.endm
+
+@------------------------------------------------
+@ Use Compiler macro
+@ Usage:
+@	USEC	<compiler specific code>
+@------------------------------------------------
+	.macro	USEC	p1, p2, p3, p4
+#ifdef USE_COMPILER
+  .ifnes "\p4", ""
+	\p1 \p2, \p3, \p4
+  .else
+    .ifnes "\p3", ""
+	\p1 \p2, \p3
+    .else
+	\p1 \p2
+    .endif
+  .endif
+#endif
+	.endm
+
+@------------------------------------------------
+@ On stack replacement macro
+@ Usage:
+@       OSR     <compiler specific code>
+@------------------------------------------------
+        .macro  OSR     p1, p2, p3, p4
+#ifdef ON_STACK_REPLACEMENT
+  .ifnes "\p4", ""
+        \p1 \p2, \p3, \p4
+  .else
+    .ifnes "\p3", ""
+        \p1 \p2, \p3
+    .else
+        \p1 \p2
+    .endif
+  .endif
+#endif
+        .endm
+@------------------------------------------------
+@ THUMB2 specific code macro
+@ Usage:
+@	T2	<thumb2 specific code>
+@------------------------------------------------
+	.macro	T2	p1, p2, p3, p4
+#ifdef THUMB2EE
+  .ifnes "\p4", ""
+        \p1 \p2, \p3, \p4
+  .else
+    .ifnes "\p3", ""
+        \p1 \p2, \p3
+    .else
+        \p1 \p2
+    .endif
+  .endif
+#endif
+        .endm
+
+	.macro	Opcode	label
+	ALIGN_OPCODE
+do_\label:
+	.endm
+
+	.macro	GET_STACK	offset, reg
+	ldr	\reg, [stack, #(\offset+1) * 4]
+	.endm
+
+	.macro	PUT_STACK	offset, reg
+	str	\reg, [stack, #(\offset+1) * 4]
+	.endm
+
+#define PUSH	java_push
+	.macro	PUSH	reg1, reg2, reg3, reg4
+  .ifnes "\reg4", ""
+	stmda	stack!, {\reg1, \reg2, \reg3, \reg4}
+  .else
+    .ifnes "\reg3", ""
+	stmda	stack!, {\reg1, \reg2, \reg3}
+    .else
+      .ifnes "\reg2", ""
+	stmda	stack!, {\reg1, \reg2}
+      .else
+	str	\reg1, [stack], #-4
+      .endif
+    .endif
+  .endif
+	.endm
+
+#define POP	java_pop
+	.macro	POP	reg1, reg2, reg3, reg4
+  .ifnes "\reg4", ""
+	ldmib	stack!, {\reg1, \reg2, \reg3, \reg4}
+  .else
+    .ifnes "\reg3", ""
+	ldmib	stack!, {\reg1, \reg2, \reg3}
+    .else
+      .ifnes "\reg2", ""
+	ldmib	stack!, {\reg1, \reg2}
+      .else
+	ldr	\reg1, [stack, #4]!
+      .endif
+    .endif
+  .endif
+	.endm
+
+	.macro	CACHE_JPC
+	ldr	jpc, [istate, #ISTATE_BCP]
+	.endm
+
+	.macro	CACHE_LOCALS
+	ldr	locals, [istate, #ISTATE_LOCALS]
+	.endm
+
+	.macro	CACHE_STACK
+	ldr	stack, [istate, #ISTATE_STACK]
+	.endm
+
+	.macro	CACHE_CP
+	ldr	constpool, [istate, #ISTATE_CONSTANTS]
+	.endm
+
+	.macro	DECACHE_STACK
+	str	stack, [istate, #ISTATE_STACK]
+	.endm
+
+	.macro	DECACHE_JPC
+	str	jpc, [istate, #ISTATE_BCP]
+	.endm
+
+	.macro	BREAK_DISPATCH
+	ldr	r1, [dispatch, #DispatchBreakPoint-XXX]
+	cmp	r1, jpc
+	bleq	do_dispatch_break
+	.endm
+
+	.set	dispatch_state, 0
+
+	.macro	DISPATCH_STATE	state
+	.set	dispatch_state, \state
+	.endm
+
+	.macro	DISPATCH_START	step=0
+	.set	dispatch_state, 1
+	ldrb	r0, [jpc, #\step]!
+	.endm
+
+	.macro	DISPATCH_START_REG	reg
+	.set	dispatch_state, 1
+	ldrb	r0, [jpc, \reg]!
+	.endm
+
+	.macro	DISPATCH_START_R2_R0
+	.set	dispatch_state, 1
+	mov	r0, r2
+	.endm
+
+	.macro	DISPATCH_START_R2_JPC
+	.set	dispatch_state, 1
+	add	jpc, jpc, #1
+	.endm
+
+	.macro	DISPATCH_START_R2
+	.set	dispatch_state, 1
+	add	jpc, jpc, #1
+	mov	r0, r2
+	.endm
+
+	.macro	DISPATCH_1
+@        ldrb    r1, [jpc, #2]
+	.endm
+
+	.macro	DISPATCH_2
+        ldr     ip, [dispatch, r0, lsl #2]
+	.endm
+
+	.macro	DISPATCH_3
+        ldrb    r2, [jpc, #1]
+	.endm
+
+	.macro	DISPATCH_4
+        ands    lr, ip, #7
+	.endm
+
+	.macro	DISPATCH_NEXT
+    .if dispatch_state == 0
+	.error	"DISPATCH_FINISH without a DISPATCH_START or DISPATCH_STATE"
+    .elseif dispatch_state == 1
+	DISPATCH_1
+    .elseif dispatch_state == 2
+	DISPATCH_2
+    .elseif dispatch_state == 3
+	DISPATCH_3
+    .elseif dispatch_state == 4
+	DISPATCH_4
+    .else
+	.error "Too many DISPATCH_NEXTs"
+    .endif
+	.set	dispatch_state, dispatch_state + 1
+	.endm
+
+	.macro	DISPATCH_FINISH
+    .if dispatch_state == 0
+	.error	"DISPATCH_FINISH without a DISPATCH_START or DISPATCH_STATE"
+    .elseif dispatch_state == 1
+	DISPATCH_1
+	DISPATCH_2
+	DISPATCH_3
+	DISPATCH_4
+    .elseif dispatch_state == 2
+	DISPATCH_2
+	DISPATCH_3
+	DISPATCH_4
+    .elseif dispatch_state == 3
+	DISPATCH_3
+	DISPATCH_4
+    .elseif dispatch_state == 4
+	DISPATCH_4
+    .endif
+        moveq   pc, ip
+	ldrb	r1, [jpc, lr]
+        bic     ip, ip, #7
+        ldr     pc, [ip, r1, lsl #2]
+	.set	dispatch_state, 0
+	.endm
+
+	.macro	DISPATCH_BYTECODE
+@        ldrb    r1, [jpc, #2]
+        ldr     ip, [dispatch, r0, lsl #2]
+        ldrb    r2, [jpc, #1]
+        ands    lr, ip, #7
+        moveq   pc, ip
+	ldrb	r1, [jpc, lr]
+        bic     ip, ip, #7
+        ldr     pc, [ip, r1, lsl #2]
+	.endm
+
+	.macro	DISPATCH step=0
+	ldrb	r0, [jpc, #\step]!
+@        ldrb    r1, [jpc, #2]
+        ldr     ip, [dispatch, r0, lsl #2]
+        ldrb    r2, [jpc, #1]
+        ands    lr, ip, #7
+        moveq   pc, ip
+	ldrb	r1, [jpc, lr]
+        bic     ip, ip, #7
+        ldr     pc, [ip, r1, lsl #2]
+	.endm
+
+#define FFI_TYPE_VOID		0
+#define FFI_TYPE_FLOAT		2
+#define	FFI_TYPE_DOUBLE		3
+#define FFI_TYPE_BOOL		5
+#define	FFI_TYPE_SINT8		6
+#define FFI_TYPE_UINT16		7
+#define FFI_TYPE_SINT16		8
+#define FFI_TYPE_SINT32		10
+#define FFI_TYPE_SINT64		12
+#define FFI_TYPE_POINTER	14
+
+	.macro	_BLX	reg
+	mov	lr, pc
+	mov	pc, \reg
+	.endm
+
+	.macro	_BX	reg
+	mov	pc, \reg
+	.endm
+
+	.macro	_BXEQ	reg
+	moveq	pc, \reg
+	.endm
+
+	.macro	_BXNE	reg
+	movne	pc, \reg
+	.endm
+
+#ifdef ARMv4
+
+#define blx _BLX
+#define bx _BX
+#define bxeq _BXEQ
+#define bxne _BXNE
+	.arch armv4
+
+#else
+	.arch armv7-a
+#endif
+#ifdef HW_FP
+	.fpu vfp
+#else
+	.fpu softvfp
+#endif
+	.eabi_attribute 20, 1
+	.eabi_attribute 21, 1
+	.eabi_attribute 23, 3
+	.eabi_attribute 24, 1
+	.eabi_attribute 25, 1
+	.eabi_attribute 26, 2
+	.eabi_attribute 30, 2
+	.eabi_attribute 18, 4
+
+	.text
+
+	.global	cmpxchg_ptr
+cmpxchg_ptr:
+	stmfd	sp!, {r4, r5, r6, r7, r8, lr}
+	mov	r6, #0xffffffc0
+	mov	r4, r2
+	mov	r7, r0
+	mov	r5, r1
+	bic	r6, r6, #0xf000
+	mov	r8, r2
+1:
+	ldr	r3, [r5, #0]
+	mov	r0, r4
+	mov	r1, r7
+	mov	r2, r5
+	cmp	r4, r3
+	bne	2f
+	blx	r6
+	cmp	r0, #0
+	bne	1b
+	mov	r0, r8
+	ldmfd	sp!, {r4, r5, r6, r7, r8, pc}
+2:
+	mov	r8, r3
+	mov	r0, r8
+	ldmfd	sp!, {r4, r5, r6, r7, r8, pc}
+
+build_frame:
+	mov	r3, r0
+	ldr	r0, [r1, #METHOD_ACCESSFLAGS]
+	stmfd	arm_sp!, {r4, r5, r6, r7, r8}
+	ands	r7, r0, #JVM_ACC_SYNCHRONIZED
+	movne	r7, #2
+	tst	r0, #JVM_ACC_NATIVE
+	mov	r4, #0
+	movne	r5, #0
+	ldreqh	r6, [r1, #METHOD_MAXLOCALS]
+	ldrneh	r6, [r1, #METHOD_SIZEOFPARAMETERS]
+	ldreq	r0, [r3, #8]
+	subeq	r6, r6, #1
+	ldrne	r0, [r3, #8]
+	subne	r6, r6, #1
+	ldreqh	r5, [r1, #METHOD_MAXSTACK]
+	addeq	r6, r0, r6, asl #2
+	addne	r6, r0, r6, asl #2
+	sub	ip, r0, #4
+	str	ip, [r3, #8]
+	mov     ip, #INTERPRETER_FRAME
+	str	r4, [r0, #-4]
+	ldr	r0, [r3, #8]
+	sub	r8, r0, #4
+	str	r8, [r3, #8]
+	str	ip, [r0, #-4]
+	ldr	r8, [r3, #8]
+	sub	ip, r8, #68
+	str	ip, [r3, #8]
+	str	r2, [r8, #-68]
+	mov	r8, #0
+	str	r4, [ip, #44]
+	str	r6, [ip, #8]
+	str	r1, [ip, #16]
+	str	ip, [ip, #64]
+	ldr	r2, [r1, #METHOD_ACCESSFLAGS]
+	tst	r2, #JVM_ACC_NATIVE
+	mov	r2, #0
+	ldreq	r4, [r1, #METHOD_CONSTMETHOD]
+	addeq	r4, r4, #CONSTMETHOD_CODEOFFSET
+	str	r4, [ip, #4]
+	ldr	r4, [r1, #METHOD_CONSTANTS]
+	ldr	r4, [r4, #CONSTANTPOOL_CACHE]
+	str	r8, [ip, #28]
+	str	r2, [ip, #32]
+	str	r4, [ip, #12]
+	str	r2, [ip, #48]
+	str	r2, [ip, #20]
+	ldr	r2, [r3, #8]
+	str	r2, [ip, #60]
+	ldr	r2, [r1, #METHOD_ACCESSFLAGS]
+	tst	r2, #JVM_ACC_SYNCHRONIZED
+	beq	.L10
+	ldr	r2, [r3, #8]
+	sub	r7, r2, r7, asl #2
+	str	r7, [r3, #8]
+	ldr	r2, [r1, #METHOD_ACCESSFLAGS]
+	tst	r2, #JVM_ACC_STATIC
+	ldrne	r2, [r1, #METHOD_CONSTANTS]
+	ldreq	r2, [r6, #0]
+	ldrne	r2, [r2, #16]
+	ldrne	r2, [r2, #60]
+	str	r2, [r7, #4]
+.L10:
+	ldr	r2, [r3, #8]
+	cmp	r5, #0
+	str	r2, [ip, #52]
+	ldr	r2, [r3, #8]
+	sub	r2, r2, #4
+	str	r2, [ip, #24]
+	ldrne	r2, [r3, #8]
+	ldreq	r5, [r3, #8]
+	subne	r5, r2, r5, asl #2
+	strne	r5, [r3, #8]
+	sub	r5, r5, #4
+	str	r5, [ip, #56]
+	ldmfd	arm_sp!, {r4, r5, r6, r7, r8}
+	bx	lr
+
+	ALIGN_CODE
+	.global	asm_generate_method_entry
+asm_generate_method_entry:
+	mov	r3, r0
+	mov	r0, #0
+#ifdef PRODUCT
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r1, r2}
+	add	r1, r1, ip
+	add	r1, r1, r2		@ r1->dispatch
+
+	ldr	r2, [r1, #can_post_interpreter_events-XXX]
+	ldrb	r2, [r2]
+	cmp	r2, #0
+	bne	1f
+
+	ldr	r2, [r1, #PrintCommandLineFlags_Address-XXX]
+	ldrb	r2, [r2]
+	cmp	r2, #0
+	bne	1f
+
+	cmp	r3, #14
+	adrcc	ip, asm_method_table
+	ldrcc	r0, [ip, r3, lsl #2]
+1:
+#endif // PRODUCT
+	bx	lr
+asm_method_table:
+	.word	normal_entry
+	.word	normal_entry_synchronized
+	.word	native_entry
+	.word	native_entry_synchronized
+	.word	empty_entry
+	.word	accessor_entry
+	.word	normal_entry		@ abstract entry
+	.word	normal_entry		@ java_lang_math_sin
+	.word	normal_entry		@ java_lang_math_cos
+	.word	normal_entry		@ java_lang_math_tan
+	.word	normal_entry		@ java_lang_math_abs
+	.word	normal_entry		@ java_lang_math_sqrt
+	.word	normal_entry		@ java_lang_math_log
+	.word	normal_entry		@ java_lang_math_log10
+
+	ALIGN_CODE
+native_entry_synchronized:
+	b	fast_native_entry_synchronized
+
+	ALIGN_CODE
+fast_native_entry_synchronized:
+	b	_ZN14CppInterpreter12native_entryEP13methodOopDesciP6Thread
+
+	ALIGN_CODE
+empty_entry:
+	b	fast_empty_entry
+
+	ALIGN_CODE
+fast_empty_entry:
+	ldr	r3, .L1359
+	ldr	r1, .L1359+4
+.LPIC19:
+	add	r3, pc, r3
+
+	ldr	ip, [r3, r1]
+	ldr	r3, [ip, #0]
+	cmp	r3, #0
+	bne	normal_entry_synchronized
+
+	ldrh	r3, [r0, #42]
+	ldr	r1, [r2, #THREAD_JAVA_SP]
+	add	r1, r1, r3, lsl #2
+	str	r1, [r2, #THREAD_JAVA_SP]
+	bx	lr
+.L1359:
+	.word	_GLOBAL_OFFSET_TABLE_-(.LPIC19+8)
+	.word	_ZN20SafepointSynchronize6_stateE(GOT)
+
+@ ---- START execute.s ---------------------------------------------------------------------
+
+	.global	asm_check_null_ptr
+asm_check_null_ptr:
+
+#ifdef HW_NULL_PTR_CHECK
+
+#define uc_mcontext		20
+#define arm_registers_offset	12
+#define arm_cpsr_offset		16*4
+
+	add	r0, r0, #uc_mcontext + arm_registers_offset
+	ldr	r1, [r0, #15*4]
+	adr	ip, abort_table
+abort_loop:
+	ldr	r2, [ip], #8
+	cmp	r2, #0
+	beq	2f
+	cmp	r2, r1
+	bne	abort_loop
+
+	ldr	r3, [ip, #-4]
+	cmp	r3, #8
+	bcs	1f
+
+	ldr	ip, [r0, #5*4]
+	sub	ip, ip, r3
+	str	ip, [r0, #5*4]
+
+	adrl	r3, null_ptr_exception
+1:
+	str	r3, [r0, #15*4]
+do_setcontext:
+	mov	r0, #1
+	bx	lr
+#endif // HW_NULL_PTR_CHECK
+2:
+#ifdef THUMB2EE
+	b	Thumb2_Check_Null
+#else
+	mov	r0, #0
+	bx	lr
+#endif
+
+#ifdef HW_NULL_PTR_CHECK
+abort_table:
+			.word	.abortentry5, 1
+			.word	.abortentry6, 1
+			.word	.abortentry7, 1
+			.word	.abortentry8, 1
+			.word	.abortentry9, 1
+			.word	.abortentry10, 1
+			.word	.abortentry11, 1
+			.word	.abortentry12, 1
+			.word	.abortentry13, 1
+
+		FBC	.word	.abortentry19, 1
+		FBC	.word	.abortentry20, 1
+		FBC	.word	.abortentry21, 1
+		FBC	.word	.abortentry22, 1
+		FBC	.word	.abortentry23, 1
+		FBC	.word	.abortentry24, 1
+		FBC	.word	.abortentry25, 1
+		FBC	.word	.abortentry26, 1
+		FBC	.word	.abortentry27, 1
+		FBC	.word	.abortentry28, 1
+		FBC	.word	.abortentry29, 1
+		FBC	.word	.abortentry30, 1
+		FBC	.word	.abortentry31, 1
+		FBC	.word	.abortentry32, 1
+
+		FBC	.word	.abortentry38, 2
+		FBC	.word	.abortentry39, 3
+		FBC	.word	.abortentry40, 4
+		FBC	.word	.abortentry41, 3
+		FBC	.word	.abortentry42, 2
+		FBC	.word	.abortentry42_1, 2
+		FBC	.word	.abortentry43, 0
+		FBC	.word	.abortentry44, 1
+		FBC	.word	.abortentry45, 3
+		FBC	.word	.abortentry46, 2
+		FBC	.word	.abortentry47, 0
+		FBC	.word	.abortentry48, 1
+		FBC	.word	.abortentry49, 0
+		FBC	.word	.abortentry50, 1
+		FBC	.word	.abortentry51, 0
+		FBC	.word	.abortentry52, 1
+
+		FBC	.word	.abortentry58, 2
+		FBC	.word	.abortentry59, 2
+		FBC	.word	.abortentry60, 2
+
+		FBC	.word	.abortentry73, 1
+		FBC	.word	.abortentry74, 1
+		FBC	.word	.abortentry75, 1
+		FBC	.word	.abortentry76, 1
+		FBC	.word	.abortentry77, 1
+
+	    FBC		.word	.abortentry78, 3
+	    FBC		.word	.abortentry79, 3
+	    FBC		.word	.abortentry80, 3
+	    FBC		.word	.abortentry81, 3
+	    FBC		.word	.abortentry82, 3
+	    FBC		.word	.abortentry83, 3
+	    FBC		.word	.abortentry84, 3
+	    FBC		.word	.abortentry85, 3
+	    FBC		.word	.abortentry86, 3
+	    FBC		.word	.abortentry87, 3
+
+	    FBC    	.word	.abortentry88, 3
+	    FBC	   	.word	.abortentry89, 5
+	    FBC	     	.word	.abortentry90, 4
+	    FBC	     	.word	.abortentry91, 4
+	    FBC		.word	.abortentry104, 0
+		FBC	.word	.abortentry105, 1
+		FBC	.word	.abortentry106, 1
+		FBC	.word	.abortentry107, 1
+		FBC	.word	.abortentry108, 1
+		FBC	.word	.abortentry109, 1
+			.word	.abortentry110, 0
+
+		FBC	.word	.abortentry111, 3
+		FBC	.word	.abortentry112, 3
+
+		FBC	.word	.abortentry113, 0
+			.word	.abortentry114, 1
+		FBC	.word	.abortentry117, 0
+			.word	.abortentry118, 0
+	.word	0
+
+#endif
+
+
+	ALIGN_CODE
+native_entry:
+	stmfd	arm_sp!, {regset, lr}
+	bl	fast_native_entry
+	ldmia	sp!, {regset, pc}
+
+	ALIGN_CODE
+fast_native_entry:
+	adrl	ip, dispatch_init_adcon
+	mov	r11, r0
+	ldm	ip, {dispatch, r7}
+	stmdb	sp!, {fast_regset, lr}
+	add	dispatch, dispatch, ip
+	add	dispatch, dispatch, r7
+	ldrh	r1, [r11, #METHOD_SIZEOFPARAMETERS]
+	ldr	r4, [r2, #THREAD_JAVA_SP]
+	ldr	r3, [r2, #THREAD_TOP_ZERO_FRAME]
+	mov	r0, #0
+	mov	ip, #INTERPRETER_FRAME
+	sub	r9, r4, #FRAME_SIZE
+	str	r9, [r2, #THREAD_JAVA_SP]	@ drop stack
+	sub	r5, r9, #4		@ stack limit = r9 - 4
+	str	r3, [r9, #ISTATE_NEXT_FRAME]
+	str	ip, [r9, #ISTATE_FRAME_TYPE]
+	str	r9, [r9, #ISTATE_MONITOR_BASE]
+	str	r5, [r9, #ISTATE_STACK_LIMIT]
+	str	r9, [r9, #ISTATE_STACK_BASE]
+	str	r0, [r9, #ISTATE_OOP_TEMP]
+
+@	str	r0, [r9, #ISTATE_CALLEE]
+@	str	r0, [r9, #ISTATE_PREV_LINK]
+	str	r0, [r9, #ISTATE_MSG]
+@	str	r0, [r9, #ISTATE_MDX]
+
+	ldr	r10, [r11, #METHOD_CONSTANTS]
+	sub	r7, r4, #4
+	mov	r5, #0
+	add	r7, r7, r1, lsl #2
+
+	ldr	r10, [r10, #CONSTANTPOOL_CACHE]
+
+	str	r2, [r9, #ISTATE_THREAD]
+	str	r5, [r9, #ISTATE_BCP]
+	str	r7, [r9, #ISTATE_LOCALS]
+	str	r10, [r9, #ISTATE_CONSTANTS]
+	str	r11, [r9, #ISTATE_METHOD]
+
+@	stmia	r9, {r2, r5, r7, r10, r11}
+	ldr	r1, [r2, #THREAD_STACK_SIZE]
+	ldr	r3, [r2, #THREAD_STACK_BASE]
+	add	r0, r9, #72
+	mov	r9, r2
+	rsb	r3, r1, r3
+	rsb	r3, r3, arm_sp
+	cmp	r3, #4096
+	str	r0, [r9, #THREAD_TOP_ZERO_FRAME]
+	ldr	r5, [r11, #METHOD_SIGNATUREHANDLER]
+	blt	.fast_native_entry_throw_stack_overflow
+	cmp	r5, #0
+	bne	.fast_native_entry_got_handleraddr
+	str	r0, [r9, #THREAD_LAST_JAVA_SP]
+	mov	r0, r9
+	mov	r1, r11
+	bl	_ZN18InterpreterRuntime19prepare_native_callEP10JavaThreadP13methodOopDesc
+	ldr	r11, [r9, #THREAD_TOP_ZERO_FRAME]
+	ldr	r1, [r9, #THREAD_PENDING_EXC]
+	str	r5, [r9, #THREAD_LAST_JAVA_SP]
+	ldr	r11, [r11, #-72 + ISTATE_METHOD]
+	cmp	r1, #0
+	bne	.fast_native_entry_exception
+	ldr	r5, [r11, #METHOD_SIGNATUREHANDLER]
+.fast_native_entry_got_handleraddr:
+	ldr	r2, [dispatch, #InterpreterRuntime_slow_signature_handler_Address-XXX]
+	cmp	r5, r2
+	bne	.fast_native_entry_get_handler
+	ldr	r3, [r9, #THREAD_TOP_ZERO_FRAME]
+	mov	r2, #0
+	mov	r0, r9
+	str	r3, [r9, #THREAD_LAST_JAVA_SP]
+	mov	r3, r2
+	mov	r1, r11
+	bl	_ZN18InterpreterRuntime22slow_signature_handlerEP10JavaThreadP13methodOopDescPiS4_
+	ldr	r11, [r9, #THREAD_TOP_ZERO_FRAME]
+	ldr	r1, [r9, #THREAD_PENDING_EXC]
+	mov	r3, #0
+	ldr	r11, [r11, #-72 + ISTATE_METHOD]
+	cmp	r1, #0
+	str	r3, [r9, #THREAD_LAST_JAVA_SP]
+	mov	r5, r0
+	bne	.fast_native_entry_exception
+.fast_native_entry_get_handler:
+
+	sub	ip, r7, r4
+	add	r3, r4, #ISTATE_OOP_TEMP-76
+
+	mov	ip, ip, asr #2
+	mov	r4, arm_sp
+
+	add	lr, ip, #4
+	sub	arm_sp, arm_sp, #16
+
+	bic	lr, lr, #1
+	add	r1, r5, #24
+
+	sub	arm_sp, arm_sp, lr, lsl #2
+	add	r2, r9, #THREAD_JNI_ENVIRONMENT
+
+	mov	lr, arm_sp
+	str	r2, [lr], #4
+
+	ldr	r2, [r11, #METHOD_ACCESSFLAGS]
+	add	r1, r1, #4
+	tst	r2, #JVM_ACC_STATIC
+	beq	.do_fast_copy_args
+
+	ldr	r2, [r11, #METHOD_CONSTANTS]
+	ldr	r2, [r2, #16]
+	str	r3, [lr], #4
+	ldr	r2, [r2, #60]
+	add	r1, r1, #4
+	str	r2, [r3]
+
+
+.do_fast_copy_args:
+	cmp	ip, #0
+	blt	.fast_no_args
+
+.fast_copy_args:
+	ldr	r0, [r1], #4
+	ldrh	r3, [r0, #6]
+	ldr	r2, [r7], #-4
+	cmp	r3, #FFI_TYPE_DOUBLE
+	cmpne	r3, #FFI_TYPE_SINT64
+	beq	.fast_copy_long
+
+	cmp	r3, #FFI_TYPE_POINTER
+	beq	.fast_copy_ptr
+
+	subs	ip, ip, #1
+	str	r2, [lr], #4
+	bge	.fast_copy_args
+	b	.fast_no_args
+
+.fast_copy_long:
+	tst	lr, #4
+	ldr	r3, [r7], #-4
+	addne	lr, lr, #4
+	str	r2, [lr, #4]
+	subs	ip, ip, #2
+	str	r3, [lr], #8
+	bge	.fast_copy_args
+	b	.fast_no_args
+
+.fast_copy_ptr:
+	cmp	r2, #0
+	addne	r2, r7, #4
+	subs	ip, ip, #1
+	str	r2, [lr], #4
+	bge	.fast_copy_args
+
+.fast_no_args:
+	ldr	r0, [r9, #THREAD_TOP_ZERO_FRAME]
+	mov	r2, #_thread_in_native
+
+	str	r0, [r9, #THREAD_LAST_JAVA_SP]
+	str	r2, [r9, #THREAD_STATE]
+
+	ldr	ip, [r11, #METHOD_NATIVEHANDLER]
+	ldrh	r11, [r11, #METHOD_SIZEOFPARAMETERS]
+
+	ldmia	arm_sp!, {r0, r1, r2, r3}
+	blx	ip
+
+	mov	ip, #_thread_in_native_trans
+	mov	arm_sp, r4
+
+	ldr	r3, [dispatch, #SafePointSynchronize_state_Address-XXX]
+	str	ip, [r9, #THREAD_STATE]
+
+	ldr	r3, [r3, #0]
+	cmp	r3, #0
+	ldreq	r3, [r9, #THREAD_SUSPEND_FLAGS]
+	cmpeq	r3, #0
+	bne	.fast_native_entry_do_special
+
+.fast_native_entry_do_return:
+	mov	r3, #_thread_in_Java
+	mov	r2, #0
+
+	str	r3, [r9, #THREAD_STATE]
+	str	r2, [r9, #THREAD_LAST_JAVA_SP]
+
+	add	r2, r5, #24
+	ldr	r3, [r5, #4]
+
+	ldr	r5, [r9, #THREAD_TOP_ZERO_FRAME]
+
+	ldr	lr, [r5], #4
+
+	add	r5, r5, r11, lsl #2
+
+	ldr	ip, [r2, r3, asl #2]
+	adr	r3, .return_type_table
+
+	ldrh	r2, [ip, #6]
+	ldr	ip, [r9, #THREAD_ACTIVE_HANDLES]
+
+	mov	tmp1, #0
+	ldr	pc, [r3, r2, lsl #2]
+
+.return_type_table:
+	.word	.fast_native_return_void	@ FFI_TYPE_VOID	== 0
+	.word	0
+	.word	.fast_native_return_w		@ FFI_TYPE_FLOAT == 2
+	.word	.fast_native_return_dw		@ FFI_TYPE_DOUBLE == 3
+	.word	0
+	.word	.fast_native_return_bool	@ FFI_TYPE_BOOL == 5
+	.word	.fast_native_return_byte	@ FFI_TYPE_SINT8 == 6
+	.word	.fast_native_return_char	@ FFI_TYPE_UINT16 == 7
+	.word	.fast_native_return_short	@ FFI_TYPE_SINT16 == 8
+	.word	0
+	.word	.fast_native_return_w		@ FFI_TYPE_SINT32 == 10
+	.word	0
+	.word	.fast_native_return_dw		@ FFI_TYPE_SINT64 == 12
+	.word	0
+	.word	.fast_native_return_obj		@ FFI_TYPE_POINTER == 14
+
+.fast_native_return_dw:
+	str	r0, [r5, #-8]!
+	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
+	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
+	str	r1, [r5, #4]
+	str	r5, [r9, #THREAD_JAVA_SP]
+	ldmfd	arm_sp!, {fast_regset, pc}
+.fast_native_return_byte:
+	mov	r0, r0, lsl #24
+	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
+	mov	r0, r0, asr #24
+	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
+	str	r0, [r5, #-4]!
+	str	r5, [r9, #THREAD_JAVA_SP]
+	ldmfd	arm_sp!, {fast_regset, pc}
+.fast_native_return_char:
+	mov	r0, r0, lsl #16
+	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
+	mov	r0, r0, lsr #16
+	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
+	str	r0, [r5, #-4]!
+	str	r5, [r9, #THREAD_JAVA_SP]
+	ldmfd	arm_sp!, {fast_regset, pc}
+.fast_native_return_bool:
+	ands	r0, r0, #255
+	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
+	movne	r0, #1
+	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
+	str	r0, [r5, #-4]!
+	str	r5, [r9, #THREAD_JAVA_SP]
+	ldmfd	arm_sp!, {fast_regset, pc}
+.fast_native_return_obj:
+	cmp	r0, #0
+	ldrne	r0, [r0]
+	str	r0, [r5, #-4]!
+	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
+	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
+	str	r5, [r9, #THREAD_JAVA_SP]
+	ldmfd	arm_sp!, {fast_regset, pc}
+.fast_native_return_short:
+	mov	r0, r0, lsl #16
+	mov	r0, r0, asr #16
+.fast_native_return_w:
+	str	r0, [r5, #-4]!
+.fast_native_return_void:
+	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
+	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
+.fast_native_exit:
+	str	r5, [r9, #THREAD_JAVA_SP]
+	ldmfd	arm_sp!, {fast_regset, pc}
+
+.fast_native_entry_throw_stack_overflow:
+	str	r0, [r9, #THREAD_LAST_JAVA_SP]
+	mov	r0, r9
+	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
+	mov	r3, #0
+	ldr	r1, [r9, #THREAD_PENDING_EXC]
+	str	r3, [r9, #THREAD_LAST_JAVA_SP]
+.fast_native_entry_exception:
+	ldr	r5, [r9, #THREAD_TOP_ZERO_FRAME]
+	ldr	r3, [r5], #4
+	str	r3, [r9, #THREAD_TOP_ZERO_FRAME]
+
+	ldrh	r3, [r11, #METHOD_SIZEOFPARAMETERS]
+	add	r5, r5, r3, lsl #2
+	b	.fast_native_exit
+
+.fast_native_entry_do_special:
+	stmdb	arm_sp!, {r0, r1}
+	mov	r0, r9
+	bl	_ZN10JavaThread40check_special_condition_for_native_transEPS_
+	ldmia	arm_sp!, {r0, r1}
+	b	.fast_native_entry_do_return
+
+#include "bytecodes_arm.s"
+
+	Opcode	idiv
+
+	POP	r1
+	POP	r0
+	cmp	r1, #0
+	beq	divide_by_zero_exception
+	bl	__aeabi_idiv
+	PUSH	r0
+	DISPATCH 1
+
+	Opcode	idiv_clz
+
+	POP	r1
+	POP	r0
+	bl	int_div
+idiv_clz_ret:
+	PUSH	r0
+	DISPATCH 1
+
+	Opcode	irem
+
+	POP	r1
+	POP	r0
+	cmp	r1, #0
+	beq	divide_by_zero_exception
+	bl	__aeabi_idivmod
+	PUSH	r1
+	DISPATCH 1
+
+	Opcode	irem_clz
+
+	POP	r1
+	POP	r0
+	bl	int_rem
+irem_clz_ret:
+	PUSH	r0
+	DISPATCH 1
+
+	Opcode	goto
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+branch_taken:
+        orr     tmp1, tmp1, r1, lsl #8
+        DISPATCH_START_REG	tmp1
+	cmp	tmp1, #0
+	ble	do_backedge
+	DISPATCH_FINISH
+
+branch_taken_unsafe:
+	mov	r2, r2, lsl #24
+	orr	tmp1, r1, r2, asr #16
+        DISPATCH_START_REG	tmp1
+  USEC	cmp	tmp1, #0
+  USEC	ble	do_backedge
+	DISPATCH_FINISH
+
+branch_taken_unsafe_1:
+	add	jpc, jpc, #1
+	orr	tmp1, ip, r1, lsl #8
+        DISPATCH_START_REG	tmp1
+  USEC	cmp	tmp1, #0
+  USEC	ble	do_backedge
+	DISPATCH_FINISH
+
+branch_taken_unsafe_2:
+	add	jpc, jpc, #2
+	orr	tmp1, ip, r1, lsl #8
+        DISPATCH_START_REG	tmp1
+  USEC	cmp	tmp1, #0
+  USEC	ble	do_backedge
+	DISPATCH_FINISH
+
+branch_taken_unsafe_3:
+	add	jpc, jpc, #3
+	orr	tmp1, ip, r1, lsl #8
+        DISPATCH_START_REG	tmp1
+  USEC	cmp	tmp1, #0
+  USEC	ble	do_backedge
+	DISPATCH_FINISH
+
+branch_taken_unsafe_4:
+	add	jpc, jpc, #4
+	orr	tmp1, ip, r1, lsl #8
+        DISPATCH_START_REG	tmp1
+  USEC	cmp	tmp1, #0
+  USEC	ble	do_backedge
+	DISPATCH_FINISH
+
+do_backedge:
+  USEC	ldr	tmp2, [istate, #ISTATE_METHOD]
+  OSR	ldr	lr, [dispatch, #InterpreterInvocationLimit_Address-XXX]
+  USEC	ldr	r1, [tmp2, #METHOD_BACKEDGECOUNTER]
+  USEC	ldr	ip, [tmp2, #METHOD_INVOCATIONCOUNTER]
+  USEC	add	r1, r1, #INVOCATIONCOUNTER_COUNTINCREMENT
+  OSR	ldr	lr, [lr]
+  USEC	add	ip, ip, #INVOCATIONCOUNTER_COUNTINCREMENT
+  USEC	str	r1, [tmp2, #METHOD_BACKEDGECOUNTER]
+#ifdef THUMB2EE
+  OSR	cmp	r1, lr
+#else
+  OSR	cmp	r1, lr, lsl #2
+#endif
+  USEC	str	ip, [tmp2, #METHOD_INVOCATIONCOUNTER]
+  OSR	bcs	do_osr
+
+osr_continue:
+	ldr	ip, [dispatch, #SafePointSynchronize_state_Address-XXX]
+	ldr	r1, [ip]
+	cmp	r1, #1
+	beq	do_synchronize
+	DISPATCH_STATE	1
+	DISPATCH_FINISH
+
+
+do_synchronize:
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	Helper_SafePoint
+	CACHE_CP
+	CACHE_JPC
+	cmp	r0, #0
+	bne	handle_exception
+	DISPATCH	0
+
+#ifdef ON_STACK_REPLACEMENT
+
+#ifdef THUMB2EE
+do_osr:
+	ldr	r3, [tmp2, #METHOD_CONSTMETHOD]
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	sub	r1, jpc, r3
+	sub	r1, r1, #CONSTMETHOD_CODEOFFSET
+	bl	FREQ_COUNT_OVERFLOW
+1:
+	cmp	r0, #0
+	bne	call_thumb2
+	CACHE_CP
+	CACHE_JPC
+	DISPATCH_START	0
+	b	osr_continue
+
+#else
+
+do_osr:
+	ldr	ip, [dispatch, #UseOnStackReplacement_Address-XXX]
+	ldrb	ip, [ip]
+	cmp	ip, #0
+	beq	osr_continue
+
+	ldr	r3, [tmp2, #METHOD_CONSTMETHOD]
+	DECACHE_JPC
+	ldrh	r3, [r3, #CONSTMETHOD_CODESIZE]
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	sub	r1, jpc, tmp1
+	cmp	r3, #MAX_FG_METHOD_SIZE
+	bcc	1f
+	ldr	tmp2, [dispatch, #BackgroundCompilation_Address-XXX]
+	mov	r3, #1
+	ldr	r5, [tmp2]
+	str	r3, [tmp2]
+	bl	FREQ_COUNT_OVERFLOW
+	str	r5, [tmp2]
+	b	2f
+1:
+	bl	FREQ_COUNT_OVERFLOW
+2:
+	ldr	r3, [istate, #ISTATE_THREAD]
+	CACHE_CP
+	ldr	r1, [r3, #THREAD_PENDING_EXC]
+	CACHE_JPC
+	cmp	r1, #0
+	bne	handle_exception
+	cmp	r0, #0
+	beq	1f
+	ldr	r1, [r0, #56]
+	cmn	r1, #2
+	bne	osr_migrate
+1:
+	DISPATCH_START	0
+	b	osr_continue
+
+osr_migrate:
+	ldr	tmp1, [r0, #128]	@ osr_method->osr_entry()
+	mov	r0, r3
+	bl	_ZN13SharedRuntime19OSR_migration_beginEP10JavaThread
+	mov	r1, r0
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldrh	lr, [r0, #METHOD_MAXLOCALS]
+	ldrh	ip, [r0, #METHOD_SIZEOFPARAMETERS]
+	ldr	r3, [istate, #ISTATE_THREAD]
+	sub	lr, lr, ip
+	ldr	r2, [r3, #THREAD_TOP_ZERO_FRAME]
+	add	ip, r2, #4
+	ldr	r2, [r2]
+	add	ip, ip, lr, lsl #2
+	str	r2, [r3, #THREAD_TOP_ZERO_FRAME]
+	str	ip, [r3, #THREAD_JAVA_SP]
+	mov	r2, tmp1
+@ r0 = method
+@ r1 = osr_buf
+@ r2 = osr_entry
+	mov	lr, pc
+	ldr	pc, [tmp1]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+
+#endif // THUMB2EE
+
+#endif // ON_STACK_REPLACEMENT
+
+	Opcode	ifeq
+	Opcode	ifnull
+        POP     r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, #0
+	beq	branch_taken
+	DISPATCH	3
+
+	Opcode	ifne
+	Opcode	ifnonnull
+        POP     r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, #0
+	bne	branch_taken
+	DISPATCH	3
+
+	Opcode	iflt
+        POP     r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, #0
+	blt	branch_taken
+	DISPATCH	3
+
+	Opcode	ifge
+        POP     r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, #0
+	bge	branch_taken
+	DISPATCH	3
+
+	Opcode	ifgt
+        POP     r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, #0
+	bgt	branch_taken
+	DISPATCH	3
+
+	Opcode	ifle
+        POP     r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, #0
+	ble	branch_taken
+	DISPATCH	3
+
+	Opcode	if_icmpeq
+	Opcode	if_acmpeq
+        POP    r2, r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, r2
+	beq	branch_taken
+	DISPATCH	3
+
+	Opcode	if_icmpne
+	Opcode	if_acmpne
+        POP    r2, r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, r2
+	bne	branch_taken
+	DISPATCH	3
+
+	Opcode	if_icmplt
+        POP    r2, r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, r2
+	blt	branch_taken
+	DISPATCH	3
+
+	Opcode	if_icmpge
+        POP    r2, r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, r2
+	bge	branch_taken
+	DISPATCH	3
+
+	Opcode	if_icmpgt
+        POP    r2, r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, r2
+	bgt	branch_taken
+	DISPATCH	3
+
+	Opcode	if_icmple
+        POP    r2, r3
+        ldrsb   r1, [jpc, #1]
+        ldrb    tmp1, [jpc, #2]
+        cmp     r3, r2
+	ble	branch_taken
+	DISPATCH	3
+
+	Opcode	ireturn
+	Opcode	freturn
+	Opcode	lreturn
+	Opcode	dreturn
+	Opcode	areturn
+	Opcode	return
+	ldr	r3, [dispatch, #SafePointSynchronize_state_Address-XXX]
+	ldr	r1, [r3]
+	cmp	r1, #1
+	bne	handle_return
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	Helper_SafePoint
+	CACHE_JPC
+	cmp	r0, #0
+	beq	handle_return
+	b	handle_exception
+
+resolve_get_put:
+	mov	r1, r0
+	mov	tmp1, lr
+        ldr     r0, [istate, #ISTATE_THREAD]
+	DECACHE_JPC
+        DECACHE_STACK
+       	bl      _ZN18InterpreterRuntime15resolve_get_putEP10JavaThreadN9Bytecodes4CodeE
+        ldr     r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+        ldr     r3, [r0, #THREAD_PENDING_EXC]
+	CACHE_CP
+        cmp     r3, #0
+	mov	lr, tmp1
+        bne     getfield_exception
+@ Now restart the getfield
+        ldrb    r3, [jpc, #1]
+        ldrb    r2, [jpc, #2]
+        orr     r3, r3, r2, lsl #8      @ r3 = index
+	add	tmp2, constpool, r3, lsl #4	@ tmp2 = cache
+	bx	lr
+
+accessor_non_w:
+	bcs	accessor_h
+	beq	accessor_sb
+	tst	r0, #2
+	bne	accessor_dw
+accessor_sh:
+	ldrsh	r0, [r3, r1]
+	str	r0, [ip, #0]
+	bx	lr
+accessor_h:
+	ldrh	r0, [r3, r1]
+	str	r0, [ip, #0]
+	bx	lr
+accessor_sb:
+	ldrsb	r0, [r3, r1]
+	str	r0, [ip, #0]
+	bx	lr
+accessor_dw:
+	add	r0, r3, r1
+	ldm	r0, {r0, r1}
+	sub	ip, ip, #4
+	str	ip, [r2, #THREAD_JAVA_SP]
+	stmia	ip, {r0, r1}
+	bx	lr
+
+	Opcode	getfield
+	ldrb	r1, [jpc, #2]
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	ldr	r3, [tmp2, #CP_OFFSET]
+        and     r3, r3, #0x00ff0000
+        cmp     r3, #opc_getfield << 16
+        blne    resolve_get_put
+  NFBC	POP	tmp1
+        ldr     r2, [tmp2, #CP_OFFSET+12]
+  NFBC	cmp	tmp1, #0
+  NFBC	beq	null_ptr_exception
+  NFBC	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+        movs    r2, r2, lsr #29
+  FBC	movhi	r0, #opc_igetfield
+        bls     getfield_non_w
+  NFBC	ldr	tmp2, [tmp1, tmp2]
+  NFBC	PUSH	tmp2
+  NFBC	DISPATCH 3
+
+#ifdef FAST_BYTECODES
+rewrite_bytecode:
+	strb	r0, [jpc]
+	DISPATCH_BYTECODE
+#endif
+
+getfield_non_w:
+        bcs     getfield_h              @ C = 1 => R2 = 1
+        beq     getfield_sb             @ Z = 1 => R2 = 0
+        tst     r2, #2
+        bne     getfield_dw
+
+#ifdef FAST_BYTECODES
+getfield_sh:
+	mov	r0, #opc_sgetfield
+	b	rewrite_bytecode
+getfield_h:
+	mov	r0, #opc_cgetfield
+	b	rewrite_bytecode
+getfield_sb:
+	mov	r0, #opc_bgetfield
+	b	rewrite_bytecode
+getfield_dw:
+	mov	r0, #opc_lgetfield
+	b	rewrite_bytecode
+#else
+getfield_sh:
+	ldrsh	tmp2, [tmp1, tmp2]
+	PUSH	tmp2
+	DISPATCH 3
+getfield_h:
+	ldrh	tmp2, [tmp1, tmp2]
+	PUSH	tmp2
+	DISPATCH 3
+getfield_sb:
+	ldrsb	tmp2, [tmp1, tmp2]
+	PUSH	tmp2
+	DISPATCH 3
+getfield_dw:
+	add	tmp1, tmp1, tmp2
+	ldm	tmp1, {r2, tmp2}
+	PUSH	r2, tmp2
+	DISPATCH 3
+#endif
+
+	Opcode	putfield
+	ldrb	r1, [jpc, #2]
+        add     tmp2, constpool, r1, lsl #12
+	add	tmp2, tmp2, r2, lsl #4
+	ldr	r3, [tmp2, #CP_OFFSET]
+        and     r3, r3, #0xff000000
+        cmp     r3, #opc_putfield << 24
+        blne    resolve_get_put
+        ldr     r2, [tmp2, #CP_OFFSET+12]
+  NFBC	ldr	tmp2, [tmp2, #CP_OFFSET+8]
+        movs    r2, r2, lsr #29
+	bls	putfield_non_w
+  FBC   mov	r0, #opc_iputfield
+	cmp	r2, #tos_atos >> 1
+  FBC	moveq	r0, #opc_aputfield
+  FBC	b	rewrite_bytecode
+  NFBC	beq	putfield_a
+  NFBC	POP	r2, r3
+  NFBC	cmp	r3, #0
+  NFBC	beq	null_ptr_exception
+  NFBC	str	r2, [r3, tmp2]
+  NFBC	DISPATCH 3
+
+putfield_non_w:
+	bcs	putfield_h
+	beq	putfield_sb
+	tst	r2, #2
+	bne	putfield_dw
+
+#ifdef FAST_BYTECODES
+putfield_sh:
+putfield_h:
+	mov	r0, #opc_cputfield
+	b	rewrite_bytecode
+putfield_sb:
+	mov	r0, #opc_bputfield
+	b	rewrite_bytecode
+putfield_dw:
+	mov	r0, #opc_lputfield
+	b	rewrite_bytecode
+#else
+putfield_sh:
+putfield_h:
+	POP	r2, r3
+	cmp	r3, #0
+	beq	null_ptr_exception
+	strh	r2, [r3, tmp2]
+	DISPATCH 3
+putfield_sb:
+	POP	r2, r3
+	cmp	r3, #0
+	beq	null_ptr_exception
+	strb	r2, [r3, tmp2]
+	DISPATCH 3
+putfield_dw:
+	POP	r2, r3, lr
+	cmp	lr, #0
+	beq	null_ptr_exception
+	add	tmp2, lr, tmp2
+	stm	tmp2, {r2, r3}
+	DISPATCH 3
+putfield_a:
+	POP	r2, r3
+	cmp	r3, #0
+	beq	null_ptr_exception
+	str	r2, [r3, tmp2]
+	mov	r0, r3
+	bl	Helper_aputfield
+	DISPATCH 3
+#endif
+
+getstatic_sh:
+	DISPATCH_START	3
+	ldrsh	tmp2, [r3, lr]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+getstatic_h:
+	DISPATCH_START	3
+	ldrh	tmp2, [r3, lr]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+getstatic_sb:
+	DISPATCH_START	3
+	ldrsb	tmp2, [r3, lr]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+getstatic_dw:
+	DISPATCH_START	3
+	add	r3, r3, lr
+	ldm	r3, {r2, tmp2}
+	DISPATCH_NEXT
+	PUSH	r2, tmp2
+	DISPATCH_FINISH
+getstatic_w:
+	DISPATCH_START	3
+	ldr	tmp2, [r3, lr]
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+
+putstatic_sh:
+putstatic_h:
+	DISPATCH_START	3
+	POP	tmp2
+	DISPATCH_NEXT
+	strh	tmp2, [r3, r2]
+	DISPATCH_FINISH
+putstatic_w:
+	cmp	lr, #tos_atos >> 1	@ >> 1 due to lsr #29 above
+	beq	putstatic_a
+	DISPATCH_START	3
+	POP	tmp2
+	DISPATCH_NEXT
+	str	tmp2, [r3, r2]
+	DISPATCH_FINISH
+putstatic_sb:
+	DISPATCH_START	3
+	POP	tmp2
+	DISPATCH_NEXT
+	strb	tmp2, [r3, r2]
+	DISPATCH_FINISH
+putstatic_dw:
+	DISPATCH_START	3
+	add	r2, r2, r3
+	POP	r3, tmp2
+	DISPATCH_NEXT
+	stm	r2, {r3, tmp2}
+	DISPATCH_FINISH
+putstatic_a:
+	POP	tmp2
+	str	tmp2, [r3, r2]
+	mov	r0, r3
+	bl	Helper_aputfield
+	DISPATCH 3
+
+resolve_invokeinterface:
+	mov	r1, #opc_invokeinterface
+	b	resolve_invoke
+resolve_invokevirtual:
+	mov	r1, #opc_invokevirtual
+	b	resolve_invoke
+resolve_invokespecial:
+	mov	r1, #opc_invokespecial
+	b	resolve_invoke
+resolve_invokestatic:
+	mov	r1, #opc_invokestatic
+resolve_invoke:
+	mov	tmp1, lr
+	ldr	r0, [istate, #ISTATE_THREAD]
+	DECACHE_JPC
+	DECACHE_STACK
+	bl	_ZN18InterpreterRuntime14resolve_invokeEP10JavaThreadN9Bytecodes4CodeE
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	r3, [r0, #4]
+	CACHE_CP
+	cmp	r3, #0
+        ldrb    r3, [jpc, #1]
+        ldrb    r2, [jpc, #2]
+	bne	resolve_exception
+        orr     r3, r3, r2, lsl #8      @ r3 = index
+	add	r0, constpool, r3, lsl #4	@ r1 = cache
+	bx	tmp1
+
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+	Opcode	new
+	ldrb	r1, [jpc, #2]
+	DECACHE_JPC
+	DECACHE_STACK
+	orr	r1, r1, r2, lsl #8
+	mov	r0, r8
+	bl	Helper_new
+	CACHE_JPC
+	CACHE_CP
+	cmp	r0, #0
+	beq	handle_exception
+	PUSH	r0
+	DISPATCH 3
+
+bytecode_interpreter_str:
+	.ascii  "[Bytecode Interpreter]\000"
+	ALIGN_WORD
+
+	Opcode	newarray
+	ldrb	r1, [jpc, #1]	@ zero_extendqisi2
+	ldr	r2, [stack, #4]
+	ldr	r0, [istate, #ISTATE_THREAD]
+	DECACHE_JPC
+	DECACHE_STACK
+	bl	_ZN18InterpreterRuntime8newarrayEP10JavaThread9BasicTypei
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	ip, [r0, #THREAD_PENDING_EXC]
+	CACHE_CP
+	cmp	ip, #0
+	ldr	r2, [r0, #THREAD_VM_RESULT]
+	bne	handle_exception
+	str	r2, [stack, #4]
+	str	ip, [r0, #THREAD_VM_RESULT]
+	DISPATCH	2
+
+	Opcode	anewarray
+	ldrb	r0, [jpc, #1]	@ zero_extendqisi2
+	ldr	r3, [stack, #4]
+	ldr	lr, [istate, #ISTATE_METHOD]
+	ldrb	r2, [jpc, #2]	@ zero_extendqisi2
+	orr	r2, r2, r0, asl #8
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r1, [lr, #METHOD_CONSTANTS]
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	_ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	ip, [r0, #THREAD_PENDING_EXC]
+	CACHE_CP
+	cmp	ip, #0
+	ldr	r2, [r0, #THREAD_VM_RESULT]
+	bne	handle_exception
+	str	r2, [stack, #4]
+	str	ip, [r0, #THREAD_VM_RESULT]
+	DISPATCH	3
+
+	Opcode	arraylength
+	DISPATCH_START	1
+	ldr	r3, [stack, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	SW_NPC	cmp	r3, #0
+	SW_NPC	beq	null_ptr_exception_jpc_1
+.abortentry114:
+	ldr	r3, [r3, #8]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	r3, [stack, #4]
+	DISPATCH_FINISH
+
+	Opcode	athrow
+	ldr	r1, [stack, #4]
+	cmp	r1, #0
+	beq	null_ptr_exception
+	mov	r2, #0
+	ldr	r0, [istate, #ISTATE_THREAD]
+	mov	r3, r2
+	bl	_ZN12ThreadShadow21set_pending_exceptionEP7oopDescPKci
+	b	handle_exception
+
+#define secondary_super_cache_offset_in_bytes	20
+#define tmp_chunk	locals
+#define tmp_hwm		stack
+#define	tmp_max		constpool
+
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+	Opcode	checkcast
+	ldrb	r1, [jpc, #2]
+	DECACHE_JPC
+	DECACHE_STACK
+	orr	r1, r1, r2, lsl #8
+	mov	r0, r8
+	GET_STACK	0, r2
+	bl	Helper_checkcast
+	CACHE_JPC
+	CACHE_CP
+	cmp	r0, #0
+	bne	handle_exception
+	DISPATCH 3
+
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+	Opcode	instanceof
+	ldrb	r1, [jpc, #2]
+	DECACHE_JPC
+	DECACHE_STACK
+	orr	r1, r1, r2, lsl #8
+	mov	r0, r8
+	POP	r2
+	bl	Helper_instanceof
+	CACHE_JPC
+	CACHE_CP
+	cmp	r0, #-1
+	beq	handle_exception
+	PUSH	r0
+	DISPATCH 3
+
+	Opcode	monitorenter
+	ldr	r1, [stack, #4]
+	cmp	r1, #0
+	beq	.monitorenter_4
+	ldr	r0, [istate, #ISTATE_MONITOR_BASE]
+	ldr	r2, [istate, #ISTATE_STACK_BASE]
+	cmp	r2, r0
+	beq	.monitorenter_5
+	mov	sl, #0
+.monitorenter_1:
+	ldr	r3, [r2, #4]
+	cmp	r3, #0
+	moveq	sl, r2
+	beq	.monitorenter_2
+	cmp	r1, r3
+	beq	.monitorenter_3
+.monitorenter_2:
+	add	r2, r2, #8
+	cmp	r2, r0
+	bne	.monitorenter_1
+.monitorenter_3:
+	cmp	sl, #0
+	beq	.monitorenter_5
+	str	r1, [sl, #4]
+	ldr	r3, [r1, #0]
+	mov	r0, sl
+	orr	tmp1, r3, #1
+	mov	r2, tmp1
+	str	tmp1, [sl, #0]
+	bl	cmpxchg_ptr
+	cmp	r0, tmp1
+	beq	.monitorenter_exit
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bic	r1, tmp1, #3
+	bl	JavaThread_is_lock_owned
+	cmp	r0, #0
+	movne	lr, #0
+	strne	lr, [sl, #0]
+	bne	.monitorenter_exit
+	mov	r1, sl
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	_ZN18InterpreterRuntime12monitorenterEP10JavaThreadP15BasicObjectLock
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+	cmp	r3, #0
+	beq	.monitorenter_exit
+	b	handle_exception
+.monitorenter_4:
+	b	null_ptr_exception
+.monitorenter_5:
+	mov	lr, #0
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r3, [istate, #ISTATE_THREAD]
+	ldr	ip, [istate, #ISTATE_THREAD]
+	ldr	r1, [r3, #THREAD_JAVA_SP]
+	ldr	r3, [r3, #THREAD_JAVA_STACK_BASE]
+	str	lr, [ip, #THREAD_LAST_JAVA_SP]
+	rsb	r3, r3, r1
+	cmp	r3, #7
+	ble	vm_fatal_error
+	sub	r3, r1, #8
+	ldr	r1, [istate, #ISTATE_THREAD]
+	str	r3, [r1, #THREAD_JAVA_SP]
+	ldr	r2, [istate, #ISTATE_STACK]
+	ldr	r1, [istate, #ISTATE_STACK_BASE]
+	add	r3, r2, #4
+	cmp	r1, r3
+	bls	.monitorenter_7
+	add	r0, r2, #8
+.monitorenter_6:
+	ldr	r3, [r0, #-4]
+	mov	r2, r0
+	str	r3, [r0, #-12]
+	add	r0, r0, #4
+	ldr	r1, [istate, #ISTATE_STACK_BASE]
+	cmp	r1, r2
+	bhi	.monitorenter_6
+	ldr	r2, [istate, #ISTATE_STACK]
+.monitorenter_7:
+	sub	r1, r1, #8
+	sub	r2, r2, #8
+	ldr	r3, [istate, #ISTATE_STACK_LIMIT]
+	str	r1, [istate, #ISTATE_STACK_BASE]
+	str	r2, [istate, #ISTATE_STACK]
+	sub	r3, r3, #8
+	mov	r0, #0
+	str	r3, [istate, #ISTATE_STACK_LIMIT]
+	str	r0, [r1, #4]
+	ldr	r1, [istate, #ISTATE_THREAD]
+	ldr	r3, [r1, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [r1, #THREAD_LAST_JAVA_SP]
+	CACHE_STACK
+	ldr	sl, [istate, #ISTATE_STACK_BASE]
+	ldr	r3, [stack, #4]
+	CACHE_JPC
+	mov	r1, r3
+	str	r3, [sl, #4]
+	ldr	r2, [r3, #0]
+	mov	r0, sl
+	orr	tmp1, r2, #1
+	mov	r2, tmp1
+	str	tmp1, [sl, #0]
+	bl	cmpxchg_ptr
+	cmp	r0, tmp1
+	beq	.monitorenter_exit
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bic	r1, tmp1, #3
+	bl	JavaThread_is_lock_owned
+	cmp	r0, #0
+	movne	ip, #0
+	strne	ip, [sl, #0]
+	bne	.monitorenter_exit
+	mov	r1, sl
+	ldr	r0, [istate, #ISTATE_THREAD]
+	DECACHE_JPC
+	DECACHE_STACK
+	bl	_ZN18InterpreterRuntime12monitorenterEP10JavaThreadP15BasicObjectLock
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+	cmp	r3, #0
+	beq	.monitorenter_exit
+	b	handle_exception
+.monitorenter_exit:
+	CACHE_CP
+	add	stack, stack, #4
+	DISPATCH	1
+
+	Opcode	monitorexit
+	ldr	sl, [stack, #4]
+	cmp	sl, #0
+	beq	.monitorexit_3
+	ldr	r2, [istate, #ISTATE_MONITOR_BASE]
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]
+	cmp	tmp1, r2
+	bne	.monitorexit_2
+	b	.monitorexit_4
+.monitorexit_1:
+	add	tmp1, tmp1, #8
+	cmp	tmp1, r2
+	beq	.monitorexit_4
+.monitorexit_2:
+	ldr	r3, [tmp1, #4]
+	cmp	sl, r3
+	bne	.monitorexit_1
+	ldr	r0, [tmp1, #0]
+	mov	lr, #0
+	cmp	r0, lr
+	str	lr, [tmp1, #4]
+	beq	.monitorexit_exit
+	mov	r1, sl
+	mov	r2, tmp1
+	bl	cmpxchg_ptr
+	cmp	tmp1, r0
+	beq	.monitorexit_exit
+	str	sl, [tmp1, #4]
+	mov	r1, tmp1
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	_ZN18InterpreterRuntime11monitorexitEP10JavaThreadP15BasicObjectLock
+	ldr	r0, [istate, #ISTATE_THREAD]
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+	CACHE_JPC
+	cmp	r3, #0
+	beq	.monitorexit_exit
+	b	handle_exception
+.monitorexit_3:
+	b	null_ptr_exception
+.monitorexit_4:
+	ldr	r0, [istate, #ISTATE_THREAD]
+	DECACHE_JPC
+	DECACHE_STACK
+	bl	_ZN18InterpreterRuntime37throw_illegal_monitor_state_exceptionEP10JavaThread
+	b	handle_exception_with_bcp
+.monitorexit_exit:
+	add	stack, stack, #4
+	CACHE_CP
+	DISPATCH	1
+
+vm_fatal_error:
+	adr	r0, .fatal_filename
+	mov	r1, #99
+	bl	_Z28report_should_not_reach_herePKci
+	b	breakpoint
+.fatal_filename:
+	.ascii	"[Optimsed Assembler Interpreter Loop]\000"
+	ALIGN_WORD
+
+	Opcode	aastore
+	DECACHE_JPC
+	DECACHE_STACK
+	mov	r0, r8
+	POP	r1, r2, r3
+	bl	Helper_aastore
+	CACHE_JPC
+	CACHE_CP
+	cmp	r0, #0
+	bne	handle_exception
+	DISPATCH 1
+
+	Opcode	wide
+	ldrb	r2, [jpc, #1]
+	ldrb	r1, [jpc, #2]	@ zero_extendqisi2
+	ldrb	r3, [jpc, #3]	@ zero_extendqisi2
+
+	sub	lr, r2, #opc_aload+1
+	cmp	lr, #opc_istore - (opc_aload+1)
+	bcc	wide_undef_opc_exception
+
+	sub	lr, r2, #opc_iload
+	cmp	r2, #opc_istore
+	subcs	lr, lr, #opc_istore - (opc_aload+1)
+	cmp	r2, #opc_astore+1
+
+	orr	r1, r3, r1, asl #8
+	adr	r3, wide_case_table
+	ldrcc	pc, [r3, lr, lsl #2]
+	
+	cmp	r2, #opc_ret
+	beq	do_wide_ret
+	cmp	r2, #opc_iinc
+	beq	do_wide_iinc
+wide_undef_opc_exception:
+	mov	r0, #VMSYMBOLS_InternalError
+	adr	r1, undef_opcode_msg
+	b	raise_exception_with_msg
+undef_opcode_msg:
+	.ascii  "undefined opcode\000"
+	ALIGN_WORD
+
+wide_case_table:
+        .word	case_wide_iload
+        .word	case_wide_lload
+        .word	case_wide_fload
+        .word	case_wide_dload
+        .word	case_wide_aload
+        .word	case_wide_istore
+        .word	case_wide_lstore
+        .word	case_wide_fstore
+        .word	case_wide_dstore
+        .word	case_wide_astore
+
+case_wide_iload:
+case_wide_fload:
+case_wide_aload:
+	ldr	r2, [locals, -r1, lsl #2]
+	PUSH	r2
+	DISPATCH	4
+case_wide_istore:
+case_wide_fstore:
+case_wide_astore:
+	POP	r2
+	str	r2, [locals, -r1, lsl #2]
+	DISPATCH	4
+case_wide_dload:
+case_wide_lload:
+	sub	r1, locals, r1, lsl #2
+	ldmda	r1, {r1, r2}
+	PUSH	r1, r2
+	DISPATCH	4
+case_wide_dstore:
+case_wide_lstore:
+	POP	r2, r3
+	sub	r1, locals, r1, lsl #2
+	stmda	r1, {r2, r3}
+	DISPATCH	4
+do_wide_ret:
+	ldr	r2, [istate, #ISTATE_METHOD]
+	ldr	r2, [r2, #8]
+	ldr	r1, [locals, -r1, lsl #2]
+	add	jpc, r2, r1
+	DISPATCH	48
+do_wide_iinc:
+	ldrsb	r2, [jpc, #4]
+	ldrb	r3, [jpc, #5]
+	orr	r2, r3, r2, lsl #8
+	ldr	r3, [locals, -r1, lsl #2]
+	add	r3, r3, r2
+	str	r3, [locals, -r1, lsl #2]
+	DISPATCH	6
+
+	Opcode	multianewarray
+	ldrb	tmp1, [jpc, #3]	@ zero_extendqisi2
+	ldr	r0, [istate, #ISTATE_THREAD]
+	add	r1, stack, tmp1, lsl #2
+	DECACHE_JPC
+	DECACHE_STACK
+	bl	_ZN18InterpreterRuntime14multianewarrayEP10JavaThreadPi
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	r1, [r0, #THREAD_PENDING_EXC]
+	CACHE_CP
+	cmp	r1, #0
+	ldr	r3, [r0, #THREAD_VM_RESULT]
+	bne	handle_exception
+	str	r3, [stack, tmp1, asl #2]!
+	str	r1, [r0, #THREAD_VM_RESULT]
+	sub	stack, stack, #4
+	DISPATCH	4
+
+	Opcode	jsr_w
+	ldr	r3, [istate, #ISTATE_METHOD]
+	ldr	r1, [r3, #8]
+	rsb	r2, r1, jpc
+	sub	r2, r2, #43
+	str	r2, [stack], #-4
+	b	do_goto_w
+
+	Opcode	goto_w
+	add	r2, jpc, #1
+	ldrb	tmp1, [jpc, #1]	@ zero_extendqisi2
+	ldrb	r3, [r2, #3]	@ zero_extendqisi2
+	ldrb	r0, [r2, #1]	@ zero_extendqisi2
+	ldrb	ip, [r2, #2]	@ zero_extendqisi2
+	orr	r3, r3, tmp1, asl #24
+	orr	r3, r3, r0, asl #16
+	orr	r3, r3, ip, asl #8
+	cmp	r3, #0
+	add	jpc, jpc, r3
+	bgt	1f
+
+	ldr	r3, [dispatch, #SafePointSynchronize_state_Address-XXX]
+	ldr	r1, [r3]
+	cmp	r1, #1
+	bne	1f
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	Helper_SafePoint
+	CACHE_JPC
+	CACHE_CP
+	cmp	r0, #0
+	bne	handle_exception
+1:
+	DISPATCH	0
+
+	Opcode	breakpoint
+	mov	r2, jpc
+	DECACHE_STACK
+	DECACHE_JPC
+	ldr	r0, [istate, #ISTATE_THREAD]
+	ldr	r1, [istate, #ISTATE_METHOD]
+	bl	_ZN18InterpreterRuntime24get_original_bytecode_atEP10JavaThreadP13methodOopDescPh
+	mov	tmp1, r0
+	ldr	r0, [istate, #ISTATE_THREAD]
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+	cmp	r3, #0
+	bne	handle_exception
+	ldr	r2, [istate, #ISTATE_BCP]
+	ldr	r1, [istate, #ISTATE_METHOD]
+	bl	_ZN18InterpreterRuntime11_breakpointEP10JavaThreadP13methodOopDescPh
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+	CACHE_CP
+	cmp	r3, #0
+	and	r0, tmp1, #255
+	bne	handle_exception
+	DISPATCH_BYTECODE
+
+#ifndef FAST_BYTECODES
+	Opcode	bgetfield
+	Opcode	cgetfield
+	Opcode	igetfield
+	Opcode	lgetfield
+	Opcode	sgetfield
+	Opcode	aputfield
+	Opcode	bputfield
+	Opcode	cputfield
+	Opcode	iputfield
+	Opcode	lputfield
+	Opcode	invokevfinal
+	Opcode	invokeresolved
+	Opcode	invokespecialresolved
+	Opcode	invokestaticresolved
+	Opcode	iaccess_0
+	Opcode	iload_0_iconst_N
+	Opcode	iload_iconst_N
+	Opcode	iadd_istore_N
+	Opcode	isub_istore_N
+	Opcode	iand_istore_N
+	Opcode	ior_istore_N
+	Opcode	ixor_istore_N
+	Opcode	iadd_u4store
+	Opcode	isub_u4store
+	Opcode	iand_u4store
+	Opcode	ior_u4store
+	Opcode	ixor_u4store
+	Opcode	fast_iload_iload
+	Opcode	fast_iload_iload_N
+	Opcode	fast_iload_N_iload
+	Opcode	fast_iload_N_iload_N
+#endif
+	Opcode	undefined
+	ldr	r2, [dispatch, #Bytecodes_name_Address-XXX]
+	ldrb	r3, [jpc, #0]	@ zero_extendqisi2
+	adrl	r0, bytecode_interpreter_str
+	cmp	r3, #last_implemented_bytecode+1
+	adrcs	ip, unknown_bytecode
+	ldrcc	ip, [r2, r3, asl #2]
+	adr	r2, unimplemented_opcode_msg
+	mov	r1, #99
+	str	ip, [arm_sp, #-8]!
+	bl	_Z19report_fatal_varargPKciS0_z
+	b	breakpoint
+unimplemented_opcode_msg:
+	.ascii  "\011*** Unimplemented opcode: %d = %s\012\000"
+unknown_bytecode:
+	.ascii	"<unknown>\000"
+	ALIGN_WORD
+
+	Opcode	return_register_finalizer
+	ldr	r1, [locals, #0]
+	ldr	r3, [r1, #4]
+	ldr	r2, [r3, #KLASS_PART+KLASS_ACCESSFLAGS]
+	tst	r2, #JVM_ACC_HAS_FINALIZER
+	beq	handle_return
+	DECACHE_JPC
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	_ZN18InterpreterRuntime18register_finalizerEP10JavaThreadP7oopDesc
+	ldr	r0, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+@ CACHE_LOCALS & CACHE_CP not require for handle_retuen / handle_exception
+	cmp	r3, #0
+	beq	handle_return
+	b	handle_exception
+
+	ALIGN_CODE
+normal_entry_synchronized:
+	stmfd	arm_sp!, {regset, lr}
+	bl	fast_normal_entry_synchronized
+	ldmfd	arm_sp!, {regset, pc}
+
+	ALIGN_CODE
+fast_normal_entry_synchronized:
+	stmfd	arm_sp!, {fast_regset, lr}
+
+	mov	sl, r0
+	mov	tmp1, r2
+
+	ldr	r0, [tmp1, #THREAD_STACK_SIZE]
+	ldr	r3, [tmp1, #THREAD_STACK_BASE]
+	rsb	r3, r0, r3
+	rsb	r3, r3, arm_sp
+	cmp	r3, #32768
+	blt	stack_overflow_before_frame
+
+	ldrh	r2, [sl, #METHOD_MAXLOCALS]
+	ldrh	r3, [sl, #METHOD_SIZEOFPARAMETERS]
+	rsb	r8, r3, r2
+
+	ldr	r1, [tmp1, #THREAD_JAVA_SP]
+	ldrh	r0, [sl, #METHOD_MAXSTACK]
+	ldr	r3, [tmp1, #THREAD_JAVA_STACK_BASE]
+
+	sub	r5, r1, r8, lsl #2
+	sub	r5, r5, #FRAME_SIZE+STACK_SPARE+LEAF_STACK_SIZE
+	sub	r5, r5, r0, lsl #2
+	cmp	r3, r5
+	bcs	stack_overflow_before_frame
+
+	cmp	r8, #0
+	ble	.normal_entry_synchronized_no_locals
+
+	mov	r2, #0
+.zero_locals_synchronized:
+	subs	r8, r8, #1
+	str	r2, [r1, #-4]!
+	bgt	.zero_locals_synchronized
+	str	r1, [tmp1, #THREAD_JAVA_SP]
+
+.normal_entry_synchronized_no_locals:
+	mov	r2, tmp1
+	mov	r1, sl
+	add	r0, tmp1, #THREAD_JAVA_STACK_BASE
+	bl	build_frame
+	mov	tmp_vvv, r0
+	ldr	r3, [tmp1, #THREAD_TOP_ZERO_FRAME]
+	sub	r0, r0, #72
+	mov	istate, r0
+	str	r3, [tmp_vvv, #0]
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r0, r1}
+	add	r0, r0, ip
+	str	tmp_vvv, [tmp1, #THREAD_TOP_ZERO_FRAME]
+@	CACHE_JPC
+	str	tmp_vvv, [tmp1, #THREAD_LAST_JAVA_SP]
+	add	dispatch, r1, r0
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [r0, #METHOD_ACCESSFLAGS]
+	tst	r3, #JVM_ACC_SYNCHRONIZED
+	beq	1f
+
+@ Do Synchronisation
+	CACHE_STACK
+	CACHE_LOCALS
+	tst	r3, #JVM_ACC_STATIC
+	ldrne	r3, [r0, #METHOD_CONSTANTS]
+	ldreq	sl, [locals, #0]
+	ldrne	r2, [r3, #16]
+	ldr	tmp1, [istate, #ISTATE_MONITOR_BASE]
+	ldrne	sl, [r2, #60]
+	ldr	r3, [sl, #0]
+	orr	tmp_xxx, r3, #1
+	str	tmp_xxx, [tmp1, #-8]!
+.normal_do_synchronisation_2:
+	ldr	tmp_vvv, [sl, #0]
+	cmp	tmp_xxx, tmp_vvv
+	bne	.normal_do_synchronisation_3
+	mov	r0, tmp_xxx
+	mov	r1, tmp1
+	mov	r2, sl
+	mov	r3, #0xffffffc0
+	bic	r3, r3, #0xf000
+	blx	r3
+	cmp	r0, #0
+	bne	.normal_do_synchronisation_2
+	b	1f
+.normal_do_synchronisation_3:
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bic	r1, tmp_xxx, #3
+	bl	JavaThread_is_lock_owned
+	cmp	r0, #0
+	beq	.normal_do_synchronisation_4
+	mov	r3, #0
+	str	r3, [tmp1]
+	b	1f
+.normal_do_synchronisation_4:
+	mov	r1, tmp1
+	DECACHE_STACK
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	_ZN18InterpreterRuntime12monitorenterEP10JavaThreadP15BasicObjectLock
+	ldr	r0, [istate, #ISTATE_THREAD]
+	ldr	r3, [r0, #THREAD_PENDING_EXC]
+	cmp	r3, #0
+	mov	r2, r0
+	bne	handle_exception_do_not_unlock
+1:
+  USEC ldr	r0, [istate, #ISTATE_METHOD]
+  USEC	ldr	r2, [r0, #METHOD_INVOCATIONCOUNTER]
+  USEC	ldr	lr, [dispatch, #InterpreterInvocationLimit_Address-XXX]
+  USEC	add	r2, r2, #INVOCATIONCOUNTER_COUNTINCREMENT
+  USEC	ldr	lr, [lr]
+  USEC	str	r2, [r0, #METHOD_INVOCATIONCOUNTER]
+  USEC	cmp	r2, lr
+  USEC	bcs	sync_method_entry_freq_count_overflow
+	CACHE_JPC
+	CACHE_LOCALS
+	CACHE_CP
+	DISPATCH	0
+
+#ifdef USE_COMPILER
+sync_method_entry_freq_count_overflow:
+        ldr     r3, [r0, #METHOD_CONSTMETHOD]
+        ldrh    r3, [r3, #CONSTMETHOD_CODESIZE]
+	mov	r1, #0
+	ldr	r0, [istate, #ISTATE_THREAD]
+        cmp     r3, #MAX_FG_METHOD_SIZE
+        bcc     1f
+        ldr     tmp2, [dispatch, #BackgroundCompilation_Address-XXX]
+        mov     r3, #1
+        ldr     r5, [tmp2]
+        str     r3, [tmp2]
+        bl      FREQ_COUNT_OVERFLOW
+        str     r5, [tmp2]
+        b       2f
+1:
+	bl	FREQ_COUNT_OVERFLOW
+2:
+  T2	cmp	r0, #0
+	CACHE_LOCALS
+  T2	bne	call_thumb2
+	CACHE_JPC
+	CACHE_CP
+	DISPATCH	0
+#endif
+
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+	Opcode	invokeinterface
+	ldrb	r1, [jpc, #2]
+	DECACHE_STACK
+        add     r0, constpool, r1, lsl #12
+	add	r0, r0, r2, asl #4
+	DECACHE_JPC
+        ldr     r2, [r0, #CP_OFFSET]
+        and     r2, r2, #0x00ff0000
+        cmp     r2, #opc_invokeinterface << 16
+        blne    resolve_invokeinterface
+
+	ldr	r3, [r0, #CP_OFFSET+12]
+	and	r2, r3, #255
+	ldr	r2, [stack, r2, lsl #2]
+	SW_NPC	cmp	r2, #0
+	SW_NPC	beq	null_ptr_exception
+.abortentry110:
+	ldr	tmp2, [r2, #4]				@ rcvr->klass()
+	tst	r3, #flag_methodInterface
+	bne	.invokeinterface_methodInterface
+
+	ldr	lr, [r0, #CP_OFFSET+4]			@ lr = iclass
+
+	add	r1, tmp2, #INSTANCEKLASS_VTABLE_OFFSET
+	ldr	r2, [tmp2, #KLASS_PART+INSTANCEKLASS_VTABLE_LEN]
+	ldr	ip, [tmp2, #KLASS_PART+INSTANCEKLASS_ITABLE_LEN]
+	add	r2, r2, #1
+	bic	r2, r2, #1
+
+	add	r1, r1, r2, lsl #2
+
+	mov	r2, #0
+1:
+	cmp	r2, ip
+	beq	incompatibleclass_exception
+	ldr	r3, [r1], #8
+	add	r2, r2, #1
+	cmp	lr, r3
+	bne	1b
+
+	ldr	r3, [r0, #CP_OFFSET+8]
+	ldr	r2, [r1, #-4]
+	add	r3, tmp2, r3, lsl #2
+	ldr	tmp2, [r3, r2]
+	cmp	tmp2, #0
+	beq	abstractmethod_exception
+.invokeinterface_invoke:
+	ldr	tmp1, [istate, #ISTATE_THREAD]
+@	str	tmp2, [istate, #ISTATE_CALLEE]
+	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
+	mov	r1, #0
+	str	ip, [istate, #36]
+	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
+
+	add	stack, stack, #4
+	str	stack, [tmp1, #THREAD_JAVA_SP]
+
+	ldr	r3, [ip]
+
+	mov	r0, tmp2
+	mov	r1, ip
+#ifndef SHARK
+	add	r3, r3, #CODE_ALIGN_SIZE
+#endif
+	mov	r2, tmp1
+	blx	r3
+
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r0, r1}
+	add	r0, r0, ip
+	add	dispatch, r1, r0
+
+	CACHE_LOCALS
+
+	ldr	ip, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	stack, [ip, #THREAD_JAVA_SP]
+	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
+	sub	stack, stack, #4
+
+	ldr	r1, [ip, #THREAD_TOP_ZERO_FRAME]
+	add	r2, r2, #4
+	str	r2, [ip, #THREAD_JAVA_SP]
+	str	r1, [ip, #THREAD_LAST_JAVA_SP]
+	DISPATCH_START	5
+	ldr	r3, [ip, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	cmp	r3, #0
+	DISPATCH_NEXT
+	bne	invokeinterface_exception_fix
+	DISPATCH_NEXT
+	CACHE_CP
+	DISPATCH_FINISH
+
+.invokeinterface_methodInterface:
+	tst	r3, #flag_vfinalMethod
+	ldrne	tmp2, [r0, #CP_OFFSET+8]
+	bne	.invokeinterface_invoke
+	ldr	r1, [r0, #CP_OFFSET+8]
+	add	r3, tmp2, r1, lsl #2
+	ldr	tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
+	b	.invokeinterface_invoke
+
+#ifdef FAST_BYTECODES
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+	Opcode	invokevfinal
+	ldrb	r1, [jpc, #2]
+	DECACHE_STACK
+	add	r0, constpool, r1, lsl #12
+	DECACHE_JPC
+	add	r0, r2, asl #4
+	ldr	r3, [r0, #CP_OFFSET+12]
+	ldr	tmp1, [istate, #ISTATE_THREAD]
+	and	r1, r3, #255
+	ldr	r2, [stack, r1, asl #2]
+	mov	r1, #0
+	SW_NPC	cmp	r2, #0
+	SW_NPC	beq	null_ptr_exception
+.abortentry117:
+	HW_NPC	ldr	r3, [r2]		@ Only to provoke abort
+
+	ldr	tmp2, [r0, #CP_OFFSET+8]
+
+@	str	tmp2, [istate, #ISTATE_CALLEE]
+	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
+	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
+	str	ip, [istate, #36]
+
+	add	stack, stack, #4
+	str	stack, [tmp1, #THREAD_JAVA_SP]
+
+	ldr	r3, [ip, #0]
+	b	normal_dispatch_and_return
+#endif // FAST_BYTECODES
+
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+        Opcode  invokevirtual
+	ldrb	r1, [jpc, #2]
+        add     r0, constpool, r1, lsl #12
+	add	r0, r0, r2, asl #4
+        ldr     r2, [r0, #CP_OFFSET]
+        and     r2, r2, #0xff000000
+        cmp     r2, #opc_invokevirtual << 24
+        blne    resolve_invokevirtual
+        ldr     r3, [r0, #CP_OFFSET+12]
+#ifdef FAST_BYTECODES
+        mov     r0, #opc_invokeresolved
+        tst     r3, #flag_vfinalMethod
+        movne   r0, #opc_invokevfinal
+        b       rewrite_bytecode
+#else
+        DECACHE_STACK
+	DECACHE_JPC
+        ldr     tmp1, [istate, #ISTATE_THREAD]
+        and     r1, r3, #255
+        ldr     r2, [stack, r1, asl #2]
+        mov     r1, #0
+        cmp     r2, #0
+        beq     null_ptr_exception
+
+        ldr     tmp2, [r0, #CP_OFFSET+8]
+        tst     r3, #flag_vfinalMethod
+        bne     1f
+
+        ldr     r3, [r2, #4]
+        add     r3, r3, tmp2, lsl #2
+        ldr     tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
+1:
+#endif // FAST_BYTECODES
+
+#ifdef FAST_BYTECODES
+# r2 = [jpc, #1]
+# r1 = [jpc, #2]
+        Opcode  invokeresolved
+	ldrb	r1, [jpc, #2]
+        DECACHE_STACK
+        add     r0, constpool, r1, lsl #12
+	DECACHE_JPC
+        add     r0, r0, r2, asl #4
+        ldr     r3, [r0, #CP_OFFSET+12]
+        ldr     tmp1, [istate, #ISTATE_THREAD]
+        and     r1, r3, #255
+        ldr     r2, [stack, r1, asl #2]
+        mov     r1, #0
+        SW_NPC	cmp     r2, #0
+        SW_NPC	beq     null_ptr_exception_jpc_0
+
+        ldr     tmp2, [r0, #CP_OFFSET+8]
+.abortentry104:
+        ldr     r3, [r2, #4]
+        add     r3, r3, tmp2, lsl #2
+        ldr     tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
+#endif // FAST_BYTECODES
+
+@        str     tmp2, [istate, #ISTATE_CALLEE]
+        ldr     ip, [tmp2, #METHOD_FROM_INTERPRETED]
+        str     r1, [tmp1, #THREAD_LAST_JAVA_SP]
+        str     ip, [istate, #36]
+
+        add     stack, stack, #4
+        str     stack, [tmp1, #THREAD_JAVA_SP]
+
+        ldr     r3, [ip, #0]
+
+normal_dispatch_and_return:
+	mov	r0, tmp2
+	mov	r1, ip
+#ifndef SHARK
+	add	r3, r3, #CODE_ALIGN_SIZE
+#endif
+	mov	r2, tmp1
+	blx	r3
+
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r0, r1}
+	add	r0, r0, ip
+	add	dispatch, r1, r0
+
+	CACHE_LOCALS
+
+	ldr	ip, [istate, #ISTATE_THREAD]
+	CACHE_JPC
+	ldr	stack, [ip, #THREAD_JAVA_SP]
+	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
+	sub	stack, stack, #4
+
+	ldr	r1, [ip, #THREAD_TOP_ZERO_FRAME]
+	add	r2, r2, #4
+	str	r2, [ip, #THREAD_JAVA_SP]
+	str	r1, [ip, #THREAD_LAST_JAVA_SP]
+	DISPATCH_START	3
+	ldr	r3, [ip, #4]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	cmp	r3, #0
+	DISPATCH_NEXT
+	bne	invoke_exception_fix
+	DISPATCH_NEXT
+	CACHE_CP
+	DISPATCH_FINISH
+
+	Opcode	invokestatic
+	ldrb	r1, [jpc, #2]
+        add     r0, constpool, r1, lsl #12
+	add	r0, r0, r2, asl #4
+        ldr     r2, [r0, #CP_OFFSET]
+	and	r2, r2, #0x00ff0000
+	cmp	r2, #opc_invokestatic << 16
+	blne	resolve_invokestatic
+  FBC	mov	r0, #opc_invokestaticresolved
+  FBC	b	rewrite_bytecode
+
+  FBC	Opcode	invokestaticresolved
+  FBC	ldrb	r1, [jpc, #2]
+        DECACHE_STACK
+  FBC   add     r0, constpool, r1, lsl #12
+	DECACHE_JPC
+  FBC	add	r0, r2, asl #4
+
+	ldr	tmp2, [r0, #CP_OFFSET+4]
+	mov	r1, #0
+@	str	tmp2, [istate, #ISTATE_CALLEE]
+	ldr	r3, [tmp2, #METHOD_FROM_INTERPRETED]
+	ldr	tmp1, [istate, #ISTATE_THREAD]
+	str	r3, [istate, #36]
+	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
+
+	add	stack, stack, #4
+	str	stack, [tmp1, #THREAD_JAVA_SP]
+
+	ldr	ip, [istate, #36]
+	ldr	r3, [ip, #0]
+	b	normal_dispatch_and_return
+
+
+	Opcode	invokespecial
+     	ldrb	r1, [jpc, #2]
+        add     r0, constpool, r1, lsl #12
+	add	r0, r0, r2, asl #4
+        ldr     r2, [r0, #CP_OFFSET]
+        and     r2, r2, #0x00ff0000
+        cmp     r2, #opc_invokespecial << 16
+        blne     resolve_invokespecial
+  FBC	mov	r0, #opc_invokespecialresolved
+  FBC	b	rewrite_bytecode
+
+  FBC	Opcode	invokespecialresolved
+  FBC	ldrb	r1, [jpc, #2]
+        DECACHE_STACK
+  FBC   add     r0, constpool, r1, lsl #12
+	DECACHE_JPC
+  FBC	add	r0, r2, asl #4
+
+	ldr	r3, [r0, #CP_OFFSET+12]
+	ldr	tmp1, [istate, #ISTATE_THREAD]
+	and	r3, r3, #255
+	ldr	r2, [stack, r3, asl #2]
+	mov	r1, #0
+	SW_NPC	cmp	r2, #0
+	SW_NPC	beq	null_ptr_exception
+.abortentry118:
+	HW_NPC	ldr	r3, [r2]		@ Only to provoke abort
+
+	ldr	tmp2, [r0, #CP_OFFSET+4]
+
+@	str	tmp2, [istate, #ISTATE_CALLEE]
+	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
+	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
+	str	ip, [istate, #36]
+
+	add	stack, stack, #4
+	str	stack, [tmp1, #THREAD_JAVA_SP]
+
+	ldr	r3, [ip, #0]
+	b	normal_dispatch_and_return
+
+	ALIGN_CODE
+normal_entry:
+	stmfd	arm_sp!, {regset, lr}
+
+	ldr	r7, [r2, #THREAD_STACK_SIZE]
+	ldr	r3, [r2, #THREAD_STACK_BASE]
+	rsb	r3, r7, r3
+	rsb	r3, r3, arm_sp
+	cmp	r3, #32768
+	blt	stack_overflow_no_frame
+
+	bl	fast_normal_entry
+
+	ldmfd	arm_sp!, {regset, pc}
+
+	ALIGN_CODE
+fast_normal_entry:
+	adrl	ip, dispatch_init_adcon
+	mov	tmp2, r0
+	ldm	ip, {r0, r1}
+	mov	tmp1, r2
+	add	r0, r0, ip
+	ldr	stack, [tmp1, #THREAD_JAVA_SP]
+	add	dispatch, r1, r0
+
+	stmdb	arm_sp!, {fast_regset, lr}
+
+	ldrh	r0, [tmp2, #METHOD_MAXLOCALS]
+	mov	r1, #0
+	ldrh	r3, [tmp2, #METHOD_SIZEOFPARAMETERS]
+        mov     ip, #INTERPRETER_FRAME
+	ldrh	r2, [tmp2, #METHOD_MAXSTACK]
+        sub     r7, r0, r3
+
+	ldr	r3, [tmp1, #THREAD_JAVA_STACK_BASE]
+	sub	r5, stack, r7, lsl #2
+	sub	r5, r5, #FRAME_SIZE+STACK_SPARE+LEAF_STACK_SIZE
+	sub	r5, r5, r2, lsl #2
+	cmp	r3, r5
+	bcs	stack_overflow_before_frame
+
+        subs    r5, r7, #2
+        tst     r7, #1
+        strne   r1, [stack, #-4]!
+        bcc     3f
+1:
+        str     r1, [stack, #-4]
+        str     r1, [stack, #-8]!
+        subs    r5, r5, #2
+        bcs     1b
+3:
+	ldr	r3, [tmp1, #THREAD_TOP_ZERO_FRAME]
+	mov	lr, #0
+        sub     istate, stack, #FRAME_SIZE
+        sub     r2, istate, r2, lsl #2
+        str     lr, [istate, #ISTATE_MSG]
+	str	r2, [tmp1, #THREAD_JAVA_SP]
+        sub     r5, r2, #4                      @ stack limit = istate - stackwords - 4
+	str	r3, [istate, #ISTATE_NEXT_FRAME]
+	str	ip, [istate, #ISTATE_FRAME_TYPE]
+@	str	istate, [istate, #ISTATE_SELF_LINK]
+	str	istate, [istate, #ISTATE_MONITOR_BASE]
+	str	r5, [istate, #ISTATE_STACK_LIMIT]
+	str	istate, [istate, #ISTATE_STACK_BASE]
+        sub     locals, stack, #4
+	str	r1, [istate, #ISTATE_OOP_TEMP]
+        add     locals, locals, r0, lsl #2
+        sub     stack, istate, #4
+        ldr     jpc, [tmp2, #METHOD_CONSTMETHOD]
+        ldr     constpool, [tmp2, #METHOD_CONSTANTS]
+        add     ip, istate, #ISTATE_NEXT_FRAME
+	DISPATCH_START	CONSTMETHOD_CODEOFFSET
+        ldr     constpool, [constpool, #CONSTANTPOOL_CACHE]
+        str     ip, [tmp1, #THREAD_TOP_ZERO_FRAME]
+  USEC	ldr	r3, [r10, #METHOD_INVOCATIONCOUNTER]
+        str     ip, [tmp1, #THREAD_LAST_JAVA_SP]
+	DISPATCH_NEXT
+  USEC	ldr	lr, [dispatch, #InterpreterInvocationLimit_Address-XXX]
+  USEC	add	r3, r3, #INVOCATIONCOUNTER_COUNTINCREMENT
+        str     tmp1, [istate, #ISTATE_THREAD]
+  USEC	ldr	lr, [lr]
+  USEC	str	r3, [tmp2, #METHOD_INVOCATIONCOUNTER]
+	str	locals, [istate, #ISTATE_LOCALS]
+  USEC	cmp	r3, lr
+	str	constpool, [istate, #ISTATE_CONSTANTS]
+  USEC	bcs	method_entry_freq_count_overflow
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	str	r10, [istate, #ISTATE_METHOD]
+@	mov	lr, #0
+@        str     lr, [istate, #ISTATE_PREV_LINK]
+@	str	lr, [istate, #ISTATE_CALLEE]
+	DISPATCH_FINISH
+#ifdef USE_COMPILER
+method_entry_freq_count_overflow:
+        ldr     r3, [r10, #METHOD_CONSTMETHOD]
+	DECACHE_JPC
+        ldrh    r3, [r3, #CONSTMETHOD_CODESIZE]
+	str	r10, [istate, #ISTATE_METHOD]
+	mov	r1, #0
+	mov	r0, tmp1
+        cmp     r3, #MAX_FG_METHOD_SIZE
+        bcc     1f
+        ldr     tmp2, [dispatch, #BackgroundCompilation_Address-XXX]
+        mov     r3, #1
+        ldr     r5, [tmp2]
+        str     r3, [tmp2]
+        bl      FREQ_COUNT_OVERFLOW
+        str     r5, [tmp2]
+        b       2f
+1:
+	bl	FREQ_COUNT_OVERFLOW
+2:
+ T2	cmp	r0, #0
+ T2	bne	call_thumb2
+	CACHE_JPC
+	CACHE_CP
+	DISPATCH	0
+
+#ifdef THUMB2EE
+#define THUMB2_MAXLOCALS 1000
+call_thumb2:
+	mov	ip, r1
+	sub	r1, locals, #THUMB2_MAXLOCALS * 4
+	ldr	r2, [istate, #ISTATE_THREAD]
+	sub	r3, locals, #31 * 4
+	add	stack, stack, #4
+	bx	ip
+#endif // THUMB2EE
+
+#endif // USE_COMPILER
+	.global	Thumb2_Install
+Thumb2_Install:
+@	ldr	r0, [r0]
+	str	r1, [r0, #METHOD_FROM_INTERPRETED]
+	bx	lr
+
+handle_return:
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+
+	cmp	tmp1, tmp2
+	blcc	return_check_monitors
+
+	mov	r3, #0
+	ldrb	lr, [jpc, #0]
+
+	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [r2, #0]
+	ldrh	r0, [r0, #40]
+	add	r1, r2, #4
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+
+	add	r1, r1, r0, lsl #2
+
+	cmp	lr, #opc_lreturn
+	cmpne	lr, #opc_dreturn
+	ldreq	r0, [stack, #8]
+	streq	r0, [r1, #-4]!
+	cmpne	lr, #opc_ireturn
+	cmpne	lr, #opc_freturn
+	cmpne	lr, #opc_areturn
+	ldreq	r0, [stack, #4]
+	streq	r0, [r1, #-4]!
+
+	str	r1, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+
+@ ----------------------------------------------------------------------------------------
+stack_overflow_no_frame:
+	mov	r0, tmp1
+	ldr	ip, [r0, #THREAD_TOP_ZERO_FRAME]
+	str	ip, [r0, #THREAD_LAST_JAVA_SP]
+	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
+	ldmfd	arm_sp!, {regset, pc}
+
+stack_overflow_before_frame:
+	mov	r0, tmp1
+	ldr	ip, [r0, #THREAD_TOP_ZERO_FRAME]
+	str	ip, [r0, #THREAD_LAST_JAVA_SP]
+	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
+	ldmfd	arm_sp!, {fast_regset, pc}
+
+handle_exception_do_not_unlock:
+	mov	r3, #1
+	strb	r3, [r2, #THREAD_DO_NOT_UNLOCK]
+	b	handle_exception_with_bcp
+
+abstractmethod_exception:
+	mov	r0, #VMSYMBOLS_AbstractMethodError
+	b	raise_exception
+incompatibleclass_exception:
+	mov	r0, #VMSYMBOLS_IncompatibleClassChangeError
+raise_exception:
+	adr	r1, null_str
+raise_exception_with_msg:
+	stmdb	sp!, {r0, r1}
+	bl	load_dispatch
+	ldmia	sp!, {r0, r1}
+	DECACHE_JPC
+        DECACHE_STACK
+	mov	r2, r1
+	ldr	r1, [dispatch, #VmSymbols_symbols_Address-XXX]
+	ldr	r1, [r1, r0, lsl #2]
+        ldr     r0, [istate, #ISTATE_THREAD]
+	bl	Helper_Raise
+        b       handle_exception_with_bcp
+null_str:
+	.byte	0
+	ALIGN_WORD
+
+invokeinterface_exception_fix:
+	sub	jpc, jpc, #2
+invoke_exception_fix:
+invokenative_exception:
+return_exception:
+	sub	jpc, jpc, #3
+resolve_exception:
+putfield_exception:
+getfield_exception:
+handle_exception:
+@ jpc = Exception PC
+@ stack = garbage
+@ locals = garbage
+@ constpool = garbage
+	DECACHE_JPC
+handle_exception_with_bcp:
+	bl	load_dispatch
+	CACHE_JPC
+	ldr	stack, [istate, #ISTATE_STACK_BASE]
+	sub	stack, stack, #4
+	DECACHE_STACK
+	cmp	jpc, #0
+	beq	1f
+
+	mov	r0, istate
+	ldr	r1, [istate, #ISTATE_THREAD]
+	bl	Helper_HandleException
+	cmp	r0, #0
+	beq	1f
+
+	mov	jpc, r0
+	CACHE_STACK
+	CACHE_LOCALS
+	CACHE_CP
+	DISPATCH 0
+1:
+	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
+
+	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
+	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
+
+	mov	r3, #0
+	ldrb	r0, [tmp_xxx, #THREAD_DO_NOT_UNLOCK]
+	strb	r3, [tmp_xxx, #THREAD_DO_NOT_UNLOCK]
+	cmp	r0, #0
+	bne	2f
+
+	cmp	tmp1, tmp2
+	blcc	return_check_monitors
+
+2:
+	mov	r3, #0
+
+	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
+	ldr	r0, [istate, #ISTATE_METHOD]
+	ldr	r3, [r2, #0]
+	ldrh	r0, [r0, #40]
+	add	r1, r2, #4
+	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
+
+	add	r1, r1, r0, lsl #2
+
+	str	r1, [tmp_xxx, #THREAD_JAVA_SP]
+
+	ldmfd	arm_sp!, {fast_regset, pc}
+
+return_check_monitors:
+	stmdb	arm_sp!, {r4, lr}
+
+	ldr	r2, [istate, #ISTATE_METHOD]
+	ldr	r4, [r2, #METHOD_ACCESSFLAGS]
+	tst	r4, #1<<5
+	subne	tmp2, tmp2, #8
+	cmp	tmp1, tmp2
+	bcs	2f
+1:
+	ldr	r3, [tmp1, #4]
+	cmp	r3, #0
+	bne	3f
+	add	tmp1, tmp1, #8
+	cmp	tmp1, tmp2
+	bcc	1b
+
+2:
+	tst	r4, #1<<5
+
+	ldmeqia	arm_sp!, {r4, pc}
+
+	ldr	tmp1, [tmp2, #4]		@ base->obj == NULL
+	cmp	tmp1, #0
+	beq	4f
+
+	ldr	r0, [tmp2, #0]			@ r0 = header
+	mov	r3, #0
+	cmp	r0, #0
+	str	r3, [tmp2, #4]			@ base->obj = NULL
+
+	ldmeqia	arm_sp!, {r4, pc}
+
+	mov	r1, tmp1
+	mov	r2, tmp2
+	bl	cmpxchg_ptr
+	cmp	tmp2, r0
+
+	ldmeqia	arm_sp!, {r4, pc}
+
+	str	tmp1, [tmp2, #4]
+
+	mov	r1, tmp2
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	Helper_synchronized_exit
+
+	ldmeqia	arm_sp!, {r4, pc}
+
+3:
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	Helper_RaiseIllegalMonitorException
+	b	2b
+
+4:
+	ldr	r0, [istate, #ISTATE_THREAD]
+	bl	Helper_RaiseIllegalMonitorException
+	ldmia	arm_sp!, {r4, pc}
+
+	ALIGN_CODE
+accessor_entry:
+	b	slow_accessor_entry
+
+	ALIGN_CODE
+slow_accessor_entry:
+  USEC	adrl	ip, dispatch_init_adcon
+  USEC	ldr	r3, [ip]
+  USEC	add	r3, r3, ip
+  USEC	ldr	ip, [ip, #invocationlimit_adcon-dispatch_init_adcon]
+  USEC	ldr	ip, [r3, ip]
+
+  USEC	ldr	r3, [r0, #METHOD_INVOCATIONCOUNTER]
+  USEC	ldr	ip, [ip, #0]
+  USEC	add	r3, r3, #INVOCATIONCOUNTER_COUNTINCREMENT
+  USEC	str	r3, [r0, #METHOD_INVOCATIONCOUNTER]
+  USEC	cmp	r3, ip
+  USEC	bcs	normal_entry
+
+	ldr	r1, [r0, #METHOD_CONSTMETHOD]
+	ldrb	r3, [r1, #CONSTMETHOD_CODEOFFSET+2]
+	ldrb	r1, [r1, #CONSTMETHOD_CODEOFFSET+3]
+	ldr	ip, [r0, #METHOD_CONSTANTS]
+	ldr	ip, [ip, #CONSTANTPOOL_CACHE]
+	orr	r3, r3, r1, lsl #8		@ r3 = index
+
+	add	r1, ip, #CP_OFFSET
+	ldr	r3, [r1, r3, lsl #4]!		@ r1 = cache, r3 = flags
+	ldr	ip, [r2, #THREAD_JAVA_SP]			@ ip == stack
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getfield << 16
+	ldr	r3, [ip, #0]
+	bne	normal_entry
+
+	cmp	r3, #0
+	beq	normal_entry
+
+	ldr	r0, [r1, #12]
+	ldr	r1, [r1, #8]
+	movs	r0, r0, lsr #29
+	bls	accessor_non_w
+
+	ldr	r0, [r3, r1]
+	str	r0, [ip, #0]
+	bx	lr
+
+.fast_accessor_non_w:
+	bcs	.fast_accessor_h
+	beq	.fast_accessor_sb
+	tst	lr, #2
+	bne	.fast_accessor_dw
+.fast_accessor_sh:
+	DISPATCH_STATE	2
+	DISPATCH_NEXT
+	ldrsh	tmp1, [r2, r3]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+.fast_accessor_h:
+	DISPATCH_STATE	2
+	DISPATCH_NEXT
+	ldrh	tmp1, [r2, r3]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+.fast_accessor_sb:
+	DISPATCH_STATE	2
+	DISPATCH_NEXT
+	ldrsb	tmp1, [r2, r3]
+	DISPATCH_NEXT
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_FINISH
+.fast_accessor_dw:
+	DISPATCH_STATE	2
+	add	tmp1, r2, r3
+	DISPATCH_NEXT
+	ldm	tmp1, {tmp2, tmp1}
+	DISPATCH_NEXT
+	PUT_STACK	0, tmp1
+	DISPATCH_NEXT
+	PUSH	tmp2
+	DISPATCH_FINISH
+
+div_zero_jpc_1:
+	sub	jpc, jpc, #1
+.lrem_0:
+.ldiv_0:
+divide_by_zero_exception:
+	mov	r0, #VMSYMBOLS_ArithmeticException
+	adr	r1, div_zero_msg
+	b	raise_exception_with_msg
+div_zero_msg:
+	.ascii  "/ by int zero\000"
+	ALIGN_WORD
+
+array_bound_exception_jpc_4_r3:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_3_r3:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_2_r3:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_1_r3:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_0_r3:
+	mov	r2, r3
+	b	array_bounds_exception
+array_bound_exception_jpc_1_tmp2:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_0_tmp2:
+	mov	r2, tmp2
+	b	array_bounds_exception
+array_bound_exception_jpc_3:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_2:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_1:
+	sub	jpc, jpc, #1
+array_bound_exception_jpc_0:
+array_bounds_exception:
+	DECACHE_JPC
+        DECACHE_STACK
+	mov	r1, r2
+        ldr     r0, [istate, #ISTATE_THREAD]
+	bl	Helper_RaiseArrayBoundException
+        b       handle_exception_with_bcp
+
+#ifndef HW_NULL_PTR_CHECK
+null_ptr_exception_jpc_5:
+	sub	jpc, jpc, #1
+null_ptr_exception_jpc_4:
+	sub	jpc, jpc, #1
+null_ptr_exception_jpc_3:
+	sub	jpc, jpc, #1
+null_ptr_exception_jpc_2:
+	sub	jpc, jpc, #1
+null_ptr_exception_jpc_1:
+	sub	jpc, jpc, #1
+null_ptr_exception_jpc_0:
+#endif
+null_ptr_exception:
+	mov	r0, #VMSYMBOLS_NullPointerException
+	b	raise_exception
+
+@ ==== SW FP ==============================================================================
+
+	Opcode	fadd
+	POP	r0, r1
+        bl      __aeabi_fadd
+	PUSH	r0
+	DISPATCH	1
+
+	Opcode	fsub
+	POP	r1
+	POP	r0
+        bl      __aeabi_fsub
+	PUSH	r0
+	DISPATCH	1
+
+	Opcode	fmul
+	POP	r0, r1
+        bl      __aeabi_fmul
+	PUSH	r0
+	DISPATCH	1
+
+	Opcode	fdiv
+	POP	r1
+	POP	r0
+        bl      __aeabi_fdiv
+	PUSH	r0
+	DISPATCH	1
+
+	Opcode	ddiv
+	POP	r2, r3
+	POP	r0, r1
+        bl      __aeabi_ddiv
+	PUSH	r0, r1
+	DISPATCH	1
+
+	Opcode	fcmpl
+        ldmib   stack, {r0, r1}
+        bl      __aeabi_fcmpgt
+        cmp     r0, #0
+        movne   r3, #-1
+        bne     3f
+        ldmib   stack, {r0, r1}
+        bl      __aeabi_fcmplt
+        cmp     r0, #0
+        movne   r3, #1
+        bne     3f
+        ldmib   stack, {r0, r1}
+        bl      __aeabi_fcmpeq
+        cmp     r0, #0
+        movne   r3, #0
+        moveq   r3, #-1
+3:
+	DISPATCH_START	1
+	add	stack, stack, #8
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+
+	Opcode	fcmpg
+        ldmib   stack, {r0, r1}
+        bl      __aeabi_fcmpgt
+        cmp     r0, #0
+        movne   r3, #-1
+        bne     4f
+        ldmib   stack, {r0, r1}
+        bl      __aeabi_fcmplt
+        cmp     r0, #0
+        movne   r3, #1
+        bne     4f
+        ldmib   stack, {r0, r1}
+        bl      __aeabi_fcmpeq
+        cmp     r0, #0
+        movne   r3, #0
+        moveq   r3, #1
+4:
+	DISPATCH_START	1
+	add	stack, stack, #8
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+
+	Opcode	dcmpl
+        ldmib   stack, {r0, r1, r2, r3}
+        bl      __aeabi_dcmpgt
+        cmp     r0, #0
+        movne   r3, #-1
+        bne     5f
+        ldmib   stack, {r0, r1, r2, r3}
+        bl      __aeabi_dcmplt
+        cmp     r0, #0
+        movne   r3, #1
+        bne     5f
+        ldmib   stack, {r0, r1, r2, r3}
+        bl      __aeabi_dcmpeq
+        cmp     r0, #0
+        movne   r3, #0
+        moveq   r3, #-1
+5:
+	DISPATCH_START	1
+	add	stack, stack, #16
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+
+	Opcode	dcmpg
+        ldmib   stack, {r0, r1, r2, r3}
+        bl      __aeabi_dcmpgt
+        cmp     r0, #0
+        movne   r3, #-1
+        bne     6f
+        ldmib   stack, {r0, r1, r2, r3}
+        bl      __aeabi_dcmplt
+        cmp     r0, #0
+        movne   r3, #1
+        bne     6f
+        ldmib   stack, {r0, r1, r2, r3}
+        bl      __aeabi_dcmpeq
+        cmp     r0, #0
+        movne   r3, #0
+        moveq   r3, #1
+6:
+	DISPATCH_START	1
+	add	stack, stack, #16
+	DISPATCH_NEXT
+	PUSH	r3
+	DISPATCH_FINISH
+
+@ ==== Fast SW FP emulation ===============================================================
+
+#define al		r0
+#define ah		r1
+#define bl		r2
+#define bh		r3
+#define tmp		tmp1
+#define sh		r12
+#define ex_add		r14
+
+@ TOS = TOSM1 + TOS
+@ What we actually do is TOS = TOS + TOSM1
+@ --- do_dadd_vtos -------------------------------------------------
+	Opcode	dadd
+	POP	al, ah, bl, bh
+	mov	tmp, #0xff000000
+	orr	tmp, tmp, #0x00e00000
+        bics    ex_add, tmp, ah, LSL #1
+        bicnes  ex_add, tmp, bh, LSL #1
+        beq     .dadd_naninf
+        teq     ah, bh
+        eormi   bh, bh, #1 << 31
+        bmi     ._dsub1
+._dadd1:
+        subs    ex_add, al, bl
+        sbcs    sh, ah, bh
+        bhs     .dadd_swapped
+        adds    bl, bl, ex_add
+        adc     bh, bh, sh
+        subs    al, al, ex_add
+        sbc     ah, ah, sh
+.dadd_swapped:
+        mov     ex_add, ah, LSR #20
+        sub     sh, ex_add, bh, LSR #20
+        tst     tmp, bh, LSL #1
+        beq     .dadd_uncommon
+        bic     ah, ah, ex_add, LSL #20
+        bic     bh, bh, tmp
+        orr     bh, bh, #1 << 20
+.dadd_doadd:
+        rsbs    tmp, sh, #32
+        blo     .dadd_bigshift
+.dadd_smallshift:
+        adds    al, al, bl, LSR sh
+        adc     ah, ah, bh, LSR sh
+        adds    al, al, bh, LSL tmp
+        adcs    ah, ah, #0
+        cmp     ah, #1 << 20
+        bhs     .dadd_carry
+        add     ah, ah, ex_add, LSL #20     @ add exponent
+.dadd_nocarry:
+        movs    bl, bl, LSL tmp         @ round and sticky bits
+	bpl	.dadd_exit
+        adds    al, al, #1
+        movccs  bl, bl, LSL #1          @ is sticky bit zero?
+	bne	.dadd_exit
+.dadd_roundeven:
+        cmp     al, #0
+        bicne   al, al, #1              @ RTE if carry didn't occur
+        adceq   ah, ah, #0              @ increment high word if it did
+.dadd_check_overflow_inx:
+        mov     bh, ah, LSL #1
+        cmp     bh, #0xFFE00000
+	blo	.dadd_exit
+        subhs   ah, ah, #3<<29          @ bias exponent
+	b	.return_double_Inf
+.dadd_bigshift:
+        cmp     bl, #1
+        adc     bl, bh, bh
+        sub     sh, sh, #32             @ nonzero
+        rsbs    tmp, sh, #31            @ sets C if within a word
+        movlo   tmp, #0                 @ C clear if sh > 31
+        addhss  al, al, bh, LSR sh
+        adc     ah, ah, ex_add, LSL #20
+        cmp     ex_add, ah, LSR #20
+        beq     .dadd_nocarry
+        sub     ah, ah, ex_add, LSL #20
+.dadd_carry:
+        add     ah, ah, #1 << 20
+        movs    ah, ah, LSR #1
+        add     ah, ah, ex_add, LSL #20
+        movs    al, al, RRX
+        bcc     .dadd_check_overflow_exact
+        adcs    al, al, #0
+        movccs  tmp, bl, LSL tmp    @EQ = round to even
+        bne     .dadd_check_overflow_exact
+        b       .dadd_roundeven
+.dadd_rnearup_carry:
+        adds    al, al, #1
+        movccs  bl, bl, LSL #1          @ is sticky bit zero?
+        bne     .dadd_check_overflow_inx
+        b       .dadd_roundeven
+.dadd_check_overflow_exact:
+        mov     bh, ah, LSL #1
+        cmp     bh, #0xFFE00000
+	blo	.dadd_exit
+        sub     ah, ah, #3<<29          @ bias exponent
+
+.return_double_Inf:
+	and	a3, ah, #0x80000000
+.return_double_Inf_1:
+	mov	al, #0
+	mov	ah, #0x7f000000
+	orr	ah, ah, #0x00f00000
+	orr	ah,ah,a3
+.dadd_exit:
+	PUSH	al, ah
+	DISPATCH	1
+
+.dadd_uncommon:
+        orrs    tmp, bl, bh, LSL #1     @ Is b zero or denormal?
+        beq     .dadd_bzero
+        movs    tmp, ex_add, LSL #21
+        bic     ah, ah, ex_add, LSL #20
+        bicne   bh, bh, #1 << 31
+        subne   sh, sh, #1              @ adjust exponent to fake exp_b = 1
+        bne     .dadd_doadd    
+        adds    al, al, bl
+        adc     ah, ah, bh
+        b       .daddsub_denorm
+.dadd_bzero:
+        movs    tmp, ex_add, LSL #21        @ is a denormal?
+	bne	.dadd_exit
+        orrs    tmp, al, ah, LSL #1     @ a zero?
+	beq	.dadd_exit
+        b       .daddsub_denorm
+
+.dadd_naninf:
+        cmp     al, #1                  @ sets C if al!=0
+        adc     ex_add, ah, ah
+        cmp     bl, #1
+        adc     sh, bh, bh
+        cmp     ex_add, tmp                 @ HI if a is NaN
+        cmpls   sh, tmp                 @ HI if either is NaN
+        bhi     .return_double_NaN
+        cmp     ex_add, sh
+        beq     .dadd_twoinf
+        cmp     ex_add, tmp                 @ EQ if a is Inf
+        movne   ah, bh
+        movne   al, bl
+	b	.dadd_exit
+.dadd_twoinf:
+        teq     ah, bh
+	bpl	.dadd_exit
+	b	.return_double_NaN
+
+@ --- do_dsub_itos -------------------------------------------------
+	Opcode	dsub
+	POP	al, ah, bl, bh
+        mov     tmp, #0xff000000
+        orr     tmp, tmp, #0x00e00000
+        bics    ex_add, tmp, ah, LSL #1
+        bicnes  ex_add, tmp, bh, LSL #1
+        beq     .drsb_naninf
+	teq	ah, bh
+	eor	ah, ah, #1 << 31
+	bmi	._dadd1
+	eor	bh, bh, #1 << 31
+._dsub1:
+        subs    ex_add, al, bl
+        sbcs    sh, ah, bh
+        bhs     .dsub_swapped
+.dsub_do_swap:
+        eor     sh, sh, #1 << 31        @ negate a and b as a - b == -b - -a
+        adds    bl, bl, ex_add
+        adc     bh, bh, sh
+        subs    al, al, ex_add
+        sbc     ah, ah, sh
+.dsub_swapped:
+        mov     ex_add, ah, LSR #20
+        sub     sh, ex_add, bh, LSR #20
+        tst     tmp, bh, LSL #1
+        beq     .dsub_uncommon
+        bic     ah, ah, ex_add, LSL #20
+        bic     bh, bh, tmp, ASR #1
+        rsbs    bl, bl, #0
+        rsc     bh, bh, tmp, ASR #1     @ 0xffe00000 >> 1 = -(1 << 20)
+.dsub_dosub:
+        rsbs    tmp, sh, #32
+        blo     .dsub_bigshift
+.dsub_smallshift:
+        adds    al, al, bl, LSR sh
+        adc     ah, ah, bh, ASR sh
+        adds    al, al, bh, LSL tmp
+        adcs    ah, ah, #0
+        bmi     .dsub_borrow
+.dsub_noborrow:
+        add     ah, ah, ex_add, LSL #20
+        movs    bl, bl, LSL tmp
+.dsub_dorounding:
+	bpl	.dsub_exit
+        adds    al, al, #1              @ Z flag set if carry to high word
+        cmpne   bl, #0x80000000         @ check we don't have to round to even
+	bne	.dsub_exit
+        cmp     al, #0
+        addeq   ah, ah, #1
+        bicne   al, al, #1
+	b	.dsub_exit
+.dsub_bigshift:
+        cmp     bl, #1
+        adc     bl, bh, bh 
+        sub     sh, sh, #32
+        rsbs    tmp, sh, #31
+        blo     .dsub_hugeshift
+        adds    al, al, bh, ASR sh
+        adcs    ah, ah, #-1
+        bpl     .dsub_noborrow
+.dsub_borrow:
+        add     tmp, tmp, #1
+        movs    tmp, bl, LSL tmp
+        adcs    al, al, al              @ shift al,ah left including guard bit
+        adc     ah, ah, ah
+        add     sh, ah, ex_add, LSL #21     @ ah = 0xFFE00000 + fraction. Adding
+        movs    sh, sh, LSR #21         @ C-bit is clear if bit 20 of ah
+        bls     .dsub_renormalize        @   clear, so 2 bits or more
+        add     ah, ah, ex_add, LSL #20
+        adds    al, al, tmp, LSR #31    @ C and Z flag are set if carry over
+        cmpcc   tmp, #0x80000000        @ check that we don't have to round
+	bne	.dsub_exit
+        cmp     al, #0
+        addeq   ah, ah, #1
+        bicne   al, al, #1
+	b	.dsub_exit
+.dsub_renormalize:
+        bcs     .dsub_ex_one
+        adds    ah, ah, #1 << 21
+        cmpeq   al, #0
+        beq     .dsub_retzero            @ go and deal with it, if so
+        mov     sh, ex_add, LSR #11
+        bic     ex_add, ex_add, #1 << 11
+        sub     ex_add, ex_add, #2        @ for leading bit
+.dsub_renormloop:                 @ TODO: add loop for 8 bit per cycle renorm
+        adds    al, al, al
+        adc     ah, ah, ah
+        sub     ex_add, ex_add, #1
+        tst     ah, #1 << 20
+        beq     .dsub_renormloop
+        add     ah, ah, sh, LSL #31 
+        add     ah, ah, ex_add, LSL #20
+        cmp     ex_add, #0
+	bgt	.dsub_exit
+        add     ah, ah, #3 << 29        @ bias exponent
+        @ Rounding direction indicator is zero (denormal results are exact)
+	mov	ip, #0
+        b       .__dunder
+.dsub_hugeshift:
+.dsub_return:
+        add     ah, ah, ex_add, LSL #20
+.dsub_return1:
+.dsub_exit:
+	PUSH	al, ah
+	DISPATCH	1
+.dsub_ex_one:    @ underflow when ex = 1 - shift back to denorm
+        movs    ah, ah, ASR #1
+        mov     al, al, RRX
+        add     ah, ah, ex_add, LSL #20
+        b       .dsub_denorm
+.dsub_uncommon:
+        orrs    tmp, bl, bh, LSL #12    @ is b zero or denorm?
+        beq     .dsub_bzero
+        movs    tmp, ex_add, LSL #21
+        bic     ah, ah, ex_add, LSL #20
+        beq     .dsub_both_denorm
+        bic     bh, bh, #1 << 31
+        sub     sh, sh, #1
+        rsbs    bl, bl,#0
+        rsc     bh, bh,#0
+        b       .dsub_dosub    
+.dsub_both_denorm:
+        subs    al, al, bl
+        sbc     ah, ah, bh
+        b       .dsub_denorm
+.dsub_bzero:
+        orrs    tmp, al, ah, LSL #1
+        bne     .dsub_denorm             @ return a@ but it might be denormal
+.dsub_retzero:
+        mov     ah, #0                  @ clear sign bit (al is already 0)
+	b	.dsub_exit
+.dsub_denorm:
+.daddsub_denorm:
+        movs    bl, ah, LSL #1          @ discard sign bit
+        tsteq   al, al                  @ do we have a zero?
+        beq     .dsub_retzero            @ yes@ go and ensure the right sign
+	b	.dsub_exit
+.drsb_naninf:
+        @ Handle NaNs and infinities in reverse subtraction. We
+        @ just swap the operands and go to dsub_naninf.
+        eor     ah, ah, bh
+        eor     al, al, bl
+        eor     bh, bh, ah
+        eor     bl, bl, al
+        eor     ah, ah, bh
+        eor     al, al, bl
+.dsub_naninf:
+        cmp     al, #1                  @ sets C if al!=0
+        adc     ex_add, ah, ah
+        cmp     bl, #1
+        adc     sh, bh, bh
+        cmp     ex_add, tmp                 @ HI if a is NaN
+        cmpls   sh, tmp                 @ HI if either is NaN
+        bhi     .return_double_NaN
+        cmp     ex_add, sh
+        beq     .dsub_twoinf
+        cmp     ex_add, tmp                 @ EQ if a is Inf
+        eorne   ah, bh, #0x80000000
+        movne   al, bl
+	b	.dsub_exit
+.dsub_twoinf:
+        teq     ah, bh
+	bmi	.dsub_exit
+
+.return_double_NaN:
+	and	a3, ah, #0x80000000
+	mov	al, #0
+	mov	ah, #0x7f000000
+	orr	ah, ah, #0x00f80000
+	orr	ah,ah,a3
+	b	.dsub_exit
+
+@ === underflow handler ================================================
+
+#define	INX_pos	30
+#define INX_bit (1<<30)
+
+#define exp	r2
+#define temp	r3
+
+.__dunder:
+        tst     ah, ah
+        orrmi   ip, ip, #1<<16
+        mov     temp, #0x600
+        mov     exp, ah, LSR #20      @ find the exponent
+        add     temp, temp, #1
+        bic     ah, ah, exp, LSL #20 @ remove exponent from mantissa
+        bic     exp, exp, #0x800        @ lose the sign bit
+        sub     exp, temp, exp
+        orr     ah, ah, #1<<20      @ put on mantissa leading bit
+        cmp     exp, #53
+        bhi     .dunder_stickyonly
+        beq     .dunder_roundbit
+        cmp     exp, #21
+        blo     .dunder_hiword
+        subs    exp, exp, #32
+        bls     .dunder_hiloword
+.dunder_loloword:
+        rsb     temp, exp, #32
+        cmp     al, #0
+        mov     al, ah, LSR exp
+        mov     exp, ah, LSL temp
+        orrne   exp, exp, #1
+        mov     ah, #0
+        b       .dunder_round
+.dunder_hiloword:
+        rsb     temp, exp, #0
+        add     exp, exp, #32
+        mov     ah, ah, LSL temp
+        orr     ah, ah, al, LSR exp
+        mov     exp, al, LSL temp
+        mov     al, ah
+        mov     ah, #0
+        b       .dunder_round
+.dunder_hiword:
+        rsb     temp, exp, #32
+        mov     tmp, al, LSL temp
+        mov     temp, ah, LSL temp
+        orr     al, temp, al, LSR exp
+        mov     ah, ah, LSR exp
+        mov     exp, tmp
+        b       .dunder_round
+.dunder_roundbit:
+        orrs    exp, al, ah, LSL #12
+        mov     al, #0
+        mov     ah, #0
+        mov     exp, #0x80000000
+        addne   exp, exp, #1
+        b       .dunder_round
+.dunder_stickyonly:
+        mov     exp, #1
+        mov     ah, #0
+        mov     al, #0
+.dunder_round:
+        tst     ip, #1<<16
+        bic     ip, ip, #1<<16
+        orrne   ah, ah, #0x80000000
+        tst     exp, exp
+	beq	.dsub_exit
+        movs    exp, exp, LSL #1        @ round bit in C, sticky in ~Z
+        bcc     .dunder_rerounded        @ if no round bit, we're done
+        beq     .dunder_roundeven        @ RTE is tricky due to rerounding
+.dunder_roundup:
+        adds    al, al, #1          @ round up
+        adc     ah, ah, #0
+.dunder_rerounded:
+	b	.dsub_exit
+.dunder_roundeven:
+        movs    exp, ip, ASR #INX_pos   @ get -1, 0, +1 from direction bits
+        bmi     .dunder_roundup          @ if -1, round up unconditionally
+        bne     .dunder_rerounded        @ if +1, round down unconditionally
+        adds    al, al, #1          @ round up ...
+        adc     ah, ah, #0
+        bic     al, al, #1          @ ... and then to even
+        b       .dunder_rerounded
+
+@ === MULTIPLY Double ===================================================
+
+#define ex_m		r14
+#define uh		r12
+#define ul		r4
+#define rs		r4
+#define th		r5
+#define tl		r11
+
+@ --- do_dmul_itos -------------------------------------------------
+	Opcode	dmul
+	POP	al, ah, bl, bh
+	stmdb	arm_sp!, {r4, r5}
+	mov	tmp, #0x7f00000
+	orr	tmp, tmp, #0x00f0000
+        bics    ex_m, tmp, ah, LSR #4     @ test for Infs or NaNs
+        bicnes  ex_m, tmp, bh, LSR #4
+        beq     .dmul_naninf
+        and     ex_m, tmp, ah, LSR #4     @ get exponent of a
+        eor     th, ah, bh              @ compute sign of result
+        orr     ex_m, ex_m, th, LSR #31     @   and save it at bottom of ex
+        ands    th, tmp, bh, LSR #4     @ get exponent of b, and test
+        tstne   ah, tmp, LSL #4         @   for zeros/denorms ...
+        beq     .dmul_zerodenorm         @   go and renormalise if we got any
+.dmul_normalised:
+        add     ex_m, ex_m, th              @ calculate exponent of result
+        sub     ex_m, ex_m, #0x3FC0000      @ rebias exponent mostly
+        bic     ah, ah, tmp, LSL #5     @ clear sign and all but lo bit of exp
+        bic     bh, bh, tmp, LSL #5
+        orr     ah, ah, #1<<20          @ set leading bit on mantissa
+        orr     bh, bh, #1<<20          @ set leading bit on mantissa
+.dmul_mantmul:
+        umull   ul, uh, ah, bl
+        umull   tl, th, al, bh
+        adds    tl, tl, ul
+        adcs    th, th, uh              @ carry from here is used below
+        umull   ul, uh, ah, bh          @ uh:ul is top part
+        adc     bh, uh, #0              @ get carry from above addition
+        umull   ah, uh, al, bl          @ uh:ah is bottom part
+        adds    tl, tl, uh
+        adcs    th, th, ul
+        adcs    bh, bh, #0
+        tst     ah, ah
+        orrne   tl, tl, #1              @ don't lose sticky bit
+        mov     bl, #-4
+        mov     uh, #32-12              @ uh will be corresponding right shift
+        cmp     bh, #0x200              @ C set if it's 11 bits
+        adc     uh, uh, #0
+        adc     bl, bl, ex_m, ASR #16     @ increment exponent correspondingly
+        rsb     ul, uh, #32             @ ul is left shift
+        mov     ah, bh, LSL ul
+        mov     al, th, LSL ul
+        orr     ah, ah, th, LSR uh
+        orr     al, al, tl, LSR uh
+        add     ah, ah, bl, LSL #20 @ put exponent back on (may wrap
+        eor     ah, ah, ex_m, LSL #31 @ put sign back on (with EOR so that
+        movs    rs, tl, LSL ul          @ compute the round word
+        beq     .dmul_exact
+        movs    uh, rs, LSL #1          @ rs is already in place
+        movcc   rs, #-INX_bit           @ direction indicator: rounded down
+        bcc     .dmul_rounded
+        orreq   bh, bh, #1<<31          @ save the round-to-even bit
+        adcs    al, al, #0          @ round up if necessary
+        adc     ah, ah, #0
+        mov     rs, #INX_bit            @ direction indicator: rounded up
+        tst     al, bh, LSR #31       @ does RTE do anything?
+        bic     al, al, bh, LSR #31 @ perform RTE
+        movne   rs, #-INX_bit           @ if RTE had effect, we rounded down
+.dmul_exact:
+.dmul_rounded:
+        teq     ah, ex_m, LSL #31       @ do the signs agree?
+	mov	uh, #0x70000000         @ even if so, need to test exp 0/7FF
+	orr	uh, uh, #0x0ff00000
+        bmi     .dmul_outflow            @ if not, UFL or OFL
+        tst     ah, uh
+        bicnes  uh, uh, ah            @ is exp 0 or 7FF?
+        beq     .dmul_outflow
+.dmul_exit:
+	ldmia	arm_sp!, {r4, r5}
+	PUSH	al, ah
+	DISPATCH	1
+
+.dmul_rdirect:
+        movs    ul, ex_m, LSL #31         @ put sign bit in N
+        tstpl   uh, #2 << 22        @ if +ve: EQ iff round up. Keeps PL
+        tstmi   uh, #1 << 22         @ if -ve: EQ iff round up.
+        moveq   rs, #INX_bit            @ rounded up
+        movne   rs, #-INX_bit           @ rounded down
+        addeqs  al, al, #1          @ may set C
+        adc     ah, ah, #0
+        b       .dmul_rounded
+
+.dmul_outflow:
+        cmp     ex_m, #0x400<<16          @ Which ballpark are we in?
+        addle   ah, ah, #0x60000000 @ Bias up if underflow
+        subge   ah, ah, #0x60000000 @ Bias down if overflow
+	mov	ip, rs
+	ldmia	arm_sp!, {r4, r5}
+        ble     .__dunder                @ underflow
+	b	.return_double_Inf
+
+.dmul_zerodenorm:
+        orrs    ul, al, ah, LSL #1      @ is a zero?
+        orrnes  ul, bl, bh, LSL #1      @ or is b zero?
+        beq     .dmul_zero               @ Return zero if so
+
+        tst     th, th                  @ is b denormal?
+        beq     .dmul_renorm_op2
+.dmul_done_op2:
+        bics    ul, ex_m, #1              @ is a denormal? (careful of sign bit)
+        beq     .dmul_renorm_op1
+        b       .dmul_normalised
+.dmul_zero:
+        mov     al, #0                  @ clear low word
+        mov     ah, ex_m, LSL #31         @ get sign of result and clear hi word
+	b	.dmul_exit
+
+.dmul_renorm_op1:
+        add     ex_m, ex_m, #1<<16          @ correct the exponent
+        bic     ah, ah, #0x80000000       @ this will get in our way
+        orrs    tl, ah, al, LSR #12    @ is highest set bit in low twelve?
+        moveq   al, al, LSL #20         @ if so, move it up
+        subeq   ex_m, ex_m, #20<<16       @ and adjust exponent
+        tst     ah, ah                  @ is highest set bit in low word?
+        moveq   ah, al, LSR #12         @ if so, move up by 20
+        moveq   al, al, LSL #20
+        subeq   ex_m, ex_m, #20<<16       @ and adjust exponent
+        mov     ul, #0                 @ shift of top word
+        movs    tl, ah, LSR #(21-16)   @ is highest set bit within 16 of top?
+        moveq   ah, ah, LSL #16         @ if not, move up
+        addeq   ul, ul, #16           @ and adjust exponent
+        movs    tl, ah, LSR #(21-8)   @ is highest set bit within 8 of top?
+        moveq   ah, ah, LSL #8         @ if not, move up
+        addeq   ul, ul, #8           @ and adjust exponent
+        movs    tl, ah, LSR #(21-4)   @ is highest set bit within 4 of top?
+        moveq   ah, ah, LSL #4         @ if not, move up
+        addeq   ul, ul, #4           @ and adjust exponent
+        movs    tl, ah, LSR #(21-2)   @ is highest set bit within 2 of top?
+        moveq   ah, ah, LSL #2         @ if not, move up
+        addeq   ul, ul, #2           @ and adjust exponent
+        movs    tl, ah, LSR #(21-1)   @ is highest set bit within 1 of top?
+        moveq   ah, ah, LSL #1         @ if not, move up
+        addeq   ul, ul, #1           @ and adjust exponent
+
+        sub     ex_m, ex_m, ul, LSL #16  @ calculate final pseudo exponent
+        mov     tl, al, LSL ul        @ shift low word up by same amout
+        rsb     ul, ul, #32           @ compute reverse shift for al
+        orr     ah, ah, al, LSR ul     @ put in high end of low word
+        mov     al, tl
+
+	mov	tmp, #0x7f00000
+	orr	tmp, tmp, #0x00f0000
+
+        b       .dmul_normalised
+
+.dmul_renorm_op2:
+        add     th, th, #1<<16          @ correct the exponent
+        bic     bh, bh, #0x80000000       @ this will get in our way
+        orrs    tl, bh, bl, LSR #12    @ is highest set bit in low twelve?
+        moveq   bl, bl, LSL #20         @ if so, move it up
+        subeq   th, th, #20<<16       @ and adjust exponent
+        tst     bh, bh                  @ is highest set bit in low word?
+        moveq   bh, bl, LSR #12         @ if so, move up by 20
+        moveq   bl, bl, LSL #20
+        subeq   th, th, #20<<16       @ and adjust exponent
+        mov     ul, #0                 @ shift of top word
+        movs    tl, bh, LSR #(21-16)   @ is highest set bit within 16 of top?
+        moveq   bh, bh, LSL #16         @ if not, move up
+        addeq   ul, ul, #16           @ and adjust exponent
+        movs    tl, bh, LSR #(21-8)   @ is highest set bit within 8 of top?
+        moveq   bh, bh, LSL #8         @ if not, move up
+        addeq   ul, ul, #8           @ and adjust exponent
+        movs    tl, bh, LSR #(21-4)   @ is highest set bit within 4 of top?
+        moveq   bh, bh, LSL #4         @ if not, move up
+        addeq   ul, ul, #4           @ and adjust exponent
+        movs    tl, bh, LSR #(21-2)   @ is highest set bit within 2 of top?
+        moveq   bh, bh, LSL #2         @ if not, move up
+        addeq   ul, ul, #2           @ and adjust exponent
+        movs    tl, bh, LSR #(21-1)   @ is highest set bit within 1 of top?
+        moveq   bh, bh, LSL #1         @ if not, move up
+        addeq   ul, ul, #1           @ and adjust exponent
+
+        sub     th, th, ul, LSL #16  @ calculate final pseudo exponent
+        mov     tl, bl, LSL ul        @ shift low word up by same amout
+        rsb     ul, ul, #32           @ compute reverse shift for bl
+        orr     bh, bh, bl, LSR ul     @ put in high end of low word
+        mov     bl, tl
+
+	mov	tmp, #0x7f00000
+	orr	tmp, tmp, #0x00f0000
+
+        b       .dmul_done_op2
+
+.dmul_naninf:
+        mov     uh, ah, LSL #1          @ discard sign bit on a
+        mov     ul, bh, LSL #1          @ and on b
+        cmp     uh, tmp, LSL #5         @ HI if ah shows a to be NaN
+        cmpeq   al, #0                  @ now HI if a is NaN
+        cmpls   ul, tmp, LSL #5         @ another chance to set HI ...
+        cmpeq   bl, #0                  @  ... if b is NaN
+        bhi     .dmul_ivo
+        orrs    ul, al, ah, LSL #1      @ is a zero?
+        orrnes  ul, bl, bh, LSL #1      @ or is b zero?
+        beq     .dmul_ivo
+        eor     ah, ah, bh
+        mov     al, #0
+        and     ah, ah, #0x80000000
+        orr     ah, ah, tmp, LSL #4
+	b	.dmul_exit
+
+.dmul_ivo:
+	ldmia	arm_sp!, {r4, r5}
+	b	.return_double_NaN
+
+#undef al
+#undef ah
+#undef bl
+#undef bh
+#undef tmp
+#undef sh
+#undef ex_add
+
+#undef	INX_pos
+#undef INX_bit
+
+#undef exp
+#undef temp
+
+#undef ex_m
+#undef uh
+#undef ul
+#undef rs
+#undef th
+#undef tl
+
+@ --- ignore_safepoints ---------------------------------------------------------------------------
+	.global	_ZN14CppInterpreter17ignore_safepointsEv
+	.type	_ZN14CppInterpreter17ignore_safepointsEv, %function
+_ZN14CppInterpreter17ignore_safepointsEv:
+#ifdef NOTICE_SAFEPOINTS
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r2, r3}
+	add	r2, r2, ip
+	add	ip, r3, r2
+	ldr	r2, [ip, #AbstractInterpreter_notice_safepoints-XXX]
+	ldrb	r1, [r2, #0]	@ zero_extendqisi2
+	cmp	r1, #0
+	bxeq	lr
+	mov	r3, #0
+	strb	r3, [r2, #0]
+	adrl	r3, main_dispatch_table
+#ifdef HW_FP
+	ldr	r0, [ip, #CPUInfo-XXX]
+	tst	r0, #ARCH_VFP
+	beq	2f
+#endif
+	mov	r2, #256
+1:
+	ldr	r1, [r3], #4
+	str	r1, [ip], #4
+	subs	r2, r2, #1
+	bne	1b
+	sub	ip, ip, #4 * 256
+	b	4f
+
+@ No HW FP - must update the table from a combination main_dispatch_table and
+@ vfp_table. Previously this updated from main_dispatch_table first, and then
+@ overwrite the updated entries with those from vfp_table. However, this creates
+@ a window where the jump table has vfp entries, so in a multithreaded world we
+@ can get undefined VFP instructions.
+@ The code below updates from both tables simultaneously. Note: this relies on
+@ the enties in vfp_table being in opcode order.
+#ifdef HW_FP
+2:
+	stmdb	arm_sp!, {r4, lr}
+	mov	r2, #0
+	adrl	r0, vfp_table
+	ldr	r4, [r0], #4
+3:
+	ldr	r1, [r3], #4
+	cmp	r2, r4
+	ldreq	r1, [r0], #4
+	ldreq	r4, [r0], #4
+	str	r1, [ip], #4
+	add	r2, r2, #1
+	cmp	r2, #256
+	bcc	3b
+	sub	ip, ip, #4 * 256
+	ldmia	arm_sp!, {r4, lr}
+#endif // HW_FP
+
+4:
+	ldr	r0, [ip, #CPUInfo-XXX]
+	tst	r0, #ARCH_CLZ
+	beq	5f
+
+	adrl	r0, do_idiv_clz
+	str	r0, [ip, #opc_idiv * 4]
+	adrl	r0, do_irem_clz
+	str	r0, [ip, #opc_irem * 4]
+
+5:
+#endif // NOTICE_SAFEPOINTS
+
+	bx	lr
+
+@ --- notice_safepoints ---------------------------------------------------------------------------
+	.global	_ZN14CppInterpreter17notice_safepointsEv
+	.type	_ZN14CppInterpreter17notice_safepointsEv, %function
+_ZN14CppInterpreter17notice_safepointsEv:
+#ifdef NOTICE_SAFEPOINTS
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r2, r3}
+	add	r2, r2, ip
+	add	ip, r3, r2
+	ldr	r2, [ip, #AbstractInterpreter_notice_safepoints-XXX]
+	ldrb	r1, [r2, #0]	@ zero_extendqisi2
+	cmp	r1, #0
+	bxne	lr
+	mov	r3, #1
+	strb	r3, [r2, #0]
+	adrl	r3, safe_dispatch_table
+	mov	r2, #256
+1:
+	ldr	r1, [r3], #4
+	str	r1, [ip], #4
+	subs	r2, r2, #1
+	bne	1b
+#endif
+	bx	lr
+
+@ --- END execute.s ----------------------------------------------------------------------------
+
+	ALIGN_CODE
+bci_init:
+        stmfd   sp!, {r4, lr}
+
+	adrl	r3, dispatch_init_adcon
+	ldm	r3, {r0, r1}
+	add	r0, r0, r3
+        add     r4, r1, r0
+	adrl	r2, adcon_init_table
+        mov     r1, r4
+1:
+	ldr	ip, [r2], #4
+	cmp	ip, #0
+	ldrne	ip, [r0, ip]
+	strne	ip, [r1, #-4]!
+	bne	1b
+	adrl	r2, main_dispatch_table
+	mov	r1, #256
+        mov     r3, r4
+2:
+	ldr	ip, [r2], #4
+	str	ip, [r3], #4
+	subs	r1, r1, #1
+	bne	2b
+
+	bl	hwcap
+	str	r0, [r4, #CPUInfo-XXX]
+
+#ifdef USE_COMPILER
+
+#define NPROCESSORS_CONF        83
+
+        mov     r0, #NPROCESSORS_CONF
+        bl      sysconf
+        cmp     r0, #2
+
+#ifdef DISABLE_BG_COMP_ON_NON_MP
+        movcc   r0, #0
+        ldrcc   r1, [r4, #BackgroundCompilation_Address-XXX]
+        strccb  r0, [r1]
+#endif
+
+        movcs   r0, #MP_COMPILE_THRESHOLD
+        movcc   r0, #UP_COMPILE_THRESHOLD
+        ldr     r1, [r4, #CompileThreshold_Address-XXX]
+        str     r0, [r1]
+
+#endif // USE_COMPILER
+
+#ifdef THUMB2EE
+	bl	Thumb2_Initialize
+#endif
+
+#ifdef HW_FP
+	ldr	r0, [r4, #CPUInfo-XXX]
+	tst	r0, #ARCH_VFP
+	bne	4f
+
+@ No HW FP - replace the HW FP entries with SW entries
+update_vfp_table:
+	adr	r0, vfp_table
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r2, r3}
+	add	r2, r2, ip
+	add	ip, r3, r2
+.update_vfp_loop:
+	ldr	r1, [r0], #4
+	cmp	r1, #0
+	ldrne	r2, [r0], #4
+	strne	r2, [ip, r1, lsl #2]
+	bne	.update_vfp_loop
+4:
+#endif // HW_FP
+
+	ldr	r0, [r4, #CPUInfo-XXX]
+	tst	r0, #ARCH_CLZ
+	beq	5f
+
+	adrl	r0, do_idiv_clz
+	str	r0, [r4, #opc_idiv * 4]
+	adrl	r0, do_irem_clz
+	str	r0, [r4, #opc_irem * 4]
+
+5:
+	ldmia	sp!, {r4, pc}
+
+#ifdef HW_FP
+vfp_table:
+	.word	opc_fadd,	do_fadd
+	.word	opc_dadd,	do_dadd
+	.word	opc_fsub,	do_fsub
+	.word	opc_dsub,	do_dsub
+	.word	opc_fmul,	do_fmul
+	.word	opc_dmul,	do_dmul
+	.word	opc_fdiv,	do_fdiv
+	.word	opc_ddiv,	do_ddiv
+	.word	opc_fcmpl,	do_fcmpl
+	.word	opc_fcmpg,	do_fcmpg
+	.word	opc_dcmpl,	do_dcmpl
+	.word	opc_dcmpg,	do_dcmpg
+	.word	0
+#endif // HW_FP
+
+load_dispatch:
+	adrl	ip, dispatch_init_adcon
+	ldm	ip, {r0, r1}
+	add	r0, r0, ip
+	add	dispatch, r1, r0
+	mov	pc, lr
+
+	ALIGN_DATA
+dispatch_init_adcon:
+	.word	_GLOBAL_OFFSET_TABLE_-dispatch_init_adcon, opclabels_data(GOTOFF)
+adcon_init_table:
+	.word	_ZN18InterpreterRuntime22slow_signature_handlerEP10JavaThreadP13methodOopDescPiS4_(GOT)
+	.word	_ZN20SafepointSynchronize6_stateE(GOT)
+	.word	_ZN9vmSymbols8_symbolsE(GOT)
+	.word	always_do_update_barrier(GOT)
+	.word	_ZN8Universe14_collectedHeapE(GOT)
+	.word	_ZN9Bytecodes5_nameE(GOT)
+	.word	_ZN19AbstractInterpreter18_notice_safepointsE(GOT)
+	.word	_ZN18ThreadLocalStorage13_thread_indexE(GOT)
+	.word	_ZN7oopDesc3_bsE(GOT)
+	.word	PrintCommandLineFlags(GOT)
+	.word	_ZN11JvmtiExport28_can_post_interpreter_eventsE(GOT)
+	.word	UseCompiler(GOT)
+invocationlimit_adcon:
+	.word	_ZN17InvocationCounter26InterpreterInvocationLimitE(GOT)
+        .word   CompileThreshold(GOT)
+        .word   BackgroundCompilation(GOT)
+        .word   UseOnStackReplacement(GOT)
+	.word	0
+
+	ALIGN_DATA
+main_dispatch_table:
+	MAIN_DISPATCH_TABLE
+
+#ifdef NOTICE_SAFEPOINTS
+safe_dispatch_table:
+	.word	do_nop
+	.word	do_u4const_0
+	.word	do_iconst_N
+	.word	do_iconst_N
+	.word	do_iconst_N
+	.word	do_iconst_N
+	.word	do_iconst_N
+	.word	do_iconst_N
+	.word	do_iconst_N
+	.word	do_u8const_0
+	.word	do_lconst_1
+	.word	do_u4const_0
+	.word	do_fconst_1
+	.word	do_fconst_2
+	.word	do_u8const_0
+	.word	do_dconst_1
+	.word	do_bipush
+	.word	do_sipush
+	.word	do_ldc
+	.word	do_ldc_w
+	.word	do_ldc2_w
+	.word	do_u4load
+	.word	do_u8load
+	.word	do_u4load
+	.word	do_u8load
+	.word	do_u4load
+	.word	do_iload_0
+	.word	do_iload_0
+	.word	do_iload_0
+	.word	do_iload_0
+	.word	do_u8load_0
+	.word	do_u8load_1
+	.word	do_u8load_2
+	.word	do_u8load_3
+	.word	do_fload_0
+	.word	do_fload_0
+	.word	do_fload_0
+	.word	do_fload_0
+	.word	do_u8load_0
+	.word	do_u8load_1
+	.word	do_u8load_2
+	.word	do_u8load_3
+	.word	do_aload_0
+	.word	do_aload_0
+	.word	do_aload_0
+	.word	do_aload_0
+	.word	do_u4aload
+	.word	do_u8aload
+	.word	do_u4aload
+	.word	do_u8aload
+	.word	do_u4aload
+	.word	do_baload
+	.word	do_caload
+	.word	do_saload
+	.word	do_u4store
+	.word	do_u8store
+	.word	do_u4store
+	.word	do_u8store
+	.word	do_u4store
+	.word	do_u4store_0
+	.word	do_u4store_1
+	.word	do_u4store_2
+	.word	do_u4store_3
+	.word	do_u8store_0
+	.word	do_u8store_1
+	.word	do_u8store_2
+	.word	do_u8store_3
+	.word	do_u4store_0
+	.word	do_u4store_1
+	.word	do_u4store_2
+	.word	do_u4store_3
+	.word	do_u8store_0
+	.word	do_u8store_1
+	.word	do_u8store_2
+	.word	do_u8store_3
+	.word	do_u4store_0
+	.word	do_u4store_1
+	.word	do_u4store_2
+	.word	do_u4store_3
+	.word	do_u4astore
+	.word	do_u8astore
+	.word	do_u4astore
+	.word	do_u8astore
+	.word	do_aastore
+	.word	do_bastore
+	.word	do_u2astore
+	.word	do_u2astore
+	.word	do_jpop
+	.word	do_jpop2
+	.word	do_dup
+	.word	do_dup_x1
+	.word	do_dup_x2
+	.word	do_dup2
+	.word	do_dup2_x1
+	.word	do_dup2_x2
+	.word	do_swap
+	.word	do_iadd
+	.word	do_ladd
+	.word	do_fadd
+	.word	do_dadd
+	.word	do_isub
+	.word	do_lsub
+	.word	do_fsub
+	.word	do_dsub
+	.word	do_imul
+	.word	do_lmul
+	.word	do_fmul
+	.word	do_dmul
+	.word	do_idiv
+	.word	do_ldiv
+	.word	do_fdiv
+	.word	do_ddiv
+	.word	do_irem
+	.word	do_lrem
+	.word	do_frem
+	.word	do_drem
+	.word	do_ineg
+	.word	do_lneg
+	.word	do_fneg
+	.word	do_dneg
+	.word	do_ishl
+	.word	do_lshl
+	.word	do_ishr
+	.word	do_lshr
+	.word	do_iushr
+	.word	do_lushr
+	.word	do_iand
+	.word	do_land
+	.word	do_ior
+	.word	do_lor
+	.word	do_ixor
+	.word	do_lxor
+	.word	do_iinc
+	.word	do_i2l
+	.word	do_i2f
+	.word	do_i2d
+	.word	do_l2i
+	.word	do_l2f
+	.word	do_l2d
+	.word	do_f2i
+	.word	do_f2l
+	.word	do_f2d
+	.word	do_d2i
+	.word	do_d2l
+	.word	do_d2f
+	.word	do_i2b
+	.word	do_i2c
+	.word	do_i2s
+	.word	do_lcmp
+	.word	do_fcmpl
+	.word	do_fcmpg
+	.word	do_dcmpl
+	.word	do_dcmpg
+	.word	do_ifeq
+	.word	do_ifne
+	.word	do_iflt
+	.word	do_ifge
+	.word	do_ifgt
+	.word	do_ifle
+	.word	do_if_icmpeq
+	.word	do_if_icmpne
+	.word	do_if_icmplt
+	.word	do_if_icmpge
+	.word	do_if_icmpgt
+	.word	do_if_icmple
+	.word	do_if_icmpeq
+	.word	do_if_icmpne
+	.word	do_goto
+	.word	do_jsr
+	.word	do_ret
+	.word	do_tableswitch
+	.word	do_lookupswitch
+	.word	do_ireturn
+	.word	do_lreturn
+	.word	do_ireturn
+	.word	do_lreturn
+	.word	do_ireturn
+	.word	do_return
+	.word	do_getstatic
+	.word	do_putstatic
+	.word	do_getfield
+	.word	do_putfield
+	.word	do_invokevirtual
+	.word	do_invokespecial
+	.word	do_invokestatic
+	.word	do_invokeinterface
+	.word	do_undefined
+	.word	do_new
+	.word	do_newarray
+	.word	do_anewarray
+	.word	do_arraylength
+	.word	do_athrow
+	.word	do_checkcast
+	.word	do_instanceof
+	.word	do_monitorenter
+	.word	do_monitorexit
+	.word	do_wide
+	.word	do_multianewarray
+	.word	do_ifeq
+	.word	do_ifne
+	.word	do_goto_w
+	.word	do_jsr_w
+	.word	do_breakpoint
+	.word	do_undefined
+	.word	do_bgetfield
+	.word	do_cgetfield
+	.word	do_undefined
+	.word	do_undefined
+	.word	do_igetfield
+	.word	do_lgetfield
+	.word	do_sgetfield
+	.word	do_aputfield
+	.word	do_bputfield
+	.word	do_cputfield
+	.word	do_undefined
+	.word	do_undefined
+	.word	do_iputfield
+	.word	do_lputfield
+	.word	do_undefined
+	.word	do_iaccess_0
+	.word	do_iaccess_0
+	.word	do_iaccess_0
+	.word	do_iaccess_0
+	.word	do_invokeresolved
+	.word	do_invokespecialresolved
+	.word	do_invokestaticresolved
+	.word	do_invokevfinal
+	.word	do_fast_iload_iload
+	.word	do_fast_iload_iload_N
+	.word	do_return_register_finalizer
+	.word	do_undefined
+	.word	do_iload_0_iconst_N
+	.word	do_iload_0_iconst_N
+	.word	do_iload_0_iconst_N
+	.word	do_iload_0_iconst_N
+	.word	do_iload_iconst_N
+	.word	do_iadd_istore_N
+	.word	do_isub_istore_N
+	.word	do_iand_istore_N
+	.word	do_ior_istore_N
+	.word	do_ixor_istore_N
+	.word	do_iadd_u4store
+	.word	do_isub_u4store
+	.word	do_iand_u4store
+	.word	do_ior_u4store
+	.word	do_ixor_u4store
+	.word	do_fast_iload_N_iload
+	.word	do_fast_iload_N_iload
+	.word	do_fast_iload_N_iload
+	.word	do_fast_iload_N_iload
+	.word	do_fast_iload_N_iload_N
+	.word	do_fast_iload_N_iload_N
+	.word	do_fast_iload_N_iload_N
+	.word	do_fast_iload_N_iload_N
+	.word	do_undefined
+	.word	do_undefined
+#endif
+
+	SUB_DISPATCH_TABLES
+
+	.arch	armv7-a
+
+	ALIGN_CODE
+	.global	Thumb2_stubs
+Thumb2_stubs:
+	.global	Thumb2_idiv_stub
+Thumb2_idiv_stub:
+int_div:
+	cmp     r1, #0x21
+	adr	r3, 1f
+	eor     r12, r0, r1
+	ldrcc	pc, [r3, r1, lsl #2]
+	rsblt   r1, r1, #0
+	subs    r2, r1, #1
+	beq     2f
+	movs    r3, r0
+	rsbmi   r3, r0, #0
+	cmp     r3, r1
+	bls     3f
+	tst     r1, r2
+	beq     4f
+	clz     r2, r3
+	clz     r0, r1
+	sub     r2, r0, r2
+	rsbs    r2, r2, #31
+	add     r2, r2, r2, lsl #1
+	mov     r0, #0
+	add     pc, pc, r2, lsl #2
+	mov	r0, #0
+	cmp     r3, r1, lsl #31
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #31
+	cmp     r3, r1, lsl #30
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #30
+	cmp     r3, r1, lsl #29
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #29
+	cmp     r3, r1, lsl #28
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #28
+	cmp     r3, r1, lsl #27
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #27
+	cmp     r3, r1, lsl #26
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #26
+	cmp     r3, r1, lsl #25
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #25
+	cmp     r3, r1, lsl #24
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #24
+	cmp     r3, r1, lsl #23
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #23
+	cmp     r3, r1, lsl #22
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #22
+	cmp     r3, r1, lsl #21
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #21
+	cmp     r3, r1, lsl #20
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #20
+	cmp     r3, r1, lsl #19
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #19
+	cmp     r3, r1, lsl #18
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #18
+	cmp     r3, r1, lsl #17
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #17
+	cmp     r3, r1, lsl #16
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #16
+	cmp     r3, r1, lsl #15
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #15
+	cmp     r3, r1, lsl #14
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #14
+	cmp     r3, r1, lsl #13
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #13
+	cmp     r3, r1, lsl #12
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #12
+	cmp     r3, r1, lsl #11
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #11
+	cmp     r3, r1, lsl #10
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #10
+	cmp     r3, r1, lsl #9
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #9
+	cmp     r3, r1, lsl #8
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #8
+	cmp     r3, r1, lsl #7
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #7
+	cmp     r3, r1, lsl #6
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #6
+	cmp     r3, r1, lsl #5
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #5
+	cmp     r3, r1, lsl #4
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #4
+	cmp     r3, r1, lsl #3
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #3
+	cmp     r3, r1, lsl #2
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #2
+	cmp     r3, r1, lsl #1
+	adc     r0, r0, r0
+	subcs   r3, r3, r1, lsl #1
+	cmp     r3, r1
+	adc     r0, r0, r0
+	subcs   r3, r3, r1
+	cmp     r12, #0
+	rsbmi   r0, r0, #0
+	bx      lr
+2:
+	teq     r12, r0
+	rsbmi   r0, r0, #0
+	bx      lr
+3:
+	movcc   r0, #0
+	asreq   r0, r12, #31
+	orreq   r0, r0, #1
+	bx      lr
+4:
+	clz     r2, r1
+	rsb     r2, r2, #31
+	cmp     r12, #0
+	lsr     r0, r3, r2
+	rsbmi   r0, r0, #0
+	bx      lr
+1:
+	.word	Thumb2_DivZero_Handler
+	.word	jdiv_1
+	.word	jdiv_2
+	.word	jdiv_3
+	.word	jdiv_4
+	.word	jdiv_5
+	.word	jdiv_6
+	.word	jdiv_7
+	.word	jdiv_8
+	.word	jdiv_9
+	.word	jdiv_10
+	.word	jdiv_11
+	.word	jdiv_12
+	.word	jdiv_13
+	.word	jdiv_14
+	.word	jdiv_15
+	.word	jdiv_16
+	.word	jdiv_17
+	.word	jdiv_18
+	.word	jdiv_19
+	.word	jdiv_20
+	.word	jdiv_21
+	.word	jdiv_22
+	.word	jdiv_23
+	.word	jdiv_24
+	.word	jdiv_25
+	.word	jdiv_26
+	.word	jdiv_27
+	.word	jdiv_28
+	.word	jdiv_29
+	.word	jdiv_30
+	.word	jdiv_31
+	.word	jdiv_32
+	ALIGN_CODE
+	.global	Thumb2_irem_stub
+Thumb2_irem_stub:
+int_rem:
+	cmp     r1, #0x21
+	adr	r3, 1f
+	ldrcc	pc, [r3, r1, lsl #2]
+	rsblt   r1, r1, #0
+	subs    r2, r1, #1
+	beq     2f
+	movs    r12, r0
+	rsbmi   r0, r0, #0
+	cmp     r0, r1
+	bls     3f
+	tst     r1, r2
+	beq     4f
+	clz     r2, r0
+	clz     r3, r1
+	sub     r2, r3, r2
+	rsbs    r2, r2, #31
+	add     pc, pc, r2, lsl #3
+	mov	r3, #0
+	cmp     r0, r1, lsl #31
+	subcs   r0, r0, r1, lsl #31
+	cmp     r0, r1, lsl #30
+	subcs   r0, r0, r1, lsl #30
+	cmp     r0, r1, lsl #29
+	subcs   r0, r0, r1, lsl #29
+	cmp     r0, r1, lsl #28
+	subcs   r0, r0, r1, lsl #28
+	cmp     r0, r1, lsl #27
+	subcs   r0, r0, r1, lsl #27
+	cmp     r0, r1, lsl #26
+	subcs   r0, r0, r1, lsl #26
+	cmp     r0, r1, lsl #25
+	subcs   r0, r0, r1, lsl #25
+	cmp     r0, r1, lsl #24
+	subcs   r0, r0, r1, lsl #24
+	cmp     r0, r1, lsl #23
+	subcs   r0, r0, r1, lsl #23
+	cmp     r0, r1, lsl #22
+	subcs   r0, r0, r1, lsl #22
+	cmp     r0, r1, lsl #21
+	subcs   r0, r0, r1, lsl #21
+	cmp     r0, r1, lsl #20
+	subcs   r0, r0, r1, lsl #20
+	cmp     r0, r1, lsl #19
+	subcs   r0, r0, r1, lsl #19
+	cmp     r0, r1, lsl #18
+	subcs   r0, r0, r1, lsl #18
+	cmp     r0, r1, lsl #17
+	subcs   r0, r0, r1, lsl #17
+	cmp     r0, r1, lsl #16
+	subcs   r0, r0, r1, lsl #16
+	cmp     r0, r1, lsl #15
+	subcs   r0, r0, r1, lsl #15
+	cmp     r0, r1, lsl #14
+	subcs   r0, r0, r1, lsl #14
+	cmp     r0, r1, lsl #13
+	subcs   r0, r0, r1, lsl #13
+	cmp     r0, r1, lsl #12
+	subcs   r0, r0, r1, lsl #12
+	cmp     r0, r1, lsl #11
+	subcs   r0, r0, r1, lsl #11
+	cmp     r0, r1, lsl #10
+	subcs   r0, r0, r1, lsl #10
+	cmp     r0, r1, lsl #9
+	subcs   r0, r0, r1, lsl #9
+	cmp     r0, r1, lsl #8
+	subcs   r0, r0, r1, lsl #8
+	cmp     r0, r1, lsl #7
+	subcs   r0, r0, r1, lsl #7
+	cmp     r0, r1, lsl #6
+	subcs   r0, r0, r1, lsl #6
+	cmp     r0, r1, lsl #5
+	subcs   r0, r0, r1, lsl #5
+	cmp     r0, r1, lsl #4
+	subcs   r0, r0, r1, lsl #4
+	cmp     r0, r1, lsl #3
+	subcs   r0, r0, r1, lsl #3
+	cmp     r0, r1, lsl #2
+	subcs   r0, r0, r1, lsl #2
+	cmp     r0, r1, lsl #1
+	subcs   r0, r0, r1, lsl #1
+	cmp     r0, r1
+	subcs   r0, r0, r1
+	cmp     r12, #0
+	rsbmi   r0, r0, #0
+	bx      lr
+2:
+	mov	r0, #0
+	bx      lr
+3:
+	moveq	r0, #0
+	cmp	r12, #0
+	rsbmi	r0, r0, #0
+	bx	lr
+4:
+	and	r0, r0, r2
+	cmp	r12, #0
+	rsbmi	r0, r0, #0
+	bx      lr
+1:
+	.word	Thumb2_DivZero_Handler
+	.word	jrem_1
+	.word	jrem_2
+	.word	jrem_3
+	.word	jrem_4
+	.word	jrem_5
+	.word	jrem_6
+	.word	jrem_7
+	.word	jrem_8
+	.word	jrem_9
+	.word	jrem_10
+	.word	jrem_11
+	.word	jrem_12
+	.word	jrem_13
+	.word	jrem_14
+	.word	jrem_15
+	.word	jrem_16
+	.word	jrem_17
+	.word	jrem_18
+	.word	jrem_19
+	.word	jrem_20
+	.word	jrem_21
+	.word	jrem_22
+	.word	jrem_23
+	.word	jrem_24
+	.word	jrem_25
+	.word	jrem_26
+	.word	jrem_27
+	.word	jrem_28
+	.word	jrem_29
+	.word	jrem_30
+	.word	jrem_31
+	.word	jrem_32
+
+#ifdef THUMB2EE
+@ R0 = BCI
+@ R1 = index
+#define Rthread	r9
+	.global	Thumb2_invokeinterface_stub
+Thumb2_invokeinterface_stub:
+	stmdb	sp!, {ip, lr}
+	ldr	ip, [istate, #ISTATE_METHOD]
+	sub	stack, stack, #4
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	ldr	ip, [ip, #METHOD_CONSTMETHOD]
+	DECACHE_STACK
+	add	jpc, ip, r0
+
+        add     r0, r2, r1, lsl #4
+	DECACHE_JPC
+
+        ldr     r2, [r0, #CP_OFFSET]
+        and     r2, r2, #0x00ff0000
+        cmp     r2, #opc_invokeinterface << 16
+        bne     istub_resolve
+2:
+	ldr	r3, [r0, #CP_OFFSET+12]
+	and	r2, r3, #255
+	ldr	r2, [stack, r2, lsl #2]
+	cmp	r2, #0
+	beq	istub_null_ptr_exception
+	ldr	tmp2, [r2, #4]				@ rcvr->klass()
+	tst	r3, #flag_methodInterface
+	bne	istub_methodInterface
+
+	ldr	lr, [r0, #CP_OFFSET+4]			@ lr = iclass
+
+	add	r1, tmp2, #INSTANCEKLASS_VTABLE_OFFSET
+	ldr	r2, [tmp2, #KLASS_PART+INSTANCEKLASS_VTABLE_LEN]
+	ldr	ip, [tmp2, #KLASS_PART+INSTANCEKLASS_ITABLE_LEN]
+	add	r2, r2, #1
+	bic	r2, r2, #1
+
+	add	r1, r1, r2, lsl #2
+
+	mov	r2, #0
+1:
+	cmp	r2, ip
+	beq	istub_incompatibleclass_exception
+	ldr	r3, [r1], #8
+	add	r2, r2, #1
+	cmp	lr, r3
+	bne	1b
+
+	ldr	r3, [r0, #CP_OFFSET+8]
+	ldr	r2, [r1, #-4]
+	add	r3, tmp2, r3, lsl #2
+	ldr	tmp2, [r3, r2]
+	cmp	tmp2, #0
+	beq	istub_abstractmethod_exception
+istub_invoke:
+	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
+	mov	r1, #0
+	str	ip, [istate, #36]
+	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
+
+	add	stack, stack, #4
+	str	stack, [Rthread, #THREAD_JAVA_SP]
+
+	ldr	r3, [ip]
+
+	mov	r0, tmp2
+	mov	r1, ip
+#ifndef SHARK
+	add	r3, r3, #CODE_ALIGN_SIZE
+#endif
+	mov	r2, Rthread
+	blx	r3
+
+	ldr	Rthread, [istate, #ISTATE_THREAD]
+
+	ldr	stack, [Rthread, #THREAD_JAVA_SP]
+	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
+
+	ldr	r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
+	add	r2, r2, #4
+	str	r2, [Rthread, #THREAD_JAVA_SP]
+	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
+	ldr	r3, [Rthread, #4]
+	cmp	r3, #0
+	bne	istub_exception
+	ldmia	sp!, {ip, pc}
+
+istub_methodInterface:
+	tst	r3, #flag_vfinalMethod
+	ldrne	tmp2, [r0, #CP_OFFSET+8]
+	bne	istub_invoke
+	ldr	r1, [r0, #CP_OFFSET+8]
+	add	r3, tmp2, r1, lsl #2
+	ldr	tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
+	b	istub_invoke
+
+istub_resolve:
+	mov	tmp2, r1
+	mov	r1, #opc_invokeinterface
+	ldr	r0, [istate, #ISTATE_THREAD]
+	ldr	ip, resolve_invoke_adcon
+	blx	ip
+	ldr	r3, [Rthread, #4]
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	cmp	r3, #0
+	bne	istub_exception
+	add	r0, r2, tmp2, lsl #4	@ r1 = cache
+	b	2b
+
+istub_exception:
+	ldmia	sp!, {ip, lr}
+	ldr	ip, handle_exception_adcon
+	bx	ip
+
+istub_null_ptr_exception:
+	mov	r0, #VMSYMBOLS_NullPointerException
+	b	3f
+istub_abstractmethod_exception:
+	mov	r0, #VMSYMBOLS_AbstractMethodError
+	b	3f
+istub_incompatibleclass_exception:
+	mov	r0, #VMSYMBOLS_IncompatibleClassChangeError
+3:
+	CACHE_JPC
+	ldmia	sp!, {ip, lr}
+	ldr	ip, raise_exception_adcon
+	bx	ip
+
+resolve_invoke_adcon:
+	.word	_ZN18InterpreterRuntime14resolve_invokeEP10JavaThreadN9Bytecodes4CodeE
+resolve_get_put_adcon:
+       	.word   _ZN18InterpreterRuntime15resolve_get_putEP10JavaThreadN9Bytecodes4CodeE
+handle_exception_adcon:
+	.word	handle_exception_with_bcp
+raise_exception_adcon:
+	.word	raise_exception
+helper_aputfield_adcon:
+	.word	Helper_aputfield
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_invokevirtual_stub
+Thumb2_invokevirtual_stub:
+	stmdb	sp!, {ip, lr}
+        ldr     ip, [istate, #ISTATE_METHOD]
+        sub     stack, stack, #4
+        ldr     r2, [istate, #ISTATE_CONSTANTS]
+        ldr     ip, [ip, #METHOD_CONSTMETHOD]
+        DECACHE_STACK
+        add     jpc, ip, r0
+
+        add     r0, r2, r1, lsl #4
+        DECACHE_JPC
+
+        ldr     r2, [r0, #CP_OFFSET]
+        and     r2, r2, #0xff000000
+        cmp     r2, #opc_invokevirtual << 24
+        bne     ivstub_resolve
+2:
+
+	ldr	r3, [r0, #CP_OFFSET+12]
+        and     r2, r3, #255
+        ldr     r2, [stack, r2, asl #2]
+        cmp     r2, #0
+        beq     istub_null_ptr_exception
+
+        ldr     tmp2, [r0, #CP_OFFSET+8]
+        tst     r3, #flag_vfinalMethod
+        bne     1f
+
+        ldr     r3, [r2, #4]
+        add     r3, r3, tmp2, lsl #2
+        ldr     tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
+1:
+	mov	r1, #0
+        ldr     ip, [tmp2, #METHOD_FROM_INTERPRETED]
+        str     r1, [Rthread, #THREAD_LAST_JAVA_SP]
+        str     ip, [istate, #36]
+
+        add     stack, stack, #4
+        str     stack, [Rthread, #THREAD_JAVA_SP]
+
+        ldr     r3, [ip, #0]
+
+	mov	r0, tmp2
+	mov	r1, ip
+#ifndef SHARK
+	add	r3, r3, #CODE_ALIGN_SIZE
+#endif
+	mov	r2, Rthread
+	blx	r3
+
+        ldr     Rthread, [istate, #ISTATE_THREAD]
+
+	ldr	stack, [Rthread, #THREAD_JAVA_SP]
+	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
+
+	ldr	r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
+	add	r2, r2, #4
+	str	r2, [Rthread, #THREAD_JAVA_SP]
+	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
+	ldr	r3, [Rthread, #4]
+	cmp	r3, #0
+	bne	istub_exception
+	ldmia	sp!, {ip, pc}
+
+ivstub_resolve:
+	mov	tmp2, r1
+	mov	r1, #opc_invokevirtual
+	ldr	r0, [istate, #ISTATE_THREAD]
+	ldr	ip, resolve_invoke_adcon
+	blx	ip
+	ldr	r3, [Rthread, #4]
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	cmp	r3, #0
+	bne	istub_exception
+	add	r0, r2, tmp2, lsl #4	@ r1 = cache
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_invokestatic_stub
+Thumb2_invokestatic_stub:
+        stmdb   sp!, {ip, lr}
+        ldr     ip, [istate, #ISTATE_METHOD]
+        sub     stack, stack, #4
+        ldr     r2, [istate, #ISTATE_CONSTANTS]
+        ldr     ip, [ip, #METHOD_CONSTMETHOD]
+        DECACHE_STACK
+        add     jpc, ip, r0
+
+        add     r0, r2, r1, lsl #4
+        DECACHE_JPC
+
+        ldr     r2, [r0, #CP_OFFSET]
+	and	r2, r2, #0x00ff0000
+	cmp	r2, #opc_invokestatic << 16
+	bne	isstub_resolve
+2:
+	ldr	tmp2, [r0, #CP_OFFSET+4]
+	mov	r1, #0
+	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
+	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
+	str	ip, [istate, #36]
+
+	add	stack, stack, #4
+	str	stack, [Rthread, #THREAD_JAVA_SP]
+
+	ldr	r3, [ip, #0]
+
+        mov     r0, tmp2
+        mov     r1, ip
+#ifndef SHARK
+        add     r3, r3, #CODE_ALIGN_SIZE
+#endif
+        mov     r2, Rthread
+        blx     r3
+
+        ldr     Rthread, [istate, #ISTATE_THREAD]
+
+        ldr     stack, [Rthread, #THREAD_JAVA_SP]
+        ldr     r2, [istate, #ISTATE_STACK_LIMIT]
+
+        ldr     r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
+        add     r2, r2, #4
+        str     r2, [Rthread, #THREAD_JAVA_SP]
+        str     r1, [Rthread, #THREAD_LAST_JAVA_SP]
+        ldr     r3, [Rthread, #4]
+        cmp     r3, #0
+        bne     istub_exception
+        ldmia   sp!, {ip, pc}
+
+isstub_resolve:
+        mov     tmp2, r1
+        mov     r1, #opc_invokestatic
+        ldr     r0, [istate, #ISTATE_THREAD]
+        ldr     ip, resolve_invoke_adcon
+        blx     ip
+        ldr     r3, [Rthread, #4]
+        ldr     r2, [istate, #ISTATE_CONSTANTS]
+        cmp     r3, #0
+        bne     istub_exception
+        add     r0, r2, tmp2, lsl #4    @ r1 = cache
+        b       2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_invokespecial_stub
+Thumb2_invokespecial_stub:
+        stmdb   sp!, {ip, lr}
+        ldr     ip, [istate, #ISTATE_METHOD]
+        sub     stack, stack, #4
+        ldr     r2, [istate, #ISTATE_CONSTANTS]
+        ldr     ip, [ip, #METHOD_CONSTMETHOD]
+        DECACHE_STACK
+        add     jpc, ip, r0
+
+        add     r0, r2, r1, lsl #4
+        DECACHE_JPC
+
+        ldr     r2, [r0, #CP_OFFSET]
+	and	r2, r2, #0x00ff0000
+	cmp	r2, #opc_invokespecial << 16
+	bne	ispstub_resolve
+2:
+        ldr     r3, [r0, #CP_OFFSET+12]
+        and     r3, r3, #255
+        ldr     r2, [stack, r3, asl #2]
+	cmp	r2, #0
+	beq	istub_null_ptr_exception
+
+	ldr	tmp2, [r0, #CP_OFFSET+4]
+	mov	r1, #0
+	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
+	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
+	str	ip, [istate, #36]
+
+	add	stack, stack, #4
+	str	stack, [Rthread, #THREAD_JAVA_SP]
+
+	ldr	r3, [ip, #0]
+
+        mov     r0, tmp2
+        mov     r1, ip
+#ifndef SHARK
+        add     r3, r3, #CODE_ALIGN_SIZE
+#endif
+        mov     r2, Rthread
+        blx     r3
+
+        ldr     Rthread, [istate, #ISTATE_THREAD]
+
+        ldr     stack, [Rthread, #THREAD_JAVA_SP]
+        ldr     r2, [istate, #ISTATE_STACK_LIMIT]
+
+        ldr     r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
+        add     r2, r2, #4
+        str     r2, [Rthread, #THREAD_JAVA_SP]
+        str     r1, [Rthread, #THREAD_LAST_JAVA_SP]
+        ldr     r3, [Rthread, #4]
+        cmp     r3, #0
+        bne     istub_exception
+        ldmia   sp!, {ip, pc}
+
+ispstub_resolve:
+        mov     tmp2, r1
+        mov     r1, #opc_invokespecial
+        ldr     r0, [istate, #ISTATE_THREAD]
+        ldr     ip, resolve_invoke_adcon
+        blx     ip
+        ldr     r3, [Rthread, #4]
+        ldr     r2, [istate, #ISTATE_CONSTANTS]
+        cmp     r3, #0
+        bne     istub_exception
+        add     r0, r2, tmp2, lsl #4    @ r1 = cache
+        b       2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_getfield_word_stub
+Thumb2_getfield_word_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getfield << 16
+	bne	1f
+2:
+	ldr	r3, [stack], #4		@ POP r3
+	ldr	ip, [r2, #CP_OFFSET+8]
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	ldr	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_getfield_sh_stub
+Thumb2_getfield_sh_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getfield << 16
+	bne	1f
+2:
+	ldr	r3, [stack], #4		@ POP r3
+	ldr	ip, [r2, #CP_OFFSET+8]
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	ldrsh	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_getfield_h_stub
+Thumb2_getfield_h_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getfield << 16
+	bne	1f
+2:
+	ldr	r3, [stack], #4		@ POP r3
+	ldr	ip, [r2, #CP_OFFSET+8]
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	ldrh	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_getfield_sb_stub
+Thumb2_getfield_sb_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getfield << 16
+	bne	1f
+2:
+	ldr	r3, [stack], #4		@ POP r3
+	ldr	ip, [r2, #CP_OFFSET+8]
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	ldrsb	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_getfield_dw_stub
+Thumb2_getfield_dw_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getfield << 16
+	bne	1f
+2:
+	ldr	r3, [stack], #4		@ POP r3
+	ldr	ip, [r2, #CP_OFFSET+8]
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	ldrd	r2, r3, [r3, ip]
+	stmdb	stack!, {r2, r3}	@ PUSH r2, r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+putstatic_stub_unresolved:
+	mov	r2, #opc_putstatic
+	b	field_stub_unresolved
+getstatic_stub_unresolved:
+	mov	r2, #opc_getstatic
+	b	field_stub_unresolved
+putfield_stub_unresolved:
+	mov	r2, #opc_putfield
+	b	field_stub_unresolved
+getfield_stub_unresolved:
+	mov	r2, #opc_getfield
+field_stub_unresolved:
+	stmdb	sp!, {r0, r1, ip, lr}
+        ldr     ip, [istate, #ISTATE_METHOD]
+	sub	r3, stack, #4
+	ldr	ip, [ip, #METHOD_CONSTMETHOD]
+	str	r3, [istate, #ISTATE_STACK]	@ DECACHE_STACK
+	add	r3, ip, r0
+	str	r3, [istate, #ISTATE_BCP]	@ DECACHE_JPC
+	ldr	ip, resolve_get_put_adcon
+	mov	r1, r2
+	ldr	r0, [istate, #ISTATE_THREAD]
+	blx	ip
+	ldmia	sp!, {r0, r1, ip, lr}
+	ldr	r3, [Rthread, #4]
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	cmp	r3, #0
+	bne	field_exception
+	add	r2, r2, r1, lsl #4
+	bx	lr
+
+field_null_ptr_exception:
+        ldr     ip, [istate, #ISTATE_METHOD]
+        ldr     ip, [ip, #METHOD_CONSTMETHOD]
+        add     jpc, ip, r0
+	mov	r0, #VMSYMBOLS_NullPointerException
+	ldr	ip, raise_exception_adcon
+	bx	ip
+
+field_exception:
+	ldr	ip, handle_exception_adcon
+	bx	ip
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_putfield_word_stub
+Thumb2_putfield_word_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putfield << 24
+	bne	1f
+2:
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	str	r2, [r3, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_putfield_h_stub
+Thumb2_putfield_h_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putfield << 24
+	bne	1f
+2:
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	strh	r2, [r3, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_putfield_b_stub
+Thumb2_putfield_b_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putfield << 24
+	bne	1f
+2:
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	strb	r2, [r3, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_putfield_a_stub
+Thumb2_putfield_a_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putfield << 24
+	bne	1f
+2:
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
+	cmp	r3, #0
+	beq	field_null_ptr_exception
+
+	str	r2, [r3, ip]
+	ldr	ip, helper_aputfield_adcon
+	mov	r0, r3
+	bx	ip
+1:
+	mov	ip, lr
+	bl	putfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_putfield_dw_stub
+Thumb2_putfield_dw_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putfield << 24
+	bne	1f
+2:
+	ldr	r1, [r2, #CP_OFFSET+8]
+	ldmia	stack!, {r2, r3, ip}	@ r2,r3 = value, ip = obj
+	cmp	ip, #0
+	beq	field_null_ptr_exception
+
+	strd	r2,r3, [ip, r1]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putfield_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_getstatic_word_stub
+Thumb2_getstatic_word_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getstatic << 16
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+
+	ldr	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_getstatic_h_stub
+Thumb2_getstatic_h_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getstatic << 16
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+
+	ldrh	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_getstatic_sh_stub
+Thumb2_getstatic_sh_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getstatic << 16
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+
+	ldrsh	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_getstatic_sb_stub
+Thumb2_getstatic_sb_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getstatic << 16
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+
+	ldrsb	r3, [r3, ip]
+	str	r3, [stack, #-4]!	@ PUSH r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+	.global	Thumb2_getstatic_dw_stub
+Thumb2_getstatic_dw_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0x00ff0000
+	cmp	r3, #opc_getstatic << 16
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+
+	ldrd	r2, r3, [r3, ip]
+	stmdb	stack!, {r2, r3}	@ PUSH r2, r3
+	bx	lr
+1:
+	mov	ip, lr
+	bl	getstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_putstatic_word_stub
+Thumb2_putstatic_word_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putstatic << 24
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldr	r2, [stack], #4		@ POP r2
+
+	str	r2, [r3, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_putstatic_h_stub
+Thumb2_putstatic_h_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putstatic << 24
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldr	r2, [stack], #4		@ POP r2
+
+	strh	r2, [r3, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_putstatic_b_stub
+Thumb2_putstatic_b_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putstatic << 24
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldr	r2, [stack], #4		@ POP r2
+
+	strb	r2, [r3, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_putstatic_dw_stub
+Thumb2_putstatic_dw_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putstatic << 24
+	bne	1f
+2:
+	ldr	r1, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldmia	stack!, {r2, r3}
+
+	strd	r2,r3, [r1, ip]
+	bx	lr
+1:
+	mov	ip, lr
+	bl	putstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+@ R0 = BCI
+@ R1 = index
+	.global	Thumb2_putstatic_a_stub
+Thumb2_putstatic_a_stub:
+	ldr	r2, [istate, #ISTATE_CONSTANTS]
+	add	r2, r2, r1, lsl #4
+	ldr	r3, [r2, #CP_OFFSET]
+	and	r3, r3, #0xff000000
+	cmp	r3, #opc_putstatic << 24
+	bne	1f
+2:
+	ldr	r3, [r2, #CP_OFFSET+4]
+	ldr	ip, [r2, #CP_OFFSET+8]
+	ldr	r2, [stack], #4		@ POP r2
+
+	str	r2, [r3, ip]
+	ldr	ip, helper_aputfield_adcon
+	mov	r0, r3
+	bx	ip
+1:
+	mov	ip, lr
+	bl	putstatic_stub_unresolved
+	mov	lr, ip
+	b	2b
+
+#endif // THUMB2EE
+
+	.global	Thumb2_stubs_end
+Thumb2_stubs_end:
+
+	ALIGN_CODE
+jdiv_1:
+	bx	lr
+jdiv_2:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+	bx	lr
+jdiv_24:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_12:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_6:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_3:
+	ldr	r1, dc_3
+        smull	r3, r2, r0, r1
+        sub	r0, r2, r0, asr #31
+	bx	lr
+jdiv_4:
+	mov	r1, r0, asr #31
+	add	r0, r0, r1, lsr #30
+	mov	r0, r0, asr #2
+	bx	lr
+jdiv_20:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_10:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_5:
+	ldr	r1, dc_5
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #1
+	bx	lr
+jdiv_28:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_14:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_7:
+	ldr	r1, dc_7
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r0, r1, r3, asr #2
+	bx	lr
+jdiv_8:
+	mov	r1, r0, asr #31
+	add	r0, r0, r1, lsr #29
+	mov	r0, r0, asr #3
+	bx	lr
+jdiv_18:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_9:
+	ldr	r1, dc_9
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #1
+	bx	lr
+jdiv_22:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_11:
+	ldr	r1, dc_11
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #1
+	bx	lr
+jdiv_26:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_13:
+	ldr	r1, dc_13
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #2
+	bx	lr
+jdiv_30:
+        add     r0, r0, r0, lsr #31
+        mov     r0, r0, asr #1
+jdiv_15:
+	ldr	r1, dc_15
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r0, r1, r3, asr #3
+	bx	lr
+jdiv_16:
+	mov	r1, r0, asr #31
+	add	r0, r0, r1, lsr #28
+	mov	r0, r0, asr #4
+	bx	lr
+jdiv_17:
+	ldr	r1, dc_17
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #3
+	bx	lr
+jdiv_19:
+	ldr	r1, dc_19
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #3
+	bx	lr
+jdiv_21:
+	ldr	r1, dc_21
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #2
+	bx	lr
+jdiv_23:
+	ldr	r1, dc_23
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r0, r1, r3, asr #4
+	bx	lr
+jdiv_25:
+	ldr	r1, dc_25
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #3
+	bx	lr
+jdiv_27:
+	ldr	r1, dc_27
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r0, r3, r2, asr #3
+	bx	lr
+jdiv_29:
+	ldr	r1, dc_29
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r0, r1, r3, asr #4
+	bx	lr
+jdiv_31:
+	ldr	r1, dc_31
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r0, r1, r3, asr #4
+	bx	lr
+jdiv_32:
+	mov	r1, r0, asr #31
+	add	r0, r0, r1, lsr #27
+	mov	r0, r0, asr #5
+	bx	lr
+jrem_1:
+	mov	r0, #0
+	bx	lr
+jrem_2:
+	add	r3, r0, r0, lsr #31
+        mov	r1, r3, asr #1
+	sub	r0, r0, r1, lsl #1
+	bx	lr
+jrem_3:
+	ldr	r1, dc_3
+        smull	r3, r2, r0, r1
+        sub	r1, r2, r0, asr #31
+	add	r3, r1, r1, lsl #1
+	sub	r0, r0, r3
+	bx	lr
+jrem_4:
+	movs	r3, r0
+        addmi	r3, r3, #3
+        mov	r1, r3, asr #2
+	sub	r0, r0, r1, lsl #2
+	bx	lr
+jrem_5:
+	ldr	r1, dc_5
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #1
+	add	r3, r1, r1, lsl #2
+	sub	r0, r0, r3
+	bx	lr
+jrem_6:
+	ldr	r1, dc_6
+        smull	r3, r2, r0, r1
+        sub	r1, r2, r0, asr #31
+	add	r3, r1, r1, lsl #1
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_7:
+	ldr	r1, dc_7
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #2
+	rsb	r3, r1, r1, lsl #3
+	sub	r0, r0, r3
+	bx	lr
+jrem_8:
+	movs	r3, r0
+        addmi	r3, r3, #7
+        mov	r1, r3, asr #3
+	sub	r0, r0, r1, lsl #3
+	bx	lr
+jrem_9:
+	ldr	r1, dc_9
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #1
+	add	r3, r1, r1, lsl #3
+	sub	r0, r0, r3
+	bx	lr
+jrem_10:
+	ldr	r1, dc_10
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #2
+	add	r3, r1, r1, lsl #2
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_11:
+	ldr	r1, dc_11
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #1
+	add	r3, r1, r1, lsl #2
+	add	r3, r1, r3, lsl #1
+	sub	r0, r0, r3
+	bx	lr
+jrem_12:
+	ldr	r1, dc_12
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #1
+	add	r3, r1, r1, lsl #1
+	sub	r0, r0, r3, lsl #2
+	bx	lr
+jrem_13:
+	ldr	r1, dc_13
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #2
+	add	r3, r1, r1, lsl #1
+	add	r3, r1, r3, lsl #2
+	sub	r0, r0, r3
+	bx	lr
+jrem_14:
+	ldr	r1, dc_14
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #3
+	rsb	r3, r1, r1, lsl #3
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_15:
+	ldr	r1, dc_15
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #3
+	rsb	r3, r1, r1, lsl #4
+	sub	r0, r0, r3
+	bx	lr
+jrem_16:
+	movs	r3, r0
+        addmi	r3, r3, #15
+        mov	r1, r3, asr #4
+	sub	r0, r0, r1, lsl #4
+	bx	lr
+jrem_17:
+	ldr	r1, dc_17
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #3
+	add	r3, r1, r1, lsl #4
+	sub	r0, r0, r3
+	bx	lr
+jrem_18:
+	ldr	r1, dc_18
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #2
+	add	r3, r1, r1, lsl #3
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_19:
+	ldr	r1, dc_19
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #3
+	add	r3, r1, r1, lsl #3
+	add	r3, r1, r3, lsl #1
+	sub	r0, r0, r3
+	bx	lr
+jrem_20:
+	ldr	r1, dc_20
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #3
+	add	r3, r1, r1, lsl #2
+	sub	r0, r0, r3, lsl #2
+	bx	lr
+jrem_21:
+	ldr	r1, dc_21
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #2
+	add	r3, r1, r1, lsl #1
+	rsb	r3, r3, r3, lsl #3
+	sub	r0, r0, r3
+	bx	lr
+jrem_22:
+	ldr	r1, dc_22
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #2
+	add	r3, r1, r1, lsl #2
+	add	r3, r1, r3, lsl #1
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_23:
+	ldr	r1, dc_23
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #4
+	add	r3, r1, r1, lsl #1
+	rsb	r3, r1, r3, lsl #3
+	sub	r0, r0, r3
+	bx	lr
+jrem_24:
+	ldr	r1, dc_24
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #2
+	add	r3, r1, r1, lsl #1
+	sub	r0, r0, r3, lsl #3
+	bx	lr
+jrem_25:
+	ldr	r1, dc_25
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #3
+	add	r3, r1, r1, lsl #2
+	add	r3, r3, r3, lsl #2
+	sub	r0, r0, r3
+	bx	lr
+jrem_26:
+	ldr	r1, dc_26
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #3
+	add	r3, r1, r1, lsl #1
+	add	r3, r1, r3, lsl #2
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_27:
+	ldr	r1, dc_27
+        smull	r3, r2, r0, r1
+        mov	r3, r0, asr #31
+        rsb	r1, r3, r2, asr #3
+	add	r3, r1, r1, lsl #1
+	add	r3, r3, r3, lsl #3
+	sub	r0, r0, r3
+	bx	lr
+jrem_28:
+	ldr	r1, dc_28
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #4
+	rsb	r3, r1, r1, lsl #3
+	sub	r0, r0, r3, lsl #2
+	bx	lr
+jrem_29:
+	ldr	r1, dc_29
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #4
+	rsb	r3, r1, r1, lsl #3
+	add	r3, r1, r3, lsl #2
+	sub	r0, r0, r3
+	bx	lr
+jrem_30:
+	ldr	r1, dc_30
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #4
+	rsb	r3, r1, r1, lsl #4
+	sub	r0, r0, r3, lsl #1
+	bx	lr
+jrem_31:
+	ldr	r1, dc_31
+        smull	r3, r2, r0, r1
+        mov	r1, r0, asr #31
+        add	r3, r0, r2
+        rsb	r1, r1, r3, asr #4
+	rsb	r3, r1, r1, lsl #5
+	sub	r0, r0, r3
+	bx	lr
+jrem_32:
+	movs	r3, r0
+        addmi	r3, r3, #31
+        mov	r1, r3, asr #5
+	sub	r0, r0, r1, lsl #5
+	bx	lr
+	ALIGN_DATA
+dc_7:
+dc_14:
+	.word     0x92492493
+dc_15:
+dc_30:
+	.word     0x88888889
+dc_23:
+	.word     0xb21642c9
+dc_28:
+	.word     0x92492493
+dc_29:
+	.word     0x8d3dcb09
+dc_31:
+	.word     0x84210843
+dc_6:
+dc_12:
+dc_24:
+	.word     0x2aaaaaab
+dc_19:
+	.word     0x6bca1af3
+dc_5:
+dc_10:
+dc_20:
+	.word     0x66666667
+dc_21:
+	.word     0x30c30c31
+dc_11:
+dc_22:
+	.word     0x2e8ba2e9
+dc_26:
+dc_13:
+	.word     0x4ec4ec4f
+dc_25:
+	.word     0x51eb851f
+dc_27:
+	.word     0x4bda12f7
+dc_3:
+	.word     0x55555556
+dc_17:
+	.word     0x78787879
+dc_9:
+dc_18:
+	.word     0x38e38e39
+
+#define TBIT 1
+
+	.global	Thumb2_DivZero_Handler
+Thumb2_DivZero_Handler:
+#ifdef THUMB2EE
+
+#define JAZ_V1	r5
+#define JAZ_V2	r6
+#define JAZ_V3	r7
+#define	JAZ_V4	r10
+#define	JAZ_V5	r11
+
+#define JAZ_REGSET	JAZ_V1,JAZ_V2,JAZ_V3,JAZ_V4,JAZ_V5,ip
+#define JAZ_REGSET_LEN	6
+
+	adrl	r0, idiv_clz_ret
+	cmp	r0, lr
+	addne	r0, r0, #irem_clz_ret - idiv_clz_ret
+	cmpne	r0, lr
+	beq	divide_by_zero_exception
+	stmdb	sp!, {JAZ_REGSET}
+	bic	r0, lr, #TBIT
+	ldr	r1, [istate, #ISTATE_METHOD]
+        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
+	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
+	mov	r2, sp
+	ldr	r3, [istate, #ISTATE_LOCALS]
+	bl	Thumb2_lr_to_bci
+	add	sp, sp, #JAZ_REGSET_LEN * 4
+	cmp	r0, #-1
+	moveq	jpc, #0
+	addne	jpc, jpc, r0
+	bl	load_dispatch
+#endif // THUMB2EE
+	b	divide_by_zero_exception
+
+#ifdef THUMB2EE
+
+	.global	Thumb2_Handle_Exception
+	.global	Thumb2_Handle_Exception_NoRegs
+	.global	Thumb2_ArrayBounds_Handler
+	.global	Thumb2_NullPtr_Handler
+	.global Thumb2_Stack_Overflow
+Thumb2_ArrayBounds_Handler:
+	stmdb	sp!, {JAZ_REGSET}
+	bic	r0, lr, #TBIT
+	ldr	r1, [istate, #ISTATE_METHOD]
+        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
+	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
+	mov	r2, sp
+	ldr	r3, [istate, #ISTATE_LOCALS]
+	bl	Thumb2_lr_to_bci
+	add	sp, sp, #JAZ_REGSET_LEN * 4
+	cmp	r0, #-1
+	moveq	jpc, #0
+	addne	jpc, jpc, r0
+	bl	load_dispatch
+	mov	r0, #VMSYMBOLS_ArrayIndexOutOfBounds
+	b	raise_exception
+Thumb2_Handle_Exception:
+	stmdb	sp!, {JAZ_REGSET}
+	bic	r0, lr, #TBIT
+	ldr	r1, [istate, #ISTATE_METHOD]
+        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
+	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
+	mov	r2, sp
+	ldr	r3, [istate, #ISTATE_LOCALS]
+	bl	Thumb2_lr_to_bci
+	add	sp, sp, #JAZ_REGSET_LEN * 4
+	cmp	r0, #-1
+	moveq	jpc, #0
+	addne	jpc, jpc, r0
+	bl	load_dispatch
+	b	handle_exception
+Thumb2_Handle_Exception_NoRegs:
+	bic	r0, lr, #TBIT
+	ldr	r1, [istate, #ISTATE_METHOD]
+        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
+	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
+	mov	r2, #0
+	bl	Thumb2_lr_to_bci
+	cmp	r0, #-1
+	moveq	jpc, #0
+	addne	jpc, jpc, r0
+	bl	load_dispatch
+	b	handle_exception
+Thumb2_NullPtr_Handler:
+	stmdb	sp!, {JAZ_REGSET}
+	bic	r0, lr, #TBIT
+	ldr	r1, [istate, #ISTATE_METHOD]
+        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
+	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
+	mov	r2, sp
+	ldr	r3, [istate, #ISTATE_LOCALS]
+	bl	Thumb2_lr_to_bci
+	add	sp, sp, #JAZ_REGSET_LEN * 4
+	cmp	r0, #-1
+	moveq	jpc, #0
+	addne	jpc, jpc, r0
+	bl	load_dispatch
+	b	null_ptr_exception
+
+Thumb2_Stack_Overflow:
+	mov	r0, r2
+	ldr	ip, [r0, #THREAD_TOP_ZERO_FRAME]
+	str	ip, [r0, #THREAD_LAST_JAVA_SP]
+	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
+	ldmfd	arm_sp!, {fast_regset, pc}
+
+	.global	Thumb2_Exit_To_Interpreter
+Thumb2_Exit_To_Interpreter:
+	bl	load_dispatch
+	sub	stack, stack, #4
+	CACHE_CP
+	CACHE_LOCALS
+	DISPATCH	0
+
+	.global	Thumb2_Clear_Cache
+Thumb2_Clear_Cache:
+	stmdb	sp!, {r7}
+	mov	r2, #0
+	mov	r7, #2
+	orr	r7, r7, #0xf0000
+	svc	0
+	ldmia	sp!, {r7}
+	bx	lr
+
+#endif // THUMB2EE
+
+	.section	.init_array,"aw",%init_array
+	.word	bci_init(target1)
+
+	.data
+	.global	CPUInfo
+	ALIGN_DATA
+        .word   0, 0, 0, 0, 0, 0, 0, 0
+        .word   0, 0, 0, 0, 0
+DispatchBreakPoint:					.word	0
+CPUInfo:						.word	0
+CodeTrace_Idx:						.word	0
+UseOnStackReplacement_Address:                          .word   0
+BackgroundCompilation_Address:                          .word   0
+CompileThreshold_Address:                               .word   0
+InterpreterInvocationLimit_Address:			.word	0
+UseCompiler_Address:					.word	0
+can_post_interpreter_events:				.word	0
+PrintCommandLineFlags_Address:				.word	0
+oopDesc_Address:					.word	0
+ThreadLocalStorage_thread_index:			.word	0
+AbstractInterpreter_notice_safepoints:			.word	0
+Bytecodes_name_Address:					.word	0
+Universe_collectedHeap_Address:				.word	0
+always_do_update_barrier_Address:			.word	0
+VmSymbols_symbols_Address:				.word	0
+SafePointSynchronize_state_Address:			.word	0
+InterpreterRuntime_slow_signature_handler_Address:	.word	0
+XXX:
+opclabels_data:
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,7456 @@
+/*
+ * Copyright 2009, 2010 Edward Nevill
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#undef THUMB2EE
+#if !defined(DISABLE_THUMB2) && defined(HOTSPOT_ASM) && !defined(SHARK)
+#define THUMB2EE
+#endif
+
+#ifdef THUMB2EE
+
+#define T2EE_PRINT_COMPILATION
+#define T2EE_PRINT_STATISTICS
+//#define T2EE_PRINT_DISASS
+#define T2EE_PRINT_REGUSAGE
+
+#ifdef T2EE_PRINT_COMPILATION
+static char *t2ee_print_compilation;
+#endif
+
+#ifdef T2EE_PRINT_STATISTICS
+static char *t2ee_print_statistics;
+#endif
+
+#ifdef T2EE_PRINT_DISASS
+static char *t2ee_print_disass;
+#endif
+
+#ifdef T2EE_PRINT_REGUSAGE
+static char *t2ee_print_regusage;
+#endif
+
+#define THUMB2_CODEBUF_SIZE (8 * 1024 * 1024)
+#define THUMB2_MAX_BYTECODE_SIZE 10000
+#define THUMB2_MAX_T2CODE_SIZE 65000
+#define THUMB2_MAXLOCALS 1000
+
+#include <sys/mman.h>
+
+#include "incls/_precompiled.incl"
+
+#ifdef T2EE_PRINT_DISASS
+#include "dis-asm.h"
+#include "bfd.h"
+#endif
+
+#define opc_nop			0x00
+#define opc_aconst_null		0x01
+#define opc_iconst_m1		0x02
+#define opc_iconst_0		0x03
+#define opc_iconst_1		0x04
+#define opc_iconst_2		0x05
+#define opc_iconst_3		0x06
+#define opc_iconst_4		0x07
+#define opc_iconst_5		0x08
+#define opc_lconst_0		0x09
+#define opc_lconst_1		0x0a
+#define opc_fconst_0		0x0b
+#define opc_fconst_1		0x0c
+#define opc_fconst_2		0x0d
+#define opc_dconst_0		0x0e
+#define opc_dconst_1		0x0f
+#define opc_bipush		0x10
+#define opc_sipush		0x11
+#define opc_ldc			0x12
+#define opc_ldc_w		0x13
+#define opc_ldc2_w		0x14
+#define opc_iload		0x15
+#define opc_lload		0x16
+#define opc_fload		0x17
+#define opc_dload		0x18
+#define opc_aload		0x19
+#define opc_iload_0		0x1a
+#define opc_iload_1		0x1b
+#define opc_iload_2		0x1c
+#define opc_iload_3		0x1d
+#define opc_lload_0		0x1e
+#define opc_lload_1		0x1f
+#define opc_lload_2		0x20
+#define opc_lload_3		0x21
+#define opc_fload_0		0x22
+#define opc_fload_1		0x23
+#define opc_fload_2		0x24
+#define opc_fload_3		0x25
+#define opc_dload_0		0x26
+#define opc_dload_1		0x27
+#define opc_dload_2		0x28
+#define opc_dload_3		0x29
+#define opc_aload_0		0x2a
+#define opc_aload_1		0x2b
+#define opc_aload_2		0x2c
+#define opc_aload_3		0x2d
+#define opc_iaload		0x2e
+#define opc_laload		0x2f
+#define opc_faload		0x30
+#define opc_daload		0x31
+#define opc_aaload		0x32
+#define opc_baload		0x33
+#define opc_caload		0x34
+#define opc_saload		0x35
+#define opc_istore		0x36
+#define opc_lstore		0x37
+#define opc_fstore		0x38
+#define opc_dstore		0x39
+#define opc_astore		0x3a
+#define opc_istore_0		0x3b
+#define opc_istore_1		0x3c
+#define opc_istore_2		0x3d
+#define opc_istore_3		0x3e
+#define opc_lstore_0		0x3f
+#define opc_lstore_1		0x40
+#define opc_lstore_2		0x41
+#define opc_lstore_3		0x42
+#define opc_fstore_0		0x43
+#define opc_fstore_1		0x44
+#define opc_fstore_2		0x45
+#define opc_fstore_3		0x46
+#define opc_dstore_0		0x47
+#define opc_dstore_1		0x48
+#define opc_dstore_2		0x49
+#define opc_dstore_3		0x4a
+#define opc_astore_0		0x4b
+#define opc_astore_1		0x4c
+#define opc_astore_2		0x4d
+#define opc_astore_3		0x4e
+#define opc_iastore		0x4f
+#define opc_lastore		0x50
+#define opc_fastore		0x51
+#define opc_dastore		0x52
+#define opc_aastore		0x53
+#define opc_bastore		0x54
+#define opc_castore		0x55
+#define opc_sastore		0x56
+#define opc_pop			0x57
+#define opc_pop2		0x58
+#define opc_dup			0x59
+#define opc_dup_x1		0x5a
+#define opc_dup_x2		0x5b
+#define opc_dup2		0x5c
+#define opc_dup2_x1		0x5d
+#define opc_dup2_x2		0x5e
+#define opc_swap		0x5f
+#define opc_iadd		0x60
+#define opc_ladd		0x61
+#define opc_fadd		0x62
+#define opc_dadd		0x63
+#define opc_isub		0x64
+#define opc_lsub		0x65
+#define opc_fsub		0x66
+#define opc_dsub		0x67
+#define opc_imul		0x68
+#define opc_lmul		0x69
+#define opc_fmul		0x6a
+#define opc_dmul		0x6b
+#define opc_idiv		0x6c
+#define opc_ldiv		0x6d
+#define opc_fdiv		0x6e
+#define opc_ddiv		0x6f
+#define opc_irem		0x70
+#define opc_lrem		0x71
+#define opc_frem		0x72
+#define opc_drem		0x73
+#define opc_ineg		0x74
+#define opc_lneg		0x75
+#define opc_fneg		0x76
+#define opc_dneg		0x77
+#define opc_ishl		0x78
+#define opc_lshl		0x79
+#define opc_ishr		0x7a
+#define opc_lshr		0x7b
+#define opc_iushr		0x7c
+#define opc_lushr		0x7d
+#define opc_iand		0x7e
+#define opc_land		0x7f
+#define opc_ior			0x80
+#define opc_lor			0x81
+#define opc_ixor		0x82
+#define opc_lxor		0x83
+#define opc_iinc		0x84
+#define opc_i2l			0x85
+#define opc_i2f			0x86
+#define opc_i2d			0x87
+#define opc_l2i			0x88
+#define opc_l2f			0x89
+#define opc_l2d			0x8a
+#define opc_f2i			0x8b
+#define opc_f2l			0x8c
+#define opc_f2d			0x8d
+#define opc_d2i			0x8e
+#define opc_d2l			0x8f
+#define opc_d2f			0x90
+#define opc_i2b			0x91
+#define opc_i2c			0x92
+#define opc_i2s			0x93
+#define opc_lcmp		0x94
+#define opc_fcmpl		0x95
+#define opc_fcmpg		0x96
+#define opc_dcmpl		0x97
+#define opc_dcmpg		0x98
+#define opc_ifeq		0x99
+#define opc_ifne		0x9a
+#define opc_iflt		0x9b
+#define opc_ifge		0x9c
+#define opc_ifgt		0x9d
+#define opc_ifle		0x9e
+#define opc_if_icmpeq		0x9f
+#define opc_if_icmpne		0xa0
+#define opc_if_icmplt		0xa1
+#define opc_if_icmpge		0xa2
+#define opc_if_icmpgt		0xa3
+#define opc_if_icmple		0xa4
+#define opc_if_acmpeq		0xa5
+#define opc_if_acmpne		0xa6
+#define opc_goto		0xa7
+#define opc_jsr			0xa8
+#define opc_ret			0xa9
+#define opc_tableswitch		0xaa
+#define opc_lookupswitch	0xab
+#define opc_ireturn		0xac
+#define opc_lreturn		0xad
+#define opc_freturn		0xae
+#define opc_dreturn		0xaf
+#define opc_areturn		0xb0
+#define opc_return		0xb1
+#define opc_getstatic		0xb2
+#define opc_putstatic		0xb3
+#define opc_getfield		0xb4
+#define opc_putfield		0xb5
+#define opc_invokevirtual	0xb6
+#define opc_invokespecial	0xb7
+#define opc_invokestatic	0xb8
+#define opc_invokeinterface	0xb9
+#define opc_new			0xbb
+#define opc_newarray		0xbc
+#define opc_anewarray		0xbd
+#define opc_arraylength		0xbe
+#define opc_athrow		0xbf
+#define opc_checkcast		0xc0
+#define opc_instanceof		0xc1
+#define opc_monitorenter	0xc2
+#define opc_monitorexit		0xc3
+#define opc_wide		0xc4
+#define opc_multianewarray	0xc5
+#define opc_ifnull		0xc6
+#define opc_ifnonnull		0xc7
+#define opc_goto_w		0xc8
+#define opc_jsr_w		0xc9
+#define opc_breakpoint		0xca
+
+#define OPC_LAST_JAVA_OP	0xca
+
+#define opc_bgetfield			0xcc
+#define opc_cgetfield			0xcd
+#define opc_igetfield			0xd0
+#define opc_lgetfield			0xd1
+#define opc_sgetfield			0xd2
+#define opc_aputfield			0xd3
+#define opc_bputfield			0xd4
+#define opc_cputfield			0xd5
+#define opc_iputfield			0xd8
+#define opc_lputfield			0xd9
+#define opc_iaccess_0			0xdb
+#define opc_iaccess_1			0xdc
+#define opc_iaccess_2			0xdd
+#define opc_iaccess_3			0xde
+#define opc_invokeresolved		0xdf
+#define opc_invokespecialresolved	0xe0
+#define opc_invokestaticresolved	0xe1
+#define opc_invokevfinal		0xe2
+#define opc_iload_iload			0xe3
+#define opc_iload_iload_N		0xe4
+#define opc_return_register_finalizer	0xe5
+#define opc_dmac			0xe6
+#define opc_iload_0_iconst_N		0xe7
+#define opc_iload_1_iconst_N		0xe8
+#define opc_iload_2_iconst_N		0xe9
+#define opc_iload_3_iconst_N		0xea
+#define opc_iload_iconst_N		0xeb
+#define opc_iadd_istore_N		0xec
+#define opc_isub_istore_N		0xed
+#define opc_iand_istore_N		0xee
+#define opc_ior_istore_N		0xef
+#define opc_ixor_istore_N		0xf0
+#define opc_iadd_u4store		0xf1
+#define opc_isub_u4store		0xf2
+#define opc_iand_u4store		0xf3
+#define opc_ior_u4store			0xf4
+#define opc_ixor_u4store		0xf5
+#define opc_iload_0_iload		0xf6
+#define opc_iload_1_iload		0xf7
+#define opc_iload_2_iload		0xf8
+#define opc_iload_3_iload		0xf9
+#define opc_iload_0_iload_N		0xfa
+#define opc_iload_1_iload_N		0xfb
+#define opc_iload_2_iload_N		0xfc
+#define opc_iload_3_iload_N		0xfd
+
+#define H_IREM				0
+#define H_IDIV				1
+#define H_LDIV				2
+#define H_LREM				3
+#define H_FREM				4
+#define H_DREM				5
+#define	H_LDC				6
+#define H_NEW				8
+#define H_I2F				9
+#define H_I2D				10
+#define H_L2F				11
+#define H_L2D				12
+#define H_F2I				13
+#define H_F2L				14
+#define H_F2D				15
+#define H_D2I				16
+#define H_D2L				17
+#define H_D2F				18
+#define H_NEWARRAY			19
+#define H_ANEWARRAY			20
+#define H_MULTIANEWARRAY		21
+#define H_INSTANCEOF			22
+#define H_CHECKCAST			23
+#define H_AASTORE			24
+#define H_APUTFIELD			25
+#define H_SYNCHRONIZED_ENTER		26
+#define H_SYNCHRONIZED_EXIT		27
+
+#define H_EXIT_TO_INTERPRETER		28
+
+#define H_GETSTATIC			H_EXIT_TO_INTERPRETER
+#define H_PUTSTATIC			H_EXIT_TO_INTERPRETER
+#define H_JSR				H_EXIT_TO_INTERPRETER
+#define H_RET				H_EXIT_TO_INTERPRETER
+#define H_ZOMBIE			H_EXIT_TO_INTERPRETER
+#define H_MONITOR			H_EXIT_TO_INTERPRETER
+#define H_ATHROW			H_EXIT_TO_INTERPRETER
+
+#define H_HANDLE_EXCEPTION		29
+#define H_ARRAYBOUND			30
+#define H_UNKNOWN			31
+
+#define H_DEBUG_METHODENTRY		32
+#define H_DEBUG_METHODEXIT		33
+#define H_DEBUG_METHODCALL		34
+
+#define H_INVOKEINTERFACE		35
+#define H_INVOKEVIRTUAL			36
+#define H_INVOKESTATIC			37
+#define H_INVOKESPECIAL			38
+
+#define H_GETFIELD_WORD			39
+#define H_GETFIELD_SH			40
+#define H_GETFIELD_H			41
+#define H_GETFIELD_SB			42
+#define H_GETFIELD_DW			43
+
+#define H_PUTFIELD_WORD			44
+#define H_PUTFIELD_H			45
+#define H_PUTFIELD_B			46
+#define H_PUTFIELD_A			47
+#define H_PUTFIELD_DW			48
+
+#define H_GETSTATIC_WORD		49
+#define H_GETSTATIC_SH			50
+#define H_GETSTATIC_H			51
+#define H_GETSTATIC_SB			52
+#define H_GETSTATIC_DW			53
+
+#define H_PUTSTATIC_WORD		54
+#define H_PUTSTATIC_H			55
+#define H_PUTSTATIC_B			56
+#define H_PUTSTATIC_A			57
+#define H_PUTSTATIC_DW			58
+
+#define H_STACK_OVERFLOW		59
+
+#define H_HANDLE_EXCEPTION_NO_REGS	60
+
+unsigned handlers[61];
+
+#define LEAF_STACK_SIZE			200
+#define STACK_SPARE			40
+
+#define COMPILER_RESULT_FAILED	1	// Failed to compiled this method
+#define COMPILER_RESULT_FATAL	2	// Fatal - dont try compile anything ever again
+
+#include <setjmp.h>
+
+static jmp_buf compiler_error_env;
+
+#ifdef PRODUCT
+
+#define JASSERT(cond, msg)	0
+#define J_Unimplemented() longjmp(compiler_error_env, COMPILER_RESULT_FATAL)
+
+#else
+
+#define JASSERT(cond, msg)	do { if (!(cond)) fatal(msg); } while (0)
+#define J_Unimplemented()       { report_unimplemented(__FILE__, __LINE__); BREAKPOINT; }
+
+#endif // PRODUCT
+
+#define GET_NATIVE_U2(p)	(*(unsigned short *)(p))
+
+#define GET_JAVA_S1(p)		(((signed char *)(p))[0])
+#define GET_JAVA_S2(p)  	((((signed char *)(p))[0] << 8) + (p)[1])
+#define GET_JAVA_U2(p)		(((p)[0] << 8) + (p)[1])
+#define GET_JAVA_U4(p)		(((p)[0] << 24) + ((p)[1] << 16) + ((p)[2] << 8) + (p)[3])
+
+#define BYTESEX_REVERSE(v) (((v)<<24) | (((v)<<8) & 0xff0000) | (((v)>>8) & 0xff00) | ((v)>>24))
+#define BYTESEX_REVERSE_U2(v) (((v)<<8) | ((v)>>8))
+
+typedef struct Thumb2_CodeBuf {
+  unsigned size;
+  char *sp;
+  char *hp;
+} Thumb2_CodeBuf;
+
+Thumb2_CodeBuf *thumb2_codebuf;
+
+unsigned bc_stackinfo[THUMB2_MAX_BYTECODE_SIZE];
+unsigned locals_info[1000];
+unsigned stack[1000];
+unsigned r_local[1000];
+
+#ifdef T2EE_PRINT_DISASS
+short start_bci[THUMB2_MAX_T2CODE_SIZE];
+short end_bci[THUMB2_MAX_T2CODE_SIZE];
+#endif
+
+// XXX hardwired constants!
+#define ENTRY_FRAME             1
+#define INTERPRETER_FRAME       2
+#define SHARK_FRAME             3
+#define FAKE_STUB_FRAME         4
+
+#include "offsets_arm.s"
+
+#define BC_FLAGS_MASK		0xfc000000
+#define BC_VISITED_P1		0x80000000
+#define BC_BRANCH_TARGET	0x40000000
+#define BC_COMPILED		0x20000000
+#define BC_VISITED_P2		0x10000000
+#define BC_ZOMBIE		0x08000000
+#define BC_BACK_TARGET		0x04000000
+
+#define IS_DEAD(x)	(((x) & BC_VISITED_P1) == 0)
+#define IS_ZOMBIE(x)	(((x) & BC_ZOMBIE) || ((x) & BC_VISITED_P2) == 0)
+
+#define LOCAL_MODIFIED		31
+#define LOCAL_REF		30
+#define LOCAL_DOUBLE		29
+#define LOCAL_FLOAT		28
+#define LOCAL_LONG		27
+#define LOCAL_INT		26
+#define LOCAL_ALLOCATED		25
+
+#define LOCAL_COUNT_BITS	10
+#define LOCAL_READ_POS		0
+#define LOCAL_WRITE_POS		LOCAL_COUNT_BITS
+
+#define LOCAL_READS(x)		(((x) >> LOCAL_READ_POS) & ((1<<LOCAL_COUNT_BITS)-1))
+#define LOCAL_WRITES(x)		(((x) >> LOCAL_WRITE_POS) & ((1<<LOCAL_COUNT_BITS)-1))
+#define LOCAL_SET_COUNTS(r, w)	(((r) << LOCAL_READ_POS) | (((w) << LOCAL_WRITE_POS)))
+#define LOCAL_INC_COUNT(c)	((c) < ((1<<LOCAL_COUNT_BITS)-1) ? (c)+1 : (c))
+
+#define STACK_REGS	4
+#define FP_STACK_REGS	4
+
+typedef unsigned	u32;
+typedef unsigned	Reg;
+
+#define	ARM_R0		0
+#define ARM_R1		1
+#define ARM_R2		2
+#define ARM_R3		3
+#define ARM_R4		4
+#define ARM_R5		5
+#define ARM_R6		6
+#define ARM_R7		7
+#define ARM_R8		8
+#define ARM_R9		9
+#define ARM_R10		10
+#define ARM_R11		11
+#define ARM_IP		12
+#define ARM_SP		13
+#define ARM_LR		14
+#define ARM_PC		15
+#define ARM_CPSR	16	// CPSR in sigcontext
+#define ARM_FAULT	17	// fault address in sigcontext
+
+#define CPSR_THUMB_BIT	(1<<5)
+
+#define VFP_S0		32
+#define VFP_S1		33
+#define VFP_S2		34
+#define VFP_S3		35
+#define VFP_S4		36
+#define VFP_S5		37
+#define VFP_S6		38
+#define VFP_S7		39
+
+#define VFP_D0		64
+#define VFP_D1		65
+#define VFP_D2		66
+#define VFP_D3		67
+#define VFP_D4		68
+#define VFP_D5		69
+#define VFP_D6		70
+#define VFP_D7		71
+
+#define PREGS	5
+
+#define JAZ_V1	ARM_R5
+#define JAZ_V2	ARM_R6
+#define JAZ_V3	ARM_R7
+#define JAZ_V4	ARM_R10
+#define JAZ_V5	ARM_R11
+
+#define Rstack		ARM_R4
+#define Rlocals		ARM_R7
+#define Ristate		ARM_R8
+#define Rthread		ARM_R9
+
+#define Rint_stack	ARM_R4
+#define Rint_jpc	ARM_R5
+#define Rint_istate	ARM_R8
+
+#define IS_ARM_INT_REG(r) ((r) <= ARM_PC)
+#define IS_ARM_FP_REG(r) (!IS_ARM_INT_REG(r))
+
+#define I_REGSET	((1<<ARM_R4) | (1<<ARM_R5) | (1<<ARM_R6) | (1<<ARM_R7) | \
+			 (1<<ARM_R9) | (1<<ARM_R10) | (1<<ARM_R11))
+#define C_REGSET	(1<<ARM_R8)
+
+#define LOG2(n) binary_log2(n)
+
+unsigned binary_log2(unsigned n)
+{
+  unsigned r = 0;
+  if ((n & 0xffff) == 0) r = 16, n >>= 16;
+  if ((n & 0xff) == 0) r += 8, n >>= 8;
+  if ((n & 0xf) == 0) r += 4, n >>= 4;
+  if ((n & 3) == 0) r += 2, n >>= 2;
+  if ((n & 1) == 0) r += 1;
+  return r;
+}
+
+typedef struct Compiled_Method {
+    // All entry points aligned on a cache line boundary
+    //		.align	CODE_ALIGN
+    // slow_entry:				@ callee save interface
+    // 		push	{r4, r5, r6, r7, r9, r10, r11, lr}
+    // 		bl	fast_entry
+    // 		pop	{r4, r5, r6, r7, r9, r10, r11, pc}
+    unsigned slow_entry[3];
+    unsigned *osr_table;			// pointer to the osr table
+    unsigned *exception_table;
+    Compiled_Method *next;
+    // The next 6 halfword give the register mapping for JAZ_V1 to JAZ_v5
+    // This is used when receovering from an exception so we can push
+    // the register back into the local variables pool.
+    short regusage[6];
+    // OSR Entry point:
+    // 	R0 = entry point within compiled method
+    // 	R1 = locals - 4000 * 4
+    // 	R2 = thread
+    // 	R3 = locals - 31 * 4
+    // osr_entry:
+    // 		@ Load each local into it register allocated register
+    // 		ldr	<reg>, [R1, #(4000-<local>) * 4]
+    //    or	ldr	<reg>, [R3, #(31-<local>) * 4]
+    // 		...
+    // 		mov	Rthread, R2
+    // 		bx	R0
+    // 		.align	CODE_ALIGN
+    unsigned osr_entry[1];
+    // fast_entry:
+    // 		push	{r8, lr}
+    // 		...	@ The compiled code
+    // 		pop	{r8, pc}
+    // 		.align	WORD_ALIGN
+    // code_handle:				@ from interpreted entry
+    // 		.word	slow_entry		@ bottom bit must be set!
+    // osr_table:
+    // 		.word	<no. of entries>
+    // @@@ For bytecode 0 and for each backwards branch target
+    // 		.short	<bytecode index>
+    // 		.short	<code offset>		@ offset in halfwords from slow_entry
+} Compiled_Method;
+
+Compiled_Method *compiled_method_list = 0;
+Compiled_Method **compiled_method_list_tail_ptr = &compiled_method_list;
+
+typedef struct Thumb2_Entrypoint {
+  unsigned compiled_entrypoint;
+  unsigned osr_entry;
+} Thumb2_Entrypoint;
+
+typedef struct CodeBuf {
+    unsigned short *codebuf;
+    unsigned idx;
+    unsigned limit;
+} CodeBuf;
+
+typedef struct Thumb2_Stack {
+    unsigned *stack;
+    unsigned depth;
+} Thumb2_Stack;
+
+#define IS_SREG(r) ((r) < STACK_REGS)
+
+typedef struct Thumb2_Registers {
+    unsigned *r_local;
+    unsigned npregs;
+    unsigned pregs[PREGS];
+    int mapping[PREGS];
+} Thumb2_Registers;
+
+typedef struct Thumb2_Info {
+    JavaThread *thread;
+    methodOop method;
+    unsigned *bc_stackinfo;
+    unsigned *locals_info;
+    jubyte *code_base;
+    unsigned code_size;
+    CodeBuf *codebuf;
+    Thumb2_Stack *jstack;
+    Thumb2_Registers *jregs;
+    unsigned compiled_return;
+    unsigned zombie_bytes;
+    unsigned is_leaf;
+} Thumb2_Info;
+
+#define IS_INT_SIZE_BASE_TYPE(c) (c=='B' || c=='C' || c=='F' || c=='I' || c=='S' || c=='Z')
+#define IS_INT_SIZE_TYPE(c) (IS_INT_SIZE_BASE_TYPE(c) || c == 'L' || c == '[')
+
+static int method_stackchange(jbyte *base)
+{
+  jbyte c;
+  int stackchange = 0;
+
+  c = *base++;
+  JASSERT(c == '(', "Invalid signature, missing '('");
+  while ((c = *base++) != ')') {
+    stackchange -= 1;
+    if (c == 'J' || c == 'D') {
+      stackchange -= 1;
+    } else if (c == '[') {
+      do { c = *base++; } while (c == '[');
+      if (c == 'L')
+	do { c = *base++; } while (c != ';');
+    } else if (c == 'L') {
+      do { c = *base++; } while (c != ';');
+    } else {
+      JASSERT(IS_INT_SIZE_BASE_TYPE(c), "Invalid signature, bad arg type");
+    }
+  }
+  JASSERT(c == ')', "Invalid signature, missing ')'");
+  c = *base++;
+  if (c == 'J' || c == 'D') stackchange += 2;
+  else if (c != 'V') {
+    stackchange += 1;
+    JASSERT(IS_INT_SIZE_TYPE(c), "Invalid signature, bad ret type");
+  }
+  return stackchange;
+}
+
+static void Thumb2_local_info_from_sig(Thumb2_Info *jinfo, methodOop method, jbyte *base)
+{
+  jbyte c;
+  unsigned arg = 0;
+  unsigned *locals_info = jinfo->locals_info;
+  unsigned local_info;
+
+  if (!method->is_static()) locals_info[arg++] = 1 << LOCAL_REF;
+  c = *base++;
+  JASSERT(c == '(', "Invalid signature, missing '('");
+  while ((c = *base++) != ')') {
+    local_info = 1 << LOCAL_INT;
+    if (c == 'J') local_info = 1 << LOCAL_LONG;
+    else if (c == 'D') local_info = 1 << LOCAL_DOUBLE;
+    else if (c == '[') {
+      local_info = 1 << LOCAL_REF;
+      do { c = *base++; } while (c == '[');
+      if (c == 'L')
+	do { c = *base++; } while (c != ';');
+    } else if (c == 'L') {
+      local_info = 1 << LOCAL_REF;
+      do { c = *base++; } while (c != ';');
+    } else {
+      JASSERT(IS_INT_SIZE_BASE_TYPE(c), "Invalid signature, bad arg type");
+    }
+    locals_info[arg++] = local_info;
+  }
+}
+
+#define T_UNDEFINED_32	0xf7f0a000
+#define T_UNDEFINED_16	0xde00
+
+static const char *local_types[] = { "int", "long", "float", "double", "ref" };
+
+#ifdef T2EE_PRINT_DISASS
+void Thumb2_disass(Thumb2_Info *jinfo)
+{
+  unsigned code_size = jinfo->code_size;
+  jubyte *code_base = jinfo->code_base;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+  unsigned *locals_info = jinfo->locals_info;
+  unsigned nlocals = jinfo->method->max_locals();
+  int bci = 0;
+  int last_bci = -1;
+  int start_b, end_b;
+  unsigned nodisass;
+
+  struct disassemble_info info;
+  unsigned short *codebuf = jinfo->codebuf->codebuf;
+  unsigned idx, compiled_len;
+
+#if 0
+  printf("Local Variable Usage\n");
+  printf("====================\n");
+  for (idx = 0; idx < nlocals; idx++) {
+    unsigned linfo = locals_info[idx];
+    unsigned typ = (linfo >> LOCAL_INT) & 0x1f;
+
+    printf("Local %d, type = %s (%x)", idx, typ ? local_types[LOG2(typ)] : "!!!unknown!!!", typ);
+    if (linfo & (1 << LOCAL_MODIFIED)) printf(", modified");
+    if (idx < (unsigned)jinfo->method->size_of_parameters()) printf(", parameter");
+    putchar('\n');
+  }
+#endif
+
+  init_disassemble_info(&info, stdout, (fprintf_ftype)fprintf);
+  info.arch = bfd_arch_arm;
+  disassemble_init_for_target(&info);
+  info.endian = BFD_ENDIAN_LITTLE;
+  info.endian_code = BFD_ENDIAN_LITTLE;
+  info.buffer = (bfd_byte *)codebuf;
+  info.buffer_vma = (bfd_vma)codebuf;
+  info.buffer_length = jinfo->codebuf->idx * sizeof(short);
+  info.disassembler_options = (char *)"force-thumb";
+
+  compiled_len = jinfo->codebuf->idx * 2;
+  for (idx = 0; idx < compiled_len; ) {
+    nodisass = 0;
+    start_b = start_bci[idx/2];
+    end_b = end_bci[idx/2];
+    if (start_b != -1) {
+      last_bci != -1;
+      for (bci = start_b; bci < end_b; ) {
+	unsigned stackinfo = bc_stackinfo[bci];
+	unsigned opcode;
+	int len;
+
+	if (stackinfo & BC_BRANCH_TARGET)
+	  printf("----- Basic Block -----\n");
+	JASSERT(bci > last_bci, "disass not advancing");
+	last_bci = bci;
+	printf("%c%4d : ", (stackinfo & BC_VISITED_P1) ? ' ' : '?', bci);
+	opcode = code_base[bci];
+	if (opcode > OPC_LAST_JAVA_OP) {
+	  if (Bytecodes::is_defined((Bytecodes::Code)opcode))
+	    opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
+	}
+	len = Bytecodes::length_for((Bytecodes::Code)opcode);
+	if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
+	switch (opcode) {
+	  case opc_tableswitch: {
+	    int nbci = (bci & ~3) + 4;
+	    int low, high;
+	    unsigned w;
+	    unsigned *table;
+	    int def;
+	    unsigned n, i;
+
+	    printf("%02x ", opcode);
+	    for (int i = 1; i < 5; i++)
+	      printf("   ");
+	    printf("%s\n", Bytecodes::name((Bytecodes::Code)opcode));
+	    printf("\t%d bytes padding\n", nbci - (bci+1));
+	    w = *(unsigned int *)(code_base + nbci + 4);
+	    low = (int)BYTESEX_REVERSE(w);
+	    w = *(unsigned int *)(code_base + nbci + 8);
+	    high = (int)BYTESEX_REVERSE(w);
+	    w = *(unsigned int *)(code_base + nbci + 0);
+	    def = (int)BYTESEX_REVERSE(w);
+	    table = (unsigned int *)(code_base + nbci + 12);
+	    printf("\tdefault:\t0x%08x\n", def);
+	    printf("\tlow:\t\t0x%08x\n", low);
+	    printf("\thigh:\t\t0x%08x\n", high);
+	    n = high - low + 1;
+	    while (low <= high) {
+	      int off;
+
+	      w = *table++;
+	      off = (int)BYTESEX_REVERSE(w);
+	      printf("\toffset %d:\t0x%08x\n", low, off);
+	      low++;
+	    }
+	    bci += len;
+	    for (i = 0; i < 4; i++) {
+	      printf("0x%08x:\t", (int)codebuf+idx);
+	      {
+		int len = print_insn_little_arm((bfd_vma)codebuf+idx, &info);
+		if (len == -1) len = 2;
+		idx += len;
+		putchar('\n');
+	      }
+	    }
+	    for (i = 0; i < n; i++) {
+	      printf("0x%08x:\t.short\t0x%04x\n", (int)codebuf+idx, *(short *)((int)codebuf + idx));
+	      idx += 2;
+	    }
+	    nodisass = 1;
+	    break;
+	  }
+	  case opc_lookupswitch: {
+	    unsigned w;
+	    unsigned nbci = (bci & ~3) + 4;;
+	    int def;
+	    int npairs;	// The Java spec says signed but must be >= 0??
+	    unsigned *table;
+
+	    printf("%02x ", opcode);
+	    for (int i = 1; i < 5; i++)
+	      printf("   ");
+	    printf("%s\n", Bytecodes::name((Bytecodes::Code)opcode));
+	    printf("\t%d bytes padding\n", nbci - (bci+1));
+
+	    w = *(unsigned int *)(code_base + nbci + 0);
+	    def = (int)BYTESEX_REVERSE(w);
+	    w = *(unsigned int *)(code_base + nbci + 4);
+	    npairs = (int)BYTESEX_REVERSE(w);
+	    table = (unsigned int *)(code_base + nbci + 8);
+	    printf("\tdefault:\t0x%08x\n", def);
+	    printf("\tnpairs:\t\t0x%08x\n", npairs);
+	    for (int i = 0; i < npairs; i++) {
+	      unsigned match, off;
+	      w = table[0];
+	      match = BYTESEX_REVERSE(w);
+	      w = table[1];
+	      table += 2;
+	      off = BYTESEX_REVERSE(w);
+	      printf("\t  match: 0x%08x, offset: 0x%08x\n", match, off);
+	    }
+	    break;
+	  }
+
+	  default:
+	    for (int i = 0; i < 5; i++) {
+	      if (i < len)
+		printf("%02x ", code_base[bci+i]);
+	      else
+		printf("   ");
+	    }
+	    printf("%s\n", Bytecodes::name((Bytecodes::Code)code_base[bci]));
+	    break;
+	}
+	bci += len;
+      }
+    }
+    if (!nodisass) {
+      printf("0x%08x:\t", (int)codebuf+idx);
+      {
+	int len;
+	unsigned s1, s2;
+
+	s1 = *(unsigned short *)((int)codebuf + idx);
+	s2 = *(unsigned short *)((int)codebuf + idx + 2);
+	if (s1 == T_UNDEFINED_16 || ((s1 << 16) + s2) == T_UNDEFINED_32) {
+	  if (s1 == T_UNDEFINED_16) {
+	    printf("undefined (0xde00) - UNPATCHED BRANCH???");
+	    len = 2;
+	  } else {
+	    printf("undefined (0xf7f0a000) - UNPATCHED BRANCH???");
+	    len = 4;
+	  }
+	} else {
+	  len = print_insn_little_arm((bfd_vma)codebuf+idx, &info);
+	  if (len == -1) len = 2;
+	  idx += len;
+	}
+	putchar('\n');
+      }
+    }
+  }
+}
+#endif
+
+#define BCI(len, pop, push, special, islocal, islocal_n, isstore, local_n, local_type) \
+	((len) | ((pop)<<3) | ((push)<<6) | (unsigned)((special) << 31) | ((islocal) << 30) | ((islocal_n) << 29) | ((isstore) << 28) | ((local_n) << 9) | ((local_type) << 11))
+
+#define BCI_LEN(x) 	((x) & 7)
+#define BCI_POP(x) 	(((x)>>3) & 7)
+#define BCI_PUSH(x) 	(((x)>>6) & 7)
+#define BCI_LOCAL_N(x)	(((x)>>9) & 3)
+#define BCI_LOCAL_TYPE(x) (((x) >> 11) & 7)
+
+#define BCI_TYPE_INT	0
+#define BCI_TYPE_LONG	1
+#define BCI_TYPE_FLOAT	2
+#define BCI_TYPE_DOUBLE	3
+#define BCI_TYPE_REF	4
+
+#define BCI_SPECIAL(x) 	((x) & 0x80000000)
+#define BCI_ISLOCAL(x)	((x) & 0x40000000)
+#define BCI_ISLOCAL_N(x) ((x) & 0x20000000)
+#define BCI_ISSTORE(x)	((x) & 0x10000000)
+
+static const unsigned bcinfo[256] = {
+	BCI(1, 0, 0, 0, 0, 0, 0, 0, 0),	// nop
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// aconst_null
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_m1
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_0
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_1
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_2
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_3
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_4
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_5
+	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// lconst_0
+	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// lconst_1
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// fconst_0
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// fconst_1
+	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// fconst_2
+	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// dconst_0
+	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// dconst_1
+	BCI(2, 0, 1, 0, 0, 0, 0, 0, 0),	// bipush
+	BCI(3, 0, 1, 0, 0, 0, 0, 0, 0),	// bipush
+	BCI(2, 0, 1, 0, 0, 0, 0, 0, 0),	// ldc
+	BCI(3, 0, 1, 0, 0, 0, 0, 0, 0),	// ldc_w
+	BCI(3, 0, 2, 0, 0, 0, 0, 0, 0),	// ldc2_w
+	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload
+	BCI(2, 0, 2, 0, 1, 0, 0, 0, BCI_TYPE_LONG),	// lload
+	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_FLOAT),	// fload
+	BCI(2, 0, 2, 0, 1, 0, 0, 0, BCI_TYPE_DOUBLE),	// dload
+	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_REF),	// aload
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3
+	BCI(1, 0, 2, 0, 1, 1, 0, 0, BCI_TYPE_LONG),	// lload_0
+	BCI(1, 0, 2, 0, 1, 1, 0, 1, BCI_TYPE_LONG),	// lload_1
+	BCI(1, 0, 2, 0, 1, 1, 0, 2, BCI_TYPE_LONG),	// lload_2
+	BCI(1, 0, 2, 0, 1, 1, 0, 3, BCI_TYPE_LONG),	// lload_3
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_FLOAT),	// fload_0
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_FLOAT),	// fload_1
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_FLOAT),	// fload_2
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_FLOAT),	// fload_3
+	BCI(1, 0, 2, 0, 1, 1, 0, 0, BCI_TYPE_DOUBLE),	// dload_0
+	BCI(1, 0, 2, 0, 1, 1, 0, 1, BCI_TYPE_DOUBLE),	// dload_1
+	BCI(1, 0, 2, 0, 1, 1, 0, 2, BCI_TYPE_DOUBLE),	// dload_2
+	BCI(1, 0, 2, 0, 1, 1, 0, 3, BCI_TYPE_DOUBLE),	// dload_3
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_REF),	// aload_0
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_REF),	// aload_1
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_REF),	// aload_2
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_REF),	// aload_3
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iaload
+	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// laload
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// faload
+	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// daload
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// aaload
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// baload
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// caload
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// saload
+	BCI(2, 1, 0, 0, 1, 0, 1, 0, BCI_TYPE_INT),	// istore
+	BCI(2, 2, 0, 0, 1, 0, 1, 0, BCI_TYPE_LONG),	// lstore
+	BCI(2, 1, 0, 0, 1, 0, 1, 0, BCI_TYPE_FLOAT),	// fstore
+	BCI(2, 2, 0, 0, 1, 0, 1, 0, BCI_TYPE_DOUBLE),	// dstore
+	BCI(2, 1, 0, 0, 1, 0, 1, 0, BCI_TYPE_REF),	// astore
+	BCI(1, 1, 0, 0, 1, 1, 1, 0, BCI_TYPE_INT),	// istore_0
+	BCI(1, 1, 0, 0, 1, 1, 1, 1, BCI_TYPE_INT),	// istore_1
+	BCI(1, 1, 0, 0, 1, 1, 1, 2, BCI_TYPE_INT),	// istore_2
+	BCI(1, 1, 0, 0, 1, 1, 1, 3, BCI_TYPE_INT),	// istore_3
+	BCI(1, 2, 0, 0, 1, 1, 1, 0, BCI_TYPE_LONG),	// lstore_0
+	BCI(1, 2, 0, 0, 1, 1, 1, 1, BCI_TYPE_LONG),	// lstore_1
+	BCI(1, 2, 0, 0, 1, 1, 1, 2, BCI_TYPE_LONG),	// lstore_2
+	BCI(1, 2, 0, 0, 1, 1, 1, 3, BCI_TYPE_LONG),	// lstore_3
+	BCI(1, 1, 0, 0, 1, 1, 1, 0, BCI_TYPE_FLOAT),	// fstore_0
+	BCI(1, 1, 0, 0, 1, 1, 1, 1, BCI_TYPE_FLOAT),	// fstore_1
+	BCI(1, 1, 0, 0, 1, 1, 1, 2, BCI_TYPE_FLOAT),	// fstore_2
+	BCI(1, 1, 0, 0, 1, 1, 1, 3, BCI_TYPE_FLOAT),	// fstore_3
+	BCI(1, 2, 0, 0, 1, 1, 1, 0, BCI_TYPE_DOUBLE),	// dstore_0
+	BCI(1, 2, 0, 0, 1, 1, 1, 1, BCI_TYPE_DOUBLE),	// dstore_1
+	BCI(1, 2, 0, 0, 1, 1, 1, 2, BCI_TYPE_DOUBLE),	// dstore_2
+	BCI(1, 2, 0, 0, 1, 1, 1, 3, BCI_TYPE_DOUBLE),	// dstore_3
+	BCI(1, 1, 0, 0, 1, 1, 1, 0, BCI_TYPE_REF),	// astore_0
+	BCI(1, 1, 0, 0, 1, 1, 1, 1, BCI_TYPE_REF),	// astore_1
+	BCI(1, 1, 0, 0, 1, 1, 1, 2, BCI_TYPE_REF),	// astore_2
+	BCI(1, 1, 0, 0, 1, 1, 1, 3, BCI_TYPE_REF),	// astore_3
+	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// iastore
+	BCI(1, 4, 0, 0, 0, 0, 0, 0, 0),	// dastore
+	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// fastore
+	BCI(1, 4, 0, 0, 0, 0, 0, 0, 0),	// lastore
+	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// aastore
+	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// bastore
+	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// castore
+	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// sastore
+	BCI(1, 1, 0, 0, 0, 0, 0, 0, 0),	// pop
+	BCI(1, 2, 0, 0, 0, 0, 0, 0, 0),	// pop2
+	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// dup
+	BCI(1, 2, 3, 0, 0, 0, 0, 0, 0),	// dup_x1
+	BCI(1, 3, 4, 0, 0, 0, 0, 0, 0),	// dup_x2
+	BCI(1, 2, 4, 0, 0, 0, 0, 0, 0),	// dup2
+	BCI(1, 3, 5, 0, 0, 0, 0, 0, 0),	// dup2_x1
+	BCI(1, 4, 6, 0, 0, 0, 0, 0, 0),	// dup2_x2
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// swap
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iadd
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// ladd
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fadd
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dadd
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// isub
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lsub
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fsub
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dsub
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// imul
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lmul
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fmul
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dmul
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// idiv
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// ldiv
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fdiv
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// ddiv
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// irem
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lrem
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// frem
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// drem
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// ineg
+	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// lneg
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// fneg
+	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// dneg
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ishl
+	BCI(1, 3, 2, 0, 0, 0, 0, 0, 0),	// lshl
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ishr
+	BCI(1, 3, 2, 0, 0, 0, 0, 0, 0),	// lshr
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iushr
+	BCI(1, 3, 2, 0, 0, 0, 0, 0, 0),	// lushr
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iand
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// land
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ior
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lor
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ixor
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lxor
+	BCI(3, 0, 0, 0, 1, 0, 1, 0, BCI_TYPE_INT),	// iinc
+	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// i2l
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2f
+	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// i2d
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// l2i
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// l2f
+	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// l2d
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// f2i
+	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// f2l
+	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// f2d
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// d2i
+	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// d2l
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// d2f
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2b
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2c
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2s
+	BCI(1, 4, 1, 0, 0, 0, 0, 0, 0),	// lcmp
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fcmpl
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fcmpg
+	BCI(1, 4, 1, 0, 0, 0, 0, 0, 0),	// dcmpl
+	BCI(1, 4, 1, 0, 0, 0, 0, 0, 0),	// dcmpg
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifeq
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifne
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// iflt
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifge
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifgt
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifle
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpeq
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpne
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmplt
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpge
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpgt
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmple
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_acmpeq
+	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_acmpne
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// goto
+	BCI(3, 0, 1, 1, 0, 0, 0, 0, 0),	// jsr
+	BCI(2, 0, 0, 1, 0, 0, 0, 0, 0),	// ret
+	BCI(0, 1, 0, 1, 0, 0, 0, 0, 0),	// tableswitch
+	BCI(0, 1, 0, 1, 0, 0, 0, 0, 0),	// lookupswitch
+	BCI(1, 1, 0, 1, 0, 0, 0, 0, 0),	// ireturn
+	BCI(1, 2, 0, 1, 0, 0, 0, 0, 0),	// lreturn
+	BCI(1, 1, 0, 1, 0, 0, 0, 0, 0),	// freturn
+	BCI(1, 2, 0, 1, 0, 0, 0, 0, 0),	// dreturn
+	BCI(1, 1, 0, 1, 0, 0, 0, 0, 0),	// areturn
+	BCI(1, 0, 0, 1, 0, 0, 0, 0, 0),	// return
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// getstatic
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// putstatic
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// getfield
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// putfield
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokevirtual
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokespecial
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokestatic
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokeinterface
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// xxxunusedxxx
+	BCI(3, 0, 1, 0, 0, 0, 0, 0, 0),	// new
+	BCI(2, 1, 1, 0, 0, 0, 0, 0, 0),	// newarray
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// anewarray
+	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// arraylength
+	BCI(1, 1, 1, 1, 0, 0, 0, 0, 0),	// athrow
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// checkcast
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// instanceof
+	BCI(1, 1, 0, 0, 0, 0, 0, 0, 0),	// monitorenter
+	BCI(1, 1, 0, 0, 0, 0, 0, 0, 0),	// monitorexit
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// wide
+	BCI(4, 0, 0, 1, 0, 0, 0, 0, 0),	// multianewarray
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifnull
+	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifnonnull
+	BCI(5, 0, 0, 1, 0, 0, 0, 0, 0),	// goto_w
+	BCI(5, 0, 0, 1, 0, 0, 0, 0, 0),	// jsr_w
+	BCI(1, 0, 0, 1, 0, 0, 0, 0, 0),	// breakpoint
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xcb
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// bgetfield
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// cgetfield
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xce
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xcf
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// igetfield
+	BCI(3, 1, 2, 0, 0, 0, 0, 0, 0),	// lgetfield
+	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// sgetfield
+	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// aputfield
+	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// bputfield
+	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// cputfield
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xd6
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xd7
+	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// iputfield
+	BCI(3, 3, 0, 0, 0, 0, 0, 0, 0),	// lputfield
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xda
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_REF),	// iaccess_0
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_REF),	// iaccess_1
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_REF),	// iaccess_2
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_REF),	// iaccess_3
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokeresolved
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokespecialresolved
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokestaticresolved
+	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokevfinal
+	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload_iload
+	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload_iload_N
+	BCI(1, 0, 0, 1, 0, 0, 0, 0, 0),	// return_register_finalizer
+	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dmac
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0_iconst_N
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1_iconst_N
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2_iconst_N
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3_iconst_N
+	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload_iconst_N
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iadd_istore_N
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// isub_istore_N
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iand_istore_N
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ior_istore_N
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ixor_istore_N
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iadd_u4store
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// isub_u4store
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iand_u4store
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ior_u4store
+	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ixor_u4store
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0_iload
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1_iload
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2_iload
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3_iload
+	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0_iload_N
+	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1_iload_N
+	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2_iload_N
+	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3_iload_N
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// impdep1
+	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// impdep2
+};
+
+void Thumb2_pass1(Thumb2_Info *jinfo, unsigned bci)
+{
+  unsigned code_size = jinfo->code_size;
+  jubyte *code_base = jinfo->code_base;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+  unsigned *locals_info = jinfo->locals_info;
+  //constantPoolCacheOop cp = jinfo->method->constants()->cache();
+
+  bc_stackinfo[bci] |= BC_BRANCH_TARGET;
+  while (bci < code_size) {
+    unsigned stackinfo = bc_stackinfo[bci];
+    unsigned bytecodeinfo;
+    unsigned opcode;
+
+    if (stackinfo & BC_VISITED_P1) break;
+    bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | BC_VISITED_P1;
+    opcode = code_base[bci];
+//	printf("bci = 0x%04x, opcode = 0x%02x (%s)", bci, opcode,  Bytecodes::name((Bytecodes::Code)opcode));
+    bytecodeinfo = bcinfo[opcode];
+    if (!BCI_SPECIAL(bytecodeinfo)) {
+      bci += BCI_LEN(bytecodeinfo);
+      continue;
+    }
+
+    switch (opcode) {
+
+      case opc_goto: {
+	int off = GET_JAVA_S2(code_base+bci+1);
+	bci += off;
+	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
+	if (off < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
+	break;
+      }
+      case opc_goto_w: {
+	int off = GET_JAVA_U4(code_base+bci+1);
+	bci += off;
+	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
+	if (off < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
+	break;
+      }
+
+      case opc_if_icmpeq:
+      case opc_if_icmpne:
+      case opc_if_icmplt:
+      case opc_if_icmpge:
+      case opc_if_icmpgt:
+      case opc_if_icmple:
+      case opc_if_acmpeq:
+      case opc_if_acmpne:
+      case opc_ifeq:
+      case opc_ifne:
+      case opc_iflt:
+      case opc_ifge:
+      case opc_ifgt:
+      case opc_ifle:
+      case opc_ifnull:
+      case opc_ifnonnull: {
+	int off = GET_JAVA_S2(code_base+bci+1);
+	if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
+	Thumb2_pass1(jinfo, bci + off);
+	bci += 3;
+	break;
+      }
+
+      case opc_jsr: {
+	int off = GET_JAVA_S2(code_base+bci+1);
+	if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
+	Thumb2_pass1(jinfo, bci + off);
+	bci += 3;
+	break;
+      }
+      case opc_jsr_w: {
+	int off = GET_JAVA_U4(code_base+bci+1);
+	if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
+	Thumb2_pass1(jinfo, bci + off);
+	bci += 5;
+	break;
+      }
+
+      case opc_ireturn:
+      case opc_lreturn:
+      case opc_freturn:
+      case opc_dreturn:
+      case opc_areturn:
+      case opc_return:
+      case opc_return_register_finalizer:
+      case opc_ret:
+      case opc_athrow:
+	// The test for BC_VISITED_P1 above will break out of the loop!!!
+	break;
+
+      case opc_tableswitch: {
+	int low, high;
+	unsigned w;
+	unsigned *table;
+	unsigned nbci;
+	int def;
+
+	nbci = bci & ~3;
+	w = *(unsigned int *)(code_base + nbci + 8);
+	low = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 12);
+	high = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 4);
+	def = (int)BYTESEX_REVERSE(w);
+	table = (unsigned int *)(code_base + nbci + 16);
+
+	while (low <= high) {
+	  int off;
+	  w = *table++;
+	  off = (int)BYTESEX_REVERSE(w);
+	  if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
+	  Thumb2_pass1(jinfo, bci + off);
+	  low++;
+	}
+
+	bci += def;
+	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
+	if (def < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
+	break;
+      }
+
+      case opc_lookupswitch: {
+	unsigned w;
+	unsigned nbci;
+	int def;
+	int npairs;	// The Java spec says signed but must be >= 0??
+	unsigned *table;
+
+	nbci = bci & ~3;
+	w = *(unsigned int *)(code_base + nbci + 4);
+	def = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 8);
+	npairs = (int)BYTESEX_REVERSE(w);
+	table = (unsigned int *)(code_base + nbci + 16);
+
+	for (int i = 0; i < npairs; i++) {
+	  int off;
+	  w = *table;
+	  table += 2;
+	  off = (int)BYTESEX_REVERSE(w);
+	  if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
+	  Thumb2_pass1(jinfo, bci + off);
+	}
+
+	bci += def;
+	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
+	if (def < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
+	break;
+      }
+
+      case opc_getstatic:
+      case opc_putstatic:
+      case opc_getfield:
+      case opc_putfield: {
+	bci += 3;
+	break;
+      }
+
+      case opc_invokeresolved:
+      case opc_invokespecialresolved:
+      case opc_invokestaticresolved:
+      case opc_invokevfinal:
+      case opc_invokevirtual:
+      case opc_invokespecial:
+      case opc_invokestatic:
+	jinfo->is_leaf = 0;
+	bci += 3;
+	break;
+
+      case opc_invokeinterface:
+	jinfo->is_leaf = 0;
+	bci += 5;
+	break;
+
+      case opc_multianewarray:
+	bci += 4;
+	break;
+
+      case opc_wide:
+	opcode = code_base[bci+1];
+	if (opcode == opc_iinc) {
+	  bci += 6;
+	} else {
+	  bci += 4;
+	}
+	break;
+
+      default:
+	opcode = code_base[bci];
+	fatal1("Undefined opcode %d\n", opcode);
+	break;
+    }
+  }
+}
+
+#ifdef ZOMBIE_DETECTION
+int Thumb2_is_zombie(Thumb2_Info *jinfo, unsigned bci)
+{
+  unsigned code_size = jinfo->code_size;
+  jubyte *code_base = jinfo->code_base;
+  unsigned bytecodeinfo;
+  unsigned opcode;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+
+  do {
+    opcode = code_base[bci];
+    // Short circuit exit - commented out because even if it has been executed
+    // we treat throw, jsr, and ret as zombies because they will call out to the
+    // interpreter.
+    // if (opcode > OPC_LAST_JAVA_OP) return 0;
+    bytecodeinfo = bcinfo[opcode];
+    if (!BCI_SPECIAL(bytecodeinfo)) {
+	bci += BCI_LEN(bytecodeinfo);
+#if 0
+	if (opcode >= opc_iload_iload) {
+	  opcode = code_base[bci];
+	  bci += BCI_LEN(bcinfo[opcode]);
+	} else if (BCI_ISLOCAL(bytecodeinfo)) {
+	  if (opcode == opc_iload || (opcode >= opc_iload_0 && opcode <= opc_iload_3)) {
+	    opcode = code_base[bci];
+	    if (opcode == opc_iload || (opcode >= opc_iload_0 && opcode <= opc_iload_3) ||
+					(opcode >= opc_iconst_m1 && opcode <= opc_iconst_5)) {
+		printf("found new zombie at %d\n", bci);
+		return 1;
+	    }
+	  }
+	} else if (opcode == opc_iadd || opcode == opc_isub ||
+		      opcode == opc_iand || opcode == opc_ior || opcode == opc_ixor) {
+	    opcode = code_base[bci];
+	    if (opcode == opc_istore || (opcode >= opc_istore_0 && opcode <= opc_istore_3)) {
+		printf("found new zombie at %d\n", bci);
+		return 1;
+	    }
+	}
+#endif
+    } else {
+      switch (opcode) {
+	case opc_goto:
+	case opc_goto_w:
+	case opc_ifeq:
+	case opc_ifne:
+	case opc_iflt:
+	case opc_ifge:
+	case opc_ifgt:
+	case opc_ifle:
+	case opc_ifnull:
+	case opc_ifnonnull:
+	case opc_if_icmpeq:
+	case opc_if_icmpne:
+	case opc_if_icmplt:
+	case opc_if_icmpge:
+	case opc_if_icmpgt:
+	case opc_if_icmple:
+	case opc_if_acmpeq:
+	case opc_if_acmpne:
+	case opc_tableswitch:
+	case opc_lookupswitch:
+	  return 0;
+	case opc_ireturn:
+	case opc_lreturn:
+	case opc_freturn:
+	case opc_dreturn:
+	case opc_areturn:
+	case opc_return:
+	case opc_return_register_finalizer:
+	    return 0;
+	case opc_jsr:
+	case opc_jsr_w:
+	case opc_ret:
+	case opc_athrow:
+	    return 1;
+	case opc_invokeinterface:
+	case opc_invokevirtual:
+	case opc_invokespecial:
+	case opc_invokestatic:
+	case opc_putfield:
+	case opc_getfield:
+	case opc_putstatic:
+	case opc_getstatic: {
+	  constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+	  ConstantPoolCacheEntry* cache;
+	  int index = GET_NATIVE_U2(code_base+bci+1);
+
+	  cache = cp->entry_at(index);
+	  if (!cache->is_resolved((Bytecodes::Code)opcode)) return 1;
+	  bci += 3;
+	  if (opcode == opc_invokeinterface) bci += 2;
+	  break;
+
+	}
+	case opc_invokeresolved:
+	case opc_invokespecialresolved:
+	case opc_invokestaticresolved:
+	case opc_invokevfinal:
+	  bci += 3;
+	  break;
+
+	case opc_multianewarray:
+	  bci += 4;
+	  break;
+
+	case opc_wide:
+	  opcode = code_base[bci+1];
+	  if (opcode == opc_iinc) {
+	    bci += 6;
+	  } else {
+	    bci += 4;
+	  }
+	  break;
+
+	default:
+	  opcode = code_base[bci];
+	  fatal1("Undefined opcode %d\n", opcode);
+	  break;
+      }
+    }
+    if (bci >= code_size) break;
+  } while (!(bc_stackinfo[bci] & BC_BRANCH_TARGET));
+  return 0;
+}
+#endif // ZOMBIT_DETECTION
+
+void Thumb2_RegAlloc(Thumb2_Info *jinfo)
+{
+  unsigned *locals_info = jinfo->locals_info;
+  unsigned i, j;
+  unsigned linfo;
+  unsigned score, max_score;
+  unsigned local;
+  unsigned nlocals = jinfo->method->max_locals();
+  unsigned *pregs = jinfo->jregs->pregs;
+  unsigned npregs = jinfo->jregs->npregs;
+
+  for (i = 0; i < npregs; i++) jinfo->jregs->mapping[i] = -1;
+  for (i = 0; i < npregs; i++) {
+    max_score = 0;
+    for (j = 0; j < nlocals; j++) {
+      linfo = locals_info[j];
+
+      if (linfo & ((1<<LOCAL_ALLOCATED)|(1<<LOCAL_DOUBLE))) continue;
+      score = LOCAL_READS(linfo) + LOCAL_WRITES(linfo);
+      if (linfo & (1<<LOCAL_MODIFIED)) score = (score+1) >> 2;
+      if (linfo & (1<<LOCAL_REF)) score = score - (score >> 2);
+      if (linfo & (1<<LOCAL_LONG)) score = (score+1) >> 2;
+      if (score > max_score) max_score = score, local = j;
+    }
+    if (max_score < 2) break;
+    locals_info[local] |= 1<<LOCAL_ALLOCATED;
+    jinfo->jregs->r_local[local] = pregs[i];
+    jinfo->jregs->mapping[i] = local;
+  }
+#ifdef T2EE_PRINT_REGUSAGE
+  if (t2ee_print_regusage) {
+    printf("Regalloc: %d physical registers allocated as follows\n", npregs);
+    for (j = 0; j < nlocals; j++) {
+      unsigned r = jinfo->jregs->r_local[j];
+      if (r) {
+	unsigned typ = (locals_info[j] >> LOCAL_INT) & 0x1f;
+	printf("  ARM Reg R%d -> local %d (type = %s)\n", r, j, local_types[LOG2(typ)]);
+      }
+    }
+  }
+#endif
+}
+
+void Thumb2_pass2(Thumb2_Info *jinfo, unsigned stackdepth, unsigned bci)
+{
+  unsigned code_size = jinfo->code_size;
+  jubyte *code_base = jinfo->code_base;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+  unsigned *locals_info = jinfo->locals_info;
+  unsigned check_zombie = 0;
+  //constantPoolCacheOop cp = jinfo->method->constants()->cache();
+
+  while (bci < code_size) {
+    unsigned stackinfo = bc_stackinfo[bci];
+    unsigned bytecodeinfo;
+    unsigned opcode;
+
+    if (stackinfo & BC_VISITED_P2) break;
+    JASSERT((int)stackdepth >= 0, "stackdepth < 0!!");
+    bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | stackdepth | BC_VISITED_P2;
+#ifdef ZOMBIE_DETECTION
+    if (check_zombie || (stackinfo & BC_BRANCH_TARGET)) {
+      if (Thumb2_is_zombie(jinfo, bci)) {
+	printf("zombie code at %d\n", bci);
+	bc_stackinfo[bci] |= BC_ZOMBIE;
+	return;
+      }
+      check_zombie = 0;
+    }
+#endif
+    opcode = code_base[bci];
+//	printf("bci = 0x%04x, opcode = 0x%02x (%s), stackdepth = %d\n", bci, opcode,  Bytecodes::name((Bytecodes::Code)opcode), stackdepth);
+    bytecodeinfo = bcinfo[opcode];
+    if (!BCI_SPECIAL(bytecodeinfo)) {
+      if (BCI_ISLOCAL(bytecodeinfo)) {
+	unsigned local = BCI_LOCAL_N(bytecodeinfo);
+	unsigned local_type = BCI_LOCAL_TYPE(bytecodeinfo) + LOCAL_INT;
+	unsigned local_modified = 0;
+	unsigned linfo;
+	unsigned read_count, write_count;
+
+	if (!BCI_ISLOCAL_N(bytecodeinfo)) local = code_base[bci+1];
+	if (BCI_ISSTORE(bytecodeinfo)) local_modified = 1U << LOCAL_MODIFIED;
+	linfo = locals_info[local];
+	read_count = LOCAL_READS(linfo);
+	write_count = LOCAL_WRITES(linfo);
+	if (local_modified)
+	  write_count = LOCAL_INC_COUNT(write_count);
+	else
+	  read_count = LOCAL_INC_COUNT(read_count);
+	
+	locals_info[local] |= (1 << local_type) | LOCAL_SET_COUNTS(read_count, write_count) | local_modified;
+	if (local_type == LOCAL_LONG || local_type == LOCAL_DOUBLE) {
+	  locals_info[local+1] |= (1 << local_type) | LOCAL_SET_COUNTS(read_count, write_count) | local_modified;
+	}
+      }
+      bci += BCI_LEN(bytecodeinfo);
+      stackdepth += BCI_PUSH(bytecodeinfo) - BCI_POP(bytecodeinfo);
+      JASSERT(stackdepth <= (unsigned)jinfo->method->max_stack(), "stack over/under flow?");
+      continue;
+    }
+
+    switch (opcode) {
+
+      case opc_goto:
+	bci += GET_JAVA_S2(code_base+bci+1);
+	break;
+      case opc_goto_w:
+	bci += GET_JAVA_U4(code_base+bci+1);
+	break;
+
+      case opc_ifeq:
+      case opc_ifne:
+      case opc_iflt:
+      case opc_ifge:
+      case opc_ifgt:
+      case opc_ifle:
+      case opc_ifnull:
+      case opc_ifnonnull:
+	stackdepth -= 1;
+	Thumb2_pass2(jinfo, stackdepth, bci + GET_JAVA_S2(code_base+bci+1));
+	check_zombie = 1;
+	bci += 3;
+	break;
+
+      case opc_if_icmpeq:
+      case opc_if_icmpne:
+      case opc_if_icmplt:
+      case opc_if_icmpge:
+      case opc_if_icmpgt:
+      case opc_if_icmple:
+      case opc_if_acmpeq:
+      case opc_if_acmpne:
+	stackdepth -= 2;
+	Thumb2_pass2(jinfo, stackdepth, bci + GET_JAVA_S2(code_base+bci+1));
+	check_zombie = 1;
+	bci += 3;
+	break;
+
+      case opc_jsr:
+	Thumb2_pass2(jinfo, stackdepth+1, bci + GET_JAVA_S2(code_base+bci+1));
+	bci += 3;
+	stackdepth = 0;
+	break;
+      case opc_jsr_w:
+	Thumb2_pass2(jinfo, stackdepth+1, bci + GET_JAVA_U4(code_base+bci+1));
+	bci += 5;
+	break;
+
+      case opc_ireturn:
+      case opc_lreturn:
+      case opc_freturn:
+      case opc_dreturn:
+      case opc_areturn:
+      case opc_return:
+      case opc_return_register_finalizer:
+      case opc_ret:
+      case opc_athrow:
+	// The test for BC_VISITED_P2 above will break out of the loop!!!
+	break;
+
+      case opc_tableswitch: {
+	int low, high;
+	unsigned w;
+	unsigned *table;
+	unsigned nbci;
+	int def;
+
+	stackdepth -= 1;
+	nbci = bci & ~3;
+	w = *(unsigned int *)(code_base + nbci + 8);
+	low = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 12);
+	high = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 4);
+	def = (int)BYTESEX_REVERSE(w);
+	table = (unsigned int *)(code_base + nbci + 16);
+
+	while (low <= high) {
+	  int off;
+	  w = *table++;
+	  off = (int)BYTESEX_REVERSE(w);
+	  Thumb2_pass2(jinfo, stackdepth, bci + off);
+	  low++;
+	}
+
+	check_zombie = 1;
+	bci += def;
+	break;
+      }
+
+      case opc_lookupswitch: {
+	unsigned w;
+	unsigned nbci;
+	int def;
+	int npairs;	// The Java spec says signed but must be >= 0??
+	unsigned *table;
+
+	stackdepth -= 1;
+	nbci = bci & ~3;
+	w = *(unsigned int *)(code_base + nbci + 4);
+	def = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 8);
+	npairs = (int)BYTESEX_REVERSE(w);
+	table = (unsigned int *)(code_base + nbci + 16);
+
+	for (int i = 0; i < npairs; i++) {
+	  int off;
+	  w = *table;
+	  table += 2;
+	  off = (int)BYTESEX_REVERSE(w);
+	  Thumb2_pass2(jinfo, stackdepth, bci + off);
+	}
+
+	check_zombie = 1;
+	bci += def;
+	break;
+      }
+
+      case opc_getstatic:
+      case opc_putstatic:
+      case opc_getfield:
+      case opc_putfield: {
+	int index = GET_JAVA_U2(code_base+bci+1);
+	constantPoolOop pool = jinfo->method->constants();
+	symbolOop sig = pool->signature_ref_at(index);
+	jbyte *base = sig->base();
+	jbyte c = *base;
+	int stackchange;
+
+	opcode = code_base[bci];
+	if (opcode == opc_getfield || opcode == opc_putfield)
+	  stackdepth -= 1;
+	stackchange = 1;
+	if (c == 'J' || c == 'D') stackchange = 2;
+	if (opcode == opc_getfield || opcode == opc_getstatic)
+	  stackdepth += stackchange;
+	else
+	  stackdepth -= stackchange;
+	bci += 3;
+	break;
+      }
+
+      case opc_invokeresolved:
+      case opc_invokespecialresolved:
+      case opc_invokestaticresolved:
+      case opc_invokevfinal:
+      case opc_invokeinterface:
+      case opc_invokevirtual:
+      case opc_invokespecial:
+      case opc_invokestatic: {
+	int index = GET_JAVA_U2(code_base+bci+1);
+	constantPoolOop pool = jinfo->method->constants();
+	//symbolOop name = pool->name_ref_at(index);
+	symbolOop sig = pool->signature_ref_at(index);
+	jbyte *base = sig->base();
+
+	//tty->print("%d: %s: %s\n", opcode, name->as_C_string(), sig->as_C_string());
+	stackdepth += method_stackchange(base);
+	opcode = code_base[bci];
+	bci += 3;
+	if (opcode == opc_invokeinterface) bci += 2;
+	if (opcode != opc_invokestatic && opcode != opc_invokestaticresolved)
+	  stackdepth -= 1;
+	break;
+      }
+
+      case opc_multianewarray:
+	stackdepth = (stackdepth - code_base[bci+3]) + 1;
+	bci += 4;
+	break;
+
+      case opc_wide:
+	opcode = code_base[bci+1];
+	if (opcode == opc_iinc) {
+	  bci += 6;
+	} else {
+	  bci += 4;
+	  if (opcode == opc_iload ||
+	  	opcode == opc_fload || opcode == opc_aload)
+	    stackdepth += 1;
+	  else if (opcode == opc_lload || opcode == opc_dload)
+	    stackdepth += 2;
+	  else if (opcode == opc_istore ||
+	  	opcode == opc_fstore || opcode == opc_astore)
+	    stackdepth -= 1;
+	  else if (opcode == opc_lstore || opcode == opc_dstore)
+	    stackdepth -= 2;
+	  else if (opcode != opc_ret)
+	    fatal1("Undefined wide opcode %d\n", opcode);
+	}
+	break;
+
+      default:
+	opcode = code_base[bci];
+	fatal1("Undefined opcode %d\n", opcode);
+	break;
+    }
+  }
+}
+
+//-------------------------------------------------------------------------------------
+
+#define Thumb2		1
+#define ThumbEE		0
+
+#define	DA	0
+#define	IA	1
+#define DB	2
+#define IB	3
+
+#define	PUSH_ED	0
+#define PUSH_EA	1
+#define	PUSH_FD	2
+#define	PUSH_FA	3
+
+#define	POP_FA	0
+#define	POP_FD	1
+#define	POP_EA	2
+#define	POP_ED	3
+
+#define ROR(imm, sh) (((imm) >> (sh)) | ((imm) << (32 - (sh))))
+#define ROL(imm, sh) (((imm) << (sh)) | ((imm) >> (32 - (sh))))
+
+#define abs(i) ((i) < 0 ? -(i) : (i))
+#define U(i) ((i) < 0 ? 0 : 1)
+
+#define LS_STR		0
+#define	LS_STRB		1
+#define	LS_STRH		2
+#define LS_LDRSB	3
+#define	LS_LDR		4
+#define LS_LDRB		5
+#define	LS_LDRH		6
+#define LS_LDRSH	7
+
+#define LS_IS_LDR(op)	((op) >= LS_LDRSB)
+#define LS_IS_WORD(op)	(((op) & 3) == LS_STR)
+#define LS_IS_BYTE(op)	(((op) & 3) == LS_STRB || (op) == LS_LDRSB)
+#define LS_IS_HW(op)	(((op) & 3) == LS_STRH || (op) == LS_LDRSH)
+
+static const unsigned t_ls_ops[16] = {
+	0x5000,		0xf8400000,
+	0x5400,		0xf8000000,
+	0x5200,		0xf8200000,
+	0x5600,		0xf9100000,
+	0x5800,		0xf8500000,
+	0x5c00,		0xf8100000,
+	0x5a00,		0xf8300000,
+	0x5e00,		0xf9300000,
+};
+
+#define DP_ADC	0
+#define DP_ADD	1
+#define DP_AND	2
+#define DP_ASR	3
+#define DP_BIC	4
+#define DP_CMN	5
+#define DP_CMP	6
+#define DP_EOR	7
+#define DP_LSL	8
+#define DP_LSR	9
+#define DP_MOV	10
+#define DP_MVN	11
+#define DP_ORN	12
+#define DP_ORR	13
+#define DP_ROR	14
+#define DP_RSB	15
+#define DP_SBC	16
+#define DP_SUB	17
+#define DP_TEQ	18
+#define DP_TST	19
+#define DP_MUL	20
+
+static const unsigned n_ops[] = {
+	DP_SBC,		// ADC	x, y == SBC x, ~y
+	DP_SUB,		// ADD	x, y == SUB x, -y
+	DP_BIC,		// AND	x, y == BIX x, ~y
+	(unsigned)-1,	// ASR
+	DP_AND,		// BIC	x, y == AND x, ~y
+	DP_CMP,		// CMN	x, y == CMP x, -y
+	DP_CMN,		// CMP	x, y == CMN x, -y
+	(unsigned)-1,	// EOR
+	(unsigned)-1,	// LSL
+	(unsigned)-1,	// LSR
+	DP_MVN,		// MOV	x, y == MVN x, ~y
+	DP_MOV,		// MVN	x, y == MOV x, ~y
+	DP_ORR,		// ORN	x, y == ORR x, ~y
+	DP_ORN,		// ORR	x, y == ORN x, ~y
+	(unsigned)-1,	// ROR
+	(unsigned)-1,	// RSB
+	DP_ADC,		// SBC	x, y == ADC x, ~y
+	DP_ADD,		// ADD	x, y == SUB x, -y
+	(unsigned)-1,	// TEQ
+	(unsigned)-1,	// TST
+	(unsigned)-1,	// MUL
+};
+
+#define N_OP(op)	n_ops[(op)]
+
+static const unsigned t_dop_ops[] = {
+//	Rd, Rm, #N	Rd, Rn, Rm
+	0xf1400000,	0xeb400000,	// ADC
+	0xf1000000,	0xeb000000,	// ADD
+	0xf0000000,	0xea000000,	// AND
+	0xea4f0020,	0xfa40f000,	// ASR
+	0xf0200000,	0xea200000,	// BIC
+	0xf1100f00,	0xeb100f00,	// CMN
+	0xf1b00f00,	0xebb00f00,	// CMP
+	0xf0800000,	0xea800000,	// EOR
+	0xea4f0000,	0xfa00f000,	// LSL
+	0xea4f0010,	0xfa20f000,	// LSR
+	0xf04f0000,	0xea4f0000,	// MOV
+	0xf06f0000,	0xea6f0000,	// MVN
+	0xf0600000,	0xea600000,	// ORN
+	0xf0400000,	0xea400000,	// ORR
+	0xea4f0030,	0xfa6f0000,	// ROR
+	0xf1c00000,	0xebc00000,	// RSB
+	0xf1600000,	0xeb600000,	// SBC
+	0xf1a00000,	0xeba00000,	// SUB
+	0xf0900f00,	0xea900f00,	// TEQ
+	0xf0100f00,	0xea100f00,	// TST
+	(unsigned)-1,	0xfb00f000,	// MUL
+};
+
+#define DP_IMM(op)	t_dop_ops[(op)*2]
+#define DP_REG(op)	t_dop_ops[(op)*2+1]
+
+#define VP_ADD	0
+#define VP_SUB	1
+#define VP_MUL	2
+#define VP_DIV	3
+
+static const unsigned t_vop_ops[] = {
+	0xee300a00,			// VADD
+	0xee300a40,			// VSUB
+	0xee200a00,			// VMUL
+	0xee800a00,			// VDIV
+};
+
+#define VP_REG(op)	t_vop_ops[op]
+
+#define T1_LS_OP(op)	t_ls_ops[(op)*2]
+#define T2_LS_OP(op)	t_ls_ops[(op)*2+1]
+
+#define SHIFT_LSL	0
+#define SHIFT_LSR	1
+#define SHIFT_ASR	2
+#define SHIFT_ROR	3
+#define SHIFT_RRX	3
+
+//------------------------------------------------------------------------------------
+
+#define TBIT 1
+
+#define E_STR_IMM6(src, imm6)		(0xce00 | ((imm6)<<3) | (src))
+#define E_LDR_IMM6(dst, imm6)		(0xcc00 | ((imm6)<<3) | (dst))
+#define E_LDR_IMM5(dst, imm5)		(0xcb00 | ((imm5)<<3) | (dst))
+#define E_LDR_IMM3(dst, base, imm3)	(0xc800 | ((imm3)<<6) | ((base) << 3) | (dst))
+
+#define T_MOV_IMM8(r, imm8)		(0x2000 | ((r)<<8) | (imm8))
+#define T_MOV_BYTELANE(r, typ, b)	(0xf04f0000 | ((typ) << 12) | ((r) << 8) | (b))
+#define T_MOV_ROT_IMM(r, ror, imm)	\
+		(0xf04f0000 | (((ror) & 0x10) << (26-4)) | (((ror) & 0xe) << (12-1)) |	\
+		(((ror) & 1) << 7) | ((r) << 8) | ((imm) & 0x7f))
+#define T_MOVW_IMM16(r, imm)		\
+		(0xf2400000 | (((imm) & 0xf000) << (16-12)) | (((imm) & 0x800) << (26-11)) | \
+		(((imm) & 0x700) << (12-8)) | ((imm) & 0xff) | ((r) << 8))
+#define T_MOVT_IMM16(r, imm)		\
+		(0xf2c00000 | (((imm) & 0xf000) << (16-12)) | (((imm) & 0x800) << (26-11)) | \
+		(((imm) & 0x700) << (12-8)) | ((imm) & 0xff) | ((r) << 8))
+#define T_MVN_BYTELANE(r, typ, b)	(0xf06f0000 | ((typ) << 12) | ((r) << 8) | (b))
+#define T_MVN_ROT_IMM(r, ror, imm)	(0xf06f0000 | (((ror) & 0x10) << (26-4)) |	\
+		(((ror) & 0xe) << (12-1)) | (((ror) & 1) << 7) | ((r) << 8) | ((imm) & 0x7f))
+
+#define T_ORR_ROT_IMM(dst, src, ror, imm)	(0xf0400000 | (((ror) & 0x10) << (26-4)) | \
+		(((ror) & 0xe) << (12-1)) | (((ror) & 1) << 7) | ((src) << 16) |	\
+		((dst) << 8) | ((imm) & 0x7f))
+#define T_ORN_ROT_IMM(dst, src, ror, imm)	(0xf0600000 | (((ror) & 0x10) << (26-4)) | \
+		(((ror) & 0xe) << (12-1)) | (((ror) & 1) << 7) | ((src) << 16) |	\
+		((dst) << 8) | ((imm) & 0x7f))
+
+#define T_STR_IMM5(src, base, imm5)	(0x6000 | ((imm5) << 6) | ((base) << 3) | (src))
+#define T_STR_SP_IMM8(src, imm8)	(0x9000 | ((src) << 8) | (imm8))
+#define T_STR_IMM12(src, base, imm12)	(0xf8c00000 | ((src)<<12) | ((base)<<16) | (imm12))
+#define T_STR_IMM8(src, base, imm8, pre, wb)	(0xf8400800 | ((src)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_LDR_IMM5(dst, base, imm5)	(0x6800 | ((imm5) << 6) | ((base) << 3) | (dst))
+#define T_LDR_SP_IMM8(src, imm8)	(0x9800 | ((dst) << 8) | (imm8))
+#define T_LDR_IMM12(dst, base, imm12)	(0xf8d00000 | ((dst)<<12) | ((base)<<16) | (imm12))
+#define T_LDR_IMM8(src, base, imm8, pre, wb)	(0xf8500800 | ((dst)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_STRB_IMM5(src, base, imm5)	(0x7000 | ((imm5) << 6) | ((base) << 3) | (src))
+#define T_STRB_IMM12(src, base, imm12)	(0xf8800000 | ((src)<<12) | ((base)<<16) | (imm12))
+#define T_STRB_IMM8(src, base, imm8, pre, wb)	(0xf8000800 | ((src)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_LDRB_IMM5(dst, base, imm5)	(0x7800 | ((imm5) << 6) | ((base) << 3) | (dst))
+#define T_LDRB_IMM12(dst, base, imm12)	(0xf8900000 | ((dst)<<12) | ((base)<<16) | (imm12))
+#define T_LDRB_IMM8(dst, base, imm8, pre, wb)	(0xf8100800 | ((dst)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_STRH_IMM5(dst, base, imm5)	(0x8000 | ((imm5) << 6) | ((base) << 3) | (dst))
+#define T_STRH_IMM12(dst, base, imm12)	(0xf8a00000 | ((dst)<<12) | ((base)<<16) | (imm12))
+#define T_STRH_IMM8(dst, base, imm8, pre, wb)	(0xf8200800 | ((dst)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_LDRH_IMM5(dst, base, imm5)	(0x8800 | ((imm5) << 6) | ((base) << 3) | (dst))
+#define T_LDRH_IMM12(dst, base, imm12)	(0xf8b00000 | ((dst)<<12) | ((base)<<16) | (imm12))
+#define T_LDRH_IMM8(dst, base, imm8, pre, wb)	(0xf8300800 | ((dst)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_LDRSH_IMM12(dst, base, imm12)	(0xf9b00000 | ((dst)<<12) | ((base)<<16) | (imm12))
+#define T_LDRSH_IMM8(dst, base, imm8, pre, wb)	(0xf9300800 | ((dst)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_LDRSB_IMM12(dst, base, imm12)	(0xf9900000 | ((dst)<<12) | ((base)<<16) | (imm12))
+#define T_LDRSB_IMM8(dst, base, imm8, pre, wb)	(0xf9100800 | ((dst)<<12) | 		\
+		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
+
+#define T_LDRD_IMM(lo, hi, base, imm8, pre, wb)	(0xe8500000 | ((base)<<16) |		\
+		((lo) << 12) | ((hi)<<8) | ((pre)<<24) | (U(imm8)<<23) | ((wb)<<21) | abs(imm8))
+#define T_STRD_IMM(lo, hi, base, imm8, pre, wb)	(0xe8400000 | ((base)<<16) |		\
+		((lo) << 12) | ((hi)<<8) | ((pre)<<24) | (U(imm8)<<23) | ((wb)<<21) | abs(imm8))
+
+#define T_LDREX(dst, base, off) (0xe8500f00 | ((base) << 16) | ((dst) << 12) | ((off) >> 2))
+#define T_STREX(dst, src, base, off) (0xe8400000 | ((base) << 16) | \
+		((src) << 12) | ((dst) << 8) | ((off >> 2)))
+
+#define T_STM8(base, regset)		(0xc000 | ((base) << 8) | (regset))
+#define T_STM16(base, regset, st, wb)	(0xe8000000 | ((st) << 23) | ((wb) << 21) |	\
+		((base) << 16) | (regset))
+
+#define T_LDM8(base, regset)		(0xc800 | ((base) << 8) | (regset))
+#define	T_LDM16(base, regset, st, wb)	(0xe8100000 | ((st) << 23) | ((wb) << 21) |	\
+		((base) << 16) | (regset))
+#define T_POP(regset)	(0xbc00 | (((regset & (1<<ARM_PC)) >> ARM_PC) << 8) | (regset & 0xff))
+#define T_PUSH(regset)	(0xb400 | (((regset & (1<<ARM_LR)) >> ARM_LR) << 8) | (regset & 0xff))
+
+#define	T1_LDR_STR_REG(op, xfer, base, off) 	((op) | ((off) << 6) | ((base) << 3) | (xfer))
+#define T2_LDR_STR_REG(op, xfer, base, off, sh)	((op) | ((base) << 16) | ((xfer) << 12) | \
+		((sh)<<4) | (off))
+
+#define T_CHKA(size, idx)		(0xca00 | (((size) & 8) << (7-3)) | ((idx) << 3) | ((size) & 7))
+#define T_HBL(handler)			(0xc300 | (handler))
+#define T_ENTER_LEAVE(enter)		(0xf3bf8f0f | ((enter)<<4))
+
+#define T1_ADD_IMM(dst, src, imm3)	(0x1c00 | ((imm3) << 6) | ((src) << 3) | (dst))
+#define T2_ADD_IMM(r, imm8)		(0x3000 | ((r) << 8) | (imm8))
+#define T3_ADD_BYTELANE(dst, src, typ, b) (0xf1000000 | ((src) << 16) | ((typ) << 12) | \
+		((dst) << 8) | (b))
+#define T3_ADD_ROT_IMM(dst, src, ror, imm) (0xf1000000 | ((src) << 16) | ((dst) << 8) | \
+		(((ror) & 0x10) << (26-4)) | (((ror) & 0x0e) << (12-1)) | (((ror) & 1) << 7) | \
+		((imm) & 0x7f))
+#define T4_ADD_IMM(dst, src, imm)	(0xf2000000 | ((src) << 16) | ((dst) << 8) | \
+		(((imm) & 0x800) << (26-11)) | (((imm) & 0x700) << (12-8)) | ((imm) & 0xff))
+
+#define T1_SUB_IMM(dst, src, imm3)	(0x1e00 | ((imm3) << 6) | ((src) << 3) | (dst))
+#define T2_SUB_IMM(r, imm8)		(0x3800 | ((r) << 8) | (imm8))
+#define T3_SUB_BYTELANE(dst, src, typ, b) (0xf1a00000 | ((src) << 16) | ((typ) << 12) | \
+		((dst) << 8) | (b))
+#define T3_SUB_ROT_IMM(dst, src, ror, imm) (0xf1a00000 | ((src) << 16) | ((dst) << 8) | \
+		(((ror) & 0x10) << (26-4)) | (((ror) & 0x0e) << (12-1)) | (((ror) & 1) << 7) | \
+		((imm) & 0x7f))
+#define T4_SUB_IMM(dst, src, imm)	(0xf2a00000 | ((src) << 16) | ((dst) << 8) | \
+		(((imm) & 0x800) << (26-11)) | (((imm) & 0x700) << (12-8)) | ((imm) & 0xff))
+
+#define T_DOP_BYTELANE(op, dst, src, typ, b)	((op) | ((dst) << 8) | ((src) << 16) | \
+		((typ) << 12) | (b))
+#define T_DOP_ROT_IMM(op, dst, src, ror, imm)	((op) | ((dst) << 8) | ((src) << 16) | \
+		(((ror) & 0x10) << (26-4)) | (((ror) & 0x0e) << (12-1)) | (((ror) & 1) << 7) | \
+		((imm) & 0x7f))
+#define T_SHIFT_IMM(op, dst, src, imm)	((op) | ((dst) << 8) | (src) | \
+		(((imm) & 3) << 6) | (((imm) & 0x1c) << (12-2)))
+#define T_DOP_REG(op, dst, lho, rho, st, sh)	((op) | ((dst) << 8) | ((lho) << 16) | (rho) | \
+		((st) << 4) | (((sh) & 0x1c) << (12-2)) | (((sh) & 3) << 6))
+#define T3_ADD_BYTELANE(dst, src, typ, b) (0xf1000000 | ((src) << 16) | ((typ) << 12) | \
+		((dst) << 8) | (b))
+
+#define T_CMP_IMM(src, imm)		(0x2800 | ((src) << 8) | (imm))
+#define T_CMP_REG(lho, rho)		(0x4280 | ((rho) << 3) | (lho))
+
+#define T_NEG(dst, src)		(0x4240 | (dst) | ((src) << 3))
+#define T_MVN(dst, src)		(0x43c0 | (dst) | ((src) << 3))
+#define T_MOV(dst, src)		(0x4600 | (((dst) & 8) << (7-3)) | ((src) << 3) | ((dst) & 7))
+
+#define T_VMOVS_TOARM(dst, src)	\
+	(0xee100a10 | ((dst) << 12) | (((src) & 1) << 7) | (((src) & 0x1e)<<(16-1)))
+#define T_VMOVS_TOVFP(dst, src) \
+	(0xee000a10 | ((src) << 12) | (((dst) & 1) << 7) | (((dst) & 0x1e)<<(16-1)))
+
+#define T_VMOVD_TOARM(dst_lo, dst_hi, src) \
+  (0xec500b10 | ((dst_lo) << 12) | ((dst_hi) << 16) | (((src) & 0x10)<<(5-4)) | ((src) & 0x0f))
+#define T_VMOVD_TOVFP(dst, src_lo, src_hi) \
+  (0xec400b10 | ((src_lo) << 12) | ((src_hi) << 16) | (((dst) & 0x10)<<(5-4)) | ((dst) & 0x0f))
+
+#define T_VOP_REG_S(op, dst, lho, rho)	((op) |				\
+		(((dst) & 1) << 22) | (((dst) & 0x1e) << (12-1)) | 	\
+		(((lho) & 1) << 7) | (((lho) & 0x1e) << (16-1))	 |	\
+		(((rho) & 1) << 5) | (((rho) & 0x1e) >> 1))
+#define T_VOP_REG_D(op, dst, lho, rho)	((op) |	(1 << 8) |		\
+		(((dst) & 0x10) << (22-4)) | (((dst) & 0xf) << 12) | 	\
+		(((lho) & 0x10) << (7-4)) | (((lho) & 0xf) << 16)   |	\
+		(((rho) & 0x10) << (5-4)) | ((rho) & 0xf))
+
+#define T_VCMP_S(lho, rho, e)		(0xeeb40a40 | ((e) << 7) |	\
+		(((lho) & 1) << 22) | (((lho) & 0x1e) << (12-1)) |	\
+		(((rho) & 1) << 5) | (((rho) & 0x1e) >>1))
+#define T_VCMP_D(lho, rho, e)		(0xeeb40b40 | ((e) << 7) |	\
+		(((lho) & 0x10) << (22-4)) | (((lho) & 0x0f) << 12) |	\
+		(((rho) & 0x10) << (5-4)) | ((rho) & 0x0f))
+#define T_VMRS(dst)	(0xeef10a10 | ((dst) << 12))
+
+#define T_MLA(res, lho, rho, a) \
+		(0xfb000000 | ((res) << 8) | ((lho) << 16) | (rho) | ((a) << 12))
+#define T_UMULL(res_lo, res_hi, lho, rho) \
+		(0xfba00000 | ((res_lo) << 12) | ((res_hi) << 8) | ((lho) << 16) | (rho))
+
+#define T_BX(src)		(0x4700 | ((src) << 3))
+#define T_TBH(base, idx)	(0xe8d0f010 | ((base) << 16) | (idx))
+
+#define T_SXTB(dst, src)	(0xb240 | ((src) << 3) | (dst))
+#define T_SXTH(dst, src)	(0xb200 | ((src) << 3) | (dst))
+#define T2_SXTB(dst, src)	(0xfa4ff080 | ((dst) << 8) | (src))
+#define T2_SXTH(dst, src)	(0xfa0ff080 | ((dst) << 8) | (src))
+#define T_UXTH(dst, src)	(0xb280 | ((src) << 3) | (dst))
+#define T2_UXTH(dst, src)	(0xfa1ff080 | ((dst) << 8) | (src))
+
+int out_16(CodeBuf *codebuf, u32 s)
+{
+  if (codebuf->idx >= codebuf->limit)
+	longjmp(compiler_error_env, COMPILER_RESULT_FATAL);
+  codebuf->codebuf[codebuf->idx++] = s;
+  return 0;
+}
+
+int out_16x2(CodeBuf *codebuf, u32 sx2)
+{
+  unsigned s1 = sx2 >> 16;
+  unsigned s2 = sx2 & 0xffff;
+
+  out_16(codebuf, s1);
+  return out_16(codebuf, s2);
+}
+
+int out_32(CodeBuf *codebuf, u32 w)
+{
+  if (codebuf->idx + 2 > codebuf->limit)
+	longjmp(compiler_error_env, COMPILER_RESULT_FATAL);
+  *(u32 *)&(codebuf->codebuf[codebuf->idx]) = w;
+  codebuf->idx += 2;
+  return 0;
+}
+
+u32 out_pos(CodeBuf *codebuf)
+{
+  return (u32)&(codebuf->codebuf[codebuf->idx]);
+}
+
+u32 out_loc(CodeBuf *codebuf)
+{
+  return codebuf->idx * 2;
+}
+
+#define CODE_ALIGN 64
+#define CODE_ALIGN_SIZE 64
+
+u32 out_align(CodeBuf *codebuf, unsigned align)
+{
+  codebuf->idx += (((out_pos(codebuf) + (align-1)) & ~(align-1)) - out_pos(codebuf)) / sizeof(short);
+  return out_pos(codebuf);
+}
+
+int thumb_single_shift(unsigned imm)
+{
+  unsigned lsl;
+
+  if (!imm) return -1;
+  lsl = 0;
+  while (!(imm & 0x80000000)) {
+    imm <<= 1;
+    lsl++;
+  }
+  if (lsl >= 24) return -1;
+  if ((imm & 0xff000000) == imm) return lsl+8;
+  return -1;
+}
+
+int thumb_bytelane(u32 imm)
+{
+    unsigned b1 = imm & 0xff;
+    unsigned b2 = (imm >> 8) & 0xff;
+    unsigned b3 = (imm >> 16) & 0xff;
+    unsigned b4 = imm >> 24;
+    int mov_type = -1;
+
+    if (b1 == b3 && b2 == 0 && b4 == 0) mov_type = 1;
+    if (b1 == b2 && b1 == b3 && b1 == b4) mov_type = 3;
+    if (b2 == b4 && b1 == 0 && b3 == 0) mov_type = 2;
+    if (imm < 256) mov_type = 0;
+    return mov_type;
+}
+
+int mov_imm(CodeBuf *codebuf, Reg r, u32 imm)
+{
+  int mov_type, rol;
+
+  if (Thumb2) {
+    if (r < ARM_R8 && imm < 256)
+      return out_16(codebuf, T_MOV_IMM8(r, imm));
+    mov_type = thumb_bytelane(imm);
+    if (mov_type >= 0) {
+      if (mov_type == 2) imm >>= 8;
+      return out_16x2(codebuf, T_MOV_BYTELANE(r, mov_type, (imm & 0xff)));
+    }
+    mov_type = thumb_bytelane(~imm);
+    if (mov_type >= 0) {
+      imm = ~imm;
+      if (mov_type == 2) imm >>= 8;
+      return out_16x2(codebuf, T_MVN_BYTELANE(r, mov_type, (imm & 0xff)));
+    }
+    rol = thumb_single_shift(imm);
+    if (rol >= 0)
+      return out_16x2(codebuf, T_MOV_ROT_IMM(r, rol, ROL(imm, rol)));
+    rol = thumb_single_shift(~imm);
+    if (rol >= 0)
+      return out_16x2(codebuf, T_MVN_ROT_IMM(r, rol, ROL(~imm, rol)));
+    if ((imm & ~0xffff) == 0)
+      return out_16x2(codebuf, T_MOVW_IMM16(r, imm & 0xffff));
+    if (r < ARM_R8) {
+      rol = thumb_single_shift(imm & ~0xff);
+      if (rol >= 0) {
+	out_16(codebuf, T_MOV_IMM8(r, imm & 0xff));
+	return out_16x2(codebuf, T_ORR_ROT_IMM(r, r, rol, ROL(imm & ~0xff, rol)));
+      }
+    }
+    out_16x2(codebuf, T_MOVW_IMM16(r, imm & 0xffff));
+    return out_16x2(codebuf, T_MOVT_IMM16(r, imm >> 16));
+  }
+  J_Unimplemented();
+}
+
+int load_store_reg_no_wb(CodeBuf *codebuf, u32 op, Reg xfer, Reg base, Reg offset,
+							  u32 shift, int pre)
+{
+  if (pre) {
+    if (xfer < ARM_R8 && base < ARM_R8 && offset < ARM_R8) {
+      if (ThumbEE) {
+	if ((shift == 0 && LS_IS_BYTE(op)) || (shift == 1 && LS_IS_HW(op)) ||
+							(shift == 2 && LS_IS_WORD(op)))
+	  return out_16(codebuf, T1_LDR_STR_REG(T1_LS_OP(op), xfer, base, offset));
+      } else if (shift == 0)
+	return out_16(codebuf, T1_LDR_STR_REG(T1_LS_OP(op), xfer, base, offset));
+    }
+    if (shift < 4)
+      return out_16x2(codebuf, T2_LDR_STR_REG(T2_LS_OP(op), xfer, base, offset, shift));
+  }
+  J_Unimplemented();
+}
+
+static int add_reg(CodeBuf *codebuf, u32 dst, u32 lho, u32 rho);
+
+int load_store_reg(CodeBuf *codebuf, u32 op, Reg xfer, Reg base, Reg offset,
+							  u32 shift, int pre, int wb)
+{
+  int rc = load_store_reg_no_wb(codebuf, op, xfer, base, offset, shift, pre);
+  if (wb) {
+    return add_reg(codebuf, base, base, offset);
+  }
+  return rc;
+}
+
+int str_reg(CodeBuf *codebuf, Reg src, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_STR, src, base, offset, shift, pre, wb);
+}
+
+int ldr_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_LDR, dst, base, offset, shift, pre, wb);
+}
+
+int strb_reg(CodeBuf *codebuf, Reg src, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_STRB, src, base, offset, shift, pre, wb);
+}
+
+int ldrb_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_LDRB, dst, base, offset, shift, pre, wb);
+}
+
+int strh_reg(CodeBuf *codebuf, Reg src, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_STRH, src, base, offset, shift, pre, wb);
+}
+
+int ldrh_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_LDRH, dst, base, offset, shift, pre, wb);
+}
+
+int ldrsh_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_LDRSH, dst, base, offset, shift, pre, wb);
+}
+
+int ldrsb_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
+{
+  return load_store_reg(codebuf, LS_LDRSB, dst, base, offset, shift, pre, wb);
+}
+
+int ldrex_imm(CodeBuf *codebuf, Reg dst, Reg base, unsigned offset)
+{
+  if (Thumb2) {
+    if ((offset & 3) == 0 && offset < 256 * 4) {
+      return out_16x2(codebuf, T_LDREX(dst, base, offset));
+    }
+  }
+  J_Unimplemented();
+}
+
+int strex_imm(CodeBuf *codebuf, Reg dst, Reg src, Reg base, unsigned offset)
+{
+  if (Thumb2) {
+    if ((offset & 3) == 0 && offset < 256 * 4) {
+      return out_16x2(codebuf, T_STREX(dst, src, base, offset));
+    }
+  }
+  J_Unimplemented();
+}
+
+int str_imm(CodeBuf *codebuf, Reg src, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (base < ARM_R8 && src < ARM_R8 && uoff < 128 && (uoff & 3) == 0)
+	return out_16(codebuf, T_STR_IMM5(src, base, uoff>>2));
+      if (base == ARM_SP && src < ARM_R8 && uoff < 1024 && (uoff &3) ==0)
+	return out_16(codebuf, T_STR_SP_IMM8(src, uoff>>2));
+      if (ThumbEE && base == ARM_R9 && src < ARM_R8 && uoff < 256 && (uoff & 3) == 0)
+	return out_16(codebuf, E_STR_IMM6(src, uoff>>2));
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_STR_IMM12(src, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_STR_IMM8(src, base, offset, pre, wb));
+    JASSERT(base != ARM_IP && src != ARM_IP, "src or base == IP in str_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return str_reg(codebuf, src, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int ldr_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (base < ARM_R8 && dst < ARM_R8 && uoff < 128 && (uoff & 3) ==0)
+	return out_16(codebuf, T_LDR_IMM5(dst, base, uoff>>2));
+      if (base == ARM_SP && dst < ARM_R8 && uoff < 1024 & (uoff & 3) == 0)
+	return out_16(codebuf, T_LDR_SP_IMM8(dst, uoff>>2));
+      if (ThumbEE && base == ARM_R9 && dst < ARM_R8 && uoff < 256 && (uoff & 3) == 0)
+	return out_16(codebuf, E_LDR_IMM6(dst, uoff>>2));
+      if (ThumbEE && base == ARM_R10 && dst < ARM_R8 && uoff < 128 && (uoff & 3) == 0)
+	return out_16(codebuf, E_LDR_IMM5(dst, uoff>>2));
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_LDR_IMM12(dst, base, uoff));
+    } else {
+      if (ThumbEE && pre && !wb && offset <= 0 && offset > -32 && (uoff & 3) == 0 &&
+							base < ARM_R8 && dst < ARM_R8)
+	return out_16(codebuf, E_LDR_IMM3(dst, base, -offset >> 2));
+      if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_LDR_IMM8(dst, base, offset, pre, wb));
+    }
+    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return ldr_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int strb_imm(CodeBuf *codebuf, Reg src, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (base < ARM_R8 && src < ARM_R8 && uoff < 32)
+	return out_16(codebuf, T_STRB_IMM5(src, base, uoff));
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_STRB_IMM12(src, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_STRB_IMM8(src, base, offset, pre, wb));
+    JASSERT(base != ARM_IP && src != ARM_IP, "src or base == IP in str_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return strb_reg(codebuf, src, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int ldrb_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (base < ARM_R8 && dst < ARM_R8 && uoff < 32)
+	return out_16(codebuf, T_LDRB_IMM5(dst, base, uoff));
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_LDRB_IMM12(dst, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_LDRB_IMM8(dst, base, offset, pre, wb));
+    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return ldrb_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int strh_imm(CodeBuf *codebuf, Reg src, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (base < ARM_R8 && src < ARM_R8 && uoff < 64 && (uoff & 1) == 0)
+	return out_16(codebuf, T_STRH_IMM5(src, base, uoff>>1));
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_STRH_IMM12(src, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_STRH_IMM8(src, base, offset, pre, wb));
+    JASSERT(base != ARM_IP && src != ARM_IP, "src or base == IP in str_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return strh_reg(codebuf, src, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int ldrh_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (base < ARM_R8 && dst < ARM_R8 && uoff < 64 && (uoff & 1) == 0)
+	return out_16(codebuf, T_LDRH_IMM5(dst, base, uoff>>1));
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_LDRH_IMM12(dst, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_LDRH_IMM8(dst, base, offset, pre, wb));
+    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return ldrh_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int ldrsh_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_LDRSH_IMM12(dst, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_LDRSH_IMM8(dst, base, offset, pre, wb));
+    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return ldrsh_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int ldrsb_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (pre && !wb && offset >= 0) {
+      if (uoff < (1 << 12))
+	return out_16x2(codebuf, T_LDRSB_IMM12(dst, base, uoff));
+    } else if (offset < 256 && offset > -256)
+	return out_16x2(codebuf, T_LDRSB_IMM8(dst, base, offset, pre, wb));
+    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
+    mov_imm(codebuf, ARM_IP, offset);
+    return ldrsb_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
+  }
+  J_Unimplemented();
+}
+
+int add_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm);
+
+int ldrd_imm(CodeBuf *codebuf, Reg dst_lo, Reg dst_hi, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (offset < 256 * 4 && offset > -256 * 4 && (offset & 3) == 0)
+      return out_16x2(codebuf, T_LDRD_IMM(dst_lo, dst_hi, base, offset>>2, pre, wb));
+    if (pre && !wb) {
+      add_imm(codebuf, ARM_IP, base, offset);
+      return out_16x2(codebuf, T_LDRD_IMM(dst_lo, dst_hi, ARM_IP, 0, 1, 0));
+    }
+  }
+  J_Unimplemented();
+}
+
+int strd_imm(CodeBuf *codebuf, Reg src_lo, Reg src_hi, Reg base, int offset, int pre, int wb)
+{
+  unsigned uoff;
+
+  if (!pre && !wb) pre = 1, offset = 0;
+  uoff = (unsigned)offset;
+  if (Thumb2) {
+    if (offset < 256 * 4 && offset > -256 * 4 && (offset & 3) == 0)
+      return out_16x2(codebuf, T_STRD_IMM(src_lo, src_hi, base, offset>>2, pre, wb));
+    if (pre && !wb) {
+      add_imm(codebuf, ARM_IP, base, offset);
+      return out_16x2(codebuf, T_STRD_IMM(src_lo, src_hi, ARM_IP, 0, 1, 0));
+    }
+  }
+  J_Unimplemented();
+}
+
+int stm(CodeBuf *codebuf, u32 regset, u32 base, u32 st, u32 wb)
+{
+  JASSERT(regset != 0, "regset != 0 in stm");
+  if (Thumb2) {
+    if (!ThumbEE && base < ARM_R8 && (regset & ~0xff) == 0 && st == IA && wb)
+      return out_16(codebuf, T_STM8(base, regset));
+    if (base == ARM_SP) {
+      if ((regset & ~0x40ff) == 0 && st == DB && wb)
+	return out_16(codebuf, T_PUSH(regset));
+    }
+    if ((regset & -regset) == regset)
+      return str_imm(codebuf, LOG2(regset), base, (st & 1) ? 4 : -4, (st & 2) >> 1, wb);
+    if (st == PUSH_EA || st == PUSH_FD)
+      return out_16x2(codebuf, T_STM16(base, regset, st, wb));
+    return out_16x2(codebuf, T_STM16(base, regset, st, wb));
+  }
+  J_Unimplemented();
+}
+
+int ldm(CodeBuf *codebuf, u32 regset, u32 base, u32 st, u32 wb)
+{
+  JASSERT(regset != 0, "regset != 0 in stm");
+  if (Thumb2) {
+    if (!ThumbEE && base < ARM_R8 && (regset & ~0xff) == 0 && st == IA && wb)
+      return out_16(codebuf, T_LDM8(base, regset));
+    if (base == ARM_SP) {
+      if ((regset & ~0x80ff) == 0 && st == IA && wb)
+	return out_16(codebuf, T_POP(regset));
+    }
+    if ((regset & -regset) == regset)
+      return ldr_imm(codebuf, LOG2(regset), base, (st & 1) ? 4 : -4, (st & 2) >> 1, wb);
+    if (st == POP_EA || st == POP_FD)
+      return out_16x2(codebuf, T_LDM16(base, regset, st, wb));
+  }
+  J_Unimplemented();
+}
+
+int dop_reg(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho, u32 sh_typ, u32 shift)
+{
+  unsigned s = 0;
+  if (op != DP_MUL) s = 1 << 20;
+//  JASSERT(dst != ARM_PC, "Terrible things happen if dst == PC && S bit set");
+  return out_16x2(codebuf, T_DOP_REG(DP_REG(op)|s, dst, lho, rho, sh_typ, shift));
+}
+
+int dop_reg_preserve(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho, u32 sh_typ, u32 shift)
+{
+  return out_16x2(codebuf, T_DOP_REG(DP_REG(op), dst, lho, rho, sh_typ, shift));
+}
+
+int sxtb(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  if (dst < ARM_R8 && src < ARM_R8)
+    return out_16(codebuf, T_SXTB(dst, src));
+  return out_16x2(codebuf, T2_SXTB(dst, src));
+}
+
+int sxth(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  if (dst < ARM_R8 && src < ARM_R8)
+    return out_16(codebuf, T_SXTH(dst, src));
+  return out_16x2(codebuf, T2_SXTH(dst, src));
+}
+
+int uxth(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  if (dst < ARM_R8 && src < ARM_R8)
+    return out_16(codebuf, T_UXTH(dst, src));
+  return out_16x2(codebuf, T2_UXTH(dst, src));
+}
+
+int mov_reg(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  if (dst == src) return 0;
+  if (dst == ARM_PC) return out_16(codebuf, T_BX(src));
+  return out_16(codebuf, T_MOV(dst, src));
+//  return dop_reg(codebuf, DP_MOV, dst, 0, src, SHIFT_LSL, 0);
+}
+
+int mvn_reg(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  if (dst < ARM_R8 && src < ARM_R8)
+    return out_16(codebuf, T_MVN(dst, src));
+  return dop_reg(codebuf, DP_MVN, dst, 0, src, SHIFT_LSL, 0);
+}
+
+int vmov_reg_s_toVFP(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  return out_16x2(codebuf, T_VMOVS_TOVFP(dst, src));
+}
+
+int vmov_reg_s_toARM(CodeBuf *codebuf, u32 dst, u32 src)
+{
+  return out_16x2(codebuf, T_VMOVS_TOARM(dst, src));
+}
+
+int vmov_reg_d_toVFP(CodeBuf *codebuf, u32 dst, u32 src_lo, u32 src_hi)
+{
+  return out_16x2(codebuf, T_VMOVD_TOVFP(dst, src_lo, src_hi));
+}
+
+int vmov_reg_d_toARM(CodeBuf *codebuf, u32 dst_lo, u32 dst_hi, u32 src)
+{
+  return out_16x2(codebuf, T_VMOVD_TOARM(dst_lo, dst_hi, src));
+}
+
+int vop_reg_s(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho)
+{
+  return out_16x2(codebuf, T_VOP_REG_S(VP_REG(op), dst, lho, rho));
+}
+
+int vop_reg_d(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho)
+{
+  return out_16x2(codebuf, T_VOP_REG_D(VP_REG(op), dst, lho, rho));
+}
+
+int vcmp_reg_s(CodeBuf *codebuf, u32 lho, u32 rho, unsigned e)
+{
+  return out_16x2(codebuf, T_VCMP_S(lho, rho, e));
+}
+
+int vcmp_reg_d(CodeBuf *codebuf, u32 lho, u32 rho, unsigned e)
+{
+  return out_16x2(codebuf, T_VCMP_D(lho, rho, e));
+}
+
+int vmrs(CodeBuf *codebuf, u32 dst)
+{
+  return out_16x2(codebuf, T_VMRS(dst));
+}
+
+int add_reg(CodeBuf *codebuf, u32 dst, u32 lho, u32 rho)
+{
+  return dop_reg(codebuf, DP_ADD, dst, lho, rho, SHIFT_LSL, 0);
+}
+
+int cmp_reg(CodeBuf *codebuf, Reg lho, Reg rho)
+{
+  if (lho < ARM_R8 && rho < ARM_R8)
+    return out_16(codebuf, T_CMP_REG(lho, rho));
+  return dop_reg(codebuf, DP_CMP, 0x0f, lho, rho, SHIFT_LSL, 0);
+}
+
+int add_reg_shift(CodeBuf *codebuf, u32 dst, u32 lho, u32 rho, u2 sh_typ, u32 shift)
+{
+  return dop_reg(codebuf, DP_ADD, dst, lho, rho, sh_typ, shift);
+}
+
+int add_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  int imm_type, rol;
+
+  if (imm == 0) return mov_reg(codebuf, dst, src);
+  if (Thumb2) {
+    if (dst < ARM_R8 && src < ARM_R8) {
+      if (imm < 8)
+	return out_16(codebuf, T1_ADD_IMM(dst, src, imm));
+      if (-imm < 8)
+	return out_16(codebuf, T1_SUB_IMM(dst, src, -imm));
+      if (src == dst) {
+	if (imm < 256)
+	  return out_16(codebuf, T2_ADD_IMM(src, imm));
+	if (-imm < 256)
+	  return out_16(codebuf, T2_SUB_IMM(src, -imm));
+      }
+    }
+    imm_type = thumb_bytelane(imm);
+    if (imm_type >= 0) {
+      if (imm_type == 2) imm >>= 8;
+      return out_16x2(codebuf, T3_ADD_BYTELANE(dst, src, imm_type, (imm & 0xff)));
+    }
+    imm_type = thumb_bytelane(-imm);
+    if (imm_type >= 0) {
+      imm = -imm;
+      if (imm_type == 2) imm >>= 8;
+      return out_16x2(codebuf, T3_SUB_BYTELANE(dst, src, imm_type, (imm & 0xff)));
+    }
+    rol = thumb_single_shift(imm);
+    if (rol >= 0)
+      return out_16x2(codebuf, T3_ADD_ROT_IMM(dst, src, rol, ROL(imm, rol)));
+    rol = thumb_single_shift(-imm);
+    if (rol >= 0)
+      return out_16x2(codebuf, T3_SUB_ROT_IMM(dst, src, rol, ROL(-imm, rol)));
+    if (imm < (1 << 12))
+      return out_16x2(codebuf, T4_ADD_IMM(dst, src, imm));
+    if (-imm < (1 << 12))
+      return out_16x2(codebuf, T4_SUB_IMM(dst, src, -imm));
+    mov_imm(codebuf, ARM_IP, imm);
+    return add_reg(codebuf, dst, src, ARM_IP);
+  }
+  J_Unimplemented();
+}
+
+int sub_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  return add_imm(codebuf, dst, src, -imm);
+}
+
+int dop_imm_s(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm, unsigned s)
+{
+    int imm_type, rol;
+    unsigned n_op, n_imm;
+
+    JASSERT(op == DP_ADC || op == DP_ADD || op == DP_AND || op == DP_BIC || op == DP_CMN ||
+		op == DP_CMP || op == DP_EOR || op == DP_MOV || op == DP_MVN ||
+		op == DP_ORN || op == DP_ORR || op == DP_RSB || op == DP_SBC ||
+		op == DP_SUB || op == DP_TEQ || op == DP_TST, "bad op");
+    if (op == DP_CMP || op == DP_CMN || op == DP_TEQ || op == DP_TST) dst = 0x0f;
+    if (op == DP_MOV || op == DP_MVN) src = 0x0f;
+    imm_type = thumb_bytelane(imm);
+    if (imm_type >= 0) {
+      if (imm_type == 2) imm >>= 8;
+      return out_16x2(codebuf, T_DOP_BYTELANE(DP_IMM(op)|s, dst, src, imm_type, (imm & 0xff)));
+    }
+    rol = thumb_single_shift(imm);
+    if (rol >= 0)
+      return out_16x2(codebuf, T_DOP_ROT_IMM(DP_IMM(op)|s, dst, src, rol, ROL(imm, rol)));
+    n_op = N_OP(op);
+    if (n_op != (unsigned)-1) {
+      n_imm = ~imm;
+      if (op == DP_ADD || op == DP_SUB || op == DP_CMP || op == DP_CMN) n_imm = -imm;
+      imm_type = thumb_bytelane(n_imm);
+      if (imm_type >= 0) {
+	if (imm_type == 2) n_imm >>= 8;
+	return out_16x2(codebuf, T_DOP_BYTELANE(DP_IMM(n_op)|s, dst, src, imm_type, (n_imm & 0xff)));
+      }
+      rol = thumb_single_shift(n_imm);
+      if (rol >= 0)
+	return out_16x2(codebuf, T_DOP_ROT_IMM(DP_IMM(n_op)|s, dst, src, rol, ROL(n_imm, rol)));
+    }
+    mov_imm(codebuf, ARM_IP, imm);
+    return out_16x2(codebuf, T_DOP_REG(DP_REG(op)|s, dst, src, ARM_IP, SHIFT_LSL, 0));
+}
+
+int dop_imm(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm)
+{
+    return dop_imm_s(codebuf, op, dst, src, imm, 1<<20);
+}
+
+int dop_imm_preserve(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm)
+{
+    return dop_imm_s(codebuf, op, dst, src, imm, 0);
+}
+
+int shift_imm(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm)
+{
+    imm &= 31;
+    if (imm == 0)
+      return mov_reg(codebuf, dst, src);
+    else
+      return out_16x2(codebuf, T_SHIFT_IMM(DP_IMM(op), dst, src, imm));
+}
+
+int rsb_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  if (dst < ARM_R8 && src < ARM_R8 && imm == 0)
+    return out_16(codebuf, T_NEG(dst, src));
+  return dop_imm(codebuf, DP_RSB, dst, src, imm);
+}
+
+int adc_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  return dop_imm(codebuf, DP_ADC, dst, src, imm);
+}
+
+int asr_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  return shift_imm(codebuf, DP_ASR, dst, src, imm);
+}
+
+int eor_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  return dop_imm(codebuf, DP_EOR, dst, src, imm);
+}
+
+int and_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  return dop_imm(codebuf, DP_AND, dst, src, imm);
+}
+
+int orr_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
+{
+  return dop_imm(codebuf, DP_ORR, dst, src, imm);
+}
+
+int cmp_imm(CodeBuf *codebuf, Reg src, u32 imm)
+{
+  if (src <= ARM_R8 && imm < 256) return out_16(codebuf, T_CMP_IMM(src, imm));
+  return dop_imm(codebuf, DP_CMP, 0x0f, src, imm);
+}
+
+int tst_imm(CodeBuf *codebuf, Reg src, u32 imm)
+{
+  return dop_imm(codebuf, DP_TST, 0x0f, src, imm);
+}
+
+int hbl(CodeBuf *codebuf, unsigned handler)
+{
+  mov_imm(codebuf, ARM_IP, 0);
+  str_imm(codebuf, ARM_IP, ARM_IP, 0, 1, 0);
+#if 0
+  if ((Thumb2 && ThumbEE))
+    return out_16(codebuf, T_HBL(handler));
+  if (TESTING)
+    return mov_imm(codebuf, ARM_R8, handler);
+  J_Unimplemented();
+#endif
+}
+
+#if 0
+int enter_leave(CodeBuf *codebuf, unsigned enter)
+{
+  if ((Thumb2 && ThumbEE))
+    return out_16x2(codebuf, T_ENTER_LEAVE(enter));
+  J_Unimplemented();
+}
+#endif
+
+int tbh(CodeBuf *codebuf, Reg base, Reg idx)
+{
+  out_16x2(codebuf, T_TBH(base, idx));
+}
+
+int umull(CodeBuf *codebuf, u32 res_lo, u32 res_hi, u32 lho, u32 rho)
+{
+  return out_16x2(codebuf, T_UMULL(res_lo, res_hi, lho, rho));
+}
+
+int mla(CodeBuf *codebuf, u32 res, u32 lho, u32 rho, u32 a)
+{
+  return out_16x2(codebuf, T_MLA(res, lho, rho, a));
+}
+
+#define COND_EQ 0
+#define COND_NE 1
+#define COND_LT	2
+#define COND_GE 3
+#define COND_GT 4
+#define COND_LE 5
+#define COND_CS 6
+#define COND_CC 7
+#define COND_MI 8
+#define COND_PL 9
+
+static unsigned conds[] = {
+	0x0,
+	0x1,
+	0xb,
+	0xa,
+	0xc,
+	0xd,
+	0x2,
+	0x3,
+	0x4,
+	0x5,
+};
+
+#define NEG_COND(cond)	((cond) ^ 1)
+
+#define T_B(uoff)	(0xe000 | ((uoff) & 0x7ff))
+#define T_BW(uoff)	(0xf0009000 | \
+			  (((uoff) & (1<<23)) << (26-23)) | \
+			  (((~(uoff) & (1<<22)) >> 22) ^ (((uoff) & (1<<23)) >> 23)) << 13 | \
+			  (((~(uoff) & (1<<21)) >> 21) ^ (((uoff) & (1<<23)) >> 23)) << 11 | \
+			  (((uoff) & 0x1ff800) << (16-11)) | \
+			  ((uoff) & 0x7ff))
+#define T_BL(uoff)	(0xf000d000 | \
+			  (((uoff) & (1<<23)) << (26-23)) | \
+			  (((~(uoff) & (1<<22)) >> 22) ^ (((uoff) & (1<<23)) >> 23)) << 13 | \
+			  (((~(uoff) & (1<<21)) >> 21) ^ (((uoff) & (1<<23)) >> 23)) << 11 | \
+			  (((uoff) & 0x1ff800) << (16-11)) | \
+			  ((uoff) & 0x7ff))
+#define T_BLX(uoff)	(0xf000c000 | \
+			  (((uoff) & (1<<23)) << (26-23)) | \
+			  (((~(uoff) & (1<<22)) >> 22) ^ (((uoff) & (1<<23)) >> 23)) << 13 | \
+			  (((~(uoff) & (1<<21)) >> 21) ^ (((uoff) & (1<<23)) >> 23)) << 11 | \
+			  (((uoff) & 0x1ff800) << (16-11)) | \
+			  ((uoff) & 0x7ff))
+#define T_BCC(cond, uoff) (0xd000 | (conds[cond] << 8) | ((uoff) & 0xff))
+#define T_BCCW(cond, uoff) (0xf0008000 | \
+			     (conds[cond] << 22) | \
+			     (((uoff) & (1<<19)) << (26-19)) | \
+			     (((uoff) & (1<<18)) >> (18-11)) | \
+			     (((uoff) & (1<<17)) >> (17-13)) | \
+			     (((uoff) & 0x1f800) << (16-11)) | \
+			     ((uoff) & 0x7ff))
+#define T_BLX_REG(r)	(0x4780 | ((r) << 3))
+#define T_CBZ(r, uoff)	(0xb100 | (((uoff) & 0x1f) << 3) | (((uoff) & 0x20) << (8-5)) | ((r) & 7))
+#define T_CBNZ(r, uoff)	(0xb900 | (((uoff) & 0x1f) << 3) | (((uoff) & 0x20) << (8-5)) | ((r) & 7))
+
+#define T_IT(cond, mask) (0xbf00 | (conds[cond] << 4) | (mask))
+
+#define IT_MASK_T	8
+
+#define PATCH(loc)	do {						\
+	  unsigned oldidx = codebuf->idx;				\
+	  codebuf->idx = (loc) >> 1;					\
+
+#define HCTAP								\
+	  codebuf->idx = oldidx;					\
+    	} while (0)
+
+int forward_16(CodeBuf *codebuf)
+{
+  int loc = out_loc(codebuf);
+  out_16(codebuf, T_UNDEFINED_16);
+  return loc;
+}
+
+int forward_32(CodeBuf *codebuf)
+{
+  int loc = out_loc(codebuf);
+  out_32(codebuf, T_UNDEFINED_32);
+  return loc;
+}
+
+int it(CodeBuf *codebuf, unsigned cond, unsigned mask)
+{
+  return out_16(codebuf, T_IT(cond, mask));
+}
+
+void t2_bug_align(CodeBuf *codebuf)
+{
+  unsigned pc = (unsigned)&codebuf->codebuf[codebuf->idx];
+  if ((pc & 0xffe) != 0xffe) return;
+  mov_reg(codebuf, ARM_R0, ARM_R0);
+}
+
+void t2_bug_fix(CodeBuf *codebuf, int offset)
+{
+  unsigned pc = (unsigned)&codebuf->codebuf[codebuf->idx];
+  if ((pc & 0xffe) != 0xffe) return;
+  if (offset >= 0 || offset < -(4096+4)) return;
+  mov_reg(codebuf, ARM_R0, ARM_R0);
+}
+
+int branch_uncond(CodeBuf *codebuf, unsigned dest)
+{
+  unsigned loc = (codebuf->idx * 2) + 4;
+  int offset;
+  unsigned uoff;
+
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest - loc;
+  if (offset >= -(1<<10) && offset < (1<<10)) {
+    uoff = offset;
+    return out_16(codebuf, T_B(uoff));
+  }
+  t2_bug_fix(codebuf, offset);
+  if (offset >= -(1<<23) && offset < (1<<23)) {
+    uoff = offset;
+    return out_16x2(codebuf, T_BW(uoff));
+  }
+  J_Unimplemented();
+}
+
+int branch_uncond_patch(CodeBuf *codebuf, unsigned loc, unsigned dest)
+{
+  int offset;
+  unsigned uoff;
+  unsigned oldidx;
+  int rc;
+
+  oldidx = codebuf->idx;
+  codebuf->idx = loc >> 1;
+  loc += 4;
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest - loc;
+  t2_bug_fix(codebuf, offset);
+  if (offset >= -(1<<23) && offset < (1<<23)) {
+    uoff = offset & ((1<<24)-1);
+    rc = out_16x2(codebuf, T_BW(uoff));
+    codebuf->idx = oldidx;
+    return rc;
+  }
+  J_Unimplemented();
+}
+
+int branch_narrow_patch(CodeBuf *codebuf, unsigned loc)
+{
+  int offset;
+  unsigned uoff;
+  unsigned oldidx;
+  unsigned dest;
+  int rc;
+
+  dest = codebuf->idx * 2;
+  oldidx = codebuf->idx;
+  codebuf->idx = loc >> 1;
+  loc += 4;
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest - loc;
+  if (offset >= -(1<<10) && offset < (1<<10)) {
+    uoff = offset & ((1<<11)-1);
+    rc = out_16(codebuf, T_B(uoff));
+    codebuf->idx = oldidx;
+    return rc;
+  }
+  J_Unimplemented();
+}
+
+int branch(CodeBuf *codebuf, unsigned cond, unsigned dest)
+{
+  unsigned loc = (codebuf->idx * 2) + 4;
+  int offset;
+  unsigned uoff;
+
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest - loc;
+  if (offset >= -(1<<7) && offset < (1<<7)) {
+    uoff = offset;
+    return out_16(codebuf, T_BCC(cond, uoff));
+  }
+  t2_bug_fix(codebuf, offset);
+  if (offset >= -(1<<19) && offset < (1<<19)) {
+    uoff = offset;
+    return out_16x2(codebuf, T_BCCW(cond, uoff));
+  }
+  J_Unimplemented();
+}
+
+int bcc_patch(CodeBuf *codebuf, unsigned cond, unsigned loc)
+{
+  int offset;
+  unsigned uoff;
+  unsigned oldidx;
+  unsigned dest;
+  int rc;
+
+  dest = codebuf->idx * 2;
+  oldidx = codebuf->idx;
+  codebuf->idx = loc >> 1;
+  loc += 4;
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest-loc;
+  if (offset >= -(1<<7) && offset < (1<<7)) {
+    uoff = offset;
+    rc = out_16(codebuf, T_BCC(cond, uoff));
+    codebuf->idx = oldidx;
+    return rc;
+  }
+  J_Unimplemented();
+}
+
+int bl(CodeBuf *codebuf, unsigned dest)
+{
+  unsigned loc = (unsigned)&codebuf->codebuf[codebuf->idx] + 4;
+  int offset;
+  unsigned uoff;
+
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest - loc;
+  t2_bug_fix(codebuf, offset);
+  if (offset >= -(1<<23) && offset < (1<<23)) {
+    uoff = offset;
+    return out_16x2(codebuf, T_BL(uoff));
+  }
+  J_Unimplemented();
+}
+
+int blx(CodeBuf *codebuf, unsigned dest)
+{
+  unsigned loc = (unsigned)&codebuf->codebuf[codebuf->idx] + 4;
+  int offset;
+  unsigned uoff;
+
+  JASSERT((dest & 3) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  loc &= ~1;
+  offset = dest - loc;
+  t2_bug_fix(codebuf, offset);
+  if (offset >= -(1<<23) && offset < (1<<23)) {
+    uoff = offset;
+    return out_16x2(codebuf, T_BLX(uoff));
+  }
+  J_Unimplemented();
+}
+
+int branch_patch(CodeBuf *codebuf, unsigned cond, unsigned loc, unsigned dest)
+{
+  int offset;
+  unsigned uoff;
+  unsigned oldidx;
+  int rc;
+
+  oldidx = codebuf->idx;
+  codebuf->idx = loc >> 1;
+  loc += 4;
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest - loc;
+  t2_bug_fix(codebuf, offset);
+  if (offset >= -(1<<19) && offset < (1<<19)) {
+    uoff = offset & ((1<<20)-1);
+    rc = out_16x2(codebuf, T_BCCW(cond, uoff));
+    codebuf->idx = oldidx;
+    return rc;
+  }
+  J_Unimplemented();
+}
+
+int blx_reg(CodeBuf *codebuf, Reg r)
+{
+  return out_16(codebuf, T_BLX_REG(r));
+}
+
+int cbz_patch(CodeBuf *codebuf, Reg r, unsigned loc)
+{
+  unsigned offset;
+  unsigned oldidx;
+  unsigned dest;
+  int rc;
+
+  dest = codebuf->idx * 2;
+  oldidx = codebuf->idx;
+  codebuf->idx = loc >> 1;
+  loc += 4;
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest-loc;
+  if (r < ARM_R8 && offset < 64) {
+    rc = out_16(codebuf, T_CBZ(r, offset));
+    codebuf->idx = oldidx;
+    return rc;
+  }
+  J_Unimplemented();
+}
+
+int cbnz_patch(CodeBuf *codebuf, Reg r, unsigned loc)
+{
+  unsigned offset;
+  unsigned oldidx;
+  unsigned dest;
+  int rc;
+
+  dest = codebuf->idx * 2;
+  oldidx = codebuf->idx;
+  codebuf->idx = loc >> 1;
+  loc += 4;
+  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
+  dest >>= 1;
+  loc >>= 1;
+  offset = dest-loc;
+  if (r < ARM_R8 && offset < 64) {
+    rc = out_16(codebuf, T_CBNZ(r, offset));
+    codebuf->idx = oldidx;
+    return rc;
+  }
+  J_Unimplemented();
+}
+
+int chka(CodeBuf *codebuf, u32 size, u32 idx)
+{
+  cmp_reg(codebuf, idx, size);
+  it(codebuf, COND_CS, IT_MASK_T);
+  bl(codebuf, handlers[H_ARRAYBOUND]);
+}
+
+//-----------------------------------------------------------------------------------
+
+void Thumb2_Push_Multiple(CodeBuf *codebuf, Reg *regs, unsigned nregs)
+{
+  unsigned regset = 0;
+  unsigned regmask;
+  unsigned i;
+  Reg r;
+
+  JASSERT(nregs > 0, "nregs must be > 0");
+  if (nregs == 1) {
+    str_imm(codebuf, regs[0], Rstack, -4, 1, 1);
+    return;
+  }
+  for (i = 0; i < nregs; i++) {
+    r = regs[i];
+    if (!IS_ARM_INT_REG(r)) J_Unimplemented();
+    regmask = 1<<r;
+    if (regset != 0 && regmask >= (regset & -regset)) {
+      stm(codebuf, regset, Rstack, PUSH_FD, 1);
+      regset = 0;
+    }
+    regset |= regmask;
+  }
+  stm(codebuf, regset, Rstack, PUSH_FD, 1);
+}
+
+void Thumb2_Pop_Multiple(CodeBuf *codebuf, Reg *regs, unsigned nregs)
+{
+  unsigned regset = 0;
+  unsigned regmask;
+  unsigned i;
+  Reg r;
+
+  JASSERT(nregs > 0, "nregs must be > 0");
+  if (nregs == 1) {
+    ldr_imm(codebuf, regs[0], Rstack, 4, 0, 1);
+    return;
+  }
+  i = nregs;
+  do {
+    i--;
+    r = regs[i];
+    if (!IS_ARM_INT_REG(r)) J_Unimplemented();
+    regmask = 1<<r;
+    if (regmask <= (regset & -regset)) {
+      ldm(codebuf, regset, Rstack, POP_FD, 1);
+      regset = 0;
+    }
+    regset |= regmask;
+  } while (i > 0);
+  ldm(codebuf, regset, Rstack, POP_FD, 1);
+}
+
+#if 0
+int load_multiple(CodeBuf *codebuf, Reg base, Reg *regs, u32 nregs, u32 st, u32 wb)
+{
+  unsigned regset = 0;
+  unsigned regmask;
+  unsigned pre = 0;
+  int dir = 1;
+  unsigned u;
+  Reg r;
+
+  if (st == IB || st == DB) pre = 4;
+  if (st == DA || st == DB) dir = -4;
+  JASSERT(nregs > 0, "nregs must be > 0");
+  if (nregs == 1)
+    return ldr_imm(codebuf, regs[0], base, dir, pre, wb);
+  if (dir > 0) {
+    u = 0;
+    do {
+      r = regs[u];
+      regmask = 1<<r;
+      if (regset != 0 && regmask >= regset) {
+	if (!wb && base != ARM_IP) {
+	  mov_reg(codebuf, ARM_IP, base);
+	  base = ARM_IP;
+	}
+	ldm(codebuf, regset, base, st, 1);
+	regset = 0;
+      }
+      regset |= regmask;
+    } while (++u < nregs);
+    ldm(codebuf, regset, base, st, wb);
+  } else {
+    u = nregs;
+    do {
+      u--;
+      r = regs[u];
+      regmask = 1<<r;
+      if (regmask <= (regset & -regset)) {
+	if (!wb && base != ARM_IP) {
+	  mov_reg(codebuf, ARM_IP, base);
+	  base = ARM_IP;
+	}
+	ldm(codebuf, regset, base, st, 1);
+	regset = 0;
+      }
+      regset |= regmask;
+    } while (u > 0);
+    ldm(codebuf, regset, base, st, wb);
+  }
+}
+#endif
+
+int mov_multiple(CodeBuf *codebuf, Reg *dst, Reg *src, unsigned nregs)
+{
+  unsigned u, n, p;
+  unsigned smask = 0;
+  unsigned dmask = 0;
+  unsigned free_mask, free_reg;
+
+  for (u = 0, n = 0; u < nregs; u++) {
+    JASSERT(dst[u] != ARM_IP, "mov_multiple cannot be used for ARM_IP");
+    JASSERT(src[u] != ARM_IP, "mov_multiple cannot be used for ARM_IP");
+    if (dst[u] != src[u]) {
+      dst[n] = dst[u];
+      src[n++] = src[u];
+    }
+  }
+  while (n) {
+    // Find a reg which is in the dst reg set but not the src reg set
+    smask = 0;
+    dmask = 0;
+    for (u = 0; u < n; u++) {
+      smask |= (1 << src[u]);
+      dmask |= (1 << dst[u]);
+    }
+    free_mask = dmask & ~smask;
+    if (!free_mask) {
+      // No such reg => must use IP
+      Reg r = dst[0];
+      mov_reg(codebuf, ARM_IP, r);
+      for (u = 0; u < n; u++) {
+	if (src[u] == r) src[u] = ARM_IP;
+      }
+      smask ^= (1<<r) | (1<<ARM_IP);
+      free_mask = dmask & ~smask;
+      JASSERT(free_mask, "still no free reg after using ARM_IP?");
+    }
+    free_reg = LOG2(free_mask);
+    for (u = 0, p = 0; u < n; u++) {
+      if (dst[u] == free_reg) {
+	mov_reg(codebuf, dst[u], src[u]);
+      } else {
+	dst[p] = dst[u];
+	src[p++] = src[u];
+      }
+    }
+    n--;
+  }
+  return 0;
+}
+
+#define TOS(jstack)	((jstack)->stack[(jstack)->depth-1])
+#define TOSM1(jstack)	((jstack)->stack[(jstack)->depth-2])
+#define TOSM2(jstack)	((jstack)->stack[(jstack)->depth-3])
+#define TOSM3(jstack)	((jstack)->stack[(jstack)->depth-4])
+
+#define POP(jstack)		((jstack)->stack[--(jstack)->depth])
+#define PUSH(jstack, r)		((jstack)->stack[(jstack)->depth++] = (r))
+#define SWAP(jstack) do { \
+		      Reg r = (jstack)->stack[(jstack)->depth-1]; \
+		      (jstack)->stack[(jstack)->depth-1] = (jstack)->stack[(jstack)->depth-2]; \
+		      (jstack)->stack[(jstack)->depth-2] = r; \
+		    } while (0)
+
+#define JSTACK_REG(jstack)		jstack_reg(jstack)
+#define JSTACK_PREFER(jstack, prefer)	jstack_prefer(jstack, prefer)
+
+static const unsigned last_clear_bit[] = {
+	3,	//	0000
+	3,	//	0001
+	3,	//	0010
+	3,	//	0011
+	3,	//	0100
+	3,	//	0101
+	3,	//	0110
+	3,	//	0111
+	2,	//	1000
+	2,	//	1001
+	2,	//	1010
+	2,	//	1011
+	1,	//	1100
+	1,	//	1101
+	0,	//	1110
+	0,	//	1111
+};
+
+#define LAST_CLEAR_BIT(mask) last_clear_bit[mask]
+
+unsigned jstack_reg(Thumb2_Stack *jstack)
+{
+  unsigned *stack = jstack->stack;
+  unsigned depth = jstack->depth;
+  unsigned mask = 0;
+  unsigned r;
+  unsigned i;
+
+  for (i = 0; i < depth; i++) mask |= 1 << stack[i];
+  mask &= (1 << STACK_REGS) - 1;
+  JASSERT(mask != (1 << STACK_REGS) - 1, "No free reg in push");
+  r = LAST_CLEAR_BIT(mask);
+  return r;
+}
+
+unsigned jstack_prefer(Thumb2_Stack *jstack, Reg prefer)
+{
+  unsigned *stack = jstack->stack;
+  unsigned depth = jstack->depth;
+  unsigned mask = 0;
+  unsigned r;
+  unsigned i;
+
+  for (i = 0; i < depth; i++) mask |= 1 << stack[i];
+  mask &= (1 << STACK_REGS) - 1;
+  if ((prefer & ~mask) & 0x0f) mask |= (~prefer & ((1 << STACK_REGS) - 1));
+  JASSERT(mask != (1 << STACK_REGS) - 1, "No free reg in push");
+  r = LAST_CLEAR_BIT(mask);
+  return r;
+}
+
+void Thumb2_Fill(Thumb2_Info *jinfo, unsigned required)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned *stack = jstack->stack;
+  unsigned depth = jstack->depth;
+  unsigned mask = 0;
+  unsigned tofill;
+  unsigned r, i;
+
+  if (depth >= required) return;
+  tofill = required - depth;
+  for (i = depth; i > 0;) {
+    i--;
+    mask |= 1 << stack[i];
+    stack[i+tofill] = stack[i];
+  }
+  mask &= (1 << STACK_REGS) - 1;
+  for (i = 0; i < tofill; i++) {
+    JASSERT(mask != (1 << STACK_REGS) - 1, "Fill failed!!!");
+    r = LAST_CLEAR_BIT(mask);
+    mask |= (1 << r);
+    stack[i] = r;
+  }
+  jstack->depth = depth + tofill;
+  Thumb2_Pop_Multiple(jinfo->codebuf, stack, tofill);
+}
+
+static const unsigned bitcount[] = {
+	0,	// 0000
+	1,	// 0001
+	1,	// 0010
+	2,	// 0011
+	1,	// 0100
+	2,	// 0101
+	2,	// 0110
+	3,	// 0111
+	1,	// 1000
+	2,	// 1001
+	2,	// 1010
+	3,	// 1011
+	2,	// 1100
+	3,	// 1101
+	3,	// 1110
+	4,	// 1111
+};
+
+#define BITCOUNT(mask) bitcount[mask]
+
+// Thumb2_Spill:-
+// 	required - ensure that at least this many registers are available
+// 	exclude - bitmask, do not count these registers as available
+//
+// 	The no. of available regs (STACK_REGS) less the no. of registers in
+// 	exclude must be >= the number required, otherwise this function loops!
+//
+// 	Typical usage is
+//
+// 	Thumb2_Spill(jinfo, 2, 0);	// get 2 free regs
+// 	r_res_lo = PUSH(jinfo->jstack, JSTACK_REG(jinfo->jstack));
+// 	r_res_hi = PUSH(jinfo->jstack, JSTACK_REG(jinfo->jstack));
+//
+//	Use the exclude mask when you do not want a subsequent call to
+//	JSTACK_REG to return a particular register or registers. This can
+//	be useful, for example, with long (64) bit operations. Eg. In the
+//	following we use it to ensure that the hi inputs are not clobbered
+//	by the lo result as part of the intermediate calculation.
+//
+//	Thumb2_Fill(jinfo, 4);
+//	exclude = (1<<rho_hi)|(1<<lho_hi);
+//	rho_lo = POP(jstack);
+//	rho_hi = POP(jstack);
+//	lho_lo = POP(jstack);
+//	lho_hi = POP(jstack);
+//	Thumb2_Spill(jinfo, 2, exclude);
+//	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~exclude));	// != rho_hi or lho_hi
+//	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~exclude));	// != rho_hi or lho_hi
+//	dop_reg(jinfo->codebuf, DP_ADD, res_lo, lho_lo, rho_lo, SHIFT_LSL, 0); 
+//	dop_reg(jinfo->codebuf, DP_ADC, res_hi, lho_hi, rho_hi, SHIFT_LSL, 0);
+//	
+void Thumb2_Spill(Thumb2_Info *jinfo, unsigned required, unsigned exclude)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned *stack = jstack->stack;
+  unsigned depth = jstack->depth;
+  unsigned mask;
+  unsigned i;
+  unsigned tospill = 0;
+
+  exclude &= (1 << STACK_REGS) - 1;
+  if (depth <= (STACK_REGS - required) && exclude == 0) return;
+  while (1) {
+    mask = 0;
+    for (i = tospill; i < depth; i++) mask |= 1 << stack[i];
+    mask &= ((1 << STACK_REGS) - 1);
+    mask |= exclude;
+    if (STACK_REGS - BITCOUNT(mask) >= required) break;
+    tospill++;
+  }
+  if (tospill == 0) return;
+  Thumb2_Push_Multiple(jinfo->codebuf, stack, tospill);
+  for (i = tospill; i < depth; i++)
+    stack[i-tospill] = stack[i];
+  jstack->depth = depth - tospill;
+  JASSERT((int)jstack->depth >= 0, "Stack underflow");
+}
+
+// Thumb2_Tmp:-
+// 	Allocate a temp reg for use in local code generation.
+// 	exclude is a bit mask of regs not to use.
+// 	A max of 2 regs can be guaranteed (ARM_IP & ARM_LR)
+// 	If allocating 2 regs you must include the reg you got the
+// 	first time in the exclude list. Otherwise you just get
+// 	the same reg again.
+Reg Thumb2_Tmp(Thumb2_Info *jinfo, unsigned exclude)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned *stack = jstack->stack;
+  unsigned depth = jstack->depth;
+  unsigned mask;
+  unsigned i;
+
+  mask = 0;
+  for (i = 0; i < depth; i++) mask |= 1 << stack[i];
+  mask |= exclude;
+  for (i = 0; i < STACK_REGS; i++)
+    if ((mask & (1<<i)) == 0) return i;
+  if ((mask & (1<<ARM_IP)) == 0) return ARM_IP;
+  if ((mask & (1<<ARM_LR)) == 0) return ARM_LR;
+  JASSERT(0, "failed to allocate a tmp reg");
+}
+
+void Thumb2_Flush(Thumb2_Info *jinfo)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+
+  if (jstack->depth > 0)
+    Thumb2_Push_Multiple(jinfo->codebuf, jstack->stack, jstack->depth);
+  jstack->depth = 0;
+}
+
+// Call this when we are about to corrupt a local
+// The local may already be on the stack
+// For example
+// 	iload	0
+// 	iconst	2
+// 	istore	0
+// 	istore	1
+// Without this check the code generated would be (r4 is local 0, r5 is local 1)
+// 	mov	r4, #2
+//	mov	r5, r4
+// With this check the code should be
+// 	mov	r3, r4
+// 	mov	r4, #2
+// 	mov	r5, r3
+// This is not ideal, but is better than the previous:-)
+//
+void Thumb2_Corrupt(Thumb2_Info *jinfo, unsigned r, unsigned ignore)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned *stack = jstack->stack;
+  unsigned depth = jstack->depth;
+  unsigned r_new, mask;
+  unsigned i;
+
+  if (ignore >= depth) return;
+//  JASSERT(depth >= ignore, "Cant ignore more than the whole stack!!");
+  if (IS_SREG(r)) return;
+  depth -= ignore;
+  for (i = 0; i < depth; i++) {
+    if (r == stack[i]) {
+      Thumb2_Spill(jinfo, 1, 0);
+      depth = jstack->depth - ignore;
+      r_new = JSTACK_REG(jstack);
+      mov_reg(jinfo->codebuf, r_new, r);
+      for (i = 0; i < depth; i++) if (r == stack[i]) stack[i] = r_new;
+      break;
+    }
+  }
+}
+
+unsigned Thumb2_ResultLocal(Thumb2_Info *jinfo, unsigned bci)
+{
+  unsigned opc = jinfo->code_base[bci];
+  if (jinfo->bc_stackinfo[bci] & BC_BRANCH_TARGET) return 0;
+  if (opc < opc_istore || opc > opc_astore_3) return 0;
+  if (opc == opc_istore || opc == opc_fstore || opc == opc_astore)
+    return jinfo->jregs->r_local[jinfo->code_base[bci+1]];
+  if ((opc >= opc_istore_0 && opc <= opc_istore_3) ||
+	(opc >= opc_fstore_0 && opc <= opc_fstore_3) ||
+	(opc >= opc_astore_0 && opc <= opc_astore_3))
+    return jinfo->jregs->r_local[(opc-opc_istore_0)&3];
+  return 0;
+}
+
+static const unsigned char dOps[] = {
+	DP_ADD, DP_ADC, VP_ADD, VP_ADD,
+	DP_SUB, DP_SBC, VP_SUB, VP_SUB,
+	DP_MUL, 0, VP_MUL, VP_MUL,
+	0, 0, VP_DIV, VP_DIV,
+	0, 0, 0, 0,
+	0, 0, 0, 0,
+	DP_LSL, 0,
+	DP_ASR, 0,
+	DP_LSR, 0,
+	DP_AND, DP_AND, DP_ORR, DP_ORR, DP_EOR, DP_EOR,
+};
+
+unsigned Thumb2_Imm(Thumb2_Info *jinfo, unsigned imm, unsigned next_bci)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r;
+  unsigned next_op;
+
+  if (!(jinfo->bc_stackinfo[next_bci] & BC_BRANCH_TARGET)) {
+    next_op = jinfo->code_base[next_bci];
+    if (next_op > OPC_LAST_JAVA_OP) {
+      if (Bytecodes::is_defined((Bytecodes::Code)next_op))
+	next_op = (unsigned)Bytecodes::java_code((Bytecodes::Code)next_op);
+    }
+    switch (next_op) {
+      case opc_istore:
+      case opc_fstore:
+      case opc_astore: {
+	unsigned local = jinfo->code_base[next_bci+1];
+	r = jinfo->jregs->r_local[local];
+	if (r) {
+	  Thumb2_Corrupt(jinfo, r, 0);
+	  mov_imm(jinfo->codebuf, r, imm);
+	  return 2;
+	}
+	break;
+      }
+      case opc_istore_0:
+      case opc_istore_1:
+      case opc_istore_2:
+      case opc_istore_3:
+      case opc_fstore_0:
+      case opc_fstore_1:
+      case opc_fstore_2:
+      case opc_fstore_3:
+      case opc_astore_0:
+      case opc_astore_1:
+      case opc_astore_2:
+      case opc_astore_3: {
+	unsigned local = (jinfo->code_base[next_bci]-opc_istore_0) & 3;
+	r = jinfo->jregs->r_local[local];
+	if (r) {
+	  Thumb2_Corrupt(jinfo, r, 0);
+	  mov_imm(jinfo->codebuf, r, imm);
+	  return 1;
+	}
+	break;
+      }
+      case opc_iadd:
+      case opc_isub:
+      case opc_ishl:
+      case opc_ishr:
+      case opc_iushr:
+      case opc_iand:
+      case opc_ior:
+      case opc_ixor: {
+	unsigned len = 0;
+	unsigned r_lho;
+
+	Thumb2_Fill(jinfo, 1);
+	r_lho = POP(jstack);
+
+	r = Thumb2_ResultLocal(jinfo, next_bci+1);
+	if (r) {
+	  Thumb2_Corrupt(jinfo, r, 0);
+	  len = Bytecodes::length_for((Bytecodes::Code)jinfo->code_base[next_bci+1]);
+	} else {
+	  Thumb2_Spill(jinfo, 1, 0);
+	  r = JSTACK_REG(jstack);
+	  PUSH(jstack, r);
+	}
+	if (next_op == opc_ishl || next_op == opc_ishr || next_op == opc_iushr)
+	  shift_imm(jinfo->codebuf, dOps[next_op-opc_iadd], r, r_lho, imm);
+	else
+	  dop_imm(jinfo->codebuf, dOps[next_op-opc_iadd], r, r_lho, imm);
+	return 1+len;
+      }
+
+      case opc_idiv: {
+	unsigned len = 0;
+	unsigned r_lho;
+	unsigned abs_imm = abs((int)imm);
+
+	if ((imm & -imm) == abs_imm) {
+	  unsigned l2_imm = LOG2(abs_imm);
+	  unsigned r_lho;
+
+	  if (imm == 0) break;
+	  if (imm == 1) return 1;
+
+	  Thumb2_Fill(jinfo, 1);
+	  r_lho = POP(jstack);
+
+	  r = Thumb2_ResultLocal(jinfo, next_bci+1);
+	  if (r) {
+	    Thumb2_Corrupt(jinfo, r, 0);
+	    len = Bytecodes::length_for((Bytecodes::Code)jinfo->code_base[next_bci+1]);
+	  } else {
+	    Thumb2_Spill(jinfo, 1, 0);
+	    r = JSTACK_REG(jstack);
+	    PUSH(jstack, r);
+	  }
+
+	  if (abs_imm != 1) {
+	    unsigned r_tmp = r_lho;
+	    if (abs_imm != 2) {
+	      r_tmp = Thumb2_Tmp(jinfo, (1<<r_lho));
+	      asr_imm(jinfo->codebuf, r_tmp, r_lho, 31);
+	    }
+	    add_reg_shift(jinfo->codebuf, r, r_lho, r_tmp, SHIFT_LSR, 32-l2_imm);
+	    asr_imm(jinfo->codebuf, r, r, l2_imm);
+	  }
+	  if ((int)imm < 0)
+	    rsb_imm(jinfo->codebuf, r, r, 0);
+	  return 1+len;
+	}
+	break;
+      }
+    }
+  }
+  Thumb2_Spill(jinfo, 1, 0);
+  r = JSTACK_REG(jstack);
+  PUSH(jstack, r);
+  mov_imm(jinfo->codebuf, r, imm);
+  return 0;
+}
+
+void Thumb2_ImmX2(Thumb2_Info *jinfo, unsigned lo, unsigned hi)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lo, r_hi;
+
+  Thumb2_Spill(jinfo, 2, 0);
+  r_hi = PUSH(jstack, JSTACK_REG(jstack));
+  r_lo = PUSH(jstack, JSTACK_REG(jstack));
+  mov_imm(jinfo->codebuf, r_lo, lo);
+  mov_imm(jinfo->codebuf, r_hi, hi);
+}
+
+#define LOCAL_OFFSET(local, stackdepth, nlocals) ((stackdepth)*4 + FRAME_SIZE + ((nlocals)-1-(local))*4)
+
+void load_local(Thumb2_Info *jinfo, Reg r, unsigned local, unsigned stackdepth)
+{
+#ifdef USE_RLOCAL
+  ldr_imm(jinfo->codebuf, r, Rlocals, -local * 4, 1, 0);
+#else
+  int nlocals = jinfo->method->max_locals();
+  ldr_imm(jinfo->codebuf, r, Rstack, LOCAL_OFFSET(local, stackdepth, nlocals), 1, 0);
+#endif
+}
+
+void store_local(Thumb2_Info *jinfo, Reg r, unsigned local, unsigned stackdepth)
+{
+#ifdef USE_RLOCAL
+  str_imm(jinfo->codebuf, r, Rlocals, -local << 2, 1, 0);
+#else
+  int nlocals = jinfo->method->max_locals();
+  str_imm(jinfo->codebuf, r, Rstack, LOCAL_OFFSET(local, stackdepth, nlocals), 1, 0);
+#endif
+}
+
+void Thumb2_Load(Thumb2_Info *jinfo, int local, unsigned stackdepth)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r;
+
+  r = jinfo->jregs->r_local[local];
+  if (r) {
+    PUSH(jstack, r);
+  } else {
+    int nlocals = jinfo->method->max_locals();
+
+    Thumb2_Spill(jinfo, 1, 0);
+    JASSERT(stackdepth >= jstack->depth, "negative stack offset?");
+    stackdepth -= jstack->depth;
+    if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+    r = JSTACK_REG(jstack);
+    PUSH(jstack, r);
+    load_local(jinfo, r, local, stackdepth);
+  }
+}
+
+void Thumb2_LoadX2(Thumb2_Info *jinfo, int local, unsigned stackdepth)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lo, r_hi;
+  int nlocals = jinfo->method->max_locals();
+
+  r_hi = jinfo->jregs->r_local[local];
+  if (r_hi) {
+    r_lo = jinfo->jregs->r_local[local+1];
+    if (r_lo) {
+      PUSH(jstack, r_hi);
+      PUSH(jstack, r_lo);
+    } else {
+      Thumb2_Spill(jinfo, 1, 0);
+      stackdepth -= jstack->depth;
+      if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+      PUSH(jstack, r_hi);
+      r_lo = PUSH(jstack, JSTACK_REG(jstack));
+      load_local(jinfo, r_lo, local+1, stackdepth);
+    }
+  } else {
+    r_lo = jinfo->jregs->r_local[local+1];
+    if (r_lo) {
+      Thumb2_Spill(jinfo, 1, 0);
+      stackdepth -= jstack->depth;
+      if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+      r_hi = PUSH(jstack, JSTACK_REG(jstack));
+      load_local(jinfo, r_hi, local, stackdepth);
+      PUSH(jstack, r_lo);
+    } else {
+      Thumb2_Spill(jinfo, 2, 0);
+      stackdepth -= jstack->depth;
+      if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+      r_hi = PUSH(jstack, JSTACK_REG(jstack));
+      r_lo = PUSH(jstack, JSTACK_REG(jstack));
+      load_local(jinfo, r_hi, local, stackdepth);
+      load_local(jinfo, r_lo, local+1, stackdepth);
+    }
+  }
+}
+
+void Thumb2_Store(Thumb2_Info *jinfo, int local, unsigned stackdepth)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r, r_local;
+  int nlocals = jinfo->method->max_locals();
+
+  Thumb2_Fill(jinfo, 1);
+  stackdepth -= jstack->depth;
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  r = POP(jstack);
+  r_local = jinfo->jregs->r_local[local];
+  if (r_local) {
+    Thumb2_Corrupt(jinfo, r_local, 0);
+    mov_reg(jinfo->codebuf, r_local, r);
+  } else {
+    store_local(jinfo, r, local, stackdepth);
+  }
+}
+
+void Thumb2_StoreX2(Thumb2_Info *jinfo, int local, unsigned stackdepth)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lo, r_hi;
+  unsigned r_local_lo, r_local_hi;
+  int nlocals = jinfo->method->max_locals();
+
+  Thumb2_Fill(jinfo, 2);
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  r_lo = POP(jstack);
+  r_hi = POP(jstack);
+  stackdepth -= 2;
+
+  r_local_hi = jinfo->jregs->r_local[local];
+  if (r_local_hi) {
+    Thumb2_Corrupt(jinfo, r_local_hi, 0);
+    mov_reg(jinfo->codebuf, r_local_hi, r_hi);
+  } else {
+    store_local(jinfo, r_hi, local, stackdepth-jstack->depth);
+  }
+
+  r_local_lo = jinfo->jregs->r_local[local+1];
+  if (r_local_lo) {
+    Thumb2_Corrupt(jinfo, r_local_lo, 0);
+    mov_reg(jinfo->codebuf, r_local_lo, r_lo);
+  } else {
+    store_local(jinfo, r_lo, local+1, stackdepth-jstack->depth);
+  }
+}
+
+void Thumb2_Xaload(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_index, r_array, r_value;
+  unsigned op = opc - (unsigned)opc_iaload;
+  unsigned r_tmp;
+
+  Thumb2_Fill(jinfo, 2);
+  r_index = POP(jstack);
+  r_array = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index));
+  r_value = JSTACK_REG(jstack);
+  PUSH(jstack, r_value);
+  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
+  chka(jinfo->codebuf, r_tmp, r_index);
+  if (opc == opc_baload) {
+    add_reg(jinfo->codebuf, r_tmp, r_array, r_index);
+    ldrsb_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  } else if (opc == opc_caload) {
+    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 1);
+    ldrh_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  } else if (opc == opc_saload) {
+    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 1);
+    ldrsh_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  } else {
+    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 2);
+    ldr_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  }
+}
+
+void Thumb2_X2aload(Thumb2_Info *jinfo)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_index, r_array, r_lo, r_hi;
+  unsigned r_tmp;
+
+  Thumb2_Fill(jinfo, 2);
+  r_index = POP(jstack);
+  r_array = POP(jstack);
+  Thumb2_Spill(jinfo, 2, 0);
+  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index));
+  r_hi = PUSH(jstack, JSTACK_REG(jstack));
+  r_lo = PUSH(jstack, JSTACK_REG(jstack));
+  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
+  chka(jinfo->codebuf, r_tmp, r_index);
+  add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 3);
+  ldrd_imm(jinfo->codebuf, r_lo, r_hi, r_tmp, 16, 1, 0);
+}
+
+void Thumb2_Xastore(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_value, r_index, r_array;
+  unsigned op = opc - (unsigned)opc_iastore;
+  unsigned r_tmp;
+
+  Thumb2_Fill(jinfo, 3);
+  r_value = POP(jstack);
+  r_index = POP(jstack);
+  r_array = POP(jstack);
+  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index)|(1<<r_value));
+  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
+  chka(jinfo->codebuf, r_tmp, r_index);
+  if (opc == opc_bastore) {
+    add_reg(jinfo->codebuf, r_tmp, r_array, r_index);
+    strb_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  } else if (opc == opc_castore || opc == opc_sastore) {
+    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 1);
+    strh_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  } else {
+    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 2);
+    str_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
+  }
+}
+
+void Thumb2_X2astore(Thumb2_Info *jinfo)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lo, r_hi, r_index, r_array;
+  unsigned r_tmp;
+
+  Thumb2_Fill(jinfo, 4);
+  r_lo = POP(jstack);
+  r_hi = POP(jstack);
+  r_index = POP(jstack);
+  r_array = POP(jstack);
+  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index)|(1<<r_lo)|(1<<r_hi));
+  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
+  chka(jinfo->codebuf, r_tmp, r_index);
+  add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 3);
+  strd_imm(jinfo->codebuf, r_lo, r_hi, r_tmp, 16, 1, 0);
+}
+
+void Thumb2_Pop(Thumb2_Info *jinfo, unsigned n)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+
+  while (n > 0 && jstack->depth > 0) {
+    POP(jstack);
+    n--;
+  }
+  if (n > 0) add_imm(jinfo->codebuf, Rstack, Rstack, n * 4);
+}
+
+void Thumb2_Dup(Thumb2_Info *jinfo, unsigned n)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned *stack = jstack->stack;
+  unsigned depth;
+  unsigned i;
+
+  Thumb2_Fill(jinfo, n+1);
+  depth = jstack->depth;
+  for (i = 0; i <= n; i++)
+    stack[depth-i] = stack[depth-i-1];
+  stack[depth-n-1] = stack[depth];
+  jstack->depth = depth + 1;
+}
+
+void Thumb2_Dup2(Thumb2_Info *jinfo, unsigned n)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned *stack = jstack->stack;
+  unsigned depth;
+  unsigned i;
+
+  Thumb2_Fill(jinfo, n+2);
+  depth = jstack->depth;
+  for (i = 0; i <= n+1; i++)
+    stack[depth-i+1] = stack[depth-i-1];
+  stack[depth-n-1] = stack[depth+1];
+  stack[depth-n-2] = stack[depth];
+  jstack->depth = depth + 2;
+}
+
+void Thumb2_Swap(Thumb2_Info *jinfo)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+
+  Thumb2_Fill(jinfo, 2);
+  SWAP(jstack);
+}
+
+void Thumb2_iOp(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lho, r_rho, r;
+
+  Thumb2_Fill(jinfo, 2);
+  r_rho = POP(jstack);
+  r_lho = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  r = JSTACK_REG(jstack);
+  PUSH(jstack, r);
+  dop_reg(jinfo->codebuf, dOps[opc-opc_iadd], r, r_lho, r_rho, 0, 0);
+}
+
+void Thumb2_iNeg(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_src, r;
+
+  Thumb2_Fill(jinfo, 1);
+  r_src = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  r = JSTACK_REG(jstack);
+  PUSH(jstack, r);
+  rsb_imm(jinfo->codebuf, r, r_src, 0);
+}
+
+void Thumb2_lNeg(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lo, r_hi, r_res_lo, r_res_hi;
+  unsigned r_tmp;
+
+  Thumb2_Fill(jinfo, 2);
+  r_lo = POP(jstack);
+  r_hi = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  r_res_hi = PUSH(jstack, JSTACK_REG(jstack));
+  Thumb2_Spill(jinfo, 1, (1<<r_hi));
+  r_res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~(1<<r_hi)));
+  JASSERT(r_res_lo != r_res_hi, "oops");
+  JASSERT(r_res_lo != r_hi, "r_res_lo != r_hi");
+  rsb_imm(jinfo->codebuf, r_res_lo, r_lo, 0);
+  r_tmp = Thumb2_Tmp(jinfo, (1<<r_hi)|(1<<r_res_lo));
+  mov_imm(jinfo->codebuf, r_tmp, 0);
+  dop_reg(jinfo->codebuf, DP_SBC, r_res_hi, r_tmp, r_hi, SHIFT_LSL, 0);
+}
+
+void Thumb2_fNeg(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r, r_result;
+
+  Thumb2_Fill(jinfo, 1);
+  r = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  r_result = PUSH(jstack, JSTACK_REG(jstack));
+  eor_imm(jinfo->codebuf, r_result, r, 0x80000000);
+}
+
+void Thumb2_dNeg(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned r_lo, r_hi, r_res_lo, r_res_hi;
+
+  Thumb2_Fill(jinfo, 2);
+  r_lo = POP(jstack);
+  r_hi = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  r_res_hi = PUSH(jstack, JSTACK_REG(jstack));
+  Thumb2_Spill(jinfo, 1, (1<<r_hi));
+  r_res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~(1<<r_hi)));
+  JASSERT(r_res_lo != r_res_hi, "oops");
+  JASSERT(r_res_lo != r_hi, "r_res_lo != r_hi");
+  mov_reg(jinfo->codebuf, r_res_lo, r_lo);
+  eor_imm(jinfo->codebuf, r_res_hi, r_hi, 0x80000000);
+}
+
+void Thumb2_lOp(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned res_lo, res_hi;
+  unsigned lho_lo, lho_hi;
+  unsigned rho_lo, rho_hi;
+
+  Thumb2_Fill(jinfo, 4);
+  rho_lo = POP(jstack);
+  rho_hi = POP(jstack);
+  lho_lo = POP(jstack);
+  lho_hi = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  res_hi = PUSH(jstack, JSTACK_REG(jstack));
+  Thumb2_Spill(jinfo, 1, (1<<lho_hi)|(1<<rho_hi));
+  res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_hi)|(1<<rho_hi))));
+  JASSERT(res_lo != rho_hi && res_lo != lho_hi, "res_lo != rho_hi && res_lo != lho_hi");
+  dop_reg(jinfo->codebuf, dOps[opc-opc_ladd], res_lo, lho_lo, rho_lo, SHIFT_LSL, 0);
+  dop_reg(jinfo->codebuf, dOps[opc-opc_ladd+1], res_hi, lho_hi, rho_hi, SHIFT_LSL, 0);
+}
+
+void Thumb2_lmul(Thumb2_Info *jinfo)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned res_lo, res_hi;
+  unsigned lho_lo, lho_hi;
+  unsigned rho_lo, rho_hi;
+  unsigned r_tmp_lo, r_tmp_hi;
+  unsigned op_mask;
+
+  Thumb2_Fill(jinfo, 4);
+  rho_lo = POP(jstack);
+  rho_hi = POP(jstack);
+  lho_lo = POP(jstack);
+  lho_hi = POP(jstack);
+  op_mask = (1<<rho_lo)|(1<<rho_hi)|(1<<lho_lo)|(1<<lho_hi);
+  Thumb2_Spill(jinfo, 2, 0);
+  res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~op_mask));
+  res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~op_mask));
+  r_tmp_lo = res_lo;
+  r_tmp_hi = res_hi;
+  if (op_mask & (1<<r_tmp_lo)) r_tmp_lo = Thumb2_Tmp(jinfo, op_mask);
+  if (op_mask & (1<<r_tmp_hi)) r_tmp_hi = Thumb2_Tmp(jinfo, op_mask|(1<<r_tmp_lo));
+  umull(jinfo->codebuf, r_tmp_lo, r_tmp_hi, rho_lo, lho_lo);
+  mla(jinfo->codebuf, r_tmp_hi, rho_lo, lho_hi, r_tmp_hi);
+  mla(jinfo->codebuf, res_hi, rho_hi, lho_lo, r_tmp_hi);
+  mov_reg(jinfo->codebuf, res_lo, r_tmp_lo);
+}
+
+void Thumb2_fOp(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned rho, lho, res;
+
+  Thumb2_Fill(jinfo, 2);
+  rho = POP(jstack);
+  lho = POP(jstack);
+  Thumb2_Spill(jinfo, 1, 0);
+  res = PUSH(jstack, JSTACK_REG(jstack));
+  vmov_reg_s_toVFP(jinfo->codebuf, VFP_S0, lho);
+  vmov_reg_s_toVFP(jinfo->codebuf, VFP_S1, rho);
+  vop_reg_s(jinfo->codebuf, dOps[opc-opc_iadd], VFP_S0, VFP_S0, VFP_S1);
+  vmov_reg_s_toARM(jinfo->codebuf, res, VFP_S0);
+}
+
+void Thumb2_dOp(Thumb2_Info *jinfo, u32 opc)
+{
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned rho_lo, rho_hi, lho_lo, lho_hi, res_lo, res_hi;
+
+  Thumb2_Fill(jinfo, 4);
+  rho_lo = POP(jstack);
+  rho_hi = POP(jstack);
+  lho_lo = POP(jstack);
+  lho_hi = POP(jstack);
+  Thumb2_Spill(jinfo, 2, 0);
+  res_hi = PUSH(jstack, JSTACK_REG(jstack));
+  res_lo = PUSH(jstack, JSTACK_REG(jstack));
+  vmov_reg_d_toVFP(jinfo->codebuf, VFP_D0, lho_lo, lho_hi);
+  vmov_reg_d_toVFP(jinfo->codebuf, VFP_D1, rho_lo, rho_hi);
+  vop_reg_d(jinfo->codebuf, dOps[opc-opc_iadd], VFP_D0, VFP_D0, VFP_D1);
+  vmov_reg_d_toARM(jinfo->codebuf, res_lo, res_hi, VFP_D0);
+}
+
+void Thumb2_Handler(Thumb2_Info *jinfo, unsigned handler, unsigned opcode, unsigned bci)
+{
+  mov_imm(jinfo->codebuf, ARM_R0, opcode);
+  mov_imm(jinfo->codebuf, ARM_R1, bci);
+  mov_imm(jinfo->codebuf, ARM_IP, 0);
+  str_imm(jinfo->codebuf, ARM_IP, ARM_IP, 0, 1, 0);
+//  hbl(jinfo->codebuf, handler);
+}
+
+void Thumb2_Debug(Thumb2_Info *jinfo, unsigned handler)
+{
+#if 0
+  Thumb2_Flush(jinfo);
+  bl(jinfo->codebuf, handlers[handler]);
+#endif
+}
+
+void Thumb2_codegen(Thumb2_Info *jinfo, unsigned start);
+
+int Thumb2_Branch(Thumb2_Info *jinfo, unsigned bci, unsigned cond)
+{
+    int offset = GET_JAVA_S2(jinfo->code_base + bci + 1);
+    unsigned dest_taken = bci + offset;
+    unsigned dest_not_taken = bci + 3;
+    unsigned loc;
+
+    if (jinfo->bc_stackinfo[dest_taken] & BC_COMPILED) {
+      branch(jinfo->codebuf, cond, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
+      return dest_not_taken;
+    }
+    loc = forward_32(jinfo->codebuf);
+    Thumb2_codegen(jinfo, dest_not_taken);
+    JASSERT(jinfo->bc_stackinfo[dest_taken] & BC_COMPILED, "dest in branch not compiled!!!");
+    branch_patch(jinfo->codebuf, cond, loc, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
+    return -1;
+}
+
+int Thumb2_Goto(Thumb2_Info *jinfo, unsigned bci, int offset, int len)
+{
+    unsigned dest_taken = bci + offset;
+    unsigned dest_not_taken = bci + len;
+    unsigned loc;
+
+    if (jinfo->bc_stackinfo[dest_taken] & BC_COMPILED) {
+      branch_uncond(jinfo->codebuf, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
+      return dest_not_taken;
+    }
+    loc = forward_32(jinfo->codebuf);
+    Thumb2_codegen(jinfo, dest_not_taken);
+    JASSERT(jinfo->bc_stackinfo[dest_taken] & BC_COMPILED, "dest in goto not compiled!!!");
+    branch_uncond_patch(jinfo->codebuf, loc, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
+    return -1;
+}
+
+void Thumb2_Return(Thumb2_Info *jinfo, unsigned opcode)
+{
+  Reg r_lo, r;
+  Thumb2_Stack *jstack = jinfo->jstack;
+
+  if (0 /*jinfo->compiled_return*/) {
+    unsigned bci = jinfo->compiled_return;
+
+    JASSERT(jinfo->bc_stackinfo[bci] & BC_COMPILED, "return not compiled");
+    JASSERT(jinfo->code_base[bci] == opcode, "type of return changed");
+    branch_uncond(jinfo->codebuf, jinfo->bc_stackinfo[bci] & ~BC_FLAGS_MASK);
+    return;
+  }
+
+  if (jinfo->method->is_synchronized()) {
+    unsigned loc_success1, loc_success2, loc_failed, loc_retry, loc_exception;
+    unsigned loc_illegal_monitor_state;
+    Thumb2_Flush(jinfo);
+//    Thumb2_save_locals(jinfo);
+    // Free the monitor
+    //
+    // 		sub	r1, Ristate, #8
+    // 		ldr	r2, [r1, #4]
+    //		cbz	r2, throw_illegal_monitor_state
+    //		ldr	r0, [r1, #0]
+    //		mov	r3, #0
+    //		str	r3, [r1, #4]
+    //		cbz	r0, success
+    //	retry:
+    //		ldrex	r3, [r2, #0]
+    //		cmp	r1, r3
+    //		bne	failed
+    //		strex	r3, r0, [r2, #0]
+    //		cbz	r3, success
+    //		b	retry
+    //	failed:
+    //		str	r2, [r1, #4]
+    //		...
+    //  success:
+    //
+    // JAZ_V1 == tmp2
+    // JAZ_V2 == tmp1
+    sub_imm(jinfo->codebuf, ARM_R1, Ristate, frame::interpreter_frame_monitor_size()*wordSize);
+    ldr_imm(jinfo->codebuf, ARM_R2, ARM_R1, 4, 1, 0);
+    loc_illegal_monitor_state = forward_16(jinfo->codebuf);
+    ldr_imm(jinfo->codebuf, ARM_R0, ARM_R1, 0, 1, 0);
+    mov_imm(jinfo->codebuf, ARM_R3, 0);
+    str_imm(jinfo->codebuf, ARM_R3, ARM_R1, 4, 1, 0);
+    loc_success1 = forward_16(jinfo->codebuf);
+    loc_retry = out_loc(jinfo->codebuf);
+    ldrex_imm(jinfo->codebuf, ARM_R3, ARM_R2, 0);
+    cmp_reg(jinfo->codebuf, ARM_R1, ARM_R3);
+    loc_failed = forward_16(jinfo->codebuf);
+    strex_imm(jinfo->codebuf, ARM_R3, ARM_R0, ARM_R2, 0);
+    loc_success2 = forward_16(jinfo->codebuf);
+    branch_uncond(jinfo->codebuf, loc_retry);
+    bcc_patch(jinfo->codebuf, COND_NE, loc_failed);
+    cbz_patch(jinfo->codebuf, ARM_R2, loc_illegal_monitor_state);
+    str_imm(jinfo->codebuf, ARM_R2, ARM_R1, 4, 1, 0);
+    mov_imm(jinfo->codebuf, ARM_R0, 0+CONSTMETHOD_CODEOFFSET);
+    bl(jinfo->codebuf, handlers[H_SYNCHRONIZED_EXIT]);
+    loc_exception = forward_16(jinfo->codebuf);
+    bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+    cbz_patch(jinfo->codebuf, ARM_R0, loc_exception);
+    cbz_patch(jinfo->codebuf, ARM_R0, loc_success1);
+    cbz_patch(jinfo->codebuf, ARM_R3, loc_success2);
+  }
+
+  if (opcode != opc_return) {
+    if (opcode == opc_lreturn || opcode == opc_dreturn) {
+      Thumb2_Fill(jinfo, 2);
+      r_lo = POP(jstack);
+      r = POP(jstack);
+    } else {
+      Thumb2_Fill(jinfo, 1);
+      r = POP(jstack);
+    }
+  }
+
+  mov_imm(jinfo->codebuf, ARM_LR, 0);
+  str_imm(jinfo->codebuf, ARM_LR, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+  ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
+  ldr_imm(jinfo->codebuf, ARM_LR, Rstack, 0, 1, 0);
+
+  if (opcode == opc_return) {
+    add_imm(jinfo->codebuf, Rstack, Rstack, jinfo->method->max_locals() * sizeof(int) + 4);
+  } else {
+    if (opcode == opc_lreturn || opcode == opc_dreturn) {
+      str_imm(jinfo->codebuf, r, Rstack, jinfo->method->max_locals() * sizeof(int), 1, 0);
+      str_imm(jinfo->codebuf, r_lo, Rstack, jinfo->method->max_locals() * sizeof(int)-4, 1, 1);
+    } else
+      str_imm(jinfo->codebuf, r, Rstack, jinfo->method->max_locals() * sizeof(int), 1, 1);
+  }
+
+//  sub_imm(jinfo->codebuf, Ristate, ARM_LR, ISTATE_NEXT_FRAME);
+  str_imm(jinfo->codebuf, ARM_LR, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
+  str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+  Thumb2_Debug(jinfo, H_DEBUG_METHODEXIT);
+//  enter_leave(jinfo->codebuf, 0);
+  ldm(jinfo->codebuf, C_REGSET + (1<<ARM_PC), ARM_SP, POP_FD, 1);
+}
+
+#if 0
+void Thumb2_save_all_locals(Thumb2_Info *jinfo, unsigned stackdepth)
+{
+  int nlocals = jinfo->method->max_locals();
+  int i;
+
+  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  for (i = 0; i < nlocals; i++) {
+    Reg r = jinfo->jregs->r_local[i];
+    if (r) {
+	store_local(jinfo, r, i, stackdepth);
+    }
+  }
+}
+#endif
+
+void Thumb2_save_locals(Thumb2_Info *jinfo, unsigned stackdepth)
+{
+  int nlocals = jinfo->method->max_locals();
+  unsigned *locals_info = jinfo->locals_info;
+  int i;
+
+  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  for (i = 0; i < nlocals; i++) {
+    Reg r = jinfo->jregs->r_local[i];
+    if (r) {
+      if ((locals_info[i] & (1 << LOCAL_REF)) && (locals_info[i] & (1 << LOCAL_MODIFIED))) {
+	store_local(jinfo, r, i, stackdepth);
+      }
+    }
+  }
+}
+
+void Thumb2_restore_locals(Thumb2_Info *jinfo, unsigned stackdepth)
+{
+  int nlocals = jinfo->method->max_locals();
+  unsigned *locals_info = jinfo->locals_info;
+  int i;
+
+  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  for (i = 0; i < nlocals; i++) {
+    Reg r = jinfo->jregs->r_local[i];
+    if (r) {
+      if (locals_info[i] & (1<<LOCAL_REF)) {
+	load_local(jinfo, r, i, stackdepth);
+      }
+    }
+  }
+}
+
+void Thumb2_invoke_save(Thumb2_Info *jinfo, unsigned stackdepth)
+{
+  int nlocals = jinfo->method->max_locals();
+  unsigned *locals_info = jinfo->locals_info;
+  int i;
+
+  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  for (i = 0; i < nlocals; i++) {
+    Reg r = jinfo->jregs->r_local[i];
+    if (r) {
+      if (locals_info[i] & (1 << LOCAL_MODIFIED)) {
+	store_local(jinfo, r, i, stackdepth);
+      }
+    }
+  }
+}
+
+void Thumb2_invoke_restore(Thumb2_Info *jinfo, unsigned stackdepth)
+{
+  int nlocals = jinfo->method->max_locals();
+  unsigned *locals_info = jinfo->locals_info;
+  int i;
+
+  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
+  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+  for (i = 0; i < nlocals; i++) {
+    Reg r = jinfo->jregs->r_local[i];
+    if (r) {
+	load_local(jinfo, r, i, stackdepth);
+    }
+  }
+}
+
+void Thumb2_Exit(Thumb2_Info *jinfo, unsigned handler, unsigned bci, unsigned stackdepth)
+{
+    Thumb2_Flush(jinfo);
+    Thumb2_invoke_save(jinfo, stackdepth);
+    mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+    bl(jinfo->codebuf, handlers[handler]);
+}
+
+void Thumb2_Jsr(Thumb2_Info *jinfo, unsigned bci, unsigned stackdepth)
+{
+      Thumb2_Exit(jinfo, H_JSR, bci, stackdepth);
+}
+
+int Thumb2_Accessor(Thumb2_Info *jinfo)
+{
+  jubyte *code_base = jinfo->code_base;
+  constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+  ConstantPoolCacheEntry* cache;
+  int index = GET_NATIVE_U2(code_base+2);
+  unsigned loc;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+
+  JASSERT(code_base[0] == opc_aload_0 || code_base[0] == opc_iaccess_0, "not an aload_0 in accessor");
+  JASSERT(code_base[4] == opc_ireturn || code_base[4] == opc_areturn, "not an ireturn in accessor");
+  cache = cp->entry_at(index);
+  if (!cache->is_resolved((Bytecodes::Code)opc_getfield)) return 0;
+
+  TosState tos_type = cache->flag_state();
+  int field_offset = cache->f2();
+
+  // Slow entry point
+  loc = forward_32(jinfo->codebuf);
+  out_32(jinfo->codebuf, 0);
+  out_32(jinfo->codebuf, 0);
+
+  out_32(jinfo->codebuf, 0);	// pointer to osr table
+  out_32(jinfo->codebuf, 0);	// Space for exception_table pointer
+  out_32(jinfo->codebuf, 0);	// next compiled method
+
+  out_32(jinfo->codebuf, 0);    // regusage
+  out_32(jinfo->codebuf, 0);
+  out_32(jinfo->codebuf, 0);
+
+  // OSR entry point
+  mov_reg(jinfo->codebuf, ARM_PC, ARM_R0);
+
+  out_align(jinfo->codebuf, CODE_ALIGN);
+
+  // fast entry point
+  bc_stackinfo[0] = (bc_stackinfo[0] & BC_FLAGS_MASK) | (jinfo->codebuf->idx * 2) | BC_COMPILED;
+  branch_uncond_patch(jinfo->codebuf, loc, jinfo->codebuf->idx * 2);
+  ldr_imm(jinfo->codebuf, ARM_R1, ARM_R2, THREAD_JAVA_SP, 1, 0);
+  ldr_imm(jinfo->codebuf, ARM_R0, ARM_R1, 0, 1, 0);
+  if (tos_type == btos)
+    ldrsb_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
+  else if (tos_type == ctos)
+    ldrh_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
+  else if (tos_type == stos)
+    ldrsh_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
+  else
+    ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R0, ARM_R1, 0, 1, 0);
+  mov_reg(jinfo->codebuf, ARM_PC, ARM_LR);
+
+  return 1;
+}
+
+void Thumb2_Enter(Thumb2_Info *jinfo)
+{
+  int parms = jinfo->method->size_of_parameters();
+  int extra_locals = jinfo->method->max_locals() - parms;
+  unsigned *locals_info = jinfo->locals_info;
+  int i;
+
+  // Slow entry point - callee save
+  // R0 = method
+  // R2 = thread
+  stm(jinfo->codebuf, I_REGSET + (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
+  bl(jinfo->codebuf, out_pos(jinfo->codebuf) + CODE_ALIGN - 4);
+  ldm(jinfo->codebuf, I_REGSET + (1<<ARM_PC), ARM_SP, POP_FD, 1);
+
+  out_32(jinfo->codebuf, 0);	// Space for osr_table pointer
+  out_32(jinfo->codebuf, 0);	// Space for exception_table pointer
+  out_32(jinfo->codebuf, 0);	// Pointer to next method
+
+  out_32(jinfo->codebuf, 0);    // regusage
+  out_32(jinfo->codebuf, 0);
+  out_32(jinfo->codebuf, 0);
+
+  // OSR entry point == Slow entry + 16 - caller save
+  // R0 = entry point within compiled method
+  // R1 = locals - THUMB2_MAXLOCALS * 4
+  // R2 = thread
+  // R3 = locals - 31 * 4
+  {
+    int nlocals = jinfo->method->max_locals();
+
+    for (i = 0; i < nlocals; i++) {
+      Reg r = jinfo->jregs->r_local[i];
+      if (r) {
+	ldr_imm(jinfo->codebuf, r,
+		(i < 32) ? ARM_R3 : ARM_R1,
+		(i < 32) ? (31 - i) * 4 : (THUMB2_MAXLOCALS - i) * 4,
+	  	1, 0);
+      }
+    }
+    mov_reg(jinfo->codebuf, Rthread, ARM_R2);
+    mov_reg(jinfo->codebuf, ARM_PC, ARM_R0);
+  }
+
+  out_align(jinfo->codebuf, CODE_ALIGN);
+
+  // Fast entry point == Slow entry + 64 - caller save
+  // R0 = method
+  // R2 = thread
+  stm(jinfo->codebuf, C_REGSET + (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
+//  enter_leave(jinfo->codebuf, 1);
+  ldr_imm(jinfo->codebuf, Rstack, ARM_R2, THREAD_JAVA_SP, 1, 0);
+  Thumb2_Debug(jinfo, H_DEBUG_METHODENTRY);
+  {
+    unsigned stacksize;
+
+    stacksize = (extra_locals + jinfo->method->max_stack()) * sizeof(int);
+    stacksize += FRAME_SIZE + STACK_SPARE;
+    if (!jinfo->is_leaf || stacksize > LEAF_STACK_SIZE) {
+      ldr_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_JAVA_STACK_BASE, 1, 0);
+      sub_imm(jinfo->codebuf, ARM_R1, Rstack, stacksize + LEAF_STACK_SIZE);
+      cmp_reg(jinfo->codebuf, ARM_R3, ARM_R1);
+      it(jinfo->codebuf, COND_CS, IT_MASK_T);
+      bl(jinfo->codebuf, handlers[H_STACK_OVERFLOW]);
+    }
+  }
+  mov_imm(jinfo->codebuf, ARM_R1, 0);
+
+  if (extra_locals > 0) {
+    sub_imm(jinfo->codebuf, Rstack, Rstack, extra_locals * 4);
+
+    for (i = 0; i < extra_locals; i++) {
+      unsigned linfo = locals_info[parms+i];
+      if (linfo & (1<< LOCAL_REF) || ((linfo >> LOCAL_INT) & 0x1f) == 0)
+	str_imm(jinfo->codebuf, ARM_R1, Rstack, (extra_locals-1 - i) * 4, 1, 0);
+    }
+  }
+
+  ldr_imm(jinfo->codebuf, ARM_IP, ARM_R0, METHOD_CONSTANTS, 1, 0);
+
+  sub_imm(jinfo->codebuf, Ristate, Rstack, FRAME_SIZE);
+
+  add_imm(jinfo->codebuf, Rlocals, Rstack, (jinfo->method->max_locals()-1) * sizeof(int));
+  str_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
+
+  if (jinfo->method->is_synchronized()) {
+    sub_imm(jinfo->codebuf, Rstack, Ristate, frame::interpreter_frame_monitor_size()*wordSize);
+    if (jinfo->method->is_static()) {
+      ldr_imm(jinfo->codebuf, ARM_R3, ARM_IP, CONSTANTPOOL_POOL_HOLDER, 1, 0);
+      ldr_imm(jinfo->codebuf, JAZ_V1, ARM_R3, KLASS_PART+KLASS_JAVA_MIRROR, 1, 0);
+    } else {
+      ldr_imm(jinfo->codebuf, JAZ_V1, Rlocals, 0, 1, 0);
+    }
+    str_imm(jinfo->codebuf, JAZ_V1, Rstack, 4, 1, 0);
+  } else
+    mov_reg(jinfo->codebuf, Rstack, Ristate);
+
+  str_imm(jinfo->codebuf, ARM_R1, Ristate, ISTATE_MSG, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R1, Ristate, ISTATE_OOP_TEMP, 1, 0);
+
+  sub_imm(jinfo->codebuf, ARM_R3, Rstack, jinfo->method->max_stack() * sizeof(int));
+  str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_JAVA_SP, 1, 0);
+
+  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK_BASE, 1, 0);
+
+  sub_imm(jinfo->codebuf, ARM_R3, ARM_R3, 4);
+  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_STACK_LIMIT, 1, 0);
+
+  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_TOP_ZERO_FRAME, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_NEXT_FRAME, 1, 0);
+
+  mov_imm(jinfo->codebuf, ARM_R3, INTERPRETER_FRAME);
+  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_FRAME_TYPE, 1, 0);
+
+  str_imm(jinfo->codebuf, Ristate, Ristate, ISTATE_MONITOR_BASE, 1, 0);
+
+  add_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_NEXT_FRAME);
+  str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_TOP_ZERO_FRAME, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_LAST_JAVA_SP, 1, 0);
+
+  ldr_imm(jinfo->codebuf, ARM_R3, ARM_IP, CONSTANTPOOL_CACHE, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_CONSTANTS, 1, 0);
+
+  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_THREAD, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
+
+  mov_reg(jinfo->codebuf, Rthread, ARM_R2);
+
+  if (jinfo->method->is_synchronized()) {
+    unsigned loc_retry, loc_failed, loc_success, loc_exception;
+
+    // JAZ_V1 == monitor object
+    //
+    // Try to acquire the monitor. Seems very sub-optimal
+    // 		ldr	r3, [JAZ_V1, #0]
+    // 		sub	r1, Ristate, #8
+    // 		orr	r3, r3, #1
+    // 		str	r3, [r1, #0]
+    // 	retry:
+    // 		ldrex	r0, [JAZ_V1, #0]
+    // 		cmp	r3, r0
+    // 		bne	failed
+    // 		strex	r0, r1, [JAZ_V1, #0]
+    // 		cbz	r0, success
+    // 		b	retry
+    // 	failed:
+    // 		<failed - someone else has the monitor - must yield>
+    //  success:
+    // 		<success - acquired the monitor>
+    //
+    ldr_imm(jinfo->codebuf, ARM_R3, JAZ_V1, 0, 1, 0);
+    sub_imm(jinfo->codebuf, ARM_R1, Ristate, frame::interpreter_frame_monitor_size()*wordSize);
+    orr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 1);
+    str_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
+    loc_retry = out_loc(jinfo->codebuf);
+// retry:
+    ldrex_imm(jinfo->codebuf, ARM_R0, JAZ_V1, 0);
+    cmp_reg(jinfo->codebuf, ARM_R3, ARM_R0);
+    loc_failed = forward_16(jinfo->codebuf);
+    strex_imm(jinfo->codebuf, ARM_R0, ARM_R1, JAZ_V1, 0);
+    loc_success = forward_16(jinfo->codebuf);
+    branch_uncond(jinfo->codebuf, loc_retry);
+    bcc_patch(jinfo->codebuf, COND_NE, loc_failed);
+// failed:
+    mov_imm(jinfo->codebuf, ARM_R0, 0+CONSTMETHOD_CODEOFFSET);
+    bl(jinfo->codebuf, handlers[H_SYNCHRONIZED_ENTER]);
+    loc_exception = forward_16(jinfo->codebuf);
+    bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
+    cbz_patch(jinfo->codebuf, ARM_R0, loc_exception);
+    cbz_patch(jinfo->codebuf, ARM_R0, loc_success);
+//    mov_imm(jinfo->codebuf, ARM_R0, 0+CONSTMETHOD_CODEOFFSET);
+//    bl(jinfo->codebuf, handlers[H_MONITOR]);
+// success:
+
+  }
+
+  {
+    int nlocals = jinfo->method->max_locals();
+
+    for (i = 0; i < nlocals; i++) {
+      Reg r = jinfo->jregs->r_local[i];
+      if (r) {
+	unsigned stackdepth = 0;
+	if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+	if (i < parms || (locals_info[i] & (1<<LOCAL_REF))) {
+	  load_local(jinfo, r, i, stackdepth);
+	}
+      }
+    }
+  }
+}
+
+unsigned opcode2handler[] = {
+  H_IDIV,
+  H_LDIV,
+  0, 0,			// fdiv, ddiv
+  H_IREM,
+  H_LREM,
+  H_FREM,
+  H_DREM,
+  0, 0, 0, 0,		// ineg, lneg, fneg, dneg
+  0, 0, 0, 0, 0, 0,	// shifts
+  0, 0, 0, 0, 0, 0,	// and, or, xor
+  0,			// iinc
+  0,			// i2l
+  H_I2F,
+  H_I2D,
+  0,			// l2i
+  H_L2F,
+  H_L2D,
+  H_F2I,
+  H_F2L,
+  H_F2D,
+  H_D2I,
+  H_D2L,
+  H_D2F,
+};
+
+#define OPCODE2HANDLER(opc) (handlers[opcode2handler[(opc)-opc_idiv]])
+
+extern "C" void _ZN18InterpreterRuntime18register_finalizerEP10JavaThreadP7oopDesc(void);
+
+void Thumb2_codegen(Thumb2_Info *jinfo, unsigned start)
+{
+  unsigned code_size = jinfo->code_size;
+  jubyte *code_base = jinfo->code_base;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+  CodeBuf *codebuf = jinfo->codebuf;
+  Thumb2_Stack *jstack = jinfo->jstack;
+  unsigned bci;
+  unsigned opcode;
+  unsigned stackinfo;
+  int len;
+  unsigned stackdepth;
+
+  for (bci = start; bci < code_size; ) {
+#ifdef T2EE_PRINT_DISASS
+    unsigned start_idx = jinfo->codebuf->idx;
+    if (start_bci[start_idx] == -1) start_bci[start_idx] = bci;
+#endif
+    opcode = code_base[bci];
+    stackinfo = bc_stackinfo[bci];
+
+    if (stackinfo & BC_BRANCH_TARGET) Thumb2_Flush(jinfo);
+    JASSERT(!(stackinfo & BC_COMPILED), "code already compiled for this bytecode?");
+    stackdepth = stackinfo & ~BC_FLAGS_MASK;
+    bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | (codebuf->idx * 2) | BC_COMPILED;
+
+    if (opcode > OPC_LAST_JAVA_OP && opcode != opc_return_register_finalizer) {
+      if (Bytecodes::is_defined((Bytecodes::Code)opcode))
+	opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
+    }
+
+    len = Bytecodes::length_for((Bytecodes::Code)opcode);
+    if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
+
+    if (IS_DEAD(stackinfo) || IS_ZOMBIE(stackinfo)) {
+      unsigned zlen = 0;
+#ifdef T2EE_PRINT_DISASS
+      unsigned start_bci = bci;
+#endif
+
+      Thumb2_Exit(jinfo, H_ZOMBIE, bci, stackdepth);
+      do {
+	zlen += len;
+	bci += len;
+	if (bci >= code_size) break;
+	opcode = code_base[bci];
+	stackinfo = bc_stackinfo[bci];
+
+	if (stackinfo & BC_BRANCH_TARGET) break;
+	if (!(IS_DEAD(stackinfo) || IS_ZOMBIE(stackinfo))) break;
+
+	bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | (codebuf->idx * 2);
+
+	if (opcode > OPC_LAST_JAVA_OP) {
+	  if (Bytecodes::is_defined((Bytecodes::Code)opcode))
+	    opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
+	}
+
+	len = Bytecodes::length_for((Bytecodes::Code)opcode);
+	if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
+
+      } while (1);
+#ifdef T2EE_PRINT_DISASS
+      end_bci[start_idx] = start_bci + zlen;
+#endif
+      jinfo->zombie_bytes += zlen;
+      continue;
+    }
+
+#if 0
+    if (bci >= 2620) {
+      unsigned zlen = 0;
+#ifdef T2EE_PRINT_DISASS
+      unsigned start_bci = bci;
+#endif
+
+      Thumb2_Exit(jinfo, H_ZOMBIE, bci, stackdepth);
+      do {
+	zlen += len;
+	bci += len;
+	if (bci >= code_size) break;
+	opcode = code_base[bci];
+	stackinfo = bc_stackinfo[bci];
+
+	if (stackinfo & BC_BRANCH_TARGET) break;
+
+	if (opcode > OPC_LAST_JAVA_OP) {
+	  if (Bytecodes::is_defined((Bytecodes::Code)opcode))
+	    opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
+	}
+
+	len = Bytecodes::length_for((Bytecodes::Code)opcode);
+	if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
+
+      } while (1);
+#ifdef T2EE_PRINT_DISASS
+      end_bci[start_idx] = start_bci + zlen;
+#endif
+      jinfo->zombie_bytes += zlen;
+      continue;
+    }
+#endif
+
+#ifdef T2EE_PRINT_DISASS
+    end_bci[start_idx] = bci + len;
+#endif
+
+    switch (opcode) {
+      case opc_nop:
+	break;
+      case opc_aconst_null:
+	len += Thumb2_Imm(jinfo, 0, bci+1);
+	break;
+      case opc_iconst_m1:
+      case opc_iconst_0:
+      case opc_iconst_1:
+      case opc_iconst_2:
+      case opc_iconst_3:
+      case opc_iconst_4:
+      case opc_iconst_5:
+	len += Thumb2_Imm(jinfo, opcode - (unsigned)opc_iconst_0, bci+1);
+	break;
+      case opc_lconst_0:
+      case opc_lconst_1:
+	Thumb2_ImmX2(jinfo, opcode - (unsigned)opc_lconst_0, 0);
+	break;
+      case opc_fconst_0:
+      case opc_fconst_1:
+      case opc_fconst_2: {
+	unsigned v = 0;
+	if (opcode == (unsigned)opc_fconst_1) v = 0x3f800000;
+	if (opcode == (unsigned)opc_fconst_2) v = 0x40000000;
+	len += Thumb2_Imm(jinfo, v, bci+1);
+	break;
+      }
+      case opc_dconst_0:
+      case opc_dconst_1: {
+	unsigned v_hi = 0;
+	if (opcode == (unsigned)opc_dconst_1) v_hi = 0x3ff00000;
+	Thumb2_ImmX2(jinfo, 0, v_hi);
+	break;
+      }
+      case opc_bipush:
+	len += Thumb2_Imm(jinfo, GET_JAVA_S1(code_base+bci+1), bci+2);
+	break;
+      case opc_sipush:
+	len += Thumb2_Imm(jinfo, GET_JAVA_S2(code_base+bci+1), bci+3);
+	break;
+      case opc_ldc:
+      case opc_ldc_w:
+      case opc_ldc2_w: {
+	unsigned index = (opcode == (unsigned)opc_ldc) ?
+				code_base[bci+1] : GET_JAVA_U2(code_base+bci+1);
+	constantPoolOop constants = jinfo->method->constants();
+	unsigned v;
+
+	switch (v = constants->tag_at(index).value()) {
+	  case JVM_CONSTANT_Integer:
+	  case JVM_CONSTANT_Float:
+	    v = (unsigned)constants->int_at(index);
+	    len += Thumb2_Imm(jinfo, v, bci+len);
+	    break;
+#if 0
+	  case JVM_CONSTANT_String:
+	    v = (unsigned)constants->resolved_string_at(index);
+	    len += Thumb2_Imm(jinfo, v, bci+len);
+	    break;
+	  case JVM_CONSTANT_Class:
+	    v = (unsigned)constants->resolved_klass_at(index)->klass_part()->java_mirror();
+	    len += Thumb2_Imm(jinfo, v, bci+len);
+	    break;
+#endif
+	  case JVM_CONSTANT_Long:
+	  case JVM_CONSTANT_Double: {
+	    unsigned long long v;
+	    v = constants->long_at(index);
+	    Thumb2_ImmX2(jinfo, v & 0xffffffff, v >> 32);
+	    break;
+	  }
+	  case JVM_CONSTANT_Class:
+	  case JVM_CONSTANT_String: {
+	    Reg r;
+	    Thumb2_Spill(jinfo, 1, 0);
+	    r = JSTACK_REG(jstack);
+	    PUSH(jstack, r);
+	    ldr_imm(jinfo->codebuf, r, Ristate, ISTATE_METHOD, 1, 0);
+	    ldr_imm(jinfo->codebuf, r, r, METHOD_CONSTANTS, 1, 0);
+	    ldr_imm(jinfo->codebuf, r, r, CONSTANTPOOL_BASE + (index << 2), 1, 0);
+	    if (v == JVM_CONSTANT_Class)
+	      ldr_imm(jinfo->codebuf, r, r, KLASS_PART+KLASS_JAVA_MIRROR, 1, 0);
+	    break;
+	  }
+	  default:
+	    unsigned loc;
+
+	    JASSERT(opcode != opc_ldc2_w, "ldc2_w unresolved?");
+	    Thumb2_Flush(jinfo);
+	    mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  Thumb2_save_locals(jinfo, stackdepth);
+	    mov_imm(jinfo->codebuf, ARM_R1, opcode != opc_ldc);
+	    bl(jinfo->codebuf, handlers[H_LDC]);
+	  Thumb2_restore_locals(jinfo, stackdepth);
+	    ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
+	    mov_imm(jinfo->codebuf, ARM_R2, 0);
+	    str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
+	    loc = forward_16(jinfo->codebuf);
+	    bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	    cbnz_patch(jinfo->codebuf, ARM_R0, loc);
+	    PUSH(jstack, ARM_R0);
+	    break;
+	}
+	break;
+      }
+
+      case opc_iload:
+      case opc_fload:
+      case opc_aload:
+	Thumb2_Load(jinfo, code_base[bci+1], stackdepth);
+	break;
+      case opc_lload:
+      case opc_dload:
+	Thumb2_LoadX2(jinfo, code_base[bci+1], stackdepth);
+	break;
+      case opc_iload_0:
+      case opc_iload_1:
+      case opc_iload_2:
+      case opc_iload_3:
+      case opc_fload_0:
+      case opc_fload_1:
+      case opc_fload_2:
+      case opc_fload_3:
+      case opc_aload_0:
+      case opc_aload_1:
+      case opc_aload_2:
+      case opc_aload_3:
+	Thumb2_Load(jinfo, (opcode - opc_iload_0) & 3, stackdepth);
+	break;
+      case opc_lload_0:
+      case opc_lload_1:
+      case opc_lload_2:
+      case opc_lload_3:
+      case opc_dload_0:
+      case opc_dload_1:
+      case opc_dload_2:
+      case opc_dload_3:
+	Thumb2_LoadX2(jinfo, (opcode - opc_iload_0) & 3, stackdepth);
+	break;
+      case opc_iaload:
+      case opc_faload:
+      case opc_aaload:
+      case opc_baload:
+      case opc_caload:
+      case opc_saload:
+	Thumb2_Xaload(jinfo, opcode);
+	break;
+      case opc_laload:
+      case opc_daload:
+	Thumb2_X2aload(jinfo);
+	break;
+      case opc_istore:
+      case opc_fstore:
+      case opc_astore:
+	Thumb2_Store(jinfo, code_base[bci+1], stackdepth);
+	break;
+      case opc_lstore:
+      case opc_dstore:
+	Thumb2_StoreX2(jinfo, code_base[bci+1], stackdepth);
+	break;
+      case opc_istore_0:
+      case opc_istore_1:
+      case opc_istore_2:
+      case opc_istore_3:
+      case opc_fstore_0:
+      case opc_fstore_1:
+      case opc_fstore_2:
+      case opc_fstore_3:
+      case opc_astore_0:
+      case opc_astore_1:
+      case opc_astore_2:
+      case opc_astore_3:
+	Thumb2_Store(jinfo, (opcode - opc_istore_0) & 3, stackdepth);
+	break;
+      case opc_lstore_0:
+      case opc_lstore_1:
+      case opc_lstore_2:
+      case opc_lstore_3:
+      case opc_dstore_0:
+      case opc_dstore_1:
+      case opc_dstore_2:
+      case opc_dstore_3:
+	Thumb2_StoreX2(jinfo, (opcode - opc_istore_0) & 3, stackdepth);
+	break;
+      case opc_iastore:
+      case opc_fastore:
+      case opc_bastore:
+      case opc_castore:
+      case opc_sastore:
+	Thumb2_Xastore(jinfo, opcode);
+	break;
+      case opc_lastore:
+      case opc_dastore:
+	Thumb2_X2astore(jinfo);
+	break;
+
+      case opc_pop:
+      case opc_pop2:
+	Thumb2_Pop(jinfo, opcode - opc_pop + 1);
+	break;
+
+      case opc_dup:
+      case opc_dup_x1:
+      case opc_dup_x2:
+	Thumb2_Dup(jinfo, opcode - opc_dup);
+	break;
+
+      case opc_dup2:
+      case opc_dup2_x1:
+      case opc_dup2_x2:
+	Thumb2_Dup2(jinfo, opcode - opc_dup2);
+	break;
+
+      case opc_swap:
+	Thumb2_Swap(jinfo);
+	break;
+
+      case opc_iadd:
+      case opc_isub:
+      case opc_imul:
+      case opc_ishl:
+      case opc_ishr:
+      case opc_iushr:
+      case opc_iand:
+      case opc_ior:
+      case opc_ixor:
+	Thumb2_iOp(jinfo, opcode);
+	break;
+
+      case opc_ladd:
+      case opc_lsub:
+      case opc_land:
+      case opc_lor:
+      case opc_lxor:
+	Thumb2_lOp(jinfo, opcode);
+	break;
+
+      case opc_lshl: {
+	Reg lho_lo, lho_hi, res_lo, res_hi, shift;
+	unsigned loc1, loc2;
+
+	Thumb2_Fill(jinfo, 3);
+	shift = POP(jstack);
+	lho_lo = POP(jstack);
+	lho_hi = POP(jstack);
+	Thumb2_Spill(jinfo, 2, (1<<lho_lo)|(1<<lho_hi));
+	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
+	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
+	JASSERT(res_lo != lho_lo && res_lo != lho_hi, "Spill failed");
+	JASSERT(res_hi != lho_lo && res_hi != lho_hi, "Spill failed");
+	and_imm(jinfo->codebuf, ARM_IP, shift, 31);
+	tst_imm(jinfo->codebuf, shift, 32);
+	loc1 = forward_16(jinfo->codebuf);
+	mov_imm(jinfo->codebuf, res_lo, 0);
+	dop_reg(jinfo->codebuf, DP_LSL, res_hi, lho_lo, ARM_IP, SHIFT_LSL, 0);
+	loc2 = forward_16(jinfo->codebuf);
+	bcc_patch(jinfo->codebuf, COND_EQ, loc1);
+	dop_reg(jinfo->codebuf, DP_LSL, res_lo, lho_lo, ARM_IP, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_LSL, res_hi, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	rsb_imm(jinfo->codebuf, ARM_IP, ARM_IP, 32);
+	dop_reg(jinfo->codebuf, DP_LSR, ARM_IP, lho_lo, ARM_IP, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_ORR, res_hi, res_hi, ARM_IP, SHIFT_LSL, 0);
+	branch_narrow_patch(jinfo->codebuf, loc2);
+	break;
+      }
+
+      case opc_lushr: {
+	Reg lho_lo, lho_hi, res_lo, res_hi, shift;
+	unsigned loc1, loc2;
+
+	Thumb2_Fill(jinfo, 3);
+	shift = POP(jstack);
+	lho_lo = POP(jstack);
+	lho_hi = POP(jstack);
+	Thumb2_Spill(jinfo, 2, (1<<lho_lo)|(1<<lho_hi));
+	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
+	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
+	JASSERT(res_lo != lho_lo && res_lo != lho_hi, "Spill failed");
+	JASSERT(res_hi != lho_lo && res_hi != lho_hi, "Spill failed");
+	and_imm(jinfo->codebuf, ARM_IP, shift, 31);
+	tst_imm(jinfo->codebuf, shift, 32);
+	loc1 = forward_16(jinfo->codebuf);
+	mov_imm(jinfo->codebuf, res_hi, 0);
+	dop_reg(jinfo->codebuf, DP_LSR, res_lo, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	loc2 = forward_16(jinfo->codebuf);
+	bcc_patch(jinfo->codebuf, COND_EQ, loc1);
+	dop_reg(jinfo->codebuf, DP_LSR, res_hi, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_LSR, res_lo, lho_lo, ARM_IP, SHIFT_LSL, 0);
+	rsb_imm(jinfo->codebuf, ARM_IP, ARM_IP, 32);
+	dop_reg(jinfo->codebuf, DP_LSL, ARM_IP, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_ORR, res_lo, res_lo, ARM_IP, SHIFT_LSL, 0);
+	branch_narrow_patch(jinfo->codebuf, loc2);
+	break;
+      }
+
+      case opc_lshr: {
+	Reg lho_lo, lho_hi, res_lo, res_hi, shift;
+	unsigned loc1, loc2;
+
+	Thumb2_Fill(jinfo, 3);
+	shift = POP(jstack);
+	lho_lo = POP(jstack);
+	lho_hi = POP(jstack);
+	Thumb2_Spill(jinfo, 2, (1<<lho_lo)|(1<<lho_hi));
+	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
+	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
+	JASSERT(res_lo != lho_lo && res_lo != lho_hi, "Spill failed");
+	JASSERT(res_hi != lho_lo && res_hi != lho_hi, "Spill failed");
+	and_imm(jinfo->codebuf, ARM_IP, shift, 31);
+	tst_imm(jinfo->codebuf, shift, 32);
+	loc1 = forward_16(jinfo->codebuf);
+	asr_imm(jinfo->codebuf, res_hi, lho_hi, 31);
+	dop_reg(jinfo->codebuf, DP_ASR, res_lo, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	loc2 = forward_16(jinfo->codebuf);
+	bcc_patch(jinfo->codebuf, COND_EQ, loc1);
+	dop_reg(jinfo->codebuf, DP_ASR, res_hi, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_LSR, res_lo, lho_lo, ARM_IP, SHIFT_LSL, 0);
+	rsb_imm(jinfo->codebuf, ARM_IP, ARM_IP, 32);
+	dop_reg(jinfo->codebuf, DP_LSL, ARM_IP, lho_hi, ARM_IP, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_ORR, res_lo, res_lo, ARM_IP, SHIFT_LSL, 0);
+	branch_narrow_patch(jinfo->codebuf, loc2);
+	break;
+      }
+
+      case opc_lmul:
+	Thumb2_lmul(jinfo);
+	break;
+
+      case opc_fadd:
+      case opc_fsub:
+      case opc_fmul:
+      case opc_fdiv:
+	Thumb2_fOp(jinfo, opcode);
+	break;
+
+      case opc_dadd:
+      case opc_dsub:
+      case opc_dmul:
+      case opc_ddiv:
+	Thumb2_dOp(jinfo, opcode);
+	break;
+
+      case opc_fcmpl:
+      case opc_fcmpg: {
+	Thumb2_Stack *jstack = jinfo->jstack;
+	unsigned rho, lho, res;
+	unsigned loc1, loc2, loc_ne;
+
+	Thumb2_Fill(jinfo, 2);
+	rho = POP(jstack);
+	lho = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	res = PUSH(jstack, JSTACK_REG(jstack));
+	vmov_reg_s_toVFP(jinfo->codebuf, VFP_S0, lho);
+	vmov_reg_s_toVFP(jinfo->codebuf, VFP_S1, rho);
+	vcmp_reg_s(jinfo->codebuf, VFP_S0, VFP_S1, 1);
+	mov_imm(jinfo->codebuf, res, opcode == opc_fcmpl ? 1 : -1);
+	vmrs(jinfo->codebuf, ARM_PC);
+	loc1 = forward_16(jinfo->codebuf);
+	dop_imm_preserve(jinfo->codebuf, DP_RSB, res, res, 0);
+	loc2 = forward_16(jinfo->codebuf);
+	vcmp_reg_s(jinfo->codebuf, VFP_S0, VFP_S1, 0);
+	loc_ne = forward_16(jinfo->codebuf);
+	mov_imm(jinfo->codebuf, res, 0);
+	bcc_patch(jinfo->codebuf, opcode == opc_fcmpl ? COND_GT : COND_MI, loc1);
+	bcc_patch(jinfo->codebuf, opcode == opc_fcmpl ? COND_MI : COND_GT, loc2);
+	bcc_patch(jinfo->codebuf, COND_NE, loc_ne);
+	break;
+      }
+
+      case opc_dcmpl:
+      case opc_dcmpg: {
+	Thumb2_Stack *jstack = jinfo->jstack;
+	unsigned rho_lo, rho_hi, lho_lo, lho_hi, res;
+	unsigned loc1, loc2, loc_ne;
+
+	Thumb2_Fill(jinfo, 4);
+	rho_lo = POP(jstack);
+	rho_hi = POP(jstack);
+	lho_lo = POP(jstack);
+	lho_hi = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	res = PUSH(jstack, JSTACK_REG(jstack));
+	vmov_reg_d_toVFP(jinfo->codebuf, VFP_S0, lho_lo, lho_hi);
+	vmov_reg_d_toVFP(jinfo->codebuf, VFP_S1, rho_lo, rho_hi);
+	vcmp_reg_d(jinfo->codebuf, VFP_S0, VFP_S1, 1);
+	mov_imm(jinfo->codebuf, res, opcode == opc_dcmpl ? 1 : -1);
+	vmrs(jinfo->codebuf, ARM_PC);
+	loc1 = forward_16(jinfo->codebuf);
+	dop_imm_preserve(jinfo->codebuf, DP_RSB, res, res, 0);
+	loc2 = forward_16(jinfo->codebuf);
+	vcmp_reg_d(jinfo->codebuf, VFP_S0, VFP_S1, 0);
+	loc_ne = forward_16(jinfo->codebuf);
+	mov_imm(jinfo->codebuf, res, 0);
+	bcc_patch(jinfo->codebuf, opcode == opc_dcmpl ? COND_GT : COND_MI, loc1);
+	bcc_patch(jinfo->codebuf, opcode == opc_dcmpl ? COND_MI : COND_GT, loc2);
+	bcc_patch(jinfo->codebuf, COND_NE, loc_ne);
+	break;
+      }
+
+      case opc_drem:
+      case opc_lrem:
+      case opc_ldiv: {
+	Reg src[4], dst[4];
+
+	Thumb2_Fill(jinfo, 4);
+	src[2] = POP(jstack);
+	src[3] = POP(jstack);
+	src[0] = POP(jstack);
+	src[1] = POP(jstack);
+	Thumb2_Flush(jinfo);
+	dst[0] = ARM_R0;
+	dst[1] = ARM_R1;
+	dst[2] = ARM_R2;
+	dst[3] = ARM_R3;
+	mov_multiple(jinfo->codebuf, dst, src, 4);
+	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
+	if (opcode != opc_lrem) {
+	  PUSH(jstack, ARM_R1);
+	  PUSH(jstack, ARM_R0);
+	} else {
+	  PUSH(jstack, ARM_R3);
+	  PUSH(jstack, ARM_R2);
+	}
+	break;
+      }
+
+      case opc_frem:
+      case opc_idiv:
+      case opc_irem: {
+	Reg r_rho, r_lho;
+
+	Thumb2_Fill(jinfo, 2);
+	r_rho = POP(jstack);
+	r_lho = POP(jstack);
+	Thumb2_Flush(jinfo);
+	if (r_rho == ARM_R0) {
+	  if (r_lho == ARM_R1) {
+	    mov_reg(jinfo->codebuf, ARM_IP, r_rho);
+	    mov_reg(jinfo->codebuf, ARM_R0, r_lho);
+	    mov_reg(jinfo->codebuf, ARM_R1, ARM_IP);
+	  } else {
+	    mov_reg(jinfo->codebuf, ARM_R1, r_rho);
+	    mov_reg(jinfo->codebuf, ARM_R0, r_lho);
+	  }
+	} else {
+	  mov_reg(jinfo->codebuf, ARM_R0, r_lho);
+	  mov_reg(jinfo->codebuf, ARM_R1, r_rho);
+	}
+#if 1
+	if (opcode == opc_frem)
+	  bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
+	else
+	  blx(jinfo->codebuf, OPCODE2HANDLER(opcode));
+#else
+	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
+#endif
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_f2i:
+      case opc_i2f: {
+	Reg r;
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Flush(jinfo);
+	mov_reg(jinfo->codebuf, ARM_R0, r);
+	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_f2d:
+      case opc_f2l:
+      case opc_i2d: {
+	Reg r;
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Flush(jinfo);
+	mov_reg(jinfo->codebuf, ARM_R0, r);
+	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
+	PUSH(jstack, ARM_R1);
+	PUSH(jstack, ARM_R0);
+	break;
+    }
+
+      case opc_d2f:
+      case opc_d2i:
+      case opc_l2d:
+      case opc_d2l:
+      case opc_l2f: {
+	Reg lo, hi;
+
+	Thumb2_Fill(jinfo, 2);
+	lo = POP(jstack);
+	hi = POP(jstack);
+	Thumb2_Flush(jinfo);
+	if (hi == ARM_R0) {
+	  if (lo == ARM_R1) {
+	    mov_reg(jinfo->codebuf, ARM_IP, hi);
+	    mov_reg(jinfo->codebuf, ARM_R0, lo);
+	    mov_reg(jinfo->codebuf, ARM_R1, ARM_IP);
+	  } else {
+	    mov_reg(jinfo->codebuf, ARM_R1, hi);
+	    mov_reg(jinfo->codebuf, ARM_R0, lo);
+	  }
+	} else {
+	  mov_reg(jinfo->codebuf, ARM_R0, lo);
+	  mov_reg(jinfo->codebuf, ARM_R1, hi);
+	}
+	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
+	if (opcode == opc_l2d || opcode == opc_d2l) PUSH(jstack, ARM_R1);
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_ineg:
+	Thumb2_iNeg(jinfo, opcode);
+	break;
+
+      case opc_lneg:
+	Thumb2_lNeg(jinfo, opcode);
+	break;
+
+      case opc_fneg:
+	Thumb2_fNeg(jinfo, opcode);
+	break;
+
+      case opc_dneg:
+	Thumb2_dNeg(jinfo, opcode);
+	break;
+
+      case opc_i2l: {
+	unsigned r, r_res_lo, r_res_hi;
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Spill(jinfo, 2, 0);
+	r_res_hi = PUSH(jstack, JSTACK_REG(jstack));
+	r_res_lo = PUSH(jstack, JSTACK_REG(jstack));
+	if (r == r_res_hi) {
+	  SWAP(jstack);
+	  r_res_hi = r_res_lo;
+	  r_res_lo = r;
+	}
+	mov_reg(jinfo->codebuf, r_res_lo, r);
+	asr_imm(jinfo->codebuf, r_res_hi, r, 31);
+	break;
+      }
+
+      case opc_l2i: {
+	unsigned r_lo, r_hi;
+	unsigned r;
+
+	Thumb2_Fill(jinfo, 2);
+	r_lo = POP(jstack);
+	r_hi = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	r = PUSH(jstack, r_lo);
+	break;
+      }
+
+      case opc_i2b: {
+	unsigned r_src, r_dst;
+
+	Thumb2_Fill(jinfo, 1);
+	r_src = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	r_dst = PUSH(jstack, JSTACK_REG(jstack));
+	sxtb(jinfo->codebuf, r_dst, r_src);
+	break;
+      }
+
+      case opc_i2s: {
+	unsigned r_src, r_dst;
+
+	Thumb2_Fill(jinfo, 1);
+	r_src = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	r_dst = PUSH(jstack, JSTACK_REG(jstack));
+	sxth(jinfo->codebuf, r_dst, r_src);
+	break;
+      }
+
+      case opc_i2c: {
+	unsigned r_src, r_dst;
+
+	Thumb2_Fill(jinfo, 1);
+	r_src = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	r_dst = PUSH(jstack, JSTACK_REG(jstack));
+	uxth(jinfo->codebuf, r_dst, r_src);
+	break;
+      }
+
+      case opc_lcmp: {
+	unsigned lho_lo, lho_hi;
+	unsigned rho_lo, rho_hi;
+	unsigned r_tmp_lo, r_tmp_hi;
+	unsigned res;
+	unsigned loc_lt, loc_eq;
+
+	Thumb2_Fill(jinfo, 4);
+	rho_lo = POP(jstack);
+	rho_hi = POP(jstack);
+	lho_lo = POP(jstack);
+	lho_hi = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	res = JSTACK_REG(jstack);
+	PUSH(jstack, res);
+	r_tmp_lo = Thumb2_Tmp(jinfo, (1<<rho_lo)|(1<<rho_hi)|(1<<lho_lo)|(1<<lho_hi));
+	r_tmp_hi = Thumb2_Tmp(jinfo, (1<<rho_lo)|(1<<rho_hi)|(1<<lho_lo)|(1<<lho_hi)|(1<<r_tmp_lo));
+	dop_reg(jinfo->codebuf, DP_SUB, r_tmp_lo, lho_lo, rho_lo, SHIFT_LSL, 0);
+	dop_reg(jinfo->codebuf, DP_SBC, r_tmp_hi, lho_hi, rho_hi, SHIFT_LSL, 0);
+	mov_imm(jinfo->codebuf, res, (unsigned)-1);
+	loc_lt = forward_16(jinfo->codebuf);
+	dop_reg(jinfo->codebuf, DP_ORR, res, r_tmp_lo, r_tmp_hi, SHIFT_LSL, 0);
+	loc_eq = forward_16(jinfo->codebuf);
+	mov_imm(jinfo->codebuf, res, 1);
+	bcc_patch(jinfo->codebuf, COND_LT, loc_lt);
+	bcc_patch(jinfo->codebuf, COND_EQ, loc_eq);
+	break;
+      }
+
+      case opc_iinc: {
+	unsigned local = code_base[bci+1];
+	int constant = GET_JAVA_S1(code_base+bci+2);
+	unsigned r = jinfo->jregs->r_local[local];
+
+	if (!r) {
+	  int nlocals = jinfo->method->max_locals();
+	  r = Thumb2_Tmp(jinfo, 0);
+	  stackdepth -= jstack->depth;
+	  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+	  load_local(jinfo, r, local, stackdepth);
+	  add_imm(jinfo->codebuf, r, r, constant);
+	  store_local(jinfo, r, local, stackdepth);
+	} else {
+	  Thumb2_Corrupt(jinfo, r, 0);
+	  add_imm(jinfo->codebuf, r, r, constant);
+	}
+	break;
+      }
+
+      case opc_getfield: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+	Reg r_obj;
+
+        cache = cp->entry_at(index);
+        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
+	  int java_index = GET_JAVA_U2(code_base+bci+1);
+	  constantPoolOop pool = jinfo->method->constants();
+	  symbolOop sig = pool->signature_ref_at(java_index);
+	  jbyte *base = sig->base();
+	  jbyte c = *base;
+	  int handler = H_GETFIELD_WORD;
+
+	  if (c == 'J' || c == 'D') handler = H_GETFIELD_DW;
+	  if (c == 'B' || c == 'Z') handler = H_GETFIELD_SB;
+	  if (c == 'C') handler = H_GETFIELD_H;
+	  if (c == 'S') handler = H_GETFIELD_SH;
+	  Thumb2_Flush(jinfo);
+	  Thumb2_save_locals(jinfo, stackdepth);
+	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  mov_imm(jinfo->codebuf, ARM_R1, index);
+	  blx(jinfo->codebuf, handlers[handler]);
+	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  break;
+	}
+
+	TosState tos_type = cache->flag_state();
+	int field_offset = cache->f2();
+
+	if (tos_type == ltos || tos_type == dtos) {
+	  Reg r_lo, r_hi;
+	  Thumb2_Fill(jinfo, 1);
+	  r_obj = POP(jstack);
+	  Thumb2_Spill(jinfo, 2, 0);
+	  r_hi = PUSH(jstack, JSTACK_REG(jstack));
+	  r_lo = PUSH(jstack, JSTACK_REG(jstack));
+	  ldrd_imm(jinfo->codebuf, r_lo, r_hi, r_obj, field_offset, 1, 0);
+	} else {
+	  Reg r;
+
+	  Thumb2_Fill(jinfo, 1);
+	  r_obj = POP(jstack);
+	  Thumb2_Spill(jinfo, 1, 0);
+	  r = JSTACK_REG(jstack);
+	  PUSH(jstack, r);
+	  if (tos_type == btos)
+	    ldrsb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else if (tos_type == ctos)
+	    ldrh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else if (tos_type == stos)
+	    ldrsh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else
+	    ldr_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	}
+	break;
+      }
+
+      case opc_monitorexit:
+      case opc_monitorenter:
+	  Thumb2_Exit(jinfo, H_MONITOR, bci, stackdepth);
+	  break;
+
+      case opc_getstatic: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+
+        cache = cp->entry_at(index);
+        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
+	  int java_index = GET_JAVA_U2(code_base+bci+1);
+	  constantPoolOop pool = jinfo->method->constants();
+	  symbolOop sig = pool->signature_ref_at(java_index);
+	  jbyte *base = sig->base();
+	  jbyte c = *base;
+	  int handler = H_GETSTATIC_WORD;
+
+	  if (c == 'J' || c == 'D') handler = H_GETSTATIC_DW;
+	  if (c == 'B' || c == 'Z') handler = H_GETSTATIC_SB;
+	  if (c == 'C') handler = H_GETSTATIC_H;
+	  if (c == 'S') handler = H_GETSTATIC_SH;
+	  Thumb2_Flush(jinfo);
+	  Thumb2_save_locals(jinfo, stackdepth);
+	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  mov_imm(jinfo->codebuf, ARM_R1, index);
+	  blx(jinfo->codebuf, handlers[handler]);
+	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  break;
+	}
+
+	TosState tos_type = cache->flag_state();
+	int field_offset = cache->f2();
+
+	if (tos_type == ltos || tos_type == dtos) {
+	  Reg r_lo, r_hi;
+	  Thumb2_Spill(jinfo, 2, 0);
+	  r_hi = PUSH(jstack, JSTACK_REG(jstack));
+	  r_lo = PUSH(jstack, JSTACK_REG(jstack));
+	  ldr_imm(jinfo->codebuf, r_lo, Ristate, ISTATE_CONSTANTS, 1, 0);
+	  ldr_imm(jinfo->codebuf, r_lo, r_lo, CP_OFFSET + (index << 4) + 4, 1, 0);
+	  ldrd_imm(jinfo->codebuf, r_lo, r_hi, r_lo, field_offset, 1, 0);
+	} else {
+	  Reg r;
+	  Thumb2_Spill(jinfo, 1, 0);
+	  r = JSTACK_REG(jstack);
+	  PUSH(jstack, r);
+	  ldr_imm(jinfo->codebuf, r, Ristate, ISTATE_CONSTANTS, 1, 0);
+	  ldr_imm(jinfo->codebuf, r, r, CP_OFFSET + (index << 4) + 4, 1, 0);
+	  if (tos_type == btos)
+	    ldrsb_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
+	  else if (tos_type == ctos)
+	    ldrh_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
+	  else if (tos_type == stos)
+	    ldrsh_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
+	  else
+	    ldr_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
+	}
+	break;
+      }
+
+      case opc_putfield: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+	Reg r_obj;
+
+        cache = cp->entry_at(index);
+        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
+	  int java_index = GET_JAVA_U2(code_base+bci+1);
+	  constantPoolOop pool = jinfo->method->constants();
+	  symbolOop sig = pool->signature_ref_at(java_index);
+	  jbyte *base = sig->base();
+	  jbyte c = *base;
+	  int handler = H_PUTFIELD_WORD;
+
+	  if (c == 'J' || c == 'D') handler = H_PUTFIELD_DW;
+	  if (c == 'B' || c == 'Z') handler = H_PUTFIELD_B;
+	  if (c == 'C' || c == 'S') handler = H_PUTFIELD_H;
+	  if (c == '[' || c == 'L') handler = H_PUTFIELD_A;
+	  Thumb2_Flush(jinfo);
+	  Thumb2_save_locals(jinfo, stackdepth);
+	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  mov_imm(jinfo->codebuf, ARM_R1, index);
+	  blx(jinfo->codebuf, handlers[handler]);
+	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  break;
+	}
+
+	TosState tos_type = cache->flag_state();
+	int field_offset = cache->f2();
+
+	if (tos_type == ltos || tos_type == dtos) {
+	  Reg r_lo, r_hi;
+	  Thumb2_Fill(jinfo, 3);
+	  r_lo = POP(jstack);
+	  r_hi = POP(jstack);
+	  r_obj = POP(jstack);
+	  strd_imm(jinfo->codebuf, r_lo, r_hi, r_obj, field_offset, 1, 0);
+	} else {
+	  Reg r;
+	  Thumb2_Fill(jinfo, 2);
+	  r = POP(jstack);
+	  r_obj = POP(jstack);
+	  if (tos_type == btos)
+	    strb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else if (tos_type == ctos | tos_type == stos)
+	    strh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else {
+	    str_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	    if (tos_type == atos) {
+	      Thumb2_Flush(jinfo);
+	      mov_reg(jinfo->codebuf, ARM_R0, r_obj);
+	      bl(jinfo->codebuf, handlers[H_APUTFIELD]);
+	    }
+	  }
+	}
+	break;
+      }
+
+      case opc_putstatic: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+
+        cache = cp->entry_at(index);
+        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
+	  int java_index = GET_JAVA_U2(code_base+bci+1);
+	  constantPoolOop pool = jinfo->method->constants();
+	  symbolOop sig = pool->signature_ref_at(java_index);
+	  jbyte *base = sig->base();
+	  jbyte c = *base;
+	  int handler = H_PUTSTATIC_WORD;
+
+	  if (c == 'J' || c == 'D') handler = H_PUTSTATIC_DW;
+	  if (c == 'B' || c == 'Z') handler = H_PUTSTATIC_B;
+	  if (c == 'C' || c == 'S') handler = H_PUTSTATIC_H;
+	  if (c == '[' || c == 'L') handler = H_PUTSTATIC_A;
+	  Thumb2_Flush(jinfo);
+	  Thumb2_save_locals(jinfo, stackdepth);
+	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  mov_imm(jinfo->codebuf, ARM_R1, index);
+	  blx(jinfo->codebuf, handlers[handler]);
+	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  break;
+	}
+
+	TosState tos_type = cache->flag_state();
+	int field_offset = cache->f2();
+	Reg r_obj;
+
+	if (tos_type == ltos || tos_type == dtos) {
+	  Reg r_lo, r_hi;
+	  Thumb2_Fill(jinfo, 2);
+	  r_lo = POP(jstack);
+	  r_hi = POP(jstack);
+	  Thumb2_Spill(jinfo, 1, (1<<r_lo)|(1<<r_hi));
+	  r_obj = JSTACK_PREFER(jstack, ~((1<<r_lo)|(1<<r_hi)));
+	  JASSERT(r_obj != r_lo && r_obj != r_hi, "corruption in putstatic");
+	  ldr_imm(jinfo->codebuf, r_obj, Ristate, ISTATE_CONSTANTS, 1, 0);
+	  ldr_imm(jinfo->codebuf, r_obj, r_obj, CP_OFFSET + (index << 4) + 4, 1, 0);
+	  strd_imm(jinfo->codebuf, r_lo, r_hi, r_obj, field_offset, 1, 0);
+	} else {
+	  Reg r;
+	  Thumb2_Fill(jinfo, 1);
+	  r = POP(jstack);
+	  Thumb2_Spill(jinfo, 1, (1<<r));
+	  r_obj = JSTACK_PREFER(jstack, ~(1<<r));
+	  JASSERT(r_obj != r, "corruption in putstatic");
+	  ldr_imm(jinfo->codebuf, r_obj, Ristate, ISTATE_CONSTANTS, 1, 0);
+	  ldr_imm(jinfo->codebuf, r_obj, r_obj, CP_OFFSET + (index << 4) + 4, 1, 0);
+	  if (tos_type == btos)
+	    strb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else if (tos_type == ctos | tos_type == stos)
+	    strh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	  else {
+	    str_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	    if (tos_type == atos) {
+	      Thumb2_Flush(jinfo);
+	      mov_reg(jinfo->codebuf, ARM_R0, r_obj);
+	      bl(jinfo->codebuf, handlers[H_APUTFIELD]);
+	    }
+	  }
+	}
+	break;
+      }
+
+      case opc_invokestatic:
+      case opc_invokespecial: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+	unsigned loc;
+	methodOop callee;
+
+        cache = cp->entry_at(index);
+        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
+	  Thumb2_Flush(jinfo);
+	  Thumb2_invoke_save(jinfo, stackdepth);
+	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  mov_imm(jinfo->codebuf, ARM_R1, index);
+	  blx(jinfo->codebuf,
+	    handlers[opcode == opc_invokestatic ? H_INVOKESTATIC : H_INVOKESPECIAL]);
+	  Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  break;
+	}
+
+	callee = (methodOop)cache->f1();
+	if (callee->is_accessor()) {
+	  u1 *code = callee->code_base();
+	  int index = GET_NATIVE_U2(&code[2]);
+	  constantPoolCacheOop callee_cache = callee->constants()->cache();
+	  ConstantPoolCacheEntry *entry = callee_cache->entry_at(index);
+	  Reg r_obj, r;
+
+	  if (entry->is_resolved(Bytecodes::_getfield)) {
+#if 0
+	    tty->print("Inlining accessor (opcode = %s) ", opcode == opc_invokestatic ? "invokestatic" : "invokespecial");
+	    callee->print_short_name(tty);
+	    tty->print("\n");
+#endif
+	    JASSERT(cache->parameter_size() == 1, "not 1 parameter to accessor");
+
+	    TosState tos_type = entry->flag_state();
+	    int field_offset = entry->f2();
+
+	    JASSERT(tos_type == btos || tos_type == ctos || tos_type == stos || tos_type == atos || tos_type == itos, "not itos or atos");
+
+	    Thumb2_Fill(jinfo, 1);
+	    r_obj = POP(jstack);
+	    Thumb2_Spill(jinfo, 1, 0);
+	    r = JSTACK_REG(jstack);
+	    PUSH(jstack, r);
+	    if (tos_type == btos)
+	      ldrb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	    else if (tos_type == ctos)
+	      ldrh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	    else if (tos_type == stos)
+	      ldrsh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	    else
+	      ldr_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	    break;
+	  }
+	}
+
+	Thumb2_Flush(jinfo);
+  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
+	ldr_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_CONSTANTS, 1, 0);
+	mov_imm(jinfo->codebuf, ARM_R1, 0);
+  ldr_imm(jinfo->codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
+	if (opcode == opc_invokespecial)
+	  ldr_imm(jinfo->codebuf, ARM_R3, Rstack, (cache->parameter_size()-1) * sizeof(int), 1, 0);
+	ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, CP_OFFSET + (index << 4) + 4, 1, 0);
+  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET);
+	if (opcode == opc_invokespecial)
+	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 0, 1, 0); // Null pointer check - cbz better?
+	str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+	ldr_imm(jinfo->codebuf, ARM_R1, ARM_R0, METHOD_FROM_INTERPRETED, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_BCP, 1, 0);
+	str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+	  Thumb2_Debug(jinfo, H_DEBUG_METHODCALL);
+	Thumb2_invoke_save(jinfo, stackdepth);
+  sub_imm(jinfo->codebuf, Rstack, Rstack, 4);
+	ldr_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
+	mov_reg(jinfo->codebuf, ARM_R2, Rthread);
+  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK, 1, 0);
+add_imm(jinfo->codebuf, ARM_R3, ARM_R3, CODE_ALIGN_SIZE);
+//	enter_leave(jinfo->codebuf, 0);
+	blx_reg(jinfo->codebuf, ARM_R3);
+//	enter_leave(jinfo->codebuf, 1);
+  ldr_imm(jinfo->codebuf, Rthread, Ristate, ISTATE_THREAD, 1, 0);
+#ifdef USE_RLOCAL
+  ldr_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
+#endif
+	ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+	ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_STACK_LIMIT, 1, 0);
+	JASSERT(!(bc_stackinfo[bci+len] & BC_COMPILED), "code already compiled for this bytecode?");
+	Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
+	add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
+	ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
+	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
+	str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R3, 0);
+	it(jinfo->codebuf, COND_NE, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
+	break;
+      }
+
+      case opc_invokeinterface: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+	unsigned loc, loc_inc_ex;
+
+// Currently we just call the unresolved invokeinterface entry for resolved /
+// unresolved alike!
+    Thumb2_Flush(jinfo);
+    Thumb2_invoke_save(jinfo, stackdepth);
+    mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+    mov_imm(jinfo->codebuf, ARM_R1, index);
+    blx(jinfo->codebuf, handlers[H_INVOKEINTERFACE]);
+    Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	break;
+      }
+
+      case opc_invokevirtual: {
+	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
+        ConstantPoolCacheEntry* cache;
+	int index = GET_NATIVE_U2(code_base+bci+1);
+	unsigned loc;
+
+        cache = cp->entry_at(index);
+        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
+	  Thumb2_Flush(jinfo);
+	  Thumb2_invoke_save(jinfo, stackdepth);
+	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	  mov_imm(jinfo->codebuf, ARM_R1, index);
+	  blx(jinfo->codebuf, handlers[H_INVOKEVIRTUAL]);
+	  Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  break;
+	}
+
+	if (cache->is_vfinal()) {
+	  methodOop callee = (methodOop)cache->f2();
+	  if (callee->is_accessor()) {
+	    u1 *code = callee->code_base();
+	    int index = GET_NATIVE_U2(&code[2]);
+	    constantPoolCacheOop callee_cache = callee->constants()->cache();
+	    ConstantPoolCacheEntry *entry = callee_cache->entry_at(index);
+	    Reg r_obj, r;
+
+	    if (entry->is_resolved(Bytecodes::_getfield)) {
+#if 0
+	      tty->print("Inlining accessor (opcode = invokevfinal) ");
+	      callee->print_short_name(tty);
+	      tty->print("\n");
+#endif
+	      JASSERT(cache->parameter_size() == 1, "not 1 parameter to accessor");
+
+	      TosState tos_type = entry->flag_state();
+	      int field_offset = entry->f2();
+
+	      JASSERT(tos_type == btos || tos_type == ctos || tos_type == stos || tos_type == atos || tos_type == itos, "not itos or atos");
+
+	      Thumb2_Fill(jinfo, 1);
+	      r_obj = POP(jstack);
+	      Thumb2_Spill(jinfo, 1, 0);
+	      r = JSTACK_REG(jstack);
+	      PUSH(jstack, r);
+	      if (tos_type == btos)
+		ldrb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	      else if (tos_type == ctos)
+		ldrh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	      else if (tos_type == stos)
+		ldrsh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	      else
+		ldr_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
+	      break;
+	    }
+	  }
+	}
+
+	Thumb2_Flush(jinfo);
+	if (cache->is_vfinal()) {
+  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_CONSTANTS, 1, 0);
+	  mov_imm(jinfo->codebuf, ARM_R1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R3, Rstack, (cache->parameter_size()-1) * sizeof(int), 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, CP_OFFSET + (index << 4) + 8, 1, 0);
+  ldr_imm(jinfo->codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 0, 1, 0); // Null pointer check - cbz better?
+	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R1, ARM_R0, METHOD_FROM_INTERPRETED, 1, 0);
+  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET);
+	  str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+	  Thumb2_Debug(jinfo, H_DEBUG_METHODCALL);
+	Thumb2_invoke_save(jinfo, stackdepth);
+  sub_imm(jinfo->codebuf, Rstack, Rstack, 4);
+	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_BCP, 1, 0);
+	  mov_reg(jinfo->codebuf, ARM_R2, Rthread);
+  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK, 1, 0);
+add_imm(jinfo->codebuf, ARM_R3, ARM_R3, CODE_ALIGN_SIZE);
+//	  enter_leave(jinfo->codebuf, 0);
+	  blx_reg(jinfo->codebuf, ARM_R3);
+//	  enter_leave(jinfo->codebuf, 1);
+  ldr_imm(jinfo->codebuf, Rthread, Ristate, ISTATE_THREAD, 1, 0);
+#ifdef USE_RLOCAL
+  ldr_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
+#endif
+	  ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_STACK_LIMIT, 1, 0);
+	JASSERT(!(bc_stackinfo[bci+len] & BC_COMPILED), "code already compiled for this bytecode?");
+	Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
+	  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
+	  ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
+	  str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
+	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R3, 0);
+	it(jinfo->codebuf, COND_NE, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
+	  break;
+	} else {
+  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R3, Rstack, (cache->parameter_size()-1) * sizeof(int), 1, 0);
+  ldr_imm(jinfo->codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 4, 1, 0);
+	  mov_imm(jinfo->codebuf, ARM_R1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R0, ARM_R3, INSTANCEKLASS_VTABLE_OFFSET + cache->f2() * 4, 1, 0);
+  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET);
+	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R1, ARM_R0, METHOD_FROM_INTERPRETED, 1, 0);
+  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_BCP, 1, 0);
+	  str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+	  Thumb2_Debug(jinfo, H_DEBUG_METHODCALL);
+	Thumb2_invoke_save(jinfo, stackdepth);
+  sub_imm(jinfo->codebuf, Rstack, Rstack, 4);
+	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
+	  mov_reg(jinfo->codebuf, ARM_R2, Rthread);
+  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK, 1, 0);
+add_imm(jinfo->codebuf, ARM_R3, ARM_R3, CODE_ALIGN_SIZE);
+//	  enter_leave(jinfo->codebuf, 0);
+	  blx_reg(jinfo->codebuf, ARM_R3);
+//	  enter_leave(jinfo->codebuf, 1);
+  ldr_imm(jinfo->codebuf, Rthread, Ristate, ISTATE_THREAD, 1, 0);
+#ifdef USE_RLOCAL
+  ldr_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
+#endif
+	  ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
+	  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_STACK_LIMIT, 1, 0);
+	JASSERT(!(bc_stackinfo[bci+len] & BC_COMPILED), "code already compiled for this bytecode?");
+	Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
+	  ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
+	  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
+	  ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
+	  str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
+	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R3, 0);
+	it(jinfo->codebuf, COND_NE, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
+	}
+	break;
+      }
+
+      case opc_jsr_w:
+      case opc_jsr: {
+	Thumb2_Jsr(jinfo , bci, stackdepth);
+	break;
+      }
+
+      case opc_ret: {
+	Thumb2_Exit(jinfo, H_RET, bci, stackdepth);
+	break;
+      }
+
+      case opc_athrow:
+	Thumb2_Exit(jinfo, H_ATHROW, bci, stackdepth);
+	break;
+
+      case opc_goto: {
+	int offset = GET_JAVA_S2(jinfo->code_base + bci + 1);
+	Thumb2_Flush(jinfo);
+	bci = Thumb2_Goto(jinfo, bci, offset, len);
+	len = 0;
+	break;
+      }
+
+      case opc_goto_w: {
+	int offset = GET_JAVA_U4(jinfo->code_base + bci + 1);
+	Thumb2_Flush(jinfo);
+	bci = Thumb2_Goto(jinfo, bci, offset, len);
+	len = 0;
+	break;
+      }
+
+      case opc_ifeq:
+      case opc_ifne:
+      case opc_iflt:
+      case opc_ifge:
+      case opc_ifgt:
+      case opc_ifle:
+      case opc_ifnull:
+      case opc_ifnonnull: {
+	Reg r;
+	unsigned cond = opcode - opc_ifeq;
+	if (opcode >= opc_ifnull) cond = opcode - opc_ifnull;
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Flush(jinfo);
+	cmp_imm(jinfo->codebuf, r, 0);
+	bci = Thumb2_Branch(jinfo, bci, cond);
+	len = 0;
+	break;
+      }
+
+      case opc_if_icmpeq:
+      case opc_if_icmpne:
+      case opc_if_icmplt:
+      case opc_if_icmpge:
+      case opc_if_icmpgt:
+      case opc_if_icmple:
+      case opc_if_acmpeq:
+      case opc_if_acmpne: {
+	Reg r_lho, r_rho;
+	unsigned cond = opcode - opc_if_icmpeq;
+	if (opcode >= opc_if_acmpeq) cond = opcode - opc_if_acmpeq;
+	Thumb2_Fill(jinfo, 2);
+	r_rho = POP(jstack);
+	r_lho = POP(jstack);
+	Thumb2_Flush(jinfo);
+	cmp_reg(jinfo->codebuf, r_lho, r_rho);
+	bci = Thumb2_Branch(jinfo, bci, cond);
+	len = 0;
+	break;
+      }
+
+      case opc_return:
+      case opc_dreturn:
+      case opc_lreturn:
+      case opc_ireturn:
+      case opc_freturn:
+      case opc_areturn:
+	Thumb2_Return(jinfo, opcode);
+	if (!jinfo->compiled_return) jinfo->compiled_return = bci;
+	break;
+
+      case opc_return_register_finalizer: {
+	Thumb2_Stack *jstack = jinfo->jstack;
+	Reg r, r_tmp;
+	unsigned loc_eq;
+
+	Thumb2_Flush(jinfo);
+	Thumb2_Load(jinfo, 0, stackdepth);
+	r = POP(jstack);
+	r_tmp = Thumb2_Tmp(jinfo, (1<<r));
+	ldr_imm(jinfo->codebuf, r_tmp, r, 4, 1, 0);
+	ldr_imm(jinfo->codebuf, r_tmp, r_tmp, KLASS_PART+KLASS_ACCESSFLAGS, 1, 0);
+	tst_imm(jinfo->codebuf, r_tmp, JVM_ACC_HAS_FINALIZER);
+	loc_eq = forward_16(jinfo->codebuf);
+	Thumb2_save_locals(jinfo, stackdepth);
+	mov_reg(jinfo->codebuf, ARM_R1, r);
+	ldr_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
+	ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
+	add_imm(jinfo->codebuf, ARM_R0, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	str_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
+	sub_imm(jinfo->codebuf, ARM_R0, Rstack, 4);
+	str_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
+
+	mov_reg(jinfo->codebuf, ARM_R0, Rthread);
+	mov_imm(jinfo->codebuf, ARM_R3, (u32)_ZN18InterpreterRuntime18register_finalizerEP10JavaThreadP7oopDesc);
+	blx_reg(jinfo->codebuf, ARM_R3);
+
+	ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R3, 0);
+	it(jinfo->codebuf, COND_NE, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	bcc_patch(jinfo->codebuf, COND_EQ, loc_eq);
+	Thumb2_Return(jinfo, opc_return);
+	break;
+      }
+
+      case opc_new: {
+	unsigned loc;
+
+	Thumb2_Flush(jinfo);
+	mov_imm(jinfo->codebuf, ARM_R1, GET_JAVA_U2(code_base+bci+1));
+	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
+      Thumb2_save_locals(jinfo, stackdepth);
+	bl(jinfo->codebuf, handlers[H_NEW]);
+      Thumb2_restore_locals(jinfo, stackdepth);
+	cmp_imm(jinfo->codebuf, ARM_R0, 0);
+	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_aastore: {
+	Reg src[3], dst[3];
+	unsigned loc;
+
+	Thumb2_Fill(jinfo, 3);
+	src[0] = POP(jstack);	// value
+	src[1] = POP(jstack);	// index
+	src[2] = POP(jstack);	// arrayref
+	Thumb2_Flush(jinfo);
+	dst[0] = ARM_R1;
+	dst[1] = ARM_R2;
+	dst[2] = ARM_R3;
+	mov_multiple(jinfo->codebuf, dst, src, 3);
+	mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+      Thumb2_save_locals(jinfo, stackdepth - 3);	// 3 args popped above
+	bl(jinfo->codebuf, handlers[H_AASTORE]);
+      Thumb2_restore_locals(jinfo, stackdepth - 3);
+	cmp_imm(jinfo->codebuf, ARM_R0, 0);
+	it(jinfo->codebuf, COND_NE, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	break;
+      }
+
+      case opc_instanceof: {
+	unsigned loc;
+	Reg r;
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Flush(jinfo);
+	mov_reg(jinfo->codebuf, ARM_R2, r);
+	mov_imm(jinfo->codebuf, ARM_R1, GET_JAVA_U2(code_base+bci+1));
+	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
+      Thumb2_save_locals(jinfo, stackdepth - 1);
+	bl(jinfo->codebuf, handlers[H_INSTANCEOF]);
+      Thumb2_restore_locals(jinfo, stackdepth - 1);	// 1 arg popped above
+	cmp_imm(jinfo->codebuf, ARM_R0, (unsigned)-1);
+	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_checkcast: {
+	unsigned loc;
+	Reg r;
+
+	Thumb2_Fill(jinfo, 1);
+	r = TOS(jstack);
+	Thumb2_Flush(jinfo);
+	mov_reg(jinfo->codebuf, ARM_R2, r);
+	mov_imm(jinfo->codebuf, ARM_R1, GET_JAVA_U2(code_base+bci+1));
+	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
+      Thumb2_save_locals(jinfo, stackdepth);
+	bl(jinfo->codebuf, handlers[H_CHECKCAST]);
+      Thumb2_restore_locals(jinfo, stackdepth);
+	cmp_imm(jinfo->codebuf, ARM_R0, 0);
+	it(jinfo->codebuf, COND_NE, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	break;
+      }
+
+      case opc_newarray: {
+	Reg r;
+	unsigned loc;
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Flush(jinfo);
+	mov_reg(jinfo->codebuf, ARM_R2, r);
+	mov_imm(jinfo->codebuf, ARM_R1, code_base[bci+1]);
+	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
+      Thumb2_save_locals(jinfo, stackdepth-1);
+	bl(jinfo->codebuf, handlers[H_NEWARRAY]);
+      Thumb2_restore_locals(jinfo, stackdepth-1);
+	ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
+	mov_imm(jinfo->codebuf, ARM_R2, 0);
+  	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R0, 0);
+	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_anewarray: {
+	Reg r;
+	unsigned loc;
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+	Thumb2_Flush(jinfo);
+	mov_reg(jinfo->codebuf, ARM_R3, r);
+	mov_imm(jinfo->codebuf, ARM_R2, GET_JAVA_U2(code_base+bci+1));
+	mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+      Thumb2_save_locals(jinfo, stackdepth-1);
+	bl(jinfo->codebuf, handlers[H_ANEWARRAY]);
+      Thumb2_restore_locals(jinfo, stackdepth-1);
+	ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
+	mov_imm(jinfo->codebuf, ARM_R2, 0);
+  	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R0, 0);
+	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_multianewarray: {
+	unsigned loc;
+
+	Thumb2_Flush(jinfo);
+	mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
+	mov_imm(jinfo->codebuf, ARM_R1, code_base[bci+3] * 4);
+      Thumb2_save_locals(jinfo, stackdepth);
+	bl(jinfo->codebuf, handlers[H_MULTIANEWARRAY]);
+      Thumb2_restore_locals(jinfo, stackdepth - code_base[bci+3]);
+	ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
+	mov_imm(jinfo->codebuf, ARM_R2, 0);
+  	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
+	cmp_imm(jinfo->codebuf, ARM_R0, 0);
+	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
+	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
+	PUSH(jstack, ARM_R0);
+	break;
+      }
+
+      case opc_arraylength: {
+	Reg r_obj, r_len;
+
+	Thumb2_Fill(jinfo, 1);
+	r_obj = POP(jstack);
+	Thumb2_Spill(jinfo, 1, 0);
+	r_len = JSTACK_REG(jstack);
+	PUSH(jstack, r_len);
+	ldr_imm(jinfo->codebuf, r_len, r_obj, 8, 1, 0);
+	break;
+      }
+
+      case opc_lookupswitch: {
+	unsigned w;
+	unsigned nbci;
+	int def;
+	int npairs;	// The Java spec says signed but must be >= 0??
+	unsigned *table, *tablep;
+	unsigned r;
+	unsigned oldidx;
+	unsigned table_loc;
+	int i;
+
+	nbci = bci & ~3;
+	w = *(unsigned int *)(code_base + nbci + 4);
+	def = bci + (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 8);
+	npairs = (int)BYTESEX_REVERSE(w);
+	table = (unsigned int *)(code_base + nbci + 12);
+
+	Thumb2_Fill(jinfo, 1);
+	r = POP(jstack);
+
+	table_loc = out_loc(jinfo->codebuf);
+	for (i = 0, tablep = table; i < npairs; i++) {
+	  unsigned match;
+
+	  w = tablep[0];
+	  match = BYTESEX_REVERSE(w);
+	  tablep += 2;
+	  cmp_imm(jinfo->codebuf, r, match);
+	  t2_bug_align(jinfo->codebuf);
+	  forward_32(jinfo->codebuf);
+	}
+	t2_bug_align(jinfo->codebuf);
+	forward_32(jinfo->codebuf);
+	Thumb2_codegen(jinfo, bci+len);
+
+	oldidx = codebuf->idx;
+	codebuf->idx = table_loc >> 1;
+	for (i = 0, tablep = table; i < npairs; i++) {
+	  unsigned match;
+	  unsigned dest;
+	  unsigned loc;
+
+	  w = tablep[0];
+	  match = BYTESEX_REVERSE(w);
+	  w = tablep[1];
+	  dest = bci + (int)BYTESEX_REVERSE(w);
+	  tablep += 2;
+	  cmp_imm(jinfo->codebuf, r, match);
+	  JASSERT(jinfo->bc_stackinfo[dest] & BC_COMPILED, "code not compiled");
+	  t2_bug_align(jinfo->codebuf);
+	  loc = forward_32(jinfo->codebuf);
+	  branch_patch(jinfo->codebuf, COND_EQ, loc, jinfo->bc_stackinfo[dest] & ~BC_FLAGS_MASK);
+	}
+	JASSERT(jinfo->bc_stackinfo[def] & BC_COMPILED, "default in lookupswitch not compiled");
+	t2_bug_align(jinfo->codebuf);
+	branch_uncond_patch(jinfo->codebuf, out_loc(jinfo->codebuf), jinfo->bc_stackinfo[def] & ~BC_FLAGS_MASK);
+	codebuf->idx = oldidx;
+
+	bci = (unsigned)-1;
+	len = 0;
+
+	break;
+      }
+
+      case opc_tableswitch: {
+	int low, high, i;
+	unsigned w;
+	unsigned *table, *tablep;
+	unsigned nbci;
+	int def;
+	unsigned loc, table_loc;
+	unsigned r, rs;
+	unsigned oldidx;
+	unsigned negative_offsets, negative_branch_table;
+
+	nbci = bci & ~3;
+	w = *(unsigned int *)(code_base + nbci + 8);
+	low = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 12);
+	high = (int)BYTESEX_REVERSE(w);
+	w = *(unsigned int *)(code_base + nbci + 4);
+	def = bci + (int)BYTESEX_REVERSE(w);
+	table = (unsigned int *)(code_base + nbci + 16);
+
+	Thumb2_Fill(jinfo, 1);
+	rs = POP(jstack);
+	r = Thumb2_Tmp(jinfo, (1<<rs));
+	sub_imm(jinfo->codebuf, r, rs, low);
+	cmp_imm(jinfo->codebuf, r, (high-low)+1);
+	loc = 0;
+	if (jinfo->bc_stackinfo[def] & BC_COMPILED)
+	  branch(jinfo->codebuf, COND_CS, jinfo->bc_stackinfo[def] & ~BC_FLAGS_MASK);
+	else
+	  loc = forward_32(jinfo->codebuf);
+	tbh(jinfo->codebuf, ARM_PC, r);
+	table_loc = out_loc(jinfo->codebuf);
+	negative_offsets = 0;
+	for (i = low, tablep = table; i <= high; i++) {
+	  int offset;
+	  w = *tablep++;
+	  offset = (int)BYTESEX_REVERSE(w);
+	  if (offset < 0) negative_offsets++;
+	  out_16(jinfo->codebuf, 0);
+	}
+	negative_branch_table = out_loc(jinfo->codebuf);
+	for (i = 0; i < (int)negative_offsets; i++) {
+	  t2_bug_align(jinfo->codebuf);
+	  out_16x2(jinfo->codebuf, 0);
+	}
+
+	Thumb2_codegen(jinfo, bci+len);
+
+	if (loc) {
+	  JASSERT(jinfo->bc_stackinfo[def] & BC_COMPILED, "def not compiled in tableswitch");
+	  branch_patch(jinfo->codebuf, COND_CS, loc, jinfo->bc_stackinfo[def] & ~BC_FLAGS_MASK);
+	}
+
+	oldidx = codebuf->idx;
+	codebuf->idx = table_loc >> 1;
+	for (i = low, tablep = table; i <= high; i++) {
+	  unsigned dest;
+	  int offset;
+
+	  w = *tablep++;
+	  offset = (int)BYTESEX_REVERSE(w);
+	  dest = bci + offset;
+	  JASSERT(jinfo->bc_stackinfo[dest] & BC_COMPILED, "code not compiled");
+	  dest = jinfo->bc_stackinfo[dest] & ~BC_FLAGS_MASK;
+	  if (offset < 0) {
+	    unsigned oldidx;
+	    out_16(jinfo->codebuf, (negative_branch_table >> 1) - (table_loc >> 1));
+	    PATCH(negative_branch_table) {
+	      t2_bug_align(jinfo->codebuf);
+	      branch_uncond_patch(jinfo->codebuf, out_loc(jinfo->codebuf), dest);
+	      negative_branch_table = out_loc(jinfo->codebuf);
+	    } HCTAP;
+	  } else {
+	    JASSERT((dest & 1) == 0 && (table_loc & 1) == 0, "unaligned code");
+	    offset = (dest >> 1) - (table_loc >> 1);
+	    if (offset >= 65536) {
+	      longjmp(compiler_error_env, COMPILER_RESULT_FAILED);
+	    }
+	    out_16(jinfo->codebuf, offset);
+	  }
+	}
+	codebuf->idx = oldidx;
+	bci = (unsigned)-1;
+	len = 0;
+	break;
+      }
+
+      case opc_wide: {
+	unsigned local = GET_JAVA_U2(code_base + bci + 2);
+	opcode = code_base[bci+1];
+	if (opcode == opc_iinc) {
+	  int constant = GET_JAVA_S2(code_base + bci + 4);
+	  unsigned r = jinfo->jregs->r_local[local];
+	  
+	  if (!r) {
+	    int nlocals = jinfo->method->max_locals();
+	    r = ARM_IP;
+	    stackdepth -= jstack->depth;
+	    if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
+	    load_local(jinfo, r, local, stackdepth);
+	    add_imm(jinfo->codebuf, r, r, constant);
+	    store_local(jinfo, r, local, stackdepth);
+	  } else {
+	    Thumb2_Corrupt(jinfo, r, 0);
+	    add_imm(jinfo->codebuf, r, r, constant);
+	  }
+	} else if (opcode == opc_ret) {
+	  Thumb2_Exit(jinfo, H_RET, bci, stackdepth);
+	} else {
+	  if (opcode == opc_iload ||
+	  	opcode == opc_fload || opcode == opc_aload)
+	    Thumb2_Load(jinfo, local, stackdepth);
+	  else if (opcode == opc_lload || opcode == opc_dload)
+	    Thumb2_LoadX2(jinfo, local, stackdepth);
+	  else if (opcode == opc_istore ||
+	  	opcode == opc_fstore || opcode == opc_astore)
+	    Thumb2_Store(jinfo, local, stackdepth);
+	  else if (opcode == opc_lstore || opcode == opc_dstore)
+	    Thumb2_StoreX2(jinfo, local, stackdepth);
+	  else fatal1("Undefined wide opcode %d\n", opcode);
+	}
+	break;
+      }
+
+      default:
+	JASSERT(0, "unknown bytecode");
+	break;
+    }
+    bci += len;
+#ifdef T2EE_PRINT_DISASS
+    if (len == 0) {
+      if (start_idx == jinfo->codebuf->idx) start_bci[start_idx] = -1;
+    } else
+      end_bci[start_idx] = bci;
+#endif
+  }
+}
+
+#define BEG_BCI_OFFSET		0
+#define END_BCI_OFFSET		1
+#define HANDLER_BCI_OFFSET	2
+#define KLASS_INDEX_OFFSET	3
+#define ENTRY_SIZE		4
+
+extern "C" int Thumb2_lr_to_bci(unsigned lr, methodOop method, Reg *regs, unsigned *locals)
+{
+  Compiled_Method *cmethod = compiled_method_list;
+  typeArrayOop table = method->exception_table();
+  constantPoolOop pool = method->constants();
+  int length = table->length();
+
+  while (cmethod) {
+    unsigned *exception_table = cmethod->exception_table;
+    if (exception_table) {
+      unsigned code_base = (unsigned)cmethod;
+      if (code_base <= lr && lr <= (unsigned)exception_table) {
+	int exception_index = -1;
+	unsigned exception_found = 0;
+
+	for (int i = 0; i < length; i += ENTRY_SIZE) {
+	  unsigned offsets = *exception_table++;
+	  unsigned exc_beg = code_base + ((offsets >> 16) << 1);
+	  unsigned exc_end = code_base + ((offsets & 0xffff) << 1);
+
+	  if (exc_beg <= lr && lr <= exc_end) {
+	    if (exc_beg > exception_found) {
+	      // With nested try catch blocks, choose the most deeply nested
+	      exception_found = exc_beg;
+	      exception_index = i;
+	    }	    
+	  }
+	  if (exception_index >= 0) {
+	    if (regs) {
+	      for (unsigned i = 0; i < PREGS; i++) {
+		int local = cmethod->regusage[i];
+		if (local >= 0) {
+		  locals[-local] = regs[i];
+		}
+	      }
+	    }
+	    return table->int_at(exception_index + BEG_BCI_OFFSET);
+	  }
+	}
+      }
+    }
+    cmethod = cmethod->next;
+  }
+  return -1;
+}
+
+void Thumb2_generate_exception_table(Compiled_Method *cmethod, Thumb2_Info *jinfo)
+{
+  methodOop method = jinfo->method;
+  typeArrayOop table = method->exception_table();
+  constantPoolOop pool = method->constants();
+  int length = table->length();
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+
+  cmethod->exception_table = (unsigned *)out_pos(jinfo->codebuf);
+  for (int i = 0; i < length; i += ENTRY_SIZE) {
+    int beg_bci = table->int_at(i + BEG_BCI_OFFSET);
+    int end_bci = table->int_at(i + END_BCI_OFFSET);
+    unsigned stackinfo;
+    unsigned beg_offset, end_offset;
+
+    stackinfo = bc_stackinfo[beg_bci];
+    beg_offset = (stackinfo & ~BC_FLAGS_MASK) >> 1;
+    stackinfo = bc_stackinfo[end_bci];
+    end_offset = (stackinfo & ~BC_FLAGS_MASK) >> 1;
+    if (!(beg_offset != 0 && end_offset >= beg_offset && end_offset < 65536)) {
+	longjmp(compiler_error_env, COMPILER_RESULT_FAILED);
+    }
+    out_32(jinfo->codebuf, (beg_offset << 16) | (end_offset));
+  }
+}
+
+void Thumb2_tablegen(Compiled_Method *cmethod, Thumb2_Info *jinfo)
+{
+  unsigned code_size = jinfo->code_size;
+  jubyte *code_base = jinfo->code_base;
+  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
+  unsigned bci;
+  unsigned count = 0;
+  unsigned i;
+  CodeBuf *codebuf = jinfo->codebuf;
+
+  cmethod->osr_table = (unsigned *)out_pos(jinfo->codebuf);
+  out_32(codebuf, 0);
+  bc_stackinfo[0] |= BC_BACK_TARGET;
+  for (bci = 0; bci < code_size;) {
+    unsigned stackinfo = bc_stackinfo[bci];
+    unsigned bytecodeinfo;
+    unsigned opcode;
+
+    if (stackinfo & BC_BACK_TARGET) {
+      unsigned code_offset = (stackinfo & ~BC_FLAGS_MASK) >> 1;
+      JASSERT(stackinfo & BC_COMPILED, "back branch target not compiled???");
+      if (code_offset >= 65536) {
+	longjmp(compiler_error_env, COMPILER_RESULT_FAILED);
+      }
+//      JASSERT(code_offset < (1<<16), "oops, codesize too big");
+      out_32(codebuf, (bci << 16) | code_offset);
+      count++;
+    }
+
+    opcode = code_base[bci];
+    bytecodeinfo = bcinfo[opcode];
+    if (!BCI_SPECIAL(bytecodeinfo)) {
+      bci += BCI_LEN(bytecodeinfo);
+      continue;
+    } else {
+      int len = Bytecodes::length_for((Bytecodes::Code)opcode);
+      if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
+      bci += len;
+    }
+  }
+  *cmethod->osr_table = count;
+  if (jinfo->method->has_exception_handler())
+    Thumb2_generate_exception_table(cmethod, jinfo);
+}
+
+extern "C" void Thumb2_Clear_Cache(char *base, char *limit);
+#define IS_COMPILED(e, cb) ((e) >= (unsigned)(cb) && (e) < (unsigned)(cb) + (cb)->size)
+
+unsigned Thumb2_osr_from_bci(Compiled_Method *cmethod, unsigned bci)
+{
+  unsigned *osr_table;
+  unsigned count;
+  unsigned i;
+
+  osr_table = cmethod->osr_table;
+  if (!osr_table) return 0;
+  count = *osr_table++;
+  for (i = 0; i < count; i++) {
+    unsigned u = *osr_table++;
+
+    if (bci == (u>>16)) return (u & 0xffff) << 1;
+  }
+  return 0;
+}
+
+static int DebugSwitch = 1;
+
+extern "C" void Debug_Ignore_Safepoints(void)
+{
+	printf("Ignore Safepoints\n");
+}
+
+extern "C" void Debug_Notice_Safepoints(void)
+{
+	printf("Notice Safepoints\n");
+}
+
+extern "C" void Debug_ExceptionReturn(interpreterState istate, intptr_t *stack)
+{
+  JavaThread *thread = istate->thread();
+
+  if (thread->has_pending_exception()) {
+    Handle ex(thread, thread->pending_exception());
+    tty->print_cr("Exception %s", Klass::cast(ex->klass())->external_name());
+  }
+}
+
+extern "C" void Debug_Stack(intptr_t *stack)
+{
+  int i;
+  char msg[16];
+
+  tty->print("  Stack:");
+  for (i = 0; i < 6; i++) {
+    tty->print(" [");
+    sprintf(msg, "%d", i);
+    tty->print(msg);
+    tty->print("] = ");
+    sprintf(msg, "%08x", (int)stack[i]);
+    tty->print(msg);
+  }
+  tty->cr();
+}
+
+extern "C" void Debug_MethodEntry(interpreterState istate, intptr_t *stack, methodOop callee)
+{
+#if 0
+  if (DebugSwitch) {
+    methodOop method = istate->method();
+    tty->print("Entering ");
+    callee->print_short_name(tty);
+    tty->print(" from ");
+    method->print_short_name(tty);
+    tty->cr();
+    Debug_Stack(stack);
+    tty->flush();
+  }
+#endif
+}
+
+extern "C" void Debug_MethodExit(interpreterState istate, intptr_t *stack)
+{
+  if (DebugSwitch) {
+    methodOop method = istate->method();
+    JavaThread *thread = istate->thread();
+    oop exc = thread->pending_exception();
+
+    if (!exc) return;
+    tty->print("Leaving ");
+    method->print_short_name(tty);
+    tty->cr();
+    Debug_Stack(stack);
+    tty->flush();
+    if (exc) tty->print_cr("Exception %s", exc->print_value_string());
+  }
+}
+
+extern "C" void Debug_MethodCall(interpreterState istate, intptr_t *stack, methodOop callee)
+{
+#if 0
+  if (DebugSwitch) {
+    methodOop method = istate->method();
+    tty->print("Calling ");
+    callee->print_short_name(tty);
+    tty->print(" from ");
+    method->print_short_name(tty);
+    tty->cr();
+    Debug_Stack(stack);
+    tty->flush();
+  }
+#endif
+}
+
+extern "C" int Debug_irem_Handler(int a, int b)
+{
+	printf("%d %% %d\n", a, b);
+	return a%b;
+}
+
+extern "C" void Thumb2_Install(methodOop mh, u32 entry);
+
+#define IS_COMPILED(e, cb) ((e) >= (unsigned)(cb) && (e) < (unsigned)(cb) + (cb)->size)
+
+extern "C" unsigned cmpxchg_ptr(unsigned new_value, volatile unsigned *ptr, unsigned cmp_value);
+static volatile unsigned compiling;
+static unsigned CompileCount = 0;
+static unsigned MaxCompile = 130;
+
+#define COMPILE_ONLY	0
+#define COMPILE_COUNT	0
+#define DISASS_AFTER	0
+//#define COMPILE_LIST	0
+
+#ifdef COMPILE_LIST
+static const char *compile_list[] = {
+	0
+};
+#endif
+
+static unsigned compiled_methods = 0;
+
+#ifdef T2EE_PRINT_STATISTICS
+static unsigned bytecodes_compiled = 0;
+static unsigned arm_code_generated = 0;
+static unsigned total_zombie_bytes = 0;
+static clock_t total_compile_time = 0;
+#endif
+
+extern unsigned CPUInfo;
+static int DisableCompiler = 0;
+
+extern "C" unsigned long long Thumb2_Compile(JavaThread *thread, unsigned branch_pc)
+{
+  HandleMark __hm(thread);
+  frame fr = thread->last_frame();
+  methodOop method = fr.interpreter_frame_method();
+  symbolOop name = method->name();
+  symbolOop sig = method->signature();
+  jbyte *base = sig->base();;
+
+  jubyte *code_base = (jubyte *)method->code_base();
+  int code_size = method->code_size();
+  InvocationCounter* ic = method->invocation_counter();
+  InvocationCounter* bc = method->backedge_counter();
+  Thumb2_Info jinfo_str;
+  CodeBuf codebuf_str;
+  Thumb2_Stack jstack_str;
+  Thumb2_Registers jregs_str;
+  int idx;
+  u32 code_handle, slow_entry;
+  Thumb2_CodeBuf *cb = thumb2_codebuf;
+  int rc;
+  char *saved_hp;
+  Compiled_Method *cmethod;
+  u32 compiled_offset;
+  Thumb2_Entrypoint thumb_entry;
+  int compiled_accessor;
+
+  if (DisableCompiler || method->is_not_compilable()) {
+	ic->set(ic->state(), 1);
+	bc->set(ic->state(), 1);
+	return 0;
+  }
+
+  slow_entry = *(unsigned *)method->from_interpreted_entry();
+  if (IS_COMPILED(slow_entry, cb)) {
+    cmethod = (Compiled_Method *)(slow_entry & ~TBIT);
+    compiled_offset = Thumb2_osr_from_bci(cmethod, branch_pc);
+    if (compiled_offset == 0) return 0;
+    thumb_entry.compiled_entrypoint = slow_entry + compiled_offset;
+    thumb_entry.osr_entry = (unsigned)cmethod->osr_entry | TBIT;
+    return *(unsigned long long *)&thumb_entry;
+  }
+
+  ic->decay();
+  bc->decay();
+
+  // Dont compile anything with code size >= 32K.
+  // We rely on the bytecode index fitting in 16 bits
+  //
+  // Dont compile anything with max stack + maxlocal > 1K
+  // The range of an LDR in T2 is -4092..4092
+  // Othersize we have difficulty access the locals from the stack pointer
+  //
+  if (code_size > THUMB2_MAX_BYTECODE_SIZE ||
+		(method->max_locals() + method->max_stack()) >= 1000 ||
+		method->has_monitor_bytecodes()) {
+        method->set_not_compilable();
+	return 0;
+  }
+
+  if (COMPILE_COUNT && compiled_methods == COMPILE_COUNT) return 0;
+
+  if (COMPILE_ONLY) {
+    if (strcmp(name->as_C_string(), COMPILE_ONLY) != 0) return 0;
+  }
+
+#ifdef COMPILE_LIST
+  {
+	const char **argv = compile_list;
+	const char *s;
+	while (s = *argv++) {
+		if (strcmp(s, method->name_and_sig_as_C_string()) == 0)
+			break;
+	}
+	if (!s) return 0;
+  }
+#endif
+
+  saved_hp = cb->hp;
+  if (rc = setjmp(compiler_error_env)) {
+    cb->hp = saved_hp;
+    if (rc == COMPILER_RESULT_FAILED)
+        method->set_not_compilable();
+    if (rc == COMPILER_RESULT_FATAL)
+	DisableCompiler = 1;
+    compiling = 0;
+    return 0;
+  }
+
+  if (cmpxchg_ptr(1, &compiling, 0)) return 0;
+
+#ifdef T2EE_PRINT_STATISTICS
+  clock_t compile_time = clock();
+#endif
+
+#ifdef T2EE_PRINT_COMPILATION
+  if (t2ee_print_compilation) {
+    fprintf(stderr, "Compiling %d %c%c %s\n",
+	compiled_methods,
+	method->is_synchronized() ? 'S' : ' ',
+	method->has_exception_handler() ? 'E' : ' ',
+	method->name_and_sig_as_C_string());
+  }
+#endif
+
+  memset(bc_stackinfo, 0, code_size * sizeof(unsigned));
+  memset(locals_info, 0, method->max_locals() * sizeof(unsigned));
+#ifdef T2EE_PRINT_DISASS
+  memset(start_bci, 0xff, sizeof(start_bci));
+  memset(end_bci, 0xff, sizeof(end_bci));
+#endif
+
+  jinfo_str.thread = thread;
+  jinfo_str.method = method;
+  jinfo_str.code_base = code_base;
+  jinfo_str.code_size = code_size;
+  jinfo_str.bc_stackinfo = bc_stackinfo;
+  jinfo_str.locals_info = locals_info;
+  jinfo_str.compiled_return = 0;
+  jinfo_str.zombie_bytes = 0;
+  jinfo_str.is_leaf = 1;
+
+  Thumb2_local_info_from_sig(&jinfo_str, method, base);
+
+  Thumb2_pass1(&jinfo_str, 0);
+  Thumb2_pass2(&jinfo_str, 0, 0);
+
+  codebuf_str.codebuf = (unsigned short *)cb->hp;
+  codebuf_str.idx = 0;
+  codebuf_str.limit = (unsigned short *)cb->sp - (unsigned short *)cb->hp;
+
+  jstack_str.stack = stack;
+  jstack_str.depth = 0;
+
+  memset(r_local, 0, method->max_locals() * sizeof(unsigned));
+
+  jregs_str.r_local = r_local;
+
+  jinfo_str.codebuf = &codebuf_str;
+  jinfo_str.jstack = &jstack_str;
+  jinfo_str.jregs = &jregs_str;
+
+  jregs_str.pregs[0] = JAZ_V1;
+  jregs_str.pregs[1] = JAZ_V2;
+  jregs_str.pregs[2] = JAZ_V3;
+  jregs_str.pregs[3] = JAZ_V4;
+
+#ifndef USE_RLOCAL
+  jregs_str.pregs[4] = JAZ_V5;
+#endif
+
+  jregs_str.npregs = PREGS;
+
+  Thumb2_RegAlloc(&jinfo_str);
+
+  slow_entry = out_align(&codebuf_str, CODE_ALIGN);
+  cmethod = (Compiled_Method *)slow_entry;
+  slow_entry |= TBIT;
+
+  cb->hp += codebuf_str.idx * 2;
+  codebuf_str.codebuf = (unsigned short *)cb->hp;
+  codebuf_str.idx = 0;
+  codebuf_str.limit = (unsigned short *)cb->sp - (unsigned short *)cb->hp;
+
+  compiled_accessor = 1;
+  if (!method->is_accessor() || !Thumb2_Accessor(&jinfo_str)) {
+    Thumb2_Enter(&jinfo_str);
+    Thumb2_codegen(&jinfo_str, 0);
+    compiled_accessor = 0;
+  }
+
+#ifdef T2EE_PRINT_DISASS
+  if (DISASS_AFTER == 0 || compiled_methods >= DISASS_AFTER)
+    if (t2ee_print_disass)
+	Thumb2_disass(&jinfo_str);
+#endif
+
+  for (int i = 0; i < PREGS; i++)
+    cmethod->regusage[i] = jregs_str.mapping[i];
+
+  Thumb2_Clear_Cache(cb->hp, cb->hp + codebuf_str.idx * 2);
+
+#ifdef T2EE_PRINT_STATISTICS
+  compile_time = clock() - compile_time;
+  total_compile_time += compile_time;
+
+  if (t2ee_print_statistics) {
+    unsigned codegen = codebuf_str.idx * 2;
+    bytecodes_compiled += code_size;
+    arm_code_generated += codegen;
+    total_zombie_bytes += jinfo_str.zombie_bytes;
+    fprintf(stderr, "%d bytecodes => %d bytes code in %.2f sec, totals: %d => %d in %.2f sec\n",
+      code_size, codegen, (double)compile_time/(double)CLOCKS_PER_SEC,
+    bytecodes_compiled, arm_code_generated, (double)total_compile_time/(double)CLOCKS_PER_SEC);
+  }
+#endif
+
+  code_handle = out_align(&codebuf_str, sizeof(address));
+
+  out_32(&codebuf_str, slow_entry);
+
+  if (!compiled_accessor)
+    Thumb2_tablegen(cmethod, &jinfo_str);
+
+  cb->hp += codebuf_str.idx * 2;
+
+  *compiled_method_list_tail_ptr = cmethod;
+  compiled_method_list_tail_ptr = &(cmethod->next);
+
+  Thumb2_Install(method, code_handle);
+
+  compiled_methods++;
+
+  compiling = 0;
+
+  compiled_offset = Thumb2_osr_from_bci(cmethod, branch_pc);
+  if (compiled_offset == 0) return 0;
+  thumb_entry.compiled_entrypoint = slow_entry + compiled_offset;
+  thumb_entry.osr_entry = (unsigned)cmethod->osr_entry | TBIT;
+  return *(unsigned long long *)&thumb_entry;
+}
+
+extern "C" void Thumb2_DivZero_Handler(void);
+extern "C" void Thumb2_ArrayBounds_Handler(void);
+extern "C" void Thumb2_Handle_Exception(void);
+extern "C" void Thumb2_Handle_Exception_NoRegs(void);
+extern "C" void Thumb2_Exit_To_Interpreter(void);
+extern "C" void Thumb2_Stack_Overflow(void);
+
+extern "C" void __divsi3(void);
+extern "C" void __aeabi_ldivmod(void);
+extern "C" void __aeabi_i2f(void);
+extern "C" void __aeabi_i2d(void);
+extern "C" void __aeabi_l2f(void);
+extern "C" void __aeabi_l2d(void);
+extern "C" void __aeabi_f2d(void);
+extern "C" void __aeabi_d2f(void);
+extern "C" void Helper_new(void);
+extern "C" void Helper_instanceof(void);
+extern "C" void Helper_checkcast(void);
+extern "C" void Helper_aastore(void);
+extern "C" void Helper_aputfield(void);
+extern "C" void Helper_synchronized_enter(void);
+extern "C" void Helper_synchronized_exit(void);
+
+extern "C" void _ZN13SharedRuntime3f2iEf(void);
+extern "C" void _ZN13SharedRuntime3f2lEf(void);
+extern "C" void _ZN13SharedRuntime3d2iEd(void);
+extern "C" void _ZN13SharedRuntime3d2lEd(void);
+extern "C" void _ZN18InterpreterRuntime8newarrayEP10JavaThread9BasicTypei(void);
+extern "C" void _ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii(void);
+extern "C" void _ZN18InterpreterRuntime14multianewarrayEP10JavaThreadPi(void);
+extern "C" void _ZN18InterpreterRuntime3ldcEP10JavaThreadb(void);
+
+extern char Thumb2_stubs[];
+extern char Thumb2_stubs_end[];
+extern char Thumb2_idiv_stub[];
+extern char Thumb2_irem_stub[];
+extern char Thumb2_invokeinterface_stub[];
+extern char Thumb2_invokevirtual_stub[];
+extern char Thumb2_invokestatic_stub[];
+extern char Thumb2_invokespecial_stub[];
+extern char Thumb2_getfield_word_stub[];
+extern char Thumb2_getfield_sh_stub[];
+extern char Thumb2_getfield_h_stub[];
+extern char Thumb2_getfield_sb_stub[];
+extern char Thumb2_getfield_dw_stub[];
+extern char Thumb2_putfield_word_stub[];
+extern char Thumb2_putfield_h_stub[];
+extern char Thumb2_putfield_b_stub[];
+extern char Thumb2_putfield_a_stub[];
+extern char Thumb2_putfield_dw_stub[];
+extern char Thumb2_getstatic_word_stub[];
+extern char Thumb2_getstatic_sh_stub[];
+extern char Thumb2_getstatic_h_stub[];
+extern char Thumb2_getstatic_sb_stub[];
+extern char Thumb2_getstatic_dw_stub[];
+extern char Thumb2_putstatic_word_stub[];
+extern char Thumb2_putstatic_h_stub[];
+extern char Thumb2_putstatic_b_stub[];
+extern char Thumb2_putstatic_a_stub[];
+extern char Thumb2_putstatic_dw_stub[];
+
+#define STUBS_SIZE	(Thumb2_stubs_end-Thumb2_stubs)
+#define IDIV_STUB		(Thumb2_idiv_stub-Thumb2_stubs)
+#define IREM_STUB		(Thumb2_irem_stub-Thumb2_stubs)
+#define INVOKEINTERFACE_STUB	(Thumb2_invokeinterface_stub-Thumb2_stubs)
+#define INVOKEVIRTUAL_STUB	(Thumb2_invokevirtual_stub-Thumb2_stubs)
+#define INVOKESTATIC_STUB	(Thumb2_invokestatic_stub-Thumb2_stubs)
+#define INVOKESPECIAL_STUB	(Thumb2_invokespecial_stub-Thumb2_stubs)
+#define GETFIELD_WORD_STUB	(Thumb2_getfield_word_stub-Thumb2_stubs)
+#define GETFIELD_SH_STUB	(Thumb2_getfield_sh_stub-Thumb2_stubs)
+#define GETFIELD_H_STUB		(Thumb2_getfield_h_stub-Thumb2_stubs)
+#define GETFIELD_SB_STUB	(Thumb2_getfield_sb_stub-Thumb2_stubs)
+#define GETFIELD_DW_STUB	(Thumb2_getfield_dw_stub-Thumb2_stubs)
+#define PUTFIELD_WORD_STUB	(Thumb2_putfield_word_stub-Thumb2_stubs)
+#define PUTFIELD_H_STUB		(Thumb2_putfield_h_stub-Thumb2_stubs)
+#define PUTFIELD_B_STUB		(Thumb2_putfield_b_stub-Thumb2_stubs)
+#define PUTFIELD_A_STUB		(Thumb2_putfield_a_stub-Thumb2_stubs)
+#define PUTFIELD_DW_STUB	(Thumb2_putfield_dw_stub-Thumb2_stubs)
+#define GETSTATIC_WORD_STUB	(Thumb2_getstatic_word_stub-Thumb2_stubs)
+#define GETSTATIC_SH_STUB	(Thumb2_getstatic_sh_stub-Thumb2_stubs)
+#define GETSTATIC_H_STUB	(Thumb2_getstatic_h_stub-Thumb2_stubs)
+#define GETSTATIC_SB_STUB	(Thumb2_getstatic_sb_stub-Thumb2_stubs)
+#define GETSTATIC_DW_STUB	(Thumb2_getstatic_dw_stub-Thumb2_stubs)
+#define PUTSTATIC_WORD_STUB	(Thumb2_putstatic_word_stub-Thumb2_stubs)
+#define PUTSTATIC_H_STUB	(Thumb2_putstatic_h_stub-Thumb2_stubs)
+#define PUTSTATIC_B_STUB	(Thumb2_putstatic_b_stub-Thumb2_stubs)
+#define PUTSTATIC_A_STUB	(Thumb2_putstatic_a_stub-Thumb2_stubs)
+#define PUTSTATIC_DW_STUB	(Thumb2_putstatic_dw_stub-Thumb2_stubs)
+
+extern "C" void Thumb2_NullPtr_Handler(void);
+
+
+extern "C" int Thumb2_Check_Null(unsigned *regs, unsigned pc)
+{
+  Thumb2_CodeBuf *cb = thumb2_codebuf;
+  if (!(CPUInfo & ARCH_THUMBEE)) return 0;
+  if (IS_COMPILED(pc, cb)) {
+    regs[ARM_LR] = pc;
+    regs[ARM_PC] = (unsigned)Thumb2_NullPtr_Handler;
+    regs[ARM_CPSR] &= ~CPSR_THUMB_BIT;
+    return 1;
+  }
+  return 0;
+}
+
+extern "C" void Thumb2_Initialize(void)
+{
+  CodeBuf codebuf;
+  Thumb2_CodeBuf *cb;
+  u32 h_divzero;
+  u32 loc_irem, loc_idiv, loc_ldiv;
+  int rc;
+
+  if (!(CPUInfo & ARCH_THUMBEE)) {
+    DisableCompiler = 1;
+    return;
+  }
+
+#ifdef T2EE_PRINT_COMPILATION
+  t2ee_print_compilation = getenv("T2EE_PRINT_COMPILATION");
+#endif
+#ifdef T2EE_PRINT_STATISTICS
+  t2ee_print_statistics = getenv("T2EE_PRINT_STATISTICS");
+#endif
+#ifdef T2EE_PRINT_DISASS
+  t2ee_print_disass = getenv("T2EE_PRINT_DISASS");
+#endif
+#ifdef T2EE_PRINT_REGUSAGE
+  t2ee_print_regusage = getenv("T2EE_PRINT_REGUSAGE");
+#endif
+
+  cb = (Thumb2_CodeBuf *)mmap(0, THUMB2_CODEBUF_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+  if (cb == MAP_FAILED) {
+    DisableCompiler = 1;
+    return;
+  }
+
+  cb->size = THUMB2_CODEBUF_SIZE;
+  cb->hp = (char *)cb + sizeof(Thumb2_CodeBuf);
+  cb->sp = (char *)cb + THUMB2_CODEBUF_SIZE;
+
+  codebuf.codebuf = (unsigned short *)cb->hp;
+  codebuf.idx = 0;
+  codebuf.limit = (unsigned short *)cb->sp - (unsigned short *)cb->hp;
+
+  if (rc = setjmp(compiler_error_env)) {
+    DisableCompiler = 1;
+    return;
+  }
+
+#if 1
+  memcpy(cb->hp, Thumb2_stubs, STUBS_SIZE);
+
+  handlers[H_IDIV] = (unsigned)(cb->hp + IDIV_STUB);
+  handlers[H_IREM] = (unsigned)(cb->hp + IREM_STUB);
+  handlers[H_INVOKEINTERFACE] = (unsigned)(cb->hp + INVOKEINTERFACE_STUB);
+  handlers[H_INVOKEVIRTUAL] = (unsigned)(cb->hp + INVOKEVIRTUAL_STUB);
+  handlers[H_INVOKESTATIC] = (unsigned)(cb->hp + INVOKESTATIC_STUB);
+  handlers[H_INVOKESPECIAL] = (unsigned)(cb->hp + INVOKESPECIAL_STUB);
+
+  handlers[H_GETFIELD_WORD] = (unsigned)(cb->hp + GETFIELD_WORD_STUB);
+  handlers[H_GETFIELD_SH] = (unsigned)(cb->hp + GETFIELD_SH_STUB);
+  handlers[H_GETFIELD_H] = (unsigned)(cb->hp + GETFIELD_H_STUB);
+  handlers[H_GETFIELD_SB] = (unsigned)(cb->hp + GETFIELD_SB_STUB);
+  handlers[H_GETFIELD_DW] = (unsigned)(cb->hp + GETFIELD_DW_STUB);
+
+  handlers[H_PUTFIELD_WORD] = (unsigned)(cb->hp + PUTFIELD_WORD_STUB);
+  handlers[H_PUTFIELD_H] = (unsigned)(cb->hp + PUTFIELD_H_STUB);
+  handlers[H_PUTFIELD_B] = (unsigned)(cb->hp + PUTFIELD_B_STUB);
+  handlers[H_PUTFIELD_A] = (unsigned)(cb->hp + PUTFIELD_A_STUB);
+  handlers[H_PUTFIELD_DW] = (unsigned)(cb->hp + PUTFIELD_DW_STUB);
+
+  handlers[H_GETSTATIC_WORD] = (unsigned)(cb->hp + GETSTATIC_WORD_STUB);
+  handlers[H_GETSTATIC_SH] = (unsigned)(cb->hp + GETSTATIC_SH_STUB);
+  handlers[H_GETSTATIC_H] = (unsigned)(cb->hp + GETSTATIC_H_STUB);
+  handlers[H_GETSTATIC_SB] = (unsigned)(cb->hp + GETSTATIC_SB_STUB);
+  handlers[H_GETSTATIC_DW] = (unsigned)(cb->hp + GETSTATIC_DW_STUB);
+
+  handlers[H_PUTSTATIC_WORD] = (unsigned)(cb->hp + PUTSTATIC_WORD_STUB);
+  handlers[H_PUTSTATIC_H] = (unsigned)(cb->hp + PUTSTATIC_H_STUB);
+  handlers[H_PUTSTATIC_B] = (unsigned)(cb->hp + PUTSTATIC_B_STUB);
+  handlers[H_PUTSTATIC_A] = (unsigned)(cb->hp + PUTSTATIC_A_STUB);
+  handlers[H_PUTSTATIC_DW] = (unsigned)(cb->hp + PUTSTATIC_DW_STUB);
+
+  codebuf.idx += (Thumb2_stubs_end-Thumb2_stubs) >> 1;
+#endif
+
+  handlers[H_LDIV] = handlers[H_LREM] = out_pos(&codebuf);
+  dop_reg(&codebuf, DP_ORR, ARM_IP, ARM_R2, ARM_R3, 0, 0);
+  loc_ldiv = forward_16(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_ldivmod);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+  bcc_patch(&codebuf, COND_EQ, loc_ldiv);
+  mov_imm(&codebuf, ARM_IP, (u32)Thumb2_DivZero_Handler);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_ARRAYBOUND] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_ArrayBounds_Handler);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+  handlers[H_HANDLE_EXCEPTION] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Handle_Exception);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+  handlers[H_HANDLE_EXCEPTION_NO_REGS] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Handle_Exception_NoRegs);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+  handlers[H_STACK_OVERFLOW] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Stack_Overflow);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+  handlers[H_DREM] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)fmod);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_FREM] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_R3, (u32)fmodf);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+  handlers[H_I2F] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_i2f);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_I2D] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_i2d);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_L2F] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_l2f);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_L2D] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_l2d);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_F2I] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3f2iEf);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_F2L] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3f2lEf);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_F2D] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_f2d);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_D2I] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3d2iEd);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_D2L] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3d2lEd);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+  handlers[H_D2F] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_d2f);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// NEW Stub
+//   r1 = index
+//   r3 = bci
+//   result -> R0, == 0 => exception
+  handlers[H_NEW] = out_pos(&codebuf);
+  mov_reg(&codebuf, ARM_R0, Ristate);
+  ldr_imm(&codebuf, ARM_R2, ARM_R0, ISTATE_METHOD, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)Helper_new);
+  ldr_imm(&codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_R2, ARM_R2, ARM_R3);
+sub_imm(&codebuf, ARM_R3, Rstack, 4);
+  str_imm(&codebuf, ARM_R3, ARM_R0, ISTATE_STACK, 1, 0);
+  str_imm(&codebuf, ARM_R2, ARM_R0, ISTATE_BCP, 1, 0);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// NEWARRAY Stub
+//   r1 = atype
+//   r2 = tos
+//   r3 = bci
+//   result -> thread->vm_result
+  handlers[H_NEWARRAY] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)_ZN18InterpreterRuntime8newarrayEP10JavaThread9BasicTypei);
+  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_R3, ARM_R0, ARM_R3);
+  mov_reg(&codebuf, ARM_R0, Rthread);
+  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_BCP, 1, 0);
+sub_imm(&codebuf, ARM_R3, Rstack, 4);
+  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// ANEWARRAY Stub
+//   r0 = bci
+//   r2 = index
+//   r3 = tos
+//   result -> thread->vm_result
+  handlers[H_ANEWARRAY] = out_pos(&codebuf);
+sub_imm(&codebuf, ARM_R1, Rstack, 4);
+  str_imm(&codebuf, ARM_R1, Ristate, ISTATE_STACK, 1, 0);
+  ldr_imm(&codebuf, ARM_R1, Ristate, ISTATE_METHOD, 1, 0);
+  ldr_imm(&codebuf, ARM_IP, ARM_R1, METHOD_CONSTMETHOD, 1, 0);
+  ldr_imm(&codebuf, ARM_R1, ARM_R1, METHOD_CONSTANTS, 1, 0);
+  add_reg(&codebuf, ARM_R0, ARM_IP, ARM_R0);
+  mov_imm(&codebuf, ARM_IP, (u32)_ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
+  mov_reg(&codebuf, ARM_R0, Rthread);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// MULTIANEWARRAY Stub
+//   r0 = bci
+//   r1 = dimensions (*4)
+  handlers[H_MULTIANEWARRAY] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
+  sub_imm(&codebuf, ARM_R3, Rstack, 4);
+  ldr_imm(&codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
+  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
+  add_reg(&codebuf, ARM_R0, ARM_R2, ARM_R0);
+  add_reg(&codebuf, Rstack, Rstack, ARM_R1);
+  mov_imm(&codebuf, ARM_R3, (u32)_ZN18InterpreterRuntime14multianewarrayEP10JavaThreadPi);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
+  mov_reg(&codebuf, ARM_R0, Rthread);
+  sub_imm(&codebuf, ARM_R1, Rstack, 4);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+// LDC Stub
+//   r0 = bci
+  handlers[H_LDC] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
+  sub_imm(&codebuf, ARM_R3, Rstack, 4);
+  ldr_imm(&codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
+  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
+  add_reg(&codebuf, ARM_R0, ARM_R2, ARM_R0);
+  mov_imm(&codebuf, ARM_R3, (u32)_ZN18InterpreterRuntime3ldcEP10JavaThreadb);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
+  mov_reg(&codebuf, ARM_R0, Rthread);
+//  mov_imm(&codebuf, ARM_R1, 0);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+// INSTANCEOF Stub
+//   r1 = index
+//   r3 = bci
+//   result -> R0, == -1 => exception
+  handlers[H_INSTANCEOF] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)Helper_instanceof);
+  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_R0, ARM_R0, ARM_R3);
+sub_imm(&codebuf, ARM_R3, Rstack, 4);
+  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
+  mov_reg(&codebuf, ARM_R0, Ristate);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// CHECKCAST Stub
+//   r1 = index
+//   r3 = bci
+//   result -> R0, != 0 => exception
+  handlers[H_CHECKCAST] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)Helper_checkcast);
+  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_R0, ARM_R0, ARM_R3);
+sub_imm(&codebuf, ARM_R3, Rstack, 4);
+  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
+  mov_reg(&codebuf, ARM_R0, Ristate);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// AASTORE Stub
+//   r0 = bci
+//   r1 = value
+//   r2 = index
+//   r3 = arrayref
+  handlers[H_AASTORE] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_IP, Ristate, ISTATE_METHOD, 1, 0);
+  ldr_imm(&codebuf, ARM_IP, ARM_IP, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_IP, ARM_IP, ARM_R0);
+sub_imm(&codebuf, ARM_R0, Rstack, 4);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
+  str_imm(&codebuf, ARM_IP, Ristate, ISTATE_BCP, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)Helper_aastore);
+  mov_reg(&codebuf, ARM_R0, Ristate);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+// APUTFIELD Stub
+//   r0 = obj
+  handlers[H_APUTFIELD] = out_pos(&codebuf);
+  mov_imm(&codebuf, ARM_R3, (u32)Helper_aputfield);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+// SYNCHRONIZED_ENTER Stub
+//   r0 = bci
+//   r1 = monitor
+  handlers[H_SYNCHRONIZED_ENTER] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_IP, Ristate, ISTATE_METHOD, 1, 0);
+  ldr_imm(&codebuf, ARM_IP, ARM_IP, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_IP, ARM_IP, ARM_R0);
+sub_imm(&codebuf, ARM_R0, Rstack, 4);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
+  str_imm(&codebuf, ARM_IP, Ristate, ISTATE_BCP, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)Helper_synchronized_enter);
+  mov_reg(&codebuf, ARM_R0, Rthread);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+//
+// SYNCHRONIZED_EXIT Stub
+//   r0 = bci
+//   r1 = monitor
+  handlers[H_SYNCHRONIZED_EXIT] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_IP, Ristate, ISTATE_METHOD, 1, 0);
+  ldr_imm(&codebuf, ARM_IP, ARM_IP, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, ARM_IP, ARM_IP, ARM_R0);
+sub_imm(&codebuf, ARM_R0, Rstack, 4);
+  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
+  str_imm(&codebuf, ARM_IP, Ristate, ISTATE_BCP, 1, 0);
+  mov_imm(&codebuf, ARM_IP, (u32)Helper_synchronized_exit);
+  mov_reg(&codebuf, ARM_R0, Rthread);
+  mov_reg(&codebuf, ARM_PC, ARM_IP);
+
+#define DEBUG_REGSET ((1<<ARM_R0)|(1<<ARM_R1)|(1<<ARM_R2)|(1<<ARM_R3)|(1<<ARM_IP))
+
+// DEBUG_METHODENTRY
+  handlers[H_DEBUG_METHODENTRY] = out_pos(&codebuf);
+  stm(&codebuf, DEBUG_REGSET | (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
+  mov_reg(&codebuf, ARM_R2, ARM_R0);
+  mov_reg(&codebuf, ARM_R0, ARM_R8);
+  mov_reg(&codebuf, ARM_R1, ARM_R4);
+  mov_imm(&codebuf, ARM_IP, (u32)Debug_MethodEntry);
+  blx_reg(&codebuf, ARM_IP);
+  ldm(&codebuf, DEBUG_REGSET | (1<<ARM_PC), ARM_SP, POP_FD, 1);
+
+// DEBUG_METHODEXIT
+  handlers[H_DEBUG_METHODEXIT] = out_pos(&codebuf);
+  stm(&codebuf, DEBUG_REGSET | (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
+  mov_reg(&codebuf, ARM_R0, ARM_R8);
+  mov_reg(&codebuf, ARM_R1, ARM_R4);
+  mov_imm(&codebuf, ARM_IP, (u32)Debug_MethodExit);
+  blx_reg(&codebuf, ARM_IP);
+  ldm(&codebuf, DEBUG_REGSET | (1<<ARM_PC), ARM_SP, POP_FD, 1);
+
+// DEBUG_METHODCALL
+  handlers[H_DEBUG_METHODCALL] = out_pos(&codebuf);
+  stm(&codebuf, DEBUG_REGSET | (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
+  mov_reg(&codebuf, ARM_R2, ARM_R0);
+  mov_reg(&codebuf, ARM_R0, ARM_R8);
+  mov_reg(&codebuf, ARM_R1, ARM_R4);
+  mov_imm(&codebuf, ARM_IP, (u32)Debug_MethodCall);
+  blx_reg(&codebuf, ARM_IP);
+  ldm(&codebuf, DEBUG_REGSET | (1<<ARM_PC), ARM_SP, POP_FD, 1);
+
+// EXIT_TO_INTERPRETER
+//   r0 = bci
+  handlers[H_EXIT_TO_INTERPRETER] = out_pos(&codebuf);
+  ldr_imm(&codebuf, ARM_R1, Ristate, ISTATE_METHOD, 1, 0);
+  ldr_imm(&codebuf, ARM_IP, ARM_R1, METHOD_CONSTMETHOD, 1, 0);
+  add_reg(&codebuf, Rint_jpc, ARM_IP, ARM_R0);
+  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Exit_To_Interpreter);
+  mov_reg(&codebuf, ARM_PC, ARM_R3);
+
+  Thumb2_Clear_Cache(cb->hp, cb->hp + codebuf.idx * 2);
+  cb->hp += codebuf.idx * 2;
+
+  thumb2_codebuf = cb;
+}
+
+#endif // THUMB2EE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arm_port/hotspot/tools/mkbc.c	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,607 @@
+/*
+ * Copyright 2009 Edward Nevill
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#define DEFAULT_PREFIX	"do_"
+
+static char *prefix = (char *)DEFAULT_PREFIX;
+
+#define ISALPHA(c) (isalpha(c) || (c) == '_')
+#define ISALNUM(c) (isalnum(c) || (c) == '_')
+
+FILE *source_f, *bci_f;
+
+typedef struct Bytecode {
+	char	*name;
+	int	len;
+} Bytecode;
+
+typedef struct StringList {
+	struct StringList *next;
+	char 		*line;
+} StringList;
+
+typedef struct OpcodeList {
+	struct OpcodeList *next;
+	long	 	opcode;
+} OpcodeList;
+
+typedef struct OpcodeSequence {
+	struct OpcodeSequence *next;
+	OpcodeList	*opcode_list;
+} OpcodeSequence;
+
+typedef struct BytecodeImpl {
+	struct BytecodeImpl *next;
+	OpcodeSequence	*opcode_seq;
+	StringList	*macro_impl;
+	StringList	*direct_impl;
+	int		len;
+	char		*name;
+	char		*do_name;
+} BytecodeImpl;
+
+Bytecode bytecodes[256];
+
+BytecodeImpl *the_impl = 0;
+BytecodeImpl **the_impl_ptr = &the_impl;
+
+#define BUFLEN 1024
+
+static int lineno = 1;
+
+void fatal(const char *s)
+{
+	fputs(s, stderr);
+	fputc('\n', stderr);
+	exit(1);
+}
+
+void outmem(void)
+{
+	fprintf(stderr, "Out of memory\n");
+	exit(1);
+}
+
+void synerr(void)
+{
+	fprintf(stderr, "Syntax error at line %d\n", lineno);
+	exit(1);
+}
+
+int readchar()
+{
+	int c;
+
+	c = getc(source_f);
+	if (c == '\n') lineno++;
+	return c;
+}
+
+int readwhitespace(int c, char *buf, int len)
+{
+	int i = 0;
+
+	while ((isspace)(c)) {
+		if (buf && i < len-1) buf[i++] = c;
+		c = (readchar)();
+	}
+	if (buf && i < len) buf[i] = 0;
+	return c;
+}
+
+int skipwhitespace(int c)
+{
+	while ((isspace)(c)) {
+		c = (readchar)();
+	}
+	return c;
+}
+
+int readeol(int c, char *buf, int len)
+{
+	int i = 0;
+
+	while (c != '\n' && c != EOF) {
+		if (buf && i < len-1) buf[i++] = c;
+		c = (readchar)();
+	}
+	if (buf && i < len) buf[i] = 0;
+	if (c == '\n') c = (readchar)();
+	return c;
+}
+
+int skipeol(int c)
+{
+	while (c != '\n' && c != EOF) c = (readchar)();
+	if (c == '\n') c = (readchar)();
+	return c;
+}
+
+int readsymbol(int c, char *buf, int len)
+{
+	int i = 0;
+
+	while (ISALNUM(c)) {
+		if (buf && i < len-1) buf[i++] = c;
+		c = (readchar)();
+	}
+	if (buf && i < len) buf[i] = 0;
+	return c;
+}
+
+int bcdef(int c, char *buf, int len)
+{
+	BytecodeImpl *def;
+	OpcodeSequence *seq;
+	OpcodeSequence **seqp;
+	OpcodeList *opc;
+	OpcodeList **opcp;
+	StringList *macro, **macrop;
+	StringList *direct, **directp;
+	char *name;
+	char *line;
+	int i;
+	int length, overall_len;
+
+	def = (BytecodeImpl *)malloc(sizeof(BytecodeImpl));
+	if (!def) outmem();
+	def->next = 0;
+	def->opcode_seq = 0;
+	def->macro_impl = 0;
+	def->direct_impl = 0;
+	def->len = -1;
+	*the_impl_ptr = def;
+	the_impl_ptr = &(def->next);
+	seqp = &(def->opcode_seq);
+	overall_len = 0;
+	do {
+		seq = (OpcodeSequence *)malloc(sizeof(OpcodeSequence));
+		if (!seq) outmem();
+		seq->next = 0;
+		seq->opcode_list = 0;
+		*seqp = seq;
+		seqp = &(seq->next);
+		opcp = &(seq->opcode_list);
+		length = -2;
+		do {
+			c = (readchar)();
+			c = skipwhitespace(c);
+			if (!ISALPHA(c)) synerr();
+			c = readsymbol(c, buf, len);
+			c = skipwhitespace(c);
+			opc = (OpcodeList *)malloc(sizeof(OpcodeList));
+			if (!opc) outmem();
+			opc->next = 0;
+			opc->opcode = -1;
+			*opcp = opc;
+			opcp = &(opc->next);
+			name = strdup(buf);
+			if (!name) outmem();
+			for (i = 0; i < 256; i++) {
+				if (strcmp(name, bytecodes[i].name) == 0) {
+					opc->opcode = i;
+					break;
+				}
+			}
+			if (i == 256) {
+				fprintf(stderr, "No such opcode '%s'\n", name);
+				exit(1);
+			}
+			if (length == -2) length = bytecodes[i].len;
+		} while (c == ',');
+		overall_len += length;
+		if (c != ')') synerr();
+		c = (readchar)();
+		c = skipwhitespace(c);
+	} while (c == '(');
+//	strcpy(buf, "do_");
+	*buf = 0;
+	if (ISALPHA(c)) {
+		c = readsymbol(c, buf, len);
+		c = skipwhitespace(c);
+	} else {
+		seq = def->opcode_seq;
+//		strcat(buf, "bytecode");
+		while (seq) {
+			opc = seq->opcode_list;
+			if (*buf) strcat(buf, "_");
+			strcat(buf, bytecodes[opc->opcode].name);
+//			sprintf(buf+strlen(buf), "_%ld", opc->opcode);
+			seq = seq->next;
+		}
+	}
+	name = strdup(buf);
+	if (!name) outmem();
+	def->name = name;
+	def->do_name = name;
+	def->len = overall_len;
+	if (c != '{') synerr();
+	c = (readchar)();
+	while (c != '\n' && isspace(c)) c = (readchar)();
+	if (c != '\n') synerr();
+	c = (readchar)();
+	c = readwhitespace(c, buf, len);
+	macrop = &(def->macro_impl);
+	while (c != '}' && c != EOF) {
+		c = readeol(c, buf + strlen(buf), len - strlen(buf));
+		line = strdup(buf);
+		if (!line) outmem();
+		macro = (StringList *)malloc(sizeof(StringList));
+		if (!macro) outmem();
+		*macrop = macro;
+		macrop = &(macro->next);
+		macro->next = 0;
+		macro->line = line;
+		c = readwhitespace(c, buf, len);
+	}
+	if (c != '}') synerr();
+	c = (readchar)();
+	c = skipwhitespace(c);
+	if (ISALPHA(c)) {
+		c = readsymbol(c, buf, len);
+		c = skipwhitespace(c);
+		name = strdup(buf);
+		if (!name) outmem();
+		def->do_name = name;
+	}
+	if (c == '[') {
+		c = (readchar)();
+		while (c != '\n' && isspace(c)) c = (readchar)();
+		if (c != '\n') synerr();
+		c = (readchar)();
+		c = readwhitespace(c, buf, len);
+		directp = &(def->direct_impl);
+		while (c != ']' && c != EOF) {
+			c = readeol(c, buf + strlen(buf), len - strlen(buf));
+			line = strdup(buf);
+			if (!line) outmem();
+			direct = (StringList *)malloc(sizeof(StringList));
+			if (!direct) outmem();
+			*directp = direct;
+			directp = &(direct->next);
+			direct->next = 0;
+			direct->line = line;
+			c = readwhitespace(c, buf, len);
+		}
+		if (c != ']') synerr();
+		c = (readchar)();
+	}
+	return c;
+}
+
+void mkbc(void)
+{
+	char buf[BUFLEN];
+	char *endptr;
+	int c;
+	char *name;
+	long opcode, len;
+
+	c = (readchar)();
+	c = skipwhitespace(c);
+	while (c != EOF) {
+		if (c == '@' || c == '#') {
+			c = skipeol(c);
+		} else if (ISALPHA(c)) {
+			c = readsymbol(c, buf, BUFLEN);
+			c = skipwhitespace(c);
+			if (c == '=') {
+				name = strdup(buf);
+				if (!name) outmem();
+				c = (readchar)();
+				c = skipwhitespace(c);
+				if (!(isdigit)(c)) synerr();
+				c = readsymbol(c, buf, BUFLEN);
+				opcode = strtol(buf, &endptr, 0);
+				if (*endptr != 0) synerr();
+				c = skipwhitespace(c);
+				if (c != ',') synerr();
+				c = (readchar)();
+				c = skipwhitespace(c);
+				if (!(isdigit)(c)) synerr();
+				c = readsymbol(c, buf, BUFLEN);
+				len = strtol(buf, &endptr, 0);
+				if (*endptr != 0) synerr();
+				bytecodes[opcode].name = name;
+				bytecodes[opcode].len = len;
+			}
+		} else if (c == '(') {
+			c = bcdef(c, buf, BUFLEN);
+		} else synerr();
+		c = skipwhitespace(c);
+	}
+}
+
+typedef struct TableEntry {
+	BytecodeImpl *impl;
+	char *impl_name;
+	char *def_name;
+	struct TableEntry *subtable;
+} TableEntry;
+
+TableEntry *the_table;
+
+int is_duplicate(TableEntry *a, TableEntry *b)
+{
+	int i;
+	char buf[256];
+
+	for (i = 0; i < 256; i++) {
+		if (a[i].subtable || b[i].subtable) {
+			if (!(a[i].subtable) || !(b[i].subtable)) return 0;
+			if (!is_duplicate(a[i].subtable, b[i].subtable)) return 0;
+		} else if (a[i].impl_name && b[i].impl_name) {
+			if (strcmp(a[i].impl_name, b[i].impl_name) != 0)
+				return 0;
+		} else if (a[i].def_name && b[i].def_name) {
+			if (strcmp(a[i].def_name, b[i].def_name) != 0)
+				return 0;
+		} else return 0;
+	}
+	return 1;
+}
+
+void remove_duplicates(TableEntry *table, int start, int *table_indices, int depth)
+{
+	TableEntry *start_entry = table[start].subtable;
+	int i, j;
+
+	if (!start_entry) fatal("Subtable is NULL in remove_duplicates!!!");
+	for (i = start+1; i < 256; i++) {
+		if (table[i].subtable) {
+			if (is_duplicate(start_entry, table[i].subtable)) {
+				fputs("dispatch", bci_f);
+				for (j = 0; j < depth; j++) {
+					fputc('_', bci_f);
+					fputs(bytecodes[table_indices[j]].name, bci_f);
+				}
+				fputc('_', bci_f);
+				fputs(bytecodes[i].name, bci_f);
+				fputs(":\n", bci_f);
+				free(table[i].subtable);
+				table[i].subtable = 0;
+			}
+		}
+	}
+}
+
+void writeouttable(TableEntry *table, int *table_indices, int depth)
+{
+	int i, j;
+	int len;
+
+	for (i = 0; i < 256; i++) {
+		if (table[i].subtable) {
+			len = 0;
+			fputs("\t.word\tdispatch", bci_f);
+			table_indices[depth] = i;
+			for (j = 0; j <= depth; j++) {
+				fputc('_', bci_f);
+				fputs(bytecodes[table_indices[j]].name, bci_f);
+				len += bytecodes[table_indices[j]].len;
+			}
+			fprintf(bci_f, "+%d\n", len);
+		} else {
+			if (table[i].impl_name)
+				fprintf(bci_f, "\t.word\t%s%s\n", prefix, table[i].impl_name);
+			else
+				fprintf(bci_f, "\t.word\t%s%s\n", prefix, table[i].def_name);
+		}
+	}
+	if (depth == 0) {
+		fputs("\t.endm\n", bci_f);
+		fputs("\t.macro\tSUB_DISPATCH_TABLES\n", bci_f);
+	}
+	for (i = 0; i < 256; i++) {
+		if (table[i].subtable) {
+			fputs("dispatch", bci_f);
+			table_indices[depth] = i;
+			for (j = 0; j <= depth; j++) {
+				fputc('_', bci_f);
+				fputs(bytecodes[table_indices[j]].name, bci_f);
+			}
+			fputs(":\n", bci_f);
+			remove_duplicates(table, i, table_indices, depth);
+			writeouttable(table[i].subtable, table_indices, depth+1);
+		}
+	}
+}
+
+void do_tableentry(BytecodeImpl *impl, TableEntry **tablep, int *table_indices, int depth)
+{
+	TableEntry *table;
+	char *def = (char *)"undefined";
+	int i,j;
+
+	if (depth == 0) fatal("Depth = 0 for tableentry\n");
+	for (i = 0; i < depth; i++) {
+		table = *tablep;
+		if (!table) {
+			table = (TableEntry *)malloc(sizeof(TableEntry) * 256);
+			if (!table) outmem();
+			*tablep = table;
+			def = strdup(def);
+			if (!def) outmem();
+			for (j = 0; j < 256; j++) {
+				table[j].impl_name = 0;
+				table[j].def_name = def;
+				table[j].subtable = 0;
+			}
+		}
+		table = &table[table_indices[i]];
+		tablep = &(table->subtable);
+		if (table->impl_name) def = table->def_name;
+	}
+	if (!table->impl_name)
+		table->impl_name = impl->do_name;
+	table->def_name = impl->do_name;
+}
+
+void dumpseq(BytecodeImpl *impl, OpcodeSequence *seq, int *table_indices, int depth)
+{
+	OpcodeList *opc;
+
+	opc = seq->opcode_list;
+	while (opc) {
+		table_indices[depth++] = opc->opcode;
+		if (seq->next != NULL) {
+			dumpseq(impl, seq->next, table_indices, depth);
+		} else {
+			do_tableentry(impl, &the_table, table_indices, depth);
+		}
+		depth--;
+		opc = opc->next;
+	}
+}
+
+void dumptable(void)
+{
+	BytecodeImpl *impl = the_impl;
+	int table_indices[256];
+	int j;
+	char	buf[256];
+	char *def;
+
+	the_table = (TableEntry *)malloc(sizeof(TableEntry) * 256);
+	if (!the_table) outmem();
+	for (j = 0; j < 256; j++) {
+		sprintf(buf, "%s", bytecodes[j].name);
+		def = strdup(buf);
+		if (!def) outmem();
+		the_table[j].impl_name = 0;
+		the_table[j].def_name = def;
+		the_table[j].subtable = 0;
+	}
+	while (impl) {
+		dumpseq(impl, impl->opcode_seq, table_indices, 0);
+		impl = impl->next;
+	}
+	fputs("\t.macro\tMAIN_DISPATCH_TABLE\n", bci_f);
+	writeouttable(the_table, table_indices, 0);
+	fputs("\t.endm\n", bci_f);
+}
+
+void dumpimpl(void)
+{
+	BytecodeImpl *impl = the_impl;
+	OpcodeList *opc;
+	StringList *code;
+	StringList *sl;
+	char buf[BUFLEN];
+	char macro[BUFLEN];
+
+	while (impl) {
+		buf[0] = 0;
+		fprintf(bci_f, "@-----------------------------------------------------------------------------\n");
+		fprintf(bci_f, "\t.macro\t%s\tjpc_off=0, seq_len=%d\n", impl->name, impl->len);
+		sl = impl->macro_impl;
+		while (sl) {
+			fputs(sl->line, bci_f);
+			fputc('\n', bci_f);
+			sl = sl->next;
+		}
+		fprintf(bci_f, "\t.endm\n\n");
+		sl = impl->direct_impl;
+		if (sl) {
+			do {
+				fputs(sl->line, bci_f);
+				fputc('\n', bci_f);
+				sl = sl->next;
+			} while (sl);
+		} else {
+			fprintf(bci_f, "\tOpcode\t%s\n", impl->do_name);
+//			fprintf(bci_f, "%s:\n", impl->do_name);
+			fprintf(bci_f, "\t%s\n", impl->name);
+//			fprintf(bci_f, "\tDISPATCH\t%d\n", impl->len);
+		}
+		impl = impl->next;
+	}
+}
+
+void dumpbc()
+{
+	int i;
+
+	for (i = 0; i < 256; i++) {
+		if (strcmp(bytecodes[i].name, "undefined") != 0)
+			fprintf(bci_f, "#define opc_%s\t\t0x%02x\n", bytecodes[i].name, i);
+	}
+	fputc('\n', bci_f);
+	dumpimpl();
+	dumptable();
+}
+
+void usage(void)
+{
+	fatal("Usage: mkbc <bytecode definition file> <asm output file>");
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+	char *source, *bci;
+	char *s;
+
+	source = bci = 0;
+	while (s = *++argv) {
+		if (s[0] == '-' && s[1] != 0) {
+			if (s[1] == 'P') {
+				prefix = s+2;
+			} else {
+				fprintf(stderr, "Unrecognized option %s\n", s);
+				usage();
+			}
+		} else {
+			if (!source) source = s;
+			else if (!bci) bci = s;
+			else {
+				fprintf(stderr, "Too many arguments\n");
+				usage();
+			}
+		}
+	}
+	if (!bci) {
+		fprintf(stderr, "Too few arguments\n");
+		usage();
+	}
+	if (strcmp(source, "-") == 0) {
+		source_f = stdin;
+	} else {
+		source_f = fopen(source, "r");
+		if (!source_f) fatal("Error opening source file");
+	}
+	if (strcmp(bci, "-") == 0) {
+		bci_f = stdout;
+	} else {
+		bci_f = fopen(bci, "w");
+		if (!bci_f) fatal("Error opening bci file for write");
+	}
+	for (i = 0; i < 256; i++) {
+		bytecodes[i].name = (char *)"undefined";
+		bytecodes[i].len = -1;
+	}
+	mkbc();
+	dumpbc();
+	if (ferror(source_f)) fatal("Error reading source");
+	if (ferror(bci_f)) fatal("Error writing bci");
+	if (source_f != stdin) fclose(source_f);
+	if (bci_f != stdout) fclose(bci_f);
+
+	return 0;
+}
--- a/ports/hotspot/make/linux/makefiles/shark.make	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#
-# Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
-# Copyright 2008, 2010 Red Hat, Inc.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code 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
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
-#
-#
-
-# Sets make macros for making Shark version of VM
-
-TYPE = SHARK
-
-VM_SUBDIR = server
-
-CFLAGS += -DSHARK
--- a/ports/hotspot/src/cpu/zero/vm/asm_helper.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,583 +0,0 @@
-/*
- * Copyright 2009, 2010 Edward Nevill
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define	ARCH_THUMBEE	(1<<16)
-#define ARCH_VFP	(1<<17)
-#define ARCH_CLZ	(1<<18)
-
-#ifndef STATIC_OFFSETS
-
-#include "incls/_bytecodeInterpreter.cpp.incl"
-
-#include <linux/auxvec.h>
-#include <asm/hwcap.h>
-
-#define VECBUFF_SIZE 64
-
-extern "C" unsigned hwcap(void)
-{
-  int fd;
-  unsigned vecs[VECBUFF_SIZE];
-  unsigned *p;
-  int i, n;
-  unsigned rc = 0;
-  unsigned arch = 4;
- 
-  fd = open("/proc/self/auxv", O_RDONLY);
-  if (fd < 0) return 0;
-  do {
-    n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned));
-    p = vecs;
-    i = n/8;
-    while (--i >= 0) {
-      unsigned tag = *p++;
-      unsigned value = *p++;
-      if (tag == 0) goto fini;
-      if (tag == AT_HWCAP) {
-	if (value & HWCAP_THUMBEE) rc |= ARCH_THUMBEE;
-	if (value & HWCAP_VFP) rc |= ARCH_VFP;
-      } else if (tag == AT_PLATFORM) {
-	const char *s = (const char *)value;
-	int c;
-
-	if (*s++ == 'v') {
-	  arch = 0;
-	  while ((isdigit)(c = *s++)) arch = arch * 10 + c - '0';
-	}
-      }
-    }
-  } while (n == VECBUFF_SIZE * sizeof(unsigned));
-fini:
-  close(fd);
-//  printf("arch = %d, rc = 0x%08x\n", arch, rc);
-  if (arch >= 5) rc |= ARCH_CLZ;
-  if (arch >= 7) rc |= ARCH_THUMBEE;
-  return rc | (1<<arch);
-}
-
-/* Thease functions allow the ASM interpreter to call CPP virtual functions.
- * Otherwise the ASM interpreter has to grup around in the VTABLE which is
- * not very portable.
- */
-extern "C" bool JavaThread_is_lock_owned(JavaThread *r0, address r1)
-{
-	return r0->is_lock_owned(r1);
-}
-
-extern "C" HeapWord **CollectedHeap_top_addr(CollectedHeap *r0)
-{
-	return r0->top_addr();
-}
-
-extern "C" HeapWord **CollectedHeap_end_addr(CollectedHeap *r0)
-{
-	return r0->end_addr();
-}
-
-extern "C" char *SharedRuntime_generate_class_cast_message(const char *name, const char *klass)
-{
-	return SharedRuntime::generate_class_cast_message(name, klass);
-}
-
-#define HELPER_THROW(thread, name, msg) Exceptions::_throw_msg(thread, __FILE__, __LINE__, name, msg)
-
-class VMStructs {
-public:
-	static inline klassOop klass_at_addr(constantPoolOop constants, u2 index) {
-	  return (klassOop) *constants->obj_at_addr(index);
-	}
-};
-
-extern "C" oop Helper_new(interpreterState istate, unsigned index)
-{
-    JavaThread *thread = istate->thread();
-
-    constantPoolOop constants = istate->method()->constants();
-    oop result = NULL;
-    if (!constants->tag_at(index).is_unresolved_klass()) {
-      // Make sure klass is initialized and doesn't have a finalizer
-      oop entry = VMStructs::klass_at_addr(constants, index);
-      klassOop k_entry = (klassOop) entry;
-      instanceKlass* ik = (instanceKlass*) k_entry->klass_part();
-      if ( ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
-	size_t obj_size = ik->size_helper();
-	// If the TLAB isn't pre-zeroed then we'll have to do it
-	bool need_zero = !ZeroTLAB;
-	if (UseTLAB) {
-	  result = (oop) thread->tlab().allocate(obj_size);
-	}
-	if (result == NULL) {
-	  need_zero = true;
-	  // Try allocate in shared eden
-    retry:
-	  HeapWord* compare_to = *Universe::heap()->top_addr();
-	  HeapWord* new_top = compare_to + obj_size;
-	  if (new_top <= *Universe::heap()->end_addr()) {
-	    if (Atomic::cmpxchg_ptr(new_top, Universe::heap()->top_addr(), compare_to) != compare_to) {
-	      goto retry;
-	    }
-	    result = (oop) compare_to;
-	  }
-	}
-	if (result != NULL) {
-	  // Initialize object (if nonzero size and need) and then the header
-	  if (need_zero ) {
-	    HeapWord* to_zero = (HeapWord*) result + sizeof(oopDesc) / oopSize;
-	    obj_size -= sizeof(oopDesc) / oopSize;
-	    if (obj_size > 0 ) {
-	      memset(to_zero, 0, obj_size * HeapWordSize);
-	    }
-	  }
-	  if (UseBiasedLocking) {
-	    result->set_mark(ik->prototype_header());
-	  } else {
-	    result->set_mark(markOopDesc::prototype());
-	  }
-	  result->set_klass_gap(0);
-	  result->set_klass(k_entry);
-	  return result;
-	}
-      }
-    }
-    // Slow case allocation
-    InterpreterRuntime::_new(thread, istate->method()->constants(), index);
-    result = thread->vm_result();
-    thread->set_vm_result(NULL);
-    return result;
-}
-
-extern "C" int Helper_instanceof(interpreterState istate, unsigned index, oop tos)
-{
-    if (tos == NULL) return 0;
-
-    // Constant pool may have actual klass or unresolved klass. If it is
-    // unresolved we must resolve it
-    if (istate->method()->constants()->tag_at(index).is_unresolved_klass()) {
-      InterpreterRuntime::quicken_io_cc(istate->thread());
-      if (istate->thread()->has_pending_exception()) return 0;
-    }
-    klassOop klassOf = VMStructs::klass_at_addr(istate->method()->constants(), index);
-    klassOop objKlassOop = tos->klass();
-    //
-    // Check for compatibilty. This check must not GC!!
-    // Seems way more expensive now that we must dispatch
-    //
-    return objKlassOop == klassOf || objKlassOop->klass_part()->is_subtype_of(klassOf);
-}
-
-extern "C" oop Helper_checkcast(interpreterState istate, unsigned index, oop tos)
-{
-    if (tos == NULL) return NULL;
-
-    // Constant pool may have actual klass or unresolved klass. If it is
-    // unresolved we must resolve it
-    if (istate->method()->constants()->tag_at(index).is_unresolved_klass()) {
-      oop except_oop;
-      InterpreterRuntime::quicken_io_cc(istate->thread());
-      if (except_oop = istate->thread()->pending_exception()) return except_oop;
-    }
-    klassOop klassOf = VMStructs::klass_at_addr(istate->method()->constants(), index);
-    klassOop objKlassOop = tos->klass(); //ebx
-    //
-    // Check for compatibilty. This check must not GC!!
-    // Seems way more expensive now that we must dispatch
-    //
-    if (objKlassOop != klassOf && !objKlassOop->klass_part()->is_subtype_of(klassOf)) {
-      ResourceMark rm(istate->thread());
-      const char* objName = Klass::cast(objKlassOop)->external_name();
-      const char* klassName = Klass::cast(klassOf)->external_name();
-      char* message = SharedRuntime::generate_class_cast_message(objName, klassName);
-      ThreadInVMfromJava trans(istate->thread());
-      HELPER_THROW(istate->thread(), vmSymbols::java_lang_ClassCastException(), message);
-    }
-    return istate->thread()->pending_exception();
-}
-
-extern "C" oop Helper_aastore(interpreterState istate, oop value, int index, arrayOop arrayref)
-{
-    if (arrayref == NULL) {
-      ThreadInVMfromJava trans(istate->thread());
-      HELPER_THROW(istate->thread(), vmSymbols::java_lang_NullPointerException(), "");
-    } else if ((uint32_t)index >= (uint32_t)arrayref->length()) {
-      char message[jintAsStringSize];
-      sprintf(message, "%d", index);
-      HELPER_THROW(istate->thread(), vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
-    } else {
-      if (value != NULL) {
-	/* Check assignability of value into arrayref */
-	klassOop rhsKlassOop = value->klass(); // EBX (subclass)
-	klassOop elemKlassOop = ((objArrayKlass*) arrayref->klass()->klass_part())->element_klass();
-	//
-	// Check for compatibilty. This check must not GC!!
-	// Seems way more expensive now that we must dispatch
-	//
-	if (rhsKlassOop != elemKlassOop && !rhsKlassOop->klass_part()->is_subtype_of(elemKlassOop)) {
-	  HELPER_THROW(istate->thread(), vmSymbols::java_lang_ArrayStoreException(), "");
-	  goto handle_exception;
-	}
-      }
-      oop* elem_loc = (oop*)(((address) arrayref->base(T_OBJECT)) + index * sizeof(oop));
-      // *(oop*)(((address) arrayref->base(T_OBJECT)) + index * sizeof(oop)) = value;
-      *elem_loc = value;
-      // Mark the card
-      BarrierSet* bs = Universe::heap()->barrier_set();
-      static volatile jbyte* _byte_map_base = (volatile jbyte*)(((CardTableModRefBS*)bs)->byte_map_base);
-      OrderAccess::release_store(&_byte_map_base[(uintptr_t)elem_loc >> CardTableModRefBS::card_shift], 0);
-    }
-handle_exception:
-    return istate->thread()->pending_exception();
-}
-
-extern "C" void Helper_aputfield(oop obj)
-{
-      BarrierSet* bs = Universe::heap()->barrier_set();
-      static volatile jbyte* _byte_map_base = (volatile jbyte*)(((CardTableModRefBS*)bs)->byte_map_base);
-      OrderAccess::release_store(&_byte_map_base[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
-}
-
-extern "C" oop Helper_synchronized_enter(JavaThread *thread, BasicObjectLock *mon)
-{
-    BasicLock *lock = mon->lock();
-    markOop displaced = lock->displaced_header();
-
-    if (thread->is_lock_owned((address)displaced->clear_lock_bits()))
-      lock->set_displaced_header(NULL);
-    else
-      InterpreterRuntime::monitorenter(thread, mon);
-    return thread->pending_exception();
-}
-
-extern "C" oop Helper_synchronized_exit(JavaThread *thread, BasicObjectLock *mon)
-{
-    {
-      HandleMark __hm(thread);
-      if (mon->obj() == NULL)
-	InterpreterRuntime::throw_illegal_monitor_state_exception(thread);
-      else
-        InterpreterRuntime::monitorexit(thread, mon);
-    }
-    return thread->pending_exception();
-}
-
-extern "C" oop Helper_SafePoint(JavaThread *thread)
-{
-    {
-      HandleMarkCleaner __hmc(thread);
-    }
-    SafepointSynchronize::block(thread);
-    return thread->pending_exception();
-}
-
-extern "C" void Helper_RaiseArrayBoundException(JavaThread *thread, int index)
-{
-  char message[jintAsStringSize];
-  sprintf(message, "%d", index);
-  {
-       ThreadInVMfromJava trans(thread);
-       Exceptions::_throw_msg(thread, "[Bytecoce Interpreter]", 99,
-			vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
-  }
-}
-
-extern "C" void Helper_Raise(JavaThread *thread, symbolOopDesc *name, char const *msg)
-{
-   ThreadInVMfromJava trans(thread);
-   Exceptions::_throw_msg(thread, "[Bytecoce Interpreter]", 99, name, msg);
-}
-
-extern "C" void Helper_RaiseIllegalMonitorException(JavaThread *thread)
-{
-    HandleMark __hm(thread);
-    thread->clear_pending_exception();
-    InterpreterRuntime::throw_illegal_monitor_state_exception(thread);
-}
-
-extern "C" address Helper_HandleException(interpreterState istate, JavaThread *thread)
-{
-    HandleMarkCleaner __hmc(thread);
-    Handle except_oop(thread, thread->pending_exception());
-    HandleMark __hm(thread);
-    intptr_t continuation_bci;
-    intptr_t *topOfStack;
-    address pc;
-
-    thread->clear_pending_exception();
-    continuation_bci = (intptr_t)InterpreterRuntime::exception_handler_for_exception(thread, except_oop());
-    except_oop = (oop) thread->vm_result();
-    thread->set_vm_result(NULL);
-    if (continuation_bci >= 0) {
-      topOfStack = (intptr_t *)istate->stack();
-      *topOfStack-- = (intptr_t)except_oop();
-      istate->set_stack(topOfStack);
-      pc = istate->method()->code_base() + continuation_bci;
-#if 0
-        tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", Klass::cast(except_oop->klass())->external_name(), except_oop());
-        tty->print_cr(" thrown in interpreter method <%s>", istate->method()->name_and_sig_as_C_string());
-        tty->print_cr(" at bci %d, continuing at %d for thread " INTPTR_FORMAT,
-                      pc - (intptr_t)istate->method()->code_base(),
-                      continuation_bci, thread);
-#endif
-      return pc;
-    }
-#if 0
-      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", Klass::cast(except_oop->klass())->external_name(), except_oop());
-      tty->print_cr(" thrown in interpreter method <%s>", istate->method()->name_and_sig_as_C_string());
-      tty->print_cr(" at bci %d, unwinding for thread " INTPTR_FORMAT,
-                    pc  - (intptr_t) istate->method()->code_base(),
-                    thread);
-#endif
-    thread->set_pending_exception(except_oop(), NULL, 0);
-    return 0;
-}
-
-#endif // STATIC_OFFSETS
-
-#ifdef STATIC_OFFSETS
-
-#include "incls/_precompiled.incl"
-
-class VMStructs {
-public:
-	static void print_vm_offsets(void);
-};
-
-#define outfile	stdout
-
-void print_def(const char *s, int v)
-{
-	fprintf(outfile, "#undef %-40s\n", s);
-	fprintf(outfile, "#define %-40s 0x%02x\n", s, v);
-}
-
-void nl(void)
-{
-	fputc('\n', outfile);
-}
-
-// ZeroFrame is not friends with VMStructs, but it is with ZeroStackPrinter
-class ZeroStackPrinter {
-public:
-  static void print_vm_offsets(void);
-};
-
-void ZeroStackPrinter::print_vm_offsets(void)
-{
-    print_def("INTERPRETER_FRAME", ZeroFrame::INTERPRETER_FRAME);
-}
-
-void VMStructs::print_vm_offsets(void)
-{
-  print_def("ISTATE_THREAD",    offset_of(BytecodeInterpreter, _thread));
-  print_def("ISTATE_BCP",       offset_of(BytecodeInterpreter, _bcp));
-  print_def("ISTATE_LOCALS",    offset_of(BytecodeInterpreter, _locals));
-  print_def("ISTATE_CONSTANTS", offset_of(BytecodeInterpreter, _constants));
-  print_def("ISTATE_METHOD",    offset_of(BytecodeInterpreter, _method));
-  print_def("ISTATE_STACK",     offset_of(BytecodeInterpreter, _stack));
-  print_def("ISTATE_MSG",       offset_of(BytecodeInterpreter, _msg));
-  print_def("ISTATE_OOP_TEMP",	offset_of(BytecodeInterpreter, _oop_temp));
-  print_def("ISTATE_STACK_BASE",offset_of(BytecodeInterpreter, _stack_base));
-  print_def("ISTATE_STACK_LIMIT",offset_of(BytecodeInterpreter, _stack_limit));
-  print_def("ISTATE_MONITOR_BASE",offset_of(BytecodeInterpreter, _monitor_base));
-  print_def("ISTATE_SELF_LINK",	offset_of(BytecodeInterpreter, _self_link));
-  print_def("ISTATE_FRAME_TYPE", sizeof(BytecodeInterpreter) + 0);
-  print_def("ISTATE_NEXT_FRAME", sizeof(BytecodeInterpreter) + 4);
-  print_def("FRAME_SIZE", sizeof(BytecodeInterpreter) + 8);
-  nl();
-  ZeroStackPrinter::print_vm_offsets();
-  nl();
-  print_def("THREAD_PENDING_EXC", offset_of(JavaThread, _pending_exception));
-  print_def("THREAD_SUSPEND_FLAGS", offset_of(JavaThread, _suspend_flags));
-  print_def("THREAD_ACTIVE_HANDLES", offset_of(JavaThread, _active_handles));
-  print_def("THREAD_LAST_HANDLE_MARK", offset_of(JavaThread, _last_handle_mark));
-  print_def("THREAD_TLAB_TOP", offset_of(JavaThread, _tlab) + offset_of(ThreadLocalAllocBuffer, _top));
-  print_def("THREAD_TLAB_END", offset_of(JavaThread, _tlab) + offset_of(ThreadLocalAllocBuffer, _end));
-  print_def("THREAD_RESOURCEAREA", offset_of(JavaThread, _resource_area));
-  print_def("THREAD_HANDLE_AREA", offset_of(JavaThread, _handle_area));
-  print_def("THREAD_STACK_BASE", offset_of(JavaThread, _stack_base));
-  print_def("THREAD_STACK_SIZE", offset_of(JavaThread, _stack_size));
-  print_def("THREAD_LAST_JAVA_SP", offset_of(JavaThread, _anchor) + offset_of(JavaFrameAnchor, _last_Java_sp));
-  print_def("THREAD_JNI_ENVIRONMENT", offset_of(JavaThread, _jni_environment));
-  print_def("THREAD_VM_RESULT", offset_of(JavaThread, _vm_result));
-  print_def("THREAD_STATE", offset_of(JavaThread, _thread_state));
-  print_def("THREAD_DO_NOT_UNLOCK", offset_of(JavaThread, _do_not_unlock_if_synchronized));
-
-  print_def("THREAD_JAVA_STACK_BASE", offset_of(JavaThread, _zero_stack) + in_bytes(ZeroStack::base_offset()));
-  print_def("THREAD_JAVA_SP", offset_of(JavaThread, _zero_stack) + in_bytes(ZeroStack::sp_offset()));
-  print_def("THREAD_TOP_ZERO_FRAME", offset_of(JavaThread, _top_zero_frame));
-  print_def("THREAD_SPECIALRUNTIMEEXITCONDITION", offset_of(JavaThread, _special_runtime_exit_condition));
-  nl();
-  print_def("_thread_external_suspend",	Thread::_external_suspend);
-  print_def("_thread_ext_suspended",	Thread::_ext_suspended);
-  print_def("_thread_deopt_suspend",	Thread::_deopt_suspend);
-  nl();
-  print_def("METHOD_CONSTMETHOD", offset_of(methodOopDesc, _constMethod));
-  print_def("METHOD_CONSTANTS", offset_of(methodOopDesc, _constants));
-  print_def("METHOD_METHODDATA", offset_of(methodOopDesc, _method_data));
-  print_def("METHOD_INVOKECOUNT", offset_of(methodOopDesc, _interpreter_invocation_count));
-  print_def("METHOD_ACCESSFLAGS", offset_of(methodOopDesc, _access_flags));
-  print_def("METHOD_VTABLEINDEX", offset_of(methodOopDesc, _vtable_index));
-  print_def("METHOD_RESULTINDEX", offset_of(methodOopDesc, _result_index));
-  print_def("METHOD_METHODSIZE", offset_of(methodOopDesc, _method_size));
-  print_def("METHOD_MAXSTACK", offset_of(methodOopDesc, _max_stack));
-  print_def("METHOD_MAXLOCALS", offset_of(methodOopDesc, _max_locals));
-  print_def("METHOD_SIZEOFPARAMETERS", offset_of(methodOopDesc, _size_of_parameters));
-  print_def("METHOD_INVOCATIONCOUNTER", offset_of(methodOopDesc, _invocation_counter));
-  print_def("METHOD_BACKEDGECOUNTER", offset_of(methodOopDesc, _backedge_counter));
-  print_def("METHOD_FROM_INTERPRETED", offset_of(methodOopDesc, _from_interpreted_entry));
-  // ECN: These two appear to be just tagged onto the end of the class
-  print_def("METHOD_NATIVEHANDLER", sizeof(methodOopDesc));
-  print_def("METHOD_SIGNATUREHANDLER", sizeof(methodOopDesc)+4);
-  nl();
-  print_def("CONSTMETHOD_CODESIZE", offset_of(constMethodOopDesc, _code_size));
-  print_def("CONSTMETHOD_CODEOFFSET", sizeof(constMethodOopDesc));
-  nl();
-  print_def("JNIHANDLEBLOCK_TOP", offset_of(JNIHandleBlock, _top));
-  nl();
-  print_def("KLASS_PART", klassOopDesc::klass_part_offset_in_bytes());
-  print_def("KLASS_ACCESSFLAGS", offset_of(Klass, _access_flags));
-  print_def("KLASS_JAVA_MIRROR", offset_of(Klass, _java_mirror));
-  print_def("INSTANCEKLASS_INITSTATE", offset_of(instanceKlass, _init_state));
-  print_def("INSTANCEKLASS_VTABLE_LEN", offset_of(instanceKlass, _vtable_len));
-  print_def("INSTANCEKLASS_ITABLE_LEN", offset_of(instanceKlass, _itable_len));
-  print_def("INSTANCEKLASS_VTABLE_OFFSET", instanceKlass::vtable_start_offset() * sizeof(int *));
-  print_def("OBJARRAYKLASS_ELEMENTKLASS", offset_of(objArrayKlass, _element_klass));
-  nl();
-  print_def("CONSTANTPOOL_TAGS", offset_of(constantPoolOopDesc, _tags));
-  print_def("CONSTANTPOOL_CACHE", offset_of(constantPoolOopDesc, _cache));
-  print_def("CONSTANTPOOL_POOL_HOLDER", offset_of(constantPoolOopDesc, _pool_holder));
-  print_def("CONSTANTPOOL_BASE", sizeof(constantPoolOopDesc));
-  nl();
-  print_def("CP_OFFSET", in_bytes(constantPoolCacheOopDesc::base_offset()));
-  nl();
-  print_def("BASE_OFFSET_BYTE", arrayOopDesc::base_offset_in_bytes(T_BYTE));
-  print_def("BASE_OFFSET_SHORT", arrayOopDesc::base_offset_in_bytes(T_SHORT));
-  print_def("BASE_OFFSET_WORD", arrayOopDesc::base_offset_in_bytes(T_INT));
-  print_def("BASE_OFFSET_LONG", arrayOopDesc::base_offset_in_bytes(T_LONG));
-  nl();
-  print_def("SIZEOF_HANDLEMARK", sizeof(HandleMark));
-}
-
-int main(void)
-{
-	print_def("ARCH_VFP",			ARCH_VFP);
-	print_def("ARCH_THUMBEE",		ARCH_THUMBEE);
-	print_def("ARCH_CLZ",			ARCH_CLZ);
-	nl();
-	print_def("JVM_CONSTANT_Utf8",		JVM_CONSTANT_Utf8);
-	print_def("JVM_CONSTANT_Unicode",	JVM_CONSTANT_Unicode);
-	print_def("JVM_CONSTANT_Integer",	JVM_CONSTANT_Integer);
-	print_def("JVM_CONSTANT_Float",		JVM_CONSTANT_Float);
-	print_def("JVM_CONSTANT_Long",		JVM_CONSTANT_Long);
-	print_def("JVM_CONSTANT_Double",	JVM_CONSTANT_Double);
-	print_def("JVM_CONSTANT_Class",		JVM_CONSTANT_Class);
-	print_def("JVM_CONSTANT_String",	JVM_CONSTANT_String);
-	print_def("JVM_CONSTANT_Fieldref",	JVM_CONSTANT_Fieldref);
-	print_def("JVM_CONSTANT_Methodref",	JVM_CONSTANT_Methodref);
-	print_def("JVM_CONSTANT_InterfaceMethodref", JVM_CONSTANT_InterfaceMethodref);
-	print_def("JVM_CONSTANT_NameAndType",	JVM_CONSTANT_NameAndType);
-	nl();
-	print_def("JVM_CONSTANT_UnresolvedClass",	JVM_CONSTANT_UnresolvedClass);
-	print_def("JVM_CONSTANT_ClassIndex",		JVM_CONSTANT_ClassIndex);
-	print_def("JVM_CONSTANT_UnresolvedString",	JVM_CONSTANT_UnresolvedString);
-	print_def("JVM_CONSTANT_StringIndex",		JVM_CONSTANT_StringIndex);
-	print_def("JVM_CONSTANT_UnresolvedClassInError",JVM_CONSTANT_UnresolvedClassInError);
-	nl();
-	print_def("JVM_ACC_PUBLIC",	JVM_ACC_PUBLIC);
-	print_def("JVM_ACC_PRIVATE",	JVM_ACC_PRIVATE);
-	print_def("JVM_ACC_PROTECTED",	JVM_ACC_PROTECTED);
-	print_def("JVM_ACC_STATIC",	JVM_ACC_STATIC);
-	print_def("JVM_ACC_FINAL",	JVM_ACC_FINAL);
-	print_def("JVM_ACC_SYNCHRONIZED",	JVM_ACC_SYNCHRONIZED);
-	print_def("JVM_ACC_SUPER",	JVM_ACC_SUPER);
-	print_def("JVM_ACC_VOLATILE",	JVM_ACC_VOLATILE);
-	print_def("JVM_ACC_BRIDGE",	JVM_ACC_BRIDGE);
-	print_def("JVM_ACC_TRANSIENT",	JVM_ACC_TRANSIENT);
-	print_def("JVM_ACC_VARARGS",	JVM_ACC_VARARGS);
-	print_def("JVM_ACC_NATIVE",	JVM_ACC_NATIVE);
-	print_def("JVM_ACC_INTERFACE",	JVM_ACC_INTERFACE);
-	print_def("JVM_ACC_ABSTRACT",	JVM_ACC_ABSTRACT);
-	print_def("JVM_ACC_STRICT",	JVM_ACC_STRICT);
-	print_def("JVM_ACC_SYNTHETIC",	JVM_ACC_SYNTHETIC);
-	print_def("JVM_ACC_ANNOTATION",	JVM_ACC_ANNOTATION);
-	print_def("JVM_ACC_ENUM",	JVM_ACC_ENUM);
-	print_def("JVM_ACC_HAS_FINALIZER", JVM_ACC_HAS_FINALIZER);
-	nl();
-	print_def("T_BOOLEAN",	T_BOOLEAN);
-	print_def("T_CHAR",	T_CHAR);
-	print_def("T_FLOAT",	T_FLOAT);
-	print_def("T_DOUBLE",	T_DOUBLE);
-	print_def("T_BYTE",	T_BYTE);
-	print_def("T_SHORT",	T_SHORT);
-	print_def("T_INT",	T_INT);
-	print_def("T_LONG",	T_LONG);
-	print_def("T_OBJECT",	T_OBJECT);
-	print_def("T_ARRAY",	T_ARRAY);
-	print_def("T_VOID",	T_VOID);
-	nl();
-	print_def("tos_btos",	btos);
-	print_def("tos_ctos",	ctos);
-	print_def("tos_stos",	stos);
-	print_def("tos_itos",	itos);
-	print_def("tos_ltos",	ltos);
-	print_def("tos_ftos",	ftos);
-	print_def("tos_dtos",	dtos);
-	print_def("tos_atos",	atos);
-	nl();
-	print_def("_thread_uninitialized",	_thread_uninitialized);
-	print_def("_thread_new",		_thread_new);
-	print_def("_thread_new_trans",		_thread_new_trans);
-	print_def("_thread_in_native",		_thread_in_native);
-	print_def("_thread_in_native_trans",	_thread_in_native_trans);
-	print_def("_thread_in_vm",		_thread_in_vm);
-	print_def("_thread_in_vm_trans",	_thread_in_vm_trans);
-	print_def("_thread_in_Java",		_thread_in_Java);
-	print_def("_thread_in_Java_trans",	_thread_in_Java_trans);
-	print_def("_thread_blocked",		_thread_blocked);
-	print_def("_thread_blocked_trans",	_thread_blocked_trans);
-	print_def("_thread_max_state",		_thread_max_state);
-	nl();
-	print_def("class_unparsable_by_gc",	instanceKlass::unparsable_by_gc);
-	print_def("class_allocated",		instanceKlass::allocated);
-	print_def("class_loaded",		instanceKlass::loaded);
-	print_def("class_linked",		instanceKlass::linked);
-	print_def("class_being_initialized",	instanceKlass::being_initialized);
-	print_def("class_fully_initialized",	instanceKlass::fully_initialized);
-	print_def("class_init_error",		instanceKlass::initialization_error);
-	nl();
-	print_def("flag_methodInterface",	1 << ConstantPoolCacheEntry::methodInterface);
-	print_def("flag_volatileField",		1 << ConstantPoolCacheEntry::volatileField);
-	print_def("flag_vfinalMethod",		1 << ConstantPoolCacheEntry::vfinalMethod);
-	print_def("flag_finalField",		1 << ConstantPoolCacheEntry::finalField);
-	nl();
-	print_def("INVOCATIONCOUNTER_COUNTINCREMENT", InvocationCounter::count_increment);
-	nl();
-	VMStructs::print_vm_offsets();
-	nl();
-	print_def("VMSYMBOLS_ArithmeticException", vmSymbols::java_lang_ArithmeticException_enum);
-	print_def("VMSYMBOLS_ArrayIndexOutOfBounds", vmSymbols::java_lang_ArrayIndexOutOfBoundsException_enum);
-	print_def("VMSYMBOLS_ArrayStoreException", vmSymbols::java_lang_ArrayStoreException_enum);
-	print_def("VMSYMBOLS_ClassCastException", vmSymbols::java_lang_ClassCastException_enum);
-	print_def("VMSYMBOLS_NullPointerException", vmSymbols::java_lang_NullPointerException_enum);
-	print_def("VMSYMBOLS_AbstractMethodError", vmSymbols::java_lang_AbstractMethodError_enum);
-	print_def("VMSYMBOLS_IncompatibleClassChangeError", vmSymbols::java_lang_IncompatibleClassChangeError_enum);
-	print_def("VMSYMBOLS_InternalError", vmSymbols::java_lang_InternalError_enum);
-
-	return 0;
-}
-
-#endif // STATIC_OFFSETS
--- a/ports/hotspot/src/cpu/zero/vm/bytecodes_arm.def	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7695 +0,0 @@
-@ Copyright 2009, 2010 Edward Nevill
-@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-@
-@ This code is free software; you can redistribute it and/or modify it
-@ under the terms of the GNU General Public License version 2 only, as
-@ published by the Free Software Foundation.
-@
-@ This code 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
-@ version 2 for more details (a copy is included in the LICENSE file that
-@ accompanied this code).
-@
-@ You should have received a copy of the GNU General Public License version
-@ 2 along with this work; if not, write to the Free Software Foundation,
-@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-#ifdef SHARK
-#define DISABLE_NOTICE_SAFEPOINTS
-#endif
-
-#ifndef DISABLE_HW_FP
-#define HW_FP
-#endif
-#ifndef DISABLE_NOTICE_SAFEPOINTS
-#define NOTICE_SAFEPOINTS
-#endif
-#ifndef DISABLE_FAST_BYTECODES
-#define FAST_BYTECODES
-#endif
-
-nop                  = 0x00, 1
-aconst_null          = 0x01, 1
-iconst_m1            = 0x02, 1
-iconst_0             = 0x03, 1
-iconst_1             = 0x04, 1
-iconst_2             = 0x05, 1
-iconst_3             = 0x06, 1
-iconst_4             = 0x07, 1
-iconst_5             = 0x08, 1
-lconst_0             = 0x09, 1
-lconst_1             = 0x0a, 1
-fconst_0             = 0x0b, 1
-fconst_1             = 0x0c, 1
-fconst_2             = 0x0d, 1
-dconst_0             = 0x0e, 1
-dconst_1             = 0x0f, 1
-bipush               = 0x10, 2
-sipush               = 0x11, 3
-ldc                  = 0x12, 2
-ldc_w                = 0x13, 3
-ldc2_w               = 0x14, 3
-iload                = 0x15, 2
-lload                = 0x16, 2
-fload                = 0x17, 2
-dload                = 0x18, 2
-aload                = 0x19, 2
-iload_0              = 0x1a, 1
-iload_1              = 0x1b, 1
-iload_2              = 0x1c, 1
-iload_3              = 0x1d, 1
-lload_0              = 0x1e, 1
-lload_1              = 0x1f, 1
-lload_2              = 0x20, 1
-lload_3              = 0x21, 1
-fload_0              = 0x22, 1
-fload_1              = 0x23, 1
-fload_2              = 0x24, 1
-fload_3              = 0x25, 1
-dload_0              = 0x26, 1
-dload_1              = 0x27, 1
-dload_2              = 0x28, 1
-dload_3              = 0x29, 1
-aload_0              = 0x2a, 1
-aload_1              = 0x2b, 1
-aload_2              = 0x2c, 1
-aload_3              = 0x2d, 1
-iaload               = 0x2e, 1
-laload               = 0x2f, 1
-faload               = 0x30, 1
-daload               = 0x31, 1
-aaload               = 0x32, 1
-baload               = 0x33, 1
-caload               = 0x34, 1
-saload               = 0x35, 1
-istore               = 0x36, 2
-lstore               = 0x37, 2
-fstore               = 0x38, 2
-dstore               = 0x39, 2
-astore               = 0x3a, 2
-istore_0             = 0x3b, 1
-istore_1             = 0x3c, 1
-istore_2             = 0x3d, 1
-istore_3             = 0x3e, 1
-lstore_0             = 0x3f, 1
-lstore_1             = 0x40, 1
-lstore_2             = 0x41, 1
-lstore_3             = 0x42, 1
-fstore_0             = 0x43, 1
-fstore_1             = 0x44, 1
-fstore_2             = 0x45, 1
-fstore_3             = 0x46, 1
-dstore_0             = 0x47, 1
-dstore_1             = 0x48, 1
-dstore_2             = 0x49, 1
-dstore_3             = 0x4a, 1
-astore_0             = 0x4b, 1
-astore_1             = 0x4c, 1
-astore_2             = 0x4d, 1
-astore_3             = 0x4e, 1
-iastore              = 0x4f, 1
-lastore              = 0x50, 1
-fastore              = 0x51, 1
-dastore              = 0x52, 1
-aastore              = 0x53, 1
-bastore              = 0x54, 1
-castore              = 0x55, 1
-sastore              = 0x56, 1
-pop                  = 0x57, 1
-pop2                 = 0x58, 1
-dup                  = 0x59, 1
-dup_x1               = 0x5a, 1
-dup_x2               = 0x5b, 1
-dup2                 = 0x5c, 1
-dup2_x1              = 0x5d, 1
-dup2_x2              = 0x5e, 1
-swap                 = 0x5f, 1
-iadd                 = 0x60, 1
-ladd                 = 0x61, 1
-fadd                 = 0x62, 1
-dadd                 = 0x63, 1
-isub                 = 0x64, 1
-lsub                 = 0x65, 1
-fsub                 = 0x66, 1
-dsub                 = 0x67, 1
-imul                 = 0x68, 1
-lmul                 = 0x69, 1
-fmul                 = 0x6a, 1
-dmul                 = 0x6b, 1
-idiv                 = 0x6c, 1
-ldiv                 = 0x6d, 1
-fdiv                 = 0x6e, 1
-ddiv                 = 0x6f, 1
-irem                 = 0x70, 1
-lrem                 = 0x71, 1
-frem                 = 0x72, 1
-drem                 = 0x73, 1
-ineg                 = 0x74, 1
-lneg                 = 0x75, 1
-fneg                 = 0x76, 1
-dneg                 = 0x77, 1
-ishl                 = 0x78, 1
-lshl                 = 0x79, 1
-ishr                 = 0x7a, 1
-lshr                 = 0x7b, 1
-iushr                = 0x7c, 1
-lushr                = 0x7d, 1
-iand                 = 0x7e, 1
-land                 = 0x7f, 1
-ior                  = 0x80, 1
-lor                  = 0x81, 1
-ixor                 = 0x82, 1
-lxor                 = 0x83, 1
-iinc                 = 0x84, 3
-i2l                  = 0x85, 1
-i2f                  = 0x86, 1
-i2d                  = 0x87, 1
-l2i                  = 0x88, 1
-l2f                  = 0x89, 1
-l2d                  = 0x8a, 1
-f2i                  = 0x8b, 1
-f2l                  = 0x8c, 1
-f2d                  = 0x8d, 1
-d2i                  = 0x8e, 1
-d2l                  = 0x8f, 1
-d2f                  = 0x90, 1
-i2b                  = 0x91, 1
-i2c                  = 0x92, 1
-i2s                  = 0x93, 1
-lcmp                 = 0x94, 1
-fcmpl                = 0x95, 1
-fcmpg                = 0x96, 1
-dcmpl                = 0x97, 1
-dcmpg                = 0x98, 1
-ifeq                 = 0x99, 0
-ifne                 = 0x9a, 0
-iflt                 = 0x9b, 0
-ifge                 = 0x9c, 0
-ifgt                 = 0x9d, 0
-ifle                 = 0x9e, 0
-if_icmpeq            = 0x9f, 0
-if_icmpne            = 0xa0, 0
-if_icmplt            = 0xa1, 0
-if_icmpge            = 0xa2, 0
-if_icmpgt            = 0xa3, 0
-if_icmple            = 0xa4, 0
-if_acmpeq            = 0xa5, 0
-if_acmpne            = 0xa6, 0
-goto                 = 0xa7, 0
-jsr                  = 0xa8, 0
-ret                  = 0xa9, 0
-tableswitch          = 0xaa, 0
-lookupswitch         = 0xab, 0
-ireturn              = 0xac, 0
-lreturn              = 0xad, 0
-freturn              = 0xae, 0
-dreturn              = 0xaf, 0
-areturn              = 0xb0, 0
-return               = 0xb1, 0
-getstatic            = 0xb2, 3
-putstatic            = 0xb3, 3
-getfield             = 0xb4, 3
-putfield             = 0xb5, 3
-invokevirtual        = 0xb6, 3
-invokespecial        = 0xb7, 3
-invokestatic         = 0xb8, 3
-invokeinterface      = 0xb9, 0
-new                  = 0xbb, 3
-newarray             = 0xbc, 2
-anewarray            = 0xbd, 3
-arraylength          = 0xbe, 1
-athrow               = 0xbf, 0
-checkcast            = 0xc0, 3
-instanceof           = 0xc1, 3
-monitorenter         = 0xc2, 1
-monitorexit          = 0xc3, 1
-wide                 = 0xc4, 1
-multianewarray       = 0xc5, 4
-ifnull               = 0xc6, 0
-ifnonnull            = 0xc7, 0
-goto_w               = 0xc8, 0
-jsr_w                = 0xc9, 0
-breakpoint           = 0xca, 0
-
-#ifdef FAST_BYTECODES
-
-@agetfield	= 0xcb, 3
-bgetfield	= 0xcc, 3
-cgetfield	= 0xcd, 3
-@dgetfield	= 0xce, 3
-@fgetfield	= 0xcf, 3
-igetfield	= 0xd0, 3
-lgetfield	= 0xd1, 3
-sgetfield	= 0xd2, 3
-
-aputfield	= 0xd3, 3
-bputfield	= 0xd4, 3
-cputfield	= 0xd5, 3
-@dputfield	= 0xd6, 3
-@fputfield	= 0xd7, 3
-iputfield	= 0xd8, 3
-lputfield	= 0xd9, 3
-@sputfield	= 0xda, 3
-
-iaccess_0	= 0xdb, 4
-iaccess_1	= 0xdc, 4
-iaccess_2	= 0xdd, 4
-iaccess_3	= 0xde, 4
-
-invokeresolved		= 0xdf, 3
-invokespecialresolved	= 0xe0, 3
-invokestaticresolved	= 0xe1, 3
-invokevfinal 		= 0xe2, 3
-
-iload_iload	= 0xe3, 4
-iload_iload_N	= 0xe4, 3
-
-@return_register_finalizer = 0xe5, 1
-
-iload_0_iconst_N        = 0xe7, 2
-iload_1_iconst_N        = 0xe8, 2
-iload_2_iconst_N        = 0xe9, 2
-iload_3_iconst_N        = 0xea, 2
-iload_iconst_N          = 0xeb, 3
-iadd_istore_N		= 0xec, 2
-isub_istore_N		= 0xed, 2
-iand_istore_N		= 0xee, 2
-ior_istore_N		= 0xef, 2
-ixor_istore_N		= 0xf0, 2
-iadd_u4store		= 0xf1, 3
-isub_u4store		= 0xf2, 3
-iand_u4store		= 0xf3, 3
-ior_u4store		= 0xf4, 3
-ixor_u4store		= 0xf5, 3
-iload_0_iload		= 0xf6, 3
-iload_1_iload		= 0xf7, 3
-iload_2_iload		= 0xf8, 3
-iload_3_iload		= 0xf9, 3
-iload_0_iload_N		= 0xfa, 2
-iload_1_iload_N		= 0xfb, 2
-iload_2_iload_N		= 0xfc, 2
-iload_3_iload_N		= 0xfd, 2
-
-#endif // FAST_BYTECODES
-
-return_register_finalizer = 0xe5, 1
-
-(nop) {
-	DISPATCH	\seq_len
-}
-
-(aconst_null,fconst_0) u4const_0 {
-	DISPATCH_START_R2
-        mov     lr, #0
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5) iconst_N {
-	sub	lr, r0, #opc_iconst_0
-	DISPATCH_START_R2
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(lconst_0,dconst_0) u8const_0 {
-	DISPATCH_START_R2
-        mov     tmp1, #0
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(lconst_1) lconst_1 {
-	DISPATCH_START_R2
-        mov     tmp2, #1
-	DISPATCH_NEXT
-        mov     tmp1, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(fconst_1) fconst_1 {
-	DISPATCH_START_R2
-        mov     tmp1, #0x3f800000
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(fconst_2) fconst_2 {
-	DISPATCH_START_R2
-        mov     r2, #0x40000000
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(dconst_1) dconst_1 {
-	DISPATCH_START_R2
-        mov     tmp1, #0x3f000000
-	DISPATCH_NEXT
-        orr     tmp1, tmp1, #0x00f00000
-	DISPATCH_NEXT
-        mov     tmp2, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(bipush) bipush {
-	DISPATCH_START	\seq_len
-	mov	tmp1, r2, lsl #24
-	DISPATCH_NEXT
-	mov	tmp1, tmp1, asr #24
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-@ r1 = [jpc, #2]
-(sipush) sipush {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	\seq_len
-	DISPATCH_NEXT
-	mov	r2, r2, lsl #24
-        orr     tmp1, r1, r2, asr #16
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,fload,aload) u4load {
-	DISPATCH_START	\seq_len
-	rsb	tmp1, r2, #0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(lload,dload) u8load {
-	DISPATCH_START	\seq_len
-	sub	r3, locals, r2, lsl #2
-	DISPATCH_NEXT
-	ldmda	r3, {tmp2, tmp1}
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(aload_0,aload_1,aload_2,aload_3) {
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3) {
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(fload_0,fload_1,fload_2,fload_3) {
-	rsb	tmp1, r0, #opc_fload_0
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(lload_0,dload_0) u8load_0 {
-	DISPATCH_START_R2
-        ldmda   locals, {tmp2-tmp1}
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lload_1,dload_1) u8load_1 {
-	DISPATCH_START_R2
-        ldmdb   locals, {tmp2-tmp1}
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lload_2,dload_2) u8load_2 {
-	DISPATCH_START_R2
-	ldr	tmp2, [locals, #-12]
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, #-8]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(lload_3,dload_3) u8load_3 {
-	DISPATCH_START_R2
-	ldr	tmp2, [locals, #-16]
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, #-12]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload) u4aload {
-	GET_STACK	1, r3
-	DISPATCH_START_R2_R0
-	POP	r2
-	DISPATCH_START_R2_JPC
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry5:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	DISPATCH_NEXT
-	ldr	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-}
-
-(laload,daload) u8aload {
-	GET_STACK	1, r3
-	DISPATCH_START_R2_R0
-	GET_STACK	0, r2
-	DISPATCH_START_R2_JPC
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry6:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #3
-	ldr	tmp2, [r3, #BASE_OFFSET_LONG]
-	DISPATCH_NEXT
-	ldr	tmp1, [r3, #20]
-	DISPATCH_NEXT
-	PUT_STACK	1, tmp1
-	PUT_STACK	0, tmp2
-	DISPATCH_FINISH
-}
-
-(baload) baload {
-	GET_STACK	1, r3
-	DISPATCH_START_R2_R0
-	POP	r2
-	DISPATCH_START_R2_JPC
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry7:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2
-	DISPATCH_NEXT
-	ldrsb	tmp1, [r3, #BASE_OFFSET_BYTE]
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-}
-
-(caload) caload {
-	GET_STACK	1, r3
-	DISPATCH_START_R2_R0
-	POP	r2
-	DISPATCH_START_R2_JPC
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry8:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #1
-	DISPATCH_NEXT
-	ldrh	tmp1, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-}
-
-(saload) saload {
-	GET_STACK	1, r3
-	DISPATCH_START_R2_R0
-	POP	r2
-	DISPATCH_START_R2_JPC
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry9:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #1
-	DISPATCH_NEXT
-	ldrsh	tmp1, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(astore,istore,fstore) u4store {
-	DISPATCH_START	\seq_len
-	rsb	tmp1, r2, #0
-	DISPATCH_NEXT
-	POP	r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(lstore,dstore) u8store {
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	sub	r3, locals, r2, lsl #2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	stmda	r3, {tmp2, tmp1}
-	DISPATCH_FINISH
-}
-
-(astore_0,istore_0,fstore_0) u4store_0 {
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	POP	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        str     tmp1, [locals, #0]
-	DISPATCH_FINISH
-}
-
-(astore_1,istore_1,fstore_1) u4store_1 {
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	POP	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        str     tmp1, [locals, #-4]
-	DISPATCH_FINISH
-}
-
-(astore_2,istore_2,fstore_2) u4store_2 {
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	POP	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        str     tmp1, [locals, #-8]
-	DISPATCH_FINISH
-}
-
-(astore_3,istore_3,fstore_3) u4store_3 {
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	POP	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        str     tmp1, [locals, #-12]
-	DISPATCH_FINISH
-}
-
-(lstore_0,dstore_0) u8store_0 {
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        stmda   locals, {tmp2, tmp1}
-	DISPATCH_FINISH
-}
-
-(lstore_1,dstore_1) u8store_1 {
-	DISPATCH_START_R2
-	DISPATCH_NEXT
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        stmdb   locals, {tmp2, tmp1}
-	DISPATCH_FINISH
-}
-
-(lstore_2,dstore_2) u8store_2 {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-        str     tmp2, [locals, #-12]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        str     tmp1, [locals, #-8]
-	DISPATCH_FINISH
-}
-
-(lstore_3,dstore_3) u8store_3 {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-        str     tmp2, [locals, #-16]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        str     tmp1, [locals, #-12]
-	DISPATCH_FINISH
-}
-
-(iastore,fastore) u4astore {
-	POP	r3, tmp2, tmp1		@ r3 = value, tmp2 = index, tmp1 = arrayref
-	DISPATCH_START_R2
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry10:
-	ldr	lr, [tmp1, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	tmp2, lr
-	bcs	array_bound_exception_jpc_1_tmp2
-	DISPATCH_NEXT
-	add	tmp1, tmp1, tmp2, lsl #2
-	DISPATCH_NEXT
-	str	r3, [tmp1, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(lastore,dastore) u8astore {
-	POP	r1, r3, tmp2, tmp1		@ r1,r3 = value, tmp2 = index, tmp1 = arrayref
-	DISPATCH_START_R2
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry11:
-	ldr	ip, [tmp1, #8]		@ ip = limit
-	cmp	tmp2, ip
-	DISPATCH_NEXT
-	bcs	array_bound_exception_jpc_1_tmp2
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2, lsl #3
-	str	r1, [tmp2, #BASE_OFFSET_LONG]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	r3, [tmp2, #20]
-	DISPATCH_FINISH
-}
-
-(bastore) bastore {
-	POP	r3, tmp2, tmp1		@ r3 = value, tmp2 = index, tmp1 = arrayref
-	DISPATCH_START_R2
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry12:
-	ldr	lr, [tmp1, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	tmp2, lr
-	bcs	array_bound_exception_jpc_1_tmp2
-	DISPATCH_NEXT
-	add	tmp1, tmp1, tmp2
-	DISPATCH_NEXT
-	strb	r3, [tmp1, #BASE_OFFSET_BYTE]
-	DISPATCH_FINISH
-}
-
-(castore,sastore) u2astore {
-	POP	r3, tmp2, tmp1		@ r3 = value, tmp2 = index, tmp1 = arrayref
-	DISPATCH_START_R2
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry13:
-	ldr	lr, [tmp1, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	tmp2, lr
-	bcs	array_bound_exception_jpc_1_tmp2
-	DISPATCH_NEXT
-	add	tmp1, tmp1, tmp2, lsl #1
-	DISPATCH_NEXT
-	strh	r3, [tmp1, #BASE_OFFSET_SHORT]
-	DISPATCH_FINISH
-}
-
-(pop) jpop {
-	DISPATCH_START_R2
-        add     stack, stack, #4
-	DISPATCH_FINISH
-}
-
-(pop2) jpop2 {
-	DISPATCH_START_R2
-        add     stack, stack, #8
-	DISPATCH_FINISH
-}
-
-(dup) dup {
-	DISPATCH_START_R2
-	ldr	lr, [stack, #4]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(dup_x1) dup_x1 {
-	DISPATCH_START_R2
-	POP	r2, r3
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(dup_x2) dup_x2 {
-	DISPATCH_START_R2
-	POP	r2, r3, lr
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_NEXT
-	PUSH	r2, r3, lr
-	DISPATCH_FINISH
-}
-
-(dup2) dup2 {
-	DISPATCH_START_R2
-	ldmib	stack, {r2, r3}
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(dup2_x1) dup2_x1 {
-	DISPATCH_START_R2
-	POP	r2, r3, lr
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_NEXT
-	PUSH	r2, r3, lr
-	DISPATCH_FINISH
-}
-
-(dup2_x2) dup2_x2 {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1, lr
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	PUSH	r2, r3, tmp1, lr
-	DISPATCH_FINISH
-}
-
-(swap) swap {
-	DISPATCH_START_R2
-	POP	r2, r3
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-
-(iadd) iadd {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	add	tmp2, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(ladd) ladd {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1, lr
-	DISPATCH_NEXT
-	adds	r2, r2, tmp1
-	adc	r3, r3, lr
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(isub) isub {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lsub) lsub {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1, lr
-	DISPATCH_NEXT
-	subs	r2, tmp1, r2
-	sbc	r3, lr, r3
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(imul) imul {
-	DISPATCH_START_R2
-	POP	r2, tmp1
-	DISPATCH_NEXT
-	mul	tmp2, r2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lmul) lmul {
-	POP	r1, tmp1, ip, lr
-        umull   r3, r0, ip, r1
-        mla     tmp1, ip, tmp1, r0
-	DISPATCH_START_R2
-        mla     tmp1, lr, r1, tmp1
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-(ldiv) ldiv {
-	POP	r2, r3
-	POP	r0, r1
-	orrs	lr, r2, r3
-	beq	.ldiv_0
-	bl	__aeabi_ldivmod
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(lrem) lrem {
-	POP	r2, r3
-	POP	r0, r1
-	orrs	lr, r2, r3
-	beq	.lrem_0
-	bl	__aeabi_ldivmod
-	PUSH	r2, r3
-	DISPATCH	\seq_len
-}
-
-(frem) frem {
-@ It must be possible to do better than this
-	POP	r0
-        bl      __aeabi_f2d
-	PUSH	r0, r1
-	GET_STACK	2, r0
-        bl      __aeabi_f2d
-	POP	r2, r3
-        bl      fmod
-        bl      __aeabi_d2f
-	PUT_STACK	0, r0
-	DISPATCH	\seq_len
-}
-
-(drem) drem {
-	POP	r2, r3
-	POP	r0, r1
-        bl      fmod
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(ineg) ineg {
-	DISPATCH_START_R2
-	POP	tmp1
-	DISPATCH_NEXT
-        rsb     tmp1, tmp1, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(lneg) lneg {
-	DISPATCH_START_R2
-	POP	r2, r3
-	DISPATCH_NEXT
-	rsbs	r2, r2, #0
-	rsc	r3, r3, #0
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(fneg) fneg {
-	DISPATCH_START_R2
-	POP	r2
-	DISPATCH_NEXT
-	eor	r2, r2, #0x80000000
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(dneg) dneg {
-	DISPATCH_START_R2
-	GET_STACK	1, r2
-	DISPATCH_NEXT
-	eor	r2, r2, #0x80000000
-	DISPATCH_NEXT
-	PUT_STACK	1, r2
-	DISPATCH_FINISH
-}
-
-(ishl) ishl {
-	DISPATCH_START_R2
-	POP	r2, r3
-	DISPATCH_NEXT
-	and	r2, r2, #31
-	mov	r2, r3, lsl r2
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(lshl) lshl {
-	DISPATCH_START_R2
-	POP	r2, r3, lr
-	DISPATCH_NEXT
-	tst	r2, #32
-	and	r2, r2, #31
-	movne	tmp1, #0
-	movne	lr, r3, lsl r2
-	moveq	tmp1, r3, lsl r2
-	moveq	lr, lr, lsl r2
-	rsbeq	r2, r2, #32
-	orreq	lr, lr, r3, lsr r2
-	PUSH	tmp1, lr
-	DISPATCH_FINISH
-}
-
-(ishr) ishr {
-	DISPATCH_START_R2
-	POP	r2, r3
-	DISPATCH_NEXT
-	and	r2, r2, #31
-	mov	r2, r3, asr r2
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(lshr) lshr {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	tst	r2, #32
-	and	r2, r2, #31
-	movne	lr, tmp1, asr #31
-	movne	r3, tmp1, asr r2
-	moveq	lr, tmp1, asr r2
-	moveq	r3, r3, lsr r2
-	rsbeq	r2, r2, #32
-	orreq	r3, r3, tmp1, lsl r2
-	PUSH	r3, lr
-	DISPATCH_FINISH
-}
-
-(iushr) iushr {
-	DISPATCH_START_R2
-	POP	r2, r3
-	DISPATCH_NEXT
-	and	r2, r2, #31
-	mov	r2, r3, lsr r2
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(lushr) lushr {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	tst	r2, #32
-	and	r2, r2, #31
-	movne	lr, #0
-	movne	r3, tmp1, lsr r2
-	moveq	lr, tmp1, lsr r2
-	moveq	r3, r3, lsr r2
-	rsbeq	r2, r2, #32
-	orreq	r3, r3, tmp1, lsl r2
-	PUSH	r3, lr
-	DISPATCH_FINISH
-}
-
-(iand) iand {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	and	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(land) land {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1, lr
-	DISPATCH_NEXT
-	and	r2, tmp1, r2
-	and	r3, lr, r3
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(ior) ior {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	orr	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lor) lor {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1, lr
-	DISPATCH_NEXT
-	orr	r2, tmp1, r2
-	orr	r3, lr, r3
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(ixor) ixor {
-	DISPATCH_START_R2
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	eor	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lxor) lxor {
-	DISPATCH_START_R2
-	POP	r2, r3, tmp1, lr
-	DISPATCH_NEXT
-	eor	r2, tmp1, r2
-	eor	r3, lr, r3
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iinc) iinc {
-	ldrsb	lr, [jpc, #2]
-	DISPATCH_START	\seq_len
-	rsb	tmp1, r2, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	add	r3, r3, lr
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(i2l) i2l {
-	DISPATCH_START_R2
-	POP	r2
-	DISPATCH_NEXT
-	mov	r3, r2, asr #31
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(i2f) i2f {
-	POP	r0
-        bl      __aeabi_i2f
-	PUSH	r0
-	DISPATCH	\seq_len
-}
-
-(i2d) i2d {
-	POP	r0
-        bl      __aeabi_i2d
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(l2i) l2i {
-	DISPATCH_START_R2
-	POP	r3
-	DISPATCH_NEXT
-	PUT_STACK	0, r3
-	DISPATCH_FINISH
-}
-
-(l2f) l2f {
-	POP	r0, r1
-        bl      __aeabi_l2f
-	PUSH	r0
-	DISPATCH	\seq_len
-}
-
-(l2d) l2d {
-	POP	r0, r1
-        bl      __aeabi_l2d
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(f2i) f2i {
-	POP	r0
-        bl      _ZN13SharedRuntime3f2iEf
-	PUSH	r0
-	DISPATCH	\seq_len
-}
-
-(f2l) f2l {
-	POP	r0
-        bl      _ZN13SharedRuntime3f2lEf
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(f2d) f2d {
-	POP	r0
-        bl      __aeabi_f2d
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(d2i) d2i {
-	POP	r0, r1
-        bl      _ZN13SharedRuntime3d2iEd
-	PUSH	r0
-	DISPATCH	\seq_len
-}
-
-(d2l) d2l {
-	POP	r0, r1
-        bl      _ZN13SharedRuntime3d2lEd
-	PUSH	r0, r1
-	DISPATCH	\seq_len
-}
-
-(d2f) d2f {
-	POP	r0, r1
-        bl      __aeabi_d2f
-	PUSH	r0
-	DISPATCH	\seq_len
-}
-
-(i2b) i2b {
-	DISPATCH_START_R2
-	POP	r3
-	DISPATCH_NEXT
-        mov     r3, r3, asl #24
-        mov     r3, r3, asr #24
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(i2c) i2c {
-	DISPATCH_START_R2
-	POP	r3
-	DISPATCH_NEXT
-        mov     r3, r3, asl #16
-        mov     r3, r3, lsr #16
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(i2s) i2s {
-	DISPATCH_START_R2
-	POP	r3
-	DISPATCH_NEXT
-        mov     r3, r3, asl #16
-        mov     r3, r3, asr #16
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(lcmp) lcmp {
-	POP	r1, r3, tmp1, lr
-	DISPATCH_START_R2
-	subs	r1, tmp1, r1
-	movne	r1, #1
-	sbcs	lr, lr, r3
-	DISPATCH_NEXT
-	movne	r1, #1
-	rsblt	r1, r1, #0
-	DISPATCH_NEXT
-	PUSH	r1
-	DISPATCH_FINISH
-}
-
-#ifdef NOTICE_SAFEPOINTS
-
-@ r2 = [jpc, #1]
-@ r1 = [jpc, #2]
-(ifeq,ifnull) ifeq_unsafe {
-	POP	r3
-	ldrb	r1, [jpc, #2]
-        cmp     r3, #0
-	beq	1f
-	DISPATCH 3
-1:
-	mov	r2, r2, lsl #24
-        orr     ip, r1, r2, asr #16
-        ldrb  r0, [jpc, ip]!
-	DISPATCH_BYTECODE
-}
-
-(ifne,ifnonnull) ifne_unsafe {
-	POP	r3
-	ldrb	r1, [jpc, #2]
-        cmp     r3, #0
-	bne	1f
-	DISPATCH 3
-1:
-	mov	r2, r2, lsl #24
-        orr     ip, r1, r2, asr #16
-        ldrb  r0, [jpc, ip]!
-	DISPATCH_BYTECODE
-}
-
-(iflt) iflt_unsafe {
-	POP	r3
-	ldrb	r1, [jpc, #2]
-        cmp     r3, #0
-	blt	1f
-	DISPATCH 3
-1:
-	mov	r2, r2, lsl #24
-        orr     ip, r1, r2, asr #16
-        ldrb  r0, [jpc, ip]!
-	DISPATCH_BYTECODE
-}
-
-(ifge) ifge_unsafe {
-	POP	r3
-	ldrb	r1, [jpc, #2]
-        cmp     r3, #0
-	bge	1f
-	DISPATCH 3
-1:
-	mov	r2, r2, lsl #24
-        orr     ip, r1, r2, asr #16
-        ldrb  r0, [jpc, ip]!
-	DISPATCH_BYTECODE
-}
-
-(ifgt) ifgt_unsafe {
-	POP	r3
-	ldrb	r1, [jpc, #2]
-        cmp     r3, #0
-	bgt	1f
-	DISPATCH 3
-1:
-	mov	r2, r2, lsl #24
-        orr     ip, r1, r2, asr #16
-        ldrb  r0, [jpc, ip]!
-	DISPATCH_BYTECODE
-}
-
-(ifle) ifle_unsafe {
-	POP	r3
-	ldrb	r1, [jpc, #2]
-        cmp     r3, #0
-	ble	1f
-	DISPATCH 3
-1:
-	mov	r2, r2, lsl #24
-        orr     ip, r1, r2, asr #16
-        ldrb  r0, [jpc, ip]!
-	DISPATCH_BYTECODE
-}
-
-(if_icmpeq,if_acmpeq) if_icmpeq_unsafe {
-	POP	r3, tmp1
-	ldrb	r1, [jpc, #2]
-        cmp     tmp1, r3
-	beq	branch_taken_unsafe
-	DISPATCH 3
-}
-
-(if_icmpne,if_acmpne) if_icmpne_unsafe {
-	POP	r3, tmp1
-	ldrb	r1, [jpc, #2]
-        cmp     tmp1, r3
-	bne	branch_taken_unsafe
-	DISPATCH 3
-}
-
-(if_icmplt) if_icmplt_unsafe {
-	POP	r3, tmp1
-	ldrb	r1, [jpc, #2]
-        cmp     tmp1, r3
-	blt	branch_taken_unsafe
-	DISPATCH 3
-}
-
-(if_icmpge) if_icmpge_unsafe {
-	POP	r3, tmp1
-	ldrb	r1, [jpc, #2]
-        cmp     tmp1, r3
-	bge	branch_taken_unsafe
-	DISPATCH 3
-}
-
-(if_icmpgt) if_icmpgt_unsafe {
-	POP	r3, tmp1
-	ldrb	r1, [jpc, #2]
-        cmp     tmp1, r3
-	bgt	branch_taken_unsafe
-	DISPATCH 3
-}
-
-(if_icmple) if_icmple_unsafe {
-	POP	r3, tmp1
-	ldrb	r1, [jpc, #2]
-        cmp     tmp1, r3
-	ble	branch_taken_unsafe
-	DISPATCH 3
-}
-
-(goto) goto_unsafe {
-	ldrb	r1, [jpc, #2]
-	mov	r2, r2, lsl #24
-        orr     tmp1, r1, r2, asr #16
-        DISPATCH_START_REG	tmp1
-  USEC  cmp     tmp1, #0
-  USEC  ble     do_backedge
-	DISPATCH_BYTECODE
-}
-
-#endif // NOTICE_SAFEPOINTS
-
-(jsr) jsr {
-	ldr	r3, [istate, #ISTATE_METHOD]
-	ldr	r1, [r3, #8]
-	rsb	r2, r1, jpc
-	sub	r2, r2, #45
-	PUSH	r2
-	b	do_goto
-}
-
-@ r2 = [jpc, #1]
-@ r1 = [jpc, #2]
-(ret) ret {
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [r0, #8]
-	ldr	r1, [locals, -r2, lsl #2]
-	add	jpc, r3, r1
-	DISPATCH	48
-}
-
-@ We dont do safe and unsafe versions of tableswitch and lookupswitch
-(tableswitch) tableswitch {
-	POP	a2
-        bic     a1, jpc, #3
-        ldr     a4,[a1,#8]
-@       BYTESEX_REVERSE a3, a4, a3
-
-        eor     a3, a4, a4, ror #16
-        bic     a3, a3, #0xff0000
-        mov     a4, a4, ror #8
-        eor     a3, a4, a3, lsr #8
-
-        ldr     a4,[a1,#12]
-@       BYTESEX_REVERSE a4, a4, ip
-
-        eor     ip, a4, a4, ror #16
-        bic     ip, ip, #0xff0000
-        mov     a4, a4, ror #8
-        eor     a4, a4, ip, lsr #8
-
-        sub     a2,a2,a3
-        sub     a4,a4,a3
-        cmp     a4,a2
-        ldrcc   a1,[a1,#4]
-        addcs   a1,a1,a2,LSL #2
-        ldrcs   a1,[a1,#16]
-@       BYTESEX_REVERSE a1, a1, a4
-
-        eor     a4, a1, a1, ror #16
-        bic     a4, a4, #0xff0000
-        mov     a1, a1, ror #8
-        eors    ip, a1, a4, lsr #8
-
-        DISPATCH_START_REG	ip
-	DISPATCH_BYTECODE
-}
-
-(lookupswitch) lookupswitch {
-	POP	a2
-        bic     a1, jpc, #3
-@       BYTESEX_REVERSE a2, a2, ip
-
-        eor     ip, a2, a2, ror #16
-        bic     ip, ip, #0xff0000
-        mov     a2, a2, ror #8
-        eor     a2, a2, ip, lsr #8
-
-        ldr     a3,[a1,#8]
-@       BYTESEX_REVERSE a3, a3, ip
-
-        eor     ip, a3, a3, ror #16
-        bic     ip, ip, #0xff0000
-        mov     a3, a3, ror #8
-        eor     a3, a3, ip, lsr #8
-
-        subs    a4,a3,#1
-        bmi     1f
-        add     a1, a1, #4
-0:
-        ldr      a3,[a1,#8]!
-        cmp     a3,a2
-        beq     2f
-        subs    a4,a4,#1
-        bpl     0b
-1:
-        bic     a1, jpc, #3
-2:
-        ldr      a2,[a1,#4]
-@       BYTESEX_REVERSE a2, a2, ip
-
-        eor     ip, a2, a2, ror #16
-        bic     ip, ip, #0xff0000
-        mov     a2, a2, ror #8
-        eors    ip, a2, ip, lsr #8
-
-        DISPATCH_START_REG	ip
-	DISPATCH_BYTECODE
-}
-
-#ifdef FAST_BYTECODES
-(igetfield) igetfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	tmp1
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry78:
-	ldr	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(bgetfield) bgetfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	tmp1
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry79:
-	ldrsb	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(cgetfield) cgetfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	tmp1
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry80:
-	ldrh	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(sgetfield) sgetfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	tmp1
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry81:
-	ldrsh	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(lgetfield) lgetfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	tmp1
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-.abortentry82:
-	ldmia	tmp2, {tmp2, tmp1}
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(iputfield) iputfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	r3, tmp1		@ r3 = value, tmp1 = object
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-.abortentry83:
-	str	r3, [tmp1, tmp2]
-	DISPATCH_FINISH
-}
-
-(cputfield) cputfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	r3, tmp1		@ r3 = value, tmp1 = object
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-.abortentry84:
-	strh	r3, [tmp1, tmp2]
-	DISPATCH_FINISH
-}
-
-(bputfield) bputfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	r3, tmp1		@ r3 = value, tmp1 = object
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-.abortentry85:
-	strb	r3, [tmp1, tmp2]
-	DISPATCH_FINISH
-}
-
-(aputfield) aputfield {
-	ldrb	r1, [jpc, #2]
-	POP	r3, tmp1		@ r3 = value, tmp1 = object
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-.abortentry113:
-	str	r3, [tmp1, tmp2]
-	mov	r0, tmp1
-	bl	Helper_aputfield
-	DISPATCH 3
-}
-
-(lputfield) lputfield {
-	ldrb	r1, [jpc, #2]
-	DISPATCH_START	3
-	POP	r3, tmp1, lr		@ r3, tmp1 = value, lr = object
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	add	tmp2, lr, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-.abortentry86:
-	stm	tmp2, {r3, tmp1}
-	DISPATCH_FINISH
-}
-
-#endif // FAST_BYTECODES
-
-@ r2 = [jpc, #1]
-@ r1 = [jpc, #2]
-(getstatic) getstatic {
-	ldrb	r1, [jpc, #2]
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-        ldr     r3, [tmp2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getstatic << 16
-	blne	resolve_get_put
-	ldr	r3, [tmp2, #CP_OFFSET+4]
-	ldr	r2, [tmp2, #CP_OFFSET+12]
-        ldr     lr, [tmp2, #CP_OFFSET+8]
-        movs    r2, r2, lsr #29
-	bhi	getstatic_w		@ C = 1, Z = 0 => R2 == 3, 5, 7
-	bcs	getstatic_h		@ C = 1 => R2 = 1
-	beq	getstatic_sb		@ Z = 1 => R2 = 0
-	tst	r2, #2
-	bne	getstatic_dw
-	b	getstatic_sh
-}
-
-@ r2 = [jpc, #1]
-@ r1 = [jpc, #2]
-(putstatic) putstatic {
-	ldrb	r1, [jpc, #2]
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-        ldr     r3, [tmp2, #CP_OFFSET]
-        and     r3, r3, #0xff000000
-        cmp     r3, #opc_putstatic << 24
-	blne	resolve_get_put
-	ldr	r3, [tmp2, #CP_OFFSET+4]		@ r3 = object
-        ldr     lr, [tmp2, #CP_OFFSET+12]           @ lr = tos_type
-        ldr     r2, [tmp2, #CP_OFFSET+8]            @ r2 = offset
-	movs	lr, lr, lsr #29
-	bhi	putstatic_w		@ C = 1, Z = 0 => R2 == 3, 5, 7
-	bcs	putstatic_h		@ C = 1 => R2 = 1
-	beq	putstatic_sb		@ Z = 1 => R2 = 0
-	tst	lr, #2
-	bne	putstatic_dw
-	b	putstatic_sh
-}
-
-#ifdef NOTICE_SAFEPOINTS
-
-(return) return_unsafe {
-
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-
-	cmp	tmp1, tmp2
-	bcc	1f
-2:
-	mov	r3, #0
-
-	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [r2, #0]
-	ldrh	r0, [r0, #40]
-	add	r1, r2, #4
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-
-	add	stack, r1, r0, lsl #2
-
-	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-1:
-	bl	return_check_monitors
-	b	2b
-}
-
-(ireturn,areturn,freturn) ireturn_unsafe {
-
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-
-	cmp	tmp1, tmp2
-	bcc	1f
-2:
-	mov	r3, #0
-
-	POP	r1					@ pop result before we lose stack
-
-	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [stack, #0]
-	ldrh	r0, [r0, #40]
-
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r1, [stack, r0, lsl #2]!
-
-	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-1:
-	bl	return_check_monitors
-	b	2b
-}
-
-(lreturn,dreturn) lreturn_unsafe {
-
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-	cmp	tmp1, tmp2
-	bcc	1f
-2:
-	mov	r3, #0
-
-	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [r2, #0]
-	ldrh	r0, [r0, #40]
-	add	r1, r2, #4
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-
-	POP	r2, r3
-
-	add	stack, r1, r0, lsl #2
-	stmdb	stack!, {r2, r3}
-
-	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-1:
-	bl	return_check_monitors
-	b	2b
-}
-
-#endif // NOTICE_SAFEPOINTS
-
-(ldc) ldc {
-	ldr	r3, [istate, #ISTATE_METHOD]			@ method
-	ldrb	lr, [jpc, #1]
-
-	ldr	tmp1, [r3, #METHOD_CONSTANTS]			@ constants
-
-	DISPATCH_START	\seq_len
-
-	ldr	r3, [tmp1, #8]
-	DISPATCH_NEXT
-	add	r3, r3, #12
-	ldrb	r3, [r3, lr]
-
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-
-	cmp	r3, #JVM_CONSTANT_Integer
-	cmpne	r3, #JVM_CONSTANT_Float
-	cmpne	r3, #JVM_CONSTANT_String
-	bne	1f
-
-	add	r3, tmp1, lr, lsl #2
-	ldr	r3, [r3, #CONSTANTPOOL_BASE]
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-1:
-	cmp	r3, #JVM_CONSTANT_Class
-	bne	2f
-	add	r0, tmp1, #CONSTANTPOOL_BASE
-	ldr	r0, [r0, lr, lsl #2]
-	ldr	r1, [r0, #60]
-	PUSH	r1
-	DISPATCH	0
-2:
-	sub	jpc, jpc, #\seq_len
-	ldr	r0, [istate, #ISTATE_THREAD]
-        DECACHE_JPC
-        DECACHE_STACK
-	mov	r1, #0
-        bl      _ZN18InterpreterRuntime3ldcEP10JavaThreadb
-	ldr	r0, [istate, #ISTATE_THREAD]			@ thread
-	CACHE_CP
-	ldr	r1, [r0, #THREAD_PENDING_EXC]
-	CACHE_JPC
-	cmp	r1, #0
-	bne	handle_exception
-	ldr	r3, [r0, #THREAD_VM_RESULT]
-	mov	r2, #0
-	PUSH	r3
-	str	r2, [r0, #THREAD_VM_RESULT]
-	DISPATCH	\seq_len
-}
-
-(ldc_w) ldc_w {
-	ldrb	lr, [jpc, #1]
-
-	ldr	r3, [istate, #ISTATE_METHOD]			@ method
-	ldrb	ip, [jpc, #2]
-	ldr	r2, [r3, #METHOD_CONSTANTS]			@ constants
-
-	DISPATCH_START	\seq_len
-
-	ldr	r3, [r2, #8]
-	orr	lr, ip, lr, lsl #8
-	add	r3, r3, #12
-	ldrb	r3, [r3, lr]
-
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-
-	cmp	r3, #JVM_CONSTANT_Integer
-	cmpne	r3, #JVM_CONSTANT_Float
-	cmpne	r3, #JVM_CONSTANT_String
-	bne	1f
-
-	add	r3, r2, lr, lsl #2
-	ldr	r3, [r3, #CONSTANTPOOL_BASE]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-1:
-	cmp	r3, #JVM_CONSTANT_Class
-	bne	2f
-	add	r0, r2, #CONSTANTPOOL_BASE
-	ldr	r0, [r0, lr, lsl #2]
-	ldr	r1, [r0, #60]
-	PUSH	r1
-	DISPATCH	0
-2:
-	sub	jpc, jpc, #\seq_len
-	ldr	r0, [istate, #ISTATE_THREAD]
-        DECACHE_JPC
-        DECACHE_STACK
-	mov	r1, #1
-        bl      _ZN18InterpreterRuntime3ldcEP10JavaThreadb
-	ldr	r0, [istate, #ISTATE_THREAD]			@ thread
-	CACHE_CP
-	ldr	r1, [r0, #THREAD_PENDING_EXC]
-	CACHE_JPC
-	cmp	r1, #0
-	ldr	r3, [r0, #THREAD_VM_RESULT]
-	bne	handle_exception
-	mov	r2, #0
-	PUSH	r3
-	str	r2, [r0, #THREAD_VM_RESULT]
-	DISPATCH	\seq_len
-}
-
-(ldc2_w) ldc2_w {
-	ldrb	r3, [jpc, #1]
-
-	ldr	tmp1, [istate, #ISTATE_METHOD]			@ method
-	ldrb	lr, [jpc, #2]
-	ldr	r2, [tmp1, #METHOD_CONSTANTS]			@ constants
-
-	DISPATCH_START	\seq_len
-
-	ldr	tmp1, [r2, #8]
-	orr	r3, lr, r3, lsl #8
-	add	tmp1, tmp1, #12
-	ldrb	tmp1, [tmp1, r3]
-
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-
-	cmp	tmp1, #JVM_CONSTANT_Long
-	cmpne	tmp1, #JVM_CONSTANT_Double
-	bne	vm_fatal_error
-
-	add	tmp1, r2, r3, lsl #2
-	ldr	r3, [tmp1, #CONSTANTPOOL_BASE]
-	ldr	tmp1, [tmp1, #CONSTANTPOOL_BASE+4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-#ifdef FAST_BYTECODES
-(iadd_u4store) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(isub_u4store) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iand_u4store) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	and	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(ior_u4store) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	orr	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(ixor_u4store) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	eor	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iadd_istore_N) {
-	ldrb	lr, [jpc, #1]
-	DISPATCH_START	\seq_len
-	DISPATCH_NEXT
-	rsb	r3, lr, #opc_istore_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(isub_istore_N) {
-	ldrb	lr, [jpc, #1]
-	DISPATCH_START	\seq_len
-	DISPATCH_NEXT
-	rsb	r3, lr, #opc_istore_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iand_istore_N) {
-	ldrb	lr, [jpc, #1]
-	DISPATCH_START	\seq_len
-	DISPATCH_NEXT
-	rsb	r3, lr, #opc_istore_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	and	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(ior_istore_N) {
-	ldrb	lr, [jpc, #1]
-	DISPATCH_START	\seq_len
-	DISPATCH_NEXT
-	rsb	r3, lr, #opc_istore_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	orr	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-(ixor_istore_N) {
-	ldrb	lr, [jpc, #1]
-	DISPATCH_START	\seq_len
-	DISPATCH_NEXT
-	rsb	r3, lr, #opc_istore_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	eor	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iconst_N)
-{
-        ldrb    r3, [jpc, #2]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-        DISPATCH_NEXT
-        sub     r3, r3, #opc_iconst_0
-        ldr     tmp1, [locals, r2, lsl #2]
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH   r3, tmp1
-        DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-        ldrb    r2, [jpc, #1-\seq_len]
-        DISPATCH_NEXT
-        ldr     tmp1, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        sub     tmp2, r2, #opc_iconst_0
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH   tmp2, tmp1
-        DISPATCH_FINISH
-}
-
-@ (aload_N)(getfield)
-(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
-{
-	ldrb	r2, [jpc, #3]
-	rsb	tmp1, r0, #opc_iaccess_0
-	ldrb	r3, [jpc, #2]
-	add	tmp2, constpool, r2, lsl #12
-	DISPATCH_START	4
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, r3, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry87:
-	ldr	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iload) fast_iload_iload
-{
-	ldrb	r3, [jpc, #3]
-	DISPATCH_START	\seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iload_N) fast_iload_iload_N
-{
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload) fast_iload_N_iload
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	DISPATCH_START	\seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N) fast_iload_N_iload_N
-{
-	rsb	r3, r0, #opc_iload_0_iload_N
-	DISPATCH_START	\seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	ldr	r3, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-#endif // FAST_BYTECODE
-
-#ifdef HW_FP
-
-(fadd) fadd_vfp {
-	DISPATCH_START_R2
-	vldr	s15, [stack, #8]
-	vldr	s14, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fadds	s15, s15, s14
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	s15, [stack, #8]
-	add	stack, stack, #4
-	DISPATCH_FINISH
-}
-
-(dadd) dadd_vfp {
-	DISPATCH_START_R2
-	vldr	d7, [stack, #12]
-	vldr	d6, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	faddd	d0, d7, d6
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	d0, [stack, #12]
-	add	stack, stack, #8
-	DISPATCH_FINISH
-}
-
-(fsub) fsub_vfp {
-	DISPATCH_START_R2
-	vldr	s15, [stack, #8]
-	vldr	s14, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fsubs	s15, s15, s14
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	s15, [stack, #8]
-	add	stack, stack, #4
-	DISPATCH_FINISH
-}
-
-(fmul) fmul_vfp {
-	DISPATCH_START_R2
-	vldr	s15, [stack, #8]
-	vldr	s14, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fmuls	s15, s15, s14
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	s15, [stack, #8]
-	add	stack, stack, #4
-	DISPATCH_FINISH
-}
-
-(dmul) dmul_vfp {
-	DISPATCH_START_R2
-	vldr	d7, [stack, #12]
-	vldr	d6, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fmuld	d0, d7, d6
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	d0, [stack, #12]
-	add	stack, stack, #8
-	DISPATCH_FINISH
-}
-
-(fdiv) fdiv_vfp {
-	DISPATCH_START_R2
-	vldr	s15, [stack, #8]
-	vldr	s14, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fdivs	s15, s15, s14
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	s15, [stack, #8]
-	add	stack, stack, #4
-	DISPATCH_FINISH
-}
-
-(ddiv) ddiv_vfp {
-	DISPATCH_START_R2
-	vldr	d7, [stack, #12]
-	vldr	d6, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fdivd	d0, d7, d6
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	vstr	d0, [stack, #12]
-	add	stack, stack, #8
-	DISPATCH_FINISH
-}
-
-(fcmpl) fcmpl_vfp {
-	DISPATCH_START_R2
-	flds	s14, [stack, #8]
-	flds	s15, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fcmpes	s14, s15
-	add	stack, stack, #8
-	fmstat
-	mvnmi	r3, #0
-	bmi	1f
-	movgt	r3, #1
-	bgt	1f
-	fcmps	s14, s15
-	fmstat
-	moveq	r3, #0
-	mvnne	r3, #0
-1:
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(fcmpg) fcmpg_vfp {
-	DISPATCH_START_R2
-	flds	s14, [stack, #8]
-	flds	s15, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fcmpes	s14, s15
-	add	stack, stack, #8
-	fmstat
-	mvnmi	r3, #0
-	bmi	1f
-	movgt	r3, #1
-	bgt	1f
-	fcmps	s14, s15
-	fmstat
-	moveq	r3, #0
-	movne	r3, #1
-1:
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(dcmpl) dcmpl_vfp {
-	DISPATCH_START_R2
-	fldd	d6, [stack, #12]
-	fldd	d7, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fcmped	d6, d7
-	fmstat
-	mvnmi	r3, #0
-	bmi	1f
-	movgt	r3, #1
-	bgt	1f
-	fcmpd	d6, d7
-	fmstat
-	moveq	r3, #0
-	mvnne	r3, #0
-1:
-	add	stack, stack, #16
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(dcmpg) dcmpg_vfp {
-	DISPATCH_START_R2
-	fldd	d6, [stack, #12]
-	fldd	d7, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	fcmped	d6, d7
-	fmstat
-	mvnmi	r3, #0
-	bmi	1f
-	movgt	r3, #1
-	bgt	1f
-	fcmpd	d6, d7
-	fmstat
-	moveq	r3, #0
-	movne	r3, #1
-1:
-	add	stack, stack, #16
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-#endif // HW_FP
-
-#ifdef FAST_BYTECODES
-
-@##############################################################################
-@ Optimised bytecode pairs
-@##############################################################################
-
-@ --- load; iaccess ------------------------------------------------------
-
-(iload_0,iload_1,iload_2,iload_3)
-(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
-{
-	rsb	lr, r0, #opc_iload_0
-	ldrb	r2, [jpc, #4]
-	rsb	tmp1, r1, #opc_iaccess_0
-	ldrb	r3, [jpc, #3]
-	ldr	lr, [locals, lr, lsl #2]
-	add	tmp2, constpool, r2, lsl #12
-	DISPATCH_START	\seq_len
-	PUSH	lr
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, r3, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry111:
-	ldr	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)
-(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
-{
-	rsb	lr, r2, #0
-	ldrb	r2, [jpc, #5]
-	rsb	tmp1, r1, #opc_iaccess_0
-	ldrb	r3, [jpc, #4]
-	ldr	lr, [locals, lr, lsl #2]
-	add	tmp2, constpool, r2, lsl #12
-	DISPATCH_START	\seq_len
-	PUSH	lr
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, r3, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry112:
-	ldr	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-@ --- load; load ---------------------------------------------------------
-
-(aload_0,aload_1,aload_2,aload_3)
-(aload_0,aload_1,aload_2,aload_3)
-{
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r1, #opc_aload_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r1, #opc_iload_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(aload_0,aload_1,aload_2,aload_3)
-{
-	rsb	tmp1, r0, #opc_iload_0
-        DISPATCH_START  \seq_len
-	rsb	tmp2, r1, #opc_aload_0
-        DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	cmp	r0, #opc_igetfield
-	ldr	tmp2, [locals, tmp2, lsl #2]
-        beq     1f
-2:
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-        DISPATCH_FINISH
-1:
-	ldrb	lr, [jpc, #-1]
-	add	lr, lr, #opc_iaccess_0-opc_aload_0
-	strb	lr, [jpc, #-1]
-	b	2b
-}
-
-@ 7 cycles
-(iload_0,iload_1,iload_2,iload_3)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	add	r0, r0, #opc_iload_0_iload_N-opc_iload_0
-	strb	r0, [jpc]
-	b	do_fast_iload_N_iload_N
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(iload,aload,fload)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(aload,fload)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(iload)
-{
-	add	r0, r0, #opc_iload_0_iload-opc_iload_0
-	strb	r0, [jpc]
-	b	do_fast_iload_N_iload
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)
-(aload_0,aload_1,aload_2,aload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r1, #opc_aload_0
-	DISPATCH_NEXT
-	rsb	tmp1, r2, #0
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	cmp	r0, #opc_igetfield
-	DISPATCH_NEXT
-	beq	1f
-2:
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-1:
-	ldrb	lr, [jpc, #-1]
-	add	lr, lr, #opc_iaccess_0-opc_aload_0
-	strb	lr, [jpc, #-1]
-	b	2b
-}
-
-@ r2 = [jpc, #1]
-(aload,fload)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r1, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp1, r2, #0
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	mov	r0, #opc_iload_iload_N
-	strb	r0, [jpc]
-	b	do_fast_iload_iload_N
-}
-
-@ r2 = [jpc, #1]
-(aload,fload)(iload,aload,fload) {
-	ldrb	tmp2, [jpc, #3]
-	rsb	tmp1, r2, #0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, tmp2, #0
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-(iload)(iload) {
-	mov	r0, #opc_iload_iload
-	strb	r0, [jpc]
-	b	do_fast_iload_iload
-}
-
-(iload)(aload,fload) {
-	ldrb	tmp2, [jpc, #3]
-	rsb	tmp1, r2, #0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, tmp2, #0
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2, tmp1
-	DISPATCH_FINISH
-}
-
-@ --- load; store --------------------------------------------------------
-
-(aload_0,aload_1,aload_2,aload_3)
-(astore_0,astore_1,astore_2,astore_3)
-{
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r1, #opc_astore_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp1, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(istore_0,istore_1,istore_2,istore_3)
-{
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r1, #opc_istore_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp1, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(astore,istore,fstore)
-{
-	ldrb	tmp2, [jpc, #2]
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, tmp2, #0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp1, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(astore,istore,fstore)
-{
-	ldrb	tmp2, [jpc, #2]
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, tmp2, #0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp1, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)
-(astore_0,astore_1,astore_2,astore_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	tmp1, r1, #opc_astore_0
-	DISPATCH_NEXT
-	rsb	tmp2, r2, #0
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)
-(istore_0,istore_1,istore_2,istore_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	tmp1, r1, #opc_istore_0
-	DISPATCH_NEXT
-	rsb	tmp2, r2, #0
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(astore,istore,fstore) {
-	ldrb	tmp1, [jpc, #3]
-	rsb	tmp2, r2, #0
-	DISPATCH_START	\seq_len
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	tmp2, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ --- load; const -------------------------------------------------------
-
-(aload_0,aload_1,aload_2,aload_3)
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
-{
-	rsb	tmp1, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	sub	tmp2, r1, #opc_iconst_0
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
-{
-        add     r0, r0, #opc_iload_0_iconst_N-opc_iload_0
-        strb    r0, [jpc]
-	b	do_iload_0_iconst_N
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
-{
-        cmp     r0, #opc_iload
-        DISPATCH_START  \seq_len
-        sub     r3, r1, #opc_iconst_0
-        DISPATCH_NEXT
-        ldr     tmp2, [locals, -r2, lsl #2]
-        DISPATCH_NEXT
-        beq     1f
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH   r3, tmp2
-        DISPATCH_FINISH
-1:
-        mov     tmp1, #opc_iload_iconst_N
-        strb    tmp1, [jpc, #-\seq_len]!
-	b	do_iload_iconst_N
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(bipush)
-{
-	ldrsb	r2, [jpc, #2]
-	rsb	r3, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(bipush)
-{
-	ldrsb	r2, [jpc, #2]
-	rsb	r3, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(sipush)
-{
-        ldrsb   r2, [jpc, #2]   @ zero_extendqisi2
-        ldrb    lr, [jpc, #3]   @ zero_extendqisi2
-	rsb	r3, r0, #opc_aload_0
-	DISPATCH_START	\seq_len
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        orr     r2, lr, r2, asl #8
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(sipush)
-{
-        ldrsb   r2, [jpc, #2]   @ zero_extendqisi2
-        ldrb    lr, [jpc, #3]   @ zero_extendqisi2
-	rsb	r3, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        orr     r2, lr, r2, asl #8
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(bipush) {
-	ldrsb	r3, [jpc, #3]
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r3, lr
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(sipush) {
-	ldrsb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #4]
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, -r2, lsl #2]
-        orr     r3, lr, r3, asl #8
-	DISPATCH_NEXT
-	PUSH	r3, tmp1
-	DISPATCH_FINISH
-}
-
-@ --- load; Xaload -------------------------------------------------------
-
-(iload_0,iload_1,iload_2,iload_3)
-(iaload,aaload,faload)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, r2, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry19:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2, lsl #2
-	ldr	lr, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(iaload,aaload,faload) {
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry20:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2, lsl #2
-	ldr	lr, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(baload)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, r2, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry21:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2
-	ldrsb	lr, [r3, #BASE_OFFSET_BYTE]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(caload)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, r2, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry22:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2, lsl #1
-	ldrh	lr, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(saload)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, r2, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry23:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2, lsl #1
-	ldrsh	lr, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(baload) {
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry24:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2
-	ldrsb	lr, [r3, #BASE_OFFSET_BYTE]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(caload) {
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry25:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2, lsl #1
-	ldrh	lr, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload,aload,fload)(saload) {
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry26:
-	ldr	lr, [r3, #8]		@ lr = length
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	add	r3, r3, r2, lsl #1
-	ldrsh	lr, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-@ --- load; Xastore -------------------------------------------------------
-
-(iload_0,iload_1,iload_2,iload_3)
-(iastore,fastore)
-{
-	POP	r2, r3
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry27:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(bastore)
-{
-	POP	r2, r3
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry28:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2
-	strb	tmp1, [r3, #BASE_OFFSET_BYTE]
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(castore,sastore)
-{
-	POP	r2, r3
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry29:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #1
-	strh	tmp1, [r3, #BASE_OFFSET_SHORT]
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(iastore,fastore) {
-	POP	r3, tmp1
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, -r2, lsl #2]
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry30:
-	ldr	lr, [tmp1, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r3, lr
-	bcs	array_bound_exception_jpc_1_r3
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r3, lsl #2
-	str	r2, [tmp1, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(bastore) {
-	POP	r3, tmp1
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, -r2, lsl #2]
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry31:
-	ldr	lr, [tmp1, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r3, lr
-	bcs	array_bound_exception_jpc_1_r3
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r3
-	strb	r2, [tmp1, #BASE_OFFSET_BYTE]
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(castore,sastore) {
-	POP	r3, tmp1
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, -r2, lsl #2]
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry32:
-	ldr	lr, [tmp1, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r3, lr
-	bcs	array_bound_exception_jpc_1_r3
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r3, lsl #1
-	strh	r2, [tmp1, #BASE_OFFSET_SHORT]
-	DISPATCH_FINISH
-}
-
-@ --- load; dataop -------------------------------------------------------
-
-(iload_0,iload_1,iload_2,iload_3)
-(iadd)
-{
-	POP	tmp2
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	add	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(iadd) {
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	POP	tmp1
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(isub)
-{
-	POP	tmp2
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	sub	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(isub) {
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	POP	tmp1
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(imul)
-{
-	POP	r2
-	rsb	lr, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	mul	r3, r2, lr
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(imul) {
-	DISPATCH_START	\seq_len
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-	mul	lr, r3, r2
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ineg)
-{
-	rsb	lr, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	rsb	lr, lr, #0
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(ineg) {
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-	rsb	r2, r2, #0
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ishl)
-{
-	POP	r2
-	rsb	lr, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	mov	lr, r2, lsl lr
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(ishl) {
-	DISPATCH_START	\seq_len
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-	mov	r2, r3, lsl r2
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ishr)
-{
-	POP	r2
-	rsb	lr, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	mov	lr, r2, asr lr
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(ishr) {
-	DISPATCH_START	\seq_len
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-	mov	r2, r3, asr r2
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(iushr)
-{
-	POP	r2
-	rsb	lr, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	mov	lr, r2, lsr lr
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(iushr) {
-	ldrb	r2, [jpc, #1]
-	DISPATCH_START	\seq_len
-	POP	r3
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-	mov	r2, r3, lsr r2
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(iand)
-{
-	POP	tmp2
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	and	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(iand) {
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	POP	tmp1
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	and	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ior)
-{
-	POP	tmp2
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	orr	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(ior) {
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	POP	tmp1
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	orr	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ixor)
-{
-	POP	tmp2
-	rsb	tmp1, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	eor	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(ixor) {
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	POP	tmp1
-	DISPATCH_NEXT
-	ldr	tmp2, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	eor	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(i2c)
-{
-	rsb	lr, r0, #opc_iload_0
-	DISPATCH_START	\seq_len
-	ldr	lr, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-        mov     lr, lr, asl #16
-        mov     lr, lr, lsr #16
-	PUSH	lr
-	DISPATCH_FINISH
-}
-
-(iload,aload,fload)(i2c) {
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, -r2, lsl #2]
-	DISPATCH_NEXT
-        mov     r2, r2, asl #16
-        mov     r2, r2, lsr #16
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-#ifdef NOTICE_SAFEPOINTS
-
-@ --- load; branch -------------------------------------------------------
-
-(iload_0,iload_1,iload_2,iload_3)
-(ifeq,ifnull)
-{
-	rsb	r3, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r3, [locals, r3, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, #0
-	beq	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(ifeq,ifnull) {
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r3, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, #0
-	beq	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ifne,ifnonnull)
-{
-	rsb	r3, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r3, [locals, r3, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, #0
-	bne	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(ifne,ifnonnull) {
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r3, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, #0
-	bne	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(iflt)
-{
-	rsb	r3, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r3, [locals, r3, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, #0
-	blt	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(iflt) {
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r3, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, #0
-	blt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ifge)
-{
-	rsb	r3, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r3, [locals, r3, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, #0
-	bge	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(ifge) {
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r3, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, #0
-	bge	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ifgt)
-{
-	rsb	r3, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r3, [locals, r3, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, #0
-	bgt	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(ifgt) {
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r3, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, #0
-	bgt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(ifle)
-{
-	rsb	r3, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r3, [locals, r3, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, #0
-	ble	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(ifle) {
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r3, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, #0
-	ble	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(if_icmpeq,if_acmpeq)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, r2
-	beq	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(if_icmpeq,if_acmpeq) {
-	POP	r3
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, r2
-	beq	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(if_icmpne,if_acmpne)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, r2
-	bne	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(if_icmpne,if_acmpne) {
-	POP	r3
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, r2
-	bne	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(if_icmplt)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, r2
-	blt	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(if_icmplt) {
-	POP	r3
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, r2
-	blt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(if_icmpge)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, r2
-	bge	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(if_icmpge) {
-	POP	r3
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, r2
-	bge	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(if_icmpgt)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, r2
-	bgt	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(if_icmpgt) {
-	POP	r3
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, r2
-	bgt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(if_icmple)
-{
-	POP	r3
-	rsb	r2, r0, #opc_iload_0
-        ldrsb   r1, [jpc, #2]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #3]
-        cmp     r3, r2
-	ble	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iload,aload,fload)(if_icmple) {
-	POP	r3
-	rsb	r2, r2, #0
-        ldrsb   r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-        ldrb    ip, [jpc, #4]
-        cmp     r3, r2
-	ble	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-@ --- load; return/invoke -------------------------------------------------
-
-(iload_0,iload_1,iload_2,iload_3)
-(ireturn,areturn,freturn)
-{
-	rsb	r0, r0, #opc_iload_0
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	r1, [locals, r0, lsl #2]
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-	cmp	tmp1, tmp2
-	bcc	1f
-2:
-	mov	r3, #0
-	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [stack, #0]
-	ldrh	r0, [r0, #40]
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r1, [stack, r0, lsl #2]!
-
-	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-1:
-	PUSH	r1
-	add	jpc, jpc, #1
-	bl	return_check_monitors
-	POP	r1
-	b	2b
-}
-
-(iload,aload,fload)(ireturn,areturn,freturn) {
-
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	r1, [locals, -r2, lsl #2]
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-	cmp	tmp1, tmp2
-	bcc	1f
-2:
-	mov	r3, #0
-	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [stack, #0]
-	ldrh	r0, [r0, #40]
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r1, [stack, r0, lsl #2]!
-
-	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-1:
-	PUSH	r1
-	add	jpc, jpc, #2
-	bl	return_check_monitors
-	POP	r1
-	b	2b
-}
-
-#endif // NOTICE_SAFEPOINTS
-
-(iload_0,iload_1,iload_2,iload_3)
-(invokeresolved)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_iload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeresolved
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(invokeresolved)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_aload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeresolved
-}
-
-(iload,aload,fload)(invokeresolved) {
-	ldr	r0, [locals, -r2, lsl #2]
-	add	jpc, jpc, #2
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeresolved
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(invokevfinal)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_iload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokevfinal
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(invokevfinal)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_aload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokevfinal
-}
-
-(iload,aload,fload)(invokevfinal) {
-	ldr	r0, [locals, -r2, lsl #2]
-	add	jpc, jpc, #2
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokevfinal
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(invokespecialresolved)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_iload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokespecialresolved
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(invokespecialresolved)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_aload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokespecialresolved
-}
-
-(iload,aload,fload)(invokespecialresolved) {
-	ldr	r0, [locals, -r2, lsl #2]
-	add	jpc, jpc, #2
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokespecialresolved
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(invokestaticresolved)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_iload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokestaticresolved
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(invokestaticresolved)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_aload_0
-	ldr	r0, [locals, r0, lsl #2]
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokestaticresolved
-}
-
-(iload,aload,fload)(invokestaticresolved) {
-	ldr	r0, [locals, -r2, lsl #2]
-	add	jpc, jpc, #2
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokestaticresolved
-
-}
-
-(iload_0,iload_1,iload_2,iload_3)
-(invokeinterface)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_iload_0
-	ldr	r0, [locals, r0, lsl #2]
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeinterface
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(invokeinterface)
-{
-	add	jpc, jpc, #1
-	rsb	r0, r0, #opc_aload_0
-	ldr	r0, [locals, r0, lsl #2]
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeinterface
-}
-
-(iload,aload,fload)(invokeinterface) {
-	ldr	r0, [locals, -r2, lsl #2]
-	add	jpc, jpc, #2
-        ldrb     r2, [jpc, #1]
-        ldrb     r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeinterface
-}
-
-(aload_0,aload_1,aload_2,aload_3)
-(igetfield)
-{
-	add	r0, r0, #opc_iaccess_0-opc_aload_0
-	strb	r0, [jpc]
-	DISPATCH_BYTECODE
-}
-
-@ 13 cycles
-(iload,aload,fload)(igetfield) {
-	ldrb	ip, [jpc, #4]
-	rsb	tmp1, r2, #0
-	ldrb	r3, [jpc, #3]
-	add	tmp2, constpool, ip, lsl #12
-	DISPATCH_START	5
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, r3, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry88:
-	ldr	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-@ --- iconst; store -------------------------------------------------
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)
-(istore_0,istore_1,istore_2,istore_3)
-{
-	sub	r3, r0, #opc_iconst_0
-	DISPATCH_START	\seq_len
-	rsb	r2, r1, #opc_istore_0
-	str	r3, [locals, r2, lsl #2]
-	DISPATCH_BYTECODE
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(astore,istore,fstore) {
-	ldrb	r2, [jpc, #2]
-	sub	r3, r0, #opc_iconst_0
-	DISPATCH_START	\seq_len
-	str	r3, [locals, -r2, lsl #2]
-	DISPATCH_BYTECODE
-}
-
-@ --- iconst; dataop -------------------------------------------------
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(iadd) {
-	sub	tmp1, r0, #opc_iconst_0
-	DISPATCH_START	\seq_len
-	POP	tmp2
-	DISPATCH_NEXT
-	add	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(isub) {
-	sub	tmp1, r0, #opc_iconst_0
-	DISPATCH_START	\seq_len
-	POP	tmp2
-	DISPATCH_NEXT
-	sub	tmp1, tmp2, tmp1
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(idiv) {
-	subs	lr, r0, #opc_iconst_2
-	DISPATCH_START	\seq_len
-	POP	tmp1
-	DISPATCH_NEXT
-	beq	5f
-	bcc	3f
-	cmp	lr, #(opc_iconst_4-opc_iconst_2)
-	beq	4f
-	bcc	2f
-@ divide by 5
-1:
-	mvn	lr, #0x198		@ Form 0x66666667 in lr
-	bic	lr, lr, #0x9800
-	add	lr, lr, lr, lsl #16
-	smull	a3, a4, tmp1, lr
-	mov	a3, tmp1, asr #31
-	rsb	tmp1, a3, a4, asr #1
-	b	6f
-@ divide by 3
-2:
-	mvn	lr, #0xa9		@ Form 0x55555556 in lr
-	bic	lr, lr, #0xaa00
-	add	lr, lr, lr, lsl #16
-        smull   a3, a4, tmp1, lr
-        sub     tmp1, a4, tmp1, asr #31
-	b	6f
-3:
-	cmp	lr, #(opc_iconst_0-opc_iconst_2)
-	beq	div_zero_jpc_1
-	rsbcc	tmp1, tmp1, #0		@ Divide by -1 or 1
-	b	6f
-@ divide by 4
-4:	movs	a4, tmp1
-	addmi	a4, a4, #3
-	mov	tmp1, a4, asr #2
-	b	6f
-@ divide by 2
-5:
-	add	tmp1, tmp1, tmp1, lsr #31
-	mov	tmp1, tmp1, asr #1
-6:
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(ishl) {
-	sub	tmp1, r0, #opc_iconst_0
-	DISPATCH_START	\seq_len
-	POP	r2
-	DISPATCH_NEXT
-	mov	tmp1, r2, lsl tmp1
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@ --- iconst; branch -------------------------------------------------
-
-#ifdef NOTICE_SAFEPOINTS
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpeq) {
-	POP	r3
-	sub	r2, r0, #opc_iconst_0
-        ldrsb   r1, [jpc, #2]
-        cmp     r3, r2
-        ldrb    ip, [jpc, #3]
-	beq	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpne) {
-	POP	r3
-	sub	r2, r0, #opc_iconst_0
-        ldrsb   r1, [jpc, #2]
-        cmp     r3, r2
-        ldrb    ip, [jpc, #3]
-	bne	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmplt) {
-	POP	r3
-	sub	r2, r0, #opc_iconst_0
-        ldrsb   r1, [jpc, #2]
-        cmp     r3, r2
-        ldrb    ip, [jpc, #3]
-	blt	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpge) {
-	POP	r3
-	sub	r2, r0, #opc_iconst_0
-        ldrsb   r1, [jpc, #2]
-        cmp     r3, r2
-        ldrb    ip, [jpc, #3]
-	bge	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmpgt) {
-	POP	r3
-	sub	r2, r0, #opc_iconst_0
-        ldrsb   r1, [jpc, #2]
-        cmp     r3, r2
-        ldrb    ip, [jpc, #3]
-	bgt	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(if_icmple) {
-	POP	r3
-	sub	r2, r0, #opc_iconst_0
-        ldrsb   r1, [jpc, #2]
-        cmp     r3, r2
-        ldrb    ip, [jpc, #3]
-	ble	branch_taken_unsafe_1
-	DISPATCH 4
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(ireturn) {
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	sub	r1, r0, #opc_iconst_0
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-	cmp	tmp1, tmp2
-	bcc	1f
-2:
-	mov	r3, #0
-	ldr	stack, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [stack, #0]
-	ldrh	r0, [r0, #40]
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r1, [stack, r0, lsl #2]!
-
-	str	stack, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-1:
-	PUSH	r1
-	add	jpc, jpc, #1
-	bl	return_check_monitors
-	POP	r1
-	b	2b
-}
-
-#endif // NOTICE_SAFEPOINTS
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokeresolved) {
-	add	jpc, jpc, #1
-	sub	r0, r0, #opc_iconst_0
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokeresolved
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokevfinal) {
-	add	jpc, jpc, #1
-	sub	r0, r0, #opc_iconst_0
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokevfinal
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokestaticresolved) {
-	add	jpc, jpc, #1
-	sub	r0, r0, #opc_iconst_0
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokestaticresolved
-}
-
-(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5)(invokespecialresolved) {
-	add	jpc, jpc, #1
-	sub	r0, r0, #opc_iconst_0
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]
-	PUSH	r0
-	b	do_invokespecialresolved
-}
-
-@# --- Bytecode sequences iaload; xxx -----------------------------------------------
-
-(iaload,faload,aaload)(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5) {
-	sub	r2, r1, #opc_iconst_0
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry38:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #12]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(bipush) {
-	ldrsb	r2, [jpc, #2]
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-.abortentry39:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_3_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #12]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(sipush) {
-	ldrsb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #3]
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	orr	r2, tmp1, r2, lsl #8
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_4
-.abortentry40:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_4_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #12]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(iload,fload,aload) {
-	ldrb	r2, [jpc, #2]
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, -r2, lsl #2]
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-.abortentry41:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_3_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	rsb	r2, r1, #opc_iload_0
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, r2, lsl #2]
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry42:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)
-(aload_0,aload_1,aload_2,aload_3)
-{
-	rsb	r2, r1, #opc_aload_0
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	ldr	r2, [locals, r2, lsl #2]
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry42_1:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	r2, r3
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(iaload,faload,aaload)
-{
-	POP	r2, r3			@ r2 = index, r3 = arrayref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_0
-.abortentry43:
-	ldr	tmp1, [r3, #8]		@ tmp1 = length
-	DISPATCH_START	\seq_len
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_2
-	add	r3, r3, r2, lsl #2
-	POP	lr			@ r2 = index, lr = arrayref
-	ldr	r2, [r3, #BASE_OFFSET_WORD]
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry44:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_1
-	add	lr, lr, r2, lsl #2
-	ldr	r2, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	r2
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(astore,istore,fstore) {
-	ldrb	r2, [jpc, #2]
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_3
-.abortentry45:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_3_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	str	r3, [locals, -r2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)
-(istore_0,istore_1,istore_2,istore_3) {
-	rsb	r2, r1, #opc_istore_0
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry46:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	r3, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	str	r3, [locals, r2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(iastore,fastore) {
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_0
-.abortentry47:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_START	\seq_len
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-
-	POP	r2, r3		@ tmp1 = value, r2 = index, r3 = arrayref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry48:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(bastore) {
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_0
-.abortentry49:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_START	\seq_len
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-
-	POP	r2, r3		@ tmp1 = value, r2 = index, r3 = arrayref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry50:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2
-	strb	tmp1, [r3, #BASE_OFFSET_BYTE]
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(castore,sastore) {
-	POP	r3, lr			@ r3 = index, lr = arrayref
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_0
-.abortentry51:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_START	\seq_len
-	cmp	r3, tmp1
-	bcs	array_bound_exception_jpc_2_r3
-	add	lr, lr, r3, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-
-	POP	r2, r3		@ tmp1 = value, r2 = index, r3 = arrayref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry52:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #1
-	strh	tmp1, [r3, #BASE_OFFSET_BYTE]
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(iand) {
-	POP	r2, r3			@ r2 = index, r3 = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry58:
-	ldr	tmp1, [r3, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_2
-	add	r3, r3, r2, lsl #2
-	ldr	tmp1, [r3, #BASE_OFFSET_WORD]		@ tmp1 = tos
-	POP	r2			@ r2 = tosm1
-	DISPATCH_NEXT
-	and	tmp1, r2, tmp1		@ tosm1 <dop> tos
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(ior) {
-	POP	r2, r3			@ r2 = index, r3 = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry59:
-	ldr	tmp1, [r3, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_2
-	add	r3, r3, r2, lsl #2
-	ldr	tmp1, [r3, #BASE_OFFSET_WORD]		@ tmp1 = tos
-	POP	r2			@ r2 = tosm1
-	DISPATCH_NEXT
-	orr	tmp1, r2, tmp1		@ tosm1 <dop> tos
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iaload,faload,aaload)(ixor) {
-	POP	r2, r3			@ r2 = index, r3 = arrayref
-	DISPATCH_START	\seq_len
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_2
-.abortentry60:
-	ldr	tmp1, [r3, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_2
-	add	r3, r3, r2, lsl #2
-	ldr	tmp1, [r3, #BASE_OFFSET_WORD]		@ tmp1 = tos
-	POP	r2			@ r2 = tosm1
-	DISPATCH_NEXT
-	eor	tmp1, r2, tmp1		@ tosm1 <dop> tos
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@ ---- iadd; xxx ------------------------------------------------------------
-
-(iadd)(iload,fload,aload) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(iadd)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	r3, r1, #opc_iload_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(iadd)(iaload,aaload,faload) {
-	POP	r2, r3, lr		@ lr = ref
-	DISPATCH_START	\seq_len
-	add	r2, r3, r2		@ r2 = index
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry73:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_1
-	add	lr, lr, r2, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iadd)(istore) {
-	mov	r0, #opc_iadd_u4store
-	strb	r0, [jpc]
-	b	do_iadd_u4store
-}
-
-(iadd)
-(istore_0,istore_1,istore_2,istore_3) {
-	mov	r0, #opc_iadd_istore_N
-	strb	r0, [jpc]
-	b	do_iadd_istore_N
-}
-
-(iadd)(iastore,fastore) {
-	POP	r2, r3
-	DISPATCH_START	\seq_len
-	add	tmp1, r3, r2		@ tmp1 = value
-	POP	r2, r3			@ r2, index, r3 = ref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry106:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(iadd)(iadd) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	add	tmp2, r3, r2
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iadd)(isub) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	add	tmp2, r3, r2
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iadd)(iinc) {
-	POP	tmp1, lr
-	DISPATCH_START	\seq_len
-	add	tmp1, lr, tmp1
-        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
-        ldrsb   r2, [jpc, #-1]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	ldr	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r2
-	str	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_FINISH
-}
-@ ---- sub; xxx ------------------------------------------------------------
-
-(isub)(iload,fload,aload) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(isub)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	r3, r1, #opc_iload_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(isub)(iaload,aaload,faload) {
-	POP	r2, r3, lr		@ lr = ref
-	DISPATCH_START	\seq_len
-	sub	r2, r3, r2		@ r2 = index
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry74:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_1
-	add	lr, lr, r2, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(isub)(istore) {
-	mov	r0, #opc_isub_u4store
-	strb	r0, [jpc]
-	b	do_isub_u4store
-}
-
-(isub)
-(istore_0,istore_1,istore_2,istore_3) {
-	mov	r0, #opc_isub_istore_N
-	strb	r0, [jpc]
-	b	do_isub_istore_N
-}
-
-(isub)(iastore,fastore) {
-	POP	r2, r3
-	DISPATCH_START	\seq_len
-	sub	tmp1, r3, r2		@ tmp1 = value
-	POP	r2, r3			@ r2, index, r3 = ref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry105:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(isub)(iadd) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	sub	tmp2, r3, r2
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(isub)(isub) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	sub	tmp2, r3, r2
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(isub)(iinc) {
-	POP	tmp1, lr
-	DISPATCH_START	\seq_len
-	sub	tmp1, lr, tmp1
-        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
-        ldrsb   r2, [jpc, #-1]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	ldr	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r2
-	str	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_FINISH
-}
-@ ---- iand; xxx ------------------------------------------------------------
-
-(iand)(iload,fload,aload) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	and	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(iand)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	r3, r1, #opc_iload_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	and	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(iand)(iaload,aaload,faload) {
-	POP	r2, r3, lr		@ lr = ref
-	DISPATCH_START	\seq_len
-	and	r2, r3, r2		@ r2 = index
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry75:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_1
-	add	lr, lr, r2, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iand)(istore) {
-	mov	r0, #opc_iand_u4store
-	strb	r0, [jpc]
-	b	do_iand_u4store
-}
-
-(iand)
-(istore_0,istore_1,istore_2,istore_3) {
-	mov	r0, #opc_iand_istore_N
-	strb	r0, [jpc]
-	b	do_iand_istore_N
-}
-
-(iand)(iastore,fastore) {
-	POP	r2, r3
-	DISPATCH_START	\seq_len
-	and	tmp1, r3, r2		@ tmp1 = value
-	POP	r2, r3			@ r2, index, r3 = ref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry107:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(iand)(iadd) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	and	tmp2, r3, r2
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iand)(isub) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	and	tmp2, r3, r2
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iand)(iinc) {
-	POP	tmp1, lr
-	DISPATCH_START	\seq_len
-	and	tmp1, lr, tmp1
-        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
-        ldrsb   r2, [jpc, #-1]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	ldr	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r2
-	str	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_FINISH
-}
-@ ---- ior; xxx ------------------------------------------------------------
-
-(ior)(iload,fload,aload) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	orr	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(ior)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	r3, r1, #opc_iload_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	orr	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(ior)(iaload,aaload,faload) {
-	POP	r2, r3, lr		@ lr = ref
-	DISPATCH_START	\seq_len
-	orr	r2, r3, r2		@ r2 = index
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry76:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_1
-	add	lr, lr, r2, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(ior)(istore) {
-	mov	r0, #opc_ior_u4store
-	strb	r0, [jpc]
-	b	do_ior_u4store
-}
-
-(ior)
-(istore_0,istore_1,istore_2,istore_3) {
-	mov	r0, #opc_ior_istore_N
-	strb	r0, [jpc]
-	b	do_ior_istore_N
-}
-
-(ior)(iastore,fastore) {
-	POP	r2, r3
-	DISPATCH_START	\seq_len
-	orr	tmp1, r3, r2		@ tmp1 = value
-	POP	r2, r3			@ r2, index, r3 = ref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry108:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(ior)(iadd) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	orr	tmp2, r3, r2
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(ior)(isub) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	orr	tmp2, r3, r2
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(ior)(iinc) {
-	POP	tmp1, lr
-	DISPATCH_START	\seq_len
-	orr	tmp1, lr, tmp1
-        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
-        ldrsb   r2, [jpc, #-1]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	ldr	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r2
-	str	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ ---- ixor; xxx ------------------------------------------------------------
-
-(ixor)(iload,fload,aload) {
-	ldrb	r3, [jpc, #2]
-	DISPATCH_START	\seq_len
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	eor	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(ixor)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	DISPATCH_START	\seq_len
-	rsb	r3, r1, #opc_iload_0
-	POP	tmp2, tmp1
-	DISPATCH_NEXT
-	ldr	r3, [locals, r3, lsl #2]
-	eor	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(ixor)(iaload,aaload,faload) {
-	POP	r2, r3, lr		@ lr = ref
-	DISPATCH_START	\seq_len
-	eor	r2, r3, r2		@ r2 = index
-	SW_NPC	cmp	lr, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry77:
-	ldr	tmp1, [lr, #8]		@ tmp1 = length
-	DISPATCH_NEXT
-	cmp	r2, tmp1
-	bcs	array_bound_exception_jpc_1
-	add	lr, lr, r2, lsl #2
-	ldr	tmp1, [lr, #BASE_OFFSET_WORD]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(ixor)(istore) {
-	mov	r0, #opc_ixor_u4store
-	strb	r0, [jpc]
-	b	do_ixor_u4store
-}
-
-(ixor)
-(istore_0,istore_1,istore_2,istore_3) {
-	mov	r0, #opc_ixor_istore_N
-	strb	r0, [jpc]
-	b	do_ixor_istore_N
-}
-
-(ixor)(iastore,fastore) {
-	POP	r2, r3
-	DISPATCH_START	\seq_len
-	eor	tmp1, r3, r2		@ tmp1 = value
-	POP	r2, r3			@ r2, index, r3 = ref
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry109:
-	ldr	lr, [r3, #8]		@ lr = limit
-	DISPATCH_NEXT
-	cmp	r2, lr
-	bcs	array_bound_exception_jpc_1
-	DISPATCH_NEXT
-	add	r3, r3, r2, lsl #2
-	str	tmp1, [r3, #BASE_OFFSET_WORD]
-	DISPATCH_FINISH
-}
-
-(ixor)(iadd) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	eor	tmp2, r3, r2
-	DISPATCH_NEXT
-	add	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-        DISPATCH_FINISH
-}
-
-(ixor)(isub) {
-	DISPATCH_START	\seq_len
-	POP	r2, r3, tmp1
-	DISPATCH_NEXT
-	eor	tmp2, r3, r2
-	DISPATCH_NEXT
-	sub	tmp2, tmp1, tmp2
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(ixor)(iinc) {
-	POP	tmp1, lr
-	DISPATCH_START	\seq_len
-	eor	tmp1, lr, tmp1
-        ldrb    r3, [jpc, #-2]	@ jpc now points to next bc
-        ldrsb   r2, [jpc, #-1]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	ldr	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_NEXT
-	add	tmp1, tmp1, r2
-	str	tmp1, [locals, -r3, lsl #2]
-	DISPATCH_FINISH
-}
-
-@ --- iinc; xxx --------------------------------------------------------------
-
-(iinc)(iconst_m1,iconst_0,iconst_1,iconst_2,iconst_3,iconst_4,iconst_5) {
-        ldrsb   tmp1, [jpc, #2]
-	sub	lr, r1, #opc_iconst_0
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	ldr	r3, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	add	r3, r3, tmp1
-	DISPATCH_NEXT
-	PUSH	lr
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iinc)(iload,aload,fload) {
-	ldrb	lr, [jpc, #4]
-        ldrsb   tmp1, [jpc, #2]
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	ldr	r3, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	rsb	lr, lr, #0
-	DISPATCH_NEXT
-	add	r3, r3, tmp1
-	DISPATCH_NEXT
-	str	r3, [locals, tmp2, lsl #2]
-	ldr	tmp1, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iinc)
-(iload_0,iload_1,iload_2,iload_3)
-{
-	rsb	lr, r1, #opc_iload_0
-        ldrsb   tmp1, [jpc, #2]
-	DISPATCH_START	\seq_len
-	rsb	tmp2, r2, #0
-	ldr	r3, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	add	r3, r3, tmp1
-	DISPATCH_NEXT
-	str	r3, [locals, tmp2, lsl #2]
-	DISPATCH_NEXT
-	ldr	tmp1, [locals, lr, lsl #2]
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@###############################################################################
-@# Optimised bytecode triples
-@###############################################################################
-
-(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
-(iload,fload,aload) {
-	ldrb	r2, [jpc, #3]
-	rsb	tmp1, r0, #opc_iaccess_0
-	ldrb	r3, [jpc, #2]
-	add	tmp2, constpool, r2, lsl #12
-	DISPATCH_START	6
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, r3, lsl #4
-	ldrb	r3, [jpc, #-1]
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_5
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	rsb	r3, r3, #0
-.abortentry89:
-	ldr	tmp2, [tmp1, tmp2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
-(iload_0,iload_1,iload_2,iload_3) {
-	ldrb	r2, [jpc, #3]
-	rsb	tmp1, r0, #opc_iaccess_0
-	ldrb	ip, [jpc, #2]
-	add	tmp2, constpool, r2, lsl #12
-	DISPATCH_START	5
-	rsb	r3, r1, #opc_iload_0
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, ip, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_4
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-.abortentry90:
-	ldr	tmp2, [tmp1, tmp2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	PUSH	r3, tmp2
-	DISPATCH_FINISH
-}
-
-(iaccess_0,iaccess_1,iaccess_2,iaccess_3)
-(iadd) {
-	ldrb	r2, [jpc, #3]
-	rsb	tmp1, r0, #opc_iaccess_0
-	ldrb	ip, [jpc, #2]
-	add	tmp2, constpool, r2, lsl #12
-	DISPATCH_START	5
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	add	tmp2, ip, lsl #4
-	DISPATCH_NEXT
-	SW_NPC	cmp	tmp1, #0
-	SW_NPC	beq	null_ptr_exception_jpc_4
-	DISPATCH_NEXT
-        ldr     tmp2, [tmp2, #CP_OFFSET+8]
-	DISPATCH_NEXT
-	POP	r3
-.abortentry91:
-	ldr	tmp2, [tmp1, tmp2]
-	DISPATCH_NEXT
-	add	tmp2, tmp2, r3
-	PUSH	tmp2
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(iadd)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-        ldrb    r2, [jpc, #1-\seq_len]
-        DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        sub     tmp1, r2, #opc_iconst_0
-        DISPATCH_NEXT
-        add     r3, r3, tmp1
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(isub)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-        ldrb    r2, [jpc, #1-\seq_len]
-        DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        sub     tmp1, r2, #opc_iconst_0
-        DISPATCH_NEXT
-        sub     r3, r3, tmp1
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(iand)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-        ldrb    r2, [jpc, #1-\seq_len]
-        DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        sub     tmp1, r2, #opc_iconst_0
-        DISPATCH_NEXT
-        and     r3, r3, tmp1
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(ior)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-        ldrb    r2, [jpc, #1-\seq_len]
-        DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        sub     tmp1, r2, #opc_iconst_0
-        DISPATCH_NEXT
-        orr     r3, r3, tmp1
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(ixor)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-        ldrb    r2, [jpc, #1-\seq_len]
-        DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        sub     tmp1, r2, #opc_iconst_0
-        DISPATCH_NEXT
-        eor     r3, r3, tmp1
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(idiv)
-{
-	rsb	tmp1, r0, #opc_iload_0_iconst_N
-	subs	lr, r2, #opc_iconst_2
-	DISPATCH_START	\seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	DISPATCH_NEXT
-	beq	5f
-	bcc	3f
-	cmp	lr, #(opc_iconst_4-opc_iconst_2)
-	beq	4f
-	bcc	2f
-@ divide by 5
-1:
-	mvn	lr, #0x198		@ Form 0x66666667 in lr
-	bic	lr, lr, #0x9800
-	add	lr, lr, lr, lsl #16
-	smull	a3, a4, tmp1, lr
-	mov	a3, tmp1, asr #31
-	rsb	tmp1, a3, a4, asr #1
-	b	6f
-@ divide by 3
-2:
-	mvn	lr, #0xa9		@ Form 0x55555556 in lr
-	bic	lr, lr, #0xaa00
-	add	lr, lr, lr, lsl #16
-        smull   a3, a4, tmp1, lr
-        sub     tmp1, a4, tmp1, asr #31
-	b	6f
-3:
-	cmp	lr, #(opc_iconst_0-opc_iconst_2)
-	beq	div_zero_jpc_1
-	rsbcc	tmp1, tmp1, #0		@ Divide by -1 or 1
-	b	6f
-@ divide by 4
-4:	movs	a4, tmp1
-	addmi	a4, a4, #3
-	mov	tmp1, a4, asr #2
-	b	6f
-@ divide by 2
-5:
-	add	tmp1, tmp1, tmp1, lsr #31
-	mov	tmp1, tmp1, asr #1
-6:
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iconst_N)
-(iadd)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        DISPATCH_NEXT
-        ldr     r2, [locals, r2, lsl #2]
-        sub     r3, r3, #opc_iconst_0
-        DISPATCH_NEXT
-        add     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iconst_N)
-(isub)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        DISPATCH_NEXT
-        ldr     r2, [locals, r2, lsl #2]
-        sub     r3, r3, #opc_iconst_0
-        DISPATCH_NEXT
-        sub     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iconst_N)
-(iand)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        DISPATCH_NEXT
-        ldr     r2, [locals, r2, lsl #2]
-        sub     r3, r3, #opc_iconst_0
-        DISPATCH_NEXT
-        and     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iconst_N)
-(ior)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        DISPATCH_NEXT
-        ldr     r2, [locals, r2, lsl #2]
-        sub     r3, r3, #opc_iconst_0
-        DISPATCH_NEXT
-        orr     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-@ r2 = [jpc, #1]
-(iload_iconst_N)
-(ixor)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        DISPATCH_NEXT
-        ldr     r2, [locals, r2, lsl #2]
-        sub     r3, r3, #opc_iconst_0
-        DISPATCH_NEXT
-        eor     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(idiv)
-{
-	ldrb	lr, [jpc, #2]
-	rsb	tmp1, r2, #0
-        DISPATCH_START  \seq_len
-	ldr	tmp1, [locals, tmp1, lsl #2]
-	subs	lr, lr, #opc_iconst_2
-	DISPATCH_NEXT
-	beq	5f
-	bcc	3f
-	cmp	lr, #(opc_iconst_4-opc_iconst_2)
-	beq	4f
-	bcc	2f
-@ divide by 5
-1:
-	mvn	lr, #0x198		@ Form 0x66666667 in lr
-	bic	lr, lr, #0x9800
-	add	lr, lr, lr, lsl #16
-	smull	a3, a4, tmp1, lr
-	mov	a3, tmp1, asr #31
-	rsb	tmp1, a3, a4, asr #1
-	b	6f
-@ divide by 3
-2:
-	mvn	lr, #0xa9		@ Form 0x55555556 in lr
-	bic	lr, lr, #0xaa00
-	add	lr, lr, lr, lsl #16
-        smull   a3, a4, tmp1, lr
-        sub     tmp1, a4, tmp1, asr #31
-	b	6f
-3:
-	cmp	lr, #(opc_iconst_0-opc_iconst_2)
-	beq	div_zero_jpc_1
-	rsbcc	tmp1, tmp1, #0		@ Divide by -1 or 1
-	b	6f
-@ divide by 4
-4:	movs	a4, tmp1
-	addmi	a4, a4, #3
-	mov	tmp1, a4, asr #2
-	b	6f
-@ divide by 2
-5:
-	add	tmp1, tmp1, tmp1, lsr #31
-	mov	tmp1, tmp1, asr #1
-6:
-	DISPATCH_NEXT
-	PUSH	tmp1
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(iadd)
-{
-        ldrb    r3, [jpc, #3]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        add     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(iadd)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #opc_iload_0
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        add     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(iadd)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        add     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(iadd)
-{
-	rsb	r3, r2, #opc_iload_0
-	rsb	r2, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        add     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(isub)
-{
-        ldrb    r3, [jpc, #3]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        sub     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(isub)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #opc_iload_0
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        sub     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(isub)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        sub     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(isub)
-{
-	rsb	r3, r2, #opc_iload_0
-	rsb	r2, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        sub     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(iand)
-{
-        ldrb    r3, [jpc, #3]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        and     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(iand)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #opc_iload_0
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        and     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(iand)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        and     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(iand)
-{
-	rsb	r3, r2, #opc_iload_0
-	rsb	r2, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        and     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(ior)
-{
-        ldrb    r3, [jpc, #3]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        orr     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(ior)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #opc_iload_0
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        orr     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(ior)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        orr     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(ior)
-{
-	rsb	r3, r2, #opc_iload_0
-	rsb	r2, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-        ldr     r2, [locals, r2, lsl #2]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        orr     r3, r2, r3
-	DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(ixor)
-{
-        ldrb    r3, [jpc, #3]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        eor     r3, r2, r3
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(ixor)
-{
-        ldrb    r3, [jpc, #2]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #opc_iload_0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        eor     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(ixor)
-{
-        ldrb    r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-        DISPATCH_START  \seq_len
-        rsb     r3, r3, #0
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        eor     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-        DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(ixor)
-{
-	rsb	r3, r2, #opc_iload_0
-	rsb	r2, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-        ldr     r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        eor     r3, r2, r3
-        DISPATCH_NEXT
-        DISPATCH_NEXT
-        PUSH    r3
-	DISPATCH_FINISH
-}
-
-@ Former quads
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(iadd_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        add     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(iadd_u4store)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #5]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        add     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(iadd_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        add     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(iadd_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #4]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #opc_istore_0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        add     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(isub_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(isub_u4store)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #5]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(isub_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(isub_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #4]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #opc_istore_0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(iand_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        and     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(iand_u4store)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #5]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        and     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(iand_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        and     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(iand_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #4]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #opc_istore_0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        and     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(ior_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(ior_u4store)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #5]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(ior_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(ior_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #4]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #opc_istore_0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(ixor_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(ixor_u4store)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #5]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(ixor_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iconst_N
-        DISPATCH_START  \seq_len
-	sub	r2, r2, #opc_iconst_0
-	DISPATCH_NEXT
-        ldrb    tmp1, [jpc, #-1]
-        ldr     r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iconst_N)
-(ixor_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-        ldrb    lr, [jpc, #4]
-        rsb     r2, r2, #0
-        DISPATCH_START  \seq_len
-	sub	r3, r3, #opc_iconst_0
-	DISPATCH_NEXT
-        rsb     tmp2, lr, #opc_istore_0
-	DISPATCH_NEXT
-        ldr     tmp1, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-#ifdef NOTICE_SAFEPOINTS
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(if_icmpeq,if_acmpeq)
-{
-	ldrb	r3, [jpc, #1]
-	rsb	r2, r0, #opc_iload_0_iconst_N
-	ldrsb	r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	beq	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iconst_N)
-(if_icmpeq,if_acmpeq)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	beq	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(if_icmpne,if_acmpne)
-{
-	ldrb	r3, [jpc, #1]
-	rsb	r2, r0, #opc_iload_0_iconst_N
-	ldrsb	r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	bne	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iconst_N)
-(if_icmpne,if_acmpne)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bne	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(if_icmplt)
-{
-	ldrb	r3, [jpc, #1]
-	rsb	r2, r0, #opc_iload_0_iconst_N
-	ldrsb	r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	blt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iconst_N)
-(if_icmplt)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	blt	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(if_icmpge)
-{
-	ldrb	r3, [jpc, #1]
-	rsb	r2, r0, #opc_iload_0_iconst_N
-	ldrsb	r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	bge	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iconst_N)
-(if_icmpge)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bge	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(if_icmpgt)
-{
-	ldrb	r3, [jpc, #1]
-	rsb	r2, r0, #opc_iload_0_iconst_N
-	ldrsb	r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	bgt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iconst_N)
-(if_icmpgt)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bgt	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iconst_N,iload_1_iconst_N,iload_2_iconst_N,iload_3_iconst_N)
-(if_icmple)
-{
-	ldrb	r3, [jpc, #1]
-	rsb	r2, r0, #opc_iload_0_iconst_N
-	ldrsb	r1, [jpc, #3]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	ble	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iconst_N)
-(if_icmple)
-{
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	ldr	r2, [locals, r2, lsl #2]
-	sub	r3, r3, #opc_iconst_0
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	ble	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-#endif // NOTICE_SAFEPOINTS
-
-(iload_iload)
-(iadd_istore_N)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	add	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(iadd_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #4]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	add	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(iadd_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #4]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        add     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(iadd_istore_N)
-{
-	ldrb	tmp1, [jpc, #3]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        add     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(isub_istore_N)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	sub	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(isub_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #4]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	sub	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(isub_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #4]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(isub_istore_N)
-{
-	ldrb	tmp1, [jpc, #3]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(iand_istore_N)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	and	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(iand_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #4]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	and	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(iand_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #4]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        and     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(iand_istore_N)
-{
-	ldrb	tmp1, [jpc, #3]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        and     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(ior_istore_N)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	orr	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(ior_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #4]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	orr	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(ior_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #4]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(ior_istore_N)
-{
-	ldrb	tmp1, [jpc, #3]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(ixor_istore_N)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	eor	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(ixor_istore_N)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #4]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #opc_istore_0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	eor	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(ixor_istore_N)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #4]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(ixor_istore_N)
-{
-	ldrb	tmp1, [jpc, #3]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #opc_istore_0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(iadd_u4store)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #6]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	add	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(iadd_u4store)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	add	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(iadd_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #5]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        add     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(iadd_u4store)
-{
-	ldrb	tmp1, [jpc, #4]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        add     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(isub_u4store)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #6]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	sub	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(isub_u4store)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	sub	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(isub_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #5]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(isub_u4store)
-{
-	ldrb	tmp1, [jpc, #4]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        sub     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(iand_u4store)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #6]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	and	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(iand_u4store)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	and	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(iand_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #5]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        and     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(iand_u4store)
-{
-	ldrb	tmp1, [jpc, #4]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        and     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(ior_u4store)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #6]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	orr	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(ior_u4store)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	orr	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(ior_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #5]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(ior_u4store)
-{
-	ldrb	tmp1, [jpc, #4]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        orr     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload)
-(ixor_u4store)
-{
-	ldrb	r3, [jpc, #3]
-	ldrb	lr, [jpc, #6]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	eor	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_iload_N)
-(ixor_u4store)
-{
-	ldrb	r3, [jpc, #2]
-	ldrb	lr, [jpc, #5]
-	rsb	r2, r2, #0
-        DISPATCH_START  \seq_len
-	rsb	r3, r3, #opc_iload_0
-	DISPATCH_NEXT
-	rsb	tmp2, lr, #0
-	ldr	tmp1, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	eor	r3, tmp1, r3
-	DISPATCH_NEXT
-        str     r3, [locals, tmp2, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(ixor_u4store)
-{
-        rsb     r3, r0, #opc_iload_0_iload
-	ldrb	r2, [jpc, #2]
-	ldrb	tmp1, [jpc, #5]
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(ixor_u4store)
-{
-	ldrb	tmp1, [jpc, #4]
-	rsb	r3, r0, #opc_iload_0_iload_N
-        DISPATCH_START  \seq_len
-	rsb	r2, r2, #opc_iload_0
-	DISPATCH_NEXT
-        ldr     r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	DISPATCH_NEXT
-        eor     r3, r3, r2
-	DISPATCH_NEXT
-	rsb	tmp1, tmp1, #0
-	DISPATCH_NEXT
-        str     r3, [locals, tmp1, lsl #2]
-	DISPATCH_FINISH
-}
-
-#ifdef NOTICE_SAFEPOINTS
-
-(iload_iload)
-(if_icmpeq,if_acmpeq) {
-	ldrb	r3, [jpc, #3]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #5]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #6]
-	cmp	r2, r3
-	beq	branch_taken_unsafe_4
-	DISPATCH 7
-}
-
-(iload_iload_N)
-(if_icmpeq,if_acmpeq) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #opc_iload_0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	beq	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(if_icmpeq,if_acmpeq) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	beq	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(if_icmpeq,if_acmpeq) {
-	rsb	r3, r2, #opc_iload_0
-	ldrsb	r1, [jpc, #3]
-	rsb	r2, r0, #opc_iload_0_iload_N
-	ldr	r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	beq	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iload)
-(if_icmpne,if_acmpne) {
-	ldrb	r3, [jpc, #3]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #5]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #6]
-	cmp	r2, r3
-	bne	branch_taken_unsafe_4
-	DISPATCH 7
-}
-
-(iload_iload_N)
-(if_icmpne,if_acmpne) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #opc_iload_0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bne	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(if_icmpne,if_acmpne) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bne	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(if_icmpne,if_acmpne) {
-	rsb	r3, r2, #opc_iload_0
-	ldrsb	r1, [jpc, #3]
-	rsb	r2, r0, #opc_iload_0_iload_N
-	ldr	r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	bne	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iload)
-(if_icmplt) {
-	ldrb	r3, [jpc, #3]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #5]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #6]
-	cmp	r2, r3
-	blt	branch_taken_unsafe_4
-	DISPATCH 7
-}
-
-(iload_iload_N)
-(if_icmplt) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #opc_iload_0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	blt	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(if_icmplt) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	blt	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(if_icmplt) {
-	rsb	r3, r2, #opc_iload_0
-	ldrsb	r1, [jpc, #3]
-	rsb	r2, r0, #opc_iload_0_iload_N
-	ldr	r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	blt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iload)
-(if_icmpge) {
-	ldrb	r3, [jpc, #3]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #5]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #6]
-	cmp	r2, r3
-	bge	branch_taken_unsafe_4
-	DISPATCH 7
-}
-
-(iload_iload_N)
-(if_icmpge) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #opc_iload_0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bge	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(if_icmpge) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bge	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(if_icmpge) {
-	rsb	r3, r2, #opc_iload_0
-	ldrsb	r1, [jpc, #3]
-	rsb	r2, r0, #opc_iload_0_iload_N
-	ldr	r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	bge	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iload)
-(if_icmpgt) {
-	ldrb	r3, [jpc, #3]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #5]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #6]
-	cmp	r2, r3
-	bgt	branch_taken_unsafe_4
-	DISPATCH 7
-}
-
-(iload_iload_N)
-(if_icmpgt) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #opc_iload_0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bgt	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(if_icmpgt) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	bgt	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(if_icmpgt) {
-	rsb	r3, r2, #opc_iload_0
-	ldrsb	r1, [jpc, #3]
-	rsb	r2, r0, #opc_iload_0_iload_N
-	ldr	r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	bgt	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-(iload_iload)
-(if_icmple) {
-	ldrb	r3, [jpc, #3]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #5]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #6]
-	cmp	r2, r3
-	ble	branch_taken_unsafe_4
-	DISPATCH 7
-}
-
-(iload_iload_N)
-(if_icmple) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r2, #0
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #opc_iload_0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	ble	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload,iload_1_iload,iload_2_iload,iload_3_iload)
-(if_icmple) {
-	ldrb	r3, [jpc, #2]
-	rsb	r2, r0, #opc_iload_0_iload
-	ldrsb	r1, [jpc, #4]
-	rsb	r3, r3, #0
-	ldr	r2, [locals, r2, lsl #2]
-	ldr	r3, [locals, r3, lsl #2]
-	ldrb	ip, [jpc, #5]
-	cmp	r2, r3
-	ble	branch_taken_unsafe_3
-	DISPATCH 6
-}
-
-(iload_0_iload_N,iload_1_iload_N,iload_2_iload_N,iload_3_iload_N)
-(if_icmple) {
-	rsb	r3, r2, #opc_iload_0
-	ldrsb	r1, [jpc, #3]
-	rsb	r2, r0, #opc_iload_0_iload_N
-	ldr	r3, [locals, r3, lsl #2]
-	ldr	r2, [locals, r2, lsl #2]
-	ldrb	ip, [jpc, #4]
-	cmp	r2, r3
-	ble	branch_taken_unsafe_2
-	DISPATCH 5
-}
-
-#endif
-
-#endif // FAST_BYTECODES
--- a/ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6336 +0,0 @@
-@ Copyright 2009, 2010 Edward Nevill
-@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-@
-@ This code is free software; you can redistribute it and/or modify it
-@ under the terms of the GNU General Public License version 2 only, as
-@ published by the Free Software Foundation.
-@
-@ This code 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
-@ version 2 for more details (a copy is included in the LICENSE file that
-@ accompanied this code).
-@
-@ You should have received a copy of the GNU General Public License version
-@ 2 along with this work; if not, write to the Free Software Foundation,
-@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-#undef THUMB2EE
-#if !defined(DISABLE_THUMB2) && defined(HOTSPOT_ASM) && !defined(SHARK)
-#define THUMB2EE
-#endif
-
-#ifdef HOTSPOT_ASM
-
-#define ARMv4
-
-#if defined(SHARK) || defined(THUMB2EE)
-
-#define USE_COMPILER
-
-#endif
-
-#ifdef USE_COMPILER
-
-#ifdef SHARK
-#define MP_COMPILE_THRESHOLD    0x10000         // 65536 - must be a single MOV constant
-#define UP_COMPILE_THRESHOLD    0x30000         // 196608 - must be a single MOV constant
-#else
-#define MP_COMPILE_THRESHOLD    0x2700		// 10000 - must be a single MOV constant
-#define UP_COMPILE_THRESHOLD    0x2700		// 10000 - must be a single MOV constant
-#endif
-
-#define MAX_FG_METHOD_SIZE      500
-
-#ifndef DISABLE_ON_STACK_REPLACEMENT
-#define ON_STACK_REPLACEMENT
-#endif
-#ifndef ENABLE_BG_COMP_ON_NON_MP
-#define DISABLE_BG_COMP_ON_NON_MP
-#endif
-
-#ifdef THUMB2EE
-#define FREQ_COUNT_OVERFLOW Thumb2_Compile
-#else
-#define FREQ_COUNT_OVERFLOW _ZN18InterpreterRuntime26frequency_counter_overflowEP10JavaThreadPh
-#endif
-
-#endif // USE_COMPILER
-
-#ifndef DISABLE_NOTICE_SAFEPOINTS
-#define NOTICE_SAFEPOINTS
-#endif
-#ifndef DISABLE_HW_NULL_PTR_CHECK
-#define HW_NULL_PTR_CHECK
-#endif
-#ifndef DISABLE_FAST_BYTECODES
-#define FAST_BYTECODES
-#endif
-#ifndef DISABLE_HW_FP
-#define HW_FP
-#endif
-
-#define LEAF_STACK_SIZE	200
-#define STACK_SPARE	40
-
-#define stack		r4
-#define	jpc		r5
-#define dispatch	r6
-#define locals		r7
-#define istate		r8
-#define constpool	r9
-#define arm_sp		r13
-
-#define tmp_xxx		r7
-#define tmp_yyy		r5
-#define tmp_vvv		r9
-
-#define tmp1		r11
-#define tmp2		r10
-
-#define regset		r4,r5,r6,r7,r9,r10,r11
-#define fast_regset	r8
-
-#include "offsets_arm.s"
-
-#define last_implemented_bytecode 201
-
-#define CODE_ALIGN_SIZE 64
-
-	.macro	ALIGN_CODE
-	.align	6
-	.endm
-
-	.macro	ALIGN_DATA
-	.align	6
-	.endm
-
-	.macro	ALIGN_OPCODE
-	.align	6
-	.endm
-
-	.macro	ALIGN_WORD
-	.align	2
-	.endm
-
-@------------------------------------------------
-@ Software NULL Pointer check macro.
-@ Usage:
-@	SW_NPC	cmp	obj, #0
-@	SW_NPC	beq	null_ptr_exception
-@------------------------------------------------
-	.macro	SW_NPC	p1, p2, p3, p4
-#ifndef HW_NULL_PTR_CHECK
-  .ifnes "\p4", ""
-	\p1 \p2, \p3, \p4
-  .else
-    .ifnes "\p3", ""
-	\p1 \p2, \p3
-    .else
-	\p1 \p2
-    .endif
-  .endif
-#endif // HW_NULL_PTR_CHECK
-	.endm
-
-	.macro	HW_NPC	p1, p2, p3, p4
-#ifdef HW_NULL_PTR_CHECK
-  .ifnes "\p4", ""
-	\p1 \p2, \p3, \p4
-  .else
-    .ifnes "\p3", ""
-	\p1 \p2, \p3
-    .else
-	\p1 \p2
-    .endif
-  .endif
-#endif // HW_NULL_PTR_CHECK
-	.endm
-
-@------------------------------------------------
-@ Fast Bytecode Macros FBC and NFBC
-@ Use to conditionalise code using fast bytecodes
-@ EG:
-@	FBC	mov	r0, #opc_invokeresolved
-@	FBC	b	rewrite_bytecode
-@	NFBC	code to handle slow case
-@	NFBC	...
-@------------------------------------------------
-	.macro	FBC	p1, p2, p3, p4, p5
-#ifdef FAST_BYTECODES
-  .ifnes "\p5", ""
-	  \p1 \p2, \p3, \p4, \p5
-  .else
-    .ifnes "\p4", ""
-	  \p1 \p2, \p3, \p4
-    .else
-      .ifnes "\p3", ""
-	  \p1 \p2, \p3
-      .else
-	  \p1 \p2
-      .endif
-    .endif
-  .endif
-#endif
-	.endm
-
-	.macro	NFBC	p1, p2, p3, p4
-#ifndef FAST_BYTECODES
-  .ifnes "\p4", ""
-	\p1 \p2, \p3, \p4
-  .else
-    .ifnes "\p3", ""
-	\p1 \p2, \p3
-    .else
-	\p1 \p2
-    .endif
-  .endif
-#endif
-	.endm
-
-@------------------------------------------------
-@ Notice Safepoints macro
-@ Usage:
-@	NSP	<notice safepoint specific code>
-@------------------------------------------------
-	.macro	NSP	p1, p2, p3, p4, p5
-#ifdef NOTICE_SAFEPOINTS
-  .ifnes "\p5", ""
-	  \p1 \p2, \p3, \p4, \p5
-  .else
-    .ifnes "\p4", ""
-	  \p1 \p2, \p3, \p4
-    .else
-      .ifnes "\p3", ""
-	  \p1 \p2, \p3
-      .else
-	  \p1 \p2
-      .endif
-    .endif
-  .endif
-#endif
-	.endm
-
-@------------------------------------------------
-@ Use Compiler macro
-@ Usage:
-@	USEC	<compiler specific code>
-@------------------------------------------------
-	.macro	USEC	p1, p2, p3, p4
-#ifdef USE_COMPILER
-  .ifnes "\p4", ""
-	\p1 \p2, \p3, \p4
-  .else
-    .ifnes "\p3", ""
-	\p1 \p2, \p3
-    .else
-	\p1 \p2
-    .endif
-  .endif
-#endif
-	.endm
-
-@------------------------------------------------
-@ On stack replacement macro
-@ Usage:
-@       OSR     <compiler specific code>
-@------------------------------------------------
-        .macro  OSR     p1, p2, p3, p4
-#ifdef ON_STACK_REPLACEMENT
-  .ifnes "\p4", ""
-        \p1 \p2, \p3, \p4
-  .else
-    .ifnes "\p3", ""
-        \p1 \p2, \p3
-    .else
-        \p1 \p2
-    .endif
-  .endif
-#endif
-        .endm
-@------------------------------------------------
-@ THUMB2 specific code macro
-@ Usage:
-@	T2	<thumb2 specific code>
-@------------------------------------------------
-	.macro	T2	p1, p2, p3, p4
-#ifdef THUMB2EE
-  .ifnes "\p4", ""
-        \p1 \p2, \p3, \p4
-  .else
-    .ifnes "\p3", ""
-        \p1 \p2, \p3
-    .else
-        \p1 \p2
-    .endif
-  .endif
-#endif
-        .endm
-
-	.macro	Opcode	label
-	ALIGN_OPCODE
-do_\label:
-	.endm
-
-	.macro	GET_STACK	offset, reg
-	ldr	\reg, [stack, #(\offset+1) * 4]
-	.endm
-
-	.macro	PUT_STACK	offset, reg
-	str	\reg, [stack, #(\offset+1) * 4]
-	.endm
-
-#define PUSH	java_push
-	.macro	PUSH	reg1, reg2, reg3, reg4
-  .ifnes "\reg4", ""
-	stmda	stack!, {\reg1, \reg2, \reg3, \reg4}
-  .else
-    .ifnes "\reg3", ""
-	stmda	stack!, {\reg1, \reg2, \reg3}
-    .else
-      .ifnes "\reg2", ""
-	stmda	stack!, {\reg1, \reg2}
-      .else
-	str	\reg1, [stack], #-4
-      .endif
-    .endif
-  .endif
-	.endm
-
-#define POP	java_pop
-	.macro	POP	reg1, reg2, reg3, reg4
-  .ifnes "\reg4", ""
-	ldmib	stack!, {\reg1, \reg2, \reg3, \reg4}
-  .else
-    .ifnes "\reg3", ""
-	ldmib	stack!, {\reg1, \reg2, \reg3}
-    .else
-      .ifnes "\reg2", ""
-	ldmib	stack!, {\reg1, \reg2}
-      .else
-	ldr	\reg1, [stack, #4]!
-      .endif
-    .endif
-  .endif
-	.endm
-
-	.macro	CACHE_JPC
-	ldr	jpc, [istate, #ISTATE_BCP]
-	.endm
-
-	.macro	CACHE_LOCALS
-	ldr	locals, [istate, #ISTATE_LOCALS]
-	.endm
-
-	.macro	CACHE_STACK
-	ldr	stack, [istate, #ISTATE_STACK]
-	.endm
-
-	.macro	CACHE_CP
-	ldr	constpool, [istate, #ISTATE_CONSTANTS]
-	.endm
-
-	.macro	DECACHE_STACK
-	str	stack, [istate, #ISTATE_STACK]
-	.endm
-
-	.macro	DECACHE_JPC
-	str	jpc, [istate, #ISTATE_BCP]
-	.endm
-
-	.macro	BREAK_DISPATCH
-	ldr	r1, [dispatch, #DispatchBreakPoint-XXX]
-	cmp	r1, jpc
-	bleq	do_dispatch_break
-	.endm
-
-	.set	dispatch_state, 0
-
-	.macro	DISPATCH_STATE	state
-	.set	dispatch_state, \state
-	.endm
-
-	.macro	DISPATCH_START	step=0
-	.set	dispatch_state, 1
-	ldrb	r0, [jpc, #\step]!
-	.endm
-
-	.macro	DISPATCH_START_REG	reg
-	.set	dispatch_state, 1
-	ldrb	r0, [jpc, \reg]!
-	.endm
-
-	.macro	DISPATCH_START_R2_R0
-	.set	dispatch_state, 1
-	mov	r0, r2
-	.endm
-
-	.macro	DISPATCH_START_R2_JPC
-	.set	dispatch_state, 1
-	add	jpc, jpc, #1
-	.endm
-
-	.macro	DISPATCH_START_R2
-	.set	dispatch_state, 1
-	add	jpc, jpc, #1
-	mov	r0, r2
-	.endm
-
-	.macro	DISPATCH_1
-@        ldrb    r1, [jpc, #2]
-	.endm
-
-	.macro	DISPATCH_2
-        ldr     ip, [dispatch, r0, lsl #2]
-	.endm
-
-	.macro	DISPATCH_3
-        ldrb    r2, [jpc, #1]
-	.endm
-
-	.macro	DISPATCH_4
-        ands    lr, ip, #7
-	.endm
-
-	.macro	DISPATCH_NEXT
-    .if dispatch_state == 0
-	.error	"DISPATCH_FINISH without a DISPATCH_START or DISPATCH_STATE"
-    .elseif dispatch_state == 1
-	DISPATCH_1
-    .elseif dispatch_state == 2
-	DISPATCH_2
-    .elseif dispatch_state == 3
-	DISPATCH_3
-    .elseif dispatch_state == 4
-	DISPATCH_4
-    .else
-	.error "Too many DISPATCH_NEXTs"
-    .endif
-	.set	dispatch_state, dispatch_state + 1
-	.endm
-
-	.macro	DISPATCH_FINISH
-    .if dispatch_state == 0
-	.error	"DISPATCH_FINISH without a DISPATCH_START or DISPATCH_STATE"
-    .elseif dispatch_state == 1
-	DISPATCH_1
-	DISPATCH_2
-	DISPATCH_3
-	DISPATCH_4
-    .elseif dispatch_state == 2
-	DISPATCH_2
-	DISPATCH_3
-	DISPATCH_4
-    .elseif dispatch_state == 3
-	DISPATCH_3
-	DISPATCH_4
-    .elseif dispatch_state == 4
-	DISPATCH_4
-    .endif
-        moveq   pc, ip
-	ldrb	r1, [jpc, lr]
-        bic     ip, ip, #7
-        ldr     pc, [ip, r1, lsl #2]
-	.set	dispatch_state, 0
-	.endm
-
-	.macro	DISPATCH_BYTECODE
-@        ldrb    r1, [jpc, #2]
-        ldr     ip, [dispatch, r0, lsl #2]
-        ldrb    r2, [jpc, #1]
-        ands    lr, ip, #7
-        moveq   pc, ip
-	ldrb	r1, [jpc, lr]
-        bic     ip, ip, #7
-        ldr     pc, [ip, r1, lsl #2]
-	.endm
-
-	.macro	DISPATCH step=0
-	ldrb	r0, [jpc, #\step]!
-@        ldrb    r1, [jpc, #2]
-        ldr     ip, [dispatch, r0, lsl #2]
-        ldrb    r2, [jpc, #1]
-        ands    lr, ip, #7
-        moveq   pc, ip
-	ldrb	r1, [jpc, lr]
-        bic     ip, ip, #7
-        ldr     pc, [ip, r1, lsl #2]
-	.endm
-
-#define FFI_TYPE_VOID		0
-#define FFI_TYPE_FLOAT		2
-#define	FFI_TYPE_DOUBLE		3
-#define FFI_TYPE_BOOL		5
-#define	FFI_TYPE_SINT8		6
-#define FFI_TYPE_UINT16		7
-#define FFI_TYPE_SINT16		8
-#define FFI_TYPE_SINT32		10
-#define FFI_TYPE_SINT64		12
-#define FFI_TYPE_POINTER	14
-
-	.macro	_BLX	reg
-	mov	lr, pc
-	mov	pc, \reg
-	.endm
-
-	.macro	_BX	reg
-	mov	pc, \reg
-	.endm
-
-	.macro	_BXEQ	reg
-	moveq	pc, \reg
-	.endm
-
-	.macro	_BXNE	reg
-	movne	pc, \reg
-	.endm
-
-#ifdef ARMv4
-
-#define blx _BLX
-#define bx _BX
-#define bxeq _BXEQ
-#define bxne _BXNE
-	.arch armv4
-
-#else
-	.arch armv7-a
-#endif
-#ifdef HW_FP
-	.fpu vfp
-#else
-	.fpu softvfp
-#endif
-	.eabi_attribute 20, 1
-	.eabi_attribute 21, 1
-	.eabi_attribute 23, 3
-	.eabi_attribute 24, 1
-	.eabi_attribute 25, 1
-	.eabi_attribute 26, 2
-	.eabi_attribute 30, 2
-	.eabi_attribute 18, 4
-
-	.text
-
-	.global	cmpxchg_ptr
-cmpxchg_ptr:
-	stmfd	sp!, {r4, r5, r6, r7, r8, lr}
-	mov	r6, #0xffffffc0
-	mov	r4, r2
-	mov	r7, r0
-	mov	r5, r1
-	bic	r6, r6, #0xf000
-	mov	r8, r2
-1:
-	ldr	r3, [r5, #0]
-	mov	r0, r4
-	mov	r1, r7
-	mov	r2, r5
-	cmp	r4, r3
-	bne	2f
-	blx	r6
-	cmp	r0, #0
-	bne	1b
-	mov	r0, r8
-	ldmfd	sp!, {r4, r5, r6, r7, r8, pc}
-2:
-	mov	r8, r3
-	mov	r0, r8
-	ldmfd	sp!, {r4, r5, r6, r7, r8, pc}
-
-build_frame:
-	mov	r3, r0
-	ldr	r0, [r1, #METHOD_ACCESSFLAGS]
-	stmfd	arm_sp!, {r4, r5, r6, r7, r8}
-	ands	r7, r0, #JVM_ACC_SYNCHRONIZED
-	movne	r7, #2
-	tst	r0, #JVM_ACC_NATIVE
-	mov	r4, #0
-	movne	r5, #0
-	ldreqh	r6, [r1, #METHOD_MAXLOCALS]
-	ldrneh	r6, [r1, #METHOD_SIZEOFPARAMETERS]
-	ldreq	r0, [r3, #8]
-	subeq	r6, r6, #1
-	ldrne	r0, [r3, #8]
-	subne	r6, r6, #1
-	ldreqh	r5, [r1, #METHOD_MAXSTACK]
-	addeq	r6, r0, r6, asl #2
-	addne	r6, r0, r6, asl #2
-	sub	ip, r0, #4
-	str	ip, [r3, #8]
-	mov     ip, #INTERPRETER_FRAME
-	str	r4, [r0, #-4]
-	ldr	r0, [r3, #8]
-	sub	r8, r0, #4
-	str	r8, [r3, #8]
-	str	ip, [r0, #-4]
-	ldr	r8, [r3, #8]
-	sub	ip, r8, #68
-	str	ip, [r3, #8]
-	str	r2, [r8, #-68]
-	mov	r8, #0
-	str	r4, [ip, #44]
-	str	r6, [ip, #8]
-	str	r1, [ip, #16]
-	str	ip, [ip, #64]
-	ldr	r2, [r1, #METHOD_ACCESSFLAGS]
-	tst	r2, #JVM_ACC_NATIVE
-	mov	r2, #0
-	ldreq	r4, [r1, #METHOD_CONSTMETHOD]
-	addeq	r4, r4, #CONSTMETHOD_CODEOFFSET
-	str	r4, [ip, #4]
-	ldr	r4, [r1, #METHOD_CONSTANTS]
-	ldr	r4, [r4, #CONSTANTPOOL_CACHE]
-	str	r8, [ip, #28]
-	str	r2, [ip, #32]
-	str	r4, [ip, #12]
-	str	r2, [ip, #48]
-	str	r2, [ip, #20]
-	ldr	r2, [r3, #8]
-	str	r2, [ip, #60]
-	ldr	r2, [r1, #METHOD_ACCESSFLAGS]
-	tst	r2, #JVM_ACC_SYNCHRONIZED
-	beq	.L10
-	ldr	r2, [r3, #8]
-	sub	r7, r2, r7, asl #2
-	str	r7, [r3, #8]
-	ldr	r2, [r1, #METHOD_ACCESSFLAGS]
-	tst	r2, #JVM_ACC_STATIC
-	ldrne	r2, [r1, #METHOD_CONSTANTS]
-	ldreq	r2, [r6, #0]
-	ldrne	r2, [r2, #16]
-	ldrne	r2, [r2, #60]
-	str	r2, [r7, #4]
-.L10:
-	ldr	r2, [r3, #8]
-	cmp	r5, #0
-	str	r2, [ip, #52]
-	ldr	r2, [r3, #8]
-	sub	r2, r2, #4
-	str	r2, [ip, #24]
-	ldrne	r2, [r3, #8]
-	ldreq	r5, [r3, #8]
-	subne	r5, r2, r5, asl #2
-	strne	r5, [r3, #8]
-	sub	r5, r5, #4
-	str	r5, [ip, #56]
-	ldmfd	arm_sp!, {r4, r5, r6, r7, r8}
-	bx	lr
-
-	ALIGN_CODE
-	.global	asm_generate_method_entry
-asm_generate_method_entry:
-	mov	r3, r0
-	mov	r0, #0
-#ifdef PRODUCT
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r1, r2}
-	add	r1, r1, ip
-	add	r1, r1, r2		@ r1->dispatch
-
-	ldr	r2, [r1, #can_post_interpreter_events-XXX]
-	ldrb	r2, [r2]
-	cmp	r2, #0
-	bne	1f
-
-	ldr	r2, [r1, #PrintCommandLineFlags_Address-XXX]
-	ldrb	r2, [r2]
-	cmp	r2, #0
-	bne	1f
-
-	cmp	r3, #14
-	adrcc	ip, asm_method_table
-	ldrcc	r0, [ip, r3, lsl #2]
-1:
-#endif // PRODUCT
-	bx	lr
-asm_method_table:
-	.word	normal_entry
-	.word	normal_entry_synchronized
-	.word	native_entry
-	.word	native_entry_synchronized
-	.word	empty_entry
-	.word	accessor_entry
-	.word	normal_entry		@ abstract entry
-	.word	normal_entry		@ java_lang_math_sin
-	.word	normal_entry		@ java_lang_math_cos
-	.word	normal_entry		@ java_lang_math_tan
-	.word	normal_entry		@ java_lang_math_abs
-	.word	normal_entry		@ java_lang_math_sqrt
-	.word	normal_entry		@ java_lang_math_log
-	.word	normal_entry		@ java_lang_math_log10
-
-	ALIGN_CODE
-native_entry_synchronized:
-	b	fast_native_entry_synchronized
-
-	ALIGN_CODE
-fast_native_entry_synchronized:
-	b	_ZN14CppInterpreter12native_entryEP13methodOopDesciP6Thread
-
-	ALIGN_CODE
-empty_entry:
-	b	fast_empty_entry
-
-	ALIGN_CODE
-fast_empty_entry:
-	ldr	r3, .L1359
-	ldr	r1, .L1359+4
-.LPIC19:
-	add	r3, pc, r3
-
-	ldr	ip, [r3, r1]
-	ldr	r3, [ip, #0]
-	cmp	r3, #0
-	bne	normal_entry_synchronized
-
-	ldrh	r3, [r0, #42]
-	ldr	r1, [r2, #THREAD_JAVA_SP]
-	add	r1, r1, r3, lsl #2
-	str	r1, [r2, #THREAD_JAVA_SP]
-	bx	lr
-.L1359:
-	.word	_GLOBAL_OFFSET_TABLE_-(.LPIC19+8)
-	.word	_ZN20SafepointSynchronize6_stateE(GOT)
-
-@ ---- START execute.s ---------------------------------------------------------------------
-
-	.global	asm_check_null_ptr
-asm_check_null_ptr:
-
-#ifdef HW_NULL_PTR_CHECK
-
-#define uc_mcontext		20
-#define arm_registers_offset	12
-#define arm_cpsr_offset		16*4
-
-	add	r0, r0, #uc_mcontext + arm_registers_offset
-	ldr	r1, [r0, #15*4]
-	adr	ip, abort_table
-abort_loop:
-	ldr	r2, [ip], #8
-	cmp	r2, #0
-	beq	2f
-	cmp	r2, r1
-	bne	abort_loop
-
-	ldr	r3, [ip, #-4]
-	cmp	r3, #8
-	bcs	1f
-
-	ldr	ip, [r0, #5*4]
-	sub	ip, ip, r3
-	str	ip, [r0, #5*4]
-
-	adrl	r3, null_ptr_exception
-1:
-	str	r3, [r0, #15*4]
-do_setcontext:
-	mov	r0, #1
-	bx	lr
-#endif // HW_NULL_PTR_CHECK
-2:
-#ifdef THUMB2EE
-	b	Thumb2_Check_Null
-#else
-	mov	r0, #0
-	bx	lr
-#endif
-
-#ifdef HW_NULL_PTR_CHECK
-abort_table:
-			.word	.abortentry5, 1
-			.word	.abortentry6, 1
-			.word	.abortentry7, 1
-			.word	.abortentry8, 1
-			.word	.abortentry9, 1
-			.word	.abortentry10, 1
-			.word	.abortentry11, 1
-			.word	.abortentry12, 1
-			.word	.abortentry13, 1
-
-		FBC	.word	.abortentry19, 1
-		FBC	.word	.abortentry20, 1
-		FBC	.word	.abortentry21, 1
-		FBC	.word	.abortentry22, 1
-		FBC	.word	.abortentry23, 1
-		FBC	.word	.abortentry24, 1
-		FBC	.word	.abortentry25, 1
-		FBC	.word	.abortentry26, 1
-		FBC	.word	.abortentry27, 1
-		FBC	.word	.abortentry28, 1
-		FBC	.word	.abortentry29, 1
-		FBC	.word	.abortentry30, 1
-		FBC	.word	.abortentry31, 1
-		FBC	.word	.abortentry32, 1
-
-		FBC	.word	.abortentry38, 2
-		FBC	.word	.abortentry39, 3
-		FBC	.word	.abortentry40, 4
-		FBC	.word	.abortentry41, 3
-		FBC	.word	.abortentry42, 2
-		FBC	.word	.abortentry42_1, 2
-		FBC	.word	.abortentry43, 0
-		FBC	.word	.abortentry44, 1
-		FBC	.word	.abortentry45, 3
-		FBC	.word	.abortentry46, 2
-		FBC	.word	.abortentry47, 0
-		FBC	.word	.abortentry48, 1
-		FBC	.word	.abortentry49, 0
-		FBC	.word	.abortentry50, 1
-		FBC	.word	.abortentry51, 0
-		FBC	.word	.abortentry52, 1
-
-		FBC	.word	.abortentry58, 2
-		FBC	.word	.abortentry59, 2
-		FBC	.word	.abortentry60, 2
-
-		FBC	.word	.abortentry73, 1
-		FBC	.word	.abortentry74, 1
-		FBC	.word	.abortentry75, 1
-		FBC	.word	.abortentry76, 1
-		FBC	.word	.abortentry77, 1
-
-	    FBC		.word	.abortentry78, 3
-	    FBC		.word	.abortentry79, 3
-	    FBC		.word	.abortentry80, 3
-	    FBC		.word	.abortentry81, 3
-	    FBC		.word	.abortentry82, 3
-	    FBC		.word	.abortentry83, 3
-	    FBC		.word	.abortentry84, 3
-	    FBC		.word	.abortentry85, 3
-	    FBC		.word	.abortentry86, 3
-	    FBC		.word	.abortentry87, 3
-
-	    FBC    	.word	.abortentry88, 3
-	    FBC	   	.word	.abortentry89, 5
-	    FBC	     	.word	.abortentry90, 4
-	    FBC	     	.word	.abortentry91, 4
-	    FBC		.word	.abortentry104, 0
-		FBC	.word	.abortentry105, 1
-		FBC	.word	.abortentry106, 1
-		FBC	.word	.abortentry107, 1
-		FBC	.word	.abortentry108, 1
-		FBC	.word	.abortentry109, 1
-			.word	.abortentry110, 0
-
-		FBC	.word	.abortentry111, 3
-		FBC	.word	.abortentry112, 3
-
-		FBC	.word	.abortentry113, 0
-			.word	.abortentry114, 1
-		FBC	.word	.abortentry117, 0
-			.word	.abortentry118, 0
-	.word	0
-
-#endif
-
-
-	ALIGN_CODE
-native_entry:
-	stmfd	arm_sp!, {regset, lr}
-	bl	fast_native_entry
-	ldmia	sp!, {regset, pc}
-
-	ALIGN_CODE
-fast_native_entry:
-	adrl	ip, dispatch_init_adcon
-	mov	r11, r0
-	ldm	ip, {dispatch, r7}
-	stmdb	sp!, {fast_regset, lr}
-	add	dispatch, dispatch, ip
-	add	dispatch, dispatch, r7
-	ldrh	r1, [r11, #METHOD_SIZEOFPARAMETERS]
-	ldr	r4, [r2, #THREAD_JAVA_SP]
-	ldr	r3, [r2, #THREAD_TOP_ZERO_FRAME]
-	mov	r0, #0
-	mov	ip, #INTERPRETER_FRAME
-	sub	r9, r4, #FRAME_SIZE
-	str	r9, [r2, #THREAD_JAVA_SP]	@ drop stack
-	sub	r5, r9, #4		@ stack limit = r9 - 4
-	str	r3, [r9, #ISTATE_NEXT_FRAME]
-	str	ip, [r9, #ISTATE_FRAME_TYPE]
-	str	r9, [r9, #ISTATE_MONITOR_BASE]
-	str	r5, [r9, #ISTATE_STACK_LIMIT]
-	str	r9, [r9, #ISTATE_STACK_BASE]
-	str	r0, [r9, #ISTATE_OOP_TEMP]
-
-@	str	r0, [r9, #ISTATE_CALLEE]
-@	str	r0, [r9, #ISTATE_PREV_LINK]
-	str	r0, [r9, #ISTATE_MSG]
-@	str	r0, [r9, #ISTATE_MDX]
-
-	ldr	r10, [r11, #METHOD_CONSTANTS]
-	sub	r7, r4, #4
-	mov	r5, #0
-	add	r7, r7, r1, lsl #2
-
-	ldr	r10, [r10, #CONSTANTPOOL_CACHE]
-
-	str	r2, [r9, #ISTATE_THREAD]
-	str	r5, [r9, #ISTATE_BCP]
-	str	r7, [r9, #ISTATE_LOCALS]
-	str	r10, [r9, #ISTATE_CONSTANTS]
-	str	r11, [r9, #ISTATE_METHOD]
-
-@	stmia	r9, {r2, r5, r7, r10, r11}
-	ldr	r1, [r2, #THREAD_STACK_SIZE]
-	ldr	r3, [r2, #THREAD_STACK_BASE]
-	add	r0, r9, #72
-	mov	r9, r2
-	rsb	r3, r1, r3
-	rsb	r3, r3, arm_sp
-	cmp	r3, #4096
-	str	r0, [r9, #THREAD_TOP_ZERO_FRAME]
-	ldr	r5, [r11, #METHOD_SIGNATUREHANDLER]
-	blt	.fast_native_entry_throw_stack_overflow
-	cmp	r5, #0
-	bne	.fast_native_entry_got_handleraddr
-	str	r0, [r9, #THREAD_LAST_JAVA_SP]
-	mov	r0, r9
-	mov	r1, r11
-	bl	_ZN18InterpreterRuntime19prepare_native_callEP10JavaThreadP13methodOopDesc
-	ldr	r11, [r9, #THREAD_TOP_ZERO_FRAME]
-	ldr	r1, [r9, #THREAD_PENDING_EXC]
-	str	r5, [r9, #THREAD_LAST_JAVA_SP]
-	ldr	r11, [r11, #-72 + ISTATE_METHOD]
-	cmp	r1, #0
-	bne	.fast_native_entry_exception
-	ldr	r5, [r11, #METHOD_SIGNATUREHANDLER]
-.fast_native_entry_got_handleraddr:
-	ldr	r2, [dispatch, #InterpreterRuntime_slow_signature_handler_Address-XXX]
-	cmp	r5, r2
-	bne	.fast_native_entry_get_handler
-	ldr	r3, [r9, #THREAD_TOP_ZERO_FRAME]
-	mov	r2, #0
-	mov	r0, r9
-	str	r3, [r9, #THREAD_LAST_JAVA_SP]
-	mov	r3, r2
-	mov	r1, r11
-	bl	_ZN18InterpreterRuntime22slow_signature_handlerEP10JavaThreadP13methodOopDescPiS4_
-	ldr	r11, [r9, #THREAD_TOP_ZERO_FRAME]
-	ldr	r1, [r9, #THREAD_PENDING_EXC]
-	mov	r3, #0
-	ldr	r11, [r11, #-72 + ISTATE_METHOD]
-	cmp	r1, #0
-	str	r3, [r9, #THREAD_LAST_JAVA_SP]
-	mov	r5, r0
-	bne	.fast_native_entry_exception
-.fast_native_entry_get_handler:
-
-	sub	ip, r7, r4
-	add	r3, r4, #ISTATE_OOP_TEMP-76
-
-	mov	ip, ip, asr #2
-	mov	r4, arm_sp
-
-	add	lr, ip, #4
-	sub	arm_sp, arm_sp, #16
-
-	bic	lr, lr, #1
-	add	r1, r5, #24
-
-	sub	arm_sp, arm_sp, lr, lsl #2
-	add	r2, r9, #THREAD_JNI_ENVIRONMENT
-
-	mov	lr, arm_sp
-	str	r2, [lr], #4
-
-	ldr	r2, [r11, #METHOD_ACCESSFLAGS]
-	add	r1, r1, #4
-	tst	r2, #JVM_ACC_STATIC
-	beq	.do_fast_copy_args
-
-	ldr	r2, [r11, #METHOD_CONSTANTS]
-	ldr	r2, [r2, #16]
-	str	r3, [lr], #4
-	ldr	r2, [r2, #60]
-	add	r1, r1, #4
-	str	r2, [r3]
-
-
-.do_fast_copy_args:
-	cmp	ip, #0
-	blt	.fast_no_args
-
-.fast_copy_args:
-	ldr	r0, [r1], #4
-	ldrh	r3, [r0, #6]
-	ldr	r2, [r7], #-4
-	cmp	r3, #FFI_TYPE_DOUBLE
-	cmpne	r3, #FFI_TYPE_SINT64
-	beq	.fast_copy_long
-
-	cmp	r3, #FFI_TYPE_POINTER
-	beq	.fast_copy_ptr
-
-	subs	ip, ip, #1
-	str	r2, [lr], #4
-	bge	.fast_copy_args
-	b	.fast_no_args
-
-.fast_copy_long:
-	tst	lr, #4
-	ldr	r3, [r7], #-4
-	addne	lr, lr, #4
-	str	r2, [lr, #4]
-	subs	ip, ip, #2
-	str	r3, [lr], #8
-	bge	.fast_copy_args
-	b	.fast_no_args
-
-.fast_copy_ptr:
-	cmp	r2, #0
-	addne	r2, r7, #4
-	subs	ip, ip, #1
-	str	r2, [lr], #4
-	bge	.fast_copy_args
-
-.fast_no_args:
-	ldr	r0, [r9, #THREAD_TOP_ZERO_FRAME]
-	mov	r2, #_thread_in_native
-
-	str	r0, [r9, #THREAD_LAST_JAVA_SP]
-	str	r2, [r9, #THREAD_STATE]
-
-	ldr	ip, [r11, #METHOD_NATIVEHANDLER]
-	ldrh	r11, [r11, #METHOD_SIZEOFPARAMETERS]
-
-	ldmia	arm_sp!, {r0, r1, r2, r3}
-	blx	ip
-
-	mov	ip, #_thread_in_native_trans
-	mov	arm_sp, r4
-
-	ldr	r3, [dispatch, #SafePointSynchronize_state_Address-XXX]
-	str	ip, [r9, #THREAD_STATE]
-
-	ldr	r3, [r3, #0]
-	cmp	r3, #0
-	ldreq	r3, [r9, #THREAD_SUSPEND_FLAGS]
-	cmpeq	r3, #0
-	bne	.fast_native_entry_do_special
-
-.fast_native_entry_do_return:
-	mov	r3, #_thread_in_Java
-	mov	r2, #0
-
-	str	r3, [r9, #THREAD_STATE]
-	str	r2, [r9, #THREAD_LAST_JAVA_SP]
-
-	add	r2, r5, #24
-	ldr	r3, [r5, #4]
-
-	ldr	r5, [r9, #THREAD_TOP_ZERO_FRAME]
-
-	ldr	lr, [r5], #4
-
-	add	r5, r5, r11, lsl #2
-
-	ldr	ip, [r2, r3, asl #2]
-	adr	r3, .return_type_table
-
-	ldrh	r2, [ip, #6]
-	ldr	ip, [r9, #THREAD_ACTIVE_HANDLES]
-
-	mov	tmp1, #0
-	ldr	pc, [r3, r2, lsl #2]
-
-.return_type_table:
-	.word	.fast_native_return_void	@ FFI_TYPE_VOID	== 0
-	.word	0
-	.word	.fast_native_return_w		@ FFI_TYPE_FLOAT == 2
-	.word	.fast_native_return_dw		@ FFI_TYPE_DOUBLE == 3
-	.word	0
-	.word	.fast_native_return_bool	@ FFI_TYPE_BOOL == 5
-	.word	.fast_native_return_byte	@ FFI_TYPE_SINT8 == 6
-	.word	.fast_native_return_char	@ FFI_TYPE_UINT16 == 7
-	.word	.fast_native_return_short	@ FFI_TYPE_SINT16 == 8
-	.word	0
-	.word	.fast_native_return_w		@ FFI_TYPE_SINT32 == 10
-	.word	0
-	.word	.fast_native_return_dw		@ FFI_TYPE_SINT64 == 12
-	.word	0
-	.word	.fast_native_return_obj		@ FFI_TYPE_POINTER == 14
-
-.fast_native_return_dw:
-	str	r0, [r5, #-8]!
-	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
-	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
-	str	r1, [r5, #4]
-	str	r5, [r9, #THREAD_JAVA_SP]
-	ldmfd	arm_sp!, {fast_regset, pc}
-.fast_native_return_byte:
-	mov	r0, r0, lsl #24
-	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
-	mov	r0, r0, asr #24
-	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
-	str	r0, [r5, #-4]!
-	str	r5, [r9, #THREAD_JAVA_SP]
-	ldmfd	arm_sp!, {fast_regset, pc}
-.fast_native_return_char:
-	mov	r0, r0, lsl #16
-	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
-	mov	r0, r0, lsr #16
-	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
-	str	r0, [r5, #-4]!
-	str	r5, [r9, #THREAD_JAVA_SP]
-	ldmfd	arm_sp!, {fast_regset, pc}
-.fast_native_return_bool:
-	ands	r0, r0, #255
-	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
-	movne	r0, #1
-	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
-	str	r0, [r5, #-4]!
-	str	r5, [r9, #THREAD_JAVA_SP]
-	ldmfd	arm_sp!, {fast_regset, pc}
-.fast_native_return_obj:
-	cmp	r0, #0
-	ldrne	r0, [r0]
-	str	r0, [r5, #-4]!
-	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
-	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
-	str	r5, [r9, #THREAD_JAVA_SP]
-	ldmfd	arm_sp!, {fast_regset, pc}
-.fast_native_return_short:
-	mov	r0, r0, lsl #16
-	mov	r0, r0, asr #16
-.fast_native_return_w:
-	str	r0, [r5, #-4]!
-.fast_native_return_void:
-	str	lr, [r9, #THREAD_TOP_ZERO_FRAME]
-	str	tmp1, [ip, #JNIHANDLEBLOCK_TOP]
-.fast_native_exit:
-	str	r5, [r9, #THREAD_JAVA_SP]
-	ldmfd	arm_sp!, {fast_regset, pc}
-
-.fast_native_entry_throw_stack_overflow:
-	str	r0, [r9, #THREAD_LAST_JAVA_SP]
-	mov	r0, r9
-	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
-	mov	r3, #0
-	ldr	r1, [r9, #THREAD_PENDING_EXC]
-	str	r3, [r9, #THREAD_LAST_JAVA_SP]
-.fast_native_entry_exception:
-	ldr	r5, [r9, #THREAD_TOP_ZERO_FRAME]
-	ldr	r3, [r5], #4
-	str	r3, [r9, #THREAD_TOP_ZERO_FRAME]
-
-	ldrh	r3, [r11, #METHOD_SIZEOFPARAMETERS]
-	add	r5, r5, r3, lsl #2
-	b	.fast_native_exit
-
-.fast_native_entry_do_special:
-	stmdb	arm_sp!, {r0, r1}
-	mov	r0, r9
-	bl	_ZN10JavaThread40check_special_condition_for_native_transEPS_
-	ldmia	arm_sp!, {r0, r1}
-	b	.fast_native_entry_do_return
-
-#include "bytecodes_arm.s"
-
-	Opcode	idiv
-
-	POP	r1
-	POP	r0
-	cmp	r1, #0
-	beq	divide_by_zero_exception
-	bl	__aeabi_idiv
-	PUSH	r0
-	DISPATCH 1
-
-	Opcode	idiv_clz
-
-	POP	r1
-	POP	r0
-	bl	int_div
-idiv_clz_ret:
-	PUSH	r0
-	DISPATCH 1
-
-	Opcode	irem
-
-	POP	r1
-	POP	r0
-	cmp	r1, #0
-	beq	divide_by_zero_exception
-	bl	__aeabi_idivmod
-	PUSH	r1
-	DISPATCH 1
-
-	Opcode	irem_clz
-
-	POP	r1
-	POP	r0
-	bl	int_rem
-irem_clz_ret:
-	PUSH	r0
-	DISPATCH 1
-
-	Opcode	goto
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-branch_taken:
-        orr     tmp1, tmp1, r1, lsl #8
-        DISPATCH_START_REG	tmp1
-	cmp	tmp1, #0
-	ble	do_backedge
-	DISPATCH_FINISH
-
-branch_taken_unsafe:
-	mov	r2, r2, lsl #24
-	orr	tmp1, r1, r2, asr #16
-        DISPATCH_START_REG	tmp1
-  USEC	cmp	tmp1, #0
-  USEC	ble	do_backedge
-	DISPATCH_FINISH
-
-branch_taken_unsafe_1:
-	add	jpc, jpc, #1
-	orr	tmp1, ip, r1, lsl #8
-        DISPATCH_START_REG	tmp1
-  USEC	cmp	tmp1, #0
-  USEC	ble	do_backedge
-	DISPATCH_FINISH
-
-branch_taken_unsafe_2:
-	add	jpc, jpc, #2
-	orr	tmp1, ip, r1, lsl #8
-        DISPATCH_START_REG	tmp1
-  USEC	cmp	tmp1, #0
-  USEC	ble	do_backedge
-	DISPATCH_FINISH
-
-branch_taken_unsafe_3:
-	add	jpc, jpc, #3
-	orr	tmp1, ip, r1, lsl #8
-        DISPATCH_START_REG	tmp1
-  USEC	cmp	tmp1, #0
-  USEC	ble	do_backedge
-	DISPATCH_FINISH
-
-branch_taken_unsafe_4:
-	add	jpc, jpc, #4
-	orr	tmp1, ip, r1, lsl #8
-        DISPATCH_START_REG	tmp1
-  USEC	cmp	tmp1, #0
-  USEC	ble	do_backedge
-	DISPATCH_FINISH
-
-do_backedge:
-  USEC	ldr	tmp2, [istate, #ISTATE_METHOD]
-  OSR	ldr	lr, [dispatch, #InterpreterInvocationLimit_Address-XXX]
-  USEC	ldr	r1, [tmp2, #METHOD_BACKEDGECOUNTER]
-  USEC	ldr	ip, [tmp2, #METHOD_INVOCATIONCOUNTER]
-  USEC	add	r1, r1, #INVOCATIONCOUNTER_COUNTINCREMENT
-  OSR	ldr	lr, [lr]
-  USEC	add	ip, ip, #INVOCATIONCOUNTER_COUNTINCREMENT
-  USEC	str	r1, [tmp2, #METHOD_BACKEDGECOUNTER]
-#ifdef THUMB2EE
-  OSR	cmp	r1, lr
-#else
-  OSR	cmp	r1, lr, lsl #2
-#endif
-  USEC	str	ip, [tmp2, #METHOD_INVOCATIONCOUNTER]
-  OSR	bcs	do_osr
-
-osr_continue:
-	ldr	ip, [dispatch, #SafePointSynchronize_state_Address-XXX]
-	ldr	r1, [ip]
-	cmp	r1, #1
-	beq	do_synchronize
-	DISPATCH_STATE	1
-	DISPATCH_FINISH
-
-
-do_synchronize:
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	Helper_SafePoint
-	CACHE_CP
-	CACHE_JPC
-	cmp	r0, #0
-	bne	handle_exception
-	DISPATCH	0
-
-#ifdef ON_STACK_REPLACEMENT
-
-#ifdef THUMB2EE
-do_osr:
-	ldr	r3, [tmp2, #METHOD_CONSTMETHOD]
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	sub	r1, jpc, r3
-	sub	r1, r1, #CONSTMETHOD_CODEOFFSET
-	bl	FREQ_COUNT_OVERFLOW
-1:
-	cmp	r0, #0
-	bne	call_thumb2
-	CACHE_CP
-	CACHE_JPC
-	DISPATCH_START	0
-	b	osr_continue
-
-#else
-
-do_osr:
-	ldr	ip, [dispatch, #UseOnStackReplacement_Address-XXX]
-	ldrb	ip, [ip]
-	cmp	ip, #0
-	beq	osr_continue
-
-	ldr	r3, [tmp2, #METHOD_CONSTMETHOD]
-	DECACHE_JPC
-	ldrh	r3, [r3, #CONSTMETHOD_CODESIZE]
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	sub	r1, jpc, tmp1
-	cmp	r3, #MAX_FG_METHOD_SIZE
-	bcc	1f
-	ldr	tmp2, [dispatch, #BackgroundCompilation_Address-XXX]
-	mov	r3, #1
-	ldr	r5, [tmp2]
-	str	r3, [tmp2]
-	bl	FREQ_COUNT_OVERFLOW
-	str	r5, [tmp2]
-	b	2f
-1:
-	bl	FREQ_COUNT_OVERFLOW
-2:
-	ldr	r3, [istate, #ISTATE_THREAD]
-	CACHE_CP
-	ldr	r1, [r3, #THREAD_PENDING_EXC]
-	CACHE_JPC
-	cmp	r1, #0
-	bne	handle_exception
-	cmp	r0, #0
-	beq	1f
-	ldr	r1, [r0, #56]
-	cmn	r1, #2
-	bne	osr_migrate
-1:
-	DISPATCH_START	0
-	b	osr_continue
-
-osr_migrate:
-	ldr	tmp1, [r0, #128]	@ osr_method->osr_entry()
-	mov	r0, r3
-	bl	_ZN13SharedRuntime19OSR_migration_beginEP10JavaThread
-	mov	r1, r0
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldrh	lr, [r0, #METHOD_MAXLOCALS]
-	ldrh	ip, [r0, #METHOD_SIZEOFPARAMETERS]
-	ldr	r3, [istate, #ISTATE_THREAD]
-	sub	lr, lr, ip
-	ldr	r2, [r3, #THREAD_TOP_ZERO_FRAME]
-	add	ip, r2, #4
-	ldr	r2, [r2]
-	add	ip, ip, lr, lsl #2
-	str	r2, [r3, #THREAD_TOP_ZERO_FRAME]
-	str	ip, [r3, #THREAD_JAVA_SP]
-	mov	r2, tmp1
-@ r0 = method
-@ r1 = osr_buf
-@ r2 = osr_entry
-	mov	lr, pc
-	ldr	pc, [tmp1]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-
-#endif // THUMB2EE
-
-#endif // ON_STACK_REPLACEMENT
-
-	Opcode	ifeq
-	Opcode	ifnull
-        POP     r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, #0
-	beq	branch_taken
-	DISPATCH	3
-
-	Opcode	ifne
-	Opcode	ifnonnull
-        POP     r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, #0
-	bne	branch_taken
-	DISPATCH	3
-
-	Opcode	iflt
-        POP     r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, #0
-	blt	branch_taken
-	DISPATCH	3
-
-	Opcode	ifge
-        POP     r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, #0
-	bge	branch_taken
-	DISPATCH	3
-
-	Opcode	ifgt
-        POP     r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, #0
-	bgt	branch_taken
-	DISPATCH	3
-
-	Opcode	ifle
-        POP     r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, #0
-	ble	branch_taken
-	DISPATCH	3
-
-	Opcode	if_icmpeq
-	Opcode	if_acmpeq
-        POP    r2, r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, r2
-	beq	branch_taken
-	DISPATCH	3
-
-	Opcode	if_icmpne
-	Opcode	if_acmpne
-        POP    r2, r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, r2
-	bne	branch_taken
-	DISPATCH	3
-
-	Opcode	if_icmplt
-        POP    r2, r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, r2
-	blt	branch_taken
-	DISPATCH	3
-
-	Opcode	if_icmpge
-        POP    r2, r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, r2
-	bge	branch_taken
-	DISPATCH	3
-
-	Opcode	if_icmpgt
-        POP    r2, r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, r2
-	bgt	branch_taken
-	DISPATCH	3
-
-	Opcode	if_icmple
-        POP    r2, r3
-        ldrsb   r1, [jpc, #1]
-        ldrb    tmp1, [jpc, #2]
-        cmp     r3, r2
-	ble	branch_taken
-	DISPATCH	3
-
-	Opcode	ireturn
-	Opcode	freturn
-	Opcode	lreturn
-	Opcode	dreturn
-	Opcode	areturn
-	Opcode	return
-	ldr	r3, [dispatch, #SafePointSynchronize_state_Address-XXX]
-	ldr	r1, [r3]
-	cmp	r1, #1
-	bne	handle_return
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	Helper_SafePoint
-	CACHE_JPC
-	cmp	r0, #0
-	beq	handle_return
-	b	handle_exception
-
-resolve_get_put:
-	mov	r1, r0
-	mov	tmp1, lr
-        ldr     r0, [istate, #ISTATE_THREAD]
-	DECACHE_JPC
-        DECACHE_STACK
-       	bl      _ZN18InterpreterRuntime15resolve_get_putEP10JavaThreadN9Bytecodes4CodeE
-        ldr     r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-        ldr     r3, [r0, #THREAD_PENDING_EXC]
-	CACHE_CP
-        cmp     r3, #0
-	mov	lr, tmp1
-        bne     getfield_exception
-@ Now restart the getfield
-        ldrb    r3, [jpc, #1]
-        ldrb    r2, [jpc, #2]
-        orr     r3, r3, r2, lsl #8      @ r3 = index
-	add	tmp2, constpool, r3, lsl #4	@ tmp2 = cache
-	bx	lr
-
-accessor_non_w:
-	bcs	accessor_h
-	beq	accessor_sb
-	tst	r0, #2
-	bne	accessor_dw
-accessor_sh:
-	ldrsh	r0, [r3, r1]
-	str	r0, [ip, #0]
-	bx	lr
-accessor_h:
-	ldrh	r0, [r3, r1]
-	str	r0, [ip, #0]
-	bx	lr
-accessor_sb:
-	ldrsb	r0, [r3, r1]
-	str	r0, [ip, #0]
-	bx	lr
-accessor_dw:
-	add	r0, r3, r1
-	ldm	r0, {r0, r1}
-	sub	ip, ip, #4
-	str	ip, [r2, #THREAD_JAVA_SP]
-	stmia	ip, {r0, r1}
-	bx	lr
-
-	Opcode	getfield
-	ldrb	r1, [jpc, #2]
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	ldr	r3, [tmp2, #CP_OFFSET]
-        and     r3, r3, #0x00ff0000
-        cmp     r3, #opc_getfield << 16
-        blne    resolve_get_put
-  NFBC	POP	tmp1
-        ldr     r2, [tmp2, #CP_OFFSET+12]
-  NFBC	cmp	tmp1, #0
-  NFBC	beq	null_ptr_exception
-  NFBC	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-        movs    r2, r2, lsr #29
-  FBC	movhi	r0, #opc_igetfield
-        bls     getfield_non_w
-  NFBC	ldr	tmp2, [tmp1, tmp2]
-  NFBC	PUSH	tmp2
-  NFBC	DISPATCH 3
-
-#ifdef FAST_BYTECODES
-rewrite_bytecode:
-	strb	r0, [jpc]
-	DISPATCH_BYTECODE
-#endif
-
-getfield_non_w:
-        bcs     getfield_h              @ C = 1 => R2 = 1
-        beq     getfield_sb             @ Z = 1 => R2 = 0
-        tst     r2, #2
-        bne     getfield_dw
-
-#ifdef FAST_BYTECODES
-getfield_sh:
-	mov	r0, #opc_sgetfield
-	b	rewrite_bytecode
-getfield_h:
-	mov	r0, #opc_cgetfield
-	b	rewrite_bytecode
-getfield_sb:
-	mov	r0, #opc_bgetfield
-	b	rewrite_bytecode
-getfield_dw:
-	mov	r0, #opc_lgetfield
-	b	rewrite_bytecode
-#else
-getfield_sh:
-	ldrsh	tmp2, [tmp1, tmp2]
-	PUSH	tmp2
-	DISPATCH 3
-getfield_h:
-	ldrh	tmp2, [tmp1, tmp2]
-	PUSH	tmp2
-	DISPATCH 3
-getfield_sb:
-	ldrsb	tmp2, [tmp1, tmp2]
-	PUSH	tmp2
-	DISPATCH 3
-getfield_dw:
-	add	tmp1, tmp1, tmp2
-	ldm	tmp1, {r2, tmp2}
-	PUSH	r2, tmp2
-	DISPATCH 3
-#endif
-
-	Opcode	putfield
-	ldrb	r1, [jpc, #2]
-        add     tmp2, constpool, r1, lsl #12
-	add	tmp2, tmp2, r2, lsl #4
-	ldr	r3, [tmp2, #CP_OFFSET]
-        and     r3, r3, #0xff000000
-        cmp     r3, #opc_putfield << 24
-        blne    resolve_get_put
-        ldr     r2, [tmp2, #CP_OFFSET+12]
-  NFBC	ldr	tmp2, [tmp2, #CP_OFFSET+8]
-        movs    r2, r2, lsr #29
-	bls	putfield_non_w
-  FBC   mov	r0, #opc_iputfield
-	cmp	r2, #tos_atos >> 1
-  FBC	moveq	r0, #opc_aputfield
-  FBC	b	rewrite_bytecode
-  NFBC	beq	putfield_a
-  NFBC	POP	r2, r3
-  NFBC	cmp	r3, #0
-  NFBC	beq	null_ptr_exception
-  NFBC	str	r2, [r3, tmp2]
-  NFBC	DISPATCH 3
-
-putfield_non_w:
-	bcs	putfield_h
-	beq	putfield_sb
-	tst	r2, #2
-	bne	putfield_dw
-
-#ifdef FAST_BYTECODES
-putfield_sh:
-putfield_h:
-	mov	r0, #opc_cputfield
-	b	rewrite_bytecode
-putfield_sb:
-	mov	r0, #opc_bputfield
-	b	rewrite_bytecode
-putfield_dw:
-	mov	r0, #opc_lputfield
-	b	rewrite_bytecode
-#else
-putfield_sh:
-putfield_h:
-	POP	r2, r3
-	cmp	r3, #0
-	beq	null_ptr_exception
-	strh	r2, [r3, tmp2]
-	DISPATCH 3
-putfield_sb:
-	POP	r2, r3
-	cmp	r3, #0
-	beq	null_ptr_exception
-	strb	r2, [r3, tmp2]
-	DISPATCH 3
-putfield_dw:
-	POP	r2, r3, lr
-	cmp	lr, #0
-	beq	null_ptr_exception
-	add	tmp2, lr, tmp2
-	stm	tmp2, {r2, r3}
-	DISPATCH 3
-putfield_a:
-	POP	r2, r3
-	cmp	r3, #0
-	beq	null_ptr_exception
-	str	r2, [r3, tmp2]
-	mov	r0, r3
-	bl	Helper_aputfield
-	DISPATCH 3
-#endif
-
-getstatic_sh:
-	DISPATCH_START	3
-	ldrsh	tmp2, [r3, lr]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-getstatic_h:
-	DISPATCH_START	3
-	ldrh	tmp2, [r3, lr]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-getstatic_sb:
-	DISPATCH_START	3
-	ldrsb	tmp2, [r3, lr]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-getstatic_dw:
-	DISPATCH_START	3
-	add	r3, r3, lr
-	ldm	r3, {r2, tmp2}
-	DISPATCH_NEXT
-	PUSH	r2, tmp2
-	DISPATCH_FINISH
-getstatic_w:
-	DISPATCH_START	3
-	ldr	tmp2, [r3, lr]
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-
-putstatic_sh:
-putstatic_h:
-	DISPATCH_START	3
-	POP	tmp2
-	DISPATCH_NEXT
-	strh	tmp2, [r3, r2]
-	DISPATCH_FINISH
-putstatic_w:
-	cmp	lr, #tos_atos >> 1	@ >> 1 due to lsr #29 above
-	beq	putstatic_a
-	DISPATCH_START	3
-	POP	tmp2
-	DISPATCH_NEXT
-	str	tmp2, [r3, r2]
-	DISPATCH_FINISH
-putstatic_sb:
-	DISPATCH_START	3
-	POP	tmp2
-	DISPATCH_NEXT
-	strb	tmp2, [r3, r2]
-	DISPATCH_FINISH
-putstatic_dw:
-	DISPATCH_START	3
-	add	r2, r2, r3
-	POP	r3, tmp2
-	DISPATCH_NEXT
-	stm	r2, {r3, tmp2}
-	DISPATCH_FINISH
-putstatic_a:
-	POP	tmp2
-	str	tmp2, [r3, r2]
-	mov	r0, r3
-	bl	Helper_aputfield
-	DISPATCH 3
-
-resolve_invokeinterface:
-	mov	r1, #opc_invokeinterface
-	b	resolve_invoke
-resolve_invokevirtual:
-	mov	r1, #opc_invokevirtual
-	b	resolve_invoke
-resolve_invokespecial:
-	mov	r1, #opc_invokespecial
-	b	resolve_invoke
-resolve_invokestatic:
-	mov	r1, #opc_invokestatic
-resolve_invoke:
-	mov	tmp1, lr
-	ldr	r0, [istate, #ISTATE_THREAD]
-	DECACHE_JPC
-	DECACHE_STACK
-	bl	_ZN18InterpreterRuntime14resolve_invokeEP10JavaThreadN9Bytecodes4CodeE
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	r3, [r0, #4]
-	CACHE_CP
-	cmp	r3, #0
-        ldrb    r3, [jpc, #1]
-        ldrb    r2, [jpc, #2]
-	bne	resolve_exception
-        orr     r3, r3, r2, lsl #8      @ r3 = index
-	add	r0, constpool, r3, lsl #4	@ r1 = cache
-	bx	tmp1
-
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-	Opcode	new
-	ldrb	r1, [jpc, #2]
-	DECACHE_JPC
-	DECACHE_STACK
-	orr	r1, r1, r2, lsl #8
-	mov	r0, r8
-	bl	Helper_new
-	CACHE_JPC
-	CACHE_CP
-	cmp	r0, #0
-	beq	handle_exception
-	PUSH	r0
-	DISPATCH 3
-
-bytecode_interpreter_str:
-	.ascii  "[Bytecode Interpreter]\000"
-	ALIGN_WORD
-
-	Opcode	newarray
-	ldrb	r1, [jpc, #1]	@ zero_extendqisi2
-	ldr	r2, [stack, #4]
-	ldr	r0, [istate, #ISTATE_THREAD]
-	DECACHE_JPC
-	DECACHE_STACK
-	bl	_ZN18InterpreterRuntime8newarrayEP10JavaThread9BasicTypei
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	ip, [r0, #THREAD_PENDING_EXC]
-	CACHE_CP
-	cmp	ip, #0
-	ldr	r2, [r0, #THREAD_VM_RESULT]
-	bne	handle_exception
-	str	r2, [stack, #4]
-	str	ip, [r0, #THREAD_VM_RESULT]
-	DISPATCH	2
-
-	Opcode	anewarray
-	ldrb	r0, [jpc, #1]	@ zero_extendqisi2
-	ldr	r3, [stack, #4]
-	ldr	lr, [istate, #ISTATE_METHOD]
-	ldrb	r2, [jpc, #2]	@ zero_extendqisi2
-	orr	r2, r2, r0, asl #8
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r1, [lr, #METHOD_CONSTANTS]
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	_ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	ip, [r0, #THREAD_PENDING_EXC]
-	CACHE_CP
-	cmp	ip, #0
-	ldr	r2, [r0, #THREAD_VM_RESULT]
-	bne	handle_exception
-	str	r2, [stack, #4]
-	str	ip, [r0, #THREAD_VM_RESULT]
-	DISPATCH	3
-
-	Opcode	arraylength
-	DISPATCH_START	1
-	ldr	r3, [stack, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	SW_NPC	cmp	r3, #0
-	SW_NPC	beq	null_ptr_exception_jpc_1
-.abortentry114:
-	ldr	r3, [r3, #8]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	r3, [stack, #4]
-	DISPATCH_FINISH
-
-	Opcode	athrow
-	ldr	r1, [stack, #4]
-	cmp	r1, #0
-	beq	null_ptr_exception
-	mov	r2, #0
-	ldr	r0, [istate, #ISTATE_THREAD]
-	mov	r3, r2
-	bl	_ZN12ThreadShadow21set_pending_exceptionEP7oopDescPKci
-	b	handle_exception
-
-#define secondary_super_cache_offset_in_bytes	20
-#define tmp_chunk	locals
-#define tmp_hwm		stack
-#define	tmp_max		constpool
-
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-	Opcode	checkcast
-	ldrb	r1, [jpc, #2]
-	DECACHE_JPC
-	DECACHE_STACK
-	orr	r1, r1, r2, lsl #8
-	mov	r0, r8
-	GET_STACK	0, r2
-	bl	Helper_checkcast
-	CACHE_JPC
-	CACHE_CP
-	cmp	r0, #0
-	bne	handle_exception
-	DISPATCH 3
-
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-	Opcode	instanceof
-	ldrb	r1, [jpc, #2]
-	DECACHE_JPC
-	DECACHE_STACK
-	orr	r1, r1, r2, lsl #8
-	mov	r0, r8
-	POP	r2
-	bl	Helper_instanceof
-	CACHE_JPC
-	CACHE_CP
-	cmp	r0, #-1
-	beq	handle_exception
-	PUSH	r0
-	DISPATCH 3
-
-	Opcode	monitorenter
-	ldr	r1, [stack, #4]
-	cmp	r1, #0
-	beq	.monitorenter_4
-	ldr	r0, [istate, #ISTATE_MONITOR_BASE]
-	ldr	r2, [istate, #ISTATE_STACK_BASE]
-	cmp	r2, r0
-	beq	.monitorenter_5
-	mov	sl, #0
-.monitorenter_1:
-	ldr	r3, [r2, #4]
-	cmp	r3, #0
-	moveq	sl, r2
-	beq	.monitorenter_2
-	cmp	r1, r3
-	beq	.monitorenter_3
-.monitorenter_2:
-	add	r2, r2, #8
-	cmp	r2, r0
-	bne	.monitorenter_1
-.monitorenter_3:
-	cmp	sl, #0
-	beq	.monitorenter_5
-	str	r1, [sl, #4]
-	ldr	r3, [r1, #0]
-	mov	r0, sl
-	orr	tmp1, r3, #1
-	mov	r2, tmp1
-	str	tmp1, [sl, #0]
-	bl	cmpxchg_ptr
-	cmp	r0, tmp1
-	beq	.monitorenter_exit
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bic	r1, tmp1, #3
-	bl	JavaThread_is_lock_owned
-	cmp	r0, #0
-	movne	lr, #0
-	strne	lr, [sl, #0]
-	bne	.monitorenter_exit
-	mov	r1, sl
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	_ZN18InterpreterRuntime12monitorenterEP10JavaThreadP15BasicObjectLock
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-	cmp	r3, #0
-	beq	.monitorenter_exit
-	b	handle_exception
-.monitorenter_4:
-	b	null_ptr_exception
-.monitorenter_5:
-	mov	lr, #0
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r3, [istate, #ISTATE_THREAD]
-	ldr	ip, [istate, #ISTATE_THREAD]
-	ldr	r1, [r3, #THREAD_JAVA_SP]
-	ldr	r3, [r3, #THREAD_JAVA_STACK_BASE]
-	str	lr, [ip, #THREAD_LAST_JAVA_SP]
-	rsb	r3, r3, r1
-	cmp	r3, #7
-	ble	vm_fatal_error
-	sub	r3, r1, #8
-	ldr	r1, [istate, #ISTATE_THREAD]
-	str	r3, [r1, #THREAD_JAVA_SP]
-	ldr	r2, [istate, #ISTATE_STACK]
-	ldr	r1, [istate, #ISTATE_STACK_BASE]
-	add	r3, r2, #4
-	cmp	r1, r3
-	bls	.monitorenter_7
-	add	r0, r2, #8
-.monitorenter_6:
-	ldr	r3, [r0, #-4]
-	mov	r2, r0
-	str	r3, [r0, #-12]
-	add	r0, r0, #4
-	ldr	r1, [istate, #ISTATE_STACK_BASE]
-	cmp	r1, r2
-	bhi	.monitorenter_6
-	ldr	r2, [istate, #ISTATE_STACK]
-.monitorenter_7:
-	sub	r1, r1, #8
-	sub	r2, r2, #8
-	ldr	r3, [istate, #ISTATE_STACK_LIMIT]
-	str	r1, [istate, #ISTATE_STACK_BASE]
-	str	r2, [istate, #ISTATE_STACK]
-	sub	r3, r3, #8
-	mov	r0, #0
-	str	r3, [istate, #ISTATE_STACK_LIMIT]
-	str	r0, [r1, #4]
-	ldr	r1, [istate, #ISTATE_THREAD]
-	ldr	r3, [r1, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [r1, #THREAD_LAST_JAVA_SP]
-	CACHE_STACK
-	ldr	sl, [istate, #ISTATE_STACK_BASE]
-	ldr	r3, [stack, #4]
-	CACHE_JPC
-	mov	r1, r3
-	str	r3, [sl, #4]
-	ldr	r2, [r3, #0]
-	mov	r0, sl
-	orr	tmp1, r2, #1
-	mov	r2, tmp1
-	str	tmp1, [sl, #0]
-	bl	cmpxchg_ptr
-	cmp	r0, tmp1
-	beq	.monitorenter_exit
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bic	r1, tmp1, #3
-	bl	JavaThread_is_lock_owned
-	cmp	r0, #0
-	movne	ip, #0
-	strne	ip, [sl, #0]
-	bne	.monitorenter_exit
-	mov	r1, sl
-	ldr	r0, [istate, #ISTATE_THREAD]
-	DECACHE_JPC
-	DECACHE_STACK
-	bl	_ZN18InterpreterRuntime12monitorenterEP10JavaThreadP15BasicObjectLock
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-	cmp	r3, #0
-	beq	.monitorenter_exit
-	b	handle_exception
-.monitorenter_exit:
-	CACHE_CP
-	add	stack, stack, #4
-	DISPATCH	1
-
-	Opcode	monitorexit
-	ldr	sl, [stack, #4]
-	cmp	sl, #0
-	beq	.monitorexit_3
-	ldr	r2, [istate, #ISTATE_MONITOR_BASE]
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]
-	cmp	tmp1, r2
-	bne	.monitorexit_2
-	b	.monitorexit_4
-.monitorexit_1:
-	add	tmp1, tmp1, #8
-	cmp	tmp1, r2
-	beq	.monitorexit_4
-.monitorexit_2:
-	ldr	r3, [tmp1, #4]
-	cmp	sl, r3
-	bne	.monitorexit_1
-	ldr	r0, [tmp1, #0]
-	mov	lr, #0
-	cmp	r0, lr
-	str	lr, [tmp1, #4]
-	beq	.monitorexit_exit
-	mov	r1, sl
-	mov	r2, tmp1
-	bl	cmpxchg_ptr
-	cmp	tmp1, r0
-	beq	.monitorexit_exit
-	str	sl, [tmp1, #4]
-	mov	r1, tmp1
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	_ZN18InterpreterRuntime11monitorexitEP10JavaThreadP15BasicObjectLock
-	ldr	r0, [istate, #ISTATE_THREAD]
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-	CACHE_JPC
-	cmp	r3, #0
-	beq	.monitorexit_exit
-	b	handle_exception
-.monitorexit_3:
-	b	null_ptr_exception
-.monitorexit_4:
-	ldr	r0, [istate, #ISTATE_THREAD]
-	DECACHE_JPC
-	DECACHE_STACK
-	bl	_ZN18InterpreterRuntime37throw_illegal_monitor_state_exceptionEP10JavaThread
-	b	handle_exception_with_bcp
-.monitorexit_exit:
-	add	stack, stack, #4
-	CACHE_CP
-	DISPATCH	1
-
-vm_fatal_error:
-	adr	r0, .fatal_filename
-	mov	r1, #99
-	bl	_Z28report_should_not_reach_herePKci
-	b	breakpoint
-.fatal_filename:
-	.ascii	"[Optimsed Assembler Interpreter Loop]\000"
-	ALIGN_WORD
-
-	Opcode	aastore
-	DECACHE_JPC
-	DECACHE_STACK
-	mov	r0, r8
-	POP	r1, r2, r3
-	bl	Helper_aastore
-	CACHE_JPC
-	CACHE_CP
-	cmp	r0, #0
-	bne	handle_exception
-	DISPATCH 1
-
-	Opcode	wide
-	ldrb	r2, [jpc, #1]
-	ldrb	r1, [jpc, #2]	@ zero_extendqisi2
-	ldrb	r3, [jpc, #3]	@ zero_extendqisi2
-
-	sub	lr, r2, #opc_aload+1
-	cmp	lr, #opc_istore - (opc_aload+1)
-	bcc	wide_undef_opc_exception
-
-	sub	lr, r2, #opc_iload
-	cmp	r2, #opc_istore
-	subcs	lr, lr, #opc_istore - (opc_aload+1)
-	cmp	r2, #opc_astore+1
-
-	orr	r1, r3, r1, asl #8
-	adr	r3, wide_case_table
-	ldrcc	pc, [r3, lr, lsl #2]
-	
-	cmp	r2, #opc_ret
-	beq	do_wide_ret
-	cmp	r2, #opc_iinc
-	beq	do_wide_iinc
-wide_undef_opc_exception:
-	mov	r0, #VMSYMBOLS_InternalError
-	adr	r1, undef_opcode_msg
-	b	raise_exception_with_msg
-undef_opcode_msg:
-	.ascii  "undefined opcode\000"
-	ALIGN_WORD
-
-wide_case_table:
-        .word	case_wide_iload
-        .word	case_wide_lload
-        .word	case_wide_fload
-        .word	case_wide_dload
-        .word	case_wide_aload
-        .word	case_wide_istore
-        .word	case_wide_lstore
-        .word	case_wide_fstore
-        .word	case_wide_dstore
-        .word	case_wide_astore
-
-case_wide_iload:
-case_wide_fload:
-case_wide_aload:
-	ldr	r2, [locals, -r1, lsl #2]
-	PUSH	r2
-	DISPATCH	4
-case_wide_istore:
-case_wide_fstore:
-case_wide_astore:
-	POP	r2
-	str	r2, [locals, -r1, lsl #2]
-	DISPATCH	4
-case_wide_dload:
-case_wide_lload:
-	sub	r1, locals, r1, lsl #2
-	ldmda	r1, {r1, r2}
-	PUSH	r1, r2
-	DISPATCH	4
-case_wide_dstore:
-case_wide_lstore:
-	POP	r2, r3
-	sub	r1, locals, r1, lsl #2
-	stmda	r1, {r2, r3}
-	DISPATCH	4
-do_wide_ret:
-	ldr	r2, [istate, #ISTATE_METHOD]
-	ldr	r2, [r2, #8]
-	ldr	r1, [locals, -r1, lsl #2]
-	add	jpc, r2, r1
-	DISPATCH	48
-do_wide_iinc:
-	ldrsb	r2, [jpc, #4]
-	ldrb	r3, [jpc, #5]
-	orr	r2, r3, r2, lsl #8
-	ldr	r3, [locals, -r1, lsl #2]
-	add	r3, r3, r2
-	str	r3, [locals, -r1, lsl #2]
-	DISPATCH	6
-
-	Opcode	multianewarray
-	ldrb	tmp1, [jpc, #3]	@ zero_extendqisi2
-	ldr	r0, [istate, #ISTATE_THREAD]
-	add	r1, stack, tmp1, lsl #2
-	DECACHE_JPC
-	DECACHE_STACK
-	bl	_ZN18InterpreterRuntime14multianewarrayEP10JavaThreadPi
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	r1, [r0, #THREAD_PENDING_EXC]
-	CACHE_CP
-	cmp	r1, #0
-	ldr	r3, [r0, #THREAD_VM_RESULT]
-	bne	handle_exception
-	str	r3, [stack, tmp1, asl #2]!
-	str	r1, [r0, #THREAD_VM_RESULT]
-	sub	stack, stack, #4
-	DISPATCH	4
-
-	Opcode	jsr_w
-	ldr	r3, [istate, #ISTATE_METHOD]
-	ldr	r1, [r3, #8]
-	rsb	r2, r1, jpc
-	sub	r2, r2, #43
-	str	r2, [stack], #-4
-	b	do_goto_w
-
-	Opcode	goto_w
-	add	r2, jpc, #1
-	ldrb	tmp1, [jpc, #1]	@ zero_extendqisi2
-	ldrb	r3, [r2, #3]	@ zero_extendqisi2
-	ldrb	r0, [r2, #1]	@ zero_extendqisi2
-	ldrb	ip, [r2, #2]	@ zero_extendqisi2
-	orr	r3, r3, tmp1, asl #24
-	orr	r3, r3, r0, asl #16
-	orr	r3, r3, ip, asl #8
-	cmp	r3, #0
-	add	jpc, jpc, r3
-	bgt	1f
-
-	ldr	r3, [dispatch, #SafePointSynchronize_state_Address-XXX]
-	ldr	r1, [r3]
-	cmp	r1, #1
-	bne	1f
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	Helper_SafePoint
-	CACHE_JPC
-	CACHE_CP
-	cmp	r0, #0
-	bne	handle_exception
-1:
-	DISPATCH	0
-
-	Opcode	breakpoint
-	mov	r2, jpc
-	DECACHE_STACK
-	DECACHE_JPC
-	ldr	r0, [istate, #ISTATE_THREAD]
-	ldr	r1, [istate, #ISTATE_METHOD]
-	bl	_ZN18InterpreterRuntime24get_original_bytecode_atEP10JavaThreadP13methodOopDescPh
-	mov	tmp1, r0
-	ldr	r0, [istate, #ISTATE_THREAD]
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-	cmp	r3, #0
-	bne	handle_exception
-	ldr	r2, [istate, #ISTATE_BCP]
-	ldr	r1, [istate, #ISTATE_METHOD]
-	bl	_ZN18InterpreterRuntime11_breakpointEP10JavaThreadP13methodOopDescPh
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-	CACHE_CP
-	cmp	r3, #0
-	and	r0, tmp1, #255
-	bne	handle_exception
-	DISPATCH_BYTECODE
-
-#ifndef FAST_BYTECODES
-	Opcode	bgetfield
-	Opcode	cgetfield
-	Opcode	igetfield
-	Opcode	lgetfield
-	Opcode	sgetfield
-	Opcode	aputfield
-	Opcode	bputfield
-	Opcode	cputfield
-	Opcode	iputfield
-	Opcode	lputfield
-	Opcode	invokevfinal
-	Opcode	invokeresolved
-	Opcode	invokespecialresolved
-	Opcode	invokestaticresolved
-	Opcode	iaccess_0
-	Opcode	iload_0_iconst_N
-	Opcode	iload_iconst_N
-	Opcode	iadd_istore_N
-	Opcode	isub_istore_N
-	Opcode	iand_istore_N
-	Opcode	ior_istore_N
-	Opcode	ixor_istore_N
-	Opcode	iadd_u4store
-	Opcode	isub_u4store
-	Opcode	iand_u4store
-	Opcode	ior_u4store
-	Opcode	ixor_u4store
-	Opcode	fast_iload_iload
-	Opcode	fast_iload_iload_N
-	Opcode	fast_iload_N_iload
-	Opcode	fast_iload_N_iload_N
-#endif
-	Opcode	undefined
-	ldr	r2, [dispatch, #Bytecodes_name_Address-XXX]
-	ldrb	r3, [jpc, #0]	@ zero_extendqisi2
-	adrl	r0, bytecode_interpreter_str
-	cmp	r3, #last_implemented_bytecode+1
-	adrcs	ip, unknown_bytecode
-	ldrcc	ip, [r2, r3, asl #2]
-	adr	r2, unimplemented_opcode_msg
-	mov	r1, #99
-	str	ip, [arm_sp, #-8]!
-	bl	_Z19report_fatal_varargPKciS0_z
-	b	breakpoint
-unimplemented_opcode_msg:
-	.ascii  "\011*** Unimplemented opcode: %d = %s\012\000"
-unknown_bytecode:
-	.ascii	"<unknown>\000"
-	ALIGN_WORD
-
-	Opcode	return_register_finalizer
-	ldr	r1, [locals, #0]
-	ldr	r3, [r1, #4]
-	ldr	r2, [r3, #KLASS_PART+KLASS_ACCESSFLAGS]
-	tst	r2, #JVM_ACC_HAS_FINALIZER
-	beq	handle_return
-	DECACHE_JPC
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	_ZN18InterpreterRuntime18register_finalizerEP10JavaThreadP7oopDesc
-	ldr	r0, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-@ CACHE_LOCALS & CACHE_CP not require for handle_retuen / handle_exception
-	cmp	r3, #0
-	beq	handle_return
-	b	handle_exception
-
-	ALIGN_CODE
-normal_entry_synchronized:
-	stmfd	arm_sp!, {regset, lr}
-	bl	fast_normal_entry_synchronized
-	ldmfd	arm_sp!, {regset, pc}
-
-	ALIGN_CODE
-fast_normal_entry_synchronized:
-	stmfd	arm_sp!, {fast_regset, lr}
-
-	mov	sl, r0
-	mov	tmp1, r2
-
-	ldr	r0, [tmp1, #THREAD_STACK_SIZE]
-	ldr	r3, [tmp1, #THREAD_STACK_BASE]
-	rsb	r3, r0, r3
-	rsb	r3, r3, arm_sp
-	cmp	r3, #32768
-	blt	stack_overflow_before_frame
-
-	ldrh	r2, [sl, #METHOD_MAXLOCALS]
-	ldrh	r3, [sl, #METHOD_SIZEOFPARAMETERS]
-	rsb	r8, r3, r2
-
-	ldr	r1, [tmp1, #THREAD_JAVA_SP]
-	ldrh	r0, [sl, #METHOD_MAXSTACK]
-	ldr	r3, [tmp1, #THREAD_JAVA_STACK_BASE]
-
-	sub	r5, r1, r8, lsl #2
-	sub	r5, r5, #FRAME_SIZE+STACK_SPARE+LEAF_STACK_SIZE
-	sub	r5, r5, r0, lsl #2
-	cmp	r3, r5
-	bcs	stack_overflow_before_frame
-
-	cmp	r8, #0
-	ble	.normal_entry_synchronized_no_locals
-
-	mov	r2, #0
-.zero_locals_synchronized:
-	subs	r8, r8, #1
-	str	r2, [r1, #-4]!
-	bgt	.zero_locals_synchronized
-	str	r1, [tmp1, #THREAD_JAVA_SP]
-
-.normal_entry_synchronized_no_locals:
-	mov	r2, tmp1
-	mov	r1, sl
-	add	r0, tmp1, #THREAD_JAVA_STACK_BASE
-	bl	build_frame
-	mov	tmp_vvv, r0
-	ldr	r3, [tmp1, #THREAD_TOP_ZERO_FRAME]
-	sub	r0, r0, #72
-	mov	istate, r0
-	str	r3, [tmp_vvv, #0]
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r0, r1}
-	add	r0, r0, ip
-	str	tmp_vvv, [tmp1, #THREAD_TOP_ZERO_FRAME]
-@	CACHE_JPC
-	str	tmp_vvv, [tmp1, #THREAD_LAST_JAVA_SP]
-	add	dispatch, r1, r0
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [r0, #METHOD_ACCESSFLAGS]
-	tst	r3, #JVM_ACC_SYNCHRONIZED
-	beq	1f
-
-@ Do Synchronisation
-	CACHE_STACK
-	CACHE_LOCALS
-	tst	r3, #JVM_ACC_STATIC
-	ldrne	r3, [r0, #METHOD_CONSTANTS]
-	ldreq	sl, [locals, #0]
-	ldrne	r2, [r3, #16]
-	ldr	tmp1, [istate, #ISTATE_MONITOR_BASE]
-	ldrne	sl, [r2, #60]
-	ldr	r3, [sl, #0]
-	orr	tmp_xxx, r3, #1
-	str	tmp_xxx, [tmp1, #-8]!
-.normal_do_synchronisation_2:
-	ldr	tmp_vvv, [sl, #0]
-	cmp	tmp_xxx, tmp_vvv
-	bne	.normal_do_synchronisation_3
-	mov	r0, tmp_xxx
-	mov	r1, tmp1
-	mov	r2, sl
-	mov	r3, #0xffffffc0
-	bic	r3, r3, #0xf000
-	blx	r3
-	cmp	r0, #0
-	bne	.normal_do_synchronisation_2
-	b	1f
-.normal_do_synchronisation_3:
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bic	r1, tmp_xxx, #3
-	bl	JavaThread_is_lock_owned
-	cmp	r0, #0
-	beq	.normal_do_synchronisation_4
-	mov	r3, #0
-	str	r3, [tmp1]
-	b	1f
-.normal_do_synchronisation_4:
-	mov	r1, tmp1
-	DECACHE_STACK
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	_ZN18InterpreterRuntime12monitorenterEP10JavaThreadP15BasicObjectLock
-	ldr	r0, [istate, #ISTATE_THREAD]
-	ldr	r3, [r0, #THREAD_PENDING_EXC]
-	cmp	r3, #0
-	mov	r2, r0
-	bne	handle_exception_do_not_unlock
-1:
-  USEC ldr	r0, [istate, #ISTATE_METHOD]
-  USEC	ldr	r2, [r0, #METHOD_INVOCATIONCOUNTER]
-  USEC	ldr	lr, [dispatch, #InterpreterInvocationLimit_Address-XXX]
-  USEC	add	r2, r2, #INVOCATIONCOUNTER_COUNTINCREMENT
-  USEC	ldr	lr, [lr]
-  USEC	str	r2, [r0, #METHOD_INVOCATIONCOUNTER]
-  USEC	cmp	r2, lr
-  USEC	bcs	sync_method_entry_freq_count_overflow
-	CACHE_JPC
-	CACHE_LOCALS
-	CACHE_CP
-	DISPATCH	0
-
-#ifdef USE_COMPILER
-sync_method_entry_freq_count_overflow:
-        ldr     r3, [r0, #METHOD_CONSTMETHOD]
-        ldrh    r3, [r3, #CONSTMETHOD_CODESIZE]
-	mov	r1, #0
-	ldr	r0, [istate, #ISTATE_THREAD]
-        cmp     r3, #MAX_FG_METHOD_SIZE
-        bcc     1f
-        ldr     tmp2, [dispatch, #BackgroundCompilation_Address-XXX]
-        mov     r3, #1
-        ldr     r5, [tmp2]
-        str     r3, [tmp2]
-        bl      FREQ_COUNT_OVERFLOW
-        str     r5, [tmp2]
-        b       2f
-1:
-	bl	FREQ_COUNT_OVERFLOW
-2:
-  T2	cmp	r0, #0
-	CACHE_LOCALS
-  T2	bne	call_thumb2
-	CACHE_JPC
-	CACHE_CP
-	DISPATCH	0
-#endif
-
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-	Opcode	invokeinterface
-	ldrb	r1, [jpc, #2]
-	DECACHE_STACK
-        add     r0, constpool, r1, lsl #12
-	add	r0, r0, r2, asl #4
-	DECACHE_JPC
-        ldr     r2, [r0, #CP_OFFSET]
-        and     r2, r2, #0x00ff0000
-        cmp     r2, #opc_invokeinterface << 16
-        blne    resolve_invokeinterface
-
-	ldr	r3, [r0, #CP_OFFSET+12]
-	and	r2, r3, #255
-	ldr	r2, [stack, r2, lsl #2]
-	SW_NPC	cmp	r2, #0
-	SW_NPC	beq	null_ptr_exception
-.abortentry110:
-	ldr	tmp2, [r2, #4]				@ rcvr->klass()
-	tst	r3, #flag_methodInterface
-	bne	.invokeinterface_methodInterface
-
-	ldr	lr, [r0, #CP_OFFSET+4]			@ lr = iclass
-
-	add	r1, tmp2, #INSTANCEKLASS_VTABLE_OFFSET
-	ldr	r2, [tmp2, #KLASS_PART+INSTANCEKLASS_VTABLE_LEN]
-	ldr	ip, [tmp2, #KLASS_PART+INSTANCEKLASS_ITABLE_LEN]
-	add	r2, r2, #1
-	bic	r2, r2, #1
-
-	add	r1, r1, r2, lsl #2
-
-	mov	r2, #0
-1:
-	cmp	r2, ip
-	beq	incompatibleclass_exception
-	ldr	r3, [r1], #8
-	add	r2, r2, #1
-	cmp	lr, r3
-	bne	1b
-
-	ldr	r3, [r0, #CP_OFFSET+8]
-	ldr	r2, [r1, #-4]
-	add	r3, tmp2, r3, lsl #2
-	ldr	tmp2, [r3, r2]
-	cmp	tmp2, #0
-	beq	abstractmethod_exception
-.invokeinterface_invoke:
-	ldr	tmp1, [istate, #ISTATE_THREAD]
-@	str	tmp2, [istate, #ISTATE_CALLEE]
-	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
-	mov	r1, #0
-	str	ip, [istate, #36]
-	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
-
-	add	stack, stack, #4
-	str	stack, [tmp1, #THREAD_JAVA_SP]
-
-	ldr	r3, [ip]
-
-	mov	r0, tmp2
-	mov	r1, ip
-#ifndef SHARK
-	add	r3, r3, #CODE_ALIGN_SIZE
-#endif
-	mov	r2, tmp1
-	blx	r3
-
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r0, r1}
-	add	r0, r0, ip
-	add	dispatch, r1, r0
-
-	CACHE_LOCALS
-
-	ldr	ip, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	stack, [ip, #THREAD_JAVA_SP]
-	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
-	sub	stack, stack, #4
-
-	ldr	r1, [ip, #THREAD_TOP_ZERO_FRAME]
-	add	r2, r2, #4
-	str	r2, [ip, #THREAD_JAVA_SP]
-	str	r1, [ip, #THREAD_LAST_JAVA_SP]
-	DISPATCH_START	5
-	ldr	r3, [ip, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	cmp	r3, #0
-	DISPATCH_NEXT
-	bne	invokeinterface_exception_fix
-	DISPATCH_NEXT
-	CACHE_CP
-	DISPATCH_FINISH
-
-.invokeinterface_methodInterface:
-	tst	r3, #flag_vfinalMethod
-	ldrne	tmp2, [r0, #CP_OFFSET+8]
-	bne	.invokeinterface_invoke
-	ldr	r1, [r0, #CP_OFFSET+8]
-	add	r3, tmp2, r1, lsl #2
-	ldr	tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
-	b	.invokeinterface_invoke
-
-#ifdef FAST_BYTECODES
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-	Opcode	invokevfinal
-	ldrb	r1, [jpc, #2]
-	DECACHE_STACK
-	add	r0, constpool, r1, lsl #12
-	DECACHE_JPC
-	add	r0, r2, asl #4
-	ldr	r3, [r0, #CP_OFFSET+12]
-	ldr	tmp1, [istate, #ISTATE_THREAD]
-	and	r1, r3, #255
-	ldr	r2, [stack, r1, asl #2]
-	mov	r1, #0
-	SW_NPC	cmp	r2, #0
-	SW_NPC	beq	null_ptr_exception
-.abortentry117:
-	HW_NPC	ldr	r3, [r2]		@ Only to provoke abort
-
-	ldr	tmp2, [r0, #CP_OFFSET+8]
-
-@	str	tmp2, [istate, #ISTATE_CALLEE]
-	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
-	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
-	str	ip, [istate, #36]
-
-	add	stack, stack, #4
-	str	stack, [tmp1, #THREAD_JAVA_SP]
-
-	ldr	r3, [ip, #0]
-	b	normal_dispatch_and_return
-#endif // FAST_BYTECODES
-
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-        Opcode  invokevirtual
-	ldrb	r1, [jpc, #2]
-        add     r0, constpool, r1, lsl #12
-	add	r0, r0, r2, asl #4
-        ldr     r2, [r0, #CP_OFFSET]
-        and     r2, r2, #0xff000000
-        cmp     r2, #opc_invokevirtual << 24
-        blne    resolve_invokevirtual
-        ldr     r3, [r0, #CP_OFFSET+12]
-#ifdef FAST_BYTECODES
-        mov     r0, #opc_invokeresolved
-        tst     r3, #flag_vfinalMethod
-        movne   r0, #opc_invokevfinal
-        b       rewrite_bytecode
-#else
-        DECACHE_STACK
-	DECACHE_JPC
-        ldr     tmp1, [istate, #ISTATE_THREAD]
-        and     r1, r3, #255
-        ldr     r2, [stack, r1, asl #2]
-        mov     r1, #0
-        cmp     r2, #0
-        beq     null_ptr_exception
-
-        ldr     tmp2, [r0, #CP_OFFSET+8]
-        tst     r3, #flag_vfinalMethod
-        bne     1f
-
-        ldr     r3, [r2, #4]
-        add     r3, r3, tmp2, lsl #2
-        ldr     tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
-1:
-#endif // FAST_BYTECODES
-
-#ifdef FAST_BYTECODES
-# r2 = [jpc, #1]
-# r1 = [jpc, #2]
-        Opcode  invokeresolved
-	ldrb	r1, [jpc, #2]
-        DECACHE_STACK
-        add     r0, constpool, r1, lsl #12
-	DECACHE_JPC
-        add     r0, r0, r2, asl #4
-        ldr     r3, [r0, #CP_OFFSET+12]
-        ldr     tmp1, [istate, #ISTATE_THREAD]
-        and     r1, r3, #255
-        ldr     r2, [stack, r1, asl #2]
-        mov     r1, #0
-        SW_NPC	cmp     r2, #0
-        SW_NPC	beq     null_ptr_exception_jpc_0
-
-        ldr     tmp2, [r0, #CP_OFFSET+8]
-.abortentry104:
-        ldr     r3, [r2, #4]
-        add     r3, r3, tmp2, lsl #2
-        ldr     tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
-#endif // FAST_BYTECODES
-
-@        str     tmp2, [istate, #ISTATE_CALLEE]
-        ldr     ip, [tmp2, #METHOD_FROM_INTERPRETED]
-        str     r1, [tmp1, #THREAD_LAST_JAVA_SP]
-        str     ip, [istate, #36]
-
-        add     stack, stack, #4
-        str     stack, [tmp1, #THREAD_JAVA_SP]
-
-        ldr     r3, [ip, #0]
-
-normal_dispatch_and_return:
-	mov	r0, tmp2
-	mov	r1, ip
-#ifndef SHARK
-	add	r3, r3, #CODE_ALIGN_SIZE
-#endif
-	mov	r2, tmp1
-	blx	r3
-
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r0, r1}
-	add	r0, r0, ip
-	add	dispatch, r1, r0
-
-	CACHE_LOCALS
-
-	ldr	ip, [istate, #ISTATE_THREAD]
-	CACHE_JPC
-	ldr	stack, [ip, #THREAD_JAVA_SP]
-	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
-	sub	stack, stack, #4
-
-	ldr	r1, [ip, #THREAD_TOP_ZERO_FRAME]
-	add	r2, r2, #4
-	str	r2, [ip, #THREAD_JAVA_SP]
-	str	r1, [ip, #THREAD_LAST_JAVA_SP]
-	DISPATCH_START	3
-	ldr	r3, [ip, #4]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	cmp	r3, #0
-	DISPATCH_NEXT
-	bne	invoke_exception_fix
-	DISPATCH_NEXT
-	CACHE_CP
-	DISPATCH_FINISH
-
-	Opcode	invokestatic
-	ldrb	r1, [jpc, #2]
-        add     r0, constpool, r1, lsl #12
-	add	r0, r0, r2, asl #4
-        ldr     r2, [r0, #CP_OFFSET]
-	and	r2, r2, #0x00ff0000
-	cmp	r2, #opc_invokestatic << 16
-	blne	resolve_invokestatic
-  FBC	mov	r0, #opc_invokestaticresolved
-  FBC	b	rewrite_bytecode
-
-  FBC	Opcode	invokestaticresolved
-  FBC	ldrb	r1, [jpc, #2]
-        DECACHE_STACK
-  FBC   add     r0, constpool, r1, lsl #12
-	DECACHE_JPC
-  FBC	add	r0, r2, asl #4
-
-	ldr	tmp2, [r0, #CP_OFFSET+4]
-	mov	r1, #0
-@	str	tmp2, [istate, #ISTATE_CALLEE]
-	ldr	r3, [tmp2, #METHOD_FROM_INTERPRETED]
-	ldr	tmp1, [istate, #ISTATE_THREAD]
-	str	r3, [istate, #36]
-	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
-
-	add	stack, stack, #4
-	str	stack, [tmp1, #THREAD_JAVA_SP]
-
-	ldr	ip, [istate, #36]
-	ldr	r3, [ip, #0]
-	b	normal_dispatch_and_return
-
-
-	Opcode	invokespecial
-     	ldrb	r1, [jpc, #2]
-        add     r0, constpool, r1, lsl #12
-	add	r0, r0, r2, asl #4
-        ldr     r2, [r0, #CP_OFFSET]
-        and     r2, r2, #0x00ff0000
-        cmp     r2, #opc_invokespecial << 16
-        blne     resolve_invokespecial
-  FBC	mov	r0, #opc_invokespecialresolved
-  FBC	b	rewrite_bytecode
-
-  FBC	Opcode	invokespecialresolved
-  FBC	ldrb	r1, [jpc, #2]
-        DECACHE_STACK
-  FBC   add     r0, constpool, r1, lsl #12
-	DECACHE_JPC
-  FBC	add	r0, r2, asl #4
-
-	ldr	r3, [r0, #CP_OFFSET+12]
-	ldr	tmp1, [istate, #ISTATE_THREAD]
-	and	r3, r3, #255
-	ldr	r2, [stack, r3, asl #2]
-	mov	r1, #0
-	SW_NPC	cmp	r2, #0
-	SW_NPC	beq	null_ptr_exception
-.abortentry118:
-	HW_NPC	ldr	r3, [r2]		@ Only to provoke abort
-
-	ldr	tmp2, [r0, #CP_OFFSET+4]
-
-@	str	tmp2, [istate, #ISTATE_CALLEE]
-	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
-	str	r1, [tmp1, #THREAD_LAST_JAVA_SP]
-	str	ip, [istate, #36]
-
-	add	stack, stack, #4
-	str	stack, [tmp1, #THREAD_JAVA_SP]
-
-	ldr	r3, [ip, #0]
-	b	normal_dispatch_and_return
-
-	ALIGN_CODE
-normal_entry:
-	stmfd	arm_sp!, {regset, lr}
-
-	ldr	r7, [r2, #THREAD_STACK_SIZE]
-	ldr	r3, [r2, #THREAD_STACK_BASE]
-	rsb	r3, r7, r3
-	rsb	r3, r3, arm_sp
-	cmp	r3, #32768
-	blt	stack_overflow_no_frame
-
-	bl	fast_normal_entry
-
-	ldmfd	arm_sp!, {regset, pc}
-
-	ALIGN_CODE
-fast_normal_entry:
-	adrl	ip, dispatch_init_adcon
-	mov	tmp2, r0
-	ldm	ip, {r0, r1}
-	mov	tmp1, r2
-	add	r0, r0, ip
-	ldr	stack, [tmp1, #THREAD_JAVA_SP]
-	add	dispatch, r1, r0
-
-	stmdb	arm_sp!, {fast_regset, lr}
-
-	ldrh	r0, [tmp2, #METHOD_MAXLOCALS]
-	mov	r1, #0
-	ldrh	r3, [tmp2, #METHOD_SIZEOFPARAMETERS]
-        mov     ip, #INTERPRETER_FRAME
-	ldrh	r2, [tmp2, #METHOD_MAXSTACK]
-        sub     r7, r0, r3
-
-	ldr	r3, [tmp1, #THREAD_JAVA_STACK_BASE]
-	sub	r5, stack, r7, lsl #2
-	sub	r5, r5, #FRAME_SIZE+STACK_SPARE+LEAF_STACK_SIZE
-	sub	r5, r5, r2, lsl #2
-	cmp	r3, r5
-	bcs	stack_overflow_before_frame
-
-        subs    r5, r7, #2
-        tst     r7, #1
-        strne   r1, [stack, #-4]!
-        bcc     3f
-1:
-        str     r1, [stack, #-4]
-        str     r1, [stack, #-8]!
-        subs    r5, r5, #2
-        bcs     1b
-3:
-	ldr	r3, [tmp1, #THREAD_TOP_ZERO_FRAME]
-	mov	lr, #0
-        sub     istate, stack, #FRAME_SIZE
-        sub     r2, istate, r2, lsl #2
-        str     lr, [istate, #ISTATE_MSG]
-	str	r2, [tmp1, #THREAD_JAVA_SP]
-        sub     r5, r2, #4                      @ stack limit = istate - stackwords - 4
-	str	r3, [istate, #ISTATE_NEXT_FRAME]
-	str	ip, [istate, #ISTATE_FRAME_TYPE]
-@	str	istate, [istate, #ISTATE_SELF_LINK]
-	str	istate, [istate, #ISTATE_MONITOR_BASE]
-	str	r5, [istate, #ISTATE_STACK_LIMIT]
-	str	istate, [istate, #ISTATE_STACK_BASE]
-        sub     locals, stack, #4
-	str	r1, [istate, #ISTATE_OOP_TEMP]
-        add     locals, locals, r0, lsl #2
-        sub     stack, istate, #4
-        ldr     jpc, [tmp2, #METHOD_CONSTMETHOD]
-        ldr     constpool, [tmp2, #METHOD_CONSTANTS]
-        add     ip, istate, #ISTATE_NEXT_FRAME
-	DISPATCH_START	CONSTMETHOD_CODEOFFSET
-        ldr     constpool, [constpool, #CONSTANTPOOL_CACHE]
-        str     ip, [tmp1, #THREAD_TOP_ZERO_FRAME]
-  USEC	ldr	r3, [r10, #METHOD_INVOCATIONCOUNTER]
-        str     ip, [tmp1, #THREAD_LAST_JAVA_SP]
-	DISPATCH_NEXT
-  USEC	ldr	lr, [dispatch, #InterpreterInvocationLimit_Address-XXX]
-  USEC	add	r3, r3, #INVOCATIONCOUNTER_COUNTINCREMENT
-        str     tmp1, [istate, #ISTATE_THREAD]
-  USEC	ldr	lr, [lr]
-  USEC	str	r3, [tmp2, #METHOD_INVOCATIONCOUNTER]
-	str	locals, [istate, #ISTATE_LOCALS]
-  USEC	cmp	r3, lr
-	str	constpool, [istate, #ISTATE_CONSTANTS]
-  USEC	bcs	method_entry_freq_count_overflow
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	str	r10, [istate, #ISTATE_METHOD]
-@	mov	lr, #0
-@        str     lr, [istate, #ISTATE_PREV_LINK]
-@	str	lr, [istate, #ISTATE_CALLEE]
-	DISPATCH_FINISH
-#ifdef USE_COMPILER
-method_entry_freq_count_overflow:
-        ldr     r3, [r10, #METHOD_CONSTMETHOD]
-	DECACHE_JPC
-        ldrh    r3, [r3, #CONSTMETHOD_CODESIZE]
-	str	r10, [istate, #ISTATE_METHOD]
-	mov	r1, #0
-	mov	r0, tmp1
-        cmp     r3, #MAX_FG_METHOD_SIZE
-        bcc     1f
-        ldr     tmp2, [dispatch, #BackgroundCompilation_Address-XXX]
-        mov     r3, #1
-        ldr     r5, [tmp2]
-        str     r3, [tmp2]
-        bl      FREQ_COUNT_OVERFLOW
-        str     r5, [tmp2]
-        b       2f
-1:
-	bl	FREQ_COUNT_OVERFLOW
-2:
- T2	cmp	r0, #0
- T2	bne	call_thumb2
-	CACHE_JPC
-	CACHE_CP
-	DISPATCH	0
-
-#ifdef THUMB2EE
-#define THUMB2_MAXLOCALS 1000
-call_thumb2:
-	mov	ip, r1
-	sub	r1, locals, #THUMB2_MAXLOCALS * 4
-	ldr	r2, [istate, #ISTATE_THREAD]
-	sub	r3, locals, #31 * 4
-	add	stack, stack, #4
-	bx	ip
-#endif // THUMB2EE
-
-#endif // USE_COMPILER
-	.global	Thumb2_Install
-Thumb2_Install:
-@	ldr	r0, [r0]
-	str	r1, [r0, #METHOD_FROM_INTERPRETED]
-	bx	lr
-
-handle_return:
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-
-	cmp	tmp1, tmp2
-	blcc	return_check_monitors
-
-	mov	r3, #0
-	ldrb	lr, [jpc, #0]
-
-	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [r2, #0]
-	ldrh	r0, [r0, #40]
-	add	r1, r2, #4
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-
-	add	r1, r1, r0, lsl #2
-
-	cmp	lr, #opc_lreturn
-	cmpne	lr, #opc_dreturn
-	ldreq	r0, [stack, #8]
-	streq	r0, [r1, #-4]!
-	cmpne	lr, #opc_ireturn
-	cmpne	lr, #opc_freturn
-	cmpne	lr, #opc_areturn
-	ldreq	r0, [stack, #4]
-	streq	r0, [r1, #-4]!
-
-	str	r1, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-
-@ ----------------------------------------------------------------------------------------
-stack_overflow_no_frame:
-	mov	r0, tmp1
-	ldr	ip, [r0, #THREAD_TOP_ZERO_FRAME]
-	str	ip, [r0, #THREAD_LAST_JAVA_SP]
-	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
-	ldmfd	arm_sp!, {regset, pc}
-
-stack_overflow_before_frame:
-	mov	r0, tmp1
-	ldr	ip, [r0, #THREAD_TOP_ZERO_FRAME]
-	str	ip, [r0, #THREAD_LAST_JAVA_SP]
-	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
-	ldmfd	arm_sp!, {fast_regset, pc}
-
-handle_exception_do_not_unlock:
-	mov	r3, #1
-	strb	r3, [r2, #THREAD_DO_NOT_UNLOCK]
-	b	handle_exception_with_bcp
-
-abstractmethod_exception:
-	mov	r0, #VMSYMBOLS_AbstractMethodError
-	b	raise_exception
-incompatibleclass_exception:
-	mov	r0, #VMSYMBOLS_IncompatibleClassChangeError
-raise_exception:
-	adr	r1, null_str
-raise_exception_with_msg:
-	stmdb	sp!, {r0, r1}
-	bl	load_dispatch
-	ldmia	sp!, {r0, r1}
-	DECACHE_JPC
-        DECACHE_STACK
-	mov	r2, r1
-	ldr	r1, [dispatch, #VmSymbols_symbols_Address-XXX]
-	ldr	r1, [r1, r0, lsl #2]
-        ldr     r0, [istate, #ISTATE_THREAD]
-	bl	Helper_Raise
-        b       handle_exception_with_bcp
-null_str:
-	.byte	0
-	ALIGN_WORD
-
-invokeinterface_exception_fix:
-	sub	jpc, jpc, #2
-invoke_exception_fix:
-invokenative_exception:
-return_exception:
-	sub	jpc, jpc, #3
-resolve_exception:
-putfield_exception:
-getfield_exception:
-handle_exception:
-@ jpc = Exception PC
-@ stack = garbage
-@ locals = garbage
-@ constpool = garbage
-	DECACHE_JPC
-handle_exception_with_bcp:
-	bl	load_dispatch
-	CACHE_JPC
-	ldr	stack, [istate, #ISTATE_STACK_BASE]
-	sub	stack, stack, #4
-	DECACHE_STACK
-	cmp	jpc, #0
-	beq	1f
-
-	mov	r0, istate
-	ldr	r1, [istate, #ISTATE_THREAD]
-	bl	Helper_HandleException
-	cmp	r0, #0
-	beq	1f
-
-	mov	jpc, r0
-	CACHE_STACK
-	CACHE_LOCALS
-	CACHE_CP
-	DISPATCH 0
-1:
-	ldr	tmp2, [istate, #ISTATE_MONITOR_BASE]	@ tmp2 = base
-
-	ldr	tmp1, [istate, #ISTATE_STACK_BASE]	@ tmp1 = end
-	ldr	tmp_xxx, [istate, #ISTATE_THREAD]
-
-	mov	r3, #0
-	ldrb	r0, [tmp_xxx, #THREAD_DO_NOT_UNLOCK]
-	strb	r3, [tmp_xxx, #THREAD_DO_NOT_UNLOCK]
-	cmp	r0, #0
-	bne	2f
-
-	cmp	tmp1, tmp2
-	blcc	return_check_monitors
-
-2:
-	mov	r3, #0
-
-	ldr	r2, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-	str	r3, [tmp_xxx, #THREAD_LAST_JAVA_SP]
-	ldr	r0, [istate, #ISTATE_METHOD]
-	ldr	r3, [r2, #0]
-	ldrh	r0, [r0, #40]
-	add	r1, r2, #4
-	str	r3, [tmp_xxx, #THREAD_TOP_ZERO_FRAME]
-
-	add	r1, r1, r0, lsl #2
-
-	str	r1, [tmp_xxx, #THREAD_JAVA_SP]
-
-	ldmfd	arm_sp!, {fast_regset, pc}
-
-return_check_monitors:
-	stmdb	arm_sp!, {r4, lr}
-
-	ldr	r2, [istate, #ISTATE_METHOD]
-	ldr	r4, [r2, #METHOD_ACCESSFLAGS]
-	tst	r4, #1<<5
-	subne	tmp2, tmp2, #8
-	cmp	tmp1, tmp2
-	bcs	2f
-1:
-	ldr	r3, [tmp1, #4]
-	cmp	r3, #0
-	bne	3f
-	add	tmp1, tmp1, #8
-	cmp	tmp1, tmp2
-	bcc	1b
-
-2:
-	tst	r4, #1<<5
-
-	ldmeqia	arm_sp!, {r4, pc}
-
-	ldr	tmp1, [tmp2, #4]		@ base->obj == NULL
-	cmp	tmp1, #0
-	beq	4f
-
-	ldr	r0, [tmp2, #0]			@ r0 = header
-	mov	r3, #0
-	cmp	r0, #0
-	str	r3, [tmp2, #4]			@ base->obj = NULL
-
-	ldmeqia	arm_sp!, {r4, pc}
-
-	mov	r1, tmp1
-	mov	r2, tmp2
-	bl	cmpxchg_ptr
-	cmp	tmp2, r0
-
-	ldmeqia	arm_sp!, {r4, pc}
-
-	str	tmp1, [tmp2, #4]
-
-	mov	r1, tmp2
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	Helper_synchronized_exit
-
-	ldmeqia	arm_sp!, {r4, pc}
-
-3:
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	Helper_RaiseIllegalMonitorException
-	b	2b
-
-4:
-	ldr	r0, [istate, #ISTATE_THREAD]
-	bl	Helper_RaiseIllegalMonitorException
-	ldmia	arm_sp!, {r4, pc}
-
-	ALIGN_CODE
-accessor_entry:
-	b	slow_accessor_entry
-
-	ALIGN_CODE
-slow_accessor_entry:
-  USEC	adrl	ip, dispatch_init_adcon
-  USEC	ldr	r3, [ip]
-  USEC	add	r3, r3, ip
-  USEC	ldr	ip, [ip, #invocationlimit_adcon-dispatch_init_adcon]
-  USEC	ldr	ip, [r3, ip]
-
-  USEC	ldr	r3, [r0, #METHOD_INVOCATIONCOUNTER]
-  USEC	ldr	ip, [ip, #0]
-  USEC	add	r3, r3, #INVOCATIONCOUNTER_COUNTINCREMENT
-  USEC	str	r3, [r0, #METHOD_INVOCATIONCOUNTER]
-  USEC	cmp	r3, ip
-  USEC	bcs	normal_entry
-
-	ldr	r1, [r0, #METHOD_CONSTMETHOD]
-	ldrb	r3, [r1, #CONSTMETHOD_CODEOFFSET+2]
-	ldrb	r1, [r1, #CONSTMETHOD_CODEOFFSET+3]
-	ldr	ip, [r0, #METHOD_CONSTANTS]
-	ldr	ip, [ip, #CONSTANTPOOL_CACHE]
-	orr	r3, r3, r1, lsl #8		@ r3 = index
-
-	add	r1, ip, #CP_OFFSET
-	ldr	r3, [r1, r3, lsl #4]!		@ r1 = cache, r3 = flags
-	ldr	ip, [r2, #THREAD_JAVA_SP]			@ ip == stack
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getfield << 16
-	ldr	r3, [ip, #0]
-	bne	normal_entry
-
-	cmp	r3, #0
-	beq	normal_entry
-
-	ldr	r0, [r1, #12]
-	ldr	r1, [r1, #8]
-	movs	r0, r0, lsr #29
-	bls	accessor_non_w
-
-	ldr	r0, [r3, r1]
-	str	r0, [ip, #0]
-	bx	lr
-
-.fast_accessor_non_w:
-	bcs	.fast_accessor_h
-	beq	.fast_accessor_sb
-	tst	lr, #2
-	bne	.fast_accessor_dw
-.fast_accessor_sh:
-	DISPATCH_STATE	2
-	DISPATCH_NEXT
-	ldrsh	tmp1, [r2, r3]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-.fast_accessor_h:
-	DISPATCH_STATE	2
-	DISPATCH_NEXT
-	ldrh	tmp1, [r2, r3]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-.fast_accessor_sb:
-	DISPATCH_STATE	2
-	DISPATCH_NEXT
-	ldrsb	tmp1, [r2, r3]
-	DISPATCH_NEXT
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_FINISH
-.fast_accessor_dw:
-	DISPATCH_STATE	2
-	add	tmp1, r2, r3
-	DISPATCH_NEXT
-	ldm	tmp1, {tmp2, tmp1}
-	DISPATCH_NEXT
-	PUT_STACK	0, tmp1
-	DISPATCH_NEXT
-	PUSH	tmp2
-	DISPATCH_FINISH
-
-div_zero_jpc_1:
-	sub	jpc, jpc, #1
-.lrem_0:
-.ldiv_0:
-divide_by_zero_exception:
-	mov	r0, #VMSYMBOLS_ArithmeticException
-	adr	r1, div_zero_msg
-	b	raise_exception_with_msg
-div_zero_msg:
-	.ascii  "/ by int zero\000"
-	ALIGN_WORD
-
-array_bound_exception_jpc_4_r3:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_3_r3:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_2_r3:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_1_r3:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_0_r3:
-	mov	r2, r3
-	b	array_bounds_exception
-array_bound_exception_jpc_1_tmp2:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_0_tmp2:
-	mov	r2, tmp2
-	b	array_bounds_exception
-array_bound_exception_jpc_3:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_2:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_1:
-	sub	jpc, jpc, #1
-array_bound_exception_jpc_0:
-array_bounds_exception:
-	DECACHE_JPC
-        DECACHE_STACK
-	mov	r1, r2
-        ldr     r0, [istate, #ISTATE_THREAD]
-	bl	Helper_RaiseArrayBoundException
-        b       handle_exception_with_bcp
-
-#ifndef HW_NULL_PTR_CHECK
-null_ptr_exception_jpc_5:
-	sub	jpc, jpc, #1
-null_ptr_exception_jpc_4:
-	sub	jpc, jpc, #1
-null_ptr_exception_jpc_3:
-	sub	jpc, jpc, #1
-null_ptr_exception_jpc_2:
-	sub	jpc, jpc, #1
-null_ptr_exception_jpc_1:
-	sub	jpc, jpc, #1
-null_ptr_exception_jpc_0:
-#endif
-null_ptr_exception:
-	mov	r0, #VMSYMBOLS_NullPointerException
-	b	raise_exception
-
-@ ==== SW FP ==============================================================================
-
-	Opcode	fadd
-	POP	r0, r1
-        bl      __aeabi_fadd
-	PUSH	r0
-	DISPATCH	1
-
-	Opcode	fsub
-	POP	r1
-	POP	r0
-        bl      __aeabi_fsub
-	PUSH	r0
-	DISPATCH	1
-
-	Opcode	fmul
-	POP	r0, r1
-        bl      __aeabi_fmul
-	PUSH	r0
-	DISPATCH	1
-
-	Opcode	fdiv
-	POP	r1
-	POP	r0
-        bl      __aeabi_fdiv
-	PUSH	r0
-	DISPATCH	1
-
-	Opcode	ddiv
-	POP	r2, r3
-	POP	r0, r1
-        bl      __aeabi_ddiv
-	PUSH	r0, r1
-	DISPATCH	1
-
-	Opcode	fcmpl
-        ldmib   stack, {r0, r1}
-        bl      __aeabi_fcmpgt
-        cmp     r0, #0
-        movne   r3, #-1
-        bne     3f
-        ldmib   stack, {r0, r1}
-        bl      __aeabi_fcmplt
-        cmp     r0, #0
-        movne   r3, #1
-        bne     3f
-        ldmib   stack, {r0, r1}
-        bl      __aeabi_fcmpeq
-        cmp     r0, #0
-        movne   r3, #0
-        moveq   r3, #-1
-3:
-	DISPATCH_START	1
-	add	stack, stack, #8
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-
-	Opcode	fcmpg
-        ldmib   stack, {r0, r1}
-        bl      __aeabi_fcmpgt
-        cmp     r0, #0
-        movne   r3, #-1
-        bne     4f
-        ldmib   stack, {r0, r1}
-        bl      __aeabi_fcmplt
-        cmp     r0, #0
-        movne   r3, #1
-        bne     4f
-        ldmib   stack, {r0, r1}
-        bl      __aeabi_fcmpeq
-        cmp     r0, #0
-        movne   r3, #0
-        moveq   r3, #1
-4:
-	DISPATCH_START	1
-	add	stack, stack, #8
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-
-	Opcode	dcmpl
-        ldmib   stack, {r0, r1, r2, r3}
-        bl      __aeabi_dcmpgt
-        cmp     r0, #0
-        movne   r3, #-1
-        bne     5f
-        ldmib   stack, {r0, r1, r2, r3}
-        bl      __aeabi_dcmplt
-        cmp     r0, #0
-        movne   r3, #1
-        bne     5f
-        ldmib   stack, {r0, r1, r2, r3}
-        bl      __aeabi_dcmpeq
-        cmp     r0, #0
-        movne   r3, #0
-        moveq   r3, #-1
-5:
-	DISPATCH_START	1
-	add	stack, stack, #16
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-
-	Opcode	dcmpg
-        ldmib   stack, {r0, r1, r2, r3}
-        bl      __aeabi_dcmpgt
-        cmp     r0, #0
-        movne   r3, #-1
-        bne     6f
-        ldmib   stack, {r0, r1, r2, r3}
-        bl      __aeabi_dcmplt
-        cmp     r0, #0
-        movne   r3, #1
-        bne     6f
-        ldmib   stack, {r0, r1, r2, r3}
-        bl      __aeabi_dcmpeq
-        cmp     r0, #0
-        movne   r3, #0
-        moveq   r3, #1
-6:
-	DISPATCH_START	1
-	add	stack, stack, #16
-	DISPATCH_NEXT
-	PUSH	r3
-	DISPATCH_FINISH
-
-@ ==== Fast SW FP emulation ===============================================================
-
-#define al		r0
-#define ah		r1
-#define bl		r2
-#define bh		r3
-#define tmp		tmp1
-#define sh		r12
-#define ex_add		r14
-
-@ TOS = TOSM1 + TOS
-@ What we actually do is TOS = TOS + TOSM1
-@ --- do_dadd_vtos -------------------------------------------------
-	Opcode	dadd
-	POP	al, ah, bl, bh
-	mov	tmp, #0xff000000
-	orr	tmp, tmp, #0x00e00000
-        bics    ex_add, tmp, ah, LSL #1
-        bicnes  ex_add, tmp, bh, LSL #1
-        beq     .dadd_naninf
-        teq     ah, bh
-        eormi   bh, bh, #1 << 31
-        bmi     ._dsub1
-._dadd1:
-        subs    ex_add, al, bl
-        sbcs    sh, ah, bh
-        bhs     .dadd_swapped
-        adds    bl, bl, ex_add
-        adc     bh, bh, sh
-        subs    al, al, ex_add
-        sbc     ah, ah, sh
-.dadd_swapped:
-        mov     ex_add, ah, LSR #20
-        sub     sh, ex_add, bh, LSR #20
-        tst     tmp, bh, LSL #1
-        beq     .dadd_uncommon
-        bic     ah, ah, ex_add, LSL #20
-        bic     bh, bh, tmp
-        orr     bh, bh, #1 << 20
-.dadd_doadd:
-        rsbs    tmp, sh, #32
-        blo     .dadd_bigshift
-.dadd_smallshift:
-        adds    al, al, bl, LSR sh
-        adc     ah, ah, bh, LSR sh
-        adds    al, al, bh, LSL tmp
-        adcs    ah, ah, #0
-        cmp     ah, #1 << 20
-        bhs     .dadd_carry
-        add     ah, ah, ex_add, LSL #20     @ add exponent
-.dadd_nocarry:
-        movs    bl, bl, LSL tmp         @ round and sticky bits
-	bpl	.dadd_exit
-        adds    al, al, #1
-        movccs  bl, bl, LSL #1          @ is sticky bit zero?
-	bne	.dadd_exit
-.dadd_roundeven:
-        cmp     al, #0
-        bicne   al, al, #1              @ RTE if carry didn't occur
-        adceq   ah, ah, #0              @ increment high word if it did
-.dadd_check_overflow_inx:
-        mov     bh, ah, LSL #1
-        cmp     bh, #0xFFE00000
-	blo	.dadd_exit
-        subhs   ah, ah, #3<<29          @ bias exponent
-	b	.return_double_Inf
-.dadd_bigshift:
-        cmp     bl, #1
-        adc     bl, bh, bh
-        sub     sh, sh, #32             @ nonzero
-        rsbs    tmp, sh, #31            @ sets C if within a word
-        movlo   tmp, #0                 @ C clear if sh > 31
-        addhss  al, al, bh, LSR sh
-        adc     ah, ah, ex_add, LSL #20
-        cmp     ex_add, ah, LSR #20
-        beq     .dadd_nocarry
-        sub     ah, ah, ex_add, LSL #20
-.dadd_carry:
-        add     ah, ah, #1 << 20
-        movs    ah, ah, LSR #1
-        add     ah, ah, ex_add, LSL #20
-        movs    al, al, RRX
-        bcc     .dadd_check_overflow_exact
-        adcs    al, al, #0
-        movccs  tmp, bl, LSL tmp    @EQ = round to even
-        bne     .dadd_check_overflow_exact
-        b       .dadd_roundeven
-.dadd_rnearup_carry:
-        adds    al, al, #1
-        movccs  bl, bl, LSL #1          @ is sticky bit zero?
-        bne     .dadd_check_overflow_inx
-        b       .dadd_roundeven
-.dadd_check_overflow_exact:
-        mov     bh, ah, LSL #1
-        cmp     bh, #0xFFE00000
-	blo	.dadd_exit
-        sub     ah, ah, #3<<29          @ bias exponent
-
-.return_double_Inf:
-	and	a3, ah, #0x80000000
-.return_double_Inf_1:
-	mov	al, #0
-	mov	ah, #0x7f000000
-	orr	ah, ah, #0x00f00000
-	orr	ah,ah,a3
-.dadd_exit:
-	PUSH	al, ah
-	DISPATCH	1
-
-.dadd_uncommon:
-        orrs    tmp, bl, bh, LSL #1     @ Is b zero or denormal?
-        beq     .dadd_bzero
-        movs    tmp, ex_add, LSL #21
-        bic     ah, ah, ex_add, LSL #20
-        bicne   bh, bh, #1 << 31
-        subne   sh, sh, #1              @ adjust exponent to fake exp_b = 1
-        bne     .dadd_doadd    
-        adds    al, al, bl
-        adc     ah, ah, bh
-        b       .daddsub_denorm
-.dadd_bzero:
-        movs    tmp, ex_add, LSL #21        @ is a denormal?
-	bne	.dadd_exit
-        orrs    tmp, al, ah, LSL #1     @ a zero?
-	beq	.dadd_exit
-        b       .daddsub_denorm
-
-.dadd_naninf:
-        cmp     al, #1                  @ sets C if al!=0
-        adc     ex_add, ah, ah
-        cmp     bl, #1
-        adc     sh, bh, bh
-        cmp     ex_add, tmp                 @ HI if a is NaN
-        cmpls   sh, tmp                 @ HI if either is NaN
-        bhi     .return_double_NaN
-        cmp     ex_add, sh
-        beq     .dadd_twoinf
-        cmp     ex_add, tmp                 @ EQ if a is Inf
-        movne   ah, bh
-        movne   al, bl
-	b	.dadd_exit
-.dadd_twoinf:
-        teq     ah, bh
-	bpl	.dadd_exit
-	b	.return_double_NaN
-
-@ --- do_dsub_itos -------------------------------------------------
-	Opcode	dsub
-	POP	al, ah, bl, bh
-        mov     tmp, #0xff000000
-        orr     tmp, tmp, #0x00e00000
-        bics    ex_add, tmp, ah, LSL #1
-        bicnes  ex_add, tmp, bh, LSL #1
-        beq     .drsb_naninf
-	teq	ah, bh
-	eor	ah, ah, #1 << 31
-	bmi	._dadd1
-	eor	bh, bh, #1 << 31
-._dsub1:
-        subs    ex_add, al, bl
-        sbcs    sh, ah, bh
-        bhs     .dsub_swapped
-.dsub_do_swap:
-        eor     sh, sh, #1 << 31        @ negate a and b as a - b == -b - -a
-        adds    bl, bl, ex_add
-        adc     bh, bh, sh
-        subs    al, al, ex_add
-        sbc     ah, ah, sh
-.dsub_swapped:
-        mov     ex_add, ah, LSR #20
-        sub     sh, ex_add, bh, LSR #20
-        tst     tmp, bh, LSL #1
-        beq     .dsub_uncommon
-        bic     ah, ah, ex_add, LSL #20
-        bic     bh, bh, tmp, ASR #1
-        rsbs    bl, bl, #0
-        rsc     bh, bh, tmp, ASR #1     @ 0xffe00000 >> 1 = -(1 << 20)
-.dsub_dosub:
-        rsbs    tmp, sh, #32
-        blo     .dsub_bigshift
-.dsub_smallshift:
-        adds    al, al, bl, LSR sh
-        adc     ah, ah, bh, ASR sh
-        adds    al, al, bh, LSL tmp
-        adcs    ah, ah, #0
-        bmi     .dsub_borrow
-.dsub_noborrow:
-        add     ah, ah, ex_add, LSL #20
-        movs    bl, bl, LSL tmp
-.dsub_dorounding:
-	bpl	.dsub_exit
-        adds    al, al, #1              @ Z flag set if carry to high word
-        cmpne   bl, #0x80000000         @ check we don't have to round to even
-	bne	.dsub_exit
-        cmp     al, #0
-        addeq   ah, ah, #1
-        bicne   al, al, #1
-	b	.dsub_exit
-.dsub_bigshift:
-        cmp     bl, #1
-        adc     bl, bh, bh 
-        sub     sh, sh, #32
-        rsbs    tmp, sh, #31
-        blo     .dsub_hugeshift
-        adds    al, al, bh, ASR sh
-        adcs    ah, ah, #-1
-        bpl     .dsub_noborrow
-.dsub_borrow:
-        add     tmp, tmp, #1
-        movs    tmp, bl, LSL tmp
-        adcs    al, al, al              @ shift al,ah left including guard bit
-        adc     ah, ah, ah
-        add     sh, ah, ex_add, LSL #21     @ ah = 0xFFE00000 + fraction. Adding
-        movs    sh, sh, LSR #21         @ C-bit is clear if bit 20 of ah
-        bls     .dsub_renormalize        @   clear, so 2 bits or more
-        add     ah, ah, ex_add, LSL #20
-        adds    al, al, tmp, LSR #31    @ C and Z flag are set if carry over
-        cmpcc   tmp, #0x80000000        @ check that we don't have to round
-	bne	.dsub_exit
-        cmp     al, #0
-        addeq   ah, ah, #1
-        bicne   al, al, #1
-	b	.dsub_exit
-.dsub_renormalize:
-        bcs     .dsub_ex_one
-        adds    ah, ah, #1 << 21
-        cmpeq   al, #0
-        beq     .dsub_retzero            @ go and deal with it, if so
-        mov     sh, ex_add, LSR #11
-        bic     ex_add, ex_add, #1 << 11
-        sub     ex_add, ex_add, #2        @ for leading bit
-.dsub_renormloop:                 @ TODO: add loop for 8 bit per cycle renorm
-        adds    al, al, al
-        adc     ah, ah, ah
-        sub     ex_add, ex_add, #1
-        tst     ah, #1 << 20
-        beq     .dsub_renormloop
-        add     ah, ah, sh, LSL #31 
-        add     ah, ah, ex_add, LSL #20
-        cmp     ex_add, #0
-	bgt	.dsub_exit
-        add     ah, ah, #3 << 29        @ bias exponent
-        @ Rounding direction indicator is zero (denormal results are exact)
-	mov	ip, #0
-        b       .__dunder
-.dsub_hugeshift:
-.dsub_return:
-        add     ah, ah, ex_add, LSL #20
-.dsub_return1:
-.dsub_exit:
-	PUSH	al, ah
-	DISPATCH	1
-.dsub_ex_one:    @ underflow when ex = 1 - shift back to denorm
-        movs    ah, ah, ASR #1
-        mov     al, al, RRX
-        add     ah, ah, ex_add, LSL #20
-        b       .dsub_denorm
-.dsub_uncommon:
-        orrs    tmp, bl, bh, LSL #12    @ is b zero or denorm?
-        beq     .dsub_bzero
-        movs    tmp, ex_add, LSL #21
-        bic     ah, ah, ex_add, LSL #20
-        beq     .dsub_both_denorm
-        bic     bh, bh, #1 << 31
-        sub     sh, sh, #1
-        rsbs    bl, bl,#0
-        rsc     bh, bh,#0
-        b       .dsub_dosub    
-.dsub_both_denorm:
-        subs    al, al, bl
-        sbc     ah, ah, bh
-        b       .dsub_denorm
-.dsub_bzero:
-        orrs    tmp, al, ah, LSL #1
-        bne     .dsub_denorm             @ return a@ but it might be denormal
-.dsub_retzero:
-        mov     ah, #0                  @ clear sign bit (al is already 0)
-	b	.dsub_exit
-.dsub_denorm:
-.daddsub_denorm:
-        movs    bl, ah, LSL #1          @ discard sign bit
-        tsteq   al, al                  @ do we have a zero?
-        beq     .dsub_retzero            @ yes@ go and ensure the right sign
-	b	.dsub_exit
-.drsb_naninf:
-        @ Handle NaNs and infinities in reverse subtraction. We
-        @ just swap the operands and go to dsub_naninf.
-        eor     ah, ah, bh
-        eor     al, al, bl
-        eor     bh, bh, ah
-        eor     bl, bl, al
-        eor     ah, ah, bh
-        eor     al, al, bl
-.dsub_naninf:
-        cmp     al, #1                  @ sets C if al!=0
-        adc     ex_add, ah, ah
-        cmp     bl, #1
-        adc     sh, bh, bh
-        cmp     ex_add, tmp                 @ HI if a is NaN
-        cmpls   sh, tmp                 @ HI if either is NaN
-        bhi     .return_double_NaN
-        cmp     ex_add, sh
-        beq     .dsub_twoinf
-        cmp     ex_add, tmp                 @ EQ if a is Inf
-        eorne   ah, bh, #0x80000000
-        movne   al, bl
-	b	.dsub_exit
-.dsub_twoinf:
-        teq     ah, bh
-	bmi	.dsub_exit
-
-.return_double_NaN:
-	and	a3, ah, #0x80000000
-	mov	al, #0
-	mov	ah, #0x7f000000
-	orr	ah, ah, #0x00f80000
-	orr	ah,ah,a3
-	b	.dsub_exit
-
-@ === underflow handler ================================================
-
-#define	INX_pos	30
-#define INX_bit (1<<30)
-
-#define exp	r2
-#define temp	r3
-
-.__dunder:
-        tst     ah, ah
-        orrmi   ip, ip, #1<<16
-        mov     temp, #0x600
-        mov     exp, ah, LSR #20      @ find the exponent
-        add     temp, temp, #1
-        bic     ah, ah, exp, LSL #20 @ remove exponent from mantissa
-        bic     exp, exp, #0x800        @ lose the sign bit
-        sub     exp, temp, exp
-        orr     ah, ah, #1<<20      @ put on mantissa leading bit
-        cmp     exp, #53
-        bhi     .dunder_stickyonly
-        beq     .dunder_roundbit
-        cmp     exp, #21
-        blo     .dunder_hiword
-        subs    exp, exp, #32
-        bls     .dunder_hiloword
-.dunder_loloword:
-        rsb     temp, exp, #32
-        cmp     al, #0
-        mov     al, ah, LSR exp
-        mov     exp, ah, LSL temp
-        orrne   exp, exp, #1
-        mov     ah, #0
-        b       .dunder_round
-.dunder_hiloword:
-        rsb     temp, exp, #0
-        add     exp, exp, #32
-        mov     ah, ah, LSL temp
-        orr     ah, ah, al, LSR exp
-        mov     exp, al, LSL temp
-        mov     al, ah
-        mov     ah, #0
-        b       .dunder_round
-.dunder_hiword:
-        rsb     temp, exp, #32
-        mov     tmp, al, LSL temp
-        mov     temp, ah, LSL temp
-        orr     al, temp, al, LSR exp
-        mov     ah, ah, LSR exp
-        mov     exp, tmp
-        b       .dunder_round
-.dunder_roundbit:
-        orrs    exp, al, ah, LSL #12
-        mov     al, #0
-        mov     ah, #0
-        mov     exp, #0x80000000
-        addne   exp, exp, #1
-        b       .dunder_round
-.dunder_stickyonly:
-        mov     exp, #1
-        mov     ah, #0
-        mov     al, #0
-.dunder_round:
-        tst     ip, #1<<16
-        bic     ip, ip, #1<<16
-        orrne   ah, ah, #0x80000000
-        tst     exp, exp
-	beq	.dsub_exit
-        movs    exp, exp, LSL #1        @ round bit in C, sticky in ~Z
-        bcc     .dunder_rerounded        @ if no round bit, we're done
-        beq     .dunder_roundeven        @ RTE is tricky due to rerounding
-.dunder_roundup:
-        adds    al, al, #1          @ round up
-        adc     ah, ah, #0
-.dunder_rerounded:
-	b	.dsub_exit
-.dunder_roundeven:
-        movs    exp, ip, ASR #INX_pos   @ get -1, 0, +1 from direction bits
-        bmi     .dunder_roundup          @ if -1, round up unconditionally
-        bne     .dunder_rerounded        @ if +1, round down unconditionally
-        adds    al, al, #1          @ round up ...
-        adc     ah, ah, #0
-        bic     al, al, #1          @ ... and then to even
-        b       .dunder_rerounded
-
-@ === MULTIPLY Double ===================================================
-
-#define ex_m		r14
-#define uh		r12
-#define ul		r4
-#define rs		r4
-#define th		r5
-#define tl		r11
-
-@ --- do_dmul_itos -------------------------------------------------
-	Opcode	dmul
-	POP	al, ah, bl, bh
-	stmdb	arm_sp!, {r4, r5}
-	mov	tmp, #0x7f00000
-	orr	tmp, tmp, #0x00f0000
-        bics    ex_m, tmp, ah, LSR #4     @ test for Infs or NaNs
-        bicnes  ex_m, tmp, bh, LSR #4
-        beq     .dmul_naninf
-        and     ex_m, tmp, ah, LSR #4     @ get exponent of a
-        eor     th, ah, bh              @ compute sign of result
-        orr     ex_m, ex_m, th, LSR #31     @   and save it at bottom of ex
-        ands    th, tmp, bh, LSR #4     @ get exponent of b, and test
-        tstne   ah, tmp, LSL #4         @   for zeros/denorms ...
-        beq     .dmul_zerodenorm         @   go and renormalise if we got any
-.dmul_normalised:
-        add     ex_m, ex_m, th              @ calculate exponent of result
-        sub     ex_m, ex_m, #0x3FC0000      @ rebias exponent mostly
-        bic     ah, ah, tmp, LSL #5     @ clear sign and all but lo bit of exp
-        bic     bh, bh, tmp, LSL #5
-        orr     ah, ah, #1<<20          @ set leading bit on mantissa
-        orr     bh, bh, #1<<20          @ set leading bit on mantissa
-.dmul_mantmul:
-        umull   ul, uh, ah, bl
-        umull   tl, th, al, bh
-        adds    tl, tl, ul
-        adcs    th, th, uh              @ carry from here is used below
-        umull   ul, uh, ah, bh          @ uh:ul is top part
-        adc     bh, uh, #0              @ get carry from above addition
-        umull   ah, uh, al, bl          @ uh:ah is bottom part
-        adds    tl, tl, uh
-        adcs    th, th, ul
-        adcs    bh, bh, #0
-        tst     ah, ah
-        orrne   tl, tl, #1              @ don't lose sticky bit
-        mov     bl, #-4
-        mov     uh, #32-12              @ uh will be corresponding right shift
-        cmp     bh, #0x200              @ C set if it's 11 bits
-        adc     uh, uh, #0
-        adc     bl, bl, ex_m, ASR #16     @ increment exponent correspondingly
-        rsb     ul, uh, #32             @ ul is left shift
-        mov     ah, bh, LSL ul
-        mov     al, th, LSL ul
-        orr     ah, ah, th, LSR uh
-        orr     al, al, tl, LSR uh
-        add     ah, ah, bl, LSL #20 @ put exponent back on (may wrap
-        eor     ah, ah, ex_m, LSL #31 @ put sign back on (with EOR so that
-        movs    rs, tl, LSL ul          @ compute the round word
-        beq     .dmul_exact
-        movs    uh, rs, LSL #1          @ rs is already in place
-        movcc   rs, #-INX_bit           @ direction indicator: rounded down
-        bcc     .dmul_rounded
-        orreq   bh, bh, #1<<31          @ save the round-to-even bit
-        adcs    al, al, #0          @ round up if necessary
-        adc     ah, ah, #0
-        mov     rs, #INX_bit            @ direction indicator: rounded up
-        tst     al, bh, LSR #31       @ does RTE do anything?
-        bic     al, al, bh, LSR #31 @ perform RTE
-        movne   rs, #-INX_bit           @ if RTE had effect, we rounded down
-.dmul_exact:
-.dmul_rounded:
-        teq     ah, ex_m, LSL #31       @ do the signs agree?
-	mov	uh, #0x70000000         @ even if so, need to test exp 0/7FF
-	orr	uh, uh, #0x0ff00000
-        bmi     .dmul_outflow            @ if not, UFL or OFL
-        tst     ah, uh
-        bicnes  uh, uh, ah            @ is exp 0 or 7FF?
-        beq     .dmul_outflow
-.dmul_exit:
-	ldmia	arm_sp!, {r4, r5}
-	PUSH	al, ah
-	DISPATCH	1
-
-.dmul_rdirect:
-        movs    ul, ex_m, LSL #31         @ put sign bit in N
-        tstpl   uh, #2 << 22        @ if +ve: EQ iff round up. Keeps PL
-        tstmi   uh, #1 << 22         @ if -ve: EQ iff round up.
-        moveq   rs, #INX_bit            @ rounded up
-        movne   rs, #-INX_bit           @ rounded down
-        addeqs  al, al, #1          @ may set C
-        adc     ah, ah, #0
-        b       .dmul_rounded
-
-.dmul_outflow:
-        cmp     ex_m, #0x400<<16          @ Which ballpark are we in?
-        addle   ah, ah, #0x60000000 @ Bias up if underflow
-        subge   ah, ah, #0x60000000 @ Bias down if overflow
-	mov	ip, rs
-	ldmia	arm_sp!, {r4, r5}
-        ble     .__dunder                @ underflow
-	b	.return_double_Inf
-
-.dmul_zerodenorm:
-        orrs    ul, al, ah, LSL #1      @ is a zero?
-        orrnes  ul, bl, bh, LSL #1      @ or is b zero?
-        beq     .dmul_zero               @ Return zero if so
-
-        tst     th, th                  @ is b denormal?
-        beq     .dmul_renorm_op2
-.dmul_done_op2:
-        bics    ul, ex_m, #1              @ is a denormal? (careful of sign bit)
-        beq     .dmul_renorm_op1
-        b       .dmul_normalised
-.dmul_zero:
-        mov     al, #0                  @ clear low word
-        mov     ah, ex_m, LSL #31         @ get sign of result and clear hi word
-	b	.dmul_exit
-
-.dmul_renorm_op1:
-        add     ex_m, ex_m, #1<<16          @ correct the exponent
-        bic     ah, ah, #0x80000000       @ this will get in our way
-        orrs    tl, ah, al, LSR #12    @ is highest set bit in low twelve?
-        moveq   al, al, LSL #20         @ if so, move it up
-        subeq   ex_m, ex_m, #20<<16       @ and adjust exponent
-        tst     ah, ah                  @ is highest set bit in low word?
-        moveq   ah, al, LSR #12         @ if so, move up by 20
-        moveq   al, al, LSL #20
-        subeq   ex_m, ex_m, #20<<16       @ and adjust exponent
-        mov     ul, #0                 @ shift of top word
-        movs    tl, ah, LSR #(21-16)   @ is highest set bit within 16 of top?
-        moveq   ah, ah, LSL #16         @ if not, move up
-        addeq   ul, ul, #16           @ and adjust exponent
-        movs    tl, ah, LSR #(21-8)   @ is highest set bit within 8 of top?
-        moveq   ah, ah, LSL #8         @ if not, move up
-        addeq   ul, ul, #8           @ and adjust exponent
-        movs    tl, ah, LSR #(21-4)   @ is highest set bit within 4 of top?
-        moveq   ah, ah, LSL #4         @ if not, move up
-        addeq   ul, ul, #4           @ and adjust exponent
-        movs    tl, ah, LSR #(21-2)   @ is highest set bit within 2 of top?
-        moveq   ah, ah, LSL #2         @ if not, move up
-        addeq   ul, ul, #2           @ and adjust exponent
-        movs    tl, ah, LSR #(21-1)   @ is highest set bit within 1 of top?
-        moveq   ah, ah, LSL #1         @ if not, move up
-        addeq   ul, ul, #1           @ and adjust exponent
-
-        sub     ex_m, ex_m, ul, LSL #16  @ calculate final pseudo exponent
-        mov     tl, al, LSL ul        @ shift low word up by same amout
-        rsb     ul, ul, #32           @ compute reverse shift for al
-        orr     ah, ah, al, LSR ul     @ put in high end of low word
-        mov     al, tl
-
-	mov	tmp, #0x7f00000
-	orr	tmp, tmp, #0x00f0000
-
-        b       .dmul_normalised
-
-.dmul_renorm_op2:
-        add     th, th, #1<<16          @ correct the exponent
-        bic     bh, bh, #0x80000000       @ this will get in our way
-        orrs    tl, bh, bl, LSR #12    @ is highest set bit in low twelve?
-        moveq   bl, bl, LSL #20         @ if so, move it up
-        subeq   th, th, #20<<16       @ and adjust exponent
-        tst     bh, bh                  @ is highest set bit in low word?
-        moveq   bh, bl, LSR #12         @ if so, move up by 20
-        moveq   bl, bl, LSL #20
-        subeq   th, th, #20<<16       @ and adjust exponent
-        mov     ul, #0                 @ shift of top word
-        movs    tl, bh, LSR #(21-16)   @ is highest set bit within 16 of top?
-        moveq   bh, bh, LSL #16         @ if not, move up
-        addeq   ul, ul, #16           @ and adjust exponent
-        movs    tl, bh, LSR #(21-8)   @ is highest set bit within 8 of top?
-        moveq   bh, bh, LSL #8         @ if not, move up
-        addeq   ul, ul, #8           @ and adjust exponent
-        movs    tl, bh, LSR #(21-4)   @ is highest set bit within 4 of top?
-        moveq   bh, bh, LSL #4         @ if not, move up
-        addeq   ul, ul, #4           @ and adjust exponent
-        movs    tl, bh, LSR #(21-2)   @ is highest set bit within 2 of top?
-        moveq   bh, bh, LSL #2         @ if not, move up
-        addeq   ul, ul, #2           @ and adjust exponent
-        movs    tl, bh, LSR #(21-1)   @ is highest set bit within 1 of top?
-        moveq   bh, bh, LSL #1         @ if not, move up
-        addeq   ul, ul, #1           @ and adjust exponent
-
-        sub     th, th, ul, LSL #16  @ calculate final pseudo exponent
-        mov     tl, bl, LSL ul        @ shift low word up by same amout
-        rsb     ul, ul, #32           @ compute reverse shift for bl
-        orr     bh, bh, bl, LSR ul     @ put in high end of low word
-        mov     bl, tl
-
-	mov	tmp, #0x7f00000
-	orr	tmp, tmp, #0x00f0000
-
-        b       .dmul_done_op2
-
-.dmul_naninf:
-        mov     uh, ah, LSL #1          @ discard sign bit on a
-        mov     ul, bh, LSL #1          @ and on b
-        cmp     uh, tmp, LSL #5         @ HI if ah shows a to be NaN
-        cmpeq   al, #0                  @ now HI if a is NaN
-        cmpls   ul, tmp, LSL #5         @ another chance to set HI ...
-        cmpeq   bl, #0                  @  ... if b is NaN
-        bhi     .dmul_ivo
-        orrs    ul, al, ah, LSL #1      @ is a zero?
-        orrnes  ul, bl, bh, LSL #1      @ or is b zero?
-        beq     .dmul_ivo
-        eor     ah, ah, bh
-        mov     al, #0
-        and     ah, ah, #0x80000000
-        orr     ah, ah, tmp, LSL #4
-	b	.dmul_exit
-
-.dmul_ivo:
-	ldmia	arm_sp!, {r4, r5}
-	b	.return_double_NaN
-
-#undef al
-#undef ah
-#undef bl
-#undef bh
-#undef tmp
-#undef sh
-#undef ex_add
-
-#undef	INX_pos
-#undef INX_bit
-
-#undef exp
-#undef temp
-
-#undef ex_m
-#undef uh
-#undef ul
-#undef rs
-#undef th
-#undef tl
-
-@ --- ignore_safepoints ---------------------------------------------------------------------------
-	.global	_ZN14CppInterpreter17ignore_safepointsEv
-	.type	_ZN14CppInterpreter17ignore_safepointsEv, %function
-_ZN14CppInterpreter17ignore_safepointsEv:
-#ifdef NOTICE_SAFEPOINTS
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r2, r3}
-	add	r2, r2, ip
-	add	ip, r3, r2
-	ldr	r2, [ip, #AbstractInterpreter_notice_safepoints-XXX]
-	ldrb	r1, [r2, #0]	@ zero_extendqisi2
-	cmp	r1, #0
-	bxeq	lr
-	mov	r3, #0
-	strb	r3, [r2, #0]
-	adrl	r3, main_dispatch_table
-#ifdef HW_FP
-	ldr	r0, [ip, #CPUInfo-XXX]
-	tst	r0, #ARCH_VFP
-	beq	2f
-#endif
-	mov	r2, #256
-1:
-	ldr	r1, [r3], #4
-	str	r1, [ip], #4
-	subs	r2, r2, #1
-	bne	1b
-	sub	ip, ip, #4 * 256
-	b	4f
-
-@ No HW FP - must update the table from a combination main_dispatch_table and
-@ vfp_table. Previously this updated from main_dispatch_table first, and then
-@ overwrite the updated entries with those from vfp_table. However, this creates
-@ a window where the jump table has vfp entries, so in a multithreaded world we
-@ can get undefined VFP instructions.
-@ The code below updates from both tables simultaneously. Note: this relies on
-@ the enties in vfp_table being in opcode order.
-#ifdef HW_FP
-2:
-	stmdb	arm_sp!, {r4, lr}
-	mov	r2, #0
-	adrl	r0, vfp_table
-	ldr	r4, [r0], #4
-3:
-	ldr	r1, [r3], #4
-	cmp	r2, r4
-	ldreq	r1, [r0], #4
-	ldreq	r4, [r0], #4
-	str	r1, [ip], #4
-	add	r2, r2, #1
-	cmp	r2, #256
-	bcc	3b
-	sub	ip, ip, #4 * 256
-	ldmia	arm_sp!, {r4, lr}
-#endif // HW_FP
-
-4:
-	ldr	r0, [ip, #CPUInfo-XXX]
-	tst	r0, #ARCH_CLZ
-	beq	5f
-
-	adrl	r0, do_idiv_clz
-	str	r0, [ip, #opc_idiv * 4]
-	adrl	r0, do_irem_clz
-	str	r0, [ip, #opc_irem * 4]
-
-5:
-#endif // NOTICE_SAFEPOINTS
-
-	bx	lr
-
-@ --- notice_safepoints ---------------------------------------------------------------------------
-	.global	_ZN14CppInterpreter17notice_safepointsEv
-	.type	_ZN14CppInterpreter17notice_safepointsEv, %function
-_ZN14CppInterpreter17notice_safepointsEv:
-#ifdef NOTICE_SAFEPOINTS
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r2, r3}
-	add	r2, r2, ip
-	add	ip, r3, r2
-	ldr	r2, [ip, #AbstractInterpreter_notice_safepoints-XXX]
-	ldrb	r1, [r2, #0]	@ zero_extendqisi2
-	cmp	r1, #0
-	bxne	lr
-	mov	r3, #1
-	strb	r3, [r2, #0]
-	adrl	r3, safe_dispatch_table
-	mov	r2, #256
-1:
-	ldr	r1, [r3], #4
-	str	r1, [ip], #4
-	subs	r2, r2, #1
-	bne	1b
-#endif
-	bx	lr
-
-@ --- END execute.s ----------------------------------------------------------------------------
-
-	ALIGN_CODE
-bci_init:
-        stmfd   sp!, {r4, lr}
-
-	adrl	r3, dispatch_init_adcon
-	ldm	r3, {r0, r1}
-	add	r0, r0, r3
-        add     r4, r1, r0
-	adrl	r2, adcon_init_table
-        mov     r1, r4
-1:
-	ldr	ip, [r2], #4
-	cmp	ip, #0
-	ldrne	ip, [r0, ip]
-	strne	ip, [r1, #-4]!
-	bne	1b
-	adrl	r2, main_dispatch_table
-	mov	r1, #256
-        mov     r3, r4
-2:
-	ldr	ip, [r2], #4
-	str	ip, [r3], #4
-	subs	r1, r1, #1
-	bne	2b
-
-	bl	hwcap
-	str	r0, [r4, #CPUInfo-XXX]
-
-#ifdef USE_COMPILER
-
-#define NPROCESSORS_CONF        83
-
-        mov     r0, #NPROCESSORS_CONF
-        bl      sysconf
-        cmp     r0, #2
-
-#ifdef DISABLE_BG_COMP_ON_NON_MP
-        movcc   r0, #0
-        ldrcc   r1, [r4, #BackgroundCompilation_Address-XXX]
-        strccb  r0, [r1]
-#endif
-
-        movcs   r0, #MP_COMPILE_THRESHOLD
-        movcc   r0, #UP_COMPILE_THRESHOLD
-        ldr     r1, [r4, #CompileThreshold_Address-XXX]
-        str     r0, [r1]
-
-#endif // USE_COMPILER
-
-#ifdef THUMB2EE
-	bl	Thumb2_Initialize
-#endif
-
-#ifdef HW_FP
-	ldr	r0, [r4, #CPUInfo-XXX]
-	tst	r0, #ARCH_VFP
-	bne	4f
-
-@ No HW FP - replace the HW FP entries with SW entries
-update_vfp_table:
-	adr	r0, vfp_table
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r2, r3}
-	add	r2, r2, ip
-	add	ip, r3, r2
-.update_vfp_loop:
-	ldr	r1, [r0], #4
-	cmp	r1, #0
-	ldrne	r2, [r0], #4
-	strne	r2, [ip, r1, lsl #2]
-	bne	.update_vfp_loop
-4:
-#endif // HW_FP
-
-	ldr	r0, [r4, #CPUInfo-XXX]
-	tst	r0, #ARCH_CLZ
-	beq	5f
-
-	adrl	r0, do_idiv_clz
-	str	r0, [r4, #opc_idiv * 4]
-	adrl	r0, do_irem_clz
-	str	r0, [r4, #opc_irem * 4]
-
-5:
-	ldmia	sp!, {r4, pc}
-
-#ifdef HW_FP
-vfp_table:
-	.word	opc_fadd,	do_fadd
-	.word	opc_dadd,	do_dadd
-	.word	opc_fsub,	do_fsub
-	.word	opc_dsub,	do_dsub
-	.word	opc_fmul,	do_fmul
-	.word	opc_dmul,	do_dmul
-	.word	opc_fdiv,	do_fdiv
-	.word	opc_ddiv,	do_ddiv
-	.word	opc_fcmpl,	do_fcmpl
-	.word	opc_fcmpg,	do_fcmpg
-	.word	opc_dcmpl,	do_dcmpl
-	.word	opc_dcmpg,	do_dcmpg
-	.word	0
-#endif // HW_FP
-
-load_dispatch:
-	adrl	ip, dispatch_init_adcon
-	ldm	ip, {r0, r1}
-	add	r0, r0, ip
-	add	dispatch, r1, r0
-	mov	pc, lr
-
-	ALIGN_DATA
-dispatch_init_adcon:
-	.word	_GLOBAL_OFFSET_TABLE_-dispatch_init_adcon, opclabels_data(GOTOFF)
-adcon_init_table:
-	.word	_ZN18InterpreterRuntime22slow_signature_handlerEP10JavaThreadP13methodOopDescPiS4_(GOT)
-	.word	_ZN20SafepointSynchronize6_stateE(GOT)
-	.word	_ZN9vmSymbols8_symbolsE(GOT)
-	.word	always_do_update_barrier(GOT)
-	.word	_ZN8Universe14_collectedHeapE(GOT)
-	.word	_ZN9Bytecodes5_nameE(GOT)
-	.word	_ZN19AbstractInterpreter18_notice_safepointsE(GOT)
-	.word	_ZN18ThreadLocalStorage13_thread_indexE(GOT)
-	.word	_ZN7oopDesc3_bsE(GOT)
-	.word	PrintCommandLineFlags(GOT)
-	.word	_ZN11JvmtiExport28_can_post_interpreter_eventsE(GOT)
-	.word	UseCompiler(GOT)
-invocationlimit_adcon:
-	.word	_ZN17InvocationCounter26InterpreterInvocationLimitE(GOT)
-        .word   CompileThreshold(GOT)
-        .word   BackgroundCompilation(GOT)
-        .word   UseOnStackReplacement(GOT)
-	.word	0
-
-	ALIGN_DATA
-main_dispatch_table:
-	MAIN_DISPATCH_TABLE
-
-#ifdef NOTICE_SAFEPOINTS
-safe_dispatch_table:
-	.word	do_nop
-	.word	do_u4const_0
-	.word	do_iconst_N
-	.word	do_iconst_N
-	.word	do_iconst_N
-	.word	do_iconst_N
-	.word	do_iconst_N
-	.word	do_iconst_N
-	.word	do_iconst_N
-	.word	do_u8const_0
-	.word	do_lconst_1
-	.word	do_u4const_0
-	.word	do_fconst_1
-	.word	do_fconst_2
-	.word	do_u8const_0
-	.word	do_dconst_1
-	.word	do_bipush
-	.word	do_sipush
-	.word	do_ldc
-	.word	do_ldc_w
-	.word	do_ldc2_w
-	.word	do_u4load
-	.word	do_u8load
-	.word	do_u4load
-	.word	do_u8load
-	.word	do_u4load
-	.word	do_iload_0
-	.word	do_iload_0
-	.word	do_iload_0
-	.word	do_iload_0
-	.word	do_u8load_0
-	.word	do_u8load_1
-	.word	do_u8load_2
-	.word	do_u8load_3
-	.word	do_fload_0
-	.word	do_fload_0
-	.word	do_fload_0
-	.word	do_fload_0
-	.word	do_u8load_0
-	.word	do_u8load_1
-	.word	do_u8load_2
-	.word	do_u8load_3
-	.word	do_aload_0
-	.word	do_aload_0
-	.word	do_aload_0
-	.word	do_aload_0
-	.word	do_u4aload
-	.word	do_u8aload
-	.word	do_u4aload
-	.word	do_u8aload
-	.word	do_u4aload
-	.word	do_baload
-	.word	do_caload
-	.word	do_saload
-	.word	do_u4store
-	.word	do_u8store
-	.word	do_u4store
-	.word	do_u8store
-	.word	do_u4store
-	.word	do_u4store_0
-	.word	do_u4store_1
-	.word	do_u4store_2
-	.word	do_u4store_3
-	.word	do_u8store_0
-	.word	do_u8store_1
-	.word	do_u8store_2
-	.word	do_u8store_3
-	.word	do_u4store_0
-	.word	do_u4store_1
-	.word	do_u4store_2
-	.word	do_u4store_3
-	.word	do_u8store_0
-	.word	do_u8store_1
-	.word	do_u8store_2
-	.word	do_u8store_3
-	.word	do_u4store_0
-	.word	do_u4store_1
-	.word	do_u4store_2
-	.word	do_u4store_3
-	.word	do_u4astore
-	.word	do_u8astore
-	.word	do_u4astore
-	.word	do_u8astore
-	.word	do_aastore
-	.word	do_bastore
-	.word	do_u2astore
-	.word	do_u2astore
-	.word	do_jpop
-	.word	do_jpop2
-	.word	do_dup
-	.word	do_dup_x1
-	.word	do_dup_x2
-	.word	do_dup2
-	.word	do_dup2_x1
-	.word	do_dup2_x2
-	.word	do_swap
-	.word	do_iadd
-	.word	do_ladd
-	.word	do_fadd
-	.word	do_dadd
-	.word	do_isub
-	.word	do_lsub
-	.word	do_fsub
-	.word	do_dsub
-	.word	do_imul
-	.word	do_lmul
-	.word	do_fmul
-	.word	do_dmul
-	.word	do_idiv
-	.word	do_ldiv
-	.word	do_fdiv
-	.word	do_ddiv
-	.word	do_irem
-	.word	do_lrem
-	.word	do_frem
-	.word	do_drem
-	.word	do_ineg
-	.word	do_lneg
-	.word	do_fneg
-	.word	do_dneg
-	.word	do_ishl
-	.word	do_lshl
-	.word	do_ishr
-	.word	do_lshr
-	.word	do_iushr
-	.word	do_lushr
-	.word	do_iand
-	.word	do_land
-	.word	do_ior
-	.word	do_lor
-	.word	do_ixor
-	.word	do_lxor
-	.word	do_iinc
-	.word	do_i2l
-	.word	do_i2f
-	.word	do_i2d
-	.word	do_l2i
-	.word	do_l2f
-	.word	do_l2d
-	.word	do_f2i
-	.word	do_f2l
-	.word	do_f2d
-	.word	do_d2i
-	.word	do_d2l
-	.word	do_d2f
-	.word	do_i2b
-	.word	do_i2c
-	.word	do_i2s
-	.word	do_lcmp
-	.word	do_fcmpl
-	.word	do_fcmpg
-	.word	do_dcmpl
-	.word	do_dcmpg
-	.word	do_ifeq
-	.word	do_ifne
-	.word	do_iflt
-	.word	do_ifge
-	.word	do_ifgt
-	.word	do_ifle
-	.word	do_if_icmpeq
-	.word	do_if_icmpne
-	.word	do_if_icmplt
-	.word	do_if_icmpge
-	.word	do_if_icmpgt
-	.word	do_if_icmple
-	.word	do_if_icmpeq
-	.word	do_if_icmpne
-	.word	do_goto
-	.word	do_jsr
-	.word	do_ret
-	.word	do_tableswitch
-	.word	do_lookupswitch
-	.word	do_ireturn
-	.word	do_lreturn
-	.word	do_ireturn
-	.word	do_lreturn
-	.word	do_ireturn
-	.word	do_return
-	.word	do_getstatic
-	.word	do_putstatic
-	.word	do_getfield
-	.word	do_putfield
-	.word	do_invokevirtual
-	.word	do_invokespecial
-	.word	do_invokestatic
-	.word	do_invokeinterface
-	.word	do_undefined
-	.word	do_new
-	.word	do_newarray
-	.word	do_anewarray
-	.word	do_arraylength
-	.word	do_athrow
-	.word	do_checkcast
-	.word	do_instanceof
-	.word	do_monitorenter
-	.word	do_monitorexit
-	.word	do_wide
-	.word	do_multianewarray
-	.word	do_ifeq
-	.word	do_ifne
-	.word	do_goto_w
-	.word	do_jsr_w
-	.word	do_breakpoint
-	.word	do_undefined
-	.word	do_bgetfield
-	.word	do_cgetfield
-	.word	do_undefined
-	.word	do_undefined
-	.word	do_igetfield
-	.word	do_lgetfield
-	.word	do_sgetfield
-	.word	do_aputfield
-	.word	do_bputfield
-	.word	do_cputfield
-	.word	do_undefined
-	.word	do_undefined
-	.word	do_iputfield
-	.word	do_lputfield
-	.word	do_undefined
-	.word	do_iaccess_0
-	.word	do_iaccess_0
-	.word	do_iaccess_0
-	.word	do_iaccess_0
-	.word	do_invokeresolved
-	.word	do_invokespecialresolved
-	.word	do_invokestaticresolved
-	.word	do_invokevfinal
-	.word	do_fast_iload_iload
-	.word	do_fast_iload_iload_N
-	.word	do_return_register_finalizer
-	.word	do_undefined
-	.word	do_iload_0_iconst_N
-	.word	do_iload_0_iconst_N
-	.word	do_iload_0_iconst_N
-	.word	do_iload_0_iconst_N
-	.word	do_iload_iconst_N
-	.word	do_iadd_istore_N
-	.word	do_isub_istore_N
-	.word	do_iand_istore_N
-	.word	do_ior_istore_N
-	.word	do_ixor_istore_N
-	.word	do_iadd_u4store
-	.word	do_isub_u4store
-	.word	do_iand_u4store
-	.word	do_ior_u4store
-	.word	do_ixor_u4store
-	.word	do_fast_iload_N_iload
-	.word	do_fast_iload_N_iload
-	.word	do_fast_iload_N_iload
-	.word	do_fast_iload_N_iload
-	.word	do_fast_iload_N_iload_N
-	.word	do_fast_iload_N_iload_N
-	.word	do_fast_iload_N_iload_N
-	.word	do_fast_iload_N_iload_N
-	.word	do_undefined
-	.word	do_undefined
-#endif
-
-	SUB_DISPATCH_TABLES
-
-	.arch	armv7-a
-
-	ALIGN_CODE
-	.global	Thumb2_stubs
-Thumb2_stubs:
-	.global	Thumb2_idiv_stub
-Thumb2_idiv_stub:
-int_div:
-	cmp     r1, #0x21
-	adr	r3, 1f
-	eor     r12, r0, r1
-	ldrcc	pc, [r3, r1, lsl #2]
-	rsblt   r1, r1, #0
-	subs    r2, r1, #1
-	beq     2f
-	movs    r3, r0
-	rsbmi   r3, r0, #0
-	cmp     r3, r1
-	bls     3f
-	tst     r1, r2
-	beq     4f
-	clz     r2, r3
-	clz     r0, r1
-	sub     r2, r0, r2
-	rsbs    r2, r2, #31
-	add     r2, r2, r2, lsl #1
-	mov     r0, #0
-	add     pc, pc, r2, lsl #2
-	mov	r0, #0
-	cmp     r3, r1, lsl #31
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #31
-	cmp     r3, r1, lsl #30
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #30
-	cmp     r3, r1, lsl #29
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #29
-	cmp     r3, r1, lsl #28
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #28
-	cmp     r3, r1, lsl #27
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #27
-	cmp     r3, r1, lsl #26
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #26
-	cmp     r3, r1, lsl #25
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #25
-	cmp     r3, r1, lsl #24
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #24
-	cmp     r3, r1, lsl #23
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #23
-	cmp     r3, r1, lsl #22
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #22
-	cmp     r3, r1, lsl #21
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #21
-	cmp     r3, r1, lsl #20
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #20
-	cmp     r3, r1, lsl #19
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #19
-	cmp     r3, r1, lsl #18
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #18
-	cmp     r3, r1, lsl #17
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #17
-	cmp     r3, r1, lsl #16
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #16
-	cmp     r3, r1, lsl #15
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #15
-	cmp     r3, r1, lsl #14
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #14
-	cmp     r3, r1, lsl #13
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #13
-	cmp     r3, r1, lsl #12
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #12
-	cmp     r3, r1, lsl #11
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #11
-	cmp     r3, r1, lsl #10
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #10
-	cmp     r3, r1, lsl #9
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #9
-	cmp     r3, r1, lsl #8
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #8
-	cmp     r3, r1, lsl #7
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #7
-	cmp     r3, r1, lsl #6
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #6
-	cmp     r3, r1, lsl #5
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #5
-	cmp     r3, r1, lsl #4
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #4
-	cmp     r3, r1, lsl #3
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #3
-	cmp     r3, r1, lsl #2
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #2
-	cmp     r3, r1, lsl #1
-	adc     r0, r0, r0
-	subcs   r3, r3, r1, lsl #1
-	cmp     r3, r1
-	adc     r0, r0, r0
-	subcs   r3, r3, r1
-	cmp     r12, #0
-	rsbmi   r0, r0, #0
-	bx      lr
-2:
-	teq     r12, r0
-	rsbmi   r0, r0, #0
-	bx      lr
-3:
-	movcc   r0, #0
-	asreq   r0, r12, #31
-	orreq   r0, r0, #1
-	bx      lr
-4:
-	clz     r2, r1
-	rsb     r2, r2, #31
-	cmp     r12, #0
-	lsr     r0, r3, r2
-	rsbmi   r0, r0, #0
-	bx      lr
-1:
-	.word	Thumb2_DivZero_Handler
-	.word	jdiv_1
-	.word	jdiv_2
-	.word	jdiv_3
-	.word	jdiv_4
-	.word	jdiv_5
-	.word	jdiv_6
-	.word	jdiv_7
-	.word	jdiv_8
-	.word	jdiv_9
-	.word	jdiv_10
-	.word	jdiv_11
-	.word	jdiv_12
-	.word	jdiv_13
-	.word	jdiv_14
-	.word	jdiv_15
-	.word	jdiv_16
-	.word	jdiv_17
-	.word	jdiv_18
-	.word	jdiv_19
-	.word	jdiv_20
-	.word	jdiv_21
-	.word	jdiv_22
-	.word	jdiv_23
-	.word	jdiv_24
-	.word	jdiv_25
-	.word	jdiv_26
-	.word	jdiv_27
-	.word	jdiv_28
-	.word	jdiv_29
-	.word	jdiv_30
-	.word	jdiv_31
-	.word	jdiv_32
-	ALIGN_CODE
-	.global	Thumb2_irem_stub
-Thumb2_irem_stub:
-int_rem:
-	cmp     r1, #0x21
-	adr	r3, 1f
-	ldrcc	pc, [r3, r1, lsl #2]
-	rsblt   r1, r1, #0
-	subs    r2, r1, #1
-	beq     2f
-	movs    r12, r0
-	rsbmi   r0, r0, #0
-	cmp     r0, r1
-	bls     3f
-	tst     r1, r2
-	beq     4f
-	clz     r2, r0
-	clz     r3, r1
-	sub     r2, r3, r2
-	rsbs    r2, r2, #31
-	add     pc, pc, r2, lsl #3
-	mov	r3, #0
-	cmp     r0, r1, lsl #31
-	subcs   r0, r0, r1, lsl #31
-	cmp     r0, r1, lsl #30
-	subcs   r0, r0, r1, lsl #30
-	cmp     r0, r1, lsl #29
-	subcs   r0, r0, r1, lsl #29
-	cmp     r0, r1, lsl #28
-	subcs   r0, r0, r1, lsl #28
-	cmp     r0, r1, lsl #27
-	subcs   r0, r0, r1, lsl #27
-	cmp     r0, r1, lsl #26
-	subcs   r0, r0, r1, lsl #26
-	cmp     r0, r1, lsl #25
-	subcs   r0, r0, r1, lsl #25
-	cmp     r0, r1, lsl #24
-	subcs   r0, r0, r1, lsl #24
-	cmp     r0, r1, lsl #23
-	subcs   r0, r0, r1, lsl #23
-	cmp     r0, r1, lsl #22
-	subcs   r0, r0, r1, lsl #22
-	cmp     r0, r1, lsl #21
-	subcs   r0, r0, r1, lsl #21
-	cmp     r0, r1, lsl #20
-	subcs   r0, r0, r1, lsl #20
-	cmp     r0, r1, lsl #19
-	subcs   r0, r0, r1, lsl #19
-	cmp     r0, r1, lsl #18
-	subcs   r0, r0, r1, lsl #18
-	cmp     r0, r1, lsl #17
-	subcs   r0, r0, r1, lsl #17
-	cmp     r0, r1, lsl #16
-	subcs   r0, r0, r1, lsl #16
-	cmp     r0, r1, lsl #15
-	subcs   r0, r0, r1, lsl #15
-	cmp     r0, r1, lsl #14
-	subcs   r0, r0, r1, lsl #14
-	cmp     r0, r1, lsl #13
-	subcs   r0, r0, r1, lsl #13
-	cmp     r0, r1, lsl #12
-	subcs   r0, r0, r1, lsl #12
-	cmp     r0, r1, lsl #11
-	subcs   r0, r0, r1, lsl #11
-	cmp     r0, r1, lsl #10
-	subcs   r0, r0, r1, lsl #10
-	cmp     r0, r1, lsl #9
-	subcs   r0, r0, r1, lsl #9
-	cmp     r0, r1, lsl #8
-	subcs   r0, r0, r1, lsl #8
-	cmp     r0, r1, lsl #7
-	subcs   r0, r0, r1, lsl #7
-	cmp     r0, r1, lsl #6
-	subcs   r0, r0, r1, lsl #6
-	cmp     r0, r1, lsl #5
-	subcs   r0, r0, r1, lsl #5
-	cmp     r0, r1, lsl #4
-	subcs   r0, r0, r1, lsl #4
-	cmp     r0, r1, lsl #3
-	subcs   r0, r0, r1, lsl #3
-	cmp     r0, r1, lsl #2
-	subcs   r0, r0, r1, lsl #2
-	cmp     r0, r1, lsl #1
-	subcs   r0, r0, r1, lsl #1
-	cmp     r0, r1
-	subcs   r0, r0, r1
-	cmp     r12, #0
-	rsbmi   r0, r0, #0
-	bx      lr
-2:
-	mov	r0, #0
-	bx      lr
-3:
-	moveq	r0, #0
-	cmp	r12, #0
-	rsbmi	r0, r0, #0
-	bx	lr
-4:
-	and	r0, r0, r2
-	cmp	r12, #0
-	rsbmi	r0, r0, #0
-	bx      lr
-1:
-	.word	Thumb2_DivZero_Handler
-	.word	jrem_1
-	.word	jrem_2
-	.word	jrem_3
-	.word	jrem_4
-	.word	jrem_5
-	.word	jrem_6
-	.word	jrem_7
-	.word	jrem_8
-	.word	jrem_9
-	.word	jrem_10
-	.word	jrem_11
-	.word	jrem_12
-	.word	jrem_13
-	.word	jrem_14
-	.word	jrem_15
-	.word	jrem_16
-	.word	jrem_17
-	.word	jrem_18
-	.word	jrem_19
-	.word	jrem_20
-	.word	jrem_21
-	.word	jrem_22
-	.word	jrem_23
-	.word	jrem_24
-	.word	jrem_25
-	.word	jrem_26
-	.word	jrem_27
-	.word	jrem_28
-	.word	jrem_29
-	.word	jrem_30
-	.word	jrem_31
-	.word	jrem_32
-
-#ifdef THUMB2EE
-@ R0 = BCI
-@ R1 = index
-#define Rthread	r9
-	.global	Thumb2_invokeinterface_stub
-Thumb2_invokeinterface_stub:
-	stmdb	sp!, {ip, lr}
-	ldr	ip, [istate, #ISTATE_METHOD]
-	sub	stack, stack, #4
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	ldr	ip, [ip, #METHOD_CONSTMETHOD]
-	DECACHE_STACK
-	add	jpc, ip, r0
-
-        add     r0, r2, r1, lsl #4
-	DECACHE_JPC
-
-        ldr     r2, [r0, #CP_OFFSET]
-        and     r2, r2, #0x00ff0000
-        cmp     r2, #opc_invokeinterface << 16
-        bne     istub_resolve
-2:
-	ldr	r3, [r0, #CP_OFFSET+12]
-	and	r2, r3, #255
-	ldr	r2, [stack, r2, lsl #2]
-	cmp	r2, #0
-	beq	istub_null_ptr_exception
-	ldr	tmp2, [r2, #4]				@ rcvr->klass()
-	tst	r3, #flag_methodInterface
-	bne	istub_methodInterface
-
-	ldr	lr, [r0, #CP_OFFSET+4]			@ lr = iclass
-
-	add	r1, tmp2, #INSTANCEKLASS_VTABLE_OFFSET
-	ldr	r2, [tmp2, #KLASS_PART+INSTANCEKLASS_VTABLE_LEN]
-	ldr	ip, [tmp2, #KLASS_PART+INSTANCEKLASS_ITABLE_LEN]
-	add	r2, r2, #1
-	bic	r2, r2, #1
-
-	add	r1, r1, r2, lsl #2
-
-	mov	r2, #0
-1:
-	cmp	r2, ip
-	beq	istub_incompatibleclass_exception
-	ldr	r3, [r1], #8
-	add	r2, r2, #1
-	cmp	lr, r3
-	bne	1b
-
-	ldr	r3, [r0, #CP_OFFSET+8]
-	ldr	r2, [r1, #-4]
-	add	r3, tmp2, r3, lsl #2
-	ldr	tmp2, [r3, r2]
-	cmp	tmp2, #0
-	beq	istub_abstractmethod_exception
-istub_invoke:
-	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
-	mov	r1, #0
-	str	ip, [istate, #36]
-	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
-
-	add	stack, stack, #4
-	str	stack, [Rthread, #THREAD_JAVA_SP]
-
-	ldr	r3, [ip]
-
-	mov	r0, tmp2
-	mov	r1, ip
-#ifndef SHARK
-	add	r3, r3, #CODE_ALIGN_SIZE
-#endif
-	mov	r2, Rthread
-	blx	r3
-
-	ldr	Rthread, [istate, #ISTATE_THREAD]
-
-	ldr	stack, [Rthread, #THREAD_JAVA_SP]
-	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
-
-	ldr	r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
-	add	r2, r2, #4
-	str	r2, [Rthread, #THREAD_JAVA_SP]
-	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
-	ldr	r3, [Rthread, #4]
-	cmp	r3, #0
-	bne	istub_exception
-	ldmia	sp!, {ip, pc}
-
-istub_methodInterface:
-	tst	r3, #flag_vfinalMethod
-	ldrne	tmp2, [r0, #CP_OFFSET+8]
-	bne	istub_invoke
-	ldr	r1, [r0, #CP_OFFSET+8]
-	add	r3, tmp2, r1, lsl #2
-	ldr	tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
-	b	istub_invoke
-
-istub_resolve:
-	mov	tmp2, r1
-	mov	r1, #opc_invokeinterface
-	ldr	r0, [istate, #ISTATE_THREAD]
-	ldr	ip, resolve_invoke_adcon
-	blx	ip
-	ldr	r3, [Rthread, #4]
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	cmp	r3, #0
-	bne	istub_exception
-	add	r0, r2, tmp2, lsl #4	@ r1 = cache
-	b	2b
-
-istub_exception:
-	ldmia	sp!, {ip, lr}
-	ldr	ip, handle_exception_adcon
-	bx	ip
-
-istub_null_ptr_exception:
-	mov	r0, #VMSYMBOLS_NullPointerException
-	b	3f
-istub_abstractmethod_exception:
-	mov	r0, #VMSYMBOLS_AbstractMethodError
-	b	3f
-istub_incompatibleclass_exception:
-	mov	r0, #VMSYMBOLS_IncompatibleClassChangeError
-3:
-	CACHE_JPC
-	ldmia	sp!, {ip, lr}
-	ldr	ip, raise_exception_adcon
-	bx	ip
-
-resolve_invoke_adcon:
-	.word	_ZN18InterpreterRuntime14resolve_invokeEP10JavaThreadN9Bytecodes4CodeE
-resolve_get_put_adcon:
-       	.word   _ZN18InterpreterRuntime15resolve_get_putEP10JavaThreadN9Bytecodes4CodeE
-handle_exception_adcon:
-	.word	handle_exception_with_bcp
-raise_exception_adcon:
-	.word	raise_exception
-helper_aputfield_adcon:
-	.word	Helper_aputfield
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_invokevirtual_stub
-Thumb2_invokevirtual_stub:
-	stmdb	sp!, {ip, lr}
-        ldr     ip, [istate, #ISTATE_METHOD]
-        sub     stack, stack, #4
-        ldr     r2, [istate, #ISTATE_CONSTANTS]
-        ldr     ip, [ip, #METHOD_CONSTMETHOD]
-        DECACHE_STACK
-        add     jpc, ip, r0
-
-        add     r0, r2, r1, lsl #4
-        DECACHE_JPC
-
-        ldr     r2, [r0, #CP_OFFSET]
-        and     r2, r2, #0xff000000
-        cmp     r2, #opc_invokevirtual << 24
-        bne     ivstub_resolve
-2:
-
-	ldr	r3, [r0, #CP_OFFSET+12]
-        and     r2, r3, #255
-        ldr     r2, [stack, r2, asl #2]
-        cmp     r2, #0
-        beq     istub_null_ptr_exception
-
-        ldr     tmp2, [r0, #CP_OFFSET+8]
-        tst     r3, #flag_vfinalMethod
-        bne     1f
-
-        ldr     r3, [r2, #4]
-        add     r3, r3, tmp2, lsl #2
-        ldr     tmp2, [r3, #INSTANCEKLASS_VTABLE_OFFSET]
-1:
-	mov	r1, #0
-        ldr     ip, [tmp2, #METHOD_FROM_INTERPRETED]
-        str     r1, [Rthread, #THREAD_LAST_JAVA_SP]
-        str     ip, [istate, #36]
-
-        add     stack, stack, #4
-        str     stack, [Rthread, #THREAD_JAVA_SP]
-
-        ldr     r3, [ip, #0]
-
-	mov	r0, tmp2
-	mov	r1, ip
-#ifndef SHARK
-	add	r3, r3, #CODE_ALIGN_SIZE
-#endif
-	mov	r2, Rthread
-	blx	r3
-
-        ldr     Rthread, [istate, #ISTATE_THREAD]
-
-	ldr	stack, [Rthread, #THREAD_JAVA_SP]
-	ldr	r2, [istate, #ISTATE_STACK_LIMIT]
-
-	ldr	r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
-	add	r2, r2, #4
-	str	r2, [Rthread, #THREAD_JAVA_SP]
-	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
-	ldr	r3, [Rthread, #4]
-	cmp	r3, #0
-	bne	istub_exception
-	ldmia	sp!, {ip, pc}
-
-ivstub_resolve:
-	mov	tmp2, r1
-	mov	r1, #opc_invokevirtual
-	ldr	r0, [istate, #ISTATE_THREAD]
-	ldr	ip, resolve_invoke_adcon
-	blx	ip
-	ldr	r3, [Rthread, #4]
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	cmp	r3, #0
-	bne	istub_exception
-	add	r0, r2, tmp2, lsl #4	@ r1 = cache
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_invokestatic_stub
-Thumb2_invokestatic_stub:
-        stmdb   sp!, {ip, lr}
-        ldr     ip, [istate, #ISTATE_METHOD]
-        sub     stack, stack, #4
-        ldr     r2, [istate, #ISTATE_CONSTANTS]
-        ldr     ip, [ip, #METHOD_CONSTMETHOD]
-        DECACHE_STACK
-        add     jpc, ip, r0
-
-        add     r0, r2, r1, lsl #4
-        DECACHE_JPC
-
-        ldr     r2, [r0, #CP_OFFSET]
-	and	r2, r2, #0x00ff0000
-	cmp	r2, #opc_invokestatic << 16
-	bne	isstub_resolve
-2:
-	ldr	tmp2, [r0, #CP_OFFSET+4]
-	mov	r1, #0
-	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
-	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
-	str	ip, [istate, #36]
-
-	add	stack, stack, #4
-	str	stack, [Rthread, #THREAD_JAVA_SP]
-
-	ldr	r3, [ip, #0]
-
-        mov     r0, tmp2
-        mov     r1, ip
-#ifndef SHARK
-        add     r3, r3, #CODE_ALIGN_SIZE
-#endif
-        mov     r2, Rthread
-        blx     r3
-
-        ldr     Rthread, [istate, #ISTATE_THREAD]
-
-        ldr     stack, [Rthread, #THREAD_JAVA_SP]
-        ldr     r2, [istate, #ISTATE_STACK_LIMIT]
-
-        ldr     r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
-        add     r2, r2, #4
-        str     r2, [Rthread, #THREAD_JAVA_SP]
-        str     r1, [Rthread, #THREAD_LAST_JAVA_SP]
-        ldr     r3, [Rthread, #4]
-        cmp     r3, #0
-        bne     istub_exception
-        ldmia   sp!, {ip, pc}
-
-isstub_resolve:
-        mov     tmp2, r1
-        mov     r1, #opc_invokestatic
-        ldr     r0, [istate, #ISTATE_THREAD]
-        ldr     ip, resolve_invoke_adcon
-        blx     ip
-        ldr     r3, [Rthread, #4]
-        ldr     r2, [istate, #ISTATE_CONSTANTS]
-        cmp     r3, #0
-        bne     istub_exception
-        add     r0, r2, tmp2, lsl #4    @ r1 = cache
-        b       2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_invokespecial_stub
-Thumb2_invokespecial_stub:
-        stmdb   sp!, {ip, lr}
-        ldr     ip, [istate, #ISTATE_METHOD]
-        sub     stack, stack, #4
-        ldr     r2, [istate, #ISTATE_CONSTANTS]
-        ldr     ip, [ip, #METHOD_CONSTMETHOD]
-        DECACHE_STACK
-        add     jpc, ip, r0
-
-        add     r0, r2, r1, lsl #4
-        DECACHE_JPC
-
-        ldr     r2, [r0, #CP_OFFSET]
-	and	r2, r2, #0x00ff0000
-	cmp	r2, #opc_invokespecial << 16
-	bne	ispstub_resolve
-2:
-        ldr     r3, [r0, #CP_OFFSET+12]
-        and     r3, r3, #255
-        ldr     r2, [stack, r3, asl #2]
-	cmp	r2, #0
-	beq	istub_null_ptr_exception
-
-	ldr	tmp2, [r0, #CP_OFFSET+4]
-	mov	r1, #0
-	ldr	ip, [tmp2, #METHOD_FROM_INTERPRETED]
-	str	r1, [Rthread, #THREAD_LAST_JAVA_SP]
-	str	ip, [istate, #36]
-
-	add	stack, stack, #4
-	str	stack, [Rthread, #THREAD_JAVA_SP]
-
-	ldr	r3, [ip, #0]
-
-        mov     r0, tmp2
-        mov     r1, ip
-#ifndef SHARK
-        add     r3, r3, #CODE_ALIGN_SIZE
-#endif
-        mov     r2, Rthread
-        blx     r3
-
-        ldr     Rthread, [istate, #ISTATE_THREAD]
-
-        ldr     stack, [Rthread, #THREAD_JAVA_SP]
-        ldr     r2, [istate, #ISTATE_STACK_LIMIT]
-
-        ldr     r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
-        add     r2, r2, #4
-        str     r2, [Rthread, #THREAD_JAVA_SP]
-        str     r1, [Rthread, #THREAD_LAST_JAVA_SP]
-        ldr     r3, [Rthread, #4]
-        cmp     r3, #0
-        bne     istub_exception
-        ldmia   sp!, {ip, pc}
-
-ispstub_resolve:
-        mov     tmp2, r1
-        mov     r1, #opc_invokespecial
-        ldr     r0, [istate, #ISTATE_THREAD]
-        ldr     ip, resolve_invoke_adcon
-        blx     ip
-        ldr     r3, [Rthread, #4]
-        ldr     r2, [istate, #ISTATE_CONSTANTS]
-        cmp     r3, #0
-        bne     istub_exception
-        add     r0, r2, tmp2, lsl #4    @ r1 = cache
-        b       2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_getfield_word_stub
-Thumb2_getfield_word_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getfield << 16
-	bne	1f
-2:
-	ldr	r3, [stack], #4		@ POP r3
-	ldr	ip, [r2, #CP_OFFSET+8]
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	ldr	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_getfield_sh_stub
-Thumb2_getfield_sh_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getfield << 16
-	bne	1f
-2:
-	ldr	r3, [stack], #4		@ POP r3
-	ldr	ip, [r2, #CP_OFFSET+8]
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	ldrsh	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_getfield_h_stub
-Thumb2_getfield_h_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getfield << 16
-	bne	1f
-2:
-	ldr	r3, [stack], #4		@ POP r3
-	ldr	ip, [r2, #CP_OFFSET+8]
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	ldrh	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_getfield_sb_stub
-Thumb2_getfield_sb_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getfield << 16
-	bne	1f
-2:
-	ldr	r3, [stack], #4		@ POP r3
-	ldr	ip, [r2, #CP_OFFSET+8]
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	ldrsb	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_getfield_dw_stub
-Thumb2_getfield_dw_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getfield << 16
-	bne	1f
-2:
-	ldr	r3, [stack], #4		@ POP r3
-	ldr	ip, [r2, #CP_OFFSET+8]
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	ldrd	r2, r3, [r3, ip]
-	stmdb	stack!, {r2, r3}	@ PUSH r2, r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-putstatic_stub_unresolved:
-	mov	r2, #opc_putstatic
-	b	field_stub_unresolved
-getstatic_stub_unresolved:
-	mov	r2, #opc_getstatic
-	b	field_stub_unresolved
-putfield_stub_unresolved:
-	mov	r2, #opc_putfield
-	b	field_stub_unresolved
-getfield_stub_unresolved:
-	mov	r2, #opc_getfield
-field_stub_unresolved:
-	stmdb	sp!, {r0, r1, ip, lr}
-        ldr     ip, [istate, #ISTATE_METHOD]
-	sub	r3, stack, #4
-	ldr	ip, [ip, #METHOD_CONSTMETHOD]
-	str	r3, [istate, #ISTATE_STACK]	@ DECACHE_STACK
-	add	r3, ip, r0
-	str	r3, [istate, #ISTATE_BCP]	@ DECACHE_JPC
-	ldr	ip, resolve_get_put_adcon
-	mov	r1, r2
-	ldr	r0, [istate, #ISTATE_THREAD]
-	blx	ip
-	ldmia	sp!, {r0, r1, ip, lr}
-	ldr	r3, [Rthread, #4]
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	cmp	r3, #0
-	bne	field_exception
-	add	r2, r2, r1, lsl #4
-	bx	lr
-
-field_null_ptr_exception:
-        ldr     ip, [istate, #ISTATE_METHOD]
-        ldr     ip, [ip, #METHOD_CONSTMETHOD]
-        add     jpc, ip, r0
-	mov	r0, #VMSYMBOLS_NullPointerException
-	ldr	ip, raise_exception_adcon
-	bx	ip
-
-field_exception:
-	ldr	ip, handle_exception_adcon
-	bx	ip
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_putfield_word_stub
-Thumb2_putfield_word_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putfield << 24
-	bne	1f
-2:
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	str	r2, [r3, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_putfield_h_stub
-Thumb2_putfield_h_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putfield << 24
-	bne	1f
-2:
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	strh	r2, [r3, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_putfield_b_stub
-Thumb2_putfield_b_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putfield << 24
-	bne	1f
-2:
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	strb	r2, [r3, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_putfield_a_stub
-Thumb2_putfield_a_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putfield << 24
-	bne	1f
-2:
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldmia	stack!, {r2, r3}	@ r2 = value, r3 = obj
-	cmp	r3, #0
-	beq	field_null_ptr_exception
-
-	str	r2, [r3, ip]
-	ldr	ip, helper_aputfield_adcon
-	mov	r0, r3
-	bx	ip
-1:
-	mov	ip, lr
-	bl	putfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_putfield_dw_stub
-Thumb2_putfield_dw_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putfield << 24
-	bne	1f
-2:
-	ldr	r1, [r2, #CP_OFFSET+8]
-	ldmia	stack!, {r2, r3, ip}	@ r2,r3 = value, ip = obj
-	cmp	ip, #0
-	beq	field_null_ptr_exception
-
-	strd	r2,r3, [ip, r1]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putfield_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_getstatic_word_stub
-Thumb2_getstatic_word_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getstatic << 16
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-
-	ldr	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_getstatic_h_stub
-Thumb2_getstatic_h_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getstatic << 16
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-
-	ldrh	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_getstatic_sh_stub
-Thumb2_getstatic_sh_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getstatic << 16
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-
-	ldrsh	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_getstatic_sb_stub
-Thumb2_getstatic_sb_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getstatic << 16
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-
-	ldrsb	r3, [r3, ip]
-	str	r3, [stack, #-4]!	@ PUSH r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-	.global	Thumb2_getstatic_dw_stub
-Thumb2_getstatic_dw_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0x00ff0000
-	cmp	r3, #opc_getstatic << 16
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-
-	ldrd	r2, r3, [r3, ip]
-	stmdb	stack!, {r2, r3}	@ PUSH r2, r3
-	bx	lr
-1:
-	mov	ip, lr
-	bl	getstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_putstatic_word_stub
-Thumb2_putstatic_word_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putstatic << 24
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldr	r2, [stack], #4		@ POP r2
-
-	str	r2, [r3, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_putstatic_h_stub
-Thumb2_putstatic_h_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putstatic << 24
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldr	r2, [stack], #4		@ POP r2
-
-	strh	r2, [r3, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_putstatic_b_stub
-Thumb2_putstatic_b_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putstatic << 24
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldr	r2, [stack], #4		@ POP r2
-
-	strb	r2, [r3, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_putstatic_dw_stub
-Thumb2_putstatic_dw_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putstatic << 24
-	bne	1f
-2:
-	ldr	r1, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldmia	stack!, {r2, r3}
-
-	strd	r2,r3, [r1, ip]
-	bx	lr
-1:
-	mov	ip, lr
-	bl	putstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-@ R0 = BCI
-@ R1 = index
-	.global	Thumb2_putstatic_a_stub
-Thumb2_putstatic_a_stub:
-	ldr	r2, [istate, #ISTATE_CONSTANTS]
-	add	r2, r2, r1, lsl #4
-	ldr	r3, [r2, #CP_OFFSET]
-	and	r3, r3, #0xff000000
-	cmp	r3, #opc_putstatic << 24
-	bne	1f
-2:
-	ldr	r3, [r2, #CP_OFFSET+4]
-	ldr	ip, [r2, #CP_OFFSET+8]
-	ldr	r2, [stack], #4		@ POP r2
-
-	str	r2, [r3, ip]
-	ldr	ip, helper_aputfield_adcon
-	mov	r0, r3
-	bx	ip
-1:
-	mov	ip, lr
-	bl	putstatic_stub_unresolved
-	mov	lr, ip
-	b	2b
-
-#endif // THUMB2EE
-
-	.global	Thumb2_stubs_end
-Thumb2_stubs_end:
-
-	ALIGN_CODE
-jdiv_1:
-	bx	lr
-jdiv_2:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-	bx	lr
-jdiv_24:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_12:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_6:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_3:
-	ldr	r1, dc_3
-        smull	r3, r2, r0, r1
-        sub	r0, r2, r0, asr #31
-	bx	lr
-jdiv_4:
-	mov	r1, r0, asr #31
-	add	r0, r0, r1, lsr #30
-	mov	r0, r0, asr #2
-	bx	lr
-jdiv_20:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_10:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_5:
-	ldr	r1, dc_5
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #1
-	bx	lr
-jdiv_28:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_14:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_7:
-	ldr	r1, dc_7
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r0, r1, r3, asr #2
-	bx	lr
-jdiv_8:
-	mov	r1, r0, asr #31
-	add	r0, r0, r1, lsr #29
-	mov	r0, r0, asr #3
-	bx	lr
-jdiv_18:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_9:
-	ldr	r1, dc_9
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #1
-	bx	lr
-jdiv_22:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_11:
-	ldr	r1, dc_11
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #1
-	bx	lr
-jdiv_26:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_13:
-	ldr	r1, dc_13
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #2
-	bx	lr
-jdiv_30:
-        add     r0, r0, r0, lsr #31
-        mov     r0, r0, asr #1
-jdiv_15:
-	ldr	r1, dc_15
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r0, r1, r3, asr #3
-	bx	lr
-jdiv_16:
-	mov	r1, r0, asr #31
-	add	r0, r0, r1, lsr #28
-	mov	r0, r0, asr #4
-	bx	lr
-jdiv_17:
-	ldr	r1, dc_17
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #3
-	bx	lr
-jdiv_19:
-	ldr	r1, dc_19
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #3
-	bx	lr
-jdiv_21:
-	ldr	r1, dc_21
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #2
-	bx	lr
-jdiv_23:
-	ldr	r1, dc_23
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r0, r1, r3, asr #4
-	bx	lr
-jdiv_25:
-	ldr	r1, dc_25
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #3
-	bx	lr
-jdiv_27:
-	ldr	r1, dc_27
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r0, r3, r2, asr #3
-	bx	lr
-jdiv_29:
-	ldr	r1, dc_29
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r0, r1, r3, asr #4
-	bx	lr
-jdiv_31:
-	ldr	r1, dc_31
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r0, r1, r3, asr #4
-	bx	lr
-jdiv_32:
-	mov	r1, r0, asr #31
-	add	r0, r0, r1, lsr #27
-	mov	r0, r0, asr #5
-	bx	lr
-jrem_1:
-	mov	r0, #0
-	bx	lr
-jrem_2:
-	add	r3, r0, r0, lsr #31
-        mov	r1, r3, asr #1
-	sub	r0, r0, r1, lsl #1
-	bx	lr
-jrem_3:
-	ldr	r1, dc_3
-        smull	r3, r2, r0, r1
-        sub	r1, r2, r0, asr #31
-	add	r3, r1, r1, lsl #1
-	sub	r0, r0, r3
-	bx	lr
-jrem_4:
-	movs	r3, r0
-        addmi	r3, r3, #3
-        mov	r1, r3, asr #2
-	sub	r0, r0, r1, lsl #2
-	bx	lr
-jrem_5:
-	ldr	r1, dc_5
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #1
-	add	r3, r1, r1, lsl #2
-	sub	r0, r0, r3
-	bx	lr
-jrem_6:
-	ldr	r1, dc_6
-        smull	r3, r2, r0, r1
-        sub	r1, r2, r0, asr #31
-	add	r3, r1, r1, lsl #1
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_7:
-	ldr	r1, dc_7
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #2
-	rsb	r3, r1, r1, lsl #3
-	sub	r0, r0, r3
-	bx	lr
-jrem_8:
-	movs	r3, r0
-        addmi	r3, r3, #7
-        mov	r1, r3, asr #3
-	sub	r0, r0, r1, lsl #3
-	bx	lr
-jrem_9:
-	ldr	r1, dc_9
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #1
-	add	r3, r1, r1, lsl #3
-	sub	r0, r0, r3
-	bx	lr
-jrem_10:
-	ldr	r1, dc_10
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #2
-	add	r3, r1, r1, lsl #2
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_11:
-	ldr	r1, dc_11
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #1
-	add	r3, r1, r1, lsl #2
-	add	r3, r1, r3, lsl #1
-	sub	r0, r0, r3
-	bx	lr
-jrem_12:
-	ldr	r1, dc_12
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #1
-	add	r3, r1, r1, lsl #1
-	sub	r0, r0, r3, lsl #2
-	bx	lr
-jrem_13:
-	ldr	r1, dc_13
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #2
-	add	r3, r1, r1, lsl #1
-	add	r3, r1, r3, lsl #2
-	sub	r0, r0, r3
-	bx	lr
-jrem_14:
-	ldr	r1, dc_14
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #3
-	rsb	r3, r1, r1, lsl #3
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_15:
-	ldr	r1, dc_15
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #3
-	rsb	r3, r1, r1, lsl #4
-	sub	r0, r0, r3
-	bx	lr
-jrem_16:
-	movs	r3, r0
-        addmi	r3, r3, #15
-        mov	r1, r3, asr #4
-	sub	r0, r0, r1, lsl #4
-	bx	lr
-jrem_17:
-	ldr	r1, dc_17
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #3
-	add	r3, r1, r1, lsl #4
-	sub	r0, r0, r3
-	bx	lr
-jrem_18:
-	ldr	r1, dc_18
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #2
-	add	r3, r1, r1, lsl #3
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_19:
-	ldr	r1, dc_19
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #3
-	add	r3, r1, r1, lsl #3
-	add	r3, r1, r3, lsl #1
-	sub	r0, r0, r3
-	bx	lr
-jrem_20:
-	ldr	r1, dc_20
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #3
-	add	r3, r1, r1, lsl #2
-	sub	r0, r0, r3, lsl #2
-	bx	lr
-jrem_21:
-	ldr	r1, dc_21
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #2
-	add	r3, r1, r1, lsl #1
-	rsb	r3, r3, r3, lsl #3
-	sub	r0, r0, r3
-	bx	lr
-jrem_22:
-	ldr	r1, dc_22
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #2
-	add	r3, r1, r1, lsl #2
-	add	r3, r1, r3, lsl #1
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_23:
-	ldr	r1, dc_23
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #4
-	add	r3, r1, r1, lsl #1
-	rsb	r3, r1, r3, lsl #3
-	sub	r0, r0, r3
-	bx	lr
-jrem_24:
-	ldr	r1, dc_24
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #2
-	add	r3, r1, r1, lsl #1
-	sub	r0, r0, r3, lsl #3
-	bx	lr
-jrem_25:
-	ldr	r1, dc_25
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #3
-	add	r3, r1, r1, lsl #2
-	add	r3, r3, r3, lsl #2
-	sub	r0, r0, r3
-	bx	lr
-jrem_26:
-	ldr	r1, dc_26
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #3
-	add	r3, r1, r1, lsl #1
-	add	r3, r1, r3, lsl #2
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_27:
-	ldr	r1, dc_27
-        smull	r3, r2, r0, r1
-        mov	r3, r0, asr #31
-        rsb	r1, r3, r2, asr #3
-	add	r3, r1, r1, lsl #1
-	add	r3, r3, r3, lsl #3
-	sub	r0, r0, r3
-	bx	lr
-jrem_28:
-	ldr	r1, dc_28
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #4
-	rsb	r3, r1, r1, lsl #3
-	sub	r0, r0, r3, lsl #2
-	bx	lr
-jrem_29:
-	ldr	r1, dc_29
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #4
-	rsb	r3, r1, r1, lsl #3
-	add	r3, r1, r3, lsl #2
-	sub	r0, r0, r3
-	bx	lr
-jrem_30:
-	ldr	r1, dc_30
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #4
-	rsb	r3, r1, r1, lsl #4
-	sub	r0, r0, r3, lsl #1
-	bx	lr
-jrem_31:
-	ldr	r1, dc_31
-        smull	r3, r2, r0, r1
-        mov	r1, r0, asr #31
-        add	r3, r0, r2
-        rsb	r1, r1, r3, asr #4
-	rsb	r3, r1, r1, lsl #5
-	sub	r0, r0, r3
-	bx	lr
-jrem_32:
-	movs	r3, r0
-        addmi	r3, r3, #31
-        mov	r1, r3, asr #5
-	sub	r0, r0, r1, lsl #5
-	bx	lr
-	ALIGN_DATA
-dc_7:
-dc_14:
-	.word     0x92492493
-dc_15:
-dc_30:
-	.word     0x88888889
-dc_23:
-	.word     0xb21642c9
-dc_28:
-	.word     0x92492493
-dc_29:
-	.word     0x8d3dcb09
-dc_31:
-	.word     0x84210843
-dc_6:
-dc_12:
-dc_24:
-	.word     0x2aaaaaab
-dc_19:
-	.word     0x6bca1af3
-dc_5:
-dc_10:
-dc_20:
-	.word     0x66666667
-dc_21:
-	.word     0x30c30c31
-dc_11:
-dc_22:
-	.word     0x2e8ba2e9
-dc_26:
-dc_13:
-	.word     0x4ec4ec4f
-dc_25:
-	.word     0x51eb851f
-dc_27:
-	.word     0x4bda12f7
-dc_3:
-	.word     0x55555556
-dc_17:
-	.word     0x78787879
-dc_9:
-dc_18:
-	.word     0x38e38e39
-
-#define TBIT 1
-
-	.global	Thumb2_DivZero_Handler
-Thumb2_DivZero_Handler:
-#ifdef THUMB2EE
-
-#define JAZ_V1	r5
-#define JAZ_V2	r6
-#define JAZ_V3	r7
-#define	JAZ_V4	r10
-#define	JAZ_V5	r11
-
-#define JAZ_REGSET	JAZ_V1,JAZ_V2,JAZ_V3,JAZ_V4,JAZ_V5,ip
-#define JAZ_REGSET_LEN	6
-
-	adrl	r0, idiv_clz_ret
-	cmp	r0, lr
-	addne	r0, r0, #irem_clz_ret - idiv_clz_ret
-	cmpne	r0, lr
-	beq	divide_by_zero_exception
-	stmdb	sp!, {JAZ_REGSET}
-	bic	r0, lr, #TBIT
-	ldr	r1, [istate, #ISTATE_METHOD]
-        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
-	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
-	mov	r2, sp
-	ldr	r3, [istate, #ISTATE_LOCALS]
-	bl	Thumb2_lr_to_bci
-	add	sp, sp, #JAZ_REGSET_LEN * 4
-	cmp	r0, #-1
-	moveq	jpc, #0
-	addne	jpc, jpc, r0
-	bl	load_dispatch
-#endif // THUMB2EE
-	b	divide_by_zero_exception
-
-#ifdef THUMB2EE
-
-	.global	Thumb2_Handle_Exception
-	.global	Thumb2_Handle_Exception_NoRegs
-	.global	Thumb2_ArrayBounds_Handler
-	.global	Thumb2_NullPtr_Handler
-	.global Thumb2_Stack_Overflow
-Thumb2_ArrayBounds_Handler:
-	stmdb	sp!, {JAZ_REGSET}
-	bic	r0, lr, #TBIT
-	ldr	r1, [istate, #ISTATE_METHOD]
-        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
-	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
-	mov	r2, sp
-	ldr	r3, [istate, #ISTATE_LOCALS]
-	bl	Thumb2_lr_to_bci
-	add	sp, sp, #JAZ_REGSET_LEN * 4
-	cmp	r0, #-1
-	moveq	jpc, #0
-	addne	jpc, jpc, r0
-	bl	load_dispatch
-	mov	r0, #VMSYMBOLS_ArrayIndexOutOfBounds
-	b	raise_exception
-Thumb2_Handle_Exception:
-	stmdb	sp!, {JAZ_REGSET}
-	bic	r0, lr, #TBIT
-	ldr	r1, [istate, #ISTATE_METHOD]
-        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
-	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
-	mov	r2, sp
-	ldr	r3, [istate, #ISTATE_LOCALS]
-	bl	Thumb2_lr_to_bci
-	add	sp, sp, #JAZ_REGSET_LEN * 4
-	cmp	r0, #-1
-	moveq	jpc, #0
-	addne	jpc, jpc, r0
-	bl	load_dispatch
-	b	handle_exception
-Thumb2_Handle_Exception_NoRegs:
-	bic	r0, lr, #TBIT
-	ldr	r1, [istate, #ISTATE_METHOD]
-        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
-	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
-	mov	r2, #0
-	bl	Thumb2_lr_to_bci
-	cmp	r0, #-1
-	moveq	jpc, #0
-	addne	jpc, jpc, r0
-	bl	load_dispatch
-	b	handle_exception
-Thumb2_NullPtr_Handler:
-	stmdb	sp!, {JAZ_REGSET}
-	bic	r0, lr, #TBIT
-	ldr	r1, [istate, #ISTATE_METHOD]
-        ldr     jpc, [r1, #METHOD_CONSTMETHOD]
-	add	jpc, jpc, #CONSTMETHOD_CODEOFFSET
-	mov	r2, sp
-	ldr	r3, [istate, #ISTATE_LOCALS]
-	bl	Thumb2_lr_to_bci
-	add	sp, sp, #JAZ_REGSET_LEN * 4
-	cmp	r0, #-1
-	moveq	jpc, #0
-	addne	jpc, jpc, r0
-	bl	load_dispatch
-	b	null_ptr_exception
-
-Thumb2_Stack_Overflow:
-	mov	r0, r2
-	ldr	ip, [r0, #THREAD_TOP_ZERO_FRAME]
-	str	ip, [r0, #THREAD_LAST_JAVA_SP]
-	bl	_ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
-	ldmfd	arm_sp!, {fast_regset, pc}
-
-	.global	Thumb2_Exit_To_Interpreter
-Thumb2_Exit_To_Interpreter:
-	bl	load_dispatch
-	sub	stack, stack, #4
-	CACHE_CP
-	CACHE_LOCALS
-	DISPATCH	0
-
-	.global	Thumb2_Clear_Cache
-Thumb2_Clear_Cache:
-	stmdb	sp!, {r7}
-	mov	r2, #0
-	mov	r7, #2
-	orr	r7, r7, #0xf0000
-	svc	0
-	ldmia	sp!, {r7}
-	bx	lr
-
-#endif // THUMB2EE
-
-	.section	.init_array,"aw",%init_array
-	.word	bci_init(target1)
-
-	.data
-	.global	CPUInfo
-	ALIGN_DATA
-        .word   0, 0, 0, 0, 0, 0, 0, 0
-        .word   0, 0, 0, 0, 0
-DispatchBreakPoint:					.word	0
-CPUInfo:						.word	0
-CodeTrace_Idx:						.word	0
-UseOnStackReplacement_Address:                          .word   0
-BackgroundCompilation_Address:                          .word   0
-CompileThreshold_Address:                               .word   0
-InterpreterInvocationLimit_Address:			.word	0
-UseCompiler_Address:					.word	0
-can_post_interpreter_events:				.word	0
-PrintCommandLineFlags_Address:				.word	0
-oopDesc_Address:					.word	0
-ThreadLocalStorage_thread_index:			.word	0
-AbstractInterpreter_notice_safepoints:			.word	0
-Bytecodes_name_Address:					.word	0
-Universe_collectedHeap_Address:				.word	0
-always_do_update_barrier_Address:			.word	0
-VmSymbols_symbols_Address:				.word	0
-SafePointSynchronize_state_Address:			.word	0
-InterpreterRuntime_slow_signature_handler_Address:	.word	0
-XXX:
-opclabels_data:
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	.word	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-#endif
--- a/ports/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-// Set the default values for platform dependent flags used by the
-// Shark compiler.  See globals.hpp for details of what they do.
-
-define_pd_global(bool,     BackgroundCompilation,        true );
-define_pd_global(bool,     UseTLAB,                      true );
-define_pd_global(bool,     ResizeTLAB,                   true );
-define_pd_global(bool,     InlineIntrinsics,             false);
-define_pd_global(bool,     PreferInterpreterNativeStubs, false);
-define_pd_global(bool,     ProfileTraps,                 false);
-define_pd_global(bool,     UseOnStackReplacement,        true );
-define_pd_global(bool,     TieredCompilation,            false);
-
-define_pd_global(intx,     CompileThreshold,             1500);
-define_pd_global(intx,     Tier2CompileThreshold,        1500);
-define_pd_global(intx,     Tier3CompileThreshold,        2500);
-define_pd_global(intx,     Tier4CompileThreshold,        4500);
-
-define_pd_global(intx,     BackEdgeThreshold,            100000);
-define_pd_global(intx,     Tier2BackEdgeThreshold,       100000);
-define_pd_global(intx,     Tier3BackEdgeThreshold,       100000);
-define_pd_global(intx,     Tier4BackEdgeThreshold,       100000);
-
-define_pd_global(intx,     OnStackReplacePercentage,     933  );
-define_pd_global(intx,     FreqInlineSize,               325  );
-define_pd_global(intx,     InlineSmallCode,              1000 );
-define_pd_global(intx,     NewRatio,                     12   );
-define_pd_global(intx,     NewSizeThreadIncrease,        4*K  );
-define_pd_global(intx,     InitialCodeCacheSize,         160*K);
-define_pd_global(intx,     ReservedCodeCacheSize,        32*M );
-define_pd_global(bool,     ProfileInterpreter,           false);
-define_pd_global(intx,     CodeCacheExpansionSize,       32*K );
-define_pd_global(uintx,    CodeCacheMinBlockLength,      1    );
-define_pd_global(uintx,    PermSize,                     12*M );
-define_pd_global(uintx,    MaxPermSize,                  64*M );
-define_pd_global(bool,     NeverActAsServerClassMachine, true );
-define_pd_global(uintx,    DefaultMaxRAM,                1*G  );
-define_pd_global(bool,     CICompileOSR,                 true );
--- a/ports/hotspot/src/cpu/zero/vm/thumb2.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7456 +0,0 @@
-/*
- * Copyright 2009, 2010 Edward Nevill
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#undef THUMB2EE
-#if !defined(DISABLE_THUMB2) && defined(HOTSPOT_ASM) && !defined(SHARK)
-#define THUMB2EE
-#endif
-
-#ifdef THUMB2EE
-
-#define T2EE_PRINT_COMPILATION
-#define T2EE_PRINT_STATISTICS
-//#define T2EE_PRINT_DISASS
-#define T2EE_PRINT_REGUSAGE
-
-#ifdef T2EE_PRINT_COMPILATION
-static char *t2ee_print_compilation;
-#endif
-
-#ifdef T2EE_PRINT_STATISTICS
-static char *t2ee_print_statistics;
-#endif
-
-#ifdef T2EE_PRINT_DISASS
-static char *t2ee_print_disass;
-#endif
-
-#ifdef T2EE_PRINT_REGUSAGE
-static char *t2ee_print_regusage;
-#endif
-
-#define THUMB2_CODEBUF_SIZE (8 * 1024 * 1024)
-#define THUMB2_MAX_BYTECODE_SIZE 10000
-#define THUMB2_MAX_T2CODE_SIZE 65000
-#define THUMB2_MAXLOCALS 1000
-
-#include <sys/mman.h>
-
-#include "incls/_precompiled.incl"
-
-#ifdef T2EE_PRINT_DISASS
-#include "dis-asm.h"
-#include "bfd.h"
-#endif
-
-#define opc_nop			0x00
-#define opc_aconst_null		0x01
-#define opc_iconst_m1		0x02
-#define opc_iconst_0		0x03
-#define opc_iconst_1		0x04
-#define opc_iconst_2		0x05
-#define opc_iconst_3		0x06
-#define opc_iconst_4		0x07
-#define opc_iconst_5		0x08
-#define opc_lconst_0		0x09
-#define opc_lconst_1		0x0a
-#define opc_fconst_0		0x0b
-#define opc_fconst_1		0x0c
-#define opc_fconst_2		0x0d
-#define opc_dconst_0		0x0e
-#define opc_dconst_1		0x0f
-#define opc_bipush		0x10
-#define opc_sipush		0x11
-#define opc_ldc			0x12
-#define opc_ldc_w		0x13
-#define opc_ldc2_w		0x14
-#define opc_iload		0x15
-#define opc_lload		0x16
-#define opc_fload		0x17
-#define opc_dload		0x18
-#define opc_aload		0x19
-#define opc_iload_0		0x1a
-#define opc_iload_1		0x1b
-#define opc_iload_2		0x1c
-#define opc_iload_3		0x1d
-#define opc_lload_0		0x1e
-#define opc_lload_1		0x1f
-#define opc_lload_2		0x20
-#define opc_lload_3		0x21
-#define opc_fload_0		0x22
-#define opc_fload_1		0x23
-#define opc_fload_2		0x24
-#define opc_fload_3		0x25
-#define opc_dload_0		0x26
-#define opc_dload_1		0x27
-#define opc_dload_2		0x28
-#define opc_dload_3		0x29
-#define opc_aload_0		0x2a
-#define opc_aload_1		0x2b
-#define opc_aload_2		0x2c
-#define opc_aload_3		0x2d
-#define opc_iaload		0x2e
-#define opc_laload		0x2f
-#define opc_faload		0x30
-#define opc_daload		0x31
-#define opc_aaload		0x32
-#define opc_baload		0x33
-#define opc_caload		0x34
-#define opc_saload		0x35
-#define opc_istore		0x36
-#define opc_lstore		0x37
-#define opc_fstore		0x38
-#define opc_dstore		0x39
-#define opc_astore		0x3a
-#define opc_istore_0		0x3b
-#define opc_istore_1		0x3c
-#define opc_istore_2		0x3d
-#define opc_istore_3		0x3e
-#define opc_lstore_0		0x3f
-#define opc_lstore_1		0x40
-#define opc_lstore_2		0x41
-#define opc_lstore_3		0x42
-#define opc_fstore_0		0x43
-#define opc_fstore_1		0x44
-#define opc_fstore_2		0x45
-#define opc_fstore_3		0x46
-#define opc_dstore_0		0x47
-#define opc_dstore_1		0x48
-#define opc_dstore_2		0x49
-#define opc_dstore_3		0x4a
-#define opc_astore_0		0x4b
-#define opc_astore_1		0x4c
-#define opc_astore_2		0x4d
-#define opc_astore_3		0x4e
-#define opc_iastore		0x4f
-#define opc_lastore		0x50
-#define opc_fastore		0x51
-#define opc_dastore		0x52
-#define opc_aastore		0x53
-#define opc_bastore		0x54
-#define opc_castore		0x55
-#define opc_sastore		0x56
-#define opc_pop			0x57
-#define opc_pop2		0x58
-#define opc_dup			0x59
-#define opc_dup_x1		0x5a
-#define opc_dup_x2		0x5b
-#define opc_dup2		0x5c
-#define opc_dup2_x1		0x5d
-#define opc_dup2_x2		0x5e
-#define opc_swap		0x5f
-#define opc_iadd		0x60
-#define opc_ladd		0x61
-#define opc_fadd		0x62
-#define opc_dadd		0x63
-#define opc_isub		0x64
-#define opc_lsub		0x65
-#define opc_fsub		0x66
-#define opc_dsub		0x67
-#define opc_imul		0x68
-#define opc_lmul		0x69
-#define opc_fmul		0x6a
-#define opc_dmul		0x6b
-#define opc_idiv		0x6c
-#define opc_ldiv		0x6d
-#define opc_fdiv		0x6e
-#define opc_ddiv		0x6f
-#define opc_irem		0x70
-#define opc_lrem		0x71
-#define opc_frem		0x72
-#define opc_drem		0x73
-#define opc_ineg		0x74
-#define opc_lneg		0x75
-#define opc_fneg		0x76
-#define opc_dneg		0x77
-#define opc_ishl		0x78
-#define opc_lshl		0x79
-#define opc_ishr		0x7a
-#define opc_lshr		0x7b
-#define opc_iushr		0x7c
-#define opc_lushr		0x7d
-#define opc_iand		0x7e
-#define opc_land		0x7f
-#define opc_ior			0x80
-#define opc_lor			0x81
-#define opc_ixor		0x82
-#define opc_lxor		0x83
-#define opc_iinc		0x84
-#define opc_i2l			0x85
-#define opc_i2f			0x86
-#define opc_i2d			0x87
-#define opc_l2i			0x88
-#define opc_l2f			0x89
-#define opc_l2d			0x8a
-#define opc_f2i			0x8b
-#define opc_f2l			0x8c
-#define opc_f2d			0x8d
-#define opc_d2i			0x8e
-#define opc_d2l			0x8f
-#define opc_d2f			0x90
-#define opc_i2b			0x91
-#define opc_i2c			0x92
-#define opc_i2s			0x93
-#define opc_lcmp		0x94
-#define opc_fcmpl		0x95
-#define opc_fcmpg		0x96
-#define opc_dcmpl		0x97
-#define opc_dcmpg		0x98
-#define opc_ifeq		0x99
-#define opc_ifne		0x9a
-#define opc_iflt		0x9b
-#define opc_ifge		0x9c
-#define opc_ifgt		0x9d
-#define opc_ifle		0x9e
-#define opc_if_icmpeq		0x9f
-#define opc_if_icmpne		0xa0
-#define opc_if_icmplt		0xa1
-#define opc_if_icmpge		0xa2
-#define opc_if_icmpgt		0xa3
-#define opc_if_icmple		0xa4
-#define opc_if_acmpeq		0xa5
-#define opc_if_acmpne		0xa6
-#define opc_goto		0xa7
-#define opc_jsr			0xa8
-#define opc_ret			0xa9
-#define opc_tableswitch		0xaa
-#define opc_lookupswitch	0xab
-#define opc_ireturn		0xac
-#define opc_lreturn		0xad
-#define opc_freturn		0xae
-#define opc_dreturn		0xaf
-#define opc_areturn		0xb0
-#define opc_return		0xb1
-#define opc_getstatic		0xb2
-#define opc_putstatic		0xb3
-#define opc_getfield		0xb4
-#define opc_putfield		0xb5
-#define opc_invokevirtual	0xb6
-#define opc_invokespecial	0xb7
-#define opc_invokestatic	0xb8
-#define opc_invokeinterface	0xb9
-#define opc_new			0xbb
-#define opc_newarray		0xbc
-#define opc_anewarray		0xbd
-#define opc_arraylength		0xbe
-#define opc_athrow		0xbf
-#define opc_checkcast		0xc0
-#define opc_instanceof		0xc1
-#define opc_monitorenter	0xc2
-#define opc_monitorexit		0xc3
-#define opc_wide		0xc4
-#define opc_multianewarray	0xc5
-#define opc_ifnull		0xc6
-#define opc_ifnonnull		0xc7
-#define opc_goto_w		0xc8
-#define opc_jsr_w		0xc9
-#define opc_breakpoint		0xca
-
-#define OPC_LAST_JAVA_OP	0xca
-
-#define opc_bgetfield			0xcc
-#define opc_cgetfield			0xcd
-#define opc_igetfield			0xd0
-#define opc_lgetfield			0xd1
-#define opc_sgetfield			0xd2
-#define opc_aputfield			0xd3
-#define opc_bputfield			0xd4
-#define opc_cputfield			0xd5
-#define opc_iputfield			0xd8
-#define opc_lputfield			0xd9
-#define opc_iaccess_0			0xdb
-#define opc_iaccess_1			0xdc
-#define opc_iaccess_2			0xdd
-#define opc_iaccess_3			0xde
-#define opc_invokeresolved		0xdf
-#define opc_invokespecialresolved	0xe0
-#define opc_invokestaticresolved	0xe1
-#define opc_invokevfinal		0xe2
-#define opc_iload_iload			0xe3
-#define opc_iload_iload_N		0xe4
-#define opc_return_register_finalizer	0xe5
-#define opc_dmac			0xe6
-#define opc_iload_0_iconst_N		0xe7
-#define opc_iload_1_iconst_N		0xe8
-#define opc_iload_2_iconst_N		0xe9
-#define opc_iload_3_iconst_N		0xea
-#define opc_iload_iconst_N		0xeb
-#define opc_iadd_istore_N		0xec
-#define opc_isub_istore_N		0xed
-#define opc_iand_istore_N		0xee
-#define opc_ior_istore_N		0xef
-#define opc_ixor_istore_N		0xf0
-#define opc_iadd_u4store		0xf1
-#define opc_isub_u4store		0xf2
-#define opc_iand_u4store		0xf3
-#define opc_ior_u4store			0xf4
-#define opc_ixor_u4store		0xf5
-#define opc_iload_0_iload		0xf6
-#define opc_iload_1_iload		0xf7
-#define opc_iload_2_iload		0xf8
-#define opc_iload_3_iload		0xf9
-#define opc_iload_0_iload_N		0xfa
-#define opc_iload_1_iload_N		0xfb
-#define opc_iload_2_iload_N		0xfc
-#define opc_iload_3_iload_N		0xfd
-
-#define H_IREM				0
-#define H_IDIV				1
-#define H_LDIV				2
-#define H_LREM				3
-#define H_FREM				4
-#define H_DREM				5
-#define	H_LDC				6
-#define H_NEW				8
-#define H_I2F				9
-#define H_I2D				10
-#define H_L2F				11
-#define H_L2D				12
-#define H_F2I				13
-#define H_F2L				14
-#define H_F2D				15
-#define H_D2I				16
-#define H_D2L				17
-#define H_D2F				18
-#define H_NEWARRAY			19
-#define H_ANEWARRAY			20
-#define H_MULTIANEWARRAY		21
-#define H_INSTANCEOF			22
-#define H_CHECKCAST			23
-#define H_AASTORE			24
-#define H_APUTFIELD			25
-#define H_SYNCHRONIZED_ENTER		26
-#define H_SYNCHRONIZED_EXIT		27
-
-#define H_EXIT_TO_INTERPRETER		28
-
-#define H_GETSTATIC			H_EXIT_TO_INTERPRETER
-#define H_PUTSTATIC			H_EXIT_TO_INTERPRETER
-#define H_JSR				H_EXIT_TO_INTERPRETER
-#define H_RET				H_EXIT_TO_INTERPRETER
-#define H_ZOMBIE			H_EXIT_TO_INTERPRETER
-#define H_MONITOR			H_EXIT_TO_INTERPRETER
-#define H_ATHROW			H_EXIT_TO_INTERPRETER
-
-#define H_HANDLE_EXCEPTION		29
-#define H_ARRAYBOUND			30
-#define H_UNKNOWN			31
-
-#define H_DEBUG_METHODENTRY		32
-#define H_DEBUG_METHODEXIT		33
-#define H_DEBUG_METHODCALL		34
-
-#define H_INVOKEINTERFACE		35
-#define H_INVOKEVIRTUAL			36
-#define H_INVOKESTATIC			37
-#define H_INVOKESPECIAL			38
-
-#define H_GETFIELD_WORD			39
-#define H_GETFIELD_SH			40
-#define H_GETFIELD_H			41
-#define H_GETFIELD_SB			42
-#define H_GETFIELD_DW			43
-
-#define H_PUTFIELD_WORD			44
-#define H_PUTFIELD_H			45
-#define H_PUTFIELD_B			46
-#define H_PUTFIELD_A			47
-#define H_PUTFIELD_DW			48
-
-#define H_GETSTATIC_WORD		49
-#define H_GETSTATIC_SH			50
-#define H_GETSTATIC_H			51
-#define H_GETSTATIC_SB			52
-#define H_GETSTATIC_DW			53
-
-#define H_PUTSTATIC_WORD		54
-#define H_PUTSTATIC_H			55
-#define H_PUTSTATIC_B			56
-#define H_PUTSTATIC_A			57
-#define H_PUTSTATIC_DW			58
-
-#define H_STACK_OVERFLOW		59
-
-#define H_HANDLE_EXCEPTION_NO_REGS	60
-
-unsigned handlers[61];
-
-#define LEAF_STACK_SIZE			200
-#define STACK_SPARE			40
-
-#define COMPILER_RESULT_FAILED	1	// Failed to compiled this method
-#define COMPILER_RESULT_FATAL	2	// Fatal - dont try compile anything ever again
-
-#include <setjmp.h>
-
-static jmp_buf compiler_error_env;
-
-#ifdef PRODUCT
-
-#define JASSERT(cond, msg)	0
-#define J_Unimplemented() longjmp(compiler_error_env, COMPILER_RESULT_FATAL)
-
-#else
-
-#define JASSERT(cond, msg)	do { if (!(cond)) fatal(msg); } while (0)
-#define J_Unimplemented()       { report_unimplemented(__FILE__, __LINE__); BREAKPOINT; }
-
-#endif // PRODUCT
-
-#define GET_NATIVE_U2(p)	(*(unsigned short *)(p))
-
-#define GET_JAVA_S1(p)		(((signed char *)(p))[0])
-#define GET_JAVA_S2(p)  	((((signed char *)(p))[0] << 8) + (p)[1])
-#define GET_JAVA_U2(p)		(((p)[0] << 8) + (p)[1])
-#define GET_JAVA_U4(p)		(((p)[0] << 24) + ((p)[1] << 16) + ((p)[2] << 8) + (p)[3])
-
-#define BYTESEX_REVERSE(v) (((v)<<24) | (((v)<<8) & 0xff0000) | (((v)>>8) & 0xff00) | ((v)>>24))
-#define BYTESEX_REVERSE_U2(v) (((v)<<8) | ((v)>>8))
-
-typedef struct Thumb2_CodeBuf {
-  unsigned size;
-  char *sp;
-  char *hp;
-} Thumb2_CodeBuf;
-
-Thumb2_CodeBuf *thumb2_codebuf;
-
-unsigned bc_stackinfo[THUMB2_MAX_BYTECODE_SIZE];
-unsigned locals_info[1000];
-unsigned stack[1000];
-unsigned r_local[1000];
-
-#ifdef T2EE_PRINT_DISASS
-short start_bci[THUMB2_MAX_T2CODE_SIZE];
-short end_bci[THUMB2_MAX_T2CODE_SIZE];
-#endif
-
-// XXX hardwired constants!
-#define ENTRY_FRAME             1
-#define INTERPRETER_FRAME       2
-#define SHARK_FRAME             3
-#define FAKE_STUB_FRAME         4
-
-#include "offsets_arm.s"
-
-#define BC_FLAGS_MASK		0xfc000000
-#define BC_VISITED_P1		0x80000000
-#define BC_BRANCH_TARGET	0x40000000
-#define BC_COMPILED		0x20000000
-#define BC_VISITED_P2		0x10000000
-#define BC_ZOMBIE		0x08000000
-#define BC_BACK_TARGET		0x04000000
-
-#define IS_DEAD(x)	(((x) & BC_VISITED_P1) == 0)
-#define IS_ZOMBIE(x)	(((x) & BC_ZOMBIE) || ((x) & BC_VISITED_P2) == 0)
-
-#define LOCAL_MODIFIED		31
-#define LOCAL_REF		30
-#define LOCAL_DOUBLE		29
-#define LOCAL_FLOAT		28
-#define LOCAL_LONG		27
-#define LOCAL_INT		26
-#define LOCAL_ALLOCATED		25
-
-#define LOCAL_COUNT_BITS	10
-#define LOCAL_READ_POS		0
-#define LOCAL_WRITE_POS		LOCAL_COUNT_BITS
-
-#define LOCAL_READS(x)		(((x) >> LOCAL_READ_POS) & ((1<<LOCAL_COUNT_BITS)-1))
-#define LOCAL_WRITES(x)		(((x) >> LOCAL_WRITE_POS) & ((1<<LOCAL_COUNT_BITS)-1))
-#define LOCAL_SET_COUNTS(r, w)	(((r) << LOCAL_READ_POS) | (((w) << LOCAL_WRITE_POS)))
-#define LOCAL_INC_COUNT(c)	((c) < ((1<<LOCAL_COUNT_BITS)-1) ? (c)+1 : (c))
-
-#define STACK_REGS	4
-#define FP_STACK_REGS	4
-
-typedef unsigned	u32;
-typedef unsigned	Reg;
-
-#define	ARM_R0		0
-#define ARM_R1		1
-#define ARM_R2		2
-#define ARM_R3		3
-#define ARM_R4		4
-#define ARM_R5		5
-#define ARM_R6		6
-#define ARM_R7		7
-#define ARM_R8		8
-#define ARM_R9		9
-#define ARM_R10		10
-#define ARM_R11		11
-#define ARM_IP		12
-#define ARM_SP		13
-#define ARM_LR		14
-#define ARM_PC		15
-#define ARM_CPSR	16	// CPSR in sigcontext
-#define ARM_FAULT	17	// fault address in sigcontext
-
-#define CPSR_THUMB_BIT	(1<<5)
-
-#define VFP_S0		32
-#define VFP_S1		33
-#define VFP_S2		34
-#define VFP_S3		35
-#define VFP_S4		36
-#define VFP_S5		37
-#define VFP_S6		38
-#define VFP_S7		39
-
-#define VFP_D0		64
-#define VFP_D1		65
-#define VFP_D2		66
-#define VFP_D3		67
-#define VFP_D4		68
-#define VFP_D5		69
-#define VFP_D6		70
-#define VFP_D7		71
-
-#define PREGS	5
-
-#define JAZ_V1	ARM_R5
-#define JAZ_V2	ARM_R6
-#define JAZ_V3	ARM_R7
-#define JAZ_V4	ARM_R10
-#define JAZ_V5	ARM_R11
-
-#define Rstack		ARM_R4
-#define Rlocals		ARM_R7
-#define Ristate		ARM_R8
-#define Rthread		ARM_R9
-
-#define Rint_stack	ARM_R4
-#define Rint_jpc	ARM_R5
-#define Rint_istate	ARM_R8
-
-#define IS_ARM_INT_REG(r) ((r) <= ARM_PC)
-#define IS_ARM_FP_REG(r) (!IS_ARM_INT_REG(r))
-
-#define I_REGSET	((1<<ARM_R4) | (1<<ARM_R5) | (1<<ARM_R6) | (1<<ARM_R7) | \
-			 (1<<ARM_R9) | (1<<ARM_R10) | (1<<ARM_R11))
-#define C_REGSET	(1<<ARM_R8)
-
-#define LOG2(n) binary_log2(n)
-
-unsigned binary_log2(unsigned n)
-{
-  unsigned r = 0;
-  if ((n & 0xffff) == 0) r = 16, n >>= 16;
-  if ((n & 0xff) == 0) r += 8, n >>= 8;
-  if ((n & 0xf) == 0) r += 4, n >>= 4;
-  if ((n & 3) == 0) r += 2, n >>= 2;
-  if ((n & 1) == 0) r += 1;
-  return r;
-}
-
-typedef struct Compiled_Method {
-    // All entry points aligned on a cache line boundary
-    //		.align	CODE_ALIGN
-    // slow_entry:				@ callee save interface
-    // 		push	{r4, r5, r6, r7, r9, r10, r11, lr}
-    // 		bl	fast_entry
-    // 		pop	{r4, r5, r6, r7, r9, r10, r11, pc}
-    unsigned slow_entry[3];
-    unsigned *osr_table;			// pointer to the osr table
-    unsigned *exception_table;
-    Compiled_Method *next;
-    // The next 6 halfword give the register mapping for JAZ_V1 to JAZ_v5
-    // This is used when receovering from an exception so we can push
-    // the register back into the local variables pool.
-    short regusage[6];
-    // OSR Entry point:
-    // 	R0 = entry point within compiled method
-    // 	R1 = locals - 4000 * 4
-    // 	R2 = thread
-    // 	R3 = locals - 31 * 4
-    // osr_entry:
-    // 		@ Load each local into it register allocated register
-    // 		ldr	<reg>, [R1, #(4000-<local>) * 4]
-    //    or	ldr	<reg>, [R3, #(31-<local>) * 4]
-    // 		...
-    // 		mov	Rthread, R2
-    // 		bx	R0
-    // 		.align	CODE_ALIGN
-    unsigned osr_entry[1];
-    // fast_entry:
-    // 		push	{r8, lr}
-    // 		...	@ The compiled code
-    // 		pop	{r8, pc}
-    // 		.align	WORD_ALIGN
-    // code_handle:				@ from interpreted entry
-    // 		.word	slow_entry		@ bottom bit must be set!
-    // osr_table:
-    // 		.word	<no. of entries>
-    // @@@ For bytecode 0 and for each backwards branch target
-    // 		.short	<bytecode index>
-    // 		.short	<code offset>		@ offset in halfwords from slow_entry
-} Compiled_Method;
-
-Compiled_Method *compiled_method_list = 0;
-Compiled_Method **compiled_method_list_tail_ptr = &compiled_method_list;
-
-typedef struct Thumb2_Entrypoint {
-  unsigned compiled_entrypoint;
-  unsigned osr_entry;
-} Thumb2_Entrypoint;
-
-typedef struct CodeBuf {
-    unsigned short *codebuf;
-    unsigned idx;
-    unsigned limit;
-} CodeBuf;
-
-typedef struct Thumb2_Stack {
-    unsigned *stack;
-    unsigned depth;
-} Thumb2_Stack;
-
-#define IS_SREG(r) ((r) < STACK_REGS)
-
-typedef struct Thumb2_Registers {
-    unsigned *r_local;
-    unsigned npregs;
-    unsigned pregs[PREGS];
-    int mapping[PREGS];
-} Thumb2_Registers;
-
-typedef struct Thumb2_Info {
-    JavaThread *thread;
-    methodOop method;
-    unsigned *bc_stackinfo;
-    unsigned *locals_info;
-    jubyte *code_base;
-    unsigned code_size;
-    CodeBuf *codebuf;
-    Thumb2_Stack *jstack;
-    Thumb2_Registers *jregs;
-    unsigned compiled_return;
-    unsigned zombie_bytes;
-    unsigned is_leaf;
-} Thumb2_Info;
-
-#define IS_INT_SIZE_BASE_TYPE(c) (c=='B' || c=='C' || c=='F' || c=='I' || c=='S' || c=='Z')
-#define IS_INT_SIZE_TYPE(c) (IS_INT_SIZE_BASE_TYPE(c) || c == 'L' || c == '[')
-
-static int method_stackchange(jbyte *base)
-{
-  jbyte c;
-  int stackchange = 0;
-
-  c = *base++;
-  JASSERT(c == '(', "Invalid signature, missing '('");
-  while ((c = *base++) != ')') {
-    stackchange -= 1;
-    if (c == 'J' || c == 'D') {
-      stackchange -= 1;
-    } else if (c == '[') {
-      do { c = *base++; } while (c == '[');
-      if (c == 'L')
-	do { c = *base++; } while (c != ';');
-    } else if (c == 'L') {
-      do { c = *base++; } while (c != ';');
-    } else {
-      JASSERT(IS_INT_SIZE_BASE_TYPE(c), "Invalid signature, bad arg type");
-    }
-  }
-  JASSERT(c == ')', "Invalid signature, missing ')'");
-  c = *base++;
-  if (c == 'J' || c == 'D') stackchange += 2;
-  else if (c != 'V') {
-    stackchange += 1;
-    JASSERT(IS_INT_SIZE_TYPE(c), "Invalid signature, bad ret type");
-  }
-  return stackchange;
-}
-
-static void Thumb2_local_info_from_sig(Thumb2_Info *jinfo, methodOop method, jbyte *base)
-{
-  jbyte c;
-  unsigned arg = 0;
-  unsigned *locals_info = jinfo->locals_info;
-  unsigned local_info;
-
-  if (!method->is_static()) locals_info[arg++] = 1 << LOCAL_REF;
-  c = *base++;
-  JASSERT(c == '(', "Invalid signature, missing '('");
-  while ((c = *base++) != ')') {
-    local_info = 1 << LOCAL_INT;
-    if (c == 'J') local_info = 1 << LOCAL_LONG;
-    else if (c == 'D') local_info = 1 << LOCAL_DOUBLE;
-    else if (c == '[') {
-      local_info = 1 << LOCAL_REF;
-      do { c = *base++; } while (c == '[');
-      if (c == 'L')
-	do { c = *base++; } while (c != ';');
-    } else if (c == 'L') {
-      local_info = 1 << LOCAL_REF;
-      do { c = *base++; } while (c != ';');
-    } else {
-      JASSERT(IS_INT_SIZE_BASE_TYPE(c), "Invalid signature, bad arg type");
-    }
-    locals_info[arg++] = local_info;
-  }
-}
-
-#define T_UNDEFINED_32	0xf7f0a000
-#define T_UNDEFINED_16	0xde00
-
-static const char *local_types[] = { "int", "long", "float", "double", "ref" };
-
-#ifdef T2EE_PRINT_DISASS
-void Thumb2_disass(Thumb2_Info *jinfo)
-{
-  unsigned code_size = jinfo->code_size;
-  jubyte *code_base = jinfo->code_base;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-  unsigned *locals_info = jinfo->locals_info;
-  unsigned nlocals = jinfo->method->max_locals();
-  int bci = 0;
-  int last_bci = -1;
-  int start_b, end_b;
-  unsigned nodisass;
-
-  struct disassemble_info info;
-  unsigned short *codebuf = jinfo->codebuf->codebuf;
-  unsigned idx, compiled_len;
-
-#if 0
-  printf("Local Variable Usage\n");
-  printf("====================\n");
-  for (idx = 0; idx < nlocals; idx++) {
-    unsigned linfo = locals_info[idx];
-    unsigned typ = (linfo >> LOCAL_INT) & 0x1f;
-
-    printf("Local %d, type = %s (%x)", idx, typ ? local_types[LOG2(typ)] : "!!!unknown!!!", typ);
-    if (linfo & (1 << LOCAL_MODIFIED)) printf(", modified");
-    if (idx < (unsigned)jinfo->method->size_of_parameters()) printf(", parameter");
-    putchar('\n');
-  }
-#endif
-
-  init_disassemble_info(&info, stdout, (fprintf_ftype)fprintf);
-  info.arch = bfd_arch_arm;
-  disassemble_init_for_target(&info);
-  info.endian = BFD_ENDIAN_LITTLE;
-  info.endian_code = BFD_ENDIAN_LITTLE;
-  info.buffer = (bfd_byte *)codebuf;
-  info.buffer_vma = (bfd_vma)codebuf;
-  info.buffer_length = jinfo->codebuf->idx * sizeof(short);
-  info.disassembler_options = (char *)"force-thumb";
-
-  compiled_len = jinfo->codebuf->idx * 2;
-  for (idx = 0; idx < compiled_len; ) {
-    nodisass = 0;
-    start_b = start_bci[idx/2];
-    end_b = end_bci[idx/2];
-    if (start_b != -1) {
-      last_bci != -1;
-      for (bci = start_b; bci < end_b; ) {
-	unsigned stackinfo = bc_stackinfo[bci];
-	unsigned opcode;
-	int len;
-
-	if (stackinfo & BC_BRANCH_TARGET)
-	  printf("----- Basic Block -----\n");
-	JASSERT(bci > last_bci, "disass not advancing");
-	last_bci = bci;
-	printf("%c%4d : ", (stackinfo & BC_VISITED_P1) ? ' ' : '?', bci);
-	opcode = code_base[bci];
-	if (opcode > OPC_LAST_JAVA_OP) {
-	  if (Bytecodes::is_defined((Bytecodes::Code)opcode))
-	    opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
-	}
-	len = Bytecodes::length_for((Bytecodes::Code)opcode);
-	if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
-	switch (opcode) {
-	  case opc_tableswitch: {
-	    int nbci = (bci & ~3) + 4;
-	    int low, high;
-	    unsigned w;
-	    unsigned *table;
-	    int def;
-	    unsigned n, i;
-
-	    printf("%02x ", opcode);
-	    for (int i = 1; i < 5; i++)
-	      printf("   ");
-	    printf("%s\n", Bytecodes::name((Bytecodes::Code)opcode));
-	    printf("\t%d bytes padding\n", nbci - (bci+1));
-	    w = *(unsigned int *)(code_base + nbci + 4);
-	    low = (int)BYTESEX_REVERSE(w);
-	    w = *(unsigned int *)(code_base + nbci + 8);
-	    high = (int)BYTESEX_REVERSE(w);
-	    w = *(unsigned int *)(code_base + nbci + 0);
-	    def = (int)BYTESEX_REVERSE(w);
-	    table = (unsigned int *)(code_base + nbci + 12);
-	    printf("\tdefault:\t0x%08x\n", def);
-	    printf("\tlow:\t\t0x%08x\n", low);
-	    printf("\thigh:\t\t0x%08x\n", high);
-	    n = high - low + 1;
-	    while (low <= high) {
-	      int off;
-
-	      w = *table++;
-	      off = (int)BYTESEX_REVERSE(w);
-	      printf("\toffset %d:\t0x%08x\n", low, off);
-	      low++;
-	    }
-	    bci += len;
-	    for (i = 0; i < 4; i++) {
-	      printf("0x%08x:\t", (int)codebuf+idx);
-	      {
-		int len = print_insn_little_arm((bfd_vma)codebuf+idx, &info);
-		if (len == -1) len = 2;
-		idx += len;
-		putchar('\n');
-	      }
-	    }
-	    for (i = 0; i < n; i++) {
-	      printf("0x%08x:\t.short\t0x%04x\n", (int)codebuf+idx, *(short *)((int)codebuf + idx));
-	      idx += 2;
-	    }
-	    nodisass = 1;
-	    break;
-	  }
-	  case opc_lookupswitch: {
-	    unsigned w;
-	    unsigned nbci = (bci & ~3) + 4;;
-	    int def;
-	    int npairs;	// The Java spec says signed but must be >= 0??
-	    unsigned *table;
-
-	    printf("%02x ", opcode);
-	    for (int i = 1; i < 5; i++)
-	      printf("   ");
-	    printf("%s\n", Bytecodes::name((Bytecodes::Code)opcode));
-	    printf("\t%d bytes padding\n", nbci - (bci+1));
-
-	    w = *(unsigned int *)(code_base + nbci + 0);
-	    def = (int)BYTESEX_REVERSE(w);
-	    w = *(unsigned int *)(code_base + nbci + 4);
-	    npairs = (int)BYTESEX_REVERSE(w);
-	    table = (unsigned int *)(code_base + nbci + 8);
-	    printf("\tdefault:\t0x%08x\n", def);
-	    printf("\tnpairs:\t\t0x%08x\n", npairs);
-	    for (int i = 0; i < npairs; i++) {
-	      unsigned match, off;
-	      w = table[0];
-	      match = BYTESEX_REVERSE(w);
-	      w = table[1];
-	      table += 2;
-	      off = BYTESEX_REVERSE(w);
-	      printf("\t  match: 0x%08x, offset: 0x%08x\n", match, off);
-	    }
-	    break;
-	  }
-
-	  default:
-	    for (int i = 0; i < 5; i++) {
-	      if (i < len)
-		printf("%02x ", code_base[bci+i]);
-	      else
-		printf("   ");
-	    }
-	    printf("%s\n", Bytecodes::name((Bytecodes::Code)code_base[bci]));
-	    break;
-	}
-	bci += len;
-      }
-    }
-    if (!nodisass) {
-      printf("0x%08x:\t", (int)codebuf+idx);
-      {
-	int len;
-	unsigned s1, s2;
-
-	s1 = *(unsigned short *)((int)codebuf + idx);
-	s2 = *(unsigned short *)((int)codebuf + idx + 2);
-	if (s1 == T_UNDEFINED_16 || ((s1 << 16) + s2) == T_UNDEFINED_32) {
-	  if (s1 == T_UNDEFINED_16) {
-	    printf("undefined (0xde00) - UNPATCHED BRANCH???");
-	    len = 2;
-	  } else {
-	    printf("undefined (0xf7f0a000) - UNPATCHED BRANCH???");
-	    len = 4;
-	  }
-	} else {
-	  len = print_insn_little_arm((bfd_vma)codebuf+idx, &info);
-	  if (len == -1) len = 2;
-	  idx += len;
-	}
-	putchar('\n');
-      }
-    }
-  }
-}
-#endif
-
-#define BCI(len, pop, push, special, islocal, islocal_n, isstore, local_n, local_type) \
-	((len) | ((pop)<<3) | ((push)<<6) | (unsigned)((special) << 31) | ((islocal) << 30) | ((islocal_n) << 29) | ((isstore) << 28) | ((local_n) << 9) | ((local_type) << 11))
-
-#define BCI_LEN(x) 	((x) & 7)
-#define BCI_POP(x) 	(((x)>>3) & 7)
-#define BCI_PUSH(x) 	(((x)>>6) & 7)
-#define BCI_LOCAL_N(x)	(((x)>>9) & 3)
-#define BCI_LOCAL_TYPE(x) (((x) >> 11) & 7)
-
-#define BCI_TYPE_INT	0
-#define BCI_TYPE_LONG	1
-#define BCI_TYPE_FLOAT	2
-#define BCI_TYPE_DOUBLE	3
-#define BCI_TYPE_REF	4
-
-#define BCI_SPECIAL(x) 	((x) & 0x80000000)
-#define BCI_ISLOCAL(x)	((x) & 0x40000000)
-#define BCI_ISLOCAL_N(x) ((x) & 0x20000000)
-#define BCI_ISSTORE(x)	((x) & 0x10000000)
-
-static const unsigned bcinfo[256] = {
-	BCI(1, 0, 0, 0, 0, 0, 0, 0, 0),	// nop
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// aconst_null
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_m1
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_0
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_1
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_2
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_3
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_4
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// iconst_5
-	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// lconst_0
-	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// lconst_1
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// fconst_0
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// fconst_1
-	BCI(1, 0, 1, 0, 0, 0, 0, 0, 0),	// fconst_2
-	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// dconst_0
-	BCI(1, 0, 2, 0, 0, 0, 0, 0, 0),	// dconst_1
-	BCI(2, 0, 1, 0, 0, 0, 0, 0, 0),	// bipush
-	BCI(3, 0, 1, 0, 0, 0, 0, 0, 0),	// bipush
-	BCI(2, 0, 1, 0, 0, 0, 0, 0, 0),	// ldc
-	BCI(3, 0, 1, 0, 0, 0, 0, 0, 0),	// ldc_w
-	BCI(3, 0, 2, 0, 0, 0, 0, 0, 0),	// ldc2_w
-	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload
-	BCI(2, 0, 2, 0, 1, 0, 0, 0, BCI_TYPE_LONG),	// lload
-	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_FLOAT),	// fload
-	BCI(2, 0, 2, 0, 1, 0, 0, 0, BCI_TYPE_DOUBLE),	// dload
-	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_REF),	// aload
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3
-	BCI(1, 0, 2, 0, 1, 1, 0, 0, BCI_TYPE_LONG),	// lload_0
-	BCI(1, 0, 2, 0, 1, 1, 0, 1, BCI_TYPE_LONG),	// lload_1
-	BCI(1, 0, 2, 0, 1, 1, 0, 2, BCI_TYPE_LONG),	// lload_2
-	BCI(1, 0, 2, 0, 1, 1, 0, 3, BCI_TYPE_LONG),	// lload_3
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_FLOAT),	// fload_0
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_FLOAT),	// fload_1
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_FLOAT),	// fload_2
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_FLOAT),	// fload_3
-	BCI(1, 0, 2, 0, 1, 1, 0, 0, BCI_TYPE_DOUBLE),	// dload_0
-	BCI(1, 0, 2, 0, 1, 1, 0, 1, BCI_TYPE_DOUBLE),	// dload_1
-	BCI(1, 0, 2, 0, 1, 1, 0, 2, BCI_TYPE_DOUBLE),	// dload_2
-	BCI(1, 0, 2, 0, 1, 1, 0, 3, BCI_TYPE_DOUBLE),	// dload_3
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_REF),	// aload_0
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_REF),	// aload_1
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_REF),	// aload_2
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_REF),	// aload_3
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iaload
-	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// laload
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// faload
-	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// daload
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// aaload
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// baload
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// caload
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// saload
-	BCI(2, 1, 0, 0, 1, 0, 1, 0, BCI_TYPE_INT),	// istore
-	BCI(2, 2, 0, 0, 1, 0, 1, 0, BCI_TYPE_LONG),	// lstore
-	BCI(2, 1, 0, 0, 1, 0, 1, 0, BCI_TYPE_FLOAT),	// fstore
-	BCI(2, 2, 0, 0, 1, 0, 1, 0, BCI_TYPE_DOUBLE),	// dstore
-	BCI(2, 1, 0, 0, 1, 0, 1, 0, BCI_TYPE_REF),	// astore
-	BCI(1, 1, 0, 0, 1, 1, 1, 0, BCI_TYPE_INT),	// istore_0
-	BCI(1, 1, 0, 0, 1, 1, 1, 1, BCI_TYPE_INT),	// istore_1
-	BCI(1, 1, 0, 0, 1, 1, 1, 2, BCI_TYPE_INT),	// istore_2
-	BCI(1, 1, 0, 0, 1, 1, 1, 3, BCI_TYPE_INT),	// istore_3
-	BCI(1, 2, 0, 0, 1, 1, 1, 0, BCI_TYPE_LONG),	// lstore_0
-	BCI(1, 2, 0, 0, 1, 1, 1, 1, BCI_TYPE_LONG),	// lstore_1
-	BCI(1, 2, 0, 0, 1, 1, 1, 2, BCI_TYPE_LONG),	// lstore_2
-	BCI(1, 2, 0, 0, 1, 1, 1, 3, BCI_TYPE_LONG),	// lstore_3
-	BCI(1, 1, 0, 0, 1, 1, 1, 0, BCI_TYPE_FLOAT),	// fstore_0
-	BCI(1, 1, 0, 0, 1, 1, 1, 1, BCI_TYPE_FLOAT),	// fstore_1
-	BCI(1, 1, 0, 0, 1, 1, 1, 2, BCI_TYPE_FLOAT),	// fstore_2
-	BCI(1, 1, 0, 0, 1, 1, 1, 3, BCI_TYPE_FLOAT),	// fstore_3
-	BCI(1, 2, 0, 0, 1, 1, 1, 0, BCI_TYPE_DOUBLE),	// dstore_0
-	BCI(1, 2, 0, 0, 1, 1, 1, 1, BCI_TYPE_DOUBLE),	// dstore_1
-	BCI(1, 2, 0, 0, 1, 1, 1, 2, BCI_TYPE_DOUBLE),	// dstore_2
-	BCI(1, 2, 0, 0, 1, 1, 1, 3, BCI_TYPE_DOUBLE),	// dstore_3
-	BCI(1, 1, 0, 0, 1, 1, 1, 0, BCI_TYPE_REF),	// astore_0
-	BCI(1, 1, 0, 0, 1, 1, 1, 1, BCI_TYPE_REF),	// astore_1
-	BCI(1, 1, 0, 0, 1, 1, 1, 2, BCI_TYPE_REF),	// astore_2
-	BCI(1, 1, 0, 0, 1, 1, 1, 3, BCI_TYPE_REF),	// astore_3
-	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// iastore
-	BCI(1, 4, 0, 0, 0, 0, 0, 0, 0),	// dastore
-	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// fastore
-	BCI(1, 4, 0, 0, 0, 0, 0, 0, 0),	// lastore
-	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// aastore
-	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// bastore
-	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// castore
-	BCI(1, 3, 0, 0, 0, 0, 0, 0, 0),	// sastore
-	BCI(1, 1, 0, 0, 0, 0, 0, 0, 0),	// pop
-	BCI(1, 2, 0, 0, 0, 0, 0, 0, 0),	// pop2
-	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// dup
-	BCI(1, 2, 3, 0, 0, 0, 0, 0, 0),	// dup_x1
-	BCI(1, 3, 4, 0, 0, 0, 0, 0, 0),	// dup_x2
-	BCI(1, 2, 4, 0, 0, 0, 0, 0, 0),	// dup2
-	BCI(1, 3, 5, 0, 0, 0, 0, 0, 0),	// dup2_x1
-	BCI(1, 4, 6, 0, 0, 0, 0, 0, 0),	// dup2_x2
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// swap
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iadd
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// ladd
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fadd
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dadd
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// isub
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lsub
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fsub
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dsub
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// imul
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lmul
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fmul
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dmul
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// idiv
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// ldiv
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fdiv
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// ddiv
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// irem
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lrem
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// frem
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// drem
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// ineg
-	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// lneg
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// fneg
-	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// dneg
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ishl
-	BCI(1, 3, 2, 0, 0, 0, 0, 0, 0),	// lshl
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ishr
-	BCI(1, 3, 2, 0, 0, 0, 0, 0, 0),	// lshr
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iushr
-	BCI(1, 3, 2, 0, 0, 0, 0, 0, 0),	// lushr
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iand
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// land
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ior
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lor
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ixor
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// lxor
-	BCI(3, 0, 0, 0, 1, 0, 1, 0, BCI_TYPE_INT),	// iinc
-	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// i2l
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2f
-	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// i2d
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// l2i
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// l2f
-	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// l2d
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// f2i
-	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// f2l
-	BCI(1, 1, 2, 0, 0, 0, 0, 0, 0),	// f2d
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// d2i
-	BCI(1, 2, 2, 0, 0, 0, 0, 0, 0),	// d2l
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// d2f
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2b
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2c
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// i2s
-	BCI(1, 4, 1, 0, 0, 0, 0, 0, 0),	// lcmp
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fcmpl
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// fcmpg
-	BCI(1, 4, 1, 0, 0, 0, 0, 0, 0),	// dcmpl
-	BCI(1, 4, 1, 0, 0, 0, 0, 0, 0),	// dcmpg
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifeq
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifne
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// iflt
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifge
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifgt
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifle
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpeq
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpne
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmplt
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpge
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmpgt
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_icmple
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_acmpeq
-	BCI(3, 2, 0, 1, 0, 0, 0, 0, 0),	// if_acmpne
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// goto
-	BCI(3, 0, 1, 1, 0, 0, 0, 0, 0),	// jsr
-	BCI(2, 0, 0, 1, 0, 0, 0, 0, 0),	// ret
-	BCI(0, 1, 0, 1, 0, 0, 0, 0, 0),	// tableswitch
-	BCI(0, 1, 0, 1, 0, 0, 0, 0, 0),	// lookupswitch
-	BCI(1, 1, 0, 1, 0, 0, 0, 0, 0),	// ireturn
-	BCI(1, 2, 0, 1, 0, 0, 0, 0, 0),	// lreturn
-	BCI(1, 1, 0, 1, 0, 0, 0, 0, 0),	// freturn
-	BCI(1, 2, 0, 1, 0, 0, 0, 0, 0),	// dreturn
-	BCI(1, 1, 0, 1, 0, 0, 0, 0, 0),	// areturn
-	BCI(1, 0, 0, 1, 0, 0, 0, 0, 0),	// return
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// getstatic
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// putstatic
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// getfield
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// putfield
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokevirtual
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokespecial
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokestatic
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokeinterface
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// xxxunusedxxx
-	BCI(3, 0, 1, 0, 0, 0, 0, 0, 0),	// new
-	BCI(2, 1, 1, 0, 0, 0, 0, 0, 0),	// newarray
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// anewarray
-	BCI(1, 1, 1, 0, 0, 0, 0, 0, 0),	// arraylength
-	BCI(1, 1, 1, 1, 0, 0, 0, 0, 0),	// athrow
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// checkcast
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// instanceof
-	BCI(1, 1, 0, 0, 0, 0, 0, 0, 0),	// monitorenter
-	BCI(1, 1, 0, 0, 0, 0, 0, 0, 0),	// monitorexit
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// wide
-	BCI(4, 0, 0, 1, 0, 0, 0, 0, 0),	// multianewarray
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifnull
-	BCI(3, 1, 0, 1, 0, 0, 0, 0, 0),	// ifnonnull
-	BCI(5, 0, 0, 1, 0, 0, 0, 0, 0),	// goto_w
-	BCI(5, 0, 0, 1, 0, 0, 0, 0, 0),	// jsr_w
-	BCI(1, 0, 0, 1, 0, 0, 0, 0, 0),	// breakpoint
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xcb
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// bgetfield
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// cgetfield
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xce
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xcf
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// igetfield
-	BCI(3, 1, 2, 0, 0, 0, 0, 0, 0),	// lgetfield
-	BCI(3, 1, 1, 0, 0, 0, 0, 0, 0),	// sgetfield
-	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// aputfield
-	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// bputfield
-	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// cputfield
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xd6
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xd7
-	BCI(3, 2, 0, 0, 0, 0, 0, 0, 0),	// iputfield
-	BCI(3, 3, 0, 0, 0, 0, 0, 0, 0),	// lputfield
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// unused 0xda
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_REF),	// iaccess_0
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_REF),	// iaccess_1
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_REF),	// iaccess_2
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_REF),	// iaccess_3
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokeresolved
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokespecialresolved
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokestaticresolved
-	BCI(3, 0, 0, 1, 0, 0, 0, 0, 0),	// invokevfinal
-	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload_iload
-	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload_iload_N
-	BCI(1, 0, 0, 1, 0, 0, 0, 0, 0),	// return_register_finalizer
-	BCI(1, 4, 2, 0, 0, 0, 0, 0, 0),	// dmac
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0_iconst_N
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1_iconst_N
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2_iconst_N
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3_iconst_N
-	BCI(2, 0, 1, 0, 1, 0, 0, 0, BCI_TYPE_INT),	// iload_iconst_N
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iadd_istore_N
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// isub_istore_N
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iand_istore_N
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ior_istore_N
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ixor_istore_N
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iadd_u4store
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// isub_u4store
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// iand_u4store
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ior_u4store
-	BCI(1, 2, 1, 0, 0, 0, 0, 0, 0),	// ixor_u4store
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0_iload
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1_iload
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2_iload
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3_iload
-	BCI(1, 0, 1, 0, 1, 1, 0, 0, BCI_TYPE_INT),	// iload_0_iload_N
-	BCI(1, 0, 1, 0, 1, 1, 0, 1, BCI_TYPE_INT),	// iload_1_iload_N
-	BCI(1, 0, 1, 0, 1, 1, 0, 2, BCI_TYPE_INT),	// iload_2_iload_N
-	BCI(1, 0, 1, 0, 1, 1, 0, 3, BCI_TYPE_INT),	// iload_3_iload_N
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// impdep1
-	BCI(0, 0, 0, 1, 0, 0, 0, 0, 0),	// impdep2
-};
-
-void Thumb2_pass1(Thumb2_Info *jinfo, unsigned bci)
-{
-  unsigned code_size = jinfo->code_size;
-  jubyte *code_base = jinfo->code_base;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-  unsigned *locals_info = jinfo->locals_info;
-  //constantPoolCacheOop cp = jinfo->method->constants()->cache();
-
-  bc_stackinfo[bci] |= BC_BRANCH_TARGET;
-  while (bci < code_size) {
-    unsigned stackinfo = bc_stackinfo[bci];
-    unsigned bytecodeinfo;
-    unsigned opcode;
-
-    if (stackinfo & BC_VISITED_P1) break;
-    bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | BC_VISITED_P1;
-    opcode = code_base[bci];
-//	printf("bci = 0x%04x, opcode = 0x%02x (%s)", bci, opcode,  Bytecodes::name((Bytecodes::Code)opcode));
-    bytecodeinfo = bcinfo[opcode];
-    if (!BCI_SPECIAL(bytecodeinfo)) {
-      bci += BCI_LEN(bytecodeinfo);
-      continue;
-    }
-
-    switch (opcode) {
-
-      case opc_goto: {
-	int off = GET_JAVA_S2(code_base+bci+1);
-	bci += off;
-	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
-	if (off < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
-	break;
-      }
-      case opc_goto_w: {
-	int off = GET_JAVA_U4(code_base+bci+1);
-	bci += off;
-	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
-	if (off < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
-	break;
-      }
-
-      case opc_if_icmpeq:
-      case opc_if_icmpne:
-      case opc_if_icmplt:
-      case opc_if_icmpge:
-      case opc_if_icmpgt:
-      case opc_if_icmple:
-      case opc_if_acmpeq:
-      case opc_if_acmpne:
-      case opc_ifeq:
-      case opc_ifne:
-      case opc_iflt:
-      case opc_ifge:
-      case opc_ifgt:
-      case opc_ifle:
-      case opc_ifnull:
-      case opc_ifnonnull: {
-	int off = GET_JAVA_S2(code_base+bci+1);
-	if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
-	Thumb2_pass1(jinfo, bci + off);
-	bci += 3;
-	break;
-      }
-
-      case opc_jsr: {
-	int off = GET_JAVA_S2(code_base+bci+1);
-	if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
-	Thumb2_pass1(jinfo, bci + off);
-	bci += 3;
-	break;
-      }
-      case opc_jsr_w: {
-	int off = GET_JAVA_U4(code_base+bci+1);
-	if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
-	Thumb2_pass1(jinfo, bci + off);
-	bci += 5;
-	break;
-      }
-
-      case opc_ireturn:
-      case opc_lreturn:
-      case opc_freturn:
-      case opc_dreturn:
-      case opc_areturn:
-      case opc_return:
-      case opc_return_register_finalizer:
-      case opc_ret:
-      case opc_athrow:
-	// The test for BC_VISITED_P1 above will break out of the loop!!!
-	break;
-
-      case opc_tableswitch: {
-	int low, high;
-	unsigned w;
-	unsigned *table;
-	unsigned nbci;
-	int def;
-
-	nbci = bci & ~3;
-	w = *(unsigned int *)(code_base + nbci + 8);
-	low = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 12);
-	high = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 4);
-	def = (int)BYTESEX_REVERSE(w);
-	table = (unsigned int *)(code_base + nbci + 16);
-
-	while (low <= high) {
-	  int off;
-	  w = *table++;
-	  off = (int)BYTESEX_REVERSE(w);
-	  if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
-	  Thumb2_pass1(jinfo, bci + off);
-	  low++;
-	}
-
-	bci += def;
-	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
-	if (def < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
-	break;
-      }
-
-      case opc_lookupswitch: {
-	unsigned w;
-	unsigned nbci;
-	int def;
-	int npairs;	// The Java spec says signed but must be >= 0??
-	unsigned *table;
-
-	nbci = bci & ~3;
-	w = *(unsigned int *)(code_base + nbci + 4);
-	def = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 8);
-	npairs = (int)BYTESEX_REVERSE(w);
-	table = (unsigned int *)(code_base + nbci + 16);
-
-	for (int i = 0; i < npairs; i++) {
-	  int off;
-	  w = *table;
-	  table += 2;
-	  off = (int)BYTESEX_REVERSE(w);
-	  if (off < 0) bc_stackinfo[bci+off] |= BC_BACK_TARGET;
-	  Thumb2_pass1(jinfo, bci + off);
-	}
-
-	bci += def;
-	bc_stackinfo[bci] |= BC_BRANCH_TARGET;
-	if (def < 0) bc_stackinfo[bci] |= BC_BACK_TARGET;
-	break;
-      }
-
-      case opc_getstatic:
-      case opc_putstatic:
-      case opc_getfield:
-      case opc_putfield: {
-	bci += 3;
-	break;
-      }
-
-      case opc_invokeresolved:
-      case opc_invokespecialresolved:
-      case opc_invokestaticresolved:
-      case opc_invokevfinal:
-      case opc_invokevirtual:
-      case opc_invokespecial:
-      case opc_invokestatic:
-	jinfo->is_leaf = 0;
-	bci += 3;
-	break;
-
-      case opc_invokeinterface:
-	jinfo->is_leaf = 0;
-	bci += 5;
-	break;
-
-      case opc_multianewarray:
-	bci += 4;
-	break;
-
-      case opc_wide:
-	opcode = code_base[bci+1];
-	if (opcode == opc_iinc) {
-	  bci += 6;
-	} else {
-	  bci += 4;
-	}
-	break;
-
-      default:
-	opcode = code_base[bci];
-	fatal1("Undefined opcode %d\n", opcode);
-	break;
-    }
-  }
-}
-
-#ifdef ZOMBIE_DETECTION
-int Thumb2_is_zombie(Thumb2_Info *jinfo, unsigned bci)
-{
-  unsigned code_size = jinfo->code_size;
-  jubyte *code_base = jinfo->code_base;
-  unsigned bytecodeinfo;
-  unsigned opcode;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-
-  do {
-    opcode = code_base[bci];
-    // Short circuit exit - commented out because even if it has been executed
-    // we treat throw, jsr, and ret as zombies because they will call out to the
-    // interpreter.
-    // if (opcode > OPC_LAST_JAVA_OP) return 0;
-    bytecodeinfo = bcinfo[opcode];
-    if (!BCI_SPECIAL(bytecodeinfo)) {
-	bci += BCI_LEN(bytecodeinfo);
-#if 0
-	if (opcode >= opc_iload_iload) {
-	  opcode = code_base[bci];
-	  bci += BCI_LEN(bcinfo[opcode]);
-	} else if (BCI_ISLOCAL(bytecodeinfo)) {
-	  if (opcode == opc_iload || (opcode >= opc_iload_0 && opcode <= opc_iload_3)) {
-	    opcode = code_base[bci];
-	    if (opcode == opc_iload || (opcode >= opc_iload_0 && opcode <= opc_iload_3) ||
-					(opcode >= opc_iconst_m1 && opcode <= opc_iconst_5)) {
-		printf("found new zombie at %d\n", bci);
-		return 1;
-	    }
-	  }
-	} else if (opcode == opc_iadd || opcode == opc_isub ||
-		      opcode == opc_iand || opcode == opc_ior || opcode == opc_ixor) {
-	    opcode = code_base[bci];
-	    if (opcode == opc_istore || (opcode >= opc_istore_0 && opcode <= opc_istore_3)) {
-		printf("found new zombie at %d\n", bci);
-		return 1;
-	    }
-	}
-#endif
-    } else {
-      switch (opcode) {
-	case opc_goto:
-	case opc_goto_w:
-	case opc_ifeq:
-	case opc_ifne:
-	case opc_iflt:
-	case opc_ifge:
-	case opc_ifgt:
-	case opc_ifle:
-	case opc_ifnull:
-	case opc_ifnonnull:
-	case opc_if_icmpeq:
-	case opc_if_icmpne:
-	case opc_if_icmplt:
-	case opc_if_icmpge:
-	case opc_if_icmpgt:
-	case opc_if_icmple:
-	case opc_if_acmpeq:
-	case opc_if_acmpne:
-	case opc_tableswitch:
-	case opc_lookupswitch:
-	  return 0;
-	case opc_ireturn:
-	case opc_lreturn:
-	case opc_freturn:
-	case opc_dreturn:
-	case opc_areturn:
-	case opc_return:
-	case opc_return_register_finalizer:
-	    return 0;
-	case opc_jsr:
-	case opc_jsr_w:
-	case opc_ret:
-	case opc_athrow:
-	    return 1;
-	case opc_invokeinterface:
-	case opc_invokevirtual:
-	case opc_invokespecial:
-	case opc_invokestatic:
-	case opc_putfield:
-	case opc_getfield:
-	case opc_putstatic:
-	case opc_getstatic: {
-	  constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-	  ConstantPoolCacheEntry* cache;
-	  int index = GET_NATIVE_U2(code_base+bci+1);
-
-	  cache = cp->entry_at(index);
-	  if (!cache->is_resolved((Bytecodes::Code)opcode)) return 1;
-	  bci += 3;
-	  if (opcode == opc_invokeinterface) bci += 2;
-	  break;
-
-	}
-	case opc_invokeresolved:
-	case opc_invokespecialresolved:
-	case opc_invokestaticresolved:
-	case opc_invokevfinal:
-	  bci += 3;
-	  break;
-
-	case opc_multianewarray:
-	  bci += 4;
-	  break;
-
-	case opc_wide:
-	  opcode = code_base[bci+1];
-	  if (opcode == opc_iinc) {
-	    bci += 6;
-	  } else {
-	    bci += 4;
-	  }
-	  break;
-
-	default:
-	  opcode = code_base[bci];
-	  fatal1("Undefined opcode %d\n", opcode);
-	  break;
-      }
-    }
-    if (bci >= code_size) break;
-  } while (!(bc_stackinfo[bci] & BC_BRANCH_TARGET));
-  return 0;
-}
-#endif // ZOMBIT_DETECTION
-
-void Thumb2_RegAlloc(Thumb2_Info *jinfo)
-{
-  unsigned *locals_info = jinfo->locals_info;
-  unsigned i, j;
-  unsigned linfo;
-  unsigned score, max_score;
-  unsigned local;
-  unsigned nlocals = jinfo->method->max_locals();
-  unsigned *pregs = jinfo->jregs->pregs;
-  unsigned npregs = jinfo->jregs->npregs;
-
-  for (i = 0; i < npregs; i++) jinfo->jregs->mapping[i] = -1;
-  for (i = 0; i < npregs; i++) {
-    max_score = 0;
-    for (j = 0; j < nlocals; j++) {
-      linfo = locals_info[j];
-
-      if (linfo & ((1<<LOCAL_ALLOCATED)|(1<<LOCAL_DOUBLE))) continue;
-      score = LOCAL_READS(linfo) + LOCAL_WRITES(linfo);
-      if (linfo & (1<<LOCAL_MODIFIED)) score = (score+1) >> 2;
-      if (linfo & (1<<LOCAL_REF)) score = score - (score >> 2);
-      if (linfo & (1<<LOCAL_LONG)) score = (score+1) >> 2;
-      if (score > max_score) max_score = score, local = j;
-    }
-    if (max_score < 2) break;
-    locals_info[local] |= 1<<LOCAL_ALLOCATED;
-    jinfo->jregs->r_local[local] = pregs[i];
-    jinfo->jregs->mapping[i] = local;
-  }
-#ifdef T2EE_PRINT_REGUSAGE
-  if (t2ee_print_regusage) {
-    printf("Regalloc: %d physical registers allocated as follows\n", npregs);
-    for (j = 0; j < nlocals; j++) {
-      unsigned r = jinfo->jregs->r_local[j];
-      if (r) {
-	unsigned typ = (locals_info[j] >> LOCAL_INT) & 0x1f;
-	printf("  ARM Reg R%d -> local %d (type = %s)\n", r, j, local_types[LOG2(typ)]);
-      }
-    }
-  }
-#endif
-}
-
-void Thumb2_pass2(Thumb2_Info *jinfo, unsigned stackdepth, unsigned bci)
-{
-  unsigned code_size = jinfo->code_size;
-  jubyte *code_base = jinfo->code_base;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-  unsigned *locals_info = jinfo->locals_info;
-  unsigned check_zombie = 0;
-  //constantPoolCacheOop cp = jinfo->method->constants()->cache();
-
-  while (bci < code_size) {
-    unsigned stackinfo = bc_stackinfo[bci];
-    unsigned bytecodeinfo;
-    unsigned opcode;
-
-    if (stackinfo & BC_VISITED_P2) break;
-    JASSERT((int)stackdepth >= 0, "stackdepth < 0!!");
-    bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | stackdepth | BC_VISITED_P2;
-#ifdef ZOMBIE_DETECTION
-    if (check_zombie || (stackinfo & BC_BRANCH_TARGET)) {
-      if (Thumb2_is_zombie(jinfo, bci)) {
-	printf("zombie code at %d\n", bci);
-	bc_stackinfo[bci] |= BC_ZOMBIE;
-	return;
-      }
-      check_zombie = 0;
-    }
-#endif
-    opcode = code_base[bci];
-//	printf("bci = 0x%04x, opcode = 0x%02x (%s), stackdepth = %d\n", bci, opcode,  Bytecodes::name((Bytecodes::Code)opcode), stackdepth);
-    bytecodeinfo = bcinfo[opcode];
-    if (!BCI_SPECIAL(bytecodeinfo)) {
-      if (BCI_ISLOCAL(bytecodeinfo)) {
-	unsigned local = BCI_LOCAL_N(bytecodeinfo);
-	unsigned local_type = BCI_LOCAL_TYPE(bytecodeinfo) + LOCAL_INT;
-	unsigned local_modified = 0;
-	unsigned linfo;
-	unsigned read_count, write_count;
-
-	if (!BCI_ISLOCAL_N(bytecodeinfo)) local = code_base[bci+1];
-	if (BCI_ISSTORE(bytecodeinfo)) local_modified = 1U << LOCAL_MODIFIED;
-	linfo = locals_info[local];
-	read_count = LOCAL_READS(linfo);
-	write_count = LOCAL_WRITES(linfo);
-	if (local_modified)
-	  write_count = LOCAL_INC_COUNT(write_count);
-	else
-	  read_count = LOCAL_INC_COUNT(read_count);
-	
-	locals_info[local] |= (1 << local_type) | LOCAL_SET_COUNTS(read_count, write_count) | local_modified;
-	if (local_type == LOCAL_LONG || local_type == LOCAL_DOUBLE) {
-	  locals_info[local+1] |= (1 << local_type) | LOCAL_SET_COUNTS(read_count, write_count) | local_modified;
-	}
-      }
-      bci += BCI_LEN(bytecodeinfo);
-      stackdepth += BCI_PUSH(bytecodeinfo) - BCI_POP(bytecodeinfo);
-      JASSERT(stackdepth <= (unsigned)jinfo->method->max_stack(), "stack over/under flow?");
-      continue;
-    }
-
-    switch (opcode) {
-
-      case opc_goto:
-	bci += GET_JAVA_S2(code_base+bci+1);
-	break;
-      case opc_goto_w:
-	bci += GET_JAVA_U4(code_base+bci+1);
-	break;
-
-      case opc_ifeq:
-      case opc_ifne:
-      case opc_iflt:
-      case opc_ifge:
-      case opc_ifgt:
-      case opc_ifle:
-      case opc_ifnull:
-      case opc_ifnonnull:
-	stackdepth -= 1;
-	Thumb2_pass2(jinfo, stackdepth, bci + GET_JAVA_S2(code_base+bci+1));
-	check_zombie = 1;
-	bci += 3;
-	break;
-
-      case opc_if_icmpeq:
-      case opc_if_icmpne:
-      case opc_if_icmplt:
-      case opc_if_icmpge:
-      case opc_if_icmpgt:
-      case opc_if_icmple:
-      case opc_if_acmpeq:
-      case opc_if_acmpne:
-	stackdepth -= 2;
-	Thumb2_pass2(jinfo, stackdepth, bci + GET_JAVA_S2(code_base+bci+1));
-	check_zombie = 1;
-	bci += 3;
-	break;
-
-      case opc_jsr:
-	Thumb2_pass2(jinfo, stackdepth+1, bci + GET_JAVA_S2(code_base+bci+1));
-	bci += 3;
-	stackdepth = 0;
-	break;
-      case opc_jsr_w:
-	Thumb2_pass2(jinfo, stackdepth+1, bci + GET_JAVA_U4(code_base+bci+1));
-	bci += 5;
-	break;
-
-      case opc_ireturn:
-      case opc_lreturn:
-      case opc_freturn:
-      case opc_dreturn:
-      case opc_areturn:
-      case opc_return:
-      case opc_return_register_finalizer:
-      case opc_ret:
-      case opc_athrow:
-	// The test for BC_VISITED_P2 above will break out of the loop!!!
-	break;
-
-      case opc_tableswitch: {
-	int low, high;
-	unsigned w;
-	unsigned *table;
-	unsigned nbci;
-	int def;
-
-	stackdepth -= 1;
-	nbci = bci & ~3;
-	w = *(unsigned int *)(code_base + nbci + 8);
-	low = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 12);
-	high = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 4);
-	def = (int)BYTESEX_REVERSE(w);
-	table = (unsigned int *)(code_base + nbci + 16);
-
-	while (low <= high) {
-	  int off;
-	  w = *table++;
-	  off = (int)BYTESEX_REVERSE(w);
-	  Thumb2_pass2(jinfo, stackdepth, bci + off);
-	  low++;
-	}
-
-	check_zombie = 1;
-	bci += def;
-	break;
-      }
-
-      case opc_lookupswitch: {
-	unsigned w;
-	unsigned nbci;
-	int def;
-	int npairs;	// The Java spec says signed but must be >= 0??
-	unsigned *table;
-
-	stackdepth -= 1;
-	nbci = bci & ~3;
-	w = *(unsigned int *)(code_base + nbci + 4);
-	def = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 8);
-	npairs = (int)BYTESEX_REVERSE(w);
-	table = (unsigned int *)(code_base + nbci + 16);
-
-	for (int i = 0; i < npairs; i++) {
-	  int off;
-	  w = *table;
-	  table += 2;
-	  off = (int)BYTESEX_REVERSE(w);
-	  Thumb2_pass2(jinfo, stackdepth, bci + off);
-	}
-
-	check_zombie = 1;
-	bci += def;
-	break;
-      }
-
-      case opc_getstatic:
-      case opc_putstatic:
-      case opc_getfield:
-      case opc_putfield: {
-	int index = GET_JAVA_U2(code_base+bci+1);
-	constantPoolOop pool = jinfo->method->constants();
-	symbolOop sig = pool->signature_ref_at(index);
-	jbyte *base = sig->base();
-	jbyte c = *base;
-	int stackchange;
-
-	opcode = code_base[bci];
-	if (opcode == opc_getfield || opcode == opc_putfield)
-	  stackdepth -= 1;
-	stackchange = 1;
-	if (c == 'J' || c == 'D') stackchange = 2;
-	if (opcode == opc_getfield || opcode == opc_getstatic)
-	  stackdepth += stackchange;
-	else
-	  stackdepth -= stackchange;
-	bci += 3;
-	break;
-      }
-
-      case opc_invokeresolved:
-      case opc_invokespecialresolved:
-      case opc_invokestaticresolved:
-      case opc_invokevfinal:
-      case opc_invokeinterface:
-      case opc_invokevirtual:
-      case opc_invokespecial:
-      case opc_invokestatic: {
-	int index = GET_JAVA_U2(code_base+bci+1);
-	constantPoolOop pool = jinfo->method->constants();
-	//symbolOop name = pool->name_ref_at(index);
-	symbolOop sig = pool->signature_ref_at(index);
-	jbyte *base = sig->base();
-
-	//tty->print("%d: %s: %s\n", opcode, name->as_C_string(), sig->as_C_string());
-	stackdepth += method_stackchange(base);
-	opcode = code_base[bci];
-	bci += 3;
-	if (opcode == opc_invokeinterface) bci += 2;
-	if (opcode != opc_invokestatic && opcode != opc_invokestaticresolved)
-	  stackdepth -= 1;
-	break;
-      }
-
-      case opc_multianewarray:
-	stackdepth = (stackdepth - code_base[bci+3]) + 1;
-	bci += 4;
-	break;
-
-      case opc_wide:
-	opcode = code_base[bci+1];
-	if (opcode == opc_iinc) {
-	  bci += 6;
-	} else {
-	  bci += 4;
-	  if (opcode == opc_iload ||
-	  	opcode == opc_fload || opcode == opc_aload)
-	    stackdepth += 1;
-	  else if (opcode == opc_lload || opcode == opc_dload)
-	    stackdepth += 2;
-	  else if (opcode == opc_istore ||
-	  	opcode == opc_fstore || opcode == opc_astore)
-	    stackdepth -= 1;
-	  else if (opcode == opc_lstore || opcode == opc_dstore)
-	    stackdepth -= 2;
-	  else if (opcode != opc_ret)
-	    fatal1("Undefined wide opcode %d\n", opcode);
-	}
-	break;
-
-      default:
-	opcode = code_base[bci];
-	fatal1("Undefined opcode %d\n", opcode);
-	break;
-    }
-  }
-}
-
-//-------------------------------------------------------------------------------------
-
-#define Thumb2		1
-#define ThumbEE		0
-
-#define	DA	0
-#define	IA	1
-#define DB	2
-#define IB	3
-
-#define	PUSH_ED	0
-#define PUSH_EA	1
-#define	PUSH_FD	2
-#define	PUSH_FA	3
-
-#define	POP_FA	0
-#define	POP_FD	1
-#define	POP_EA	2
-#define	POP_ED	3
-
-#define ROR(imm, sh) (((imm) >> (sh)) | ((imm) << (32 - (sh))))
-#define ROL(imm, sh) (((imm) << (sh)) | ((imm) >> (32 - (sh))))
-
-#define abs(i) ((i) < 0 ? -(i) : (i))
-#define U(i) ((i) < 0 ? 0 : 1)
-
-#define LS_STR		0
-#define	LS_STRB		1
-#define	LS_STRH		2
-#define LS_LDRSB	3
-#define	LS_LDR		4
-#define LS_LDRB		5
-#define	LS_LDRH		6
-#define LS_LDRSH	7
-
-#define LS_IS_LDR(op)	((op) >= LS_LDRSB)
-#define LS_IS_WORD(op)	(((op) & 3) == LS_STR)
-#define LS_IS_BYTE(op)	(((op) & 3) == LS_STRB || (op) == LS_LDRSB)
-#define LS_IS_HW(op)	(((op) & 3) == LS_STRH || (op) == LS_LDRSH)
-
-static const unsigned t_ls_ops[16] = {
-	0x5000,		0xf8400000,
-	0x5400,		0xf8000000,
-	0x5200,		0xf8200000,
-	0x5600,		0xf9100000,
-	0x5800,		0xf8500000,
-	0x5c00,		0xf8100000,
-	0x5a00,		0xf8300000,
-	0x5e00,		0xf9300000,
-};
-
-#define DP_ADC	0
-#define DP_ADD	1
-#define DP_AND	2
-#define DP_ASR	3
-#define DP_BIC	4
-#define DP_CMN	5
-#define DP_CMP	6
-#define DP_EOR	7
-#define DP_LSL	8
-#define DP_LSR	9
-#define DP_MOV	10
-#define DP_MVN	11
-#define DP_ORN	12
-#define DP_ORR	13
-#define DP_ROR	14
-#define DP_RSB	15
-#define DP_SBC	16
-#define DP_SUB	17
-#define DP_TEQ	18
-#define DP_TST	19
-#define DP_MUL	20
-
-static const unsigned n_ops[] = {
-	DP_SBC,		// ADC	x, y == SBC x, ~y
-	DP_SUB,		// ADD	x, y == SUB x, -y
-	DP_BIC,		// AND	x, y == BIX x, ~y
-	(unsigned)-1,	// ASR
-	DP_AND,		// BIC	x, y == AND x, ~y
-	DP_CMP,		// CMN	x, y == CMP x, -y
-	DP_CMN,		// CMP	x, y == CMN x, -y
-	(unsigned)-1,	// EOR
-	(unsigned)-1,	// LSL
-	(unsigned)-1,	// LSR
-	DP_MVN,		// MOV	x, y == MVN x, ~y
-	DP_MOV,		// MVN	x, y == MOV x, ~y
-	DP_ORR,		// ORN	x, y == ORR x, ~y
-	DP_ORN,		// ORR	x, y == ORN x, ~y
-	(unsigned)-1,	// ROR
-	(unsigned)-1,	// RSB
-	DP_ADC,		// SBC	x, y == ADC x, ~y
-	DP_ADD,		// ADD	x, y == SUB x, -y
-	(unsigned)-1,	// TEQ
-	(unsigned)-1,	// TST
-	(unsigned)-1,	// MUL
-};
-
-#define N_OP(op)	n_ops[(op)]
-
-static const unsigned t_dop_ops[] = {
-//	Rd, Rm, #N	Rd, Rn, Rm
-	0xf1400000,	0xeb400000,	// ADC
-	0xf1000000,	0xeb000000,	// ADD
-	0xf0000000,	0xea000000,	// AND
-	0xea4f0020,	0xfa40f000,	// ASR
-	0xf0200000,	0xea200000,	// BIC
-	0xf1100f00,	0xeb100f00,	// CMN
-	0xf1b00f00,	0xebb00f00,	// CMP
-	0xf0800000,	0xea800000,	// EOR
-	0xea4f0000,	0xfa00f000,	// LSL
-	0xea4f0010,	0xfa20f000,	// LSR
-	0xf04f0000,	0xea4f0000,	// MOV
-	0xf06f0000,	0xea6f0000,	// MVN
-	0xf0600000,	0xea600000,	// ORN
-	0xf0400000,	0xea400000,	// ORR
-	0xea4f0030,	0xfa6f0000,	// ROR
-	0xf1c00000,	0xebc00000,	// RSB
-	0xf1600000,	0xeb600000,	// SBC
-	0xf1a00000,	0xeba00000,	// SUB
-	0xf0900f00,	0xea900f00,	// TEQ
-	0xf0100f00,	0xea100f00,	// TST
-	(unsigned)-1,	0xfb00f000,	// MUL
-};
-
-#define DP_IMM(op)	t_dop_ops[(op)*2]
-#define DP_REG(op)	t_dop_ops[(op)*2+1]
-
-#define VP_ADD	0
-#define VP_SUB	1
-#define VP_MUL	2
-#define VP_DIV	3
-
-static const unsigned t_vop_ops[] = {
-	0xee300a00,			// VADD
-	0xee300a40,			// VSUB
-	0xee200a00,			// VMUL
-	0xee800a00,			// VDIV
-};
-
-#define VP_REG(op)	t_vop_ops[op]
-
-#define T1_LS_OP(op)	t_ls_ops[(op)*2]
-#define T2_LS_OP(op)	t_ls_ops[(op)*2+1]
-
-#define SHIFT_LSL	0
-#define SHIFT_LSR	1
-#define SHIFT_ASR	2
-#define SHIFT_ROR	3
-#define SHIFT_RRX	3
-
-//------------------------------------------------------------------------------------
-
-#define TBIT 1
-
-#define E_STR_IMM6(src, imm6)		(0xce00 | ((imm6)<<3) | (src))
-#define E_LDR_IMM6(dst, imm6)		(0xcc00 | ((imm6)<<3) | (dst))
-#define E_LDR_IMM5(dst, imm5)		(0xcb00 | ((imm5)<<3) | (dst))
-#define E_LDR_IMM3(dst, base, imm3)	(0xc800 | ((imm3)<<6) | ((base) << 3) | (dst))
-
-#define T_MOV_IMM8(r, imm8)		(0x2000 | ((r)<<8) | (imm8))
-#define T_MOV_BYTELANE(r, typ, b)	(0xf04f0000 | ((typ) << 12) | ((r) << 8) | (b))
-#define T_MOV_ROT_IMM(r, ror, imm)	\
-		(0xf04f0000 | (((ror) & 0x10) << (26-4)) | (((ror) & 0xe) << (12-1)) |	\
-		(((ror) & 1) << 7) | ((r) << 8) | ((imm) & 0x7f))
-#define T_MOVW_IMM16(r, imm)		\
-		(0xf2400000 | (((imm) & 0xf000) << (16-12)) | (((imm) & 0x800) << (26-11)) | \
-		(((imm) & 0x700) << (12-8)) | ((imm) & 0xff) | ((r) << 8))
-#define T_MOVT_IMM16(r, imm)		\
-		(0xf2c00000 | (((imm) & 0xf000) << (16-12)) | (((imm) & 0x800) << (26-11)) | \
-		(((imm) & 0x700) << (12-8)) | ((imm) & 0xff) | ((r) << 8))
-#define T_MVN_BYTELANE(r, typ, b)	(0xf06f0000 | ((typ) << 12) | ((r) << 8) | (b))
-#define T_MVN_ROT_IMM(r, ror, imm)	(0xf06f0000 | (((ror) & 0x10) << (26-4)) |	\
-		(((ror) & 0xe) << (12-1)) | (((ror) & 1) << 7) | ((r) << 8) | ((imm) & 0x7f))
-
-#define T_ORR_ROT_IMM(dst, src, ror, imm)	(0xf0400000 | (((ror) & 0x10) << (26-4)) | \
-		(((ror) & 0xe) << (12-1)) | (((ror) & 1) << 7) | ((src) << 16) |	\
-		((dst) << 8) | ((imm) & 0x7f))
-#define T_ORN_ROT_IMM(dst, src, ror, imm)	(0xf0600000 | (((ror) & 0x10) << (26-4)) | \
-		(((ror) & 0xe) << (12-1)) | (((ror) & 1) << 7) | ((src) << 16) |	\
-		((dst) << 8) | ((imm) & 0x7f))
-
-#define T_STR_IMM5(src, base, imm5)	(0x6000 | ((imm5) << 6) | ((base) << 3) | (src))
-#define T_STR_SP_IMM8(src, imm8)	(0x9000 | ((src) << 8) | (imm8))
-#define T_STR_IMM12(src, base, imm12)	(0xf8c00000 | ((src)<<12) | ((base)<<16) | (imm12))
-#define T_STR_IMM8(src, base, imm8, pre, wb)	(0xf8400800 | ((src)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_LDR_IMM5(dst, base, imm5)	(0x6800 | ((imm5) << 6) | ((base) << 3) | (dst))
-#define T_LDR_SP_IMM8(src, imm8)	(0x9800 | ((dst) << 8) | (imm8))
-#define T_LDR_IMM12(dst, base, imm12)	(0xf8d00000 | ((dst)<<12) | ((base)<<16) | (imm12))
-#define T_LDR_IMM8(src, base, imm8, pre, wb)	(0xf8500800 | ((dst)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_STRB_IMM5(src, base, imm5)	(0x7000 | ((imm5) << 6) | ((base) << 3) | (src))
-#define T_STRB_IMM12(src, base, imm12)	(0xf8800000 | ((src)<<12) | ((base)<<16) | (imm12))
-#define T_STRB_IMM8(src, base, imm8, pre, wb)	(0xf8000800 | ((src)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_LDRB_IMM5(dst, base, imm5)	(0x7800 | ((imm5) << 6) | ((base) << 3) | (dst))
-#define T_LDRB_IMM12(dst, base, imm12)	(0xf8900000 | ((dst)<<12) | ((base)<<16) | (imm12))
-#define T_LDRB_IMM8(dst, base, imm8, pre, wb)	(0xf8100800 | ((dst)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_STRH_IMM5(dst, base, imm5)	(0x8000 | ((imm5) << 6) | ((base) << 3) | (dst))
-#define T_STRH_IMM12(dst, base, imm12)	(0xf8a00000 | ((dst)<<12) | ((base)<<16) | (imm12))
-#define T_STRH_IMM8(dst, base, imm8, pre, wb)	(0xf8200800 | ((dst)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_LDRH_IMM5(dst, base, imm5)	(0x8800 | ((imm5) << 6) | ((base) << 3) | (dst))
-#define T_LDRH_IMM12(dst, base, imm12)	(0xf8b00000 | ((dst)<<12) | ((base)<<16) | (imm12))
-#define T_LDRH_IMM8(dst, base, imm8, pre, wb)	(0xf8300800 | ((dst)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_LDRSH_IMM12(dst, base, imm12)	(0xf9b00000 | ((dst)<<12) | ((base)<<16) | (imm12))
-#define T_LDRSH_IMM8(dst, base, imm8, pre, wb)	(0xf9300800 | ((dst)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_LDRSB_IMM12(dst, base, imm12)	(0xf9900000 | ((dst)<<12) | ((base)<<16) | (imm12))
-#define T_LDRSB_IMM8(dst, base, imm8, pre, wb)	(0xf9100800 | ((dst)<<12) | 		\
-		((base)<<16) | ((pre)<<10) | (U(imm8)<<9) | ((wb)<<8) | abs(imm8))
-
-#define T_LDRD_IMM(lo, hi, base, imm8, pre, wb)	(0xe8500000 | ((base)<<16) |		\
-		((lo) << 12) | ((hi)<<8) | ((pre)<<24) | (U(imm8)<<23) | ((wb)<<21) | abs(imm8))
-#define T_STRD_IMM(lo, hi, base, imm8, pre, wb)	(0xe8400000 | ((base)<<16) |		\
-		((lo) << 12) | ((hi)<<8) | ((pre)<<24) | (U(imm8)<<23) | ((wb)<<21) | abs(imm8))
-
-#define T_LDREX(dst, base, off) (0xe8500f00 | ((base) << 16) | ((dst) << 12) | ((off) >> 2))
-#define T_STREX(dst, src, base, off) (0xe8400000 | ((base) << 16) | \
-		((src) << 12) | ((dst) << 8) | ((off >> 2)))
-
-#define T_STM8(base, regset)		(0xc000 | ((base) << 8) | (regset))
-#define T_STM16(base, regset, st, wb)	(0xe8000000 | ((st) << 23) | ((wb) << 21) |	\
-		((base) << 16) | (regset))
-
-#define T_LDM8(base, regset)		(0xc800 | ((base) << 8) | (regset))
-#define	T_LDM16(base, regset, st, wb)	(0xe8100000 | ((st) << 23) | ((wb) << 21) |	\
-		((base) << 16) | (regset))
-#define T_POP(regset)	(0xbc00 | (((regset & (1<<ARM_PC)) >> ARM_PC) << 8) | (regset & 0xff))
-#define T_PUSH(regset)	(0xb400 | (((regset & (1<<ARM_LR)) >> ARM_LR) << 8) | (regset & 0xff))
-
-#define	T1_LDR_STR_REG(op, xfer, base, off) 	((op) | ((off) << 6) | ((base) << 3) | (xfer))
-#define T2_LDR_STR_REG(op, xfer, base, off, sh)	((op) | ((base) << 16) | ((xfer) << 12) | \
-		((sh)<<4) | (off))
-
-#define T_CHKA(size, idx)		(0xca00 | (((size) & 8) << (7-3)) | ((idx) << 3) | ((size) & 7))
-#define T_HBL(handler)			(0xc300 | (handler))
-#define T_ENTER_LEAVE(enter)		(0xf3bf8f0f | ((enter)<<4))
-
-#define T1_ADD_IMM(dst, src, imm3)	(0x1c00 | ((imm3) << 6) | ((src) << 3) | (dst))
-#define T2_ADD_IMM(r, imm8)		(0x3000 | ((r) << 8) | (imm8))
-#define T3_ADD_BYTELANE(dst, src, typ, b) (0xf1000000 | ((src) << 16) | ((typ) << 12) | \
-		((dst) << 8) | (b))
-#define T3_ADD_ROT_IMM(dst, src, ror, imm) (0xf1000000 | ((src) << 16) | ((dst) << 8) | \
-		(((ror) & 0x10) << (26-4)) | (((ror) & 0x0e) << (12-1)) | (((ror) & 1) << 7) | \
-		((imm) & 0x7f))
-#define T4_ADD_IMM(dst, src, imm)	(0xf2000000 | ((src) << 16) | ((dst) << 8) | \
-		(((imm) & 0x800) << (26-11)) | (((imm) & 0x700) << (12-8)) | ((imm) & 0xff))
-
-#define T1_SUB_IMM(dst, src, imm3)	(0x1e00 | ((imm3) << 6) | ((src) << 3) | (dst))
-#define T2_SUB_IMM(r, imm8)		(0x3800 | ((r) << 8) | (imm8))
-#define T3_SUB_BYTELANE(dst, src, typ, b) (0xf1a00000 | ((src) << 16) | ((typ) << 12) | \
-		((dst) << 8) | (b))
-#define T3_SUB_ROT_IMM(dst, src, ror, imm) (0xf1a00000 | ((src) << 16) | ((dst) << 8) | \
-		(((ror) & 0x10) << (26-4)) | (((ror) & 0x0e) << (12-1)) | (((ror) & 1) << 7) | \
-		((imm) & 0x7f))
-#define T4_SUB_IMM(dst, src, imm)	(0xf2a00000 | ((src) << 16) | ((dst) << 8) | \
-		(((imm) & 0x800) << (26-11)) | (((imm) & 0x700) << (12-8)) | ((imm) & 0xff))
-
-#define T_DOP_BYTELANE(op, dst, src, typ, b)	((op) | ((dst) << 8) | ((src) << 16) | \
-		((typ) << 12) | (b))
-#define T_DOP_ROT_IMM(op, dst, src, ror, imm)	((op) | ((dst) << 8) | ((src) << 16) | \
-		(((ror) & 0x10) << (26-4)) | (((ror) & 0x0e) << (12-1)) | (((ror) & 1) << 7) | \
-		((imm) & 0x7f))
-#define T_SHIFT_IMM(op, dst, src, imm)	((op) | ((dst) << 8) | (src) | \
-		(((imm) & 3) << 6) | (((imm) & 0x1c) << (12-2)))
-#define T_DOP_REG(op, dst, lho, rho, st, sh)	((op) | ((dst) << 8) | ((lho) << 16) | (rho) | \
-		((st) << 4) | (((sh) & 0x1c) << (12-2)) | (((sh) & 3) << 6))
-#define T3_ADD_BYTELANE(dst, src, typ, b) (0xf1000000 | ((src) << 16) | ((typ) << 12) | \
-		((dst) << 8) | (b))
-
-#define T_CMP_IMM(src, imm)		(0x2800 | ((src) << 8) | (imm))
-#define T_CMP_REG(lho, rho)		(0x4280 | ((rho) << 3) | (lho))
-
-#define T_NEG(dst, src)		(0x4240 | (dst) | ((src) << 3))
-#define T_MVN(dst, src)		(0x43c0 | (dst) | ((src) << 3))
-#define T_MOV(dst, src)		(0x4600 | (((dst) & 8) << (7-3)) | ((src) << 3) | ((dst) & 7))
-
-#define T_VMOVS_TOARM(dst, src)	\
-	(0xee100a10 | ((dst) << 12) | (((src) & 1) << 7) | (((src) & 0x1e)<<(16-1)))
-#define T_VMOVS_TOVFP(dst, src) \
-	(0xee000a10 | ((src) << 12) | (((dst) & 1) << 7) | (((dst) & 0x1e)<<(16-1)))
-
-#define T_VMOVD_TOARM(dst_lo, dst_hi, src) \
-  (0xec500b10 | ((dst_lo) << 12) | ((dst_hi) << 16) | (((src) & 0x10)<<(5-4)) | ((src) & 0x0f))
-#define T_VMOVD_TOVFP(dst, src_lo, src_hi) \
-  (0xec400b10 | ((src_lo) << 12) | ((src_hi) << 16) | (((dst) & 0x10)<<(5-4)) | ((dst) & 0x0f))
-
-#define T_VOP_REG_S(op, dst, lho, rho)	((op) |				\
-		(((dst) & 1) << 22) | (((dst) & 0x1e) << (12-1)) | 	\
-		(((lho) & 1) << 7) | (((lho) & 0x1e) << (16-1))	 |	\
-		(((rho) & 1) << 5) | (((rho) & 0x1e) >> 1))
-#define T_VOP_REG_D(op, dst, lho, rho)	((op) |	(1 << 8) |		\
-		(((dst) & 0x10) << (22-4)) | (((dst) & 0xf) << 12) | 	\
-		(((lho) & 0x10) << (7-4)) | (((lho) & 0xf) << 16)   |	\
-		(((rho) & 0x10) << (5-4)) | ((rho) & 0xf))
-
-#define T_VCMP_S(lho, rho, e)		(0xeeb40a40 | ((e) << 7) |	\
-		(((lho) & 1) << 22) | (((lho) & 0x1e) << (12-1)) |	\
-		(((rho) & 1) << 5) | (((rho) & 0x1e) >>1))
-#define T_VCMP_D(lho, rho, e)		(0xeeb40b40 | ((e) << 7) |	\
-		(((lho) & 0x10) << (22-4)) | (((lho) & 0x0f) << 12) |	\
-		(((rho) & 0x10) << (5-4)) | ((rho) & 0x0f))
-#define T_VMRS(dst)	(0xeef10a10 | ((dst) << 12))
-
-#define T_MLA(res, lho, rho, a) \
-		(0xfb000000 | ((res) << 8) | ((lho) << 16) | (rho) | ((a) << 12))
-#define T_UMULL(res_lo, res_hi, lho, rho) \
-		(0xfba00000 | ((res_lo) << 12) | ((res_hi) << 8) | ((lho) << 16) | (rho))
-
-#define T_BX(src)		(0x4700 | ((src) << 3))
-#define T_TBH(base, idx)	(0xe8d0f010 | ((base) << 16) | (idx))
-
-#define T_SXTB(dst, src)	(0xb240 | ((src) << 3) | (dst))
-#define T_SXTH(dst, src)	(0xb200 | ((src) << 3) | (dst))
-#define T2_SXTB(dst, src)	(0xfa4ff080 | ((dst) << 8) | (src))
-#define T2_SXTH(dst, src)	(0xfa0ff080 | ((dst) << 8) | (src))
-#define T_UXTH(dst, src)	(0xb280 | ((src) << 3) | (dst))
-#define T2_UXTH(dst, src)	(0xfa1ff080 | ((dst) << 8) | (src))
-
-int out_16(CodeBuf *codebuf, u32 s)
-{
-  if (codebuf->idx >= codebuf->limit)
-	longjmp(compiler_error_env, COMPILER_RESULT_FATAL);
-  codebuf->codebuf[codebuf->idx++] = s;
-  return 0;
-}
-
-int out_16x2(CodeBuf *codebuf, u32 sx2)
-{
-  unsigned s1 = sx2 >> 16;
-  unsigned s2 = sx2 & 0xffff;
-
-  out_16(codebuf, s1);
-  return out_16(codebuf, s2);
-}
-
-int out_32(CodeBuf *codebuf, u32 w)
-{
-  if (codebuf->idx + 2 > codebuf->limit)
-	longjmp(compiler_error_env, COMPILER_RESULT_FATAL);
-  *(u32 *)&(codebuf->codebuf[codebuf->idx]) = w;
-  codebuf->idx += 2;
-  return 0;
-}
-
-u32 out_pos(CodeBuf *codebuf)
-{
-  return (u32)&(codebuf->codebuf[codebuf->idx]);
-}
-
-u32 out_loc(CodeBuf *codebuf)
-{
-  return codebuf->idx * 2;
-}
-
-#define CODE_ALIGN 64
-#define CODE_ALIGN_SIZE 64
-
-u32 out_align(CodeBuf *codebuf, unsigned align)
-{
-  codebuf->idx += (((out_pos(codebuf) + (align-1)) & ~(align-1)) - out_pos(codebuf)) / sizeof(short);
-  return out_pos(codebuf);
-}
-
-int thumb_single_shift(unsigned imm)
-{
-  unsigned lsl;
-
-  if (!imm) return -1;
-  lsl = 0;
-  while (!(imm & 0x80000000)) {
-    imm <<= 1;
-    lsl++;
-  }
-  if (lsl >= 24) return -1;
-  if ((imm & 0xff000000) == imm) return lsl+8;
-  return -1;
-}
-
-int thumb_bytelane(u32 imm)
-{
-    unsigned b1 = imm & 0xff;
-    unsigned b2 = (imm >> 8) & 0xff;
-    unsigned b3 = (imm >> 16) & 0xff;
-    unsigned b4 = imm >> 24;
-    int mov_type = -1;
-
-    if (b1 == b3 && b2 == 0 && b4 == 0) mov_type = 1;
-    if (b1 == b2 && b1 == b3 && b1 == b4) mov_type = 3;
-    if (b2 == b4 && b1 == 0 && b3 == 0) mov_type = 2;
-    if (imm < 256) mov_type = 0;
-    return mov_type;
-}
-
-int mov_imm(CodeBuf *codebuf, Reg r, u32 imm)
-{
-  int mov_type, rol;
-
-  if (Thumb2) {
-    if (r < ARM_R8 && imm < 256)
-      return out_16(codebuf, T_MOV_IMM8(r, imm));
-    mov_type = thumb_bytelane(imm);
-    if (mov_type >= 0) {
-      if (mov_type == 2) imm >>= 8;
-      return out_16x2(codebuf, T_MOV_BYTELANE(r, mov_type, (imm & 0xff)));
-    }
-    mov_type = thumb_bytelane(~imm);
-    if (mov_type >= 0) {
-      imm = ~imm;
-      if (mov_type == 2) imm >>= 8;
-      return out_16x2(codebuf, T_MVN_BYTELANE(r, mov_type, (imm & 0xff)));
-    }
-    rol = thumb_single_shift(imm);
-    if (rol >= 0)
-      return out_16x2(codebuf, T_MOV_ROT_IMM(r, rol, ROL(imm, rol)));
-    rol = thumb_single_shift(~imm);
-    if (rol >= 0)
-      return out_16x2(codebuf, T_MVN_ROT_IMM(r, rol, ROL(~imm, rol)));
-    if ((imm & ~0xffff) == 0)
-      return out_16x2(codebuf, T_MOVW_IMM16(r, imm & 0xffff));
-    if (r < ARM_R8) {
-      rol = thumb_single_shift(imm & ~0xff);
-      if (rol >= 0) {
-	out_16(codebuf, T_MOV_IMM8(r, imm & 0xff));
-	return out_16x2(codebuf, T_ORR_ROT_IMM(r, r, rol, ROL(imm & ~0xff, rol)));
-      }
-    }
-    out_16x2(codebuf, T_MOVW_IMM16(r, imm & 0xffff));
-    return out_16x2(codebuf, T_MOVT_IMM16(r, imm >> 16));
-  }
-  J_Unimplemented();
-}
-
-int load_store_reg_no_wb(CodeBuf *codebuf, u32 op, Reg xfer, Reg base, Reg offset,
-							  u32 shift, int pre)
-{
-  if (pre) {
-    if (xfer < ARM_R8 && base < ARM_R8 && offset < ARM_R8) {
-      if (ThumbEE) {
-	if ((shift == 0 && LS_IS_BYTE(op)) || (shift == 1 && LS_IS_HW(op)) ||
-							(shift == 2 && LS_IS_WORD(op)))
-	  return out_16(codebuf, T1_LDR_STR_REG(T1_LS_OP(op), xfer, base, offset));
-      } else if (shift == 0)
-	return out_16(codebuf, T1_LDR_STR_REG(T1_LS_OP(op), xfer, base, offset));
-    }
-    if (shift < 4)
-      return out_16x2(codebuf, T2_LDR_STR_REG(T2_LS_OP(op), xfer, base, offset, shift));
-  }
-  J_Unimplemented();
-}
-
-static int add_reg(CodeBuf *codebuf, u32 dst, u32 lho, u32 rho);
-
-int load_store_reg(CodeBuf *codebuf, u32 op, Reg xfer, Reg base, Reg offset,
-							  u32 shift, int pre, int wb)
-{
-  int rc = load_store_reg_no_wb(codebuf, op, xfer, base, offset, shift, pre);
-  if (wb) {
-    return add_reg(codebuf, base, base, offset);
-  }
-  return rc;
-}
-
-int str_reg(CodeBuf *codebuf, Reg src, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_STR, src, base, offset, shift, pre, wb);
-}
-
-int ldr_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_LDR, dst, base, offset, shift, pre, wb);
-}
-
-int strb_reg(CodeBuf *codebuf, Reg src, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_STRB, src, base, offset, shift, pre, wb);
-}
-
-int ldrb_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_LDRB, dst, base, offset, shift, pre, wb);
-}
-
-int strh_reg(CodeBuf *codebuf, Reg src, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_STRH, src, base, offset, shift, pre, wb);
-}
-
-int ldrh_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_LDRH, dst, base, offset, shift, pre, wb);
-}
-
-int ldrsh_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_LDRSH, dst, base, offset, shift, pre, wb);
-}
-
-int ldrsb_reg(CodeBuf *codebuf, Reg dst, Reg base, Reg offset, u32 shift, int pre, int wb)
-{
-  return load_store_reg(codebuf, LS_LDRSB, dst, base, offset, shift, pre, wb);
-}
-
-int ldrex_imm(CodeBuf *codebuf, Reg dst, Reg base, unsigned offset)
-{
-  if (Thumb2) {
-    if ((offset & 3) == 0 && offset < 256 * 4) {
-      return out_16x2(codebuf, T_LDREX(dst, base, offset));
-    }
-  }
-  J_Unimplemented();
-}
-
-int strex_imm(CodeBuf *codebuf, Reg dst, Reg src, Reg base, unsigned offset)
-{
-  if (Thumb2) {
-    if ((offset & 3) == 0 && offset < 256 * 4) {
-      return out_16x2(codebuf, T_STREX(dst, src, base, offset));
-    }
-  }
-  J_Unimplemented();
-}
-
-int str_imm(CodeBuf *codebuf, Reg src, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (base < ARM_R8 && src < ARM_R8 && uoff < 128 && (uoff & 3) == 0)
-	return out_16(codebuf, T_STR_IMM5(src, base, uoff>>2));
-      if (base == ARM_SP && src < ARM_R8 && uoff < 1024 && (uoff &3) ==0)
-	return out_16(codebuf, T_STR_SP_IMM8(src, uoff>>2));
-      if (ThumbEE && base == ARM_R9 && src < ARM_R8 && uoff < 256 && (uoff & 3) == 0)
-	return out_16(codebuf, E_STR_IMM6(src, uoff>>2));
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_STR_IMM12(src, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_STR_IMM8(src, base, offset, pre, wb));
-    JASSERT(base != ARM_IP && src != ARM_IP, "src or base == IP in str_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return str_reg(codebuf, src, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int ldr_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (base < ARM_R8 && dst < ARM_R8 && uoff < 128 && (uoff & 3) ==0)
-	return out_16(codebuf, T_LDR_IMM5(dst, base, uoff>>2));
-      if (base == ARM_SP && dst < ARM_R8 && uoff < 1024 & (uoff & 3) == 0)
-	return out_16(codebuf, T_LDR_SP_IMM8(dst, uoff>>2));
-      if (ThumbEE && base == ARM_R9 && dst < ARM_R8 && uoff < 256 && (uoff & 3) == 0)
-	return out_16(codebuf, E_LDR_IMM6(dst, uoff>>2));
-      if (ThumbEE && base == ARM_R10 && dst < ARM_R8 && uoff < 128 && (uoff & 3) == 0)
-	return out_16(codebuf, E_LDR_IMM5(dst, uoff>>2));
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_LDR_IMM12(dst, base, uoff));
-    } else {
-      if (ThumbEE && pre && !wb && offset <= 0 && offset > -32 && (uoff & 3) == 0 &&
-							base < ARM_R8 && dst < ARM_R8)
-	return out_16(codebuf, E_LDR_IMM3(dst, base, -offset >> 2));
-      if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_LDR_IMM8(dst, base, offset, pre, wb));
-    }
-    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return ldr_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int strb_imm(CodeBuf *codebuf, Reg src, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (base < ARM_R8 && src < ARM_R8 && uoff < 32)
-	return out_16(codebuf, T_STRB_IMM5(src, base, uoff));
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_STRB_IMM12(src, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_STRB_IMM8(src, base, offset, pre, wb));
-    JASSERT(base != ARM_IP && src != ARM_IP, "src or base == IP in str_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return strb_reg(codebuf, src, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int ldrb_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (base < ARM_R8 && dst < ARM_R8 && uoff < 32)
-	return out_16(codebuf, T_LDRB_IMM5(dst, base, uoff));
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_LDRB_IMM12(dst, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_LDRB_IMM8(dst, base, offset, pre, wb));
-    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return ldrb_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int strh_imm(CodeBuf *codebuf, Reg src, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (base < ARM_R8 && src < ARM_R8 && uoff < 64 && (uoff & 1) == 0)
-	return out_16(codebuf, T_STRH_IMM5(src, base, uoff>>1));
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_STRH_IMM12(src, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_STRH_IMM8(src, base, offset, pre, wb));
-    JASSERT(base != ARM_IP && src != ARM_IP, "src or base == IP in str_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return strh_reg(codebuf, src, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int ldrh_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (base < ARM_R8 && dst < ARM_R8 && uoff < 64 && (uoff & 1) == 0)
-	return out_16(codebuf, T_LDRH_IMM5(dst, base, uoff>>1));
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_LDRH_IMM12(dst, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_LDRH_IMM8(dst, base, offset, pre, wb));
-    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return ldrh_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int ldrsh_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_LDRSH_IMM12(dst, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_LDRSH_IMM8(dst, base, offset, pre, wb));
-    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return ldrsh_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int ldrsb_imm(CodeBuf *codebuf, Reg dst, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (pre && !wb && offset >= 0) {
-      if (uoff < (1 << 12))
-	return out_16x2(codebuf, T_LDRSB_IMM12(dst, base, uoff));
-    } else if (offset < 256 && offset > -256)
-	return out_16x2(codebuf, T_LDRSB_IMM8(dst, base, offset, pre, wb));
-    JASSERT(base != ARM_IP, "base == IP in ldr_imm");
-    mov_imm(codebuf, ARM_IP, offset);
-    return ldrsb_reg(codebuf, dst, base, ARM_IP, 0, pre, wb);
-  }
-  J_Unimplemented();
-}
-
-int add_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm);
-
-int ldrd_imm(CodeBuf *codebuf, Reg dst_lo, Reg dst_hi, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (offset < 256 * 4 && offset > -256 * 4 && (offset & 3) == 0)
-      return out_16x2(codebuf, T_LDRD_IMM(dst_lo, dst_hi, base, offset>>2, pre, wb));
-    if (pre && !wb) {
-      add_imm(codebuf, ARM_IP, base, offset);
-      return out_16x2(codebuf, T_LDRD_IMM(dst_lo, dst_hi, ARM_IP, 0, 1, 0));
-    }
-  }
-  J_Unimplemented();
-}
-
-int strd_imm(CodeBuf *codebuf, Reg src_lo, Reg src_hi, Reg base, int offset, int pre, int wb)
-{
-  unsigned uoff;
-
-  if (!pre && !wb) pre = 1, offset = 0;
-  uoff = (unsigned)offset;
-  if (Thumb2) {
-    if (offset < 256 * 4 && offset > -256 * 4 && (offset & 3) == 0)
-      return out_16x2(codebuf, T_STRD_IMM(src_lo, src_hi, base, offset>>2, pre, wb));
-    if (pre && !wb) {
-      add_imm(codebuf, ARM_IP, base, offset);
-      return out_16x2(codebuf, T_STRD_IMM(src_lo, src_hi, ARM_IP, 0, 1, 0));
-    }
-  }
-  J_Unimplemented();
-}
-
-int stm(CodeBuf *codebuf, u32 regset, u32 base, u32 st, u32 wb)
-{
-  JASSERT(regset != 0, "regset != 0 in stm");
-  if (Thumb2) {
-    if (!ThumbEE && base < ARM_R8 && (regset & ~0xff) == 0 && st == IA && wb)
-      return out_16(codebuf, T_STM8(base, regset));
-    if (base == ARM_SP) {
-      if ((regset & ~0x40ff) == 0 && st == DB && wb)
-	return out_16(codebuf, T_PUSH(regset));
-    }
-    if ((regset & -regset) == regset)
-      return str_imm(codebuf, LOG2(regset), base, (st & 1) ? 4 : -4, (st & 2) >> 1, wb);
-    if (st == PUSH_EA || st == PUSH_FD)
-      return out_16x2(codebuf, T_STM16(base, regset, st, wb));
-    return out_16x2(codebuf, T_STM16(base, regset, st, wb));
-  }
-  J_Unimplemented();
-}
-
-int ldm(CodeBuf *codebuf, u32 regset, u32 base, u32 st, u32 wb)
-{
-  JASSERT(regset != 0, "regset != 0 in stm");
-  if (Thumb2) {
-    if (!ThumbEE && base < ARM_R8 && (regset & ~0xff) == 0 && st == IA && wb)
-      return out_16(codebuf, T_LDM8(base, regset));
-    if (base == ARM_SP) {
-      if ((regset & ~0x80ff) == 0 && st == IA && wb)
-	return out_16(codebuf, T_POP(regset));
-    }
-    if ((regset & -regset) == regset)
-      return ldr_imm(codebuf, LOG2(regset), base, (st & 1) ? 4 : -4, (st & 2) >> 1, wb);
-    if (st == POP_EA || st == POP_FD)
-      return out_16x2(codebuf, T_LDM16(base, regset, st, wb));
-  }
-  J_Unimplemented();
-}
-
-int dop_reg(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho, u32 sh_typ, u32 shift)
-{
-  unsigned s = 0;
-  if (op != DP_MUL) s = 1 << 20;
-//  JASSERT(dst != ARM_PC, "Terrible things happen if dst == PC && S bit set");
-  return out_16x2(codebuf, T_DOP_REG(DP_REG(op)|s, dst, lho, rho, sh_typ, shift));
-}
-
-int dop_reg_preserve(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho, u32 sh_typ, u32 shift)
-{
-  return out_16x2(codebuf, T_DOP_REG(DP_REG(op), dst, lho, rho, sh_typ, shift));
-}
-
-int sxtb(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  if (dst < ARM_R8 && src < ARM_R8)
-    return out_16(codebuf, T_SXTB(dst, src));
-  return out_16x2(codebuf, T2_SXTB(dst, src));
-}
-
-int sxth(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  if (dst < ARM_R8 && src < ARM_R8)
-    return out_16(codebuf, T_SXTH(dst, src));
-  return out_16x2(codebuf, T2_SXTH(dst, src));
-}
-
-int uxth(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  if (dst < ARM_R8 && src < ARM_R8)
-    return out_16(codebuf, T_UXTH(dst, src));
-  return out_16x2(codebuf, T2_UXTH(dst, src));
-}
-
-int mov_reg(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  if (dst == src) return 0;
-  if (dst == ARM_PC) return out_16(codebuf, T_BX(src));
-  return out_16(codebuf, T_MOV(dst, src));
-//  return dop_reg(codebuf, DP_MOV, dst, 0, src, SHIFT_LSL, 0);
-}
-
-int mvn_reg(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  if (dst < ARM_R8 && src < ARM_R8)
-    return out_16(codebuf, T_MVN(dst, src));
-  return dop_reg(codebuf, DP_MVN, dst, 0, src, SHIFT_LSL, 0);
-}
-
-int vmov_reg_s_toVFP(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  return out_16x2(codebuf, T_VMOVS_TOVFP(dst, src));
-}
-
-int vmov_reg_s_toARM(CodeBuf *codebuf, u32 dst, u32 src)
-{
-  return out_16x2(codebuf, T_VMOVS_TOARM(dst, src));
-}
-
-int vmov_reg_d_toVFP(CodeBuf *codebuf, u32 dst, u32 src_lo, u32 src_hi)
-{
-  return out_16x2(codebuf, T_VMOVD_TOVFP(dst, src_lo, src_hi));
-}
-
-int vmov_reg_d_toARM(CodeBuf *codebuf, u32 dst_lo, u32 dst_hi, u32 src)
-{
-  return out_16x2(codebuf, T_VMOVD_TOARM(dst_lo, dst_hi, src));
-}
-
-int vop_reg_s(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho)
-{
-  return out_16x2(codebuf, T_VOP_REG_S(VP_REG(op), dst, lho, rho));
-}
-
-int vop_reg_d(CodeBuf *codebuf, u32 op, u32 dst, u32 lho, u32 rho)
-{
-  return out_16x2(codebuf, T_VOP_REG_D(VP_REG(op), dst, lho, rho));
-}
-
-int vcmp_reg_s(CodeBuf *codebuf, u32 lho, u32 rho, unsigned e)
-{
-  return out_16x2(codebuf, T_VCMP_S(lho, rho, e));
-}
-
-int vcmp_reg_d(CodeBuf *codebuf, u32 lho, u32 rho, unsigned e)
-{
-  return out_16x2(codebuf, T_VCMP_D(lho, rho, e));
-}
-
-int vmrs(CodeBuf *codebuf, u32 dst)
-{
-  return out_16x2(codebuf, T_VMRS(dst));
-}
-
-int add_reg(CodeBuf *codebuf, u32 dst, u32 lho, u32 rho)
-{
-  return dop_reg(codebuf, DP_ADD, dst, lho, rho, SHIFT_LSL, 0);
-}
-
-int cmp_reg(CodeBuf *codebuf, Reg lho, Reg rho)
-{
-  if (lho < ARM_R8 && rho < ARM_R8)
-    return out_16(codebuf, T_CMP_REG(lho, rho));
-  return dop_reg(codebuf, DP_CMP, 0x0f, lho, rho, SHIFT_LSL, 0);
-}
-
-int add_reg_shift(CodeBuf *codebuf, u32 dst, u32 lho, u32 rho, u2 sh_typ, u32 shift)
-{
-  return dop_reg(codebuf, DP_ADD, dst, lho, rho, sh_typ, shift);
-}
-
-int add_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  int imm_type, rol;
-
-  if (imm == 0) return mov_reg(codebuf, dst, src);
-  if (Thumb2) {
-    if (dst < ARM_R8 && src < ARM_R8) {
-      if (imm < 8)
-	return out_16(codebuf, T1_ADD_IMM(dst, src, imm));
-      if (-imm < 8)
-	return out_16(codebuf, T1_SUB_IMM(dst, src, -imm));
-      if (src == dst) {
-	if (imm < 256)
-	  return out_16(codebuf, T2_ADD_IMM(src, imm));
-	if (-imm < 256)
-	  return out_16(codebuf, T2_SUB_IMM(src, -imm));
-      }
-    }
-    imm_type = thumb_bytelane(imm);
-    if (imm_type >= 0) {
-      if (imm_type == 2) imm >>= 8;
-      return out_16x2(codebuf, T3_ADD_BYTELANE(dst, src, imm_type, (imm & 0xff)));
-    }
-    imm_type = thumb_bytelane(-imm);
-    if (imm_type >= 0) {
-      imm = -imm;
-      if (imm_type == 2) imm >>= 8;
-      return out_16x2(codebuf, T3_SUB_BYTELANE(dst, src, imm_type, (imm & 0xff)));
-    }
-    rol = thumb_single_shift(imm);
-    if (rol >= 0)
-      return out_16x2(codebuf, T3_ADD_ROT_IMM(dst, src, rol, ROL(imm, rol)));
-    rol = thumb_single_shift(-imm);
-    if (rol >= 0)
-      return out_16x2(codebuf, T3_SUB_ROT_IMM(dst, src, rol, ROL(-imm, rol)));
-    if (imm < (1 << 12))
-      return out_16x2(codebuf, T4_ADD_IMM(dst, src, imm));
-    if (-imm < (1 << 12))
-      return out_16x2(codebuf, T4_SUB_IMM(dst, src, -imm));
-    mov_imm(codebuf, ARM_IP, imm);
-    return add_reg(codebuf, dst, src, ARM_IP);
-  }
-  J_Unimplemented();
-}
-
-int sub_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  return add_imm(codebuf, dst, src, -imm);
-}
-
-int dop_imm_s(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm, unsigned s)
-{
-    int imm_type, rol;
-    unsigned n_op, n_imm;
-
-    JASSERT(op == DP_ADC || op == DP_ADD || op == DP_AND || op == DP_BIC || op == DP_CMN ||
-		op == DP_CMP || op == DP_EOR || op == DP_MOV || op == DP_MVN ||
-		op == DP_ORN || op == DP_ORR || op == DP_RSB || op == DP_SBC ||
-		op == DP_SUB || op == DP_TEQ || op == DP_TST, "bad op");
-    if (op == DP_CMP || op == DP_CMN || op == DP_TEQ || op == DP_TST) dst = 0x0f;
-    if (op == DP_MOV || op == DP_MVN) src = 0x0f;
-    imm_type = thumb_bytelane(imm);
-    if (imm_type >= 0) {
-      if (imm_type == 2) imm >>= 8;
-      return out_16x2(codebuf, T_DOP_BYTELANE(DP_IMM(op)|s, dst, src, imm_type, (imm & 0xff)));
-    }
-    rol = thumb_single_shift(imm);
-    if (rol >= 0)
-      return out_16x2(codebuf, T_DOP_ROT_IMM(DP_IMM(op)|s, dst, src, rol, ROL(imm, rol)));
-    n_op = N_OP(op);
-    if (n_op != (unsigned)-1) {
-      n_imm = ~imm;
-      if (op == DP_ADD || op == DP_SUB || op == DP_CMP || op == DP_CMN) n_imm = -imm;
-      imm_type = thumb_bytelane(n_imm);
-      if (imm_type >= 0) {
-	if (imm_type == 2) n_imm >>= 8;
-	return out_16x2(codebuf, T_DOP_BYTELANE(DP_IMM(n_op)|s, dst, src, imm_type, (n_imm & 0xff)));
-      }
-      rol = thumb_single_shift(n_imm);
-      if (rol >= 0)
-	return out_16x2(codebuf, T_DOP_ROT_IMM(DP_IMM(n_op)|s, dst, src, rol, ROL(n_imm, rol)));
-    }
-    mov_imm(codebuf, ARM_IP, imm);
-    return out_16x2(codebuf, T_DOP_REG(DP_REG(op)|s, dst, src, ARM_IP, SHIFT_LSL, 0));
-}
-
-int dop_imm(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm)
-{
-    return dop_imm_s(codebuf, op, dst, src, imm, 1<<20);
-}
-
-int dop_imm_preserve(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm)
-{
-    return dop_imm_s(codebuf, op, dst, src, imm, 0);
-}
-
-int shift_imm(CodeBuf *codebuf, u32 op, u32 dst, u32 src, u32 imm)
-{
-    imm &= 31;
-    if (imm == 0)
-      return mov_reg(codebuf, dst, src);
-    else
-      return out_16x2(codebuf, T_SHIFT_IMM(DP_IMM(op), dst, src, imm));
-}
-
-int rsb_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  if (dst < ARM_R8 && src < ARM_R8 && imm == 0)
-    return out_16(codebuf, T_NEG(dst, src));
-  return dop_imm(codebuf, DP_RSB, dst, src, imm);
-}
-
-int adc_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  return dop_imm(codebuf, DP_ADC, dst, src, imm);
-}
-
-int asr_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  return shift_imm(codebuf, DP_ASR, dst, src, imm);
-}
-
-int eor_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  return dop_imm(codebuf, DP_EOR, dst, src, imm);
-}
-
-int and_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  return dop_imm(codebuf, DP_AND, dst, src, imm);
-}
-
-int orr_imm(CodeBuf *codebuf, u32 dst, u32 src, u32 imm)
-{
-  return dop_imm(codebuf, DP_ORR, dst, src, imm);
-}
-
-int cmp_imm(CodeBuf *codebuf, Reg src, u32 imm)
-{
-  if (src <= ARM_R8 && imm < 256) return out_16(codebuf, T_CMP_IMM(src, imm));
-  return dop_imm(codebuf, DP_CMP, 0x0f, src, imm);
-}
-
-int tst_imm(CodeBuf *codebuf, Reg src, u32 imm)
-{
-  return dop_imm(codebuf, DP_TST, 0x0f, src, imm);
-}
-
-int hbl(CodeBuf *codebuf, unsigned handler)
-{
-  mov_imm(codebuf, ARM_IP, 0);
-  str_imm(codebuf, ARM_IP, ARM_IP, 0, 1, 0);
-#if 0
-  if ((Thumb2 && ThumbEE))
-    return out_16(codebuf, T_HBL(handler));
-  if (TESTING)
-    return mov_imm(codebuf, ARM_R8, handler);
-  J_Unimplemented();
-#endif
-}
-
-#if 0
-int enter_leave(CodeBuf *codebuf, unsigned enter)
-{
-  if ((Thumb2 && ThumbEE))
-    return out_16x2(codebuf, T_ENTER_LEAVE(enter));
-  J_Unimplemented();
-}
-#endif
-
-int tbh(CodeBuf *codebuf, Reg base, Reg idx)
-{
-  out_16x2(codebuf, T_TBH(base, idx));
-}
-
-int umull(CodeBuf *codebuf, u32 res_lo, u32 res_hi, u32 lho, u32 rho)
-{
-  return out_16x2(codebuf, T_UMULL(res_lo, res_hi, lho, rho));
-}
-
-int mla(CodeBuf *codebuf, u32 res, u32 lho, u32 rho, u32 a)
-{
-  return out_16x2(codebuf, T_MLA(res, lho, rho, a));
-}
-
-#define COND_EQ 0
-#define COND_NE 1
-#define COND_LT	2
-#define COND_GE 3
-#define COND_GT 4
-#define COND_LE 5
-#define COND_CS 6
-#define COND_CC 7
-#define COND_MI 8
-#define COND_PL 9
-
-static unsigned conds[] = {
-	0x0,
-	0x1,
-	0xb,
-	0xa,
-	0xc,
-	0xd,
-	0x2,
-	0x3,
-	0x4,
-	0x5,
-};
-
-#define NEG_COND(cond)	((cond) ^ 1)
-
-#define T_B(uoff)	(0xe000 | ((uoff) & 0x7ff))
-#define T_BW(uoff)	(0xf0009000 | \
-			  (((uoff) & (1<<23)) << (26-23)) | \
-			  (((~(uoff) & (1<<22)) >> 22) ^ (((uoff) & (1<<23)) >> 23)) << 13 | \
-			  (((~(uoff) & (1<<21)) >> 21) ^ (((uoff) & (1<<23)) >> 23)) << 11 | \
-			  (((uoff) & 0x1ff800) << (16-11)) | \
-			  ((uoff) & 0x7ff))
-#define T_BL(uoff)	(0xf000d000 | \
-			  (((uoff) & (1<<23)) << (26-23)) | \
-			  (((~(uoff) & (1<<22)) >> 22) ^ (((uoff) & (1<<23)) >> 23)) << 13 | \
-			  (((~(uoff) & (1<<21)) >> 21) ^ (((uoff) & (1<<23)) >> 23)) << 11 | \
-			  (((uoff) & 0x1ff800) << (16-11)) | \
-			  ((uoff) & 0x7ff))
-#define T_BLX(uoff)	(0xf000c000 | \
-			  (((uoff) & (1<<23)) << (26-23)) | \
-			  (((~(uoff) & (1<<22)) >> 22) ^ (((uoff) & (1<<23)) >> 23)) << 13 | \
-			  (((~(uoff) & (1<<21)) >> 21) ^ (((uoff) & (1<<23)) >> 23)) << 11 | \
-			  (((uoff) & 0x1ff800) << (16-11)) | \
-			  ((uoff) & 0x7ff))
-#define T_BCC(cond, uoff) (0xd000 | (conds[cond] << 8) | ((uoff) & 0xff))
-#define T_BCCW(cond, uoff) (0xf0008000 | \
-			     (conds[cond] << 22) | \
-			     (((uoff) & (1<<19)) << (26-19)) | \
-			     (((uoff) & (1<<18)) >> (18-11)) | \
-			     (((uoff) & (1<<17)) >> (17-13)) | \
-			     (((uoff) & 0x1f800) << (16-11)) | \
-			     ((uoff) & 0x7ff))
-#define T_BLX_REG(r)	(0x4780 | ((r) << 3))
-#define T_CBZ(r, uoff)	(0xb100 | (((uoff) & 0x1f) << 3) | (((uoff) & 0x20) << (8-5)) | ((r) & 7))
-#define T_CBNZ(r, uoff)	(0xb900 | (((uoff) & 0x1f) << 3) | (((uoff) & 0x20) << (8-5)) | ((r) & 7))
-
-#define T_IT(cond, mask) (0xbf00 | (conds[cond] << 4) | (mask))
-
-#define IT_MASK_T	8
-
-#define PATCH(loc)	do {						\
-	  unsigned oldidx = codebuf->idx;				\
-	  codebuf->idx = (loc) >> 1;					\
-
-#define HCTAP								\
-	  codebuf->idx = oldidx;					\
-    	} while (0)
-
-int forward_16(CodeBuf *codebuf)
-{
-  int loc = out_loc(codebuf);
-  out_16(codebuf, T_UNDEFINED_16);
-  return loc;
-}
-
-int forward_32(CodeBuf *codebuf)
-{
-  int loc = out_loc(codebuf);
-  out_32(codebuf, T_UNDEFINED_32);
-  return loc;
-}
-
-int it(CodeBuf *codebuf, unsigned cond, unsigned mask)
-{
-  return out_16(codebuf, T_IT(cond, mask));
-}
-
-void t2_bug_align(CodeBuf *codebuf)
-{
-  unsigned pc = (unsigned)&codebuf->codebuf[codebuf->idx];
-  if ((pc & 0xffe) != 0xffe) return;
-  mov_reg(codebuf, ARM_R0, ARM_R0);
-}
-
-void t2_bug_fix(CodeBuf *codebuf, int offset)
-{
-  unsigned pc = (unsigned)&codebuf->codebuf[codebuf->idx];
-  if ((pc & 0xffe) != 0xffe) return;
-  if (offset >= 0 || offset < -(4096+4)) return;
-  mov_reg(codebuf, ARM_R0, ARM_R0);
-}
-
-int branch_uncond(CodeBuf *codebuf, unsigned dest)
-{
-  unsigned loc = (codebuf->idx * 2) + 4;
-  int offset;
-  unsigned uoff;
-
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest - loc;
-  if (offset >= -(1<<10) && offset < (1<<10)) {
-    uoff = offset;
-    return out_16(codebuf, T_B(uoff));
-  }
-  t2_bug_fix(codebuf, offset);
-  if (offset >= -(1<<23) && offset < (1<<23)) {
-    uoff = offset;
-    return out_16x2(codebuf, T_BW(uoff));
-  }
-  J_Unimplemented();
-}
-
-int branch_uncond_patch(CodeBuf *codebuf, unsigned loc, unsigned dest)
-{
-  int offset;
-  unsigned uoff;
-  unsigned oldidx;
-  int rc;
-
-  oldidx = codebuf->idx;
-  codebuf->idx = loc >> 1;
-  loc += 4;
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest - loc;
-  t2_bug_fix(codebuf, offset);
-  if (offset >= -(1<<23) && offset < (1<<23)) {
-    uoff = offset & ((1<<24)-1);
-    rc = out_16x2(codebuf, T_BW(uoff));
-    codebuf->idx = oldidx;
-    return rc;
-  }
-  J_Unimplemented();
-}
-
-int branch_narrow_patch(CodeBuf *codebuf, unsigned loc)
-{
-  int offset;
-  unsigned uoff;
-  unsigned oldidx;
-  unsigned dest;
-  int rc;
-
-  dest = codebuf->idx * 2;
-  oldidx = codebuf->idx;
-  codebuf->idx = loc >> 1;
-  loc += 4;
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest - loc;
-  if (offset >= -(1<<10) && offset < (1<<10)) {
-    uoff = offset & ((1<<11)-1);
-    rc = out_16(codebuf, T_B(uoff));
-    codebuf->idx = oldidx;
-    return rc;
-  }
-  J_Unimplemented();
-}
-
-int branch(CodeBuf *codebuf, unsigned cond, unsigned dest)
-{
-  unsigned loc = (codebuf->idx * 2) + 4;
-  int offset;
-  unsigned uoff;
-
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest - loc;
-  if (offset >= -(1<<7) && offset < (1<<7)) {
-    uoff = offset;
-    return out_16(codebuf, T_BCC(cond, uoff));
-  }
-  t2_bug_fix(codebuf, offset);
-  if (offset >= -(1<<19) && offset < (1<<19)) {
-    uoff = offset;
-    return out_16x2(codebuf, T_BCCW(cond, uoff));
-  }
-  J_Unimplemented();
-}
-
-int bcc_patch(CodeBuf *codebuf, unsigned cond, unsigned loc)
-{
-  int offset;
-  unsigned uoff;
-  unsigned oldidx;
-  unsigned dest;
-  int rc;
-
-  dest = codebuf->idx * 2;
-  oldidx = codebuf->idx;
-  codebuf->idx = loc >> 1;
-  loc += 4;
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest-loc;
-  if (offset >= -(1<<7) && offset < (1<<7)) {
-    uoff = offset;
-    rc = out_16(codebuf, T_BCC(cond, uoff));
-    codebuf->idx = oldidx;
-    return rc;
-  }
-  J_Unimplemented();
-}
-
-int bl(CodeBuf *codebuf, unsigned dest)
-{
-  unsigned loc = (unsigned)&codebuf->codebuf[codebuf->idx] + 4;
-  int offset;
-  unsigned uoff;
-
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest - loc;
-  t2_bug_fix(codebuf, offset);
-  if (offset >= -(1<<23) && offset < (1<<23)) {
-    uoff = offset;
-    return out_16x2(codebuf, T_BL(uoff));
-  }
-  J_Unimplemented();
-}
-
-int blx(CodeBuf *codebuf, unsigned dest)
-{
-  unsigned loc = (unsigned)&codebuf->codebuf[codebuf->idx] + 4;
-  int offset;
-  unsigned uoff;
-
-  JASSERT((dest & 3) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  loc &= ~1;
-  offset = dest - loc;
-  t2_bug_fix(codebuf, offset);
-  if (offset >= -(1<<23) && offset < (1<<23)) {
-    uoff = offset;
-    return out_16x2(codebuf, T_BLX(uoff));
-  }
-  J_Unimplemented();
-}
-
-int branch_patch(CodeBuf *codebuf, unsigned cond, unsigned loc, unsigned dest)
-{
-  int offset;
-  unsigned uoff;
-  unsigned oldidx;
-  int rc;
-
-  oldidx = codebuf->idx;
-  codebuf->idx = loc >> 1;
-  loc += 4;
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest - loc;
-  t2_bug_fix(codebuf, offset);
-  if (offset >= -(1<<19) && offset < (1<<19)) {
-    uoff = offset & ((1<<20)-1);
-    rc = out_16x2(codebuf, T_BCCW(cond, uoff));
-    codebuf->idx = oldidx;
-    return rc;
-  }
-  J_Unimplemented();
-}
-
-int blx_reg(CodeBuf *codebuf, Reg r)
-{
-  return out_16(codebuf, T_BLX_REG(r));
-}
-
-int cbz_patch(CodeBuf *codebuf, Reg r, unsigned loc)
-{
-  unsigned offset;
-  unsigned oldidx;
-  unsigned dest;
-  int rc;
-
-  dest = codebuf->idx * 2;
-  oldidx = codebuf->idx;
-  codebuf->idx = loc >> 1;
-  loc += 4;
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest-loc;
-  if (r < ARM_R8 && offset < 64) {
-    rc = out_16(codebuf, T_CBZ(r, offset));
-    codebuf->idx = oldidx;
-    return rc;
-  }
-  J_Unimplemented();
-}
-
-int cbnz_patch(CodeBuf *codebuf, Reg r, unsigned loc)
-{
-  unsigned offset;
-  unsigned oldidx;
-  unsigned dest;
-  int rc;
-
-  dest = codebuf->idx * 2;
-  oldidx = codebuf->idx;
-  codebuf->idx = loc >> 1;
-  loc += 4;
-  JASSERT((dest & 1) == 0 && (loc & 1) == 0, "unaligned code");
-  dest >>= 1;
-  loc >>= 1;
-  offset = dest-loc;
-  if (r < ARM_R8 && offset < 64) {
-    rc = out_16(codebuf, T_CBNZ(r, offset));
-    codebuf->idx = oldidx;
-    return rc;
-  }
-  J_Unimplemented();
-}
-
-int chka(CodeBuf *codebuf, u32 size, u32 idx)
-{
-  cmp_reg(codebuf, idx, size);
-  it(codebuf, COND_CS, IT_MASK_T);
-  bl(codebuf, handlers[H_ARRAYBOUND]);
-}
-
-//-----------------------------------------------------------------------------------
-
-void Thumb2_Push_Multiple(CodeBuf *codebuf, Reg *regs, unsigned nregs)
-{
-  unsigned regset = 0;
-  unsigned regmask;
-  unsigned i;
-  Reg r;
-
-  JASSERT(nregs > 0, "nregs must be > 0");
-  if (nregs == 1) {
-    str_imm(codebuf, regs[0], Rstack, -4, 1, 1);
-    return;
-  }
-  for (i = 0; i < nregs; i++) {
-    r = regs[i];
-    if (!IS_ARM_INT_REG(r)) J_Unimplemented();
-    regmask = 1<<r;
-    if (regset != 0 && regmask >= (regset & -regset)) {
-      stm(codebuf, regset, Rstack, PUSH_FD, 1);
-      regset = 0;
-    }
-    regset |= regmask;
-  }
-  stm(codebuf, regset, Rstack, PUSH_FD, 1);
-}
-
-void Thumb2_Pop_Multiple(CodeBuf *codebuf, Reg *regs, unsigned nregs)
-{
-  unsigned regset = 0;
-  unsigned regmask;
-  unsigned i;
-  Reg r;
-
-  JASSERT(nregs > 0, "nregs must be > 0");
-  if (nregs == 1) {
-    ldr_imm(codebuf, regs[0], Rstack, 4, 0, 1);
-    return;
-  }
-  i = nregs;
-  do {
-    i--;
-    r = regs[i];
-    if (!IS_ARM_INT_REG(r)) J_Unimplemented();
-    regmask = 1<<r;
-    if (regmask <= (regset & -regset)) {
-      ldm(codebuf, regset, Rstack, POP_FD, 1);
-      regset = 0;
-    }
-    regset |= regmask;
-  } while (i > 0);
-  ldm(codebuf, regset, Rstack, POP_FD, 1);
-}
-
-#if 0
-int load_multiple(CodeBuf *codebuf, Reg base, Reg *regs, u32 nregs, u32 st, u32 wb)
-{
-  unsigned regset = 0;
-  unsigned regmask;
-  unsigned pre = 0;
-  int dir = 1;
-  unsigned u;
-  Reg r;
-
-  if (st == IB || st == DB) pre = 4;
-  if (st == DA || st == DB) dir = -4;
-  JASSERT(nregs > 0, "nregs must be > 0");
-  if (nregs == 1)
-    return ldr_imm(codebuf, regs[0], base, dir, pre, wb);
-  if (dir > 0) {
-    u = 0;
-    do {
-      r = regs[u];
-      regmask = 1<<r;
-      if (regset != 0 && regmask >= regset) {
-	if (!wb && base != ARM_IP) {
-	  mov_reg(codebuf, ARM_IP, base);
-	  base = ARM_IP;
-	}
-	ldm(codebuf, regset, base, st, 1);
-	regset = 0;
-      }
-      regset |= regmask;
-    } while (++u < nregs);
-    ldm(codebuf, regset, base, st, wb);
-  } else {
-    u = nregs;
-    do {
-      u--;
-      r = regs[u];
-      regmask = 1<<r;
-      if (regmask <= (regset & -regset)) {
-	if (!wb && base != ARM_IP) {
-	  mov_reg(codebuf, ARM_IP, base);
-	  base = ARM_IP;
-	}
-	ldm(codebuf, regset, base, st, 1);
-	regset = 0;
-      }
-      regset |= regmask;
-    } while (u > 0);
-    ldm(codebuf, regset, base, st, wb);
-  }
-}
-#endif
-
-int mov_multiple(CodeBuf *codebuf, Reg *dst, Reg *src, unsigned nregs)
-{
-  unsigned u, n, p;
-  unsigned smask = 0;
-  unsigned dmask = 0;
-  unsigned free_mask, free_reg;
-
-  for (u = 0, n = 0; u < nregs; u++) {
-    JASSERT(dst[u] != ARM_IP, "mov_multiple cannot be used for ARM_IP");
-    JASSERT(src[u] != ARM_IP, "mov_multiple cannot be used for ARM_IP");
-    if (dst[u] != src[u]) {
-      dst[n] = dst[u];
-      src[n++] = src[u];
-    }
-  }
-  while (n) {
-    // Find a reg which is in the dst reg set but not the src reg set
-    smask = 0;
-    dmask = 0;
-    for (u = 0; u < n; u++) {
-      smask |= (1 << src[u]);
-      dmask |= (1 << dst[u]);
-    }
-    free_mask = dmask & ~smask;
-    if (!free_mask) {
-      // No such reg => must use IP
-      Reg r = dst[0];
-      mov_reg(codebuf, ARM_IP, r);
-      for (u = 0; u < n; u++) {
-	if (src[u] == r) src[u] = ARM_IP;
-      }
-      smask ^= (1<<r) | (1<<ARM_IP);
-      free_mask = dmask & ~smask;
-      JASSERT(free_mask, "still no free reg after using ARM_IP?");
-    }
-    free_reg = LOG2(free_mask);
-    for (u = 0, p = 0; u < n; u++) {
-      if (dst[u] == free_reg) {
-	mov_reg(codebuf, dst[u], src[u]);
-      } else {
-	dst[p] = dst[u];
-	src[p++] = src[u];
-      }
-    }
-    n--;
-  }
-  return 0;
-}
-
-#define TOS(jstack)	((jstack)->stack[(jstack)->depth-1])
-#define TOSM1(jstack)	((jstack)->stack[(jstack)->depth-2])
-#define TOSM2(jstack)	((jstack)->stack[(jstack)->depth-3])
-#define TOSM3(jstack)	((jstack)->stack[(jstack)->depth-4])
-
-#define POP(jstack)		((jstack)->stack[--(jstack)->depth])
-#define PUSH(jstack, r)		((jstack)->stack[(jstack)->depth++] = (r))
-#define SWAP(jstack) do { \
-		      Reg r = (jstack)->stack[(jstack)->depth-1]; \
-		      (jstack)->stack[(jstack)->depth-1] = (jstack)->stack[(jstack)->depth-2]; \
-		      (jstack)->stack[(jstack)->depth-2] = r; \
-		    } while (0)
-
-#define JSTACK_REG(jstack)		jstack_reg(jstack)
-#define JSTACK_PREFER(jstack, prefer)	jstack_prefer(jstack, prefer)
-
-static const unsigned last_clear_bit[] = {
-	3,	//	0000
-	3,	//	0001
-	3,	//	0010
-	3,	//	0011
-	3,	//	0100
-	3,	//	0101
-	3,	//	0110
-	3,	//	0111
-	2,	//	1000
-	2,	//	1001
-	2,	//	1010
-	2,	//	1011
-	1,	//	1100
-	1,	//	1101
-	0,	//	1110
-	0,	//	1111
-};
-
-#define LAST_CLEAR_BIT(mask) last_clear_bit[mask]
-
-unsigned jstack_reg(Thumb2_Stack *jstack)
-{
-  unsigned *stack = jstack->stack;
-  unsigned depth = jstack->depth;
-  unsigned mask = 0;
-  unsigned r;
-  unsigned i;
-
-  for (i = 0; i < depth; i++) mask |= 1 << stack[i];
-  mask &= (1 << STACK_REGS) - 1;
-  JASSERT(mask != (1 << STACK_REGS) - 1, "No free reg in push");
-  r = LAST_CLEAR_BIT(mask);
-  return r;
-}
-
-unsigned jstack_prefer(Thumb2_Stack *jstack, Reg prefer)
-{
-  unsigned *stack = jstack->stack;
-  unsigned depth = jstack->depth;
-  unsigned mask = 0;
-  unsigned r;
-  unsigned i;
-
-  for (i = 0; i < depth; i++) mask |= 1 << stack[i];
-  mask &= (1 << STACK_REGS) - 1;
-  if ((prefer & ~mask) & 0x0f) mask |= (~prefer & ((1 << STACK_REGS) - 1));
-  JASSERT(mask != (1 << STACK_REGS) - 1, "No free reg in push");
-  r = LAST_CLEAR_BIT(mask);
-  return r;
-}
-
-void Thumb2_Fill(Thumb2_Info *jinfo, unsigned required)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned *stack = jstack->stack;
-  unsigned depth = jstack->depth;
-  unsigned mask = 0;
-  unsigned tofill;
-  unsigned r, i;
-
-  if (depth >= required) return;
-  tofill = required - depth;
-  for (i = depth; i > 0;) {
-    i--;
-    mask |= 1 << stack[i];
-    stack[i+tofill] = stack[i];
-  }
-  mask &= (1 << STACK_REGS) - 1;
-  for (i = 0; i < tofill; i++) {
-    JASSERT(mask != (1 << STACK_REGS) - 1, "Fill failed!!!");
-    r = LAST_CLEAR_BIT(mask);
-    mask |= (1 << r);
-    stack[i] = r;
-  }
-  jstack->depth = depth + tofill;
-  Thumb2_Pop_Multiple(jinfo->codebuf, stack, tofill);
-}
-
-static const unsigned bitcount[] = {
-	0,	// 0000
-	1,	// 0001
-	1,	// 0010
-	2,	// 0011
-	1,	// 0100
-	2,	// 0101
-	2,	// 0110
-	3,	// 0111
-	1,	// 1000
-	2,	// 1001
-	2,	// 1010
-	3,	// 1011
-	2,	// 1100
-	3,	// 1101
-	3,	// 1110
-	4,	// 1111
-};
-
-#define BITCOUNT(mask) bitcount[mask]
-
-// Thumb2_Spill:-
-// 	required - ensure that at least this many registers are available
-// 	exclude - bitmask, do not count these registers as available
-//
-// 	The no. of available regs (STACK_REGS) less the no. of registers in
-// 	exclude must be >= the number required, otherwise this function loops!
-//
-// 	Typical usage is
-//
-// 	Thumb2_Spill(jinfo, 2, 0);	// get 2 free regs
-// 	r_res_lo = PUSH(jinfo->jstack, JSTACK_REG(jinfo->jstack));
-// 	r_res_hi = PUSH(jinfo->jstack, JSTACK_REG(jinfo->jstack));
-//
-//	Use the exclude mask when you do not want a subsequent call to
-//	JSTACK_REG to return a particular register or registers. This can
-//	be useful, for example, with long (64) bit operations. Eg. In the
-//	following we use it to ensure that the hi inputs are not clobbered
-//	by the lo result as part of the intermediate calculation.
-//
-//	Thumb2_Fill(jinfo, 4);
-//	exclude = (1<<rho_hi)|(1<<lho_hi);
-//	rho_lo = POP(jstack);
-//	rho_hi = POP(jstack);
-//	lho_lo = POP(jstack);
-//	lho_hi = POP(jstack);
-//	Thumb2_Spill(jinfo, 2, exclude);
-//	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~exclude));	// != rho_hi or lho_hi
-//	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~exclude));	// != rho_hi or lho_hi
-//	dop_reg(jinfo->codebuf, DP_ADD, res_lo, lho_lo, rho_lo, SHIFT_LSL, 0); 
-//	dop_reg(jinfo->codebuf, DP_ADC, res_hi, lho_hi, rho_hi, SHIFT_LSL, 0);
-//	
-void Thumb2_Spill(Thumb2_Info *jinfo, unsigned required, unsigned exclude)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned *stack = jstack->stack;
-  unsigned depth = jstack->depth;
-  unsigned mask;
-  unsigned i;
-  unsigned tospill = 0;
-
-  exclude &= (1 << STACK_REGS) - 1;
-  if (depth <= (STACK_REGS - required) && exclude == 0) return;
-  while (1) {
-    mask = 0;
-    for (i = tospill; i < depth; i++) mask |= 1 << stack[i];
-    mask &= ((1 << STACK_REGS) - 1);
-    mask |= exclude;
-    if (STACK_REGS - BITCOUNT(mask) >= required) break;
-    tospill++;
-  }
-  if (tospill == 0) return;
-  Thumb2_Push_Multiple(jinfo->codebuf, stack, tospill);
-  for (i = tospill; i < depth; i++)
-    stack[i-tospill] = stack[i];
-  jstack->depth = depth - tospill;
-  JASSERT((int)jstack->depth >= 0, "Stack underflow");
-}
-
-// Thumb2_Tmp:-
-// 	Allocate a temp reg for use in local code generation.
-// 	exclude is a bit mask of regs not to use.
-// 	A max of 2 regs can be guaranteed (ARM_IP & ARM_LR)
-// 	If allocating 2 regs you must include the reg you got the
-// 	first time in the exclude list. Otherwise you just get
-// 	the same reg again.
-Reg Thumb2_Tmp(Thumb2_Info *jinfo, unsigned exclude)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned *stack = jstack->stack;
-  unsigned depth = jstack->depth;
-  unsigned mask;
-  unsigned i;
-
-  mask = 0;
-  for (i = 0; i < depth; i++) mask |= 1 << stack[i];
-  mask |= exclude;
-  for (i = 0; i < STACK_REGS; i++)
-    if ((mask & (1<<i)) == 0) return i;
-  if ((mask & (1<<ARM_IP)) == 0) return ARM_IP;
-  if ((mask & (1<<ARM_LR)) == 0) return ARM_LR;
-  JASSERT(0, "failed to allocate a tmp reg");
-}
-
-void Thumb2_Flush(Thumb2_Info *jinfo)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-
-  if (jstack->depth > 0)
-    Thumb2_Push_Multiple(jinfo->codebuf, jstack->stack, jstack->depth);
-  jstack->depth = 0;
-}
-
-// Call this when we are about to corrupt a local
-// The local may already be on the stack
-// For example
-// 	iload	0
-// 	iconst	2
-// 	istore	0
-// 	istore	1
-// Without this check the code generated would be (r4 is local 0, r5 is local 1)
-// 	mov	r4, #2
-//	mov	r5, r4
-// With this check the code should be
-// 	mov	r3, r4
-// 	mov	r4, #2
-// 	mov	r5, r3
-// This is not ideal, but is better than the previous:-)
-//
-void Thumb2_Corrupt(Thumb2_Info *jinfo, unsigned r, unsigned ignore)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned *stack = jstack->stack;
-  unsigned depth = jstack->depth;
-  unsigned r_new, mask;
-  unsigned i;
-
-  if (ignore >= depth) return;
-//  JASSERT(depth >= ignore, "Cant ignore more than the whole stack!!");
-  if (IS_SREG(r)) return;
-  depth -= ignore;
-  for (i = 0; i < depth; i++) {
-    if (r == stack[i]) {
-      Thumb2_Spill(jinfo, 1, 0);
-      depth = jstack->depth - ignore;
-      r_new = JSTACK_REG(jstack);
-      mov_reg(jinfo->codebuf, r_new, r);
-      for (i = 0; i < depth; i++) if (r == stack[i]) stack[i] = r_new;
-      break;
-    }
-  }
-}
-
-unsigned Thumb2_ResultLocal(Thumb2_Info *jinfo, unsigned bci)
-{
-  unsigned opc = jinfo->code_base[bci];
-  if (jinfo->bc_stackinfo[bci] & BC_BRANCH_TARGET) return 0;
-  if (opc < opc_istore || opc > opc_astore_3) return 0;
-  if (opc == opc_istore || opc == opc_fstore || opc == opc_astore)
-    return jinfo->jregs->r_local[jinfo->code_base[bci+1]];
-  if ((opc >= opc_istore_0 && opc <= opc_istore_3) ||
-	(opc >= opc_fstore_0 && opc <= opc_fstore_3) ||
-	(opc >= opc_astore_0 && opc <= opc_astore_3))
-    return jinfo->jregs->r_local[(opc-opc_istore_0)&3];
-  return 0;
-}
-
-static const unsigned char dOps[] = {
-	DP_ADD, DP_ADC, VP_ADD, VP_ADD,
-	DP_SUB, DP_SBC, VP_SUB, VP_SUB,
-	DP_MUL, 0, VP_MUL, VP_MUL,
-	0, 0, VP_DIV, VP_DIV,
-	0, 0, 0, 0,
-	0, 0, 0, 0,
-	DP_LSL, 0,
-	DP_ASR, 0,
-	DP_LSR, 0,
-	DP_AND, DP_AND, DP_ORR, DP_ORR, DP_EOR, DP_EOR,
-};
-
-unsigned Thumb2_Imm(Thumb2_Info *jinfo, unsigned imm, unsigned next_bci)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r;
-  unsigned next_op;
-
-  if (!(jinfo->bc_stackinfo[next_bci] & BC_BRANCH_TARGET)) {
-    next_op = jinfo->code_base[next_bci];
-    if (next_op > OPC_LAST_JAVA_OP) {
-      if (Bytecodes::is_defined((Bytecodes::Code)next_op))
-	next_op = (unsigned)Bytecodes::java_code((Bytecodes::Code)next_op);
-    }
-    switch (next_op) {
-      case opc_istore:
-      case opc_fstore:
-      case opc_astore: {
-	unsigned local = jinfo->code_base[next_bci+1];
-	r = jinfo->jregs->r_local[local];
-	if (r) {
-	  Thumb2_Corrupt(jinfo, r, 0);
-	  mov_imm(jinfo->codebuf, r, imm);
-	  return 2;
-	}
-	break;
-      }
-      case opc_istore_0:
-      case opc_istore_1:
-      case opc_istore_2:
-      case opc_istore_3:
-      case opc_fstore_0:
-      case opc_fstore_1:
-      case opc_fstore_2:
-      case opc_fstore_3:
-      case opc_astore_0:
-      case opc_astore_1:
-      case opc_astore_2:
-      case opc_astore_3: {
-	unsigned local = (jinfo->code_base[next_bci]-opc_istore_0) & 3;
-	r = jinfo->jregs->r_local[local];
-	if (r) {
-	  Thumb2_Corrupt(jinfo, r, 0);
-	  mov_imm(jinfo->codebuf, r, imm);
-	  return 1;
-	}
-	break;
-      }
-      case opc_iadd:
-      case opc_isub:
-      case opc_ishl:
-      case opc_ishr:
-      case opc_iushr:
-      case opc_iand:
-      case opc_ior:
-      case opc_ixor: {
-	unsigned len = 0;
-	unsigned r_lho;
-
-	Thumb2_Fill(jinfo, 1);
-	r_lho = POP(jstack);
-
-	r = Thumb2_ResultLocal(jinfo, next_bci+1);
-	if (r) {
-	  Thumb2_Corrupt(jinfo, r, 0);
-	  len = Bytecodes::length_for((Bytecodes::Code)jinfo->code_base[next_bci+1]);
-	} else {
-	  Thumb2_Spill(jinfo, 1, 0);
-	  r = JSTACK_REG(jstack);
-	  PUSH(jstack, r);
-	}
-	if (next_op == opc_ishl || next_op == opc_ishr || next_op == opc_iushr)
-	  shift_imm(jinfo->codebuf, dOps[next_op-opc_iadd], r, r_lho, imm);
-	else
-	  dop_imm(jinfo->codebuf, dOps[next_op-opc_iadd], r, r_lho, imm);
-	return 1+len;
-      }
-
-      case opc_idiv: {
-	unsigned len = 0;
-	unsigned r_lho;
-	unsigned abs_imm = abs((int)imm);
-
-	if ((imm & -imm) == abs_imm) {
-	  unsigned l2_imm = LOG2(abs_imm);
-	  unsigned r_lho;
-
-	  if (imm == 0) break;
-	  if (imm == 1) return 1;
-
-	  Thumb2_Fill(jinfo, 1);
-	  r_lho = POP(jstack);
-
-	  r = Thumb2_ResultLocal(jinfo, next_bci+1);
-	  if (r) {
-	    Thumb2_Corrupt(jinfo, r, 0);
-	    len = Bytecodes::length_for((Bytecodes::Code)jinfo->code_base[next_bci+1]);
-	  } else {
-	    Thumb2_Spill(jinfo, 1, 0);
-	    r = JSTACK_REG(jstack);
-	    PUSH(jstack, r);
-	  }
-
-	  if (abs_imm != 1) {
-	    unsigned r_tmp = r_lho;
-	    if (abs_imm != 2) {
-	      r_tmp = Thumb2_Tmp(jinfo, (1<<r_lho));
-	      asr_imm(jinfo->codebuf, r_tmp, r_lho, 31);
-	    }
-	    add_reg_shift(jinfo->codebuf, r, r_lho, r_tmp, SHIFT_LSR, 32-l2_imm);
-	    asr_imm(jinfo->codebuf, r, r, l2_imm);
-	  }
-	  if ((int)imm < 0)
-	    rsb_imm(jinfo->codebuf, r, r, 0);
-	  return 1+len;
-	}
-	break;
-      }
-    }
-  }
-  Thumb2_Spill(jinfo, 1, 0);
-  r = JSTACK_REG(jstack);
-  PUSH(jstack, r);
-  mov_imm(jinfo->codebuf, r, imm);
-  return 0;
-}
-
-void Thumb2_ImmX2(Thumb2_Info *jinfo, unsigned lo, unsigned hi)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lo, r_hi;
-
-  Thumb2_Spill(jinfo, 2, 0);
-  r_hi = PUSH(jstack, JSTACK_REG(jstack));
-  r_lo = PUSH(jstack, JSTACK_REG(jstack));
-  mov_imm(jinfo->codebuf, r_lo, lo);
-  mov_imm(jinfo->codebuf, r_hi, hi);
-}
-
-#define LOCAL_OFFSET(local, stackdepth, nlocals) ((stackdepth)*4 + FRAME_SIZE + ((nlocals)-1-(local))*4)
-
-void load_local(Thumb2_Info *jinfo, Reg r, unsigned local, unsigned stackdepth)
-{
-#ifdef USE_RLOCAL
-  ldr_imm(jinfo->codebuf, r, Rlocals, -local * 4, 1, 0);
-#else
-  int nlocals = jinfo->method->max_locals();
-  ldr_imm(jinfo->codebuf, r, Rstack, LOCAL_OFFSET(local, stackdepth, nlocals), 1, 0);
-#endif
-}
-
-void store_local(Thumb2_Info *jinfo, Reg r, unsigned local, unsigned stackdepth)
-{
-#ifdef USE_RLOCAL
-  str_imm(jinfo->codebuf, r, Rlocals, -local << 2, 1, 0);
-#else
-  int nlocals = jinfo->method->max_locals();
-  str_imm(jinfo->codebuf, r, Rstack, LOCAL_OFFSET(local, stackdepth, nlocals), 1, 0);
-#endif
-}
-
-void Thumb2_Load(Thumb2_Info *jinfo, int local, unsigned stackdepth)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r;
-
-  r = jinfo->jregs->r_local[local];
-  if (r) {
-    PUSH(jstack, r);
-  } else {
-    int nlocals = jinfo->method->max_locals();
-
-    Thumb2_Spill(jinfo, 1, 0);
-    JASSERT(stackdepth >= jstack->depth, "negative stack offset?");
-    stackdepth -= jstack->depth;
-    if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-    r = JSTACK_REG(jstack);
-    PUSH(jstack, r);
-    load_local(jinfo, r, local, stackdepth);
-  }
-}
-
-void Thumb2_LoadX2(Thumb2_Info *jinfo, int local, unsigned stackdepth)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lo, r_hi;
-  int nlocals = jinfo->method->max_locals();
-
-  r_hi = jinfo->jregs->r_local[local];
-  if (r_hi) {
-    r_lo = jinfo->jregs->r_local[local+1];
-    if (r_lo) {
-      PUSH(jstack, r_hi);
-      PUSH(jstack, r_lo);
-    } else {
-      Thumb2_Spill(jinfo, 1, 0);
-      stackdepth -= jstack->depth;
-      if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-      PUSH(jstack, r_hi);
-      r_lo = PUSH(jstack, JSTACK_REG(jstack));
-      load_local(jinfo, r_lo, local+1, stackdepth);
-    }
-  } else {
-    r_lo = jinfo->jregs->r_local[local+1];
-    if (r_lo) {
-      Thumb2_Spill(jinfo, 1, 0);
-      stackdepth -= jstack->depth;
-      if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-      r_hi = PUSH(jstack, JSTACK_REG(jstack));
-      load_local(jinfo, r_hi, local, stackdepth);
-      PUSH(jstack, r_lo);
-    } else {
-      Thumb2_Spill(jinfo, 2, 0);
-      stackdepth -= jstack->depth;
-      if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-      r_hi = PUSH(jstack, JSTACK_REG(jstack));
-      r_lo = PUSH(jstack, JSTACK_REG(jstack));
-      load_local(jinfo, r_hi, local, stackdepth);
-      load_local(jinfo, r_lo, local+1, stackdepth);
-    }
-  }
-}
-
-void Thumb2_Store(Thumb2_Info *jinfo, int local, unsigned stackdepth)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r, r_local;
-  int nlocals = jinfo->method->max_locals();
-
-  Thumb2_Fill(jinfo, 1);
-  stackdepth -= jstack->depth;
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  r = POP(jstack);
-  r_local = jinfo->jregs->r_local[local];
-  if (r_local) {
-    Thumb2_Corrupt(jinfo, r_local, 0);
-    mov_reg(jinfo->codebuf, r_local, r);
-  } else {
-    store_local(jinfo, r, local, stackdepth);
-  }
-}
-
-void Thumb2_StoreX2(Thumb2_Info *jinfo, int local, unsigned stackdepth)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lo, r_hi;
-  unsigned r_local_lo, r_local_hi;
-  int nlocals = jinfo->method->max_locals();
-
-  Thumb2_Fill(jinfo, 2);
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  r_lo = POP(jstack);
-  r_hi = POP(jstack);
-  stackdepth -= 2;
-
-  r_local_hi = jinfo->jregs->r_local[local];
-  if (r_local_hi) {
-    Thumb2_Corrupt(jinfo, r_local_hi, 0);
-    mov_reg(jinfo->codebuf, r_local_hi, r_hi);
-  } else {
-    store_local(jinfo, r_hi, local, stackdepth-jstack->depth);
-  }
-
-  r_local_lo = jinfo->jregs->r_local[local+1];
-  if (r_local_lo) {
-    Thumb2_Corrupt(jinfo, r_local_lo, 0);
-    mov_reg(jinfo->codebuf, r_local_lo, r_lo);
-  } else {
-    store_local(jinfo, r_lo, local+1, stackdepth-jstack->depth);
-  }
-}
-
-void Thumb2_Xaload(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_index, r_array, r_value;
-  unsigned op = opc - (unsigned)opc_iaload;
-  unsigned r_tmp;
-
-  Thumb2_Fill(jinfo, 2);
-  r_index = POP(jstack);
-  r_array = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index));
-  r_value = JSTACK_REG(jstack);
-  PUSH(jstack, r_value);
-  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
-  chka(jinfo->codebuf, r_tmp, r_index);
-  if (opc == opc_baload) {
-    add_reg(jinfo->codebuf, r_tmp, r_array, r_index);
-    ldrsb_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  } else if (opc == opc_caload) {
-    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 1);
-    ldrh_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  } else if (opc == opc_saload) {
-    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 1);
-    ldrsh_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  } else {
-    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 2);
-    ldr_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  }
-}
-
-void Thumb2_X2aload(Thumb2_Info *jinfo)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_index, r_array, r_lo, r_hi;
-  unsigned r_tmp;
-
-  Thumb2_Fill(jinfo, 2);
-  r_index = POP(jstack);
-  r_array = POP(jstack);
-  Thumb2_Spill(jinfo, 2, 0);
-  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index));
-  r_hi = PUSH(jstack, JSTACK_REG(jstack));
-  r_lo = PUSH(jstack, JSTACK_REG(jstack));
-  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
-  chka(jinfo->codebuf, r_tmp, r_index);
-  add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 3);
-  ldrd_imm(jinfo->codebuf, r_lo, r_hi, r_tmp, 16, 1, 0);
-}
-
-void Thumb2_Xastore(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_value, r_index, r_array;
-  unsigned op = opc - (unsigned)opc_iastore;
-  unsigned r_tmp;
-
-  Thumb2_Fill(jinfo, 3);
-  r_value = POP(jstack);
-  r_index = POP(jstack);
-  r_array = POP(jstack);
-  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index)|(1<<r_value));
-  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
-  chka(jinfo->codebuf, r_tmp, r_index);
-  if (opc == opc_bastore) {
-    add_reg(jinfo->codebuf, r_tmp, r_array, r_index);
-    strb_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  } else if (opc == opc_castore || opc == opc_sastore) {
-    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 1);
-    strh_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  } else {
-    add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 2);
-    str_imm(jinfo->codebuf, r_value, r_tmp, 12, 1, 0);
-  }
-}
-
-void Thumb2_X2astore(Thumb2_Info *jinfo)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lo, r_hi, r_index, r_array;
-  unsigned r_tmp;
-
-  Thumb2_Fill(jinfo, 4);
-  r_lo = POP(jstack);
-  r_hi = POP(jstack);
-  r_index = POP(jstack);
-  r_array = POP(jstack);
-  r_tmp = Thumb2_Tmp(jinfo, (1<<r_array)|(1<<r_index)|(1<<r_lo)|(1<<r_hi));
-  ldr_imm(jinfo->codebuf, r_tmp, r_array, 8, 1, 0);
-  chka(jinfo->codebuf, r_tmp, r_index);
-  add_reg_shift(jinfo->codebuf, r_tmp, r_array, r_index, SHIFT_LSL, 3);
-  strd_imm(jinfo->codebuf, r_lo, r_hi, r_tmp, 16, 1, 0);
-}
-
-void Thumb2_Pop(Thumb2_Info *jinfo, unsigned n)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-
-  while (n > 0 && jstack->depth > 0) {
-    POP(jstack);
-    n--;
-  }
-  if (n > 0) add_imm(jinfo->codebuf, Rstack, Rstack, n * 4);
-}
-
-void Thumb2_Dup(Thumb2_Info *jinfo, unsigned n)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned *stack = jstack->stack;
-  unsigned depth;
-  unsigned i;
-
-  Thumb2_Fill(jinfo, n+1);
-  depth = jstack->depth;
-  for (i = 0; i <= n; i++)
-    stack[depth-i] = stack[depth-i-1];
-  stack[depth-n-1] = stack[depth];
-  jstack->depth = depth + 1;
-}
-
-void Thumb2_Dup2(Thumb2_Info *jinfo, unsigned n)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned *stack = jstack->stack;
-  unsigned depth;
-  unsigned i;
-
-  Thumb2_Fill(jinfo, n+2);
-  depth = jstack->depth;
-  for (i = 0; i <= n+1; i++)
-    stack[depth-i+1] = stack[depth-i-1];
-  stack[depth-n-1] = stack[depth+1];
-  stack[depth-n-2] = stack[depth];
-  jstack->depth = depth + 2;
-}
-
-void Thumb2_Swap(Thumb2_Info *jinfo)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-
-  Thumb2_Fill(jinfo, 2);
-  SWAP(jstack);
-}
-
-void Thumb2_iOp(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lho, r_rho, r;
-
-  Thumb2_Fill(jinfo, 2);
-  r_rho = POP(jstack);
-  r_lho = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  r = JSTACK_REG(jstack);
-  PUSH(jstack, r);
-  dop_reg(jinfo->codebuf, dOps[opc-opc_iadd], r, r_lho, r_rho, 0, 0);
-}
-
-void Thumb2_iNeg(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_src, r;
-
-  Thumb2_Fill(jinfo, 1);
-  r_src = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  r = JSTACK_REG(jstack);
-  PUSH(jstack, r);
-  rsb_imm(jinfo->codebuf, r, r_src, 0);
-}
-
-void Thumb2_lNeg(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lo, r_hi, r_res_lo, r_res_hi;
-  unsigned r_tmp;
-
-  Thumb2_Fill(jinfo, 2);
-  r_lo = POP(jstack);
-  r_hi = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  r_res_hi = PUSH(jstack, JSTACK_REG(jstack));
-  Thumb2_Spill(jinfo, 1, (1<<r_hi));
-  r_res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~(1<<r_hi)));
-  JASSERT(r_res_lo != r_res_hi, "oops");
-  JASSERT(r_res_lo != r_hi, "r_res_lo != r_hi");
-  rsb_imm(jinfo->codebuf, r_res_lo, r_lo, 0);
-  r_tmp = Thumb2_Tmp(jinfo, (1<<r_hi)|(1<<r_res_lo));
-  mov_imm(jinfo->codebuf, r_tmp, 0);
-  dop_reg(jinfo->codebuf, DP_SBC, r_res_hi, r_tmp, r_hi, SHIFT_LSL, 0);
-}
-
-void Thumb2_fNeg(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r, r_result;
-
-  Thumb2_Fill(jinfo, 1);
-  r = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  r_result = PUSH(jstack, JSTACK_REG(jstack));
-  eor_imm(jinfo->codebuf, r_result, r, 0x80000000);
-}
-
-void Thumb2_dNeg(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned r_lo, r_hi, r_res_lo, r_res_hi;
-
-  Thumb2_Fill(jinfo, 2);
-  r_lo = POP(jstack);
-  r_hi = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  r_res_hi = PUSH(jstack, JSTACK_REG(jstack));
-  Thumb2_Spill(jinfo, 1, (1<<r_hi));
-  r_res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~(1<<r_hi)));
-  JASSERT(r_res_lo != r_res_hi, "oops");
-  JASSERT(r_res_lo != r_hi, "r_res_lo != r_hi");
-  mov_reg(jinfo->codebuf, r_res_lo, r_lo);
-  eor_imm(jinfo->codebuf, r_res_hi, r_hi, 0x80000000);
-}
-
-void Thumb2_lOp(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned res_lo, res_hi;
-  unsigned lho_lo, lho_hi;
-  unsigned rho_lo, rho_hi;
-
-  Thumb2_Fill(jinfo, 4);
-  rho_lo = POP(jstack);
-  rho_hi = POP(jstack);
-  lho_lo = POP(jstack);
-  lho_hi = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  res_hi = PUSH(jstack, JSTACK_REG(jstack));
-  Thumb2_Spill(jinfo, 1, (1<<lho_hi)|(1<<rho_hi));
-  res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_hi)|(1<<rho_hi))));
-  JASSERT(res_lo != rho_hi && res_lo != lho_hi, "res_lo != rho_hi && res_lo != lho_hi");
-  dop_reg(jinfo->codebuf, dOps[opc-opc_ladd], res_lo, lho_lo, rho_lo, SHIFT_LSL, 0);
-  dop_reg(jinfo->codebuf, dOps[opc-opc_ladd+1], res_hi, lho_hi, rho_hi, SHIFT_LSL, 0);
-}
-
-void Thumb2_lmul(Thumb2_Info *jinfo)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned res_lo, res_hi;
-  unsigned lho_lo, lho_hi;
-  unsigned rho_lo, rho_hi;
-  unsigned r_tmp_lo, r_tmp_hi;
-  unsigned op_mask;
-
-  Thumb2_Fill(jinfo, 4);
-  rho_lo = POP(jstack);
-  rho_hi = POP(jstack);
-  lho_lo = POP(jstack);
-  lho_hi = POP(jstack);
-  op_mask = (1<<rho_lo)|(1<<rho_hi)|(1<<lho_lo)|(1<<lho_hi);
-  Thumb2_Spill(jinfo, 2, 0);
-  res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~op_mask));
-  res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~op_mask));
-  r_tmp_lo = res_lo;
-  r_tmp_hi = res_hi;
-  if (op_mask & (1<<r_tmp_lo)) r_tmp_lo = Thumb2_Tmp(jinfo, op_mask);
-  if (op_mask & (1<<r_tmp_hi)) r_tmp_hi = Thumb2_Tmp(jinfo, op_mask|(1<<r_tmp_lo));
-  umull(jinfo->codebuf, r_tmp_lo, r_tmp_hi, rho_lo, lho_lo);
-  mla(jinfo->codebuf, r_tmp_hi, rho_lo, lho_hi, r_tmp_hi);
-  mla(jinfo->codebuf, res_hi, rho_hi, lho_lo, r_tmp_hi);
-  mov_reg(jinfo->codebuf, res_lo, r_tmp_lo);
-}
-
-void Thumb2_fOp(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned rho, lho, res;
-
-  Thumb2_Fill(jinfo, 2);
-  rho = POP(jstack);
-  lho = POP(jstack);
-  Thumb2_Spill(jinfo, 1, 0);
-  res = PUSH(jstack, JSTACK_REG(jstack));
-  vmov_reg_s_toVFP(jinfo->codebuf, VFP_S0, lho);
-  vmov_reg_s_toVFP(jinfo->codebuf, VFP_S1, rho);
-  vop_reg_s(jinfo->codebuf, dOps[opc-opc_iadd], VFP_S0, VFP_S0, VFP_S1);
-  vmov_reg_s_toARM(jinfo->codebuf, res, VFP_S0);
-}
-
-void Thumb2_dOp(Thumb2_Info *jinfo, u32 opc)
-{
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned rho_lo, rho_hi, lho_lo, lho_hi, res_lo, res_hi;
-
-  Thumb2_Fill(jinfo, 4);
-  rho_lo = POP(jstack);
-  rho_hi = POP(jstack);
-  lho_lo = POP(jstack);
-  lho_hi = POP(jstack);
-  Thumb2_Spill(jinfo, 2, 0);
-  res_hi = PUSH(jstack, JSTACK_REG(jstack));
-  res_lo = PUSH(jstack, JSTACK_REG(jstack));
-  vmov_reg_d_toVFP(jinfo->codebuf, VFP_D0, lho_lo, lho_hi);
-  vmov_reg_d_toVFP(jinfo->codebuf, VFP_D1, rho_lo, rho_hi);
-  vop_reg_d(jinfo->codebuf, dOps[opc-opc_iadd], VFP_D0, VFP_D0, VFP_D1);
-  vmov_reg_d_toARM(jinfo->codebuf, res_lo, res_hi, VFP_D0);
-}
-
-void Thumb2_Handler(Thumb2_Info *jinfo, unsigned handler, unsigned opcode, unsigned bci)
-{
-  mov_imm(jinfo->codebuf, ARM_R0, opcode);
-  mov_imm(jinfo->codebuf, ARM_R1, bci);
-  mov_imm(jinfo->codebuf, ARM_IP, 0);
-  str_imm(jinfo->codebuf, ARM_IP, ARM_IP, 0, 1, 0);
-//  hbl(jinfo->codebuf, handler);
-}
-
-void Thumb2_Debug(Thumb2_Info *jinfo, unsigned handler)
-{
-#if 0
-  Thumb2_Flush(jinfo);
-  bl(jinfo->codebuf, handlers[handler]);
-#endif
-}
-
-void Thumb2_codegen(Thumb2_Info *jinfo, unsigned start);
-
-int Thumb2_Branch(Thumb2_Info *jinfo, unsigned bci, unsigned cond)
-{
-    int offset = GET_JAVA_S2(jinfo->code_base + bci + 1);
-    unsigned dest_taken = bci + offset;
-    unsigned dest_not_taken = bci + 3;
-    unsigned loc;
-
-    if (jinfo->bc_stackinfo[dest_taken] & BC_COMPILED) {
-      branch(jinfo->codebuf, cond, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
-      return dest_not_taken;
-    }
-    loc = forward_32(jinfo->codebuf);
-    Thumb2_codegen(jinfo, dest_not_taken);
-    JASSERT(jinfo->bc_stackinfo[dest_taken] & BC_COMPILED, "dest in branch not compiled!!!");
-    branch_patch(jinfo->codebuf, cond, loc, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
-    return -1;
-}
-
-int Thumb2_Goto(Thumb2_Info *jinfo, unsigned bci, int offset, int len)
-{
-    unsigned dest_taken = bci + offset;
-    unsigned dest_not_taken = bci + len;
-    unsigned loc;
-
-    if (jinfo->bc_stackinfo[dest_taken] & BC_COMPILED) {
-      branch_uncond(jinfo->codebuf, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
-      return dest_not_taken;
-    }
-    loc = forward_32(jinfo->codebuf);
-    Thumb2_codegen(jinfo, dest_not_taken);
-    JASSERT(jinfo->bc_stackinfo[dest_taken] & BC_COMPILED, "dest in goto not compiled!!!");
-    branch_uncond_patch(jinfo->codebuf, loc, jinfo->bc_stackinfo[dest_taken] & ~BC_FLAGS_MASK);
-    return -1;
-}
-
-void Thumb2_Return(Thumb2_Info *jinfo, unsigned opcode)
-{
-  Reg r_lo, r;
-  Thumb2_Stack *jstack = jinfo->jstack;
-
-  if (0 /*jinfo->compiled_return*/) {
-    unsigned bci = jinfo->compiled_return;
-
-    JASSERT(jinfo->bc_stackinfo[bci] & BC_COMPILED, "return not compiled");
-    JASSERT(jinfo->code_base[bci] == opcode, "type of return changed");
-    branch_uncond(jinfo->codebuf, jinfo->bc_stackinfo[bci] & ~BC_FLAGS_MASK);
-    return;
-  }
-
-  if (jinfo->method->is_synchronized()) {
-    unsigned loc_success1, loc_success2, loc_failed, loc_retry, loc_exception;
-    unsigned loc_illegal_monitor_state;
-    Thumb2_Flush(jinfo);
-//    Thumb2_save_locals(jinfo);
-    // Free the monitor
-    //
-    // 		sub	r1, Ristate, #8
-    // 		ldr	r2, [r1, #4]
-    //		cbz	r2, throw_illegal_monitor_state
-    //		ldr	r0, [r1, #0]
-    //		mov	r3, #0
-    //		str	r3, [r1, #4]
-    //		cbz	r0, success
-    //	retry:
-    //		ldrex	r3, [r2, #0]
-    //		cmp	r1, r3
-    //		bne	failed
-    //		strex	r3, r0, [r2, #0]
-    //		cbz	r3, success
-    //		b	retry
-    //	failed:
-    //		str	r2, [r1, #4]
-    //		...
-    //  success:
-    //
-    // JAZ_V1 == tmp2
-    // JAZ_V2 == tmp1
-    sub_imm(jinfo->codebuf, ARM_R1, Ristate, frame::interpreter_frame_monitor_size()*wordSize);
-    ldr_imm(jinfo->codebuf, ARM_R2, ARM_R1, 4, 1, 0);
-    loc_illegal_monitor_state = forward_16(jinfo->codebuf);
-    ldr_imm(jinfo->codebuf, ARM_R0, ARM_R1, 0, 1, 0);
-    mov_imm(jinfo->codebuf, ARM_R3, 0);
-    str_imm(jinfo->codebuf, ARM_R3, ARM_R1, 4, 1, 0);
-    loc_success1 = forward_16(jinfo->codebuf);
-    loc_retry = out_loc(jinfo->codebuf);
-    ldrex_imm(jinfo->codebuf, ARM_R3, ARM_R2, 0);
-    cmp_reg(jinfo->codebuf, ARM_R1, ARM_R3);
-    loc_failed = forward_16(jinfo->codebuf);
-    strex_imm(jinfo->codebuf, ARM_R3, ARM_R0, ARM_R2, 0);
-    loc_success2 = forward_16(jinfo->codebuf);
-    branch_uncond(jinfo->codebuf, loc_retry);
-    bcc_patch(jinfo->codebuf, COND_NE, loc_failed);
-    cbz_patch(jinfo->codebuf, ARM_R2, loc_illegal_monitor_state);
-    str_imm(jinfo->codebuf, ARM_R2, ARM_R1, 4, 1, 0);
-    mov_imm(jinfo->codebuf, ARM_R0, 0+CONSTMETHOD_CODEOFFSET);
-    bl(jinfo->codebuf, handlers[H_SYNCHRONIZED_EXIT]);
-    loc_exception = forward_16(jinfo->codebuf);
-    bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-    cbz_patch(jinfo->codebuf, ARM_R0, loc_exception);
-    cbz_patch(jinfo->codebuf, ARM_R0, loc_success1);
-    cbz_patch(jinfo->codebuf, ARM_R3, loc_success2);
-  }
-
-  if (opcode != opc_return) {
-    if (opcode == opc_lreturn || opcode == opc_dreturn) {
-      Thumb2_Fill(jinfo, 2);
-      r_lo = POP(jstack);
-      r = POP(jstack);
-    } else {
-      Thumb2_Fill(jinfo, 1);
-      r = POP(jstack);
-    }
-  }
-
-  mov_imm(jinfo->codebuf, ARM_LR, 0);
-  str_imm(jinfo->codebuf, ARM_LR, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-  ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
-  ldr_imm(jinfo->codebuf, ARM_LR, Rstack, 0, 1, 0);
-
-  if (opcode == opc_return) {
-    add_imm(jinfo->codebuf, Rstack, Rstack, jinfo->method->max_locals() * sizeof(int) + 4);
-  } else {
-    if (opcode == opc_lreturn || opcode == opc_dreturn) {
-      str_imm(jinfo->codebuf, r, Rstack, jinfo->method->max_locals() * sizeof(int), 1, 0);
-      str_imm(jinfo->codebuf, r_lo, Rstack, jinfo->method->max_locals() * sizeof(int)-4, 1, 1);
-    } else
-      str_imm(jinfo->codebuf, r, Rstack, jinfo->method->max_locals() * sizeof(int), 1, 1);
-  }
-
-//  sub_imm(jinfo->codebuf, Ristate, ARM_LR, ISTATE_NEXT_FRAME);
-  str_imm(jinfo->codebuf, ARM_LR, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
-  str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-  Thumb2_Debug(jinfo, H_DEBUG_METHODEXIT);
-//  enter_leave(jinfo->codebuf, 0);
-  ldm(jinfo->codebuf, C_REGSET + (1<<ARM_PC), ARM_SP, POP_FD, 1);
-}
-
-#if 0
-void Thumb2_save_all_locals(Thumb2_Info *jinfo, unsigned stackdepth)
-{
-  int nlocals = jinfo->method->max_locals();
-  int i;
-
-  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  for (i = 0; i < nlocals; i++) {
-    Reg r = jinfo->jregs->r_local[i];
-    if (r) {
-	store_local(jinfo, r, i, stackdepth);
-    }
-  }
-}
-#endif
-
-void Thumb2_save_locals(Thumb2_Info *jinfo, unsigned stackdepth)
-{
-  int nlocals = jinfo->method->max_locals();
-  unsigned *locals_info = jinfo->locals_info;
-  int i;
-
-  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  for (i = 0; i < nlocals; i++) {
-    Reg r = jinfo->jregs->r_local[i];
-    if (r) {
-      if ((locals_info[i] & (1 << LOCAL_REF)) && (locals_info[i] & (1 << LOCAL_MODIFIED))) {
-	store_local(jinfo, r, i, stackdepth);
-      }
-    }
-  }
-}
-
-void Thumb2_restore_locals(Thumb2_Info *jinfo, unsigned stackdepth)
-{
-  int nlocals = jinfo->method->max_locals();
-  unsigned *locals_info = jinfo->locals_info;
-  int i;
-
-  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  for (i = 0; i < nlocals; i++) {
-    Reg r = jinfo->jregs->r_local[i];
-    if (r) {
-      if (locals_info[i] & (1<<LOCAL_REF)) {
-	load_local(jinfo, r, i, stackdepth);
-      }
-    }
-  }
-}
-
-void Thumb2_invoke_save(Thumb2_Info *jinfo, unsigned stackdepth)
-{
-  int nlocals = jinfo->method->max_locals();
-  unsigned *locals_info = jinfo->locals_info;
-  int i;
-
-  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  for (i = 0; i < nlocals; i++) {
-    Reg r = jinfo->jregs->r_local[i];
-    if (r) {
-      if (locals_info[i] & (1 << LOCAL_MODIFIED)) {
-	store_local(jinfo, r, i, stackdepth);
-      }
-    }
-  }
-}
-
-void Thumb2_invoke_restore(Thumb2_Info *jinfo, unsigned stackdepth)
-{
-  int nlocals = jinfo->method->max_locals();
-  unsigned *locals_info = jinfo->locals_info;
-  int i;
-
-  JASSERT(jinfo->jstack->depth == 0, "stack not empty");
-  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-  for (i = 0; i < nlocals; i++) {
-    Reg r = jinfo->jregs->r_local[i];
-    if (r) {
-	load_local(jinfo, r, i, stackdepth);
-    }
-  }
-}
-
-void Thumb2_Exit(Thumb2_Info *jinfo, unsigned handler, unsigned bci, unsigned stackdepth)
-{
-    Thumb2_Flush(jinfo);
-    Thumb2_invoke_save(jinfo, stackdepth);
-    mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-    bl(jinfo->codebuf, handlers[handler]);
-}
-
-void Thumb2_Jsr(Thumb2_Info *jinfo, unsigned bci, unsigned stackdepth)
-{
-      Thumb2_Exit(jinfo, H_JSR, bci, stackdepth);
-}
-
-int Thumb2_Accessor(Thumb2_Info *jinfo)
-{
-  jubyte *code_base = jinfo->code_base;
-  constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-  ConstantPoolCacheEntry* cache;
-  int index = GET_NATIVE_U2(code_base+2);
-  unsigned loc;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-
-  JASSERT(code_base[0] == opc_aload_0 || code_base[0] == opc_iaccess_0, "not an aload_0 in accessor");
-  JASSERT(code_base[4] == opc_ireturn || code_base[4] == opc_areturn, "not an ireturn in accessor");
-  cache = cp->entry_at(index);
-  if (!cache->is_resolved((Bytecodes::Code)opc_getfield)) return 0;
-
-  TosState tos_type = cache->flag_state();
-  int field_offset = cache->f2();
-
-  // Slow entry point
-  loc = forward_32(jinfo->codebuf);
-  out_32(jinfo->codebuf, 0);
-  out_32(jinfo->codebuf, 0);
-
-  out_32(jinfo->codebuf, 0);	// pointer to osr table
-  out_32(jinfo->codebuf, 0);	// Space for exception_table pointer
-  out_32(jinfo->codebuf, 0);	// next compiled method
-
-  out_32(jinfo->codebuf, 0);    // regusage
-  out_32(jinfo->codebuf, 0);
-  out_32(jinfo->codebuf, 0);
-
-  // OSR entry point
-  mov_reg(jinfo->codebuf, ARM_PC, ARM_R0);
-
-  out_align(jinfo->codebuf, CODE_ALIGN);
-
-  // fast entry point
-  bc_stackinfo[0] = (bc_stackinfo[0] & BC_FLAGS_MASK) | (jinfo->codebuf->idx * 2) | BC_COMPILED;
-  branch_uncond_patch(jinfo->codebuf, loc, jinfo->codebuf->idx * 2);
-  ldr_imm(jinfo->codebuf, ARM_R1, ARM_R2, THREAD_JAVA_SP, 1, 0);
-  ldr_imm(jinfo->codebuf, ARM_R0, ARM_R1, 0, 1, 0);
-  if (tos_type == btos)
-    ldrsb_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
-  else if (tos_type == ctos)
-    ldrh_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
-  else if (tos_type == stos)
-    ldrsh_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
-  else
-    ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, field_offset, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R0, ARM_R1, 0, 1, 0);
-  mov_reg(jinfo->codebuf, ARM_PC, ARM_LR);
-
-  return 1;
-}
-
-void Thumb2_Enter(Thumb2_Info *jinfo)
-{
-  int parms = jinfo->method->size_of_parameters();
-  int extra_locals = jinfo->method->max_locals() - parms;
-  unsigned *locals_info = jinfo->locals_info;
-  int i;
-
-  // Slow entry point - callee save
-  // R0 = method
-  // R2 = thread
-  stm(jinfo->codebuf, I_REGSET + (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
-  bl(jinfo->codebuf, out_pos(jinfo->codebuf) + CODE_ALIGN - 4);
-  ldm(jinfo->codebuf, I_REGSET + (1<<ARM_PC), ARM_SP, POP_FD, 1);
-
-  out_32(jinfo->codebuf, 0);	// Space for osr_table pointer
-  out_32(jinfo->codebuf, 0);	// Space for exception_table pointer
-  out_32(jinfo->codebuf, 0);	// Pointer to next method
-
-  out_32(jinfo->codebuf, 0);    // regusage
-  out_32(jinfo->codebuf, 0);
-  out_32(jinfo->codebuf, 0);
-
-  // OSR entry point == Slow entry + 16 - caller save
-  // R0 = entry point within compiled method
-  // R1 = locals - THUMB2_MAXLOCALS * 4
-  // R2 = thread
-  // R3 = locals - 31 * 4
-  {
-    int nlocals = jinfo->method->max_locals();
-
-    for (i = 0; i < nlocals; i++) {
-      Reg r = jinfo->jregs->r_local[i];
-      if (r) {
-	ldr_imm(jinfo->codebuf, r,
-		(i < 32) ? ARM_R3 : ARM_R1,
-		(i < 32) ? (31 - i) * 4 : (THUMB2_MAXLOCALS - i) * 4,
-	  	1, 0);
-      }
-    }
-    mov_reg(jinfo->codebuf, Rthread, ARM_R2);
-    mov_reg(jinfo->codebuf, ARM_PC, ARM_R0);
-  }
-
-  out_align(jinfo->codebuf, CODE_ALIGN);
-
-  // Fast entry point == Slow entry + 64 - caller save
-  // R0 = method
-  // R2 = thread
-  stm(jinfo->codebuf, C_REGSET + (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
-//  enter_leave(jinfo->codebuf, 1);
-  ldr_imm(jinfo->codebuf, Rstack, ARM_R2, THREAD_JAVA_SP, 1, 0);
-  Thumb2_Debug(jinfo, H_DEBUG_METHODENTRY);
-  {
-    unsigned stacksize;
-
-    stacksize = (extra_locals + jinfo->method->max_stack()) * sizeof(int);
-    stacksize += FRAME_SIZE + STACK_SPARE;
-    if (!jinfo->is_leaf || stacksize > LEAF_STACK_SIZE) {
-      ldr_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_JAVA_STACK_BASE, 1, 0);
-      sub_imm(jinfo->codebuf, ARM_R1, Rstack, stacksize + LEAF_STACK_SIZE);
-      cmp_reg(jinfo->codebuf, ARM_R3, ARM_R1);
-      it(jinfo->codebuf, COND_CS, IT_MASK_T);
-      bl(jinfo->codebuf, handlers[H_STACK_OVERFLOW]);
-    }
-  }
-  mov_imm(jinfo->codebuf, ARM_R1, 0);
-
-  if (extra_locals > 0) {
-    sub_imm(jinfo->codebuf, Rstack, Rstack, extra_locals * 4);
-
-    for (i = 0; i < extra_locals; i++) {
-      unsigned linfo = locals_info[parms+i];
-      if (linfo & (1<< LOCAL_REF) || ((linfo >> LOCAL_INT) & 0x1f) == 0)
-	str_imm(jinfo->codebuf, ARM_R1, Rstack, (extra_locals-1 - i) * 4, 1, 0);
-    }
-  }
-
-  ldr_imm(jinfo->codebuf, ARM_IP, ARM_R0, METHOD_CONSTANTS, 1, 0);
-
-  sub_imm(jinfo->codebuf, Ristate, Rstack, FRAME_SIZE);
-
-  add_imm(jinfo->codebuf, Rlocals, Rstack, (jinfo->method->max_locals()-1) * sizeof(int));
-  str_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
-
-  if (jinfo->method->is_synchronized()) {
-    sub_imm(jinfo->codebuf, Rstack, Ristate, frame::interpreter_frame_monitor_size()*wordSize);
-    if (jinfo->method->is_static()) {
-      ldr_imm(jinfo->codebuf, ARM_R3, ARM_IP, CONSTANTPOOL_POOL_HOLDER, 1, 0);
-      ldr_imm(jinfo->codebuf, JAZ_V1, ARM_R3, KLASS_PART+KLASS_JAVA_MIRROR, 1, 0);
-    } else {
-      ldr_imm(jinfo->codebuf, JAZ_V1, Rlocals, 0, 1, 0);
-    }
-    str_imm(jinfo->codebuf, JAZ_V1, Rstack, 4, 1, 0);
-  } else
-    mov_reg(jinfo->codebuf, Rstack, Ristate);
-
-  str_imm(jinfo->codebuf, ARM_R1, Ristate, ISTATE_MSG, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R1, Ristate, ISTATE_OOP_TEMP, 1, 0);
-
-  sub_imm(jinfo->codebuf, ARM_R3, Rstack, jinfo->method->max_stack() * sizeof(int));
-  str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_JAVA_SP, 1, 0);
-
-  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK_BASE, 1, 0);
-
-  sub_imm(jinfo->codebuf, ARM_R3, ARM_R3, 4);
-  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_STACK_LIMIT, 1, 0);
-
-  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_TOP_ZERO_FRAME, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_NEXT_FRAME, 1, 0);
-
-  mov_imm(jinfo->codebuf, ARM_R3, INTERPRETER_FRAME);
-  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_FRAME_TYPE, 1, 0);
-
-  str_imm(jinfo->codebuf, Ristate, Ristate, ISTATE_MONITOR_BASE, 1, 0);
-
-  add_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_NEXT_FRAME);
-  str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_TOP_ZERO_FRAME, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_LAST_JAVA_SP, 1, 0);
-
-  ldr_imm(jinfo->codebuf, ARM_R3, ARM_IP, CONSTANTPOOL_CACHE, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_CONSTANTS, 1, 0);
-
-  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_THREAD, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
-
-  mov_reg(jinfo->codebuf, Rthread, ARM_R2);
-
-  if (jinfo->method->is_synchronized()) {
-    unsigned loc_retry, loc_failed, loc_success, loc_exception;
-
-    // JAZ_V1 == monitor object
-    //
-    // Try to acquire the monitor. Seems very sub-optimal
-    // 		ldr	r3, [JAZ_V1, #0]
-    // 		sub	r1, Ristate, #8
-    // 		orr	r3, r3, #1
-    // 		str	r3, [r1, #0]
-    // 	retry:
-    // 		ldrex	r0, [JAZ_V1, #0]
-    // 		cmp	r3, r0
-    // 		bne	failed
-    // 		strex	r0, r1, [JAZ_V1, #0]
-    // 		cbz	r0, success
-    // 		b	retry
-    // 	failed:
-    // 		<failed - someone else has the monitor - must yield>
-    //  success:
-    // 		<success - acquired the monitor>
-    //
-    ldr_imm(jinfo->codebuf, ARM_R3, JAZ_V1, 0, 1, 0);
-    sub_imm(jinfo->codebuf, ARM_R1, Ristate, frame::interpreter_frame_monitor_size()*wordSize);
-    orr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 1);
-    str_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
-    loc_retry = out_loc(jinfo->codebuf);
-// retry:
-    ldrex_imm(jinfo->codebuf, ARM_R0, JAZ_V1, 0);
-    cmp_reg(jinfo->codebuf, ARM_R3, ARM_R0);
-    loc_failed = forward_16(jinfo->codebuf);
-    strex_imm(jinfo->codebuf, ARM_R0, ARM_R1, JAZ_V1, 0);
-    loc_success = forward_16(jinfo->codebuf);
-    branch_uncond(jinfo->codebuf, loc_retry);
-    bcc_patch(jinfo->codebuf, COND_NE, loc_failed);
-// failed:
-    mov_imm(jinfo->codebuf, ARM_R0, 0+CONSTMETHOD_CODEOFFSET);
-    bl(jinfo->codebuf, handlers[H_SYNCHRONIZED_ENTER]);
-    loc_exception = forward_16(jinfo->codebuf);
-    bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
-    cbz_patch(jinfo->codebuf, ARM_R0, loc_exception);
-    cbz_patch(jinfo->codebuf, ARM_R0, loc_success);
-//    mov_imm(jinfo->codebuf, ARM_R0, 0+CONSTMETHOD_CODEOFFSET);
-//    bl(jinfo->codebuf, handlers[H_MONITOR]);
-// success:
-
-  }
-
-  {
-    int nlocals = jinfo->method->max_locals();
-
-    for (i = 0; i < nlocals; i++) {
-      Reg r = jinfo->jregs->r_local[i];
-      if (r) {
-	unsigned stackdepth = 0;
-	if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-	if (i < parms || (locals_info[i] & (1<<LOCAL_REF))) {
-	  load_local(jinfo, r, i, stackdepth);
-	}
-      }
-    }
-  }
-}
-
-unsigned opcode2handler[] = {
-  H_IDIV,
-  H_LDIV,
-  0, 0,			// fdiv, ddiv
-  H_IREM,
-  H_LREM,
-  H_FREM,
-  H_DREM,
-  0, 0, 0, 0,		// ineg, lneg, fneg, dneg
-  0, 0, 0, 0, 0, 0,	// shifts
-  0, 0, 0, 0, 0, 0,	// and, or, xor
-  0,			// iinc
-  0,			// i2l
-  H_I2F,
-  H_I2D,
-  0,			// l2i
-  H_L2F,
-  H_L2D,
-  H_F2I,
-  H_F2L,
-  H_F2D,
-  H_D2I,
-  H_D2L,
-  H_D2F,
-};
-
-#define OPCODE2HANDLER(opc) (handlers[opcode2handler[(opc)-opc_idiv]])
-
-extern "C" void _ZN18InterpreterRuntime18register_finalizerEP10JavaThreadP7oopDesc(void);
-
-void Thumb2_codegen(Thumb2_Info *jinfo, unsigned start)
-{
-  unsigned code_size = jinfo->code_size;
-  jubyte *code_base = jinfo->code_base;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-  CodeBuf *codebuf = jinfo->codebuf;
-  Thumb2_Stack *jstack = jinfo->jstack;
-  unsigned bci;
-  unsigned opcode;
-  unsigned stackinfo;
-  int len;
-  unsigned stackdepth;
-
-  for (bci = start; bci < code_size; ) {
-#ifdef T2EE_PRINT_DISASS
-    unsigned start_idx = jinfo->codebuf->idx;
-    if (start_bci[start_idx] == -1) start_bci[start_idx] = bci;
-#endif
-    opcode = code_base[bci];
-    stackinfo = bc_stackinfo[bci];
-
-    if (stackinfo & BC_BRANCH_TARGET) Thumb2_Flush(jinfo);
-    JASSERT(!(stackinfo & BC_COMPILED), "code already compiled for this bytecode?");
-    stackdepth = stackinfo & ~BC_FLAGS_MASK;
-    bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | (codebuf->idx * 2) | BC_COMPILED;
-
-    if (opcode > OPC_LAST_JAVA_OP && opcode != opc_return_register_finalizer) {
-      if (Bytecodes::is_defined((Bytecodes::Code)opcode))
-	opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
-    }
-
-    len = Bytecodes::length_for((Bytecodes::Code)opcode);
-    if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
-
-    if (IS_DEAD(stackinfo) || IS_ZOMBIE(stackinfo)) {
-      unsigned zlen = 0;
-#ifdef T2EE_PRINT_DISASS
-      unsigned start_bci = bci;
-#endif
-
-      Thumb2_Exit(jinfo, H_ZOMBIE, bci, stackdepth);
-      do {
-	zlen += len;
-	bci += len;
-	if (bci >= code_size) break;
-	opcode = code_base[bci];
-	stackinfo = bc_stackinfo[bci];
-
-	if (stackinfo & BC_BRANCH_TARGET) break;
-	if (!(IS_DEAD(stackinfo) || IS_ZOMBIE(stackinfo))) break;
-
-	bc_stackinfo[bci] = (stackinfo & BC_FLAGS_MASK) | (codebuf->idx * 2);
-
-	if (opcode > OPC_LAST_JAVA_OP) {
-	  if (Bytecodes::is_defined((Bytecodes::Code)opcode))
-	    opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
-	}
-
-	len = Bytecodes::length_for((Bytecodes::Code)opcode);
-	if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
-
-      } while (1);
-#ifdef T2EE_PRINT_DISASS
-      end_bci[start_idx] = start_bci + zlen;
-#endif
-      jinfo->zombie_bytes += zlen;
-      continue;
-    }
-
-#if 0
-    if (bci >= 2620) {
-      unsigned zlen = 0;
-#ifdef T2EE_PRINT_DISASS
-      unsigned start_bci = bci;
-#endif
-
-      Thumb2_Exit(jinfo, H_ZOMBIE, bci, stackdepth);
-      do {
-	zlen += len;
-	bci += len;
-	if (bci >= code_size) break;
-	opcode = code_base[bci];
-	stackinfo = bc_stackinfo[bci];
-
-	if (stackinfo & BC_BRANCH_TARGET) break;
-
-	if (opcode > OPC_LAST_JAVA_OP) {
-	  if (Bytecodes::is_defined((Bytecodes::Code)opcode))
-	    opcode = (unsigned)Bytecodes::java_code((Bytecodes::Code)opcode);
-	}
-
-	len = Bytecodes::length_for((Bytecodes::Code)opcode);
-	if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
-
-      } while (1);
-#ifdef T2EE_PRINT_DISASS
-      end_bci[start_idx] = start_bci + zlen;
-#endif
-      jinfo->zombie_bytes += zlen;
-      continue;
-    }
-#endif
-
-#ifdef T2EE_PRINT_DISASS
-    end_bci[start_idx] = bci + len;
-#endif
-
-    switch (opcode) {
-      case opc_nop:
-	break;
-      case opc_aconst_null:
-	len += Thumb2_Imm(jinfo, 0, bci+1);
-	break;
-      case opc_iconst_m1:
-      case opc_iconst_0:
-      case opc_iconst_1:
-      case opc_iconst_2:
-      case opc_iconst_3:
-      case opc_iconst_4:
-      case opc_iconst_5:
-	len += Thumb2_Imm(jinfo, opcode - (unsigned)opc_iconst_0, bci+1);
-	break;
-      case opc_lconst_0:
-      case opc_lconst_1:
-	Thumb2_ImmX2(jinfo, opcode - (unsigned)opc_lconst_0, 0);
-	break;
-      case opc_fconst_0:
-      case opc_fconst_1:
-      case opc_fconst_2: {
-	unsigned v = 0;
-	if (opcode == (unsigned)opc_fconst_1) v = 0x3f800000;
-	if (opcode == (unsigned)opc_fconst_2) v = 0x40000000;
-	len += Thumb2_Imm(jinfo, v, bci+1);
-	break;
-      }
-      case opc_dconst_0:
-      case opc_dconst_1: {
-	unsigned v_hi = 0;
-	if (opcode == (unsigned)opc_dconst_1) v_hi = 0x3ff00000;
-	Thumb2_ImmX2(jinfo, 0, v_hi);
-	break;
-      }
-      case opc_bipush:
-	len += Thumb2_Imm(jinfo, GET_JAVA_S1(code_base+bci+1), bci+2);
-	break;
-      case opc_sipush:
-	len += Thumb2_Imm(jinfo, GET_JAVA_S2(code_base+bci+1), bci+3);
-	break;
-      case opc_ldc:
-      case opc_ldc_w:
-      case opc_ldc2_w: {
-	unsigned index = (opcode == (unsigned)opc_ldc) ?
-				code_base[bci+1] : GET_JAVA_U2(code_base+bci+1);
-	constantPoolOop constants = jinfo->method->constants();
-	unsigned v;
-
-	switch (v = constants->tag_at(index).value()) {
-	  case JVM_CONSTANT_Integer:
-	  case JVM_CONSTANT_Float:
-	    v = (unsigned)constants->int_at(index);
-	    len += Thumb2_Imm(jinfo, v, bci+len);
-	    break;
-#if 0
-	  case JVM_CONSTANT_String:
-	    v = (unsigned)constants->resolved_string_at(index);
-	    len += Thumb2_Imm(jinfo, v, bci+len);
-	    break;
-	  case JVM_CONSTANT_Class:
-	    v = (unsigned)constants->resolved_klass_at(index)->klass_part()->java_mirror();
-	    len += Thumb2_Imm(jinfo, v, bci+len);
-	    break;
-#endif
-	  case JVM_CONSTANT_Long:
-	  case JVM_CONSTANT_Double: {
-	    unsigned long long v;
-	    v = constants->long_at(index);
-	    Thumb2_ImmX2(jinfo, v & 0xffffffff, v >> 32);
-	    break;
-	  }
-	  case JVM_CONSTANT_Class:
-	  case JVM_CONSTANT_String: {
-	    Reg r;
-	    Thumb2_Spill(jinfo, 1, 0);
-	    r = JSTACK_REG(jstack);
-	    PUSH(jstack, r);
-	    ldr_imm(jinfo->codebuf, r, Ristate, ISTATE_METHOD, 1, 0);
-	    ldr_imm(jinfo->codebuf, r, r, METHOD_CONSTANTS, 1, 0);
-	    ldr_imm(jinfo->codebuf, r, r, CONSTANTPOOL_BASE + (index << 2), 1, 0);
-	    if (v == JVM_CONSTANT_Class)
-	      ldr_imm(jinfo->codebuf, r, r, KLASS_PART+KLASS_JAVA_MIRROR, 1, 0);
-	    break;
-	  }
-	  default:
-	    unsigned loc;
-
-	    JASSERT(opcode != opc_ldc2_w, "ldc2_w unresolved?");
-	    Thumb2_Flush(jinfo);
-	    mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  Thumb2_save_locals(jinfo, stackdepth);
-	    mov_imm(jinfo->codebuf, ARM_R1, opcode != opc_ldc);
-	    bl(jinfo->codebuf, handlers[H_LDC]);
-	  Thumb2_restore_locals(jinfo, stackdepth);
-	    ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
-	    mov_imm(jinfo->codebuf, ARM_R2, 0);
-	    str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
-	    loc = forward_16(jinfo->codebuf);
-	    bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	    cbnz_patch(jinfo->codebuf, ARM_R0, loc);
-	    PUSH(jstack, ARM_R0);
-	    break;
-	}
-	break;
-      }
-
-      case opc_iload:
-      case opc_fload:
-      case opc_aload:
-	Thumb2_Load(jinfo, code_base[bci+1], stackdepth);
-	break;
-      case opc_lload:
-      case opc_dload:
-	Thumb2_LoadX2(jinfo, code_base[bci+1], stackdepth);
-	break;
-      case opc_iload_0:
-      case opc_iload_1:
-      case opc_iload_2:
-      case opc_iload_3:
-      case opc_fload_0:
-      case opc_fload_1:
-      case opc_fload_2:
-      case opc_fload_3:
-      case opc_aload_0:
-      case opc_aload_1:
-      case opc_aload_2:
-      case opc_aload_3:
-	Thumb2_Load(jinfo, (opcode - opc_iload_0) & 3, stackdepth);
-	break;
-      case opc_lload_0:
-      case opc_lload_1:
-      case opc_lload_2:
-      case opc_lload_3:
-      case opc_dload_0:
-      case opc_dload_1:
-      case opc_dload_2:
-      case opc_dload_3:
-	Thumb2_LoadX2(jinfo, (opcode - opc_iload_0) & 3, stackdepth);
-	break;
-      case opc_iaload:
-      case opc_faload:
-      case opc_aaload:
-      case opc_baload:
-      case opc_caload:
-      case opc_saload:
-	Thumb2_Xaload(jinfo, opcode);
-	break;
-      case opc_laload:
-      case opc_daload:
-	Thumb2_X2aload(jinfo);
-	break;
-      case opc_istore:
-      case opc_fstore:
-      case opc_astore:
-	Thumb2_Store(jinfo, code_base[bci+1], stackdepth);
-	break;
-      case opc_lstore:
-      case opc_dstore:
-	Thumb2_StoreX2(jinfo, code_base[bci+1], stackdepth);
-	break;
-      case opc_istore_0:
-      case opc_istore_1:
-      case opc_istore_2:
-      case opc_istore_3:
-      case opc_fstore_0:
-      case opc_fstore_1:
-      case opc_fstore_2:
-      case opc_fstore_3:
-      case opc_astore_0:
-      case opc_astore_1:
-      case opc_astore_2:
-      case opc_astore_3:
-	Thumb2_Store(jinfo, (opcode - opc_istore_0) & 3, stackdepth);
-	break;
-      case opc_lstore_0:
-      case opc_lstore_1:
-      case opc_lstore_2:
-      case opc_lstore_3:
-      case opc_dstore_0:
-      case opc_dstore_1:
-      case opc_dstore_2:
-      case opc_dstore_3:
-	Thumb2_StoreX2(jinfo, (opcode - opc_istore_0) & 3, stackdepth);
-	break;
-      case opc_iastore:
-      case opc_fastore:
-      case opc_bastore:
-      case opc_castore:
-      case opc_sastore:
-	Thumb2_Xastore(jinfo, opcode);
-	break;
-      case opc_lastore:
-      case opc_dastore:
-	Thumb2_X2astore(jinfo);
-	break;
-
-      case opc_pop:
-      case opc_pop2:
-	Thumb2_Pop(jinfo, opcode - opc_pop + 1);
-	break;
-
-      case opc_dup:
-      case opc_dup_x1:
-      case opc_dup_x2:
-	Thumb2_Dup(jinfo, opcode - opc_dup);
-	break;
-
-      case opc_dup2:
-      case opc_dup2_x1:
-      case opc_dup2_x2:
-	Thumb2_Dup2(jinfo, opcode - opc_dup2);
-	break;
-
-      case opc_swap:
-	Thumb2_Swap(jinfo);
-	break;
-
-      case opc_iadd:
-      case opc_isub:
-      case opc_imul:
-      case opc_ishl:
-      case opc_ishr:
-      case opc_iushr:
-      case opc_iand:
-      case opc_ior:
-      case opc_ixor:
-	Thumb2_iOp(jinfo, opcode);
-	break;
-
-      case opc_ladd:
-      case opc_lsub:
-      case opc_land:
-      case opc_lor:
-      case opc_lxor:
-	Thumb2_lOp(jinfo, opcode);
-	break;
-
-      case opc_lshl: {
-	Reg lho_lo, lho_hi, res_lo, res_hi, shift;
-	unsigned loc1, loc2;
-
-	Thumb2_Fill(jinfo, 3);
-	shift = POP(jstack);
-	lho_lo = POP(jstack);
-	lho_hi = POP(jstack);
-	Thumb2_Spill(jinfo, 2, (1<<lho_lo)|(1<<lho_hi));
-	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
-	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
-	JASSERT(res_lo != lho_lo && res_lo != lho_hi, "Spill failed");
-	JASSERT(res_hi != lho_lo && res_hi != lho_hi, "Spill failed");
-	and_imm(jinfo->codebuf, ARM_IP, shift, 31);
-	tst_imm(jinfo->codebuf, shift, 32);
-	loc1 = forward_16(jinfo->codebuf);
-	mov_imm(jinfo->codebuf, res_lo, 0);
-	dop_reg(jinfo->codebuf, DP_LSL, res_hi, lho_lo, ARM_IP, SHIFT_LSL, 0);
-	loc2 = forward_16(jinfo->codebuf);
-	bcc_patch(jinfo->codebuf, COND_EQ, loc1);
-	dop_reg(jinfo->codebuf, DP_LSL, res_lo, lho_lo, ARM_IP, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_LSL, res_hi, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	rsb_imm(jinfo->codebuf, ARM_IP, ARM_IP, 32);
-	dop_reg(jinfo->codebuf, DP_LSR, ARM_IP, lho_lo, ARM_IP, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_ORR, res_hi, res_hi, ARM_IP, SHIFT_LSL, 0);
-	branch_narrow_patch(jinfo->codebuf, loc2);
-	break;
-      }
-
-      case opc_lushr: {
-	Reg lho_lo, lho_hi, res_lo, res_hi, shift;
-	unsigned loc1, loc2;
-
-	Thumb2_Fill(jinfo, 3);
-	shift = POP(jstack);
-	lho_lo = POP(jstack);
-	lho_hi = POP(jstack);
-	Thumb2_Spill(jinfo, 2, (1<<lho_lo)|(1<<lho_hi));
-	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
-	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
-	JASSERT(res_lo != lho_lo && res_lo != lho_hi, "Spill failed");
-	JASSERT(res_hi != lho_lo && res_hi != lho_hi, "Spill failed");
-	and_imm(jinfo->codebuf, ARM_IP, shift, 31);
-	tst_imm(jinfo->codebuf, shift, 32);
-	loc1 = forward_16(jinfo->codebuf);
-	mov_imm(jinfo->codebuf, res_hi, 0);
-	dop_reg(jinfo->codebuf, DP_LSR, res_lo, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	loc2 = forward_16(jinfo->codebuf);
-	bcc_patch(jinfo->codebuf, COND_EQ, loc1);
-	dop_reg(jinfo->codebuf, DP_LSR, res_hi, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_LSR, res_lo, lho_lo, ARM_IP, SHIFT_LSL, 0);
-	rsb_imm(jinfo->codebuf, ARM_IP, ARM_IP, 32);
-	dop_reg(jinfo->codebuf, DP_LSL, ARM_IP, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_ORR, res_lo, res_lo, ARM_IP, SHIFT_LSL, 0);
-	branch_narrow_patch(jinfo->codebuf, loc2);
-	break;
-      }
-
-      case opc_lshr: {
-	Reg lho_lo, lho_hi, res_lo, res_hi, shift;
-	unsigned loc1, loc2;
-
-	Thumb2_Fill(jinfo, 3);
-	shift = POP(jstack);
-	lho_lo = POP(jstack);
-	lho_hi = POP(jstack);
-	Thumb2_Spill(jinfo, 2, (1<<lho_lo)|(1<<lho_hi));
-	res_hi = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
-	res_lo = PUSH(jstack, JSTACK_PREFER(jstack, ~((1<<lho_lo)|(1<<lho_hi))));
-	JASSERT(res_lo != lho_lo && res_lo != lho_hi, "Spill failed");
-	JASSERT(res_hi != lho_lo && res_hi != lho_hi, "Spill failed");
-	and_imm(jinfo->codebuf, ARM_IP, shift, 31);
-	tst_imm(jinfo->codebuf, shift, 32);
-	loc1 = forward_16(jinfo->codebuf);
-	asr_imm(jinfo->codebuf, res_hi, lho_hi, 31);
-	dop_reg(jinfo->codebuf, DP_ASR, res_lo, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	loc2 = forward_16(jinfo->codebuf);
-	bcc_patch(jinfo->codebuf, COND_EQ, loc1);
-	dop_reg(jinfo->codebuf, DP_ASR, res_hi, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_LSR, res_lo, lho_lo, ARM_IP, SHIFT_LSL, 0);
-	rsb_imm(jinfo->codebuf, ARM_IP, ARM_IP, 32);
-	dop_reg(jinfo->codebuf, DP_LSL, ARM_IP, lho_hi, ARM_IP, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_ORR, res_lo, res_lo, ARM_IP, SHIFT_LSL, 0);
-	branch_narrow_patch(jinfo->codebuf, loc2);
-	break;
-      }
-
-      case opc_lmul:
-	Thumb2_lmul(jinfo);
-	break;
-
-      case opc_fadd:
-      case opc_fsub:
-      case opc_fmul:
-      case opc_fdiv:
-	Thumb2_fOp(jinfo, opcode);
-	break;
-
-      case opc_dadd:
-      case opc_dsub:
-      case opc_dmul:
-      case opc_ddiv:
-	Thumb2_dOp(jinfo, opcode);
-	break;
-
-      case opc_fcmpl:
-      case opc_fcmpg: {
-	Thumb2_Stack *jstack = jinfo->jstack;
-	unsigned rho, lho, res;
-	unsigned loc1, loc2, loc_ne;
-
-	Thumb2_Fill(jinfo, 2);
-	rho = POP(jstack);
-	lho = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	res = PUSH(jstack, JSTACK_REG(jstack));
-	vmov_reg_s_toVFP(jinfo->codebuf, VFP_S0, lho);
-	vmov_reg_s_toVFP(jinfo->codebuf, VFP_S1, rho);
-	vcmp_reg_s(jinfo->codebuf, VFP_S0, VFP_S1, 1);
-	mov_imm(jinfo->codebuf, res, opcode == opc_fcmpl ? 1 : -1);
-	vmrs(jinfo->codebuf, ARM_PC);
-	loc1 = forward_16(jinfo->codebuf);
-	dop_imm_preserve(jinfo->codebuf, DP_RSB, res, res, 0);
-	loc2 = forward_16(jinfo->codebuf);
-	vcmp_reg_s(jinfo->codebuf, VFP_S0, VFP_S1, 0);
-	loc_ne = forward_16(jinfo->codebuf);
-	mov_imm(jinfo->codebuf, res, 0);
-	bcc_patch(jinfo->codebuf, opcode == opc_fcmpl ? COND_GT : COND_MI, loc1);
-	bcc_patch(jinfo->codebuf, opcode == opc_fcmpl ? COND_MI : COND_GT, loc2);
-	bcc_patch(jinfo->codebuf, COND_NE, loc_ne);
-	break;
-      }
-
-      case opc_dcmpl:
-      case opc_dcmpg: {
-	Thumb2_Stack *jstack = jinfo->jstack;
-	unsigned rho_lo, rho_hi, lho_lo, lho_hi, res;
-	unsigned loc1, loc2, loc_ne;
-
-	Thumb2_Fill(jinfo, 4);
-	rho_lo = POP(jstack);
-	rho_hi = POP(jstack);
-	lho_lo = POP(jstack);
-	lho_hi = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	res = PUSH(jstack, JSTACK_REG(jstack));
-	vmov_reg_d_toVFP(jinfo->codebuf, VFP_S0, lho_lo, lho_hi);
-	vmov_reg_d_toVFP(jinfo->codebuf, VFP_S1, rho_lo, rho_hi);
-	vcmp_reg_d(jinfo->codebuf, VFP_S0, VFP_S1, 1);
-	mov_imm(jinfo->codebuf, res, opcode == opc_dcmpl ? 1 : -1);
-	vmrs(jinfo->codebuf, ARM_PC);
-	loc1 = forward_16(jinfo->codebuf);
-	dop_imm_preserve(jinfo->codebuf, DP_RSB, res, res, 0);
-	loc2 = forward_16(jinfo->codebuf);
-	vcmp_reg_d(jinfo->codebuf, VFP_S0, VFP_S1, 0);
-	loc_ne = forward_16(jinfo->codebuf);
-	mov_imm(jinfo->codebuf, res, 0);
-	bcc_patch(jinfo->codebuf, opcode == opc_dcmpl ? COND_GT : COND_MI, loc1);
-	bcc_patch(jinfo->codebuf, opcode == opc_dcmpl ? COND_MI : COND_GT, loc2);
-	bcc_patch(jinfo->codebuf, COND_NE, loc_ne);
-	break;
-      }
-
-      case opc_drem:
-      case opc_lrem:
-      case opc_ldiv: {
-	Reg src[4], dst[4];
-
-	Thumb2_Fill(jinfo, 4);
-	src[2] = POP(jstack);
-	src[3] = POP(jstack);
-	src[0] = POP(jstack);
-	src[1] = POP(jstack);
-	Thumb2_Flush(jinfo);
-	dst[0] = ARM_R0;
-	dst[1] = ARM_R1;
-	dst[2] = ARM_R2;
-	dst[3] = ARM_R3;
-	mov_multiple(jinfo->codebuf, dst, src, 4);
-	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
-	if (opcode != opc_lrem) {
-	  PUSH(jstack, ARM_R1);
-	  PUSH(jstack, ARM_R0);
-	} else {
-	  PUSH(jstack, ARM_R3);
-	  PUSH(jstack, ARM_R2);
-	}
-	break;
-      }
-
-      case opc_frem:
-      case opc_idiv:
-      case opc_irem: {
-	Reg r_rho, r_lho;
-
-	Thumb2_Fill(jinfo, 2);
-	r_rho = POP(jstack);
-	r_lho = POP(jstack);
-	Thumb2_Flush(jinfo);
-	if (r_rho == ARM_R0) {
-	  if (r_lho == ARM_R1) {
-	    mov_reg(jinfo->codebuf, ARM_IP, r_rho);
-	    mov_reg(jinfo->codebuf, ARM_R0, r_lho);
-	    mov_reg(jinfo->codebuf, ARM_R1, ARM_IP);
-	  } else {
-	    mov_reg(jinfo->codebuf, ARM_R1, r_rho);
-	    mov_reg(jinfo->codebuf, ARM_R0, r_lho);
-	  }
-	} else {
-	  mov_reg(jinfo->codebuf, ARM_R0, r_lho);
-	  mov_reg(jinfo->codebuf, ARM_R1, r_rho);
-	}
-#if 1
-	if (opcode == opc_frem)
-	  bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
-	else
-	  blx(jinfo->codebuf, OPCODE2HANDLER(opcode));
-#else
-	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
-#endif
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_f2i:
-      case opc_i2f: {
-	Reg r;
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Flush(jinfo);
-	mov_reg(jinfo->codebuf, ARM_R0, r);
-	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_f2d:
-      case opc_f2l:
-      case opc_i2d: {
-	Reg r;
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Flush(jinfo);
-	mov_reg(jinfo->codebuf, ARM_R0, r);
-	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
-	PUSH(jstack, ARM_R1);
-	PUSH(jstack, ARM_R0);
-	break;
-    }
-
-      case opc_d2f:
-      case opc_d2i:
-      case opc_l2d:
-      case opc_d2l:
-      case opc_l2f: {
-	Reg lo, hi;
-
-	Thumb2_Fill(jinfo, 2);
-	lo = POP(jstack);
-	hi = POP(jstack);
-	Thumb2_Flush(jinfo);
-	if (hi == ARM_R0) {
-	  if (lo == ARM_R1) {
-	    mov_reg(jinfo->codebuf, ARM_IP, hi);
-	    mov_reg(jinfo->codebuf, ARM_R0, lo);
-	    mov_reg(jinfo->codebuf, ARM_R1, ARM_IP);
-	  } else {
-	    mov_reg(jinfo->codebuf, ARM_R1, hi);
-	    mov_reg(jinfo->codebuf, ARM_R0, lo);
-	  }
-	} else {
-	  mov_reg(jinfo->codebuf, ARM_R0, lo);
-	  mov_reg(jinfo->codebuf, ARM_R1, hi);
-	}
-	bl(jinfo->codebuf, OPCODE2HANDLER(opcode));
-	if (opcode == opc_l2d || opcode == opc_d2l) PUSH(jstack, ARM_R1);
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_ineg:
-	Thumb2_iNeg(jinfo, opcode);
-	break;
-
-      case opc_lneg:
-	Thumb2_lNeg(jinfo, opcode);
-	break;
-
-      case opc_fneg:
-	Thumb2_fNeg(jinfo, opcode);
-	break;
-
-      case opc_dneg:
-	Thumb2_dNeg(jinfo, opcode);
-	break;
-
-      case opc_i2l: {
-	unsigned r, r_res_lo, r_res_hi;
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Spill(jinfo, 2, 0);
-	r_res_hi = PUSH(jstack, JSTACK_REG(jstack));
-	r_res_lo = PUSH(jstack, JSTACK_REG(jstack));
-	if (r == r_res_hi) {
-	  SWAP(jstack);
-	  r_res_hi = r_res_lo;
-	  r_res_lo = r;
-	}
-	mov_reg(jinfo->codebuf, r_res_lo, r);
-	asr_imm(jinfo->codebuf, r_res_hi, r, 31);
-	break;
-      }
-
-      case opc_l2i: {
-	unsigned r_lo, r_hi;
-	unsigned r;
-
-	Thumb2_Fill(jinfo, 2);
-	r_lo = POP(jstack);
-	r_hi = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	r = PUSH(jstack, r_lo);
-	break;
-      }
-
-      case opc_i2b: {
-	unsigned r_src, r_dst;
-
-	Thumb2_Fill(jinfo, 1);
-	r_src = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	r_dst = PUSH(jstack, JSTACK_REG(jstack));
-	sxtb(jinfo->codebuf, r_dst, r_src);
-	break;
-      }
-
-      case opc_i2s: {
-	unsigned r_src, r_dst;
-
-	Thumb2_Fill(jinfo, 1);
-	r_src = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	r_dst = PUSH(jstack, JSTACK_REG(jstack));
-	sxth(jinfo->codebuf, r_dst, r_src);
-	break;
-      }
-
-      case opc_i2c: {
-	unsigned r_src, r_dst;
-
-	Thumb2_Fill(jinfo, 1);
-	r_src = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	r_dst = PUSH(jstack, JSTACK_REG(jstack));
-	uxth(jinfo->codebuf, r_dst, r_src);
-	break;
-      }
-
-      case opc_lcmp: {
-	unsigned lho_lo, lho_hi;
-	unsigned rho_lo, rho_hi;
-	unsigned r_tmp_lo, r_tmp_hi;
-	unsigned res;
-	unsigned loc_lt, loc_eq;
-
-	Thumb2_Fill(jinfo, 4);
-	rho_lo = POP(jstack);
-	rho_hi = POP(jstack);
-	lho_lo = POP(jstack);
-	lho_hi = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	res = JSTACK_REG(jstack);
-	PUSH(jstack, res);
-	r_tmp_lo = Thumb2_Tmp(jinfo, (1<<rho_lo)|(1<<rho_hi)|(1<<lho_lo)|(1<<lho_hi));
-	r_tmp_hi = Thumb2_Tmp(jinfo, (1<<rho_lo)|(1<<rho_hi)|(1<<lho_lo)|(1<<lho_hi)|(1<<r_tmp_lo));
-	dop_reg(jinfo->codebuf, DP_SUB, r_tmp_lo, lho_lo, rho_lo, SHIFT_LSL, 0);
-	dop_reg(jinfo->codebuf, DP_SBC, r_tmp_hi, lho_hi, rho_hi, SHIFT_LSL, 0);
-	mov_imm(jinfo->codebuf, res, (unsigned)-1);
-	loc_lt = forward_16(jinfo->codebuf);
-	dop_reg(jinfo->codebuf, DP_ORR, res, r_tmp_lo, r_tmp_hi, SHIFT_LSL, 0);
-	loc_eq = forward_16(jinfo->codebuf);
-	mov_imm(jinfo->codebuf, res, 1);
-	bcc_patch(jinfo->codebuf, COND_LT, loc_lt);
-	bcc_patch(jinfo->codebuf, COND_EQ, loc_eq);
-	break;
-      }
-
-      case opc_iinc: {
-	unsigned local = code_base[bci+1];
-	int constant = GET_JAVA_S1(code_base+bci+2);
-	unsigned r = jinfo->jregs->r_local[local];
-
-	if (!r) {
-	  int nlocals = jinfo->method->max_locals();
-	  r = Thumb2_Tmp(jinfo, 0);
-	  stackdepth -= jstack->depth;
-	  if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-	  load_local(jinfo, r, local, stackdepth);
-	  add_imm(jinfo->codebuf, r, r, constant);
-	  store_local(jinfo, r, local, stackdepth);
-	} else {
-	  Thumb2_Corrupt(jinfo, r, 0);
-	  add_imm(jinfo->codebuf, r, r, constant);
-	}
-	break;
-      }
-
-      case opc_getfield: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-	Reg r_obj;
-
-        cache = cp->entry_at(index);
-        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
-	  int java_index = GET_JAVA_U2(code_base+bci+1);
-	  constantPoolOop pool = jinfo->method->constants();
-	  symbolOop sig = pool->signature_ref_at(java_index);
-	  jbyte *base = sig->base();
-	  jbyte c = *base;
-	  int handler = H_GETFIELD_WORD;
-
-	  if (c == 'J' || c == 'D') handler = H_GETFIELD_DW;
-	  if (c == 'B' || c == 'Z') handler = H_GETFIELD_SB;
-	  if (c == 'C') handler = H_GETFIELD_H;
-	  if (c == 'S') handler = H_GETFIELD_SH;
-	  Thumb2_Flush(jinfo);
-	  Thumb2_save_locals(jinfo, stackdepth);
-	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  mov_imm(jinfo->codebuf, ARM_R1, index);
-	  blx(jinfo->codebuf, handlers[handler]);
-	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  break;
-	}
-
-	TosState tos_type = cache->flag_state();
-	int field_offset = cache->f2();
-
-	if (tos_type == ltos || tos_type == dtos) {
-	  Reg r_lo, r_hi;
-	  Thumb2_Fill(jinfo, 1);
-	  r_obj = POP(jstack);
-	  Thumb2_Spill(jinfo, 2, 0);
-	  r_hi = PUSH(jstack, JSTACK_REG(jstack));
-	  r_lo = PUSH(jstack, JSTACK_REG(jstack));
-	  ldrd_imm(jinfo->codebuf, r_lo, r_hi, r_obj, field_offset, 1, 0);
-	} else {
-	  Reg r;
-
-	  Thumb2_Fill(jinfo, 1);
-	  r_obj = POP(jstack);
-	  Thumb2_Spill(jinfo, 1, 0);
-	  r = JSTACK_REG(jstack);
-	  PUSH(jstack, r);
-	  if (tos_type == btos)
-	    ldrsb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else if (tos_type == ctos)
-	    ldrh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else if (tos_type == stos)
-	    ldrsh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else
-	    ldr_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	}
-	break;
-      }
-
-      case opc_monitorexit:
-      case opc_monitorenter:
-	  Thumb2_Exit(jinfo, H_MONITOR, bci, stackdepth);
-	  break;
-
-      case opc_getstatic: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-
-        cache = cp->entry_at(index);
-        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
-	  int java_index = GET_JAVA_U2(code_base+bci+1);
-	  constantPoolOop pool = jinfo->method->constants();
-	  symbolOop sig = pool->signature_ref_at(java_index);
-	  jbyte *base = sig->base();
-	  jbyte c = *base;
-	  int handler = H_GETSTATIC_WORD;
-
-	  if (c == 'J' || c == 'D') handler = H_GETSTATIC_DW;
-	  if (c == 'B' || c == 'Z') handler = H_GETSTATIC_SB;
-	  if (c == 'C') handler = H_GETSTATIC_H;
-	  if (c == 'S') handler = H_GETSTATIC_SH;
-	  Thumb2_Flush(jinfo);
-	  Thumb2_save_locals(jinfo, stackdepth);
-	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  mov_imm(jinfo->codebuf, ARM_R1, index);
-	  blx(jinfo->codebuf, handlers[handler]);
-	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  break;
-	}
-
-	TosState tos_type = cache->flag_state();
-	int field_offset = cache->f2();
-
-	if (tos_type == ltos || tos_type == dtos) {
-	  Reg r_lo, r_hi;
-	  Thumb2_Spill(jinfo, 2, 0);
-	  r_hi = PUSH(jstack, JSTACK_REG(jstack));
-	  r_lo = PUSH(jstack, JSTACK_REG(jstack));
-	  ldr_imm(jinfo->codebuf, r_lo, Ristate, ISTATE_CONSTANTS, 1, 0);
-	  ldr_imm(jinfo->codebuf, r_lo, r_lo, CP_OFFSET + (index << 4) + 4, 1, 0);
-	  ldrd_imm(jinfo->codebuf, r_lo, r_hi, r_lo, field_offset, 1, 0);
-	} else {
-	  Reg r;
-	  Thumb2_Spill(jinfo, 1, 0);
-	  r = JSTACK_REG(jstack);
-	  PUSH(jstack, r);
-	  ldr_imm(jinfo->codebuf, r, Ristate, ISTATE_CONSTANTS, 1, 0);
-	  ldr_imm(jinfo->codebuf, r, r, CP_OFFSET + (index << 4) + 4, 1, 0);
-	  if (tos_type == btos)
-	    ldrsb_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
-	  else if (tos_type == ctos)
-	    ldrh_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
-	  else if (tos_type == stos)
-	    ldrsh_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
-	  else
-	    ldr_imm(jinfo->codebuf, r, r, field_offset, 1, 0);
-	}
-	break;
-      }
-
-      case opc_putfield: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-	Reg r_obj;
-
-        cache = cp->entry_at(index);
-        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
-	  int java_index = GET_JAVA_U2(code_base+bci+1);
-	  constantPoolOop pool = jinfo->method->constants();
-	  symbolOop sig = pool->signature_ref_at(java_index);
-	  jbyte *base = sig->base();
-	  jbyte c = *base;
-	  int handler = H_PUTFIELD_WORD;
-
-	  if (c == 'J' || c == 'D') handler = H_PUTFIELD_DW;
-	  if (c == 'B' || c == 'Z') handler = H_PUTFIELD_B;
-	  if (c == 'C' || c == 'S') handler = H_PUTFIELD_H;
-	  if (c == '[' || c == 'L') handler = H_PUTFIELD_A;
-	  Thumb2_Flush(jinfo);
-	  Thumb2_save_locals(jinfo, stackdepth);
-	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  mov_imm(jinfo->codebuf, ARM_R1, index);
-	  blx(jinfo->codebuf, handlers[handler]);
-	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  break;
-	}
-
-	TosState tos_type = cache->flag_state();
-	int field_offset = cache->f2();
-
-	if (tos_type == ltos || tos_type == dtos) {
-	  Reg r_lo, r_hi;
-	  Thumb2_Fill(jinfo, 3);
-	  r_lo = POP(jstack);
-	  r_hi = POP(jstack);
-	  r_obj = POP(jstack);
-	  strd_imm(jinfo->codebuf, r_lo, r_hi, r_obj, field_offset, 1, 0);
-	} else {
-	  Reg r;
-	  Thumb2_Fill(jinfo, 2);
-	  r = POP(jstack);
-	  r_obj = POP(jstack);
-	  if (tos_type == btos)
-	    strb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else if (tos_type == ctos | tos_type == stos)
-	    strh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else {
-	    str_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	    if (tos_type == atos) {
-	      Thumb2_Flush(jinfo);
-	      mov_reg(jinfo->codebuf, ARM_R0, r_obj);
-	      bl(jinfo->codebuf, handlers[H_APUTFIELD]);
-	    }
-	  }
-	}
-	break;
-      }
-
-      case opc_putstatic: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-
-        cache = cp->entry_at(index);
-        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
-	  int java_index = GET_JAVA_U2(code_base+bci+1);
-	  constantPoolOop pool = jinfo->method->constants();
-	  symbolOop sig = pool->signature_ref_at(java_index);
-	  jbyte *base = sig->base();
-	  jbyte c = *base;
-	  int handler = H_PUTSTATIC_WORD;
-
-	  if (c == 'J' || c == 'D') handler = H_PUTSTATIC_DW;
-	  if (c == 'B' || c == 'Z') handler = H_PUTSTATIC_B;
-	  if (c == 'C' || c == 'S') handler = H_PUTSTATIC_H;
-	  if (c == '[' || c == 'L') handler = H_PUTSTATIC_A;
-	  Thumb2_Flush(jinfo);
-	  Thumb2_save_locals(jinfo, stackdepth);
-	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  mov_imm(jinfo->codebuf, ARM_R1, index);
-	  blx(jinfo->codebuf, handlers[handler]);
-	  Thumb2_restore_locals(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  break;
-	}
-
-	TosState tos_type = cache->flag_state();
-	int field_offset = cache->f2();
-	Reg r_obj;
-
-	if (tos_type == ltos || tos_type == dtos) {
-	  Reg r_lo, r_hi;
-	  Thumb2_Fill(jinfo, 2);
-	  r_lo = POP(jstack);
-	  r_hi = POP(jstack);
-	  Thumb2_Spill(jinfo, 1, (1<<r_lo)|(1<<r_hi));
-	  r_obj = JSTACK_PREFER(jstack, ~((1<<r_lo)|(1<<r_hi)));
-	  JASSERT(r_obj != r_lo && r_obj != r_hi, "corruption in putstatic");
-	  ldr_imm(jinfo->codebuf, r_obj, Ristate, ISTATE_CONSTANTS, 1, 0);
-	  ldr_imm(jinfo->codebuf, r_obj, r_obj, CP_OFFSET + (index << 4) + 4, 1, 0);
-	  strd_imm(jinfo->codebuf, r_lo, r_hi, r_obj, field_offset, 1, 0);
-	} else {
-	  Reg r;
-	  Thumb2_Fill(jinfo, 1);
-	  r = POP(jstack);
-	  Thumb2_Spill(jinfo, 1, (1<<r));
-	  r_obj = JSTACK_PREFER(jstack, ~(1<<r));
-	  JASSERT(r_obj != r, "corruption in putstatic");
-	  ldr_imm(jinfo->codebuf, r_obj, Ristate, ISTATE_CONSTANTS, 1, 0);
-	  ldr_imm(jinfo->codebuf, r_obj, r_obj, CP_OFFSET + (index << 4) + 4, 1, 0);
-	  if (tos_type == btos)
-	    strb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else if (tos_type == ctos | tos_type == stos)
-	    strh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	  else {
-	    str_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	    if (tos_type == atos) {
-	      Thumb2_Flush(jinfo);
-	      mov_reg(jinfo->codebuf, ARM_R0, r_obj);
-	      bl(jinfo->codebuf, handlers[H_APUTFIELD]);
-	    }
-	  }
-	}
-	break;
-      }
-
-      case opc_invokestatic:
-      case opc_invokespecial: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-	unsigned loc;
-	methodOop callee;
-
-        cache = cp->entry_at(index);
-        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
-	  Thumb2_Flush(jinfo);
-	  Thumb2_invoke_save(jinfo, stackdepth);
-	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  mov_imm(jinfo->codebuf, ARM_R1, index);
-	  blx(jinfo->codebuf,
-	    handlers[opcode == opc_invokestatic ? H_INVOKESTATIC : H_INVOKESPECIAL]);
-	  Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  break;
-	}
-
-	callee = (methodOop)cache->f1();
-	if (callee->is_accessor()) {
-	  u1 *code = callee->code_base();
-	  int index = GET_NATIVE_U2(&code[2]);
-	  constantPoolCacheOop callee_cache = callee->constants()->cache();
-	  ConstantPoolCacheEntry *entry = callee_cache->entry_at(index);
-	  Reg r_obj, r;
-
-	  if (entry->is_resolved(Bytecodes::_getfield)) {
-#if 0
-	    tty->print("Inlining accessor (opcode = %s) ", opcode == opc_invokestatic ? "invokestatic" : "invokespecial");
-	    callee->print_short_name(tty);
-	    tty->print("\n");
-#endif
-	    JASSERT(cache->parameter_size() == 1, "not 1 parameter to accessor");
-
-	    TosState tos_type = entry->flag_state();
-	    int field_offset = entry->f2();
-
-	    JASSERT(tos_type == btos || tos_type == ctos || tos_type == stos || tos_type == atos || tos_type == itos, "not itos or atos");
-
-	    Thumb2_Fill(jinfo, 1);
-	    r_obj = POP(jstack);
-	    Thumb2_Spill(jinfo, 1, 0);
-	    r = JSTACK_REG(jstack);
-	    PUSH(jstack, r);
-	    if (tos_type == btos)
-	      ldrb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	    else if (tos_type == ctos)
-	      ldrh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	    else if (tos_type == stos)
-	      ldrsh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	    else
-	      ldr_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	    break;
-	  }
-	}
-
-	Thumb2_Flush(jinfo);
-  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
-	ldr_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_CONSTANTS, 1, 0);
-	mov_imm(jinfo->codebuf, ARM_R1, 0);
-  ldr_imm(jinfo->codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
-	if (opcode == opc_invokespecial)
-	  ldr_imm(jinfo->codebuf, ARM_R3, Rstack, (cache->parameter_size()-1) * sizeof(int), 1, 0);
-	ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, CP_OFFSET + (index << 4) + 4, 1, 0);
-  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET);
-	if (opcode == opc_invokespecial)
-	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 0, 1, 0); // Null pointer check - cbz better?
-	str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-	ldr_imm(jinfo->codebuf, ARM_R1, ARM_R0, METHOD_FROM_INTERPRETED, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_BCP, 1, 0);
-	str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-	  Thumb2_Debug(jinfo, H_DEBUG_METHODCALL);
-	Thumb2_invoke_save(jinfo, stackdepth);
-  sub_imm(jinfo->codebuf, Rstack, Rstack, 4);
-	ldr_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
-	mov_reg(jinfo->codebuf, ARM_R2, Rthread);
-  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK, 1, 0);
-add_imm(jinfo->codebuf, ARM_R3, ARM_R3, CODE_ALIGN_SIZE);
-//	enter_leave(jinfo->codebuf, 0);
-	blx_reg(jinfo->codebuf, ARM_R3);
-//	enter_leave(jinfo->codebuf, 1);
-  ldr_imm(jinfo->codebuf, Rthread, Ristate, ISTATE_THREAD, 1, 0);
-#ifdef USE_RLOCAL
-  ldr_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
-#endif
-	ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-	ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_STACK_LIMIT, 1, 0);
-	JASSERT(!(bc_stackinfo[bci+len] & BC_COMPILED), "code already compiled for this bytecode?");
-	Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
-	add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
-	ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
-	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
-	str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R3, 0);
-	it(jinfo->codebuf, COND_NE, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
-	break;
-      }
-
-      case opc_invokeinterface: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-	unsigned loc, loc_inc_ex;
-
-// Currently we just call the unresolved invokeinterface entry for resolved /
-// unresolved alike!
-    Thumb2_Flush(jinfo);
-    Thumb2_invoke_save(jinfo, stackdepth);
-    mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-    mov_imm(jinfo->codebuf, ARM_R1, index);
-    blx(jinfo->codebuf, handlers[H_INVOKEINTERFACE]);
-    Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	break;
-      }
-
-      case opc_invokevirtual: {
-	constantPoolCacheOop  cp = jinfo->method->constants()->cache();
-        ConstantPoolCacheEntry* cache;
-	int index = GET_NATIVE_U2(code_base+bci+1);
-	unsigned loc;
-
-        cache = cp->entry_at(index);
-        if (!cache->is_resolved((Bytecodes::Code)opcode)) {
-	  Thumb2_Flush(jinfo);
-	  Thumb2_invoke_save(jinfo, stackdepth);
-	  mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	  mov_imm(jinfo->codebuf, ARM_R1, index);
-	  blx(jinfo->codebuf, handlers[H_INVOKEVIRTUAL]);
-	  Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  break;
-	}
-
-	if (cache->is_vfinal()) {
-	  methodOop callee = (methodOop)cache->f2();
-	  if (callee->is_accessor()) {
-	    u1 *code = callee->code_base();
-	    int index = GET_NATIVE_U2(&code[2]);
-	    constantPoolCacheOop callee_cache = callee->constants()->cache();
-	    ConstantPoolCacheEntry *entry = callee_cache->entry_at(index);
-	    Reg r_obj, r;
-
-	    if (entry->is_resolved(Bytecodes::_getfield)) {
-#if 0
-	      tty->print("Inlining accessor (opcode = invokevfinal) ");
-	      callee->print_short_name(tty);
-	      tty->print("\n");
-#endif
-	      JASSERT(cache->parameter_size() == 1, "not 1 parameter to accessor");
-
-	      TosState tos_type = entry->flag_state();
-	      int field_offset = entry->f2();
-
-	      JASSERT(tos_type == btos || tos_type == ctos || tos_type == stos || tos_type == atos || tos_type == itos, "not itos or atos");
-
-	      Thumb2_Fill(jinfo, 1);
-	      r_obj = POP(jstack);
-	      Thumb2_Spill(jinfo, 1, 0);
-	      r = JSTACK_REG(jstack);
-	      PUSH(jstack, r);
-	      if (tos_type == btos)
-		ldrb_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	      else if (tos_type == ctos)
-		ldrh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	      else if (tos_type == stos)
-		ldrsh_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	      else
-		ldr_imm(jinfo->codebuf, r, r_obj, field_offset, 1, 0);
-	      break;
-	    }
-	  }
-	}
-
-	Thumb2_Flush(jinfo);
-	if (cache->is_vfinal()) {
-  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_CONSTANTS, 1, 0);
-	  mov_imm(jinfo->codebuf, ARM_R1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R3, Rstack, (cache->parameter_size()-1) * sizeof(int), 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, CP_OFFSET + (index << 4) + 8, 1, 0);
-  ldr_imm(jinfo->codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 0, 1, 0); // Null pointer check - cbz better?
-	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R1, ARM_R0, METHOD_FROM_INTERPRETED, 1, 0);
-  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET);
-	  str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-	  Thumb2_Debug(jinfo, H_DEBUG_METHODCALL);
-	Thumb2_invoke_save(jinfo, stackdepth);
-  sub_imm(jinfo->codebuf, Rstack, Rstack, 4);
-	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_BCP, 1, 0);
-	  mov_reg(jinfo->codebuf, ARM_R2, Rthread);
-  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK, 1, 0);
-add_imm(jinfo->codebuf, ARM_R3, ARM_R3, CODE_ALIGN_SIZE);
-//	  enter_leave(jinfo->codebuf, 0);
-	  blx_reg(jinfo->codebuf, ARM_R3);
-//	  enter_leave(jinfo->codebuf, 1);
-  ldr_imm(jinfo->codebuf, Rthread, Ristate, ISTATE_THREAD, 1, 0);
-#ifdef USE_RLOCAL
-  ldr_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
-#endif
-	  ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_STACK_LIMIT, 1, 0);
-	JASSERT(!(bc_stackinfo[bci+len] & BC_COMPILED), "code already compiled for this bytecode?");
-	Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
-	  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
-	  ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
-	  str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
-	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R3, 0);
-	it(jinfo->codebuf, COND_NE, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
-	  break;
-	} else {
-  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R3, Rstack, (cache->parameter_size()-1) * sizeof(int), 1, 0);
-  ldr_imm(jinfo->codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R3, 4, 1, 0);
-	  mov_imm(jinfo->codebuf, ARM_R1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R0, ARM_R3, INSTANCEKLASS_VTABLE_OFFSET + cache->f2() * 4, 1, 0);
-  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, bci+CONSTMETHOD_CODEOFFSET);
-	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R1, ARM_R0, METHOD_FROM_INTERPRETED, 1, 0);
-  str_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_BCP, 1, 0);
-	  str_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-	  Thumb2_Debug(jinfo, H_DEBUG_METHODCALL);
-	Thumb2_invoke_save(jinfo, stackdepth);
-  sub_imm(jinfo->codebuf, Rstack, Rstack, 4);
-	  ldr_imm(jinfo->codebuf, ARM_R3, ARM_R1, 0, 1, 0);
-	  mov_reg(jinfo->codebuf, ARM_R2, Rthread);
-  str_imm(jinfo->codebuf, Rstack, Ristate, ISTATE_STACK, 1, 0);
-add_imm(jinfo->codebuf, ARM_R3, ARM_R3, CODE_ALIGN_SIZE);
-//	  enter_leave(jinfo->codebuf, 0);
-	  blx_reg(jinfo->codebuf, ARM_R3);
-//	  enter_leave(jinfo->codebuf, 1);
-  ldr_imm(jinfo->codebuf, Rthread, Ristate, ISTATE_THREAD, 1, 0);
-#ifdef USE_RLOCAL
-  ldr_imm(jinfo->codebuf, Rlocals, Ristate, ISTATE_LOCALS, 1, 0);
-#endif
-	  ldr_imm(jinfo->codebuf, Rstack, Rthread, THREAD_JAVA_SP, 1, 0);
-	  ldr_imm(jinfo->codebuf, ARM_R2, Ristate, ISTATE_STACK_LIMIT, 1, 0);
-	JASSERT(!(bc_stackinfo[bci+len] & BC_COMPILED), "code already compiled for this bytecode?");
-	Thumb2_invoke_restore(jinfo, bc_stackinfo[bci+len] & ~BC_FLAGS_MASK);
-	  ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
-	  add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
-	  ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
-	  str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
-	  str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R3, 0);
-	it(jinfo->codebuf, COND_NE, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
-	}
-	break;
-      }
-
-      case opc_jsr_w:
-      case opc_jsr: {
-	Thumb2_Jsr(jinfo , bci, stackdepth);
-	break;
-      }
-
-      case opc_ret: {
-	Thumb2_Exit(jinfo, H_RET, bci, stackdepth);
-	break;
-      }
-
-      case opc_athrow:
-	Thumb2_Exit(jinfo, H_ATHROW, bci, stackdepth);
-	break;
-
-      case opc_goto: {
-	int offset = GET_JAVA_S2(jinfo->code_base + bci + 1);
-	Thumb2_Flush(jinfo);
-	bci = Thumb2_Goto(jinfo, bci, offset, len);
-	len = 0;
-	break;
-      }
-
-      case opc_goto_w: {
-	int offset = GET_JAVA_U4(jinfo->code_base + bci + 1);
-	Thumb2_Flush(jinfo);
-	bci = Thumb2_Goto(jinfo, bci, offset, len);
-	len = 0;
-	break;
-      }
-
-      case opc_ifeq:
-      case opc_ifne:
-      case opc_iflt:
-      case opc_ifge:
-      case opc_ifgt:
-      case opc_ifle:
-      case opc_ifnull:
-      case opc_ifnonnull: {
-	Reg r;
-	unsigned cond = opcode - opc_ifeq;
-	if (opcode >= opc_ifnull) cond = opcode - opc_ifnull;
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Flush(jinfo);
-	cmp_imm(jinfo->codebuf, r, 0);
-	bci = Thumb2_Branch(jinfo, bci, cond);
-	len = 0;
-	break;
-      }
-
-      case opc_if_icmpeq:
-      case opc_if_icmpne:
-      case opc_if_icmplt:
-      case opc_if_icmpge:
-      case opc_if_icmpgt:
-      case opc_if_icmple:
-      case opc_if_acmpeq:
-      case opc_if_acmpne: {
-	Reg r_lho, r_rho;
-	unsigned cond = opcode - opc_if_icmpeq;
-	if (opcode >= opc_if_acmpeq) cond = opcode - opc_if_acmpeq;
-	Thumb2_Fill(jinfo, 2);
-	r_rho = POP(jstack);
-	r_lho = POP(jstack);
-	Thumb2_Flush(jinfo);
-	cmp_reg(jinfo->codebuf, r_lho, r_rho);
-	bci = Thumb2_Branch(jinfo, bci, cond);
-	len = 0;
-	break;
-      }
-
-      case opc_return:
-      case opc_dreturn:
-      case opc_lreturn:
-      case opc_ireturn:
-      case opc_freturn:
-      case opc_areturn:
-	Thumb2_Return(jinfo, opcode);
-	if (!jinfo->compiled_return) jinfo->compiled_return = bci;
-	break;
-
-      case opc_return_register_finalizer: {
-	Thumb2_Stack *jstack = jinfo->jstack;
-	Reg r, r_tmp;
-	unsigned loc_eq;
-
-	Thumb2_Flush(jinfo);
-	Thumb2_Load(jinfo, 0, stackdepth);
-	r = POP(jstack);
-	r_tmp = Thumb2_Tmp(jinfo, (1<<r));
-	ldr_imm(jinfo->codebuf, r_tmp, r, 4, 1, 0);
-	ldr_imm(jinfo->codebuf, r_tmp, r_tmp, KLASS_PART+KLASS_ACCESSFLAGS, 1, 0);
-	tst_imm(jinfo->codebuf, r_tmp, JVM_ACC_HAS_FINALIZER);
-	loc_eq = forward_16(jinfo->codebuf);
-	Thumb2_save_locals(jinfo, stackdepth);
-	mov_reg(jinfo->codebuf, ARM_R1, r);
-	ldr_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
-	ldr_imm(jinfo->codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
-	add_imm(jinfo->codebuf, ARM_R0, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	str_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
-	sub_imm(jinfo->codebuf, ARM_R0, Rstack, 4);
-	str_imm(jinfo->codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
-
-	mov_reg(jinfo->codebuf, ARM_R0, Rthread);
-	mov_imm(jinfo->codebuf, ARM_R3, (u32)_ZN18InterpreterRuntime18register_finalizerEP10JavaThreadP7oopDesc);
-	blx_reg(jinfo->codebuf, ARM_R3);
-
-	ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R3, 0);
-	it(jinfo->codebuf, COND_NE, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	bcc_patch(jinfo->codebuf, COND_EQ, loc_eq);
-	Thumb2_Return(jinfo, opc_return);
-	break;
-      }
-
-      case opc_new: {
-	unsigned loc;
-
-	Thumb2_Flush(jinfo);
-	mov_imm(jinfo->codebuf, ARM_R1, GET_JAVA_U2(code_base+bci+1));
-	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
-      Thumb2_save_locals(jinfo, stackdepth);
-	bl(jinfo->codebuf, handlers[H_NEW]);
-      Thumb2_restore_locals(jinfo, stackdepth);
-	cmp_imm(jinfo->codebuf, ARM_R0, 0);
-	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_aastore: {
-	Reg src[3], dst[3];
-	unsigned loc;
-
-	Thumb2_Fill(jinfo, 3);
-	src[0] = POP(jstack);	// value
-	src[1] = POP(jstack);	// index
-	src[2] = POP(jstack);	// arrayref
-	Thumb2_Flush(jinfo);
-	dst[0] = ARM_R1;
-	dst[1] = ARM_R2;
-	dst[2] = ARM_R3;
-	mov_multiple(jinfo->codebuf, dst, src, 3);
-	mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-      Thumb2_save_locals(jinfo, stackdepth - 3);	// 3 args popped above
-	bl(jinfo->codebuf, handlers[H_AASTORE]);
-      Thumb2_restore_locals(jinfo, stackdepth - 3);
-	cmp_imm(jinfo->codebuf, ARM_R0, 0);
-	it(jinfo->codebuf, COND_NE, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	break;
-      }
-
-      case opc_instanceof: {
-	unsigned loc;
-	Reg r;
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Flush(jinfo);
-	mov_reg(jinfo->codebuf, ARM_R2, r);
-	mov_imm(jinfo->codebuf, ARM_R1, GET_JAVA_U2(code_base+bci+1));
-	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
-      Thumb2_save_locals(jinfo, stackdepth - 1);
-	bl(jinfo->codebuf, handlers[H_INSTANCEOF]);
-      Thumb2_restore_locals(jinfo, stackdepth - 1);	// 1 arg popped above
-	cmp_imm(jinfo->codebuf, ARM_R0, (unsigned)-1);
-	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_checkcast: {
-	unsigned loc;
-	Reg r;
-
-	Thumb2_Fill(jinfo, 1);
-	r = TOS(jstack);
-	Thumb2_Flush(jinfo);
-	mov_reg(jinfo->codebuf, ARM_R2, r);
-	mov_imm(jinfo->codebuf, ARM_R1, GET_JAVA_U2(code_base+bci+1));
-	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
-      Thumb2_save_locals(jinfo, stackdepth);
-	bl(jinfo->codebuf, handlers[H_CHECKCAST]);
-      Thumb2_restore_locals(jinfo, stackdepth);
-	cmp_imm(jinfo->codebuf, ARM_R0, 0);
-	it(jinfo->codebuf, COND_NE, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	break;
-      }
-
-      case opc_newarray: {
-	Reg r;
-	unsigned loc;
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Flush(jinfo);
-	mov_reg(jinfo->codebuf, ARM_R2, r);
-	mov_imm(jinfo->codebuf, ARM_R1, code_base[bci+1]);
-	mov_imm(jinfo->codebuf, ARM_R3, bci+CONSTMETHOD_CODEOFFSET);
-      Thumb2_save_locals(jinfo, stackdepth-1);
-	bl(jinfo->codebuf, handlers[H_NEWARRAY]);
-      Thumb2_restore_locals(jinfo, stackdepth-1);
-	ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
-	mov_imm(jinfo->codebuf, ARM_R2, 0);
-  	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R0, 0);
-	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_anewarray: {
-	Reg r;
-	unsigned loc;
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-	Thumb2_Flush(jinfo);
-	mov_reg(jinfo->codebuf, ARM_R3, r);
-	mov_imm(jinfo->codebuf, ARM_R2, GET_JAVA_U2(code_base+bci+1));
-	mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-      Thumb2_save_locals(jinfo, stackdepth-1);
-	bl(jinfo->codebuf, handlers[H_ANEWARRAY]);
-      Thumb2_restore_locals(jinfo, stackdepth-1);
-	ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
-	mov_imm(jinfo->codebuf, ARM_R2, 0);
-  	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R0, 0);
-	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_multianewarray: {
-	unsigned loc;
-
-	Thumb2_Flush(jinfo);
-	mov_imm(jinfo->codebuf, ARM_R0, bci+CONSTMETHOD_CODEOFFSET);
-	mov_imm(jinfo->codebuf, ARM_R1, code_base[bci+3] * 4);
-      Thumb2_save_locals(jinfo, stackdepth);
-	bl(jinfo->codebuf, handlers[H_MULTIANEWARRAY]);
-      Thumb2_restore_locals(jinfo, stackdepth - code_base[bci+3]);
-	ldr_imm(jinfo->codebuf, ARM_R0, Rthread, THREAD_VM_RESULT, 1, 0);
-	mov_imm(jinfo->codebuf, ARM_R2, 0);
-  	str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_VM_RESULT, 1, 0);
-	cmp_imm(jinfo->codebuf, ARM_R0, 0);
-	it(jinfo->codebuf, COND_EQ, IT_MASK_T);
-	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
-	PUSH(jstack, ARM_R0);
-	break;
-      }
-
-      case opc_arraylength: {
-	Reg r_obj, r_len;
-
-	Thumb2_Fill(jinfo, 1);
-	r_obj = POP(jstack);
-	Thumb2_Spill(jinfo, 1, 0);
-	r_len = JSTACK_REG(jstack);
-	PUSH(jstack, r_len);
-	ldr_imm(jinfo->codebuf, r_len, r_obj, 8, 1, 0);
-	break;
-      }
-
-      case opc_lookupswitch: {
-	unsigned w;
-	unsigned nbci;
-	int def;
-	int npairs;	// The Java spec says signed but must be >= 0??
-	unsigned *table, *tablep;
-	unsigned r;
-	unsigned oldidx;
-	unsigned table_loc;
-	int i;
-
-	nbci = bci & ~3;
-	w = *(unsigned int *)(code_base + nbci + 4);
-	def = bci + (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 8);
-	npairs = (int)BYTESEX_REVERSE(w);
-	table = (unsigned int *)(code_base + nbci + 12);
-
-	Thumb2_Fill(jinfo, 1);
-	r = POP(jstack);
-
-	table_loc = out_loc(jinfo->codebuf);
-	for (i = 0, tablep = table; i < npairs; i++) {
-	  unsigned match;
-
-	  w = tablep[0];
-	  match = BYTESEX_REVERSE(w);
-	  tablep += 2;
-	  cmp_imm(jinfo->codebuf, r, match);
-	  t2_bug_align(jinfo->codebuf);
-	  forward_32(jinfo->codebuf);
-	}
-	t2_bug_align(jinfo->codebuf);
-	forward_32(jinfo->codebuf);
-	Thumb2_codegen(jinfo, bci+len);
-
-	oldidx = codebuf->idx;
-	codebuf->idx = table_loc >> 1;
-	for (i = 0, tablep = table; i < npairs; i++) {
-	  unsigned match;
-	  unsigned dest;
-	  unsigned loc;
-
-	  w = tablep[0];
-	  match = BYTESEX_REVERSE(w);
-	  w = tablep[1];
-	  dest = bci + (int)BYTESEX_REVERSE(w);
-	  tablep += 2;
-	  cmp_imm(jinfo->codebuf, r, match);
-	  JASSERT(jinfo->bc_stackinfo[dest] & BC_COMPILED, "code not compiled");
-	  t2_bug_align(jinfo->codebuf);
-	  loc = forward_32(jinfo->codebuf);
-	  branch_patch(jinfo->codebuf, COND_EQ, loc, jinfo->bc_stackinfo[dest] & ~BC_FLAGS_MASK);
-	}
-	JASSERT(jinfo->bc_stackinfo[def] & BC_COMPILED, "default in lookupswitch not compiled");
-	t2_bug_align(jinfo->codebuf);
-	branch_uncond_patch(jinfo->codebuf, out_loc(jinfo->codebuf), jinfo->bc_stackinfo[def] & ~BC_FLAGS_MASK);
-	codebuf->idx = oldidx;
-
-	bci = (unsigned)-1;
-	len = 0;
-
-	break;
-      }
-
-      case opc_tableswitch: {
-	int low, high, i;
-	unsigned w;
-	unsigned *table, *tablep;
-	unsigned nbci;
-	int def;
-	unsigned loc, table_loc;
-	unsigned r, rs;
-	unsigned oldidx;
-	unsigned negative_offsets, negative_branch_table;
-
-	nbci = bci & ~3;
-	w = *(unsigned int *)(code_base + nbci + 8);
-	low = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 12);
-	high = (int)BYTESEX_REVERSE(w);
-	w = *(unsigned int *)(code_base + nbci + 4);
-	def = bci + (int)BYTESEX_REVERSE(w);
-	table = (unsigned int *)(code_base + nbci + 16);
-
-	Thumb2_Fill(jinfo, 1);
-	rs = POP(jstack);
-	r = Thumb2_Tmp(jinfo, (1<<rs));
-	sub_imm(jinfo->codebuf, r, rs, low);
-	cmp_imm(jinfo->codebuf, r, (high-low)+1);
-	loc = 0;
-	if (jinfo->bc_stackinfo[def] & BC_COMPILED)
-	  branch(jinfo->codebuf, COND_CS, jinfo->bc_stackinfo[def] & ~BC_FLAGS_MASK);
-	else
-	  loc = forward_32(jinfo->codebuf);
-	tbh(jinfo->codebuf, ARM_PC, r);
-	table_loc = out_loc(jinfo->codebuf);
-	negative_offsets = 0;
-	for (i = low, tablep = table; i <= high; i++) {
-	  int offset;
-	  w = *tablep++;
-	  offset = (int)BYTESEX_REVERSE(w);
-	  if (offset < 0) negative_offsets++;
-	  out_16(jinfo->codebuf, 0);
-	}
-	negative_branch_table = out_loc(jinfo->codebuf);
-	for (i = 0; i < (int)negative_offsets; i++) {
-	  t2_bug_align(jinfo->codebuf);
-	  out_16x2(jinfo->codebuf, 0);
-	}
-
-	Thumb2_codegen(jinfo, bci+len);
-
-	if (loc) {
-	  JASSERT(jinfo->bc_stackinfo[def] & BC_COMPILED, "def not compiled in tableswitch");
-	  branch_patch(jinfo->codebuf, COND_CS, loc, jinfo->bc_stackinfo[def] & ~BC_FLAGS_MASK);
-	}
-
-	oldidx = codebuf->idx;
-	codebuf->idx = table_loc >> 1;
-	for (i = low, tablep = table; i <= high; i++) {
-	  unsigned dest;
-	  int offset;
-
-	  w = *tablep++;
-	  offset = (int)BYTESEX_REVERSE(w);
-	  dest = bci + offset;
-	  JASSERT(jinfo->bc_stackinfo[dest] & BC_COMPILED, "code not compiled");
-	  dest = jinfo->bc_stackinfo[dest] & ~BC_FLAGS_MASK;
-	  if (offset < 0) {
-	    unsigned oldidx;
-	    out_16(jinfo->codebuf, (negative_branch_table >> 1) - (table_loc >> 1));
-	    PATCH(negative_branch_table) {
-	      t2_bug_align(jinfo->codebuf);
-	      branch_uncond_patch(jinfo->codebuf, out_loc(jinfo->codebuf), dest);
-	      negative_branch_table = out_loc(jinfo->codebuf);
-	    } HCTAP;
-	  } else {
-	    JASSERT((dest & 1) == 0 && (table_loc & 1) == 0, "unaligned code");
-	    offset = (dest >> 1) - (table_loc >> 1);
-	    if (offset >= 65536) {
-	      longjmp(compiler_error_env, COMPILER_RESULT_FAILED);
-	    }
-	    out_16(jinfo->codebuf, offset);
-	  }
-	}
-	codebuf->idx = oldidx;
-	bci = (unsigned)-1;
-	len = 0;
-	break;
-      }
-
-      case opc_wide: {
-	unsigned local = GET_JAVA_U2(code_base + bci + 2);
-	opcode = code_base[bci+1];
-	if (opcode == opc_iinc) {
-	  int constant = GET_JAVA_S2(code_base + bci + 4);
-	  unsigned r = jinfo->jregs->r_local[local];
-	  
-	  if (!r) {
-	    int nlocals = jinfo->method->max_locals();
-	    r = ARM_IP;
-	    stackdepth -= jstack->depth;
-	    if (jinfo->method->is_synchronized()) stackdepth += frame::interpreter_frame_monitor_size();
-	    load_local(jinfo, r, local, stackdepth);
-	    add_imm(jinfo->codebuf, r, r, constant);
-	    store_local(jinfo, r, local, stackdepth);
-	  } else {
-	    Thumb2_Corrupt(jinfo, r, 0);
-	    add_imm(jinfo->codebuf, r, r, constant);
-	  }
-	} else if (opcode == opc_ret) {
-	  Thumb2_Exit(jinfo, H_RET, bci, stackdepth);
-	} else {
-	  if (opcode == opc_iload ||
-	  	opcode == opc_fload || opcode == opc_aload)
-	    Thumb2_Load(jinfo, local, stackdepth);
-	  else if (opcode == opc_lload || opcode == opc_dload)
-	    Thumb2_LoadX2(jinfo, local, stackdepth);
-	  else if (opcode == opc_istore ||
-	  	opcode == opc_fstore || opcode == opc_astore)
-	    Thumb2_Store(jinfo, local, stackdepth);
-	  else if (opcode == opc_lstore || opcode == opc_dstore)
-	    Thumb2_StoreX2(jinfo, local, stackdepth);
-	  else fatal1("Undefined wide opcode %d\n", opcode);
-	}
-	break;
-      }
-
-      default:
-	JASSERT(0, "unknown bytecode");
-	break;
-    }
-    bci += len;
-#ifdef T2EE_PRINT_DISASS
-    if (len == 0) {
-      if (start_idx == jinfo->codebuf->idx) start_bci[start_idx] = -1;
-    } else
-      end_bci[start_idx] = bci;
-#endif
-  }
-}
-
-#define BEG_BCI_OFFSET		0
-#define END_BCI_OFFSET		1
-#define HANDLER_BCI_OFFSET	2
-#define KLASS_INDEX_OFFSET	3
-#define ENTRY_SIZE		4
-
-extern "C" int Thumb2_lr_to_bci(unsigned lr, methodOop method, Reg *regs, unsigned *locals)
-{
-  Compiled_Method *cmethod = compiled_method_list;
-  typeArrayOop table = method->exception_table();
-  constantPoolOop pool = method->constants();
-  int length = table->length();
-
-  while (cmethod) {
-    unsigned *exception_table = cmethod->exception_table;
-    if (exception_table) {
-      unsigned code_base = (unsigned)cmethod;
-      if (code_base <= lr && lr <= (unsigned)exception_table) {
-	int exception_index = -1;
-	unsigned exception_found = 0;
-
-	for (int i = 0; i < length; i += ENTRY_SIZE) {
-	  unsigned offsets = *exception_table++;
-	  unsigned exc_beg = code_base + ((offsets >> 16) << 1);
-	  unsigned exc_end = code_base + ((offsets & 0xffff) << 1);
-
-	  if (exc_beg <= lr && lr <= exc_end) {
-	    if (exc_beg > exception_found) {
-	      // With nested try catch blocks, choose the most deeply nested
-	      exception_found = exc_beg;
-	      exception_index = i;
-	    }	    
-	  }
-	  if (exception_index >= 0) {
-	    if (regs) {
-	      for (unsigned i = 0; i < PREGS; i++) {
-		int local = cmethod->regusage[i];
-		if (local >= 0) {
-		  locals[-local] = regs[i];
-		}
-	      }
-	    }
-	    return table->int_at(exception_index + BEG_BCI_OFFSET);
-	  }
-	}
-      }
-    }
-    cmethod = cmethod->next;
-  }
-  return -1;
-}
-
-void Thumb2_generate_exception_table(Compiled_Method *cmethod, Thumb2_Info *jinfo)
-{
-  methodOop method = jinfo->method;
-  typeArrayOop table = method->exception_table();
-  constantPoolOop pool = method->constants();
-  int length = table->length();
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-
-  cmethod->exception_table = (unsigned *)out_pos(jinfo->codebuf);
-  for (int i = 0; i < length; i += ENTRY_SIZE) {
-    int beg_bci = table->int_at(i + BEG_BCI_OFFSET);
-    int end_bci = table->int_at(i + END_BCI_OFFSET);
-    unsigned stackinfo;
-    unsigned beg_offset, end_offset;
-
-    stackinfo = bc_stackinfo[beg_bci];
-    beg_offset = (stackinfo & ~BC_FLAGS_MASK) >> 1;
-    stackinfo = bc_stackinfo[end_bci];
-    end_offset = (stackinfo & ~BC_FLAGS_MASK) >> 1;
-    if (!(beg_offset != 0 && end_offset >= beg_offset && end_offset < 65536)) {
-	longjmp(compiler_error_env, COMPILER_RESULT_FAILED);
-    }
-    out_32(jinfo->codebuf, (beg_offset << 16) | (end_offset));
-  }
-}
-
-void Thumb2_tablegen(Compiled_Method *cmethod, Thumb2_Info *jinfo)
-{
-  unsigned code_size = jinfo->code_size;
-  jubyte *code_base = jinfo->code_base;
-  unsigned *bc_stackinfo = jinfo->bc_stackinfo;
-  unsigned bci;
-  unsigned count = 0;
-  unsigned i;
-  CodeBuf *codebuf = jinfo->codebuf;
-
-  cmethod->osr_table = (unsigned *)out_pos(jinfo->codebuf);
-  out_32(codebuf, 0);
-  bc_stackinfo[0] |= BC_BACK_TARGET;
-  for (bci = 0; bci < code_size;) {
-    unsigned stackinfo = bc_stackinfo[bci];
-    unsigned bytecodeinfo;
-    unsigned opcode;
-
-    if (stackinfo & BC_BACK_TARGET) {
-      unsigned code_offset = (stackinfo & ~BC_FLAGS_MASK) >> 1;
-      JASSERT(stackinfo & BC_COMPILED, "back branch target not compiled???");
-      if (code_offset >= 65536) {
-	longjmp(compiler_error_env, COMPILER_RESULT_FAILED);
-      }
-//      JASSERT(code_offset < (1<<16), "oops, codesize too big");
-      out_32(codebuf, (bci << 16) | code_offset);
-      count++;
-    }
-
-    opcode = code_base[bci];
-    bytecodeinfo = bcinfo[opcode];
-    if (!BCI_SPECIAL(bytecodeinfo)) {
-      bci += BCI_LEN(bytecodeinfo);
-      continue;
-    } else {
-      int len = Bytecodes::length_for((Bytecodes::Code)opcode);
-      if (len <= 0) len = Bytecodes::special_length_at((address)(code_base+bci), (address)(code_base+code_size));
-      bci += len;
-    }
-  }
-  *cmethod->osr_table = count;
-  if (jinfo->method->has_exception_handler())
-    Thumb2_generate_exception_table(cmethod, jinfo);
-}
-
-extern "C" void Thumb2_Clear_Cache(char *base, char *limit);
-#define IS_COMPILED(e, cb) ((e) >= (unsigned)(cb) && (e) < (unsigned)(cb) + (cb)->size)
-
-unsigned Thumb2_osr_from_bci(Compiled_Method *cmethod, unsigned bci)
-{
-  unsigned *osr_table;
-  unsigned count;
-  unsigned i;
-
-  osr_table = cmethod->osr_table;
-  if (!osr_table) return 0;
-  count = *osr_table++;
-  for (i = 0; i < count; i++) {
-    unsigned u = *osr_table++;
-
-    if (bci == (u>>16)) return (u & 0xffff) << 1;
-  }
-  return 0;
-}
-
-static int DebugSwitch = 1;
-
-extern "C" void Debug_Ignore_Safepoints(void)
-{
-	printf("Ignore Safepoints\n");
-}
-
-extern "C" void Debug_Notice_Safepoints(void)
-{
-	printf("Notice Safepoints\n");
-}
-
-extern "C" void Debug_ExceptionReturn(interpreterState istate, intptr_t *stack)
-{
-  JavaThread *thread = istate->thread();
-
-  if (thread->has_pending_exception()) {
-    Handle ex(thread, thread->pending_exception());
-    tty->print_cr("Exception %s", Klass::cast(ex->klass())->external_name());
-  }
-}
-
-extern "C" void Debug_Stack(intptr_t *stack)
-{
-  int i;
-  char msg[16];
-
-  tty->print("  Stack:");
-  for (i = 0; i < 6; i++) {
-    tty->print(" [");
-    sprintf(msg, "%d", i);
-    tty->print(msg);
-    tty->print("] = ");
-    sprintf(msg, "%08x", (int)stack[i]);
-    tty->print(msg);
-  }
-  tty->cr();
-}
-
-extern "C" void Debug_MethodEntry(interpreterState istate, intptr_t *stack, methodOop callee)
-{
-#if 0
-  if (DebugSwitch) {
-    methodOop method = istate->method();
-    tty->print("Entering ");
-    callee->print_short_name(tty);
-    tty->print(" from ");
-    method->print_short_name(tty);
-    tty->cr();
-    Debug_Stack(stack);
-    tty->flush();
-  }
-#endif
-}
-
-extern "C" void Debug_MethodExit(interpreterState istate, intptr_t *stack)
-{
-  if (DebugSwitch) {
-    methodOop method = istate->method();
-    JavaThread *thread = istate->thread();
-    oop exc = thread->pending_exception();
-
-    if (!exc) return;
-    tty->print("Leaving ");
-    method->print_short_name(tty);
-    tty->cr();
-    Debug_Stack(stack);
-    tty->flush();
-    if (exc) tty->print_cr("Exception %s", exc->print_value_string());
-  }
-}
-
-extern "C" void Debug_MethodCall(interpreterState istate, intptr_t *stack, methodOop callee)
-{
-#if 0
-  if (DebugSwitch) {
-    methodOop method = istate->method();
-    tty->print("Calling ");
-    callee->print_short_name(tty);
-    tty->print(" from ");
-    method->print_short_name(tty);
-    tty->cr();
-    Debug_Stack(stack);
-    tty->flush();
-  }
-#endif
-}
-
-extern "C" int Debug_irem_Handler(int a, int b)
-{
-	printf("%d %% %d\n", a, b);
-	return a%b;
-}
-
-extern "C" void Thumb2_Install(methodOop mh, u32 entry);
-
-#define IS_COMPILED(e, cb) ((e) >= (unsigned)(cb) && (e) < (unsigned)(cb) + (cb)->size)
-
-extern "C" unsigned cmpxchg_ptr(unsigned new_value, volatile unsigned *ptr, unsigned cmp_value);
-static volatile unsigned compiling;
-static unsigned CompileCount = 0;
-static unsigned MaxCompile = 130;
-
-#define COMPILE_ONLY	0
-#define COMPILE_COUNT	0
-#define DISASS_AFTER	0
-//#define COMPILE_LIST	0
-
-#ifdef COMPILE_LIST
-static const char *compile_list[] = {
-	0
-};
-#endif
-
-static unsigned compiled_methods = 0;
-
-#ifdef T2EE_PRINT_STATISTICS
-static unsigned bytecodes_compiled = 0;
-static unsigned arm_code_generated = 0;
-static unsigned total_zombie_bytes = 0;
-static clock_t total_compile_time = 0;
-#endif
-
-extern unsigned CPUInfo;
-static int DisableCompiler = 0;
-
-extern "C" unsigned long long Thumb2_Compile(JavaThread *thread, unsigned branch_pc)
-{
-  HandleMark __hm(thread);
-  frame fr = thread->last_frame();
-  methodOop method = fr.interpreter_frame_method();
-  symbolOop name = method->name();
-  symbolOop sig = method->signature();
-  jbyte *base = sig->base();;
-
-  jubyte *code_base = (jubyte *)method->code_base();
-  int code_size = method->code_size();
-  InvocationCounter* ic = method->invocation_counter();
-  InvocationCounter* bc = method->backedge_counter();
-  Thumb2_Info jinfo_str;
-  CodeBuf codebuf_str;
-  Thumb2_Stack jstack_str;
-  Thumb2_Registers jregs_str;
-  int idx;
-  u32 code_handle, slow_entry;
-  Thumb2_CodeBuf *cb = thumb2_codebuf;
-  int rc;
-  char *saved_hp;
-  Compiled_Method *cmethod;
-  u32 compiled_offset;
-  Thumb2_Entrypoint thumb_entry;
-  int compiled_accessor;
-
-  if (DisableCompiler || method->is_not_compilable()) {
-	ic->set(ic->state(), 1);
-	bc->set(ic->state(), 1);
-	return 0;
-  }
-
-  slow_entry = *(unsigned *)method->from_interpreted_entry();
-  if (IS_COMPILED(slow_entry, cb)) {
-    cmethod = (Compiled_Method *)(slow_entry & ~TBIT);
-    compiled_offset = Thumb2_osr_from_bci(cmethod, branch_pc);
-    if (compiled_offset == 0) return 0;
-    thumb_entry.compiled_entrypoint = slow_entry + compiled_offset;
-    thumb_entry.osr_entry = (unsigned)cmethod->osr_entry | TBIT;
-    return *(unsigned long long *)&thumb_entry;
-  }
-
-  ic->decay();
-  bc->decay();
-
-  // Dont compile anything with code size >= 32K.
-  // We rely on the bytecode index fitting in 16 bits
-  //
-  // Dont compile anything with max stack + maxlocal > 1K
-  // The range of an LDR in T2 is -4092..4092
-  // Othersize we have difficulty access the locals from the stack pointer
-  //
-  if (code_size > THUMB2_MAX_BYTECODE_SIZE ||
-		(method->max_locals() + method->max_stack()) >= 1000 ||
-		method->has_monitor_bytecodes()) {
-        method->set_not_compilable();
-	return 0;
-  }
-
-  if (COMPILE_COUNT && compiled_methods == COMPILE_COUNT) return 0;
-
-  if (COMPILE_ONLY) {
-    if (strcmp(name->as_C_string(), COMPILE_ONLY) != 0) return 0;
-  }
-
-#ifdef COMPILE_LIST
-  {
-	const char **argv = compile_list;
-	const char *s;
-	while (s = *argv++) {
-		if (strcmp(s, method->name_and_sig_as_C_string()) == 0)
-			break;
-	}
-	if (!s) return 0;
-  }
-#endif
-
-  saved_hp = cb->hp;
-  if (rc = setjmp(compiler_error_env)) {
-    cb->hp = saved_hp;
-    if (rc == COMPILER_RESULT_FAILED)
-        method->set_not_compilable();
-    if (rc == COMPILER_RESULT_FATAL)
-	DisableCompiler = 1;
-    compiling = 0;
-    return 0;
-  }
-
-  if (cmpxchg_ptr(1, &compiling, 0)) return 0;
-
-#ifdef T2EE_PRINT_STATISTICS
-  clock_t compile_time = clock();
-#endif
-
-#ifdef T2EE_PRINT_COMPILATION
-  if (t2ee_print_compilation) {
-    fprintf(stderr, "Compiling %d %c%c %s\n",
-	compiled_methods,
-	method->is_synchronized() ? 'S' : ' ',
-	method->has_exception_handler() ? 'E' : ' ',
-	method->name_and_sig_as_C_string());
-  }
-#endif
-
-  memset(bc_stackinfo, 0, code_size * sizeof(unsigned));
-  memset(locals_info, 0, method->max_locals() * sizeof(unsigned));
-#ifdef T2EE_PRINT_DISASS
-  memset(start_bci, 0xff, sizeof(start_bci));
-  memset(end_bci, 0xff, sizeof(end_bci));
-#endif
-
-  jinfo_str.thread = thread;
-  jinfo_str.method = method;
-  jinfo_str.code_base = code_base;
-  jinfo_str.code_size = code_size;
-  jinfo_str.bc_stackinfo = bc_stackinfo;
-  jinfo_str.locals_info = locals_info;
-  jinfo_str.compiled_return = 0;
-  jinfo_str.zombie_bytes = 0;
-  jinfo_str.is_leaf = 1;
-
-  Thumb2_local_info_from_sig(&jinfo_str, method, base);
-
-  Thumb2_pass1(&jinfo_str, 0);
-  Thumb2_pass2(&jinfo_str, 0, 0);
-
-  codebuf_str.codebuf = (unsigned short *)cb->hp;
-  codebuf_str.idx = 0;
-  codebuf_str.limit = (unsigned short *)cb->sp - (unsigned short *)cb->hp;
-
-  jstack_str.stack = stack;
-  jstack_str.depth = 0;
-
-  memset(r_local, 0, method->max_locals() * sizeof(unsigned));
-
-  jregs_str.r_local = r_local;
-
-  jinfo_str.codebuf = &codebuf_str;
-  jinfo_str.jstack = &jstack_str;
-  jinfo_str.jregs = &jregs_str;
-
-  jregs_str.pregs[0] = JAZ_V1;
-  jregs_str.pregs[1] = JAZ_V2;
-  jregs_str.pregs[2] = JAZ_V3;
-  jregs_str.pregs[3] = JAZ_V4;
-
-#ifndef USE_RLOCAL
-  jregs_str.pregs[4] = JAZ_V5;
-#endif
-
-  jregs_str.npregs = PREGS;
-
-  Thumb2_RegAlloc(&jinfo_str);
-
-  slow_entry = out_align(&codebuf_str, CODE_ALIGN);
-  cmethod = (Compiled_Method *)slow_entry;
-  slow_entry |= TBIT;
-
-  cb->hp += codebuf_str.idx * 2;
-  codebuf_str.codebuf = (unsigned short *)cb->hp;
-  codebuf_str.idx = 0;
-  codebuf_str.limit = (unsigned short *)cb->sp - (unsigned short *)cb->hp;
-
-  compiled_accessor = 1;
-  if (!method->is_accessor() || !Thumb2_Accessor(&jinfo_str)) {
-    Thumb2_Enter(&jinfo_str);
-    Thumb2_codegen(&jinfo_str, 0);
-    compiled_accessor = 0;
-  }
-
-#ifdef T2EE_PRINT_DISASS
-  if (DISASS_AFTER == 0 || compiled_methods >= DISASS_AFTER)
-    if (t2ee_print_disass)
-	Thumb2_disass(&jinfo_str);
-#endif
-
-  for (int i = 0; i < PREGS; i++)
-    cmethod->regusage[i] = jregs_str.mapping[i];
-
-  Thumb2_Clear_Cache(cb->hp, cb->hp + codebuf_str.idx * 2);
-
-#ifdef T2EE_PRINT_STATISTICS
-  compile_time = clock() - compile_time;
-  total_compile_time += compile_time;
-
-  if (t2ee_print_statistics) {
-    unsigned codegen = codebuf_str.idx * 2;
-    bytecodes_compiled += code_size;
-    arm_code_generated += codegen;
-    total_zombie_bytes += jinfo_str.zombie_bytes;
-    fprintf(stderr, "%d bytecodes => %d bytes code in %.2f sec, totals: %d => %d in %.2f sec\n",
-      code_size, codegen, (double)compile_time/(double)CLOCKS_PER_SEC,
-    bytecodes_compiled, arm_code_generated, (double)total_compile_time/(double)CLOCKS_PER_SEC);
-  }
-#endif
-
-  code_handle = out_align(&codebuf_str, sizeof(address));
-
-  out_32(&codebuf_str, slow_entry);
-
-  if (!compiled_accessor)
-    Thumb2_tablegen(cmethod, &jinfo_str);
-
-  cb->hp += codebuf_str.idx * 2;
-
-  *compiled_method_list_tail_ptr = cmethod;
-  compiled_method_list_tail_ptr = &(cmethod->next);
-
-  Thumb2_Install(method, code_handle);
-
-  compiled_methods++;
-
-  compiling = 0;
-
-  compiled_offset = Thumb2_osr_from_bci(cmethod, branch_pc);
-  if (compiled_offset == 0) return 0;
-  thumb_entry.compiled_entrypoint = slow_entry + compiled_offset;
-  thumb_entry.osr_entry = (unsigned)cmethod->osr_entry | TBIT;
-  return *(unsigned long long *)&thumb_entry;
-}
-
-extern "C" void Thumb2_DivZero_Handler(void);
-extern "C" void Thumb2_ArrayBounds_Handler(void);
-extern "C" void Thumb2_Handle_Exception(void);
-extern "C" void Thumb2_Handle_Exception_NoRegs(void);
-extern "C" void Thumb2_Exit_To_Interpreter(void);
-extern "C" void Thumb2_Stack_Overflow(void);
-
-extern "C" void __divsi3(void);
-extern "C" void __aeabi_ldivmod(void);
-extern "C" void __aeabi_i2f(void);
-extern "C" void __aeabi_i2d(void);
-extern "C" void __aeabi_l2f(void);
-extern "C" void __aeabi_l2d(void);
-extern "C" void __aeabi_f2d(void);
-extern "C" void __aeabi_d2f(void);
-extern "C" void Helper_new(void);
-extern "C" void Helper_instanceof(void);
-extern "C" void Helper_checkcast(void);
-extern "C" void Helper_aastore(void);
-extern "C" void Helper_aputfield(void);
-extern "C" void Helper_synchronized_enter(void);
-extern "C" void Helper_synchronized_exit(void);
-
-extern "C" void _ZN13SharedRuntime3f2iEf(void);
-extern "C" void _ZN13SharedRuntime3f2lEf(void);
-extern "C" void _ZN13SharedRuntime3d2iEd(void);
-extern "C" void _ZN13SharedRuntime3d2lEd(void);
-extern "C" void _ZN18InterpreterRuntime8newarrayEP10JavaThread9BasicTypei(void);
-extern "C" void _ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii(void);
-extern "C" void _ZN18InterpreterRuntime14multianewarrayEP10JavaThreadPi(void);
-extern "C" void _ZN18InterpreterRuntime3ldcEP10JavaThreadb(void);
-
-extern char Thumb2_stubs[];
-extern char Thumb2_stubs_end[];
-extern char Thumb2_idiv_stub[];
-extern char Thumb2_irem_stub[];
-extern char Thumb2_invokeinterface_stub[];
-extern char Thumb2_invokevirtual_stub[];
-extern char Thumb2_invokestatic_stub[];
-extern char Thumb2_invokespecial_stub[];
-extern char Thumb2_getfield_word_stub[];
-extern char Thumb2_getfield_sh_stub[];
-extern char Thumb2_getfield_h_stub[];
-extern char Thumb2_getfield_sb_stub[];
-extern char Thumb2_getfield_dw_stub[];
-extern char Thumb2_putfield_word_stub[];
-extern char Thumb2_putfield_h_stub[];
-extern char Thumb2_putfield_b_stub[];
-extern char Thumb2_putfield_a_stub[];
-extern char Thumb2_putfield_dw_stub[];
-extern char Thumb2_getstatic_word_stub[];
-extern char Thumb2_getstatic_sh_stub[];
-extern char Thumb2_getstatic_h_stub[];
-extern char Thumb2_getstatic_sb_stub[];
-extern char Thumb2_getstatic_dw_stub[];
-extern char Thumb2_putstatic_word_stub[];
-extern char Thumb2_putstatic_h_stub[];
-extern char Thumb2_putstatic_b_stub[];
-extern char Thumb2_putstatic_a_stub[];
-extern char Thumb2_putstatic_dw_stub[];
-
-#define STUBS_SIZE	(Thumb2_stubs_end-Thumb2_stubs)
-#define IDIV_STUB		(Thumb2_idiv_stub-Thumb2_stubs)
-#define IREM_STUB		(Thumb2_irem_stub-Thumb2_stubs)
-#define INVOKEINTERFACE_STUB	(Thumb2_invokeinterface_stub-Thumb2_stubs)
-#define INVOKEVIRTUAL_STUB	(Thumb2_invokevirtual_stub-Thumb2_stubs)
-#define INVOKESTATIC_STUB	(Thumb2_invokestatic_stub-Thumb2_stubs)
-#define INVOKESPECIAL_STUB	(Thumb2_invokespecial_stub-Thumb2_stubs)
-#define GETFIELD_WORD_STUB	(Thumb2_getfield_word_stub-Thumb2_stubs)
-#define GETFIELD_SH_STUB	(Thumb2_getfield_sh_stub-Thumb2_stubs)
-#define GETFIELD_H_STUB		(Thumb2_getfield_h_stub-Thumb2_stubs)
-#define GETFIELD_SB_STUB	(Thumb2_getfield_sb_stub-Thumb2_stubs)
-#define GETFIELD_DW_STUB	(Thumb2_getfield_dw_stub-Thumb2_stubs)
-#define PUTFIELD_WORD_STUB	(Thumb2_putfield_word_stub-Thumb2_stubs)
-#define PUTFIELD_H_STUB		(Thumb2_putfield_h_stub-Thumb2_stubs)
-#define PUTFIELD_B_STUB		(Thumb2_putfield_b_stub-Thumb2_stubs)
-#define PUTFIELD_A_STUB		(Thumb2_putfield_a_stub-Thumb2_stubs)
-#define PUTFIELD_DW_STUB	(Thumb2_putfield_dw_stub-Thumb2_stubs)
-#define GETSTATIC_WORD_STUB	(Thumb2_getstatic_word_stub-Thumb2_stubs)
-#define GETSTATIC_SH_STUB	(Thumb2_getstatic_sh_stub-Thumb2_stubs)
-#define GETSTATIC_H_STUB	(Thumb2_getstatic_h_stub-Thumb2_stubs)
-#define GETSTATIC_SB_STUB	(Thumb2_getstatic_sb_stub-Thumb2_stubs)
-#define GETSTATIC_DW_STUB	(Thumb2_getstatic_dw_stub-Thumb2_stubs)
-#define PUTSTATIC_WORD_STUB	(Thumb2_putstatic_word_stub-Thumb2_stubs)
-#define PUTSTATIC_H_STUB	(Thumb2_putstatic_h_stub-Thumb2_stubs)
-#define PUTSTATIC_B_STUB	(Thumb2_putstatic_b_stub-Thumb2_stubs)
-#define PUTSTATIC_A_STUB	(Thumb2_putstatic_a_stub-Thumb2_stubs)
-#define PUTSTATIC_DW_STUB	(Thumb2_putstatic_dw_stub-Thumb2_stubs)
-
-extern "C" void Thumb2_NullPtr_Handler(void);
-
-
-extern "C" int Thumb2_Check_Null(unsigned *regs, unsigned pc)
-{
-  Thumb2_CodeBuf *cb = thumb2_codebuf;
-  if (!(CPUInfo & ARCH_THUMBEE)) return 0;
-  if (IS_COMPILED(pc, cb)) {
-    regs[ARM_LR] = pc;
-    regs[ARM_PC] = (unsigned)Thumb2_NullPtr_Handler;
-    regs[ARM_CPSR] &= ~CPSR_THUMB_BIT;
-    return 1;
-  }
-  return 0;
-}
-
-extern "C" void Thumb2_Initialize(void)
-{
-  CodeBuf codebuf;
-  Thumb2_CodeBuf *cb;
-  u32 h_divzero;
-  u32 loc_irem, loc_idiv, loc_ldiv;
-  int rc;
-
-  if (!(CPUInfo & ARCH_THUMBEE)) {
-    DisableCompiler = 1;
-    return;
-  }
-
-#ifdef T2EE_PRINT_COMPILATION
-  t2ee_print_compilation = getenv("T2EE_PRINT_COMPILATION");
-#endif
-#ifdef T2EE_PRINT_STATISTICS
-  t2ee_print_statistics = getenv("T2EE_PRINT_STATISTICS");
-#endif
-#ifdef T2EE_PRINT_DISASS
-  t2ee_print_disass = getenv("T2EE_PRINT_DISASS");
-#endif
-#ifdef T2EE_PRINT_REGUSAGE
-  t2ee_print_regusage = getenv("T2EE_PRINT_REGUSAGE");
-#endif
-
-  cb = (Thumb2_CodeBuf *)mmap(0, THUMB2_CODEBUF_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
-  if (cb == MAP_FAILED) {
-    DisableCompiler = 1;
-    return;
-  }
-
-  cb->size = THUMB2_CODEBUF_SIZE;
-  cb->hp = (char *)cb + sizeof(Thumb2_CodeBuf);
-  cb->sp = (char *)cb + THUMB2_CODEBUF_SIZE;
-
-  codebuf.codebuf = (unsigned short *)cb->hp;
-  codebuf.idx = 0;
-  codebuf.limit = (unsigned short *)cb->sp - (unsigned short *)cb->hp;
-
-  if (rc = setjmp(compiler_error_env)) {
-    DisableCompiler = 1;
-    return;
-  }
-
-#if 1
-  memcpy(cb->hp, Thumb2_stubs, STUBS_SIZE);
-
-  handlers[H_IDIV] = (unsigned)(cb->hp + IDIV_STUB);
-  handlers[H_IREM] = (unsigned)(cb->hp + IREM_STUB);
-  handlers[H_INVOKEINTERFACE] = (unsigned)(cb->hp + INVOKEINTERFACE_STUB);
-  handlers[H_INVOKEVIRTUAL] = (unsigned)(cb->hp + INVOKEVIRTUAL_STUB);
-  handlers[H_INVOKESTATIC] = (unsigned)(cb->hp + INVOKESTATIC_STUB);
-  handlers[H_INVOKESPECIAL] = (unsigned)(cb->hp + INVOKESPECIAL_STUB);
-
-  handlers[H_GETFIELD_WORD] = (unsigned)(cb->hp + GETFIELD_WORD_STUB);
-  handlers[H_GETFIELD_SH] = (unsigned)(cb->hp + GETFIELD_SH_STUB);
-  handlers[H_GETFIELD_H] = (unsigned)(cb->hp + GETFIELD_H_STUB);
-  handlers[H_GETFIELD_SB] = (unsigned)(cb->hp + GETFIELD_SB_STUB);
-  handlers[H_GETFIELD_DW] = (unsigned)(cb->hp + GETFIELD_DW_STUB);
-
-  handlers[H_PUTFIELD_WORD] = (unsigned)(cb->hp + PUTFIELD_WORD_STUB);
-  handlers[H_PUTFIELD_H] = (unsigned)(cb->hp + PUTFIELD_H_STUB);
-  handlers[H_PUTFIELD_B] = (unsigned)(cb->hp + PUTFIELD_B_STUB);
-  handlers[H_PUTFIELD_A] = (unsigned)(cb->hp + PUTFIELD_A_STUB);
-  handlers[H_PUTFIELD_DW] = (unsigned)(cb->hp + PUTFIELD_DW_STUB);
-
-  handlers[H_GETSTATIC_WORD] = (unsigned)(cb->hp + GETSTATIC_WORD_STUB);
-  handlers[H_GETSTATIC_SH] = (unsigned)(cb->hp + GETSTATIC_SH_STUB);
-  handlers[H_GETSTATIC_H] = (unsigned)(cb->hp + GETSTATIC_H_STUB);
-  handlers[H_GETSTATIC_SB] = (unsigned)(cb->hp + GETSTATIC_SB_STUB);
-  handlers[H_GETSTATIC_DW] = (unsigned)(cb->hp + GETSTATIC_DW_STUB);
-
-  handlers[H_PUTSTATIC_WORD] = (unsigned)(cb->hp + PUTSTATIC_WORD_STUB);
-  handlers[H_PUTSTATIC_H] = (unsigned)(cb->hp + PUTSTATIC_H_STUB);
-  handlers[H_PUTSTATIC_B] = (unsigned)(cb->hp + PUTSTATIC_B_STUB);
-  handlers[H_PUTSTATIC_A] = (unsigned)(cb->hp + PUTSTATIC_A_STUB);
-  handlers[H_PUTSTATIC_DW] = (unsigned)(cb->hp + PUTSTATIC_DW_STUB);
-
-  codebuf.idx += (Thumb2_stubs_end-Thumb2_stubs) >> 1;
-#endif
-
-  handlers[H_LDIV] = handlers[H_LREM] = out_pos(&codebuf);
-  dop_reg(&codebuf, DP_ORR, ARM_IP, ARM_R2, ARM_R3, 0, 0);
-  loc_ldiv = forward_16(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_ldivmod);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-  bcc_patch(&codebuf, COND_EQ, loc_ldiv);
-  mov_imm(&codebuf, ARM_IP, (u32)Thumb2_DivZero_Handler);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_ARRAYBOUND] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_ArrayBounds_Handler);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-  handlers[H_HANDLE_EXCEPTION] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Handle_Exception);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-  handlers[H_HANDLE_EXCEPTION_NO_REGS] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Handle_Exception_NoRegs);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-  handlers[H_STACK_OVERFLOW] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Stack_Overflow);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-  handlers[H_DREM] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)fmod);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_FREM] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_R3, (u32)fmodf);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-  handlers[H_I2F] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_i2f);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_I2D] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_i2d);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_L2F] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_l2f);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_L2D] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_l2d);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_F2I] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3f2iEf);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_F2L] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3f2lEf);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_F2D] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_f2d);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_D2I] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3d2iEd);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_D2L] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)_ZN13SharedRuntime3d2lEd);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-  handlers[H_D2F] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_IP, (u32)__aeabi_d2f);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// NEW Stub
-//   r1 = index
-//   r3 = bci
-//   result -> R0, == 0 => exception
-  handlers[H_NEW] = out_pos(&codebuf);
-  mov_reg(&codebuf, ARM_R0, Ristate);
-  ldr_imm(&codebuf, ARM_R2, ARM_R0, ISTATE_METHOD, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)Helper_new);
-  ldr_imm(&codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_R2, ARM_R2, ARM_R3);
-sub_imm(&codebuf, ARM_R3, Rstack, 4);
-  str_imm(&codebuf, ARM_R3, ARM_R0, ISTATE_STACK, 1, 0);
-  str_imm(&codebuf, ARM_R2, ARM_R0, ISTATE_BCP, 1, 0);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// NEWARRAY Stub
-//   r1 = atype
-//   r2 = tos
-//   r3 = bci
-//   result -> thread->vm_result
-  handlers[H_NEWARRAY] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)_ZN18InterpreterRuntime8newarrayEP10JavaThread9BasicTypei);
-  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_R3, ARM_R0, ARM_R3);
-  mov_reg(&codebuf, ARM_R0, Rthread);
-  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_BCP, 1, 0);
-sub_imm(&codebuf, ARM_R3, Rstack, 4);
-  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// ANEWARRAY Stub
-//   r0 = bci
-//   r2 = index
-//   r3 = tos
-//   result -> thread->vm_result
-  handlers[H_ANEWARRAY] = out_pos(&codebuf);
-sub_imm(&codebuf, ARM_R1, Rstack, 4);
-  str_imm(&codebuf, ARM_R1, Ristate, ISTATE_STACK, 1, 0);
-  ldr_imm(&codebuf, ARM_R1, Ristate, ISTATE_METHOD, 1, 0);
-  ldr_imm(&codebuf, ARM_IP, ARM_R1, METHOD_CONSTMETHOD, 1, 0);
-  ldr_imm(&codebuf, ARM_R1, ARM_R1, METHOD_CONSTANTS, 1, 0);
-  add_reg(&codebuf, ARM_R0, ARM_IP, ARM_R0);
-  mov_imm(&codebuf, ARM_IP, (u32)_ZN18InterpreterRuntime9anewarrayEP10JavaThreadP19constantPoolOopDescii);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
-  mov_reg(&codebuf, ARM_R0, Rthread);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// MULTIANEWARRAY Stub
-//   r0 = bci
-//   r1 = dimensions (*4)
-  handlers[H_MULTIANEWARRAY] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
-  sub_imm(&codebuf, ARM_R3, Rstack, 4);
-  ldr_imm(&codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
-  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
-  add_reg(&codebuf, ARM_R0, ARM_R2, ARM_R0);
-  add_reg(&codebuf, Rstack, Rstack, ARM_R1);
-  mov_imm(&codebuf, ARM_R3, (u32)_ZN18InterpreterRuntime14multianewarrayEP10JavaThreadPi);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
-  mov_reg(&codebuf, ARM_R0, Rthread);
-  sub_imm(&codebuf, ARM_R1, Rstack, 4);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-// LDC Stub
-//   r0 = bci
-  handlers[H_LDC] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_R2, Ristate, ISTATE_METHOD, 1, 0);
-  sub_imm(&codebuf, ARM_R3, Rstack, 4);
-  ldr_imm(&codebuf, ARM_R2, ARM_R2, METHOD_CONSTMETHOD, 1, 0);
-  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
-  add_reg(&codebuf, ARM_R0, ARM_R2, ARM_R0);
-  mov_imm(&codebuf, ARM_R3, (u32)_ZN18InterpreterRuntime3ldcEP10JavaThreadb);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
-  mov_reg(&codebuf, ARM_R0, Rthread);
-//  mov_imm(&codebuf, ARM_R1, 0);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-// INSTANCEOF Stub
-//   r1 = index
-//   r3 = bci
-//   result -> R0, == -1 => exception
-  handlers[H_INSTANCEOF] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)Helper_instanceof);
-  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_R0, ARM_R0, ARM_R3);
-sub_imm(&codebuf, ARM_R3, Rstack, 4);
-  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
-  mov_reg(&codebuf, ARM_R0, Ristate);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// CHECKCAST Stub
-//   r1 = index
-//   r3 = bci
-//   result -> R0, != 0 => exception
-  handlers[H_CHECKCAST] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)Helper_checkcast);
-  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_R0, ARM_R0, ARM_R3);
-sub_imm(&codebuf, ARM_R3, Rstack, 4);
-  str_imm(&codebuf, ARM_R3, Ristate, ISTATE_STACK, 1, 0);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_BCP, 1, 0);
-  mov_reg(&codebuf, ARM_R0, Ristate);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// AASTORE Stub
-//   r0 = bci
-//   r1 = value
-//   r2 = index
-//   r3 = arrayref
-  handlers[H_AASTORE] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_IP, Ristate, ISTATE_METHOD, 1, 0);
-  ldr_imm(&codebuf, ARM_IP, ARM_IP, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_IP, ARM_IP, ARM_R0);
-sub_imm(&codebuf, ARM_R0, Rstack, 4);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
-  str_imm(&codebuf, ARM_IP, Ristate, ISTATE_BCP, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)Helper_aastore);
-  mov_reg(&codebuf, ARM_R0, Ristate);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-// APUTFIELD Stub
-//   r0 = obj
-  handlers[H_APUTFIELD] = out_pos(&codebuf);
-  mov_imm(&codebuf, ARM_R3, (u32)Helper_aputfield);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-// SYNCHRONIZED_ENTER Stub
-//   r0 = bci
-//   r1 = monitor
-  handlers[H_SYNCHRONIZED_ENTER] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_IP, Ristate, ISTATE_METHOD, 1, 0);
-  ldr_imm(&codebuf, ARM_IP, ARM_IP, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_IP, ARM_IP, ARM_R0);
-sub_imm(&codebuf, ARM_R0, Rstack, 4);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
-  str_imm(&codebuf, ARM_IP, Ristate, ISTATE_BCP, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)Helper_synchronized_enter);
-  mov_reg(&codebuf, ARM_R0, Rthread);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-//
-// SYNCHRONIZED_EXIT Stub
-//   r0 = bci
-//   r1 = monitor
-  handlers[H_SYNCHRONIZED_EXIT] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_IP, Ristate, ISTATE_METHOD, 1, 0);
-  ldr_imm(&codebuf, ARM_IP, ARM_IP, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, ARM_IP, ARM_IP, ARM_R0);
-sub_imm(&codebuf, ARM_R0, Rstack, 4);
-  str_imm(&codebuf, ARM_R0, Ristate, ISTATE_STACK, 1, 0);
-  str_imm(&codebuf, ARM_IP, Ristate, ISTATE_BCP, 1, 0);
-  mov_imm(&codebuf, ARM_IP, (u32)Helper_synchronized_exit);
-  mov_reg(&codebuf, ARM_R0, Rthread);
-  mov_reg(&codebuf, ARM_PC, ARM_IP);
-
-#define DEBUG_REGSET ((1<<ARM_R0)|(1<<ARM_R1)|(1<<ARM_R2)|(1<<ARM_R3)|(1<<ARM_IP))
-
-// DEBUG_METHODENTRY
-  handlers[H_DEBUG_METHODENTRY] = out_pos(&codebuf);
-  stm(&codebuf, DEBUG_REGSET | (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
-  mov_reg(&codebuf, ARM_R2, ARM_R0);
-  mov_reg(&codebuf, ARM_R0, ARM_R8);
-  mov_reg(&codebuf, ARM_R1, ARM_R4);
-  mov_imm(&codebuf, ARM_IP, (u32)Debug_MethodEntry);
-  blx_reg(&codebuf, ARM_IP);
-  ldm(&codebuf, DEBUG_REGSET | (1<<ARM_PC), ARM_SP, POP_FD, 1);
-
-// DEBUG_METHODEXIT
-  handlers[H_DEBUG_METHODEXIT] = out_pos(&codebuf);
-  stm(&codebuf, DEBUG_REGSET | (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
-  mov_reg(&codebuf, ARM_R0, ARM_R8);
-  mov_reg(&codebuf, ARM_R1, ARM_R4);
-  mov_imm(&codebuf, ARM_IP, (u32)Debug_MethodExit);
-  blx_reg(&codebuf, ARM_IP);
-  ldm(&codebuf, DEBUG_REGSET | (1<<ARM_PC), ARM_SP, POP_FD, 1);
-
-// DEBUG_METHODCALL
-  handlers[H_DEBUG_METHODCALL] = out_pos(&codebuf);
-  stm(&codebuf, DEBUG_REGSET | (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
-  mov_reg(&codebuf, ARM_R2, ARM_R0);
-  mov_reg(&codebuf, ARM_R0, ARM_R8);
-  mov_reg(&codebuf, ARM_R1, ARM_R4);
-  mov_imm(&codebuf, ARM_IP, (u32)Debug_MethodCall);
-  blx_reg(&codebuf, ARM_IP);
-  ldm(&codebuf, DEBUG_REGSET | (1<<ARM_PC), ARM_SP, POP_FD, 1);
-
-// EXIT_TO_INTERPRETER
-//   r0 = bci
-  handlers[H_EXIT_TO_INTERPRETER] = out_pos(&codebuf);
-  ldr_imm(&codebuf, ARM_R1, Ristate, ISTATE_METHOD, 1, 0);
-  ldr_imm(&codebuf, ARM_IP, ARM_R1, METHOD_CONSTMETHOD, 1, 0);
-  add_reg(&codebuf, Rint_jpc, ARM_IP, ARM_R0);
-  mov_imm(&codebuf, ARM_R3, (u32)Thumb2_Exit_To_Interpreter);
-  mov_reg(&codebuf, ARM_PC, ARM_R3);
-
-  Thumb2_Clear_Cache(cb->hp, cb->hp + codebuf.idx * 2);
-  cb->hp += codebuf.idx * 2;
-
-  thumb2_codebuf = cb;
-}
-
-#endif // THUMB2EE
--- a/ports/hotspot/src/share/vm/includeDB_shark	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,369 +0,0 @@
-//
-// Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
-// Copyright 2008, 2009, 2010 Red Hat, Inc.
-// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-//
-// This code is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License version 2 only, as
-// published by the Free Software Foundation.
-//
-// This code 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
-// version 2 for more details (a copy is included in the LICENSE file that
-// accompanied this code).
-//
-// You should have received a copy of the GNU General Public License version
-// 2 along with this work; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-// CA 95054 USA or visit www.sun.com if you need additional information or
-// have any questions.
-//
-//
-
-// NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps!
-
-ciMethod.cpp                            ciTypeFlow.hpp
-ciMethod.cpp                            methodOop.hpp
-
-ciTypeFlow.cpp                          allocation.inline.hpp
-ciTypeFlow.cpp                          bytecode.hpp
-ciTypeFlow.cpp                          bytecodes.hpp
-ciTypeFlow.cpp                          ciConstant.hpp
-ciTypeFlow.cpp                          ciField.hpp
-ciTypeFlow.cpp                          ciMethod.hpp
-ciTypeFlow.cpp                          ciMethodData.hpp
-ciTypeFlow.cpp                          ciObjArrayKlass.hpp
-ciTypeFlow.cpp                          ciStreams.hpp
-ciTypeFlow.cpp                          ciTypeArrayKlass.hpp
-ciTypeFlow.cpp                          ciTypeFlow.hpp
-ciTypeFlow.cpp                          compileLog.hpp
-ciTypeFlow.cpp                          deoptimization.hpp
-ciTypeFlow.cpp                          growableArray.hpp
-ciTypeFlow.cpp                          shark_globals.hpp
-
-ciTypeFlow.hpp                          ciEnv.hpp
-ciTypeFlow.hpp                          ciKlass.hpp
-ciTypeFlow.hpp                          ciMethodBlocks.hpp
-
-cppInterpreter_<arch>.cpp               shark_globals.hpp
-
-compileBroker.cpp                       sharkCompiler.hpp
-
-globals.hpp                             shark_globals_<arch>.hpp
-
-globals.cpp                             shark_globals.hpp
-
-llvmValue.hpp                           llvmHeaders.hpp
-llvmValue.hpp                           sharkContext.hpp
-llvmValue.hpp                           sharkType.hpp
-
-nmethod.cpp                             sharkCompiler.hpp
-
-sharedRuntime_<arch>.cpp                compileBroker.hpp
-sharedRuntime_<arch>.cpp                sharkCompiler.hpp
-
-shark_globals.cpp                       shark_globals.hpp
-
-shark_globals.hpp                       shark_globals_<arch>.hpp
-shark_globals.hpp                       globals.hpp
-
-sharkBlock.cpp                          debug.hpp
-sharkBlock.cpp                          bytecodes.hpp
-sharkBlock.cpp                          llvmHeaders.hpp
-sharkBlock.cpp                          llvmValue.hpp
-sharkBlock.cpp                          shark_globals.hpp
-sharkBlock.cpp                          sharkBlock.hpp
-sharkBlock.cpp                          sharkBuilder.hpp
-sharkBlock.cpp                          sharkConstant.hpp
-sharkBlock.cpp                          sharkState.hpp
-sharkBlock.cpp                          sharkValue.hpp
-
-sharkBlock.hpp                          allocation.hpp
-sharkBlock.hpp                          ciMethod.hpp
-sharkBlock.hpp                          ciStreams.hpp
-sharkBlock.hpp                          debug.hpp
-sharkBlock.hpp                          llvmHeaders.hpp
-sharkBlock.hpp                          sharkBuilder.hpp
-sharkBlock.hpp                          sharkConstant.hpp
-sharkBlock.hpp                          sharkInvariants.hpp
-sharkBlock.hpp                          sharkState.hpp
-sharkBlock.hpp                          sharkValue.hpp
-
-sharkBuilder.cpp                        ciMethod.hpp
-sharkBuilder.cpp                        debug.hpp
-sharkBuilder.cpp                        llvmHeaders.hpp
-sharkBuilder.cpp                        llvmValue.hpp
-sharkBuilder.cpp                        methodOop.hpp
-sharkBuilder.cpp                        os.hpp
-sharkBuilder.cpp                        resourceArea.hpp
-sharkBuilder.cpp                        llvmHeaders.hpp
-sharkBuilder.cpp                        sharkBuilder.hpp
-sharkBuilder.cpp                        sharkContext.hpp
-sharkBuilder.cpp                        sharkRuntime.hpp
-sharkBuilder.cpp                        synchronizer.hpp
-sharkBuilder.cpp                        thread.hpp
-
-sharkBuilder.hpp                        barrierSet.hpp
-sharkBuilder.hpp                        cardTableModRefBS.hpp
-sharkBuilder.hpp                        ciType.hpp
-sharkBuilder.hpp                        debug.hpp
-sharkBuilder.hpp                        llvmHeaders.hpp
-sharkBuilder.hpp                        llvmValue.hpp
-sharkBuilder.hpp                        sizes.hpp
-sharkBuilder.hpp                        sharkCodeBuffer.hpp
-sharkBuilder.hpp                        sharkType.hpp
-sharkBuilder.hpp                        sharkValue.hpp
-sharkBuilder.hpp                        sharkEntry.hpp
-
-sharkCacheDecache.cpp                   ciMethod.hpp
-sharkCacheDecache.cpp                   debugInfoRec.hpp
-sharkCacheDecache.cpp                   llvmValue.hpp
-sharkCacheDecache.cpp                   sharkBuilder.hpp
-sharkCacheDecache.cpp                   sharkCacheDecache.hpp
-sharkCacheDecache.cpp                   sharkFunction.hpp
-sharkCacheDecache.cpp                   sharkState.hpp
-
-sharkCacheDecache.hpp                   ciMethod.hpp
-sharkCacheDecache.hpp                   debugInfoRec.hpp
-sharkCacheDecache.hpp                   sharkBuilder.hpp
-sharkCacheDecache.hpp                   sharkFunction.hpp
-sharkCacheDecache.hpp                   sharkStateScanner.hpp
-
-sharkCodeBuffer.hpp                     allocation.hpp
-sharkCodeBuffer.hpp                     codeBuffer.hpp
-sharkCodeBuffer.hpp                     llvmHeaders.hpp
-
-sharkCompiler.cpp                       abstractCompiler.hpp
-sharkCompiler.cpp                       ciEnv.hpp
-sharkCompiler.cpp                       ciMethod.hpp
-sharkCompiler.cpp                       debug.hpp
-sharkCompiler.cpp                       debugInfoRec.hpp
-sharkCompiler.cpp                       dependencies.hpp
-sharkCompiler.cpp                       exceptionHandlerTable.hpp
-sharkCompiler.cpp                       llvmHeaders.hpp
-sharkCompiler.cpp                       oopMap.hpp
-sharkCompiler.cpp                       oopRecorder.hpp
-sharkCompiler.cpp                       shark_globals.hpp
-sharkCompiler.cpp                       sharkBuilder.hpp
-sharkCompiler.cpp                       sharkCodeBuffer.hpp
-sharkCompiler.cpp                       sharkCompiler.hpp
-sharkCompiler.cpp                       sharkContext.hpp
-sharkCompiler.cpp                       sharkEntry.hpp
-sharkCompiler.cpp                       sharkFunction.hpp
-sharkCompiler.cpp                       sharkMemoryManager.hpp
-sharkCompiler.cpp                       sharkNativeWrapper.hpp
-
-sharkCompiler.hpp                       abstractCompiler.hpp
-sharkCompiler.hpp                       ciEnv.hpp
-sharkCompiler.hpp                       ciMethod.hpp
-sharkCompiler.hpp                       compileBroker.hpp
-sharkCompiler.hpp                       llvmHeaders.hpp
-sharkCompiler.hpp                       sharkMemoryManager.hpp
-
-sharkContext.cpp                        arrayOop.hpp
-sharkContext.cpp                        globalDefinitions.hpp
-sharkContext.cpp                        llvmHeaders.hpp
-sharkContext.cpp                        oop.hpp
-sharkContext.cpp                        sharkContext.hpp
-
-sharkContext.hpp                        llvmHeaders.hpp
-sharkContext.hpp                        sharkCompiler.hpp
-
-sharkConstant.cpp                       ciInstance.hpp
-sharkConstant.cpp                       ciStreams.hpp
-sharkConstant.cpp                       sharkBuilder.hpp
-sharkConstant.cpp                       sharkConstant.hpp
-sharkConstant.cpp                       sharkValue.hpp
-
-sharkConstant.hpp                       allocation.hpp
-sharkConstant.hpp                       ciStreams.hpp
-sharkConstant.hpp                       sharkBuilder.hpp
-sharkConstant.hpp                       sharkValue.hpp
-
-sharkEntry.hpp                          llvmHeaders.hpp
-
-sharkFunction.cpp                       allocation.hpp
-sharkFunction.cpp                       ciTypeFlow.hpp
-sharkFunction.cpp                       debug.hpp
-sharkFunction.cpp                       llvmHeaders.hpp
-sharkFunction.cpp                       llvmValue.hpp
-sharkFunction.cpp                       shark_globals.hpp
-sharkFunction.cpp                       sharkBuilder.hpp
-sharkFunction.cpp                       sharkEntry.hpp
-sharkFunction.cpp                       sharkFunction.hpp
-sharkFunction.cpp                       sharkState.hpp
-sharkFunction.cpp                       sharkTopLevelBlock.hpp
-
-sharkFunction.hpp                       allocation.hpp
-sharkFunction.hpp                       ciEnv.hpp
-sharkFunction.hpp                       ciStreams.hpp
-sharkFunction.hpp                       ciTypeFlow.hpp
-sharkFunction.hpp                       llvmHeaders.hpp
-sharkFunction.hpp                       llvmValue.hpp
-sharkFunction.hpp                       sharkBuilder.hpp
-sharkFunction.hpp                       sharkContext.hpp
-sharkFunction.hpp                       sharkInvariants.hpp
-sharkFunction.hpp                       sharkStack.hpp
-
-sharkInliner.cpp                        allocation.hpp
-sharkInliner.cpp                        bytecodes.hpp
-sharkInliner.cpp                        ciField.hpp
-sharkInliner.cpp                        ciMethod.hpp
-sharkInliner.cpp                        ciStreams.hpp
-sharkInliner.cpp                        shark_globals.hpp
-sharkInliner.cpp                        sharkBlock.hpp
-sharkInliner.cpp                        sharkConstant.hpp
-sharkInliner.cpp                        sharkInliner.hpp
-sharkInliner.cpp                        sharkIntrinsics.hpp
-sharkInliner.cpp                        sharkState.hpp
-sharkInliner.cpp                        sharkValue.hpp
-
-sharkInliner.hpp                        allocation.hpp
-sharkInliner.hpp                        ciMethod.hpp
-sharkInliner.hpp                        llvmHeaders.hpp
-sharkInliner.hpp                        sharkState.hpp
-
-sharkIntrinsics.cpp                     ciMethod.hpp
-sharkIntrinsics.cpp                     llvmHeaders.hpp
-sharkIntrinsics.cpp                     shark_globals.hpp
-sharkIntrinsics.cpp                     sharkIntrinsics.hpp
-sharkIntrinsics.cpp                     sharkState.hpp
-sharkIntrinsics.cpp                     sharkValue.hpp
-
-sharkIntrinsics.hpp                     allocation.hpp
-sharkIntrinsics.hpp                     ciMethod.hpp
-sharkIntrinsics.hpp                     llvmHeaders.hpp
-sharkIntrinsics.hpp                     sharkState.hpp
-
-sharkInvariants.cpp                     sharkInvariants.hpp
-
-sharkInvariants.hpp                     allocation.hpp
-sharkInvariants.hpp                     ciEnv.hpp
-sharkInvariants.hpp                     ciMethod.hpp
-sharkInvariants.hpp                     ciInstanceKlass.hpp
-sharkInvariants.hpp                     ciTypeFlow.hpp
-sharkInvariants.hpp                     debugInfoRec.hpp
-sharkInvariants.hpp                     dependencies.hpp
-sharkInvariants.hpp                     llvmHeaders.hpp
-sharkInvariants.hpp                     sharkBuilder.hpp
-
-sharkMemoryManager.hpp                  llvmHeaders.hpp
-sharkMemoryManager.hpp                  sharkEntry.hpp
-
-sharkMemoryManager.cpp                  llvmHeaders.hpp
-sharkMemoryManager.cpp                  sharkEntry.hpp
-sharkMemoryManager.cpp                  sharkMemoryManager.hpp
-
-sharkNativeWrapper.cpp                  llvmHeaders.hpp
-sharkNativeWrapper.cpp                  sharkNativeWrapper.hpp
-sharkNativeWrapper.cpp                  sharkType.hpp
-
-sharkNativeWrapper.hpp                  handles.hpp
-sharkNativeWrapper.hpp                  llvmHeaders.hpp
-sharkNativeWrapper.hpp                  sharkBuilder.hpp
-sharkNativeWrapper.hpp                  sharkContext.hpp
-sharkNativeWrapper.hpp                  sharkInvariants.hpp
-sharkNativeWrapper.hpp                  sharkStack.hpp
-
-sharkRuntime.cpp                        biasedLocking.hpp
-sharkRuntime.cpp                        deoptimization.hpp
-sharkRuntime.cpp                        llvmHeaders.hpp
-sharkRuntime.cpp                        klassOop.hpp
-sharkRuntime.cpp                        sharkRuntime.hpp
-sharkRuntime.cpp                        stack_<arch>.inline.hpp
-sharkRuntime.cpp                        thread.hpp
-
-sharkRuntime.hpp                        allocation.hpp
-sharkRuntime.hpp                        llvmHeaders.hpp
-sharkRuntime.hpp                        llvmValue.hpp
-sharkRuntime.hpp                        klassOop.hpp
-sharkRuntime.hpp                        thread.hpp
-
-sharkStack.cpp                          llvmHeaders.hpp
-sharkStack.cpp                          sharkFunction.hpp
-sharkStack.cpp                          sharkNativeWrapper.hpp
-sharkStack.cpp                          sharkStack.hpp
-sharkStack.cpp                          sharkType.hpp
-
-sharkStack.hpp                          llvmHeaders.hpp
-sharkStack.hpp                          sharkInvariants.hpp
-sharkStack.hpp                          sharkType.hpp
-
-sharkState.cpp                          allocation.hpp
-sharkState.cpp                          ciType.hpp
-sharkState.cpp                          ciTypeFlow.hpp
-sharkState.cpp                          sharkBuilder.hpp
-sharkState.cpp                          sharkCacheDecache.hpp
-sharkState.cpp                          sharkState.hpp
-sharkState.cpp                          sharkTopLevelBlock.hpp
-sharkState.cpp                          sharkType.hpp
-sharkState.cpp                          sharkValue.hpp
-
-sharkState.hpp                          allocation.hpp
-sharkState.hpp                          ciMethod.hpp
-sharkState.hpp                          llvmHeaders.hpp
-sharkState.hpp                          sharkBuilder.hpp
-sharkState.hpp                          sharkInvariants.hpp
-sharkState.hpp                          sharkValue.hpp
-
-sharkStateScanner.cpp                   sharkState.hpp
-sharkStateScanner.cpp                   sharkStateScanner.hpp
-
-sharkStateScanner.hpp                   allocation.hpp
-sharkStateScanner.hpp                   llvmHeaders.hpp
-sharkStateScanner.hpp                   sharkFunction.hpp
-sharkStateScanner.hpp                   sharkInvariants.hpp
-
-sharkTopLevelBlock.cpp                  allocation.hpp
-sharkTopLevelBlock.cpp                  bytecodes.hpp
-sharkTopLevelBlock.cpp                  ciField.hpp
-sharkTopLevelBlock.cpp                  ciInstance.hpp
-sharkTopLevelBlock.cpp                  ciObjArrayKlass.hpp
-sharkTopLevelBlock.cpp                  ciStreams.hpp
-sharkTopLevelBlock.cpp                  ciType.hpp
-sharkTopLevelBlock.cpp                  ciTypeFlow.hpp
-sharkTopLevelBlock.cpp                  debug.hpp
-sharkTopLevelBlock.cpp                  deoptimization.hpp
-sharkTopLevelBlock.cpp                  llvmHeaders.hpp
-sharkTopLevelBlock.cpp                  llvmValue.hpp
-sharkTopLevelBlock.cpp                  shark_globals.hpp
-sharkTopLevelBlock.cpp                  sharkCacheDecache.hpp
-sharkTopLevelBlock.cpp                  sharkTopLevelBlock.hpp
-sharkTopLevelBlock.cpp                  sharkBuilder.hpp
-sharkTopLevelBlock.cpp                  sharkConstant.hpp
-sharkTopLevelBlock.cpp                  sharkInliner.hpp
-sharkTopLevelBlock.cpp                  sharkState.hpp
-sharkTopLevelBlock.cpp                  sharkValue.hpp
-
-sharkTopLevelBlock.hpp                  allocation.hpp
-sharkTopLevelBlock.hpp                  bytecodes.hpp
-sharkTopLevelBlock.hpp                  ciStreams.hpp
-sharkTopLevelBlock.hpp                  ciType.hpp
-sharkTopLevelBlock.hpp                  ciTypeFlow.hpp
-sharkTopLevelBlock.hpp                  llvmHeaders.hpp
-sharkTopLevelBlock.hpp                  sharkBlock.hpp
-sharkTopLevelBlock.hpp                  sharkBuilder.hpp
-sharkTopLevelBlock.hpp                  sharkFunction.hpp
-sharkTopLevelBlock.hpp                  sharkState.hpp
-sharkTopLevelBlock.hpp                  sharkValue.hpp
-
-sharkType.hpp                           allocation.hpp
-sharkType.hpp                           ciType.hpp
-sharkType.hpp                           globalDefinitions.hpp
-sharkType.hpp                           llvmHeaders.hpp
-sharkType.hpp                           sharkContext.hpp
-
-sharkValue.cpp                          ciType.hpp
-sharkValue.cpp                          llvmHeaders.hpp
-sharkValue.cpp                          llvmValue.hpp
-sharkValue.cpp                          sharkBuilder.hpp
-sharkValue.cpp                          sharkValue.hpp
-
-sharkValue.hpp                          allocation.hpp
-sharkValue.hpp                          ciType.hpp
-sharkValue.hpp                          llvmHeaders.hpp
-sharkValue.hpp                          llvmValue.hpp
-sharkValue.hpp                          sharkType.hpp
--- a/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#ifdef assert
-  #undef assert
-#endif
-
-#ifdef DEBUG
-  #define SHARK_DEBUG
-  #undef DEBUG
-#endif
-
-#include <llvm/Argument.h>
-#include <llvm/Constants.h>
-#include <llvm/DerivedTypes.h>
-#include <llvm/ExecutionEngine/ExecutionEngine.h>
-#include <llvm/Instructions.h>
-#include <llvm/LLVMContext.h>
-#include <llvm/Module.h>
-#if SHARK_LLVM_VERSION < 27
-#include <llvm/ModuleProvider.h>
-#endif
-#include <llvm/Support/IRBuilder.h>
-#include <llvm/System/Threading.h>
-#include <llvm/Target/TargetSelect.h>
-#include <llvm/Type.h>
-#include <llvm/ExecutionEngine/JITMemoryManager.h>
-#include <llvm/Support/CommandLine.h>
-#if SHARK_LLVM_VERSION >= 27
-#include <llvm/ExecutionEngine/JIT.h>
-#include <llvm/ADT/StringMap.h>
-#include <llvm/Support/Debug.h>
-#include <llvm/System/Host.h>
-#endif
-
-#include <map>
-
-#ifdef assert
-  #undef assert
-#endif
-
-// from hotspot/src/share/vm/utilities/debug.hpp
-#ifdef ASSERT
-  #define assert(p, msg)                                          \
-    if (!(p)) {                                                  \
-      report_assertion_failure(__FILE__, __LINE__,               \
-                              "assert(" XSTR(p) ",\"" msg "\")");\
-      BREAKPOINT;                                                \
-    }
-#else
-  #define assert(p, msg)
-#endif
-
-#ifdef DEBUG
-  #undef DEBUG
-#endif
-#ifdef SHARK_DEBUG
-  #define DEBUG
-  #undef SHARK_DEBUG
-#endif
--- a/ports/hotspot/src/share/vm/shark/llvmValue.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class LLVMValue : public AllStatic {
- public:
-  static llvm::ConstantInt* jbyte_constant(jbyte value)
-  {
-    return llvm::ConstantInt::get(SharkType::jbyte_type(), value, true);
-  }
-  static llvm::ConstantInt* jint_constant(jint value)
-  {
-    return llvm::ConstantInt::get(SharkType::jint_type(), value, true);
-  }
-  static llvm::ConstantInt* jlong_constant(jlong value)
-  {
-    return llvm::ConstantInt::get(SharkType::jlong_type(), value, true);
-  }
-  static llvm::ConstantFP* jfloat_constant(jfloat value)
-  {
-    return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value));
-  }
-  static llvm::ConstantFP* jdouble_constant(jdouble value)
-  {
-    return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value));
-  }
-  static llvm::ConstantPointerNull* null()
-  {
-    return llvm::ConstantPointerNull::get(SharkType::oop_type());
-  }
-
- public:
-  static llvm::ConstantInt* bit_constant(int value)
-  {
-    return llvm::ConstantInt::get(SharkType::bit_type(), value, false);
-  }
-  static llvm::ConstantInt* intptr_constant(intptr_t value)
-  {
-    return llvm::ConstantInt::get(SharkType::intptr_type(), value, false);
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1260 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkBlock.cpp.incl"
-
-using namespace llvm;
-
-void SharkBlock::parse_bytecode(int start, int limit) {
-  SharkValue *a, *b, *c, *d;
-  int i;
-
-  // Ensure the current state is initialized before we emit any code,
-  // so that any setup code for the state is at the start of the block
-  current_state();
-
-  // Parse the bytecodes
-  iter()->reset_to_bci(start);
-  while (iter()->next_bci() < limit) {
-    NOT_PRODUCT(a = b = c = d = NULL);
-    iter()->next();
-
-    if (SharkTraceBytecodes)
-      tty->print_cr("%4d: %s", bci(), Bytecodes::name(bc()));
-
-    if (has_trap() && trap_bci() == bci()) {
-      do_trap(trap_request());
-      return;
-    }
-
-    if (UseLoopSafepoints) {
-      // XXX if a lcmp is followed by an if_?? then C2 maybe-inserts
-      // the safepoint before the lcmp rather than before the if.
-      // Maybe we should do this too.  See parse2.cpp for details.
-      switch (bc()) {
-      case Bytecodes::_goto:
-      case Bytecodes::_ifnull:
-      case Bytecodes::_ifnonnull:
-      case Bytecodes::_if_acmpeq:
-      case Bytecodes::_if_acmpne:
-      case Bytecodes::_ifeq:
-      case Bytecodes::_ifne:
-      case Bytecodes::_iflt:
-      case Bytecodes::_ifle:
-      case Bytecodes::_ifgt:
-      case Bytecodes::_ifge:
-      case Bytecodes::_if_icmpeq:
-      case Bytecodes::_if_icmpne:
-      case Bytecodes::_if_icmplt:
-      case Bytecodes::_if_icmple:
-      case Bytecodes::_if_icmpgt:
-      case Bytecodes::_if_icmpge:
-        if (iter()->get_dest() <= bci())
-          maybe_add_backedge_safepoint();
-        break;
-
-      case Bytecodes::_goto_w:
-        if (iter()->get_far_dest() <= bci())
-          maybe_add_backedge_safepoint();
-        break;
-
-      case Bytecodes::_tableswitch:
-      case Bytecodes::_lookupswitch:
-        if (switch_default_dest() <= bci()) {
-          maybe_add_backedge_safepoint();
-          break;
-        }
-        int len = switch_table_length();
-        for (int i = 0; i < len; i++) {
-          if (switch_dest(i) <= bci()) {
-            maybe_add_backedge_safepoint();
-            break;
-          }
-        }
-        break;
-      }
-    }
-
-    switch (bc()) {
-    case Bytecodes::_nop:
-      break;
-
-    case Bytecodes::_aconst_null:
-      push(SharkValue::null());
-      break;
-
-    case Bytecodes::_iconst_m1:
-      push(SharkValue::jint_constant(-1));
-      break;
-    case Bytecodes::_iconst_0:
-      push(SharkValue::jint_constant(0));
-      break;
-    case Bytecodes::_iconst_1:
-      push(SharkValue::jint_constant(1));
-      break;
-    case Bytecodes::_iconst_2:
-      push(SharkValue::jint_constant(2));
-      break;
-    case Bytecodes::_iconst_3:
-      push(SharkValue::jint_constant(3));
-      break;
-    case Bytecodes::_iconst_4:
-      push(SharkValue::jint_constant(4));
-      break;
-    case Bytecodes::_iconst_5:
-      push(SharkValue::jint_constant(5));
-      break;
-
-    case Bytecodes::_lconst_0:
-      push(SharkValue::jlong_constant(0));
-      break;
-    case Bytecodes::_lconst_1:
-      push(SharkValue::jlong_constant(1));
-      break;
-
-    case Bytecodes::_fconst_0:
-      push(SharkValue::jfloat_constant(0));
-      break;
-    case Bytecodes::_fconst_1:
-      push(SharkValue::jfloat_constant(1));
-      break;
-    case Bytecodes::_fconst_2:
-      push(SharkValue::jfloat_constant(2));
-      break;
-
-    case Bytecodes::_dconst_0:
-      push(SharkValue::jdouble_constant(0));
-      break;
-    case Bytecodes::_dconst_1:
-      push(SharkValue::jdouble_constant(1));
-      break;
-
-    case Bytecodes::_bipush:
-      push(SharkValue::jint_constant(iter()->get_byte()));
-      break;
-    case Bytecodes::_sipush:
-      push(SharkValue::jint_constant(iter()->get_short()));
-      break;
-
-    case Bytecodes::_ldc:
-    case Bytecodes::_ldc_w:
-    case Bytecodes::_ldc2_w:
-      push(SharkConstant::for_ldc(iter())->value(builder()));
-      break;
-
-    case Bytecodes::_iload_0:
-    case Bytecodes::_lload_0:
-    case Bytecodes::_fload_0:
-    case Bytecodes::_dload_0:
-    case Bytecodes::_aload_0:
-      push(local(0));
-      break;
-    case Bytecodes::_iload_1:
-    case Bytecodes::_lload_1:
-    case Bytecodes::_fload_1:
-    case Bytecodes::_dload_1:
-    case Bytecodes::_aload_1:
-      push(local(1));
-      break;
-    case Bytecodes::_iload_2:
-    case Bytecodes::_lload_2:
-    case Bytecodes::_fload_2:
-    case Bytecodes::_dload_2:
-    case Bytecodes::_aload_2:
-      push(local(2));
-      break;
-    case Bytecodes::_iload_3:
-    case Bytecodes::_lload_3:
-    case Bytecodes::_fload_3:
-    case Bytecodes::_dload_3:
-    case Bytecodes::_aload_3:
-      push(local(3));
-      break;
-    case Bytecodes::_iload:
-    case Bytecodes::_lload:
-    case Bytecodes::_fload:
-    case Bytecodes::_dload:
-    case Bytecodes::_aload:
-      push(local(iter()->get_index()));
-      break;
-
-    case Bytecodes::_baload:
-      do_aload(T_BYTE);
-      break;
-    case Bytecodes::_caload:
-      do_aload(T_CHAR);
-      break;
-    case Bytecodes::_saload:
-      do_aload(T_SHORT);
-      break;
-    case Bytecodes::_iaload:
-      do_aload(T_INT);
-      break;
-    case Bytecodes::_laload:
-      do_aload(T_LONG);
-      break;
-    case Bytecodes::_faload:
-      do_aload(T_FLOAT);
-      break;
-    case Bytecodes::_daload:
-      do_aload(T_DOUBLE);
-      break;
-    case Bytecodes::_aaload:
-      do_aload(T_OBJECT);
-      break;
-
-    case Bytecodes::_istore_0:
-    case Bytecodes::_lstore_0:
-    case Bytecodes::_fstore_0:
-    case Bytecodes::_dstore_0:
-    case Bytecodes::_astore_0:
-      set_local(0, pop());
-      break;
-    case Bytecodes::_istore_1:
-    case Bytecodes::_lstore_1:
-    case Bytecodes::_fstore_1:
-    case Bytecodes::_dstore_1:
-    case Bytecodes::_astore_1:
-      set_local(1, pop());
-      break;
-    case Bytecodes::_istore_2:
-    case Bytecodes::_lstore_2:
-    case Bytecodes::_fstore_2:
-    case Bytecodes::_dstore_2:
-    case Bytecodes::_astore_2:
-      set_local(2, pop());
-      break;
-    case Bytecodes::_istore_3:
-    case Bytecodes::_lstore_3:
-    case Bytecodes::_fstore_3:
-    case Bytecodes::_dstore_3:
-    case Bytecodes::_astore_3:
-      set_local(3, pop());
-      break;
-    case Bytecodes::_istore:
-    case Bytecodes::_lstore:
-    case Bytecodes::_fstore:
-    case Bytecodes::_dstore:
-    case Bytecodes::_astore:
-      set_local(iter()->get_index(), pop());
-      break;
-
-    case Bytecodes::_bastore:
-      do_astore(T_BYTE);
-      break;
-    case Bytecodes::_castore:
-      do_astore(T_CHAR);
-      break;
-    case Bytecodes::_sastore:
-      do_astore(T_SHORT);
-      break;
-    case Bytecodes::_iastore:
-      do_astore(T_INT);
-      break;
-    case Bytecodes::_lastore:
-      do_astore(T_LONG);
-      break;
-    case Bytecodes::_fastore:
-      do_astore(T_FLOAT);
-      break;
-    case Bytecodes::_dastore:
-      do_astore(T_DOUBLE);
-      break;
-    case Bytecodes::_aastore:
-      do_astore(T_OBJECT);
-      break;
-
-    case Bytecodes::_pop:
-      xpop();
-      break;
-    case Bytecodes::_pop2:
-      xpop();
-      xpop();
-      break;
-    case Bytecodes::_swap:
-      a = xpop();
-      b = xpop();
-      xpush(a);
-      xpush(b);
-      break;
-    case Bytecodes::_dup:
-      a = xpop();
-      xpush(a);
-      xpush(a);
-      break;
-    case Bytecodes::_dup_x1:
-      a = xpop();
-      b = xpop();
-      xpush(a);
-      xpush(b);
-      xpush(a);
-      break;
-    case Bytecodes::_dup_x2:
-      a = xpop();
-      b = xpop();
-      c = xpop();
-      xpush(a);
-      xpush(c);
-      xpush(b);
-      xpush(a);
-      break;
-    case Bytecodes::_dup2:
-      a = xpop();
-      b = xpop();
-      xpush(b);
-      xpush(a);
-      xpush(b);
-      xpush(a);
-      break;
-    case Bytecodes::_dup2_x1:
-      a = xpop();
-      b = xpop();
-      c = xpop();
-      xpush(b);
-      xpush(a);
-      xpush(c);
-      xpush(b);
-      xpush(a);
-      break;
-    case Bytecodes::_dup2_x2:
-      a = xpop();
-      b = xpop();
-      c = xpop();
-      d = xpop();
-      xpush(b);
-      xpush(a);
-      xpush(d);
-      xpush(c);
-      xpush(b);
-      xpush(a);
-      break;
-
-    case Bytecodes::_arraylength:
-      do_arraylength();
-      break;
-
-    case Bytecodes::_getfield:
-      do_getfield();
-      break;
-    case Bytecodes::_getstatic:
-      do_getstatic();
-      break;
-    case Bytecodes::_putfield:
-      do_putfield();
-      break;
-    case Bytecodes::_putstatic:
-      do_putstatic();
-      break;
-
-    case Bytecodes::_iadd:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateAdd(a->jint_value(), b->jint_value()), false));
-      break;
-    case Bytecodes::_isub:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateSub(a->jint_value(), b->jint_value()), false));
-      break;
-    case Bytecodes::_imul:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateMul(a->jint_value(), b->jint_value()), false));
-      break;
-    case Bytecodes::_idiv:
-      do_idiv();
-      break;
-    case Bytecodes::_irem:
-      do_irem();
-      break;
-    case Bytecodes::_ineg:
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateNeg(a->jint_value()), a->zero_checked()));
-      break;
-    case Bytecodes::_ishl:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateShl(
-          a->jint_value(),
-          builder()->CreateAnd(
-            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
-      break;
-    case Bytecodes::_ishr:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateAShr(
-          a->jint_value(),
-          builder()->CreateAnd(
-            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
-      break;
-    case Bytecodes::_iushr:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateLShr(
-          a->jint_value(),
-          builder()->CreateAnd(
-            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
-      break;
-    case Bytecodes::_iand:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateAnd(a->jint_value(), b->jint_value()), false));
-      break;
-    case Bytecodes::_ior:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateOr(a->jint_value(), b->jint_value()),
-        a->zero_checked() && b->zero_checked()));
-      break;
-    case Bytecodes::_ixor:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jint(
-        builder()->CreateXor(a->jint_value(), b->jint_value()), false));
-      break;
-
-    case Bytecodes::_ladd:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateAdd(a->jlong_value(), b->jlong_value()), false));
-      break;
-    case Bytecodes::_lsub:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateSub(a->jlong_value(), b->jlong_value()), false));
-      break;
-    case Bytecodes::_lmul:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateMul(a->jlong_value(), b->jlong_value()), false));
-      break;
-    case Bytecodes::_ldiv:
-      do_ldiv();
-      break;
-    case Bytecodes::_lrem:
-      do_lrem();
-      break;
-    case Bytecodes::_lneg:
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateNeg(a->jlong_value()), a->zero_checked()));
-      break;
-    case Bytecodes::_lshl:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateShl(
-          a->jlong_value(),
-          builder()->CreateIntCast(
-            builder()->CreateAnd(
-              b->jint_value(), LLVMValue::jint_constant(0x3f)),
-            SharkType::jlong_type(), true)), false));
-      break;
-    case Bytecodes::_lshr:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateAShr(
-          a->jlong_value(),
-          builder()->CreateIntCast(
-            builder()->CreateAnd(
-              b->jint_value(), LLVMValue::jint_constant(0x3f)),
-            SharkType::jlong_type(), true)), false));
-      break;
-    case Bytecodes::_lushr:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateLShr(
-          a->jlong_value(),
-          builder()->CreateIntCast(
-            builder()->CreateAnd(
-              b->jint_value(), LLVMValue::jint_constant(0x3f)),
-            SharkType::jlong_type(), true)), false));
-      break;
-    case Bytecodes::_land:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateAnd(a->jlong_value(), b->jlong_value()), false));
-      break;
-    case Bytecodes::_lor:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateOr(a->jlong_value(), b->jlong_value()),
-        a->zero_checked() && b->zero_checked()));
-      break;
-    case Bytecodes::_lxor:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateXor(a->jlong_value(), b->jlong_value()), false));
-      break;
-
-    case Bytecodes::_fadd:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jfloat(
-        builder()->CreateFAdd(a->jfloat_value(), b->jfloat_value())));
-      break;
-    case Bytecodes::_fsub:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jfloat(
-        builder()->CreateFSub(a->jfloat_value(), b->jfloat_value())));
-      break;
-    case Bytecodes::_fmul:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jfloat(
-        builder()->CreateFMul(a->jfloat_value(), b->jfloat_value())));
-      break;
-    case Bytecodes::_fdiv:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jfloat(
-        builder()->CreateFDiv(a->jfloat_value(), b->jfloat_value())));
-      break;
-    case Bytecodes::_frem:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jfloat(
-        builder()->CreateFRem(a->jfloat_value(), b->jfloat_value())));
-      break;
-    case Bytecodes::_fneg:
-      a = pop();
-      push(SharkValue::create_jfloat(
-        builder()->CreateFNeg(a->jfloat_value())));
-      break;
-
-    case Bytecodes::_dadd:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jdouble(
-        builder()->CreateFAdd(a->jdouble_value(), b->jdouble_value())));
-      break;
-    case Bytecodes::_dsub:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jdouble(
-        builder()->CreateFSub(a->jdouble_value(), b->jdouble_value())));
-      break;
-    case Bytecodes::_dmul:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jdouble(
-        builder()->CreateFMul(a->jdouble_value(), b->jdouble_value())));
-      break;
-    case Bytecodes::_ddiv:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jdouble(
-        builder()->CreateFDiv(a->jdouble_value(), b->jdouble_value())));
-      break;
-    case Bytecodes::_drem:
-      b = pop();
-      a = pop();
-      push(SharkValue::create_jdouble(
-        builder()->CreateFRem(a->jdouble_value(), b->jdouble_value())));
-      break;
-    case Bytecodes::_dneg:
-      a = pop();
-      push(SharkValue::create_jdouble(
-        builder()->CreateFNeg(a->jdouble_value())));
-      break;
-
-    case Bytecodes::_iinc:
-      i = iter()->get_index();
-      set_local(
-        i,
-        SharkValue::create_jint(
-          builder()->CreateAdd(
-            LLVMValue::jint_constant(iter()->get_iinc_con()),
-            local(i)->jint_value()), false));
-      break;
-
-    case Bytecodes::_lcmp:
-      do_lcmp();
-      break;
-
-    case Bytecodes::_fcmpl:
-      do_fcmp(false, false);
-      break;
-    case Bytecodes::_fcmpg:
-      do_fcmp(false, true);
-      break;
-    case Bytecodes::_dcmpl:
-      do_fcmp(true, false);
-      break;
-    case Bytecodes::_dcmpg:
-      do_fcmp(true, true);
-      break;
-
-    case Bytecodes::_i2l:
-      a = pop();
-      push(SharkValue::create_jlong(
-        builder()->CreateIntCast(
-          a->jint_value(), SharkType::jlong_type(), true), a->zero_checked()));
-      break;
-    case Bytecodes::_i2f:
-      push(SharkValue::create_jfloat(
-        builder()->CreateSIToFP(
-          pop()->jint_value(), SharkType::jfloat_type())));
-      break;
-    case Bytecodes::_i2d:
-      push(SharkValue::create_jdouble(
-        builder()->CreateSIToFP(
-          pop()->jint_value(), SharkType::jdouble_type())));
-      break;
-
-    case Bytecodes::_l2i:
-      push(SharkValue::create_jint(
-        builder()->CreateIntCast(
-          pop()->jlong_value(), SharkType::jint_type(), true), false));
-      break;
-    case Bytecodes::_l2f:
-      push(SharkValue::create_jfloat(
-        builder()->CreateSIToFP(
-          pop()->jlong_value(), SharkType::jfloat_type())));
-      break;
-    case Bytecodes::_l2d:
-      push(SharkValue::create_jdouble(
-        builder()->CreateSIToFP(
-          pop()->jlong_value(), SharkType::jdouble_type())));
-      break;
-
-    case Bytecodes::_f2i:
-      push(SharkValue::create_jint(
-        builder()->CreateCall(
-          builder()->f2i(), pop()->jfloat_value()), false));
-      break;
-    case Bytecodes::_f2l:
-      push(SharkValue::create_jlong(
-        builder()->CreateCall(
-          builder()->f2l(), pop()->jfloat_value()), false));
-      break;
-    case Bytecodes::_f2d:
-      push(SharkValue::create_jdouble(
-        builder()->CreateFPExt(
-          pop()->jfloat_value(), SharkType::jdouble_type())));
-      break;
-
-    case Bytecodes::_d2i:
-      push(SharkValue::create_jint(
-        builder()->CreateCall(
-          builder()->d2i(), pop()->jdouble_value()), false));
-      break;
-    case Bytecodes::_d2l:
-      push(SharkValue::create_jlong(
-        builder()->CreateCall(
-          builder()->d2l(), pop()->jdouble_value()), false));
-      break;
-    case Bytecodes::_d2f:
-      push(SharkValue::create_jfloat(
-        builder()->CreateFPTrunc(
-          pop()->jdouble_value(), SharkType::jfloat_type())));
-      break;
-
-    case Bytecodes::_i2b:
-      push(SharkValue::create_jint(
-        builder()->CreateAShr(
-          builder()->CreateShl(
-            pop()->jint_value(),
-            LLVMValue::jint_constant(24)),
-          LLVMValue::jint_constant(24)), false));
-      break;
-    case Bytecodes::_i2c:
-      push(SharkValue::create_jint(
-        builder()->CreateAnd(
-            pop()->jint_value(),
-            LLVMValue::jint_constant(0xffff)), false));
-      break;
-    case Bytecodes::_i2s:
-      push(SharkValue::create_jint(
-        builder()->CreateAShr(
-          builder()->CreateShl(
-            pop()->jint_value(),
-            LLVMValue::jint_constant(16)),
-          LLVMValue::jint_constant(16)), false));
-      break;
-
-    case Bytecodes::_return:
-      do_return(T_VOID);
-      break;
-    case Bytecodes::_ireturn:
-      do_return(T_INT);
-      break;
-    case Bytecodes::_lreturn:
-      do_return(T_LONG);
-      break;
-    case Bytecodes::_freturn:
-      do_return(T_FLOAT);
-      break;
-    case Bytecodes::_dreturn:
-      do_return(T_DOUBLE);
-      break;
-    case Bytecodes::_areturn:
-      do_return(T_OBJECT);
-      break;
-
-    case Bytecodes::_athrow:
-      do_athrow();
-      break;
-
-    case Bytecodes::_goto:
-    case Bytecodes::_goto_w:
-      do_goto();
-      break;
-
-    case Bytecodes::_jsr:
-    case Bytecodes::_jsr_w:
-      do_jsr();
-      break;
-
-    case Bytecodes::_ret:
-      do_ret();
-      break;
-
-    case Bytecodes::_ifnull:
-      do_if(ICmpInst::ICMP_EQ, SharkValue::null(), pop());
-      break;
-    case Bytecodes::_ifnonnull:
-      do_if(ICmpInst::ICMP_NE, SharkValue::null(), pop());
-      break;
-    case Bytecodes::_if_acmpeq:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_EQ, b, a);
-      break;
-    case Bytecodes::_if_acmpne:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_NE, b, a);
-      break;
-    case Bytecodes::_ifeq:
-      do_if(ICmpInst::ICMP_EQ, SharkValue::jint_constant(0), pop());
-      break;
-    case Bytecodes::_ifne:
-      do_if(ICmpInst::ICMP_NE, SharkValue::jint_constant(0), pop());
-      break;
-    case Bytecodes::_iflt:
-      do_if(ICmpInst::ICMP_SLT, SharkValue::jint_constant(0), pop());
-      break;
-    case Bytecodes::_ifle:
-      do_if(ICmpInst::ICMP_SLE, SharkValue::jint_constant(0), pop());
-      break;
-    case Bytecodes::_ifgt:
-      do_if(ICmpInst::ICMP_SGT, SharkValue::jint_constant(0), pop());
-      break;
-    case Bytecodes::_ifge:
-      do_if(ICmpInst::ICMP_SGE, SharkValue::jint_constant(0), pop());
-      break;
-    case Bytecodes::_if_icmpeq:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_EQ, b, a);
-      break;
-    case Bytecodes::_if_icmpne:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_NE, b, a);
-      break;
-    case Bytecodes::_if_icmplt:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_SLT, b, a);
-      break;
-    case Bytecodes::_if_icmple:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_SLE, b, a);
-      break;
-    case Bytecodes::_if_icmpgt:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_SGT, b, a);
-      break;
-    case Bytecodes::_if_icmpge:
-      b = pop();
-      a = pop();
-      do_if(ICmpInst::ICMP_SGE, b, a);
-      break;
-
-    case Bytecodes::_tableswitch:
-    case Bytecodes::_lookupswitch:
-      do_switch();
-      break;
-
-    case Bytecodes::_invokestatic:
-    case Bytecodes::_invokespecial:
-    case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokeinterface:
-      do_call();
-      break;
-
-    case Bytecodes::_instanceof:
-      // This is a very common construct:
-      //
-      //  if (object instanceof Klass) {
-      //    something = (Klass) object;
-      //    ...
-      //  }
-      //
-      // which gets compiled to something like this:
-      //
-      //  28: aload 9
-      //  30: instanceof <Class Klass>
-      //  33: ifeq 52
-      //  36: aload 9
-      //  38: checkcast <Class Klass>
-      //
-      // Handling both bytecodes at once allows us
-      // to eliminate the checkcast.
-      if (iter()->next_bci() < limit &&
-          (iter()->next_bc() == Bytecodes::_ifeq ||
-           iter()->next_bc() == Bytecodes::_ifne) &&
-          (!UseLoopSafepoints ||
-           iter()->next_get_dest() > iter()->next_bci())) {
-        if (maybe_do_instanceof_if()) {
-          iter()->next();
-          if (SharkTraceBytecodes)
-            tty->print_cr("%4d: %s", bci(), Bytecodes::name(bc()));
-          break;
-        }
-      }
-      // fall through
-    case Bytecodes::_checkcast:
-      do_instance_check();
-      break;
-
-    case Bytecodes::_new:
-      do_new();
-      break;
-    case Bytecodes::_newarray:
-      do_newarray();
-      break;
-    case Bytecodes::_anewarray:
-      do_anewarray();
-      break;
-    case Bytecodes::_multianewarray:
-      do_multianewarray();
-      break;
-
-    case Bytecodes::_monitorenter:
-      do_monitorenter();
-      break;
-    case Bytecodes::_monitorexit:
-      do_monitorexit();
-      break;
-
-    default:
-      ShouldNotReachHere();
-    }
-  }
-}
-
-SharkState* SharkBlock::initial_current_state() {
-  return entry_state()->copy();
-}
-
-int SharkBlock::switch_default_dest() {
-  return iter()->get_dest_table(0);
-}
-
-int SharkBlock::switch_table_length() {
-  switch(bc()) {
-  case Bytecodes::_tableswitch:
-    return iter()->get_int_table(2) - iter()->get_int_table(1) + 1;
-
-  case Bytecodes::_lookupswitch:
-    return iter()->get_int_table(1);
-
-  default:
-    ShouldNotReachHere();
-  }
-}
-
-int SharkBlock::switch_key(int i) {
-  switch(bc()) {
-  case Bytecodes::_tableswitch:
-    return iter()->get_int_table(1) + i;
-
-  case Bytecodes::_lookupswitch:
-    return iter()->get_int_table(2 + 2 * i);
-
-  default:
-    ShouldNotReachHere();
-  }
-}
-
-int SharkBlock::switch_dest(int i) {
-  switch(bc()) {
-  case Bytecodes::_tableswitch:
-    return iter()->get_dest_table(i + 3);
-
-  case Bytecodes::_lookupswitch:
-    return iter()->get_dest_table(2 + 2 * i + 1);
-
-  default:
-    ShouldNotReachHere();
-  }
-}
-
-void SharkBlock::do_div_or_rem(bool is_long, bool is_rem) {
-  SharkValue *sb = pop();
-  SharkValue *sa = pop();
-
-  check_divide_by_zero(sb);
-
-  Value *a, *b, *p, *q;
-  if (is_long) {
-    a = sa->jlong_value();
-    b = sb->jlong_value();
-    p = LLVMValue::jlong_constant(0x8000000000000000LL);
-    q = LLVMValue::jlong_constant(-1);
-  }
-  else {
-    a = sa->jint_value();
-    b = sb->jint_value();
-    p = LLVMValue::jint_constant(0x80000000);
-    q = LLVMValue::jint_constant(-1);
-  }
-
-  BasicBlock *ip           = builder()->GetBlockInsertionPoint();
-  BasicBlock *special_case = builder()->CreateBlock(ip, "special_case");
-  BasicBlock *general_case = builder()->CreateBlock(ip, "general_case");
-  BasicBlock *done         = builder()->CreateBlock(ip, "done");
-
-  builder()->CreateCondBr(
-    builder()->CreateAnd(
-      builder()->CreateICmpEQ(a, p),
-      builder()->CreateICmpEQ(b, q)),
-    special_case, general_case);
-
-  builder()->SetInsertPoint(special_case);
-  Value *special_result;
-  if (is_rem) {
-    if (is_long)
-      special_result = LLVMValue::jlong_constant(0);
-    else
-      special_result = LLVMValue::jint_constant(0);
-  }
-  else {
-    special_result = a;
-  }
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(general_case);
-  Value *general_result;
-  if (is_rem)
-    general_result = builder()->CreateSRem(a, b);
-  else
-    general_result = builder()->CreateSDiv(a, b);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(done);
-  PHINode *result;
-  if (is_long)
-    result = builder()->CreatePHI(SharkType::jlong_type(), "result");
-  else
-    result = builder()->CreatePHI(SharkType::jint_type(), "result");
-  result->addIncoming(special_result, special_case);
-  result->addIncoming(general_result, general_case);
-
-  if (is_long)
-    push(SharkValue::create_jlong(result, false));
-  else
-    push(SharkValue::create_jint(result, false));
-}
-
-void SharkBlock::do_field_access(bool is_get, bool is_field) {
-  bool will_link;
-  ciField *field = iter()->get_field(will_link);
-  assert(will_link, "typeflow responsibility");
-  assert(is_field != field->is_static(), "mismatch");
-
-  // Pop the value off the stack where necessary
-  SharkValue *value = NULL;
-  if (!is_get)
-    value = pop();
-
-  // Find the object we're accessing, if necessary
-  Value *object = NULL;
-  if (is_field) {
-    SharkValue *value = pop();
-    check_null(value);
-    object = value->generic_value();
-  }
-  if (is_get && field->is_constant()) {
-    SharkConstant *constant = SharkConstant::for_field(iter());
-    if (constant->is_loaded())
-      value = constant->value(builder());
-  }
-  if (!is_get || value == NULL) {
-    if (!is_field)
-      object = builder()->CreateInlineOop(field->holder());
-
-    BasicType   basic_type = field->type()->basic_type();
-    const Type *stack_type = SharkType::to_stackType(basic_type);
-    const Type *field_type = SharkType::to_arrayType(basic_type);
-
-    Value *addr = builder()->CreateAddressOfStructEntry(
-      object, in_ByteSize(field->offset_in_bytes()),
-      PointerType::getUnqual(field_type),
-      "addr");
-
-    // Do the access
-    if (is_get) {
-      Value *field_value = builder()->CreateLoad(addr);
-
-      if (field_type != stack_type) {
-        field_value = builder()->CreateIntCast(
-          field_value, stack_type, basic_type != T_CHAR);
-      }
-
-      value = SharkValue::create_generic(field->type(), field_value, false);
-    }
-    else {
-      Value *field_value = value->generic_value();
-
-      if (field_type != stack_type) {
-        field_value = builder()->CreateIntCast(
-          field_value, field_type, basic_type != T_CHAR);
-      }
-
-      builder()->CreateStore(field_value, addr);
-
-      if (!field->type()->is_primitive_type())
-        builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr);
-
-      if (field->is_volatile())
-        builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
-    }
-  }
-
-  // Push the value onto the stack where necessary
-  if (is_get)
-    push(value);
-}
-
-void SharkBlock::do_lcmp() {
-  Value *b = pop()->jlong_value();
-  Value *a = pop()->jlong_value();
-
-  BasicBlock *ip   = builder()->GetBlockInsertionPoint();
-  BasicBlock *ne   = builder()->CreateBlock(ip, "lcmp_ne");
-  BasicBlock *lt   = builder()->CreateBlock(ip, "lcmp_lt");
-  BasicBlock *gt   = builder()->CreateBlock(ip, "lcmp_gt");
-  BasicBlock *done = builder()->CreateBlock(ip, "done");
-
-  BasicBlock *eq = builder()->GetInsertBlock();
-  builder()->CreateCondBr(builder()->CreateICmpEQ(a, b), done, ne);
-
-  builder()->SetInsertPoint(ne);
-  builder()->CreateCondBr(builder()->CreateICmpSLT(a, b), lt, gt);
-
-  builder()->SetInsertPoint(lt);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(gt);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(done);
-  PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result");
-  result->addIncoming(LLVMValue::jint_constant(-1), lt);
-  result->addIncoming(LLVMValue::jint_constant(0),  eq);
-  result->addIncoming(LLVMValue::jint_constant(1),  gt);
-
-  push(SharkValue::create_jint(result, false));
-}
-
-void SharkBlock::do_fcmp(bool is_double, bool unordered_is_greater) {
-  Value *a, *b;
-  if (is_double) {
-    b = pop()->jdouble_value();
-    a = pop()->jdouble_value();
-  }
-  else {
-    b = pop()->jfloat_value();
-    a = pop()->jfloat_value();
-  }
-
-  BasicBlock *ip      = builder()->GetBlockInsertionPoint();
-  BasicBlock *ordered = builder()->CreateBlock(ip, "ordered");
-  BasicBlock *ge      = builder()->CreateBlock(ip, "fcmp_ge");
-  BasicBlock *lt      = builder()->CreateBlock(ip, "fcmp_lt");
-  BasicBlock *eq      = builder()->CreateBlock(ip, "fcmp_eq");
-  BasicBlock *gt      = builder()->CreateBlock(ip, "fcmp_gt");
-  BasicBlock *done    = builder()->CreateBlock(ip, "done");
-
-  builder()->CreateCondBr(
-    builder()->CreateFCmpUNO(a, b),
-    unordered_is_greater ? gt : lt, ordered);
-
-  builder()->SetInsertPoint(ordered);
-  builder()->CreateCondBr(builder()->CreateFCmpULT(a, b), lt, ge);
-
-  builder()->SetInsertPoint(ge);
-  builder()->CreateCondBr(builder()->CreateFCmpUGT(a, b), gt, eq);
-
-  builder()->SetInsertPoint(lt);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(gt);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(eq);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(done);
-  PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result");
-  result->addIncoming(LLVMValue::jint_constant(-1), lt);
-  result->addIncoming(LLVMValue::jint_constant(0),  eq);
-  result->addIncoming(LLVMValue::jint_constant(1),  gt);
-
-  push(SharkValue::create_jint(result, false));
-}
-
-void SharkBlock::emit_IR() {
-  ShouldNotCallThis();
-}
-
-SharkState* SharkBlock::entry_state() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_zero_check(SharkValue* value) {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::maybe_add_backedge_safepoint() {
-  ShouldNotCallThis();
-}
-
-bool SharkBlock::has_trap() {
-  return false;
-}
-
-int SharkBlock::trap_request() {
-  ShouldNotCallThis();
-}
-
-int SharkBlock::trap_bci() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_trap(int trap_request) {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_arraylength() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_aload(BasicType basic_type) {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_astore(BasicType basic_type) {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_return(BasicType type) {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_athrow() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_goto() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_jsr() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_ret() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_if(ICmpInst::Predicate p, SharkValue* b, SharkValue* a) {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_switch() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_call() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_instance_check() {
-  ShouldNotCallThis();
-}
-
-bool SharkBlock::maybe_do_instanceof_if() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_new() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_newarray() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_anewarray() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_multianewarray() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_monitorenter() {
-  ShouldNotCallThis();
-}
-
-void SharkBlock::do_monitorexit() {
-  ShouldNotCallThis();
-}
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkState;
-
-class SharkBlock : public SharkTargetInvariants {
- protected:
-  SharkBlock(const SharkTargetInvariants* parent)
-    : SharkTargetInvariants(parent),
-      _iter(target()),
-      _current_state(NULL) {}
-
-  SharkBlock(const SharkCompileInvariants* parent, ciMethod* target)
-    : SharkTargetInvariants(parent, target),
-      _iter(target),
-      _current_state(NULL) {}
-
- private:
-  ciBytecodeStream _iter;
-  SharkState*      _current_state;
-
- public:
-  ciBytecodeStream* iter() {
-    return &_iter;
-  }
-  Bytecodes::Code bc() {
-    return iter()->cur_bc();
-  }
-  int bci() {
-    return iter()->cur_bci();
-  }
-
-  // Entry state
- protected:
-  virtual SharkState* entry_state();
-
-  // Current state
- private:
-  SharkState* initial_current_state();
-
- public:
-  SharkState* current_state() {
-    if (_current_state == NULL)
-      set_current_state(initial_current_state());
-    return _current_state;
-  }
-
- protected:
-  void set_current_state(SharkState* current_state) {
-    _current_state = current_state;
-  }
-
-  // Local variables
- protected:
-  SharkValue* local(int index) {
-    SharkValue *value = current_state()->local(index);
-    assert(value != NULL, "shouldn't be");
-    assert(value->is_one_word() ||
-           (index + 1 < max_locals() &&
-            current_state()->local(index + 1) == NULL), "should be");
-    return value;
-  }
-  void set_local(int index, SharkValue* value) {
-    assert(value != NULL, "shouldn't be");
-    current_state()->set_local(index, value);
-    if (value->is_two_word())
-      current_state()->set_local(index + 1, NULL);
-  }
-
-  // Expression stack (raw)
- protected:
-  void xpush(SharkValue* value) {
-    current_state()->push(value);
-  }
-  SharkValue* xpop() {
-    return current_state()->pop();
-  }
-  SharkValue* xstack(int slot) {
-    SharkValue *value = current_state()->stack(slot);
-    assert(value != NULL, "shouldn't be");
-    assert(value->is_one_word() ||
-           (slot > 0 &&
-            current_state()->stack(slot - 1) == NULL), "should be");
-    return value;
-  }
-  int xstack_depth() {
-    return current_state()->stack_depth();
-  }
-
-  // Expression stack (cooked)
- protected:
-  void push(SharkValue* value) {
-    assert(value != NULL, "shouldn't be");
-    xpush(value);
-    if (value->is_two_word())
-      xpush(NULL);
-  }
-  SharkValue* pop() {
-    int size = current_state()->stack(0) == NULL ? 2 : 1;
-    if (size == 2)
-      xpop();
-    SharkValue *value = xpop();
-    assert(value && value->size() == size, "should be");
-    return value;
-  }
-  SharkValue* pop_result(BasicType type) {
-    SharkValue *result = pop();
-
-#ifdef ASSERT
-    switch (result->basic_type()) {
-    case T_BOOLEAN:
-    case T_BYTE:
-    case T_CHAR:
-    case T_SHORT:
-      assert(type == T_INT, "type mismatch");
-      break;
-
-    case T_ARRAY:
-      assert(type == T_OBJECT, "type mismatch");
-      break;
-
-    default:
-      assert(result->basic_type() == type, "type mismatch");
-    }
-#endif // ASSERT
-
-    return result;
-  }
-
-  // Code generation
- public:
-  virtual void emit_IR();
-
- protected:
-  void parse_bytecode(int start, int limit);
-
-  // Helpers
- protected:
-  virtual void do_zero_check(SharkValue* value);
-
-  // Zero checking
- protected:
-  void check_null(SharkValue* object) {
-    zero_check(object);
-  }
-  void check_divide_by_zero(SharkValue* value) {
-    zero_check(value);
-  }
- private:
-  void zero_check(SharkValue* value) {
-    if (!value->zero_checked())
-      do_zero_check(value);
-  }
-
-  // Safepoints
- protected:
-  virtual void maybe_add_backedge_safepoint();
-
-  // Traps
- protected:
-  virtual bool has_trap();
-  virtual int  trap_request();
-  virtual int  trap_bci();
-  virtual void do_trap(int trap_request);
-
-  // arraylength
- protected:
-  virtual void do_arraylength();
-
-  // *aload and *astore
- protected:
-  virtual void do_aload(BasicType basic_type);
-  virtual void do_astore(BasicType basic_type);
-
-  // *div and *rem
- private:
-  void do_idiv() {
-    do_div_or_rem(false, false);
-  }
-  void do_irem() {
-    do_div_or_rem(false, true);
-  }
-  void do_ldiv() {
-    do_div_or_rem(true, false);
-  }
-  void do_lrem() {
-    do_div_or_rem(true, true);
-  }
-  void do_div_or_rem(bool is_long, bool is_rem);
-
-  // get* and put*
- private:
-  void do_getstatic() {
-    do_field_access(true, false);
-  }
-  void do_getfield() {
-    do_field_access(true, true);
-  }
-  void do_putstatic() {
-    do_field_access(false, false);
-  }
-  void do_putfield() {
-    do_field_access(false, true);
-  }
-  void do_field_access(bool is_get, bool is_field);
-
-  // lcmp and [fd]cmp[lg]
- private:
-  void do_lcmp();
-  void do_fcmp(bool is_double, bool unordered_is_greater);
-
-  // *return and athrow
- protected:
-  virtual void do_return(BasicType type);
-  virtual void do_athrow();
-
-  // goto*
- protected:
-  virtual void do_goto();
-
-  // jsr* and ret
- protected:
-  virtual void do_jsr();
-  virtual void do_ret();
-
-  // if*
- protected:
-  virtual void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a);
-
-  // *switch
- protected:
-  int switch_default_dest();
-  int switch_table_length();
-  int switch_key(int i);
-  int switch_dest(int i);
-
-  virtual void do_switch();
-
-  // invoke*
- protected:
-  virtual void do_call();
-
-  // checkcast and instanceof
- protected:
-  virtual void do_instance_check();
-  virtual bool maybe_do_instanceof_if();
-
-  // new and *newarray
- protected:
-  virtual void do_new();
-  virtual void do_newarray();
-  virtual void do_anewarray();
-  virtual void do_multianewarray();
-
-  // monitorenter and monitorexit
- protected:
-  virtual void do_monitorenter();
-  virtual void do_monitorexit();
-};
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,591 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkBuilder.cpp.incl"
-
-using namespace llvm;
-
-SharkBuilder::SharkBuilder(SharkCodeBuffer* code_buffer)
-  : IRBuilder<>(SharkContext::current()),
-    _code_buffer(code_buffer) {
-}
-
-// Helpers for accessing structures
-Value* SharkBuilder::CreateAddressOfStructEntry(Value*      base,
-                                                ByteSize    offset,
-                                                const Type* type,
-                                                const char* name) {
-  return CreateBitCast(CreateStructGEP(base, in_bytes(offset)), type, name);
-}
-
-LoadInst* SharkBuilder::CreateValueOfStructEntry(Value*      base,
-                                                 ByteSize    offset,
-                                                 const Type* type,
-                                                 const char* name) {
-  return CreateLoad(
-    CreateAddressOfStructEntry(
-      base, offset, PointerType::getUnqual(type)),
-    name);
-}
-
-// Helpers for accessing arrays
-
-LoadInst* SharkBuilder::CreateArrayLength(Value* arrayoop) {
-  return CreateValueOfStructEntry(
-    arrayoop, in_ByteSize(arrayOopDesc::length_offset_in_bytes()),
-    SharkType::jint_type(), "length");
-}
-
-Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
-                                        const Type* element_type,
-                                        int         element_bytes,
-                                        ByteSize    base_offset,
-                                        Value*      index,
-                                        const char* name) {
-  Value* offset = CreateIntCast(index, SharkType::intptr_type(), false);
-  if (element_bytes != 1)
-    offset = CreateShl(
-      offset,
-      LLVMValue::intptr_constant(exact_log2(element_bytes)));
-  offset = CreateAdd(
-    LLVMValue::intptr_constant(in_bytes(base_offset)), offset);
-
-  return CreateIntToPtr(
-    CreateAdd(CreatePtrToInt(arrayoop, SharkType::intptr_type()), offset),
-    PointerType::getUnqual(element_type),
-    name);
-}
-
-Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
-                                        BasicType   basic_type,
-                                        ByteSize    base_offset,
-                                        Value*      index,
-                                        const char* name) {
-  return CreateArrayAddress(
-    arrayoop,
-    SharkType::to_arrayType(basic_type),
-    type2aelembytes(basic_type),
-    base_offset, index, name);
-}
-
-Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
-                                        BasicType   basic_type,
-                                        Value*      index,
-                                        const char* name) {
-  return CreateArrayAddress(
-    arrayoop, basic_type,
-    in_ByteSize(arrayOopDesc::base_offset_in_bytes(basic_type)),
-    index, name);
-}
-
-// Helpers for creating intrinsics and external functions.
-
-const Type* SharkBuilder::make_type(char type, bool void_ok) {
-  switch (type) {
-    // Primitive types
-  case 'c':
-    return SharkType::jbyte_type();
-  case 'i':
-    return SharkType::jint_type();
-  case 'l':
-    return SharkType::jlong_type();
-  case 'x':
-    return SharkType::intptr_type();
-  case 'f':
-    return SharkType::jfloat_type();
-  case 'd':
-    return SharkType::jdouble_type();
-
-    // Pointers to primitive types
-  case 'C':
-  case 'I':
-  case 'L':
-  case 'X':
-  case 'F':
-  case 'D':
-    return PointerType::getUnqual(make_type(tolower(type), false));
-
-    // VM objects
-  case 'T':
-    return SharkType::thread_type();
-  case 'M':
-    return PointerType::getUnqual(SharkType::monitor_type());
-  case 'O':
-    return SharkType::oop_type();
-
-    // Miscellaneous
-  case 'v':
-    assert(void_ok, "should be");
-    return SharkType::void_type();
-  case '1':
-    return SharkType::bit_type();
-
-  default:
-    ShouldNotReachHere();
-  }
-}
-
-const FunctionType* SharkBuilder::make_ftype(const char* params,
-                                             const char* ret) {
-  std::vector<const Type*> param_types;
-  for (const char* c = params; *c; c++)
-    param_types.push_back(make_type(*c, false));
-
-  assert(strlen(ret) == 1, "should be");
-  const Type *return_type = make_type(*ret, true);
-
-  return FunctionType::get(return_type, param_types, false);
-}
-
-// Create an object representing an intrinsic or external function by
-// referencing the symbol by name.  This is the LLVM-style approach,
-// but it cannot be used on functions within libjvm.so its symbols
-// are not exported.  Note that you cannot make this work simply by
-// exporting the symbols, as some symbols have the same names as
-// symbols in the standard libraries (eg, atan2, fabs) and would
-// obscure them were they visible.
-Value* SharkBuilder::make_function(const char* name,
-                                   const char* params,
-                                   const char* ret) {
-  return SharkContext::current().get_external(name, make_ftype(params, ret));
-}
-
-// Create an object representing an external function by inlining a
-// function pointer in the code.  This is not the LLVM way, but it's
-// the only way to access functions in libjvm.so and functions like
-// __kernel_dmb on ARM which is accessed via an absolute address.
-Value* SharkBuilder::make_function(address     func,
-                                   const char* params,
-                                   const char* ret) {
-  return CreateIntToPtr(
-    LLVMValue::intptr_constant((intptr_t) func),
-    PointerType::getUnqual(make_ftype(params, ret)));
-}
-
-// VM calls
-
-Value* SharkBuilder::find_exception_handler() {
-  return make_function(
-    (address) SharkRuntime::find_exception_handler, "TIi", "i");
-}
-
-Value* SharkBuilder::monitorenter() {
-  return make_function((address) SharkRuntime::monitorenter, "TM", "v");
-}
-
-Value* SharkBuilder::monitorexit() {
-  return make_function((address) SharkRuntime::monitorexit, "TM", "v");
-}
-
-Value* SharkBuilder::new_instance() {
-  return make_function((address) SharkRuntime::new_instance, "Ti", "v");
-}
-
-Value* SharkBuilder::newarray() {
-  return make_function((address) SharkRuntime::newarray, "Tii", "v");
-}
-
-Value* SharkBuilder::anewarray() {
-  return make_function((address) SharkRuntime::anewarray, "Tii", "v");
-}
-
-Value* SharkBuilder::multianewarray() {
-  return make_function((address) SharkRuntime::multianewarray, "TiiI", "v");
-}
-
-Value* SharkBuilder::register_finalizer() {
-  return make_function((address) SharkRuntime::register_finalizer, "TO", "v");
-}
-
-Value* SharkBuilder::safepoint() {
-  return make_function((address) SafepointSynchronize::block, "T", "v");
-}
-
-Value* SharkBuilder::throw_ArithmeticException() {
-  return make_function(
-    (address) SharkRuntime::throw_ArithmeticException, "TCi", "v");
-}
-
-Value* SharkBuilder::throw_ArrayIndexOutOfBoundsException() {
-  return make_function(
-    (address) SharkRuntime::throw_ArrayIndexOutOfBoundsException, "TCii", "v");
-}
-
-Value* SharkBuilder::throw_ClassCastException() {
-  return make_function(
-    (address) SharkRuntime::throw_ClassCastException, "TCi", "v");
-}
-
-Value* SharkBuilder::throw_NullPointerException() {
-  return make_function(
-    (address) SharkRuntime::throw_NullPointerException, "TCi", "v");
-}
-
-// High-level non-VM calls
-
-Value* SharkBuilder::f2i() {
-  return make_function((address) SharedRuntime::f2i, "f", "i");
-}
-
-Value* SharkBuilder::f2l() {
-  return make_function((address) SharedRuntime::f2l, "f", "l");
-}
-
-Value* SharkBuilder::d2i() {
-  return make_function((address) SharedRuntime::d2i, "d", "i");
-}
-
-Value* SharkBuilder::d2l() {
-  return make_function((address) SharedRuntime::d2l, "d", "l");
-}
-
-Value* SharkBuilder::is_subtype_of() {
-  return make_function((address) SharkRuntime::is_subtype_of, "OO", "c");
-}
-
-Value* SharkBuilder::current_time_millis() {
-  return make_function((address) os::javaTimeMillis, "", "l");
-}
-
-Value* SharkBuilder::sin() {
-  return make_function("llvm.sin.f64", "d", "d");
-}
-
-Value* SharkBuilder::cos() {
-  return make_function("llvm.cos.f64", "d", "d");
-}
-
-Value* SharkBuilder::tan() {
-  return make_function((address) ::tan, "d", "d");
-}
-
-Value* SharkBuilder::atan2() {
-  return make_function((address) ::atan2, "dd", "d");
-}
-
-Value* SharkBuilder::sqrt() {
-  return make_function("llvm.sqrt.f64", "d", "d");
-}
-
-Value* SharkBuilder::log() {
-  return make_function("llvm.log.f64", "d", "d");
-}
-
-Value* SharkBuilder::log10() {
-  return make_function("llvm.log10.f64", "d", "d");
-}
-
-Value* SharkBuilder::pow() {
-  return make_function("llvm.pow.f64", "dd", "d");
-}
-
-Value* SharkBuilder::exp() {
-  return make_function("llvm.exp.f64", "d", "d");
-}
-
-Value* SharkBuilder::fabs() {
-  return make_function((address) ::fabs, "d", "d");
-}
-
-Value* SharkBuilder::unsafe_field_offset_to_byte_offset() {
-  extern jlong Unsafe_field_offset_to_byte_offset(jlong field_offset);
-  return make_function((address) Unsafe_field_offset_to_byte_offset, "l", "l");
-}
-
-Value* SharkBuilder::osr_migration_end() {
-  return make_function((address) SharedRuntime::OSR_migration_end, "C", "v");
-}
-
-// Semi-VM calls
-
-Value* SharkBuilder::throw_StackOverflowError() {
-  return make_function((address) ZeroStack::handle_overflow, "T", "v");
-}
-
-Value* SharkBuilder::uncommon_trap() {
-  return make_function((address) SharkRuntime::uncommon_trap, "Ti", "i");
-}
-
-Value* SharkBuilder::deoptimized_entry_point() {
-  return make_function((address) CppInterpreter::main_loop, "iT", "v");
-}
-
-// Native-Java transition
-
-Value* SharkBuilder::check_special_condition_for_native_trans() {
-  return make_function(
-    (address) JavaThread::check_special_condition_for_native_trans,
-    "T", "v");
-}
-
-// Low-level non-VM calls
-
-// The ARM-specific code here is to work around unimplemented
-// atomic exchange and memory barrier intrinsics in LLVM.
-//
-// Delegating to external functions for these would normally
-// incur a speed penalty, but Linux on ARM is a special case
-// in that atomic operations on that platform are handled by
-// external functions anyway.  It would be *preferable* for
-// the calls to be hidden away in LLVM, but it's not hurting
-// performance so having the calls here is acceptable.
-//
-// If you are building Shark on a platform without atomic
-// exchange and/or memory barrier intrinsics then it is only
-// acceptable to mimic this approach if your platform cannot
-// perform these operations without delegating to a function.
-
-#ifdef ARM
-static jint zero_cmpxchg_int(volatile jint *ptr, jint oldval, jint newval) {
-  return Atomic::cmpxchg(newval, ptr, oldval);
-}
-#endif // ARM
-
-Value* SharkBuilder::cmpxchg_int() {
-  return make_function(
-#ifdef ARM
-    (address) zero_cmpxchg_int,
-#else
-    "llvm.atomic.cmp.swap.i32.p0i32",
-#endif // ARM
-    "Iii", "i");
-}
-
-#ifdef ARM
-static intptr_t zero_cmpxchg_ptr(volatile intptr_t* ptr,
-                                 intptr_t           oldval,
-                                 intptr_t           newval) {
-  return Atomic::cmpxchg_ptr(newval, ptr, oldval);
-}
-#endif // ARM
-
-Value* SharkBuilder::cmpxchg_ptr() {
-  return make_function(
-#ifdef ARM
-    (address) zero_cmpxchg_ptr,
-#else
-    "llvm.atomic.cmp.swap.i" LP64_ONLY("64") NOT_LP64("32") ".p0i" LP64_ONLY("64") NOT_LP64("32"),
-#endif // ARM
-    "Xxx", "x");
-}
-
-Value* SharkBuilder::frame_address() {
-  return make_function("llvm.frameaddress", "i", "C");
-}
-
-Value* SharkBuilder::memory_barrier() {
-  return make_function(
-#ifdef ARM
-    (address) 0xffff0fa0, // __kernel_dmb
-#else
-    "llvm.memory.barrier",
-#endif // ARM
-    "11111", "v");
-}
-
-Value* SharkBuilder::memset() {
-#if SHARK_LLVM_VERSION >= 28
-  // LLVM 2.8 added a fifth isVolatile field for memset
-  // introduced with LLVM r100304
-  return make_function("llvm.memset.i32", "Cciii", "v");
-#else
-  return make_function("llvm.memset.i32", "Ccii", "v");
-#endif
-}
-
-Value* SharkBuilder::unimplemented() {
-  return make_function((address) report_unimplemented, "Ci", "v");
-}
-
-Value* SharkBuilder::should_not_reach_here() {
-  return make_function((address) report_should_not_reach_here, "Ci", "v");
-}
-
-Value* SharkBuilder::dump() {
-  return make_function((address) SharkRuntime::dump, "Cx", "v");
-}
-
-// Public interface to low-level non-VM calls
-
-CallInst* SharkBuilder::CreateCmpxchgInt(Value* exchange_value,
-                                         Value* dst,
-                                         Value* compare_value) {
-  return CreateCall3(cmpxchg_int(), dst, compare_value, exchange_value);
-}
-
-CallInst* SharkBuilder::CreateCmpxchgPtr(Value* exchange_value,
-                                         Value* dst,
-                                         Value* compare_value) {
-  return CreateCall3(cmpxchg_ptr(), dst, compare_value, exchange_value);
-}
-
-CallInst* SharkBuilder::CreateGetFrameAddress() {
-  return CreateCall(frame_address(), LLVMValue::jint_constant(0));
-}
-
-CallInst *SharkBuilder::CreateMemoryBarrier(int flags) {
-  Value *args[] = {
-    LLVMValue::bit_constant((flags & BARRIER_LOADLOAD) ? 1 : 0),
-    LLVMValue::bit_constant((flags & BARRIER_LOADSTORE) ? 1 : 0),
-    LLVMValue::bit_constant((flags & BARRIER_STORELOAD) ? 1 : 0),
-    LLVMValue::bit_constant((flags & BARRIER_STORESTORE) ? 1 : 0),
-    LLVMValue::bit_constant(1)};
-
-  return CreateCall(memory_barrier(), args, args + 5);
-}
-
-CallInst* SharkBuilder::CreateMemset(Value* dst,
-                                     Value* value,
-                                     Value* len,
-                                     Value* align) {
-#if SHARK_LLVM_VERSION >= 28
-  return CreateCall5(memset(), dst, value, len, align,
-                     LLVMValue::jint_constant(0));
-#else
-  return CreateCall4(memset(), dst, value, len, align);
-#endif
-}
-
-CallInst* SharkBuilder::CreateUnimplemented(const char* file, int line) {
-  return CreateCall2(
-    unimplemented(),
-    CreateIntToPtr(
-      LLVMValue::intptr_constant((intptr_t) file),
-      PointerType::getUnqual(SharkType::jbyte_type())),
-    LLVMValue::jint_constant(line));
-}
-
-CallInst* SharkBuilder::CreateShouldNotReachHere(const char* file, int line) {
-  return CreateCall2(
-    should_not_reach_here(),
-    CreateIntToPtr(
-      LLVMValue::intptr_constant((intptr_t) file),
-      PointerType::getUnqual(SharkType::jbyte_type())),
-    LLVMValue::jint_constant(line));
-}
-
-#ifndef PRODUCT
-CallInst* SharkBuilder::CreateDump(Value* value) {
-  const char *name;
-  if (value->hasName())
-    // XXX this leaks, but it's only debug code
-    name = strdup(value->getName().str().c_str());
-  else
-    name = "unnamed_value";
-
-  if (isa<PointerType>(value->getType()))
-    value = CreatePtrToInt(value, SharkType::intptr_type());
-  else if (value->getType()->
-#if SHARK_LLVM_VERSION >= 27
-           isIntegerTy()
-#else
-           isInteger()
-#endif
-           )
-    value = CreateIntCast(value, SharkType::intptr_type(), false);
-  else
-    Unimplemented();
-
-  return CreateCall2(
-    dump(),
-    CreateIntToPtr(
-      LLVMValue::intptr_constant((intptr_t) name),
-      PointerType::getUnqual(SharkType::jbyte_type())),
-    value);
-}
-#endif // PRODUCT
-
-// HotSpot memory barriers
-
-void SharkBuilder::CreateUpdateBarrierSet(BarrierSet* bs, Value* field) {
-  if (bs->kind() != BarrierSet::CardTableModRef)
-    Unimplemented();
-
-  CreateStore(
-    LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card),
-    CreateIntToPtr(
-      CreateAdd(
-        LLVMValue::intptr_constant(
-          (intptr_t) ((CardTableModRefBS *) bs)->byte_map_base),
-        CreateLShr(
-          CreatePtrToInt(field, SharkType::intptr_type()),
-          LLVMValue::intptr_constant(CardTableModRefBS::card_shift))),
-      PointerType::getUnqual(SharkType::jbyte_type())));
-}
-
-// Helpers for accessing the code buffer
-
-Value* SharkBuilder::code_buffer_address(int offset) {
-  return CreateAdd(
-    code_buffer()->base_pc(),
-    LLVMValue::intptr_constant(offset));
-}
-
-Value* SharkBuilder::CreateInlineOop(jobject object, const char* name) {
-  return CreateLoad(
-    CreateIntToPtr(
-      code_buffer_address(code_buffer()->inline_oop(object)),
-      PointerType::getUnqual(SharkType::oop_type())),
-    name);
-}
-
-Value* SharkBuilder::CreateInlineData(void*       data,
-                                      size_t      size,
-                                      const Type* type, 
-                                      const char* name) {
-  return CreateIntToPtr(
-    code_buffer_address(code_buffer()->inline_data(data, size)),
-    type,
-    name);
-}
-
-// Helpers for creating basic blocks.
-
-BasicBlock* SharkBuilder::GetBlockInsertionPoint() const {
-  BasicBlock *cur = GetInsertBlock();
-
-  // BasicBlock::Create takes an insertBefore argument, so
-  // we need to find the block _after_ the current block
-  Function::iterator iter = cur->getParent()->begin();
-  Function::iterator end  = cur->getParent()->end();
-  while (iter != end) {
-    iter++;
-    if (&*iter == cur) {
-      iter++;
-      break;
-    }
-  }
-
-  if (iter == end)
-    return NULL;
-  else
-    return iter;
-}
-
-BasicBlock* SharkBuilder::CreateBlock(BasicBlock* ip, const char* name) const {
-  return BasicBlock::Create(
-    SharkContext::current(), name, GetInsertBlock()->getParent(), ip);
-}
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkBuilder : public llvm::IRBuilder<> {
-  friend class SharkCompileInvariants;
-
- public:
-  SharkBuilder(SharkCodeBuffer* code_buffer);
-
-  // The code buffer we are building into.
- private:
-  SharkCodeBuffer* _code_buffer;
-
- protected:
-  SharkCodeBuffer* code_buffer() const {
-    return _code_buffer;
-  }
-
-  // Helpers for accessing structures.
- public:
-  llvm::Value* CreateAddressOfStructEntry(llvm::Value* base,
-                                          ByteSize offset,
-                                          const llvm::Type* type,
-                                          const char *name = "");
-  llvm::LoadInst* CreateValueOfStructEntry(llvm::Value* base,
-                                           ByteSize offset,
-                                           const llvm::Type* type,
-                                           const char *name = "");
-
-  // Helpers for accessing arrays.
- public:
-  llvm::LoadInst* CreateArrayLength(llvm::Value* arrayoop);
-  llvm::Value* CreateArrayAddress(llvm::Value*      arrayoop,
-                                  const llvm::Type* element_type,
-                                  int               element_bytes,
-                                  ByteSize          base_offset,
-                                  llvm::Value*      index,
-                                  const char*       name = "");
-  llvm::Value* CreateArrayAddress(llvm::Value* arrayoop,
-                                  BasicType    basic_type,
-                                  ByteSize     base_offset,
-                                  llvm::Value* index,
-                                  const char*  name = "");
-  llvm::Value* CreateArrayAddress(llvm::Value* arrayoop,
-                                  BasicType    basic_type,
-                                  llvm::Value* index,
-                                  const char*  name = "");
-
-  // Helpers for creating intrinsics and external functions.
- private:
-  static const llvm::Type* make_type(char type, bool void_ok);
-  static const llvm::FunctionType* make_ftype(const char* params,
-                                              const char* ret);
-  llvm::Value* make_function(const char* name,
-                             const char* params,
-                             const char* ret);
-  llvm::Value* make_function(address     func,
-                             const char* params,
-                             const char* ret);
-
-  // Intrinsics and external functions, part 1: VM calls.
-  //   These are functions declared with JRT_ENTRY and JRT_EXIT,
-  //   macros which flip the thread from _thread_in_Java to
-  //   _thread_in_vm and back.  VM calls always safepoint, and can
-  //   therefore throw exceptions.  VM calls require of setup and
-  //   teardown, and must be called with SharkTopLevelBlock::call_vm.
- public:
-  llvm::Value* find_exception_handler();
-  llvm::Value* monitorenter();
-  llvm::Value* monitorexit();
-  llvm::Value* new_instance();
-  llvm::Value* newarray();
-  llvm::Value* anewarray();
-  llvm::Value* multianewarray();
-  llvm::Value* register_finalizer();
-  llvm::Value* safepoint();
-  llvm::Value* throw_ArithmeticException();
-  llvm::Value* throw_ArrayIndexOutOfBoundsException();
-  llvm::Value* throw_ClassCastException();
-  llvm::Value* throw_NullPointerException();
-
-  // Intrinsics and external functions, part 2: High-level non-VM calls.
-  //   These are called like normal functions.  The stack is not set
-  //   up for walking so they must not safepoint or throw exceptions,
-  //   or call anything that might.
- public:
-  llvm::Value* f2i();
-  llvm::Value* f2l();
-  llvm::Value* d2i();
-  llvm::Value* d2l();
-  llvm::Value* is_subtype_of();
-  llvm::Value* current_time_millis();
-  llvm::Value* sin();
-  llvm::Value* cos();
-  llvm::Value* tan();
-  llvm::Value* atan2();
-  llvm::Value* sqrt();
-  llvm::Value* log();
-  llvm::Value* log10();
-  llvm::Value* pow();
-  llvm::Value* exp();
-  llvm::Value* fabs();
-  llvm::Value* unsafe_field_offset_to_byte_offset();
-  llvm::Value* osr_migration_end();
-
-  // Intrinsics and external functions, part 3: semi-VM calls.
-  //   These are special cases that do VM call stuff but are invoked
-  //   as though they were normal calls.  This is acceptable so long
-  //   as the method that calls them returns to its immediately that
-  //   the semi VM call returns.
- public:
-  llvm::Value* throw_StackOverflowError();
-  llvm::Value* uncommon_trap();
-  llvm::Value* deoptimized_entry_point();
-
-  // Intrinsics and external functions, part 4: Native-Java transition.
-  //   This is a special case in that it is invoked during a thread
-  //   state transition.  The stack must be set up for walking, and it
-  //   may throw exceptions, but the state is _thread_in_native_trans.
- public:
-  llvm::Value* check_special_condition_for_native_trans();
-
-  // Intrinsics and external functions, part 5: Low-level non-VM calls.
-  //   These have the same caveats as the high-level non-VM calls
-  //   above.  They are not accessed directly; rather, you should
-  //   access them via the various Create* methods below.
- private:
-  llvm::Value* cmpxchg_int();
-  llvm::Value* cmpxchg_ptr();
-  llvm::Value* frame_address();
-  llvm::Value* memory_barrier();
-  llvm::Value* memset();
-  llvm::Value* unimplemented();
-  llvm::Value* should_not_reach_here();
-  llvm::Value* dump();
-
-  // Public interface to low-level non-VM calls.
- public:
-  llvm::CallInst* CreateCmpxchgInt(llvm::Value* exchange_value,
-                                   llvm::Value* dst,
-                                   llvm::Value* compare_value);
-  llvm::CallInst* CreateCmpxchgPtr(llvm::Value* exchange_value,
-                                   llvm::Value* dst,
-                                   llvm::Value* compare_value);
-  llvm::CallInst* CreateGetFrameAddress();
-  llvm::CallInst* CreateMemoryBarrier(int flags);
-  llvm::CallInst* CreateMemset(llvm::Value* dst,
-                               llvm::Value* value,
-                               llvm::Value* len,
-                               llvm::Value* align);
-  llvm::CallInst* CreateUnimplemented(const char* file, int line);
-  llvm::CallInst* CreateShouldNotReachHere(const char* file, int line);
-  NOT_PRODUCT(llvm::CallInst* CreateDump(llvm::Value* value));
-
-  // Flags for CreateMemoryBarrier.
- public:
-  enum BarrierFlags {
-    BARRIER_LOADLOAD   = 1,
-    BARRIER_LOADSTORE  = 2,
-    BARRIER_STORELOAD  = 4,
-    BARRIER_STORESTORE = 8
-  };
-
-  // HotSpot memory barriers
- public:
-  void CreateUpdateBarrierSet(BarrierSet* bs, llvm::Value* field);
-
-  // Helpers for accessing the code buffer.
- public:
-  llvm::Value* code_buffer_address(int offset);
-  llvm::Value* CreateInlineOop(jobject object, const char* name = "");
-  llvm::Value* CreateInlineOop(ciObject* object, const char* name = "") {
-    return CreateInlineOop(object->constant_encoding(), name);
-  }
-  llvm::Value* CreateInlineData(void*             data,
-                                size_t            size,
-                                const llvm::Type* type, 
-                                const char*       name = ""); 
-
-  // Helpers for creating basic blocks.
-  // NB don't use unless SharkFunction::CreateBlock is unavailable.
-  // XXX these are hacky and should be removed.
- public:
-  llvm::BasicBlock* GetBlockInsertionPoint() const;
-  llvm::BasicBlock* CreateBlock(llvm::BasicBlock* ip,
-                                const char*       name="") const;
-};
--- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkCacheDecache.cpp.incl"
-
-using namespace llvm;
-
-void SharkDecacher::start_frame() {
-  // Start recording the debug information
-  _pc_offset = code_buffer()->create_unique_offset();
-  _oopmap = new OopMap(
-    oopmap_slot_munge(stack()->oopmap_frame_size()),
-    oopmap_slot_munge(arg_size()));
-  debug_info()->add_safepoint(pc_offset(), oopmap());
-}
-
-void SharkDecacher::start_stack(int stack_depth) {
-  // Create the array we'll record our stack slots in
-  _exparray = new GrowableArray<ScopeValue*>(stack_depth);
-
-  // Set the stack pointer
-  stack()->CreateStoreStackPointer(
-    builder()->CreatePtrToInt(
-      stack()->slot_addr(
-        stack()->stack_slots_offset() + max_stack() - stack_depth),
-      SharkType::intptr_type()));
-}
-
-void SharkDecacher::process_stack_slot(int          index,
-                                       SharkValue** addr,
-                                       int          offset) {
-  SharkValue *value = *addr;
-
-  // Write the value to the frame if necessary
-  if (stack_slot_needs_write(index, value)) {
-    write_value_to_frame(
-      SharkType::to_stackType(value->basic_type()),
-      value->generic_value(),
-      adjusted_offset(value, offset));
-  }
-
-  // Record the value in the oopmap if necessary
-  if (stack_slot_needs_oopmap(index, value)) {
-    oopmap()->set_oop(slot2reg(offset));
-  }
-
-  // Record the value in the debuginfo if necessary
-  if (stack_slot_needs_debuginfo(index, value)) {
-    exparray()->append(slot2lv(offset, stack_location_type(index, addr)));
-  }
-}
-
-void SharkDecacher::start_monitors(int num_monitors) {
-  // Create the array we'll record our monitors in
-  _monarray = new GrowableArray<MonitorValue*>(num_monitors);
-}
-
-void SharkDecacher::process_monitor(int index, int box_offset, int obj_offset) {
-  oopmap()->set_oop(slot2reg(obj_offset));
-
-  monarray()->append(new MonitorValue(
-    slot2lv (obj_offset, Location::oop),
-    slot2loc(box_offset, Location::normal)));
-}
-
-void SharkDecacher::process_oop_tmp_slot(Value** value, int offset) {
-  // Decache the temporary oop slot
-  if (*value) {
-    write_value_to_frame(
-      SharkType::oop_type(),
-      *value,
-      offset);
-
-    oopmap()->set_oop(slot2reg(offset));
-  }
-}
-
-void SharkDecacher::process_method_slot(Value** value, int offset) {
-  // Decache the method pointer
-  write_value_to_frame(
-    SharkType::methodOop_type(),
-    *value,
-    offset);
-
-  oopmap()->set_oop(slot2reg(offset));
-}
-
-void SharkDecacher::process_pc_slot(int offset) {
-  // Record the PC
-  builder()->CreateStore(
-    builder()->code_buffer_address(pc_offset()),
-    stack()->slot_addr(offset));
-}
-
-void SharkDecacher::start_locals() {
-  // Create the array we'll record our local variables in
-  _locarray = new GrowableArray<ScopeValue*>(max_locals());}
-
-void SharkDecacher::process_local_slot(int          index,
-                                       SharkValue** addr,
-                                       int          offset) {
-  SharkValue *value = *addr;
-
-  // Write the value to the frame if necessary
-  if (local_slot_needs_write(index, value)) {
-    write_value_to_frame(
-      SharkType::to_stackType(value->basic_type()),
-      value->generic_value(),
-      adjusted_offset(value, offset));
-  }
-
-  // Record the value in the oopmap if necessary
-  if (local_slot_needs_oopmap(index, value)) {
-    oopmap()->set_oop(slot2reg(offset));
-  }
-
-  // Record the value in the debuginfo if necessary
-  if (local_slot_needs_debuginfo(index, value)) {
-    locarray()->append(slot2lv(offset, local_location_type(index, addr)));
-  }
-}
-
-void SharkDecacher::end_frame() {
-  // Record the scope
-  debug_info()->describe_scope(
-    pc_offset(),
-    target(),
-    bci(),
-    true,
-    false,
-    false,
-    debug_info()->create_scope_values(locarray()),
-    debug_info()->create_scope_values(exparray()),
-    debug_info()->create_monitor_values(monarray()));
-
-  // Finish recording the debug information
-  debug_info()->end_safepoint(pc_offset());
-}
-
-void SharkCacher::process_stack_slot(int          index,
-                                     SharkValue** addr,
-                                     int          offset) {
-  SharkValue *value = *addr;
-
-  // Read the value from the frame if necessary
-  if (stack_slot_needs_read(index, value)) {
-    *addr = SharkValue::create_generic(
-      value->type(),
-      read_value_from_frame(
-        SharkType::to_stackType(value->basic_type()),
-        adjusted_offset(value, offset)),
-      value->zero_checked());
-  }
-}
-
-void SharkOSREntryCacher::process_monitor(int index,
-                                          int box_offset,
-                                          int obj_offset) {
-  // Copy the monitor from the OSR buffer to the frame
-  int src_offset = max_locals() + index * 2;
-  builder()->CreateStore(
-    builder()->CreateLoad(
-      CreateAddressOfOSRBufEntry(src_offset, SharkType::intptr_type())),
-    stack()->slot_addr(box_offset, SharkType::intptr_type()));
-  builder()->CreateStore(
-    builder()->CreateLoad(
-      CreateAddressOfOSRBufEntry(src_offset + 1, SharkType::oop_type())),
-    stack()->slot_addr(obj_offset, SharkType::oop_type()));
-}
-
-void SharkCacher::process_oop_tmp_slot(Value** value, int offset) {
-  // Cache the temporary oop
-  if (*value)
-    *value = read_value_from_frame(SharkType::oop_type(), offset);
-}
-
-void SharkCacher::process_method_slot(Value** value, int offset) {
-  // Cache the method pointer
-  *value = read_value_from_frame(SharkType::methodOop_type(), offset);
-}
-
-void SharkFunctionEntryCacher::process_method_slot(Value** value, int offset) {
-  // "Cache" the method pointer
-  *value = method();
-}
-
-void SharkCacher::process_local_slot(int          index,
-                                     SharkValue** addr,
-                                     int          offset) {
-  SharkValue *value = *addr;
-
-  // Read the value from the frame if necessary
-  if (local_slot_needs_read(index, value)) {
-    *addr = SharkValue::create_generic(
-      value->type(),
-      read_value_from_frame(
-        SharkType::to_stackType(value->basic_type()),
-        adjusted_offset(value, offset)),
-      value->zero_checked());
-  }
-}
-
-Value* SharkOSREntryCacher::CreateAddressOfOSRBufEntry(int         offset,
-                                                       const Type* type) {
-  Value *result = builder()->CreateStructGEP(osr_buf(), offset);
-  if (type != SharkType::intptr_type())
-    result = builder()->CreateBitCast(result, PointerType::getUnqual(type));
-  return result;
-}
-
-void SharkOSREntryCacher::process_local_slot(int          index,
-                                             SharkValue** addr,
-                                             int          offset) {
-  SharkValue *value = *addr;
-
-  // Read the value from the OSR buffer if necessary
-  if (local_slot_needs_read(index, value)) {
-    *addr = SharkValue::create_generic(
-      value->type(),
-      builder()->CreateLoad(
-        CreateAddressOfOSRBufEntry(
-          adjusted_offset(value, max_locals() - 1 - index),
-          SharkType::to_stackType(value->basic_type()))),
-      value->zero_checked());
-  }
-}
-
-void SharkDecacher::write_value_to_frame(const Type* type,
-                                         Value*      value,
-                                         int         offset) {
-  builder()->CreateStore(value, stack()->slot_addr(offset, type));
-}
-
-Value* SharkCacher::read_value_from_frame(const Type* type, int offset) {
-  return builder()->CreateLoad(stack()->slot_addr(offset, type));
-}
--- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,417 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-// Class hierarchy:
-// - SharkStateScanner
-//   - SharkCacherDecacher
-//     - SharkDecacher
-//       - SharkJavaCallDecacher
-//       - SharkVMCallDecacher
-//       - SharkTrapDecacher
-//     - SharkCacher
-//       - SharkJavaCallCacher
-//       - SharkVMCallCacher
-//       - SharkFunctionEntryCacher
-//         - SharkNormalEntryCacher
-//         - SharkOSREntryCacher
-
-class SharkCacherDecacher : public SharkStateScanner {
- protected:
-  SharkCacherDecacher(SharkFunction* function)
-    : SharkStateScanner(function) {}
-
-  // Helper
- protected:
-  static int adjusted_offset(SharkValue* value, int offset) {
-    if (value->is_two_word())
-      offset--;
-    return offset;
-  }
-};
-
-class SharkDecacher : public SharkCacherDecacher {
- protected:
-  SharkDecacher(SharkFunction* function, int bci)
-    : SharkCacherDecacher(function), _bci(bci) {}
-
- private:
-  int _bci;
-
- protected:
-  int bci() const {
-    return _bci;
-  }
-
- private:
-  int                           _pc_offset;
-  OopMap*                       _oopmap;
-  GrowableArray<ScopeValue*>*   _exparray;
-  GrowableArray<MonitorValue*>* _monarray;
-  GrowableArray<ScopeValue*>*   _locarray;
-
- private:
-  int pc_offset() const {
-    return _pc_offset;
-  }
-  OopMap* oopmap() const {
-    return _oopmap;
-  }
-  GrowableArray<ScopeValue*>* exparray() const {
-    return _exparray;
-  }
-  GrowableArray<MonitorValue*>* monarray() const {
-    return _monarray;
-  }
-  GrowableArray<ScopeValue*>* locarray() const {
-    return _locarray;
-  }
-
-  // Callbacks
- protected:
-  void start_frame();
-
-  void start_stack(int stack_depth);
-  void process_stack_slot(int index, SharkValue** value, int offset);
-
-  void start_monitors(int num_monitors);
-  void process_monitor(int index, int box_offset, int obj_offset);
-
-  void process_oop_tmp_slot(llvm::Value** value, int offset);
-  void process_method_slot(llvm::Value** value, int offset);
-  void process_pc_slot(int offset);
-
-  void start_locals();
-  void process_local_slot(int index, SharkValue** value, int offset);
-
-  void end_frame();
-
-  // oopmap and debuginfo helpers
- private:
-  static int oopmap_slot_munge(int offset) {
-    return SharkStack::oopmap_slot_munge(offset);
-  }
-  static VMReg slot2reg(int offset) {
-    return SharkStack::slot2reg(offset);
-  }
-  static Location slot2loc(int offset, Location::Type type) {
-    return Location::new_stk_loc(type, offset * wordSize);
-  }
-  static LocationValue* slot2lv(int offset, Location::Type type) {
-    return new LocationValue(slot2loc(offset, type));
-  }
-  static Location::Type location_type(SharkValue** addr, bool maybe_two_word) {
-    // low addresses this end
-    //                           Type       32-bit    64-bit
-    //   ----------------------------------------------------
-    //   stack[0]    local[3]    jobject    oop       oop
-    //   stack[1]    local[2]    NULL       normal    lng
-    //   stack[2]    local[1]    jlong      normal    invalid
-    //   stack[3]    local[0]    jint       normal    normal
-    //
-    // high addresses this end
-
-    SharkValue *value = *addr;
-    if (value) {
-      if (value->is_jobject())
-        return Location::oop;
-#ifdef _LP64
-      if (value->is_two_word())
-        return Location::invalid;
-#endif // _LP64
-      return Location::normal;
-    }
-    else {
-      if (maybe_two_word) {
-        value = *(addr - 1);
-        if (value && value->is_two_word()) {
-#ifdef _LP64
-          if (value->is_jlong())
-            return Location::lng;
-          if (value->is_jdouble())
-            return Location::dbl;
-          ShouldNotReachHere();
-#else
-          return Location::normal;
-#endif // _LP64
-        }
-      }
-      return Location::invalid;
-    }
-  }
-
-  // Stack slot helpers
- protected:
-  virtual bool stack_slot_needs_write(int index, SharkValue* value) = 0;
-  virtual bool stack_slot_needs_oopmap(int index, SharkValue* value) = 0;
-  virtual bool stack_slot_needs_debuginfo(int index, SharkValue* value) = 0;
-
-  static Location::Type stack_location_type(int index, SharkValue** addr) {
-    return location_type(addr, *addr == NULL);
-  }
-
-  // Local slot helpers
- protected:
-  virtual bool local_slot_needs_write(int index, SharkValue* value) = 0;
-  virtual bool local_slot_needs_oopmap(int index, SharkValue* value) = 0;
-  virtual bool local_slot_needs_debuginfo(int index, SharkValue* value) = 0;
-
-  static Location::Type local_location_type(int index, SharkValue** addr) {
-    return location_type(addr, index > 0);
-  }
-
-  // Writer helper
- protected:
-  void write_value_to_frame(const llvm::Type* type,
-                            llvm::Value*      value,
-                            int               offset);
-};
-
-class SharkJavaCallDecacher : public SharkDecacher {
- public:
-  SharkJavaCallDecacher(SharkFunction* function, int bci, ciMethod* callee)
-    : SharkDecacher(function, bci), _callee(callee) {}
-
- private:
-  ciMethod* _callee;
-
- protected:
-  ciMethod* callee() const {
-    return _callee;
-  }
-
-  // Stack slot helpers
- protected:
-  bool stack_slot_needs_write(int index, SharkValue* value) {
-    return value && (index < callee()->arg_size() || value->is_jobject());
-  }
-  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
-    return value && value->is_jobject() && index >= callee()->arg_size();
-  }
-  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
-    return index >= callee()->arg_size();
-  }
-
-  // Local slot helpers
- protected:
-  bool local_slot_needs_write(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool local_slot_needs_oopmap(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
-    return true;
-  }
-};
-
-class SharkVMCallDecacher : public SharkDecacher {
- public:
-  SharkVMCallDecacher(SharkFunction* function, int bci)
-    : SharkDecacher(function, bci) {}
-
-  // Stack slot helpers
- protected:
-  bool stack_slot_needs_write(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
-    return true;
-  }
-
-  // Local slot helpers
- protected:
-  bool local_slot_needs_write(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool local_slot_needs_oopmap(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
-    return true;
-  }
-};
-
-class SharkTrapDecacher : public SharkDecacher {
- public:
-  SharkTrapDecacher(SharkFunction* function, int bci)
-    : SharkDecacher(function, bci) {}
-
-  // Stack slot helpers
- protected:
-  bool stack_slot_needs_write(int index, SharkValue* value) {
-    return value != NULL;
-  }
-  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
-    return true;
-  }
-
-  // Local slot helpers
- protected:
-  bool local_slot_needs_write(int index, SharkValue* value) {
-    return value != NULL;
-  }
-  bool local_slot_needs_oopmap(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
-    return true;
-  }
-};
-
-class SharkCacher : public SharkCacherDecacher {
- protected:
-  SharkCacher(SharkFunction* function)
-    : SharkCacherDecacher(function) {}
-
-  // Callbacks
- protected:
-  void process_stack_slot(int index, SharkValue** value, int offset);
-
-  void process_oop_tmp_slot(llvm::Value** value, int offset);
-  virtual void process_method_slot(llvm::Value** value, int offset);
-
-  virtual void process_local_slot(int index, SharkValue** value, int offset);
-
-  // Stack slot helper
- protected:
-  virtual bool stack_slot_needs_read(int index, SharkValue* value) = 0;
-
-  // Local slot helper
- protected:
-  virtual bool local_slot_needs_read(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-
-  // Writer helper
- protected:
-  llvm::Value* read_value_from_frame(const llvm::Type* type, int offset);
-};
-
-class SharkJavaCallCacher : public SharkCacher {
- public:
-  SharkJavaCallCacher(SharkFunction* function, ciMethod* callee)
-    : SharkCacher(function), _callee(callee) {}
-
- private:
-  ciMethod* _callee;
-
- protected:
-  ciMethod* callee() const {
-    return _callee;
-  }
-
-  // Stack slot helper
- protected:
-  bool stack_slot_needs_read(int index, SharkValue* value) {
-    return value && (index < callee()->return_type()->size() ||
-                     value->is_jobject());
-  }
-};
-
-class SharkVMCallCacher : public SharkCacher {
- public:
-  SharkVMCallCacher(SharkFunction* function)
-    : SharkCacher(function) {}
-
-  // Stack slot helper
- protected:
-  bool stack_slot_needs_read(int index, SharkValue* value) {
-    return value && value->is_jobject();
-  }
-};
-
-class SharkFunctionEntryCacher : public SharkCacher {
- public:
-  SharkFunctionEntryCacher(SharkFunction* function, llvm::Value* method)
-    : SharkCacher(function), _method(method) {}
-
- private:
-  llvm::Value* _method;
-
- private:
-  llvm::Value* method() const {
-    return _method;
-  }
-
-  // Method slot callback
- protected:
-  void process_method_slot(llvm::Value** value, int offset);
-
-  // Stack slot helper
- protected:
-  bool stack_slot_needs_read(int index, SharkValue* value) {
-    ShouldNotReachHere(); // entry block shouldn't have stack
-  }
-
-  // Local slot helper
- protected:
-  bool local_slot_needs_read(int index, SharkValue* value) {
-    return value != NULL;
-  }
-};
-
-class SharkNormalEntryCacher : public SharkFunctionEntryCacher {
- public:
-  SharkNormalEntryCacher(SharkFunction* function, llvm::Value* method)
-    : SharkFunctionEntryCacher(function, method) {}
-};
-
-class SharkOSREntryCacher : public SharkFunctionEntryCacher {
- public:
-  SharkOSREntryCacher(SharkFunction* function,
-                      llvm::Value*   method,
-                      llvm::Value*   osr_buf)
-    : SharkFunctionEntryCacher(function, method),
-      _osr_buf(
-        builder()->CreateBitCast(
-          osr_buf,
-          llvm::PointerType::getUnqual(
-            llvm::ArrayType::get(
-              SharkType::intptr_type(),
-              max_locals() + max_monitors() * 2)))) {}
-
- private:
-  llvm::Value* _osr_buf;
-
- private:
-  llvm::Value* osr_buf() const {
-    return _osr_buf;
-  }
-
-  // Callbacks
- protected:
-  void process_monitor(int index, int box_offset, int obj_offset);
-  void process_local_slot(int index, SharkValue** value, int offset);
-
-  // Helper
- private:
-  llvm::Value* CreateAddressOfOSRBufEntry(int offset, const llvm::Type* type);
-};
--- a/ports/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkCodeBuffer : public StackObj {
- public:
-  SharkCodeBuffer(MacroAssembler* masm)
-    : _masm(masm), _base_pc(NULL) {}
-
- private:
-  MacroAssembler* _masm;
-  llvm::Value*    _base_pc;
-
- private:
-  MacroAssembler* masm() const {
-    return _masm;
-  }
-
- public:
-  llvm::Value* base_pc() const {
-    return _base_pc;
-  }
-  void set_base_pc(llvm::Value* base_pc) {
-    assert(_base_pc == NULL, "only do this once");
-    _base_pc = base_pc;
-  }
-
-  // Allocate some space in the buffer and return its address.
-  // This buffer will have been relocated by the time the method
-  // is installed, so you can't inline the result in code.
- public:
-  void* malloc(size_t size) const {
-    masm()->align(BytesPerWord);
-    void *result = masm()->pc();
-    masm()->advance(size);
-    return result;
-  }
-
-  // Create a unique offset in the buffer.
- public:
-  int create_unique_offset() const {
-    int offset = masm()->offset();
-    masm()->advance(1);
-    return offset;
-  }
-
-  // Inline an oop into the buffer and return its offset.
- public:
-  int inline_oop(jobject object) const {
-    masm()->align(BytesPerWord);
-    int offset = masm()->offset();
-    masm()->store_oop(object);
-    return offset;
-  }
-
-  // Inline a block of non-oop data into the buffer and return its offset.
- public:
-  int inline_data(void *src, size_t size) const {
-    masm()->align(BytesPerWord);
-    int offset = masm()->offset();
-    void *dst = masm()->pc();
-    masm()->advance(size);
-    memcpy(dst, src, size);
-    return offset;
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkCompiler.cpp.incl"
-
-#include <fnmatch.h>
-
-using namespace llvm;
-
-#if SHARK_LLVM_VERSION >= 27
-namespace {
-  cl::opt<std::string>
-  MCPU("mcpu");
-
-  cl::list<std::string>
-  MAttrs("mattr",
-         cl::CommaSeparated);
-}
-#endif
-
-SharkCompiler::SharkCompiler()
-  : AbstractCompiler() {
-  // Create the lock to protect the memory manager and execution engine
-  _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock");
-  MutexLocker locker(execution_engine_lock());
-
-  // Make LLVM safe for multithreading
-  if (!llvm_start_multithreaded())
-    fatal("llvm_start_multithreaded() failed");
-
-  // Initialize the native target
-  InitializeNativeTarget();
-
-  // Create the two contexts which we'll use
-  _normal_context = new SharkContext("normal");
-  _native_context = new SharkContext("native");
-
-  // Create the memory manager
-  _memory_manager = new SharkMemoryManager();
-
-#if SHARK_LLVM_VERSION >= 27
-  // Finetune LLVM for the current host CPU.
-  StringMap<bool> Features;
-  bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features);
-  std::string cpu("-mcpu=" + llvm::sys::getHostCPUName());
-
-  std::vector<const char*> args;
-  args.push_back(""); // program name
-  args.push_back(cpu.c_str());
-
-  std::string mattr("-mattr=");
-  if(gotCpuFeatures){
-    for(StringMap<bool>::iterator I = Features.begin(),
-      E = Features.end(); I != E; ++I){
-      if(I->second){
-        std::string attr(I->first());
-        mattr+="+"+attr+",";
-      }
-    }
-    args.push_back(mattr.c_str());
-  }
-
-  args.push_back(0);  // terminator
-  cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
-
-  // Create the JIT
-  std::string ErrorMsg;
-
-  EngineBuilder builder(_normal_context->module());
-  builder.setMCPU(MCPU);
-  builder.setMAttrs(MAttrs);
-  builder.setJITMemoryManager(memory_manager());
-  builder.setEngineKind(EngineKind::JIT);
-  builder.setErrorStr(&ErrorMsg);
-  _execution_engine = builder.create();
-
-  if (!execution_engine()) {
-    if (!ErrorMsg.empty())
-      printf("Error while creating Shark JIT: %s\n",ErrorMsg.c_str());
-    else
-      printf("Unknown error while creating Shark JIT\n");
-    exit(1);
-  }
-
-  execution_engine()->addModule(
-    _native_context->module());
-#else
-  _execution_engine = ExecutionEngine::createJIT(
-    _normal_context->module_provider(),
-    NULL, memory_manager(), CodeGenOpt::Default);
-  execution_engine()->addModuleProvider(
-    _native_context->module_provider());
-#endif
-
-  // All done
-  mark_initialized();
-}
-
-void SharkCompiler::initialize() {
-  ShouldNotCallThis();
-}
-
-void SharkCompiler::compile_method(ciEnv*    env,
-                                   ciMethod* target,
-                                   int       entry_bci) {
-  assert(is_initialized(), "should be");
-  ResourceMark rm;
-  const char *name = methodname(
-    target->holder()->name()->as_utf8(), target->name()->as_utf8());
-
-  // Do the typeflow analysis
-  ciTypeFlow *flow;
-  if (entry_bci == InvocationEntryBci)
-    flow = target->get_flow_analysis();
-  else
-    flow = target->get_osr_flow_analysis(entry_bci);
-  if (flow->failing())
-    return;
-  if (SharkPrintTypeflowOf != NULL) {
-    if (!fnmatch(SharkPrintTypeflowOf, name, 0))
-      flow->print_on(tty);
-  }
-
-  // Create the recorders
-  Arena arena;
-  env->set_oop_recorder(new OopRecorder(&arena));
-  OopMapSet oopmaps;
-  env->set_debug_info(new DebugInformationRecorder(env->oop_recorder()));
-  env->debug_info()->set_oopmaps(&oopmaps);
-  env->set_dependencies(new Dependencies(env));
-
-  // Create the code buffer and builder
-  CodeBuffer hscb("Shark", 256 * K, 64 * K);
-  hscb.initialize_oop_recorder(env->oop_recorder());
-  MacroAssembler *masm = new MacroAssembler(&hscb);
-  SharkCodeBuffer cb(masm);
-  SharkBuilder builder(&cb);
-
-  // Emit the entry point
-  SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry));
-
-  // Build the LLVM IR for the method
-  Function *function = SharkFunction::build(env, &builder, flow, name);
-
-  // Generate native code.  It's unpleasant that we have to drop into
-  // the VM to do this -- it blocks safepoints -- but I can't see any
-  // other way to handle the locking.
-  {
-    ThreadInVMfromNative tiv(JavaThread::current());
-    generate_native_code(entry, function, name);
-  }
-
-  // Install the method into the VM
-  CodeOffsets offsets;
-  offsets.set_value(CodeOffsets::Deopt, 0);
-  offsets.set_value(CodeOffsets::Exceptions, 0);
-  offsets.set_value(CodeOffsets::Verified_Entry,
-                    target->is_static() ? 0 : wordSize);
-
-  ExceptionHandlerTable handler_table;
-  ImplicitExceptionTable inc_table;
-
-  env->register_method(target,
-                       entry_bci,
-                       &offsets,
-                       0,
-                       &hscb,
-                       0,
-                       &oopmaps,
-                       &handler_table,
-                       &inc_table,
-                       this,
-                       env->comp_level(),
-                       false,
-                       false);
-}
-
-nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
-                                                methodHandle    target,
-                                                BasicType*      arg_types,
-                                                BasicType       return_type) {
-  assert(is_initialized(), "should be");
-  ResourceMark rm;
-  const char *name = methodname(
-    target->klass_name()->as_utf8(), target->name()->as_utf8());
-
-  // Create the code buffer and builder
-  SharkCodeBuffer cb(masm);
-  SharkBuilder builder(&cb);
-
-  // Emit the entry point
-  SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry));
-
-  // Build the LLVM IR for the method
-  SharkNativeWrapper *wrapper = SharkNativeWrapper::build(
-    &builder, target, name, arg_types, return_type);
-
-  // Generate native code
-  generate_native_code(entry, wrapper->function(), name);
-
-  // Return the nmethod for installation in the VM
-  return nmethod::new_native_nmethod(target,
-                                     masm->code(),
-                                     0,
-                                     0,
-                                     wrapper->frame_size(),
-                                     wrapper->receiver_offset(),
-                                     wrapper->lock_offset(),
-                                     wrapper->oop_maps());
-}
-
-void SharkCompiler::generate_native_code(SharkEntry* entry,
-                                         Function*   function,
-                                         const char* name) {
-  // Print the LLVM bitcode, if requested
-  if (SharkPrintBitcodeOf != NULL) {
-    if (!fnmatch(SharkPrintBitcodeOf, name, 0))
-      function->dump();
-  }
-
-  // Compile to native code
-  address code = NULL;
-  context()->add_function(function);
-  {
-    MutexLocker locker(execution_engine_lock());
-    free_queued_methods();
-
-    if (SharkPrintAsmOf != NULL) {
-#if SHARK_LLVM_VERSION >= 27
-#ifndef NDEBUG
-      if (!fnmatch(SharkPrintAsmOf, name, 0)) {
-        llvm::SetCurrentDebugType(X86_ONLY("x86-emitter") NOT_X86("jit"));
-        llvm::DebugFlag = true;
-      }
-      else {
-        llvm::SetCurrentDebugType("");
-        llvm::DebugFlag = false;
-      }
-#endif // !NDEBUG
-#else
-      // NB you need to patch LLVM with http://tinyurl.com/yf3baln for this
-      std::vector<const char*> args;
-      args.push_back(""); // program name
-      if (!fnmatch(SharkPrintAsmOf, name, 0))
-        args.push_back("-debug-only=x86-emitter");
-      else
-        args.push_back("-debug-only=none");
-      args.push_back(0);  // terminator
-      cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
-#endif // SHARK_LLVM_VERSION
-    }
-    memory_manager()->set_entry_for_function(function, entry);
-    code = (address) execution_engine()->getPointerToFunction(function);
-  }
-  entry->set_entry_point(code);
-  entry->set_function(function);
-  entry->set_context(context());
-  address code_start = entry->code_start();
-  address code_limit = entry->code_limit();
-
-  // Register generated code for profiling, etc
-  if (JvmtiExport::should_post_dynamic_code_generated())
-    JvmtiExport::post_dynamic_code_generated(name, code_start, code_limit);
-
-  // Print debug information, if requested
-  if (SharkTraceInstalls) {
-    tty->print_cr(
-      " [%p-%p): %s (%d bytes code)",
-      code_start, code_limit, name, code_limit - code_start);
-  }
-}
-
-void SharkCompiler::free_compiled_method(address code) {
-  // This method may only be called when the VM is at a safepoint.
-  // All _thread_in_vm threads will be waiting for the safepoint to
-  // finish with the exception of the VM thread, so we can consider
-  // ourself the owner of the execution engine lock even though we
-  // can't actually acquire it at this time.
-  assert(Thread::current()->is_VM_thread(), "must be called by VM thread");
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-
-  SharkEntry *entry = (SharkEntry *) code;
-  entry->context()->push_to_free_queue(entry->function());
-}
-
-void SharkCompiler::free_queued_methods() {
-  // The free queue is protected by the execution engine lock
-  assert(execution_engine_lock()->owned_by_self(), "should be");
-
-  while (true) {
-    Function *function = context()->pop_from_free_queue();
-    if (function == NULL)
-      break;
-
-    execution_engine()->freeMachineCodeForFunction(function);
-    function->eraseFromParent();
-  }
-}
-
-const char* SharkCompiler::methodname(const char* klass, const char* method) {
-  char *buf = NEW_RESOURCE_ARRAY(char, strlen(klass) + 2 + strlen(method) + 1);
-
-  char *dst = buf;
-  for (const char *c = klass; *c; c++) {
-    if (*c == '/')
-      *(dst++) = '.';
-    else
-      *(dst++) = *c;
-  }
-  *(dst++) = ':';
-  *(dst++) = ':';
-  for (const char *c = method; *c; c++) {
-    *(dst++) = *c;
-  }
-  *(dst++) = '\0';
-  return buf;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkContext;
-
-class SharkCompiler : public AbstractCompiler {
- public:
-  // Creation
-  SharkCompiler();
-
-  // Name of this compiler
-  const char *name()     { return "shark"; }
-
-  // Missing feature tests
-  bool supports_native() { return true; }
-  bool supports_osr()    { return true; }
-
-  // Customization
-  bool needs_adapters()  { return false; }
-  bool needs_stubs()     { return false; }
-
-  // Initialization
-  void initialize();
-
-  // Compile a normal (bytecode) method and install it in the VM
-  void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
-
-  // Generate a wrapper for a native (JNI) method
-  nmethod* generate_native_wrapper(MacroAssembler* masm,
-                                   methodHandle    target,
-                                   BasicType*      arg_types,
-                                   BasicType       return_type);
-
-  // Free compiled methods (and native wrappers)
-  void free_compiled_method(address code);
-
-  // Each thread generating IR needs its own context.  The normal
-  // context is used for bytecode methods, and is protected from
-  // multiple simultaneous accesses by being restricted to the
-  // compiler thread.  The native context is used for JNI methods,
-  // and is protected from multiple simultaneous accesses by the
-  // adapter handler library lock.
- private:
-  SharkContext* _normal_context;
-  SharkContext* _native_context;
-
- public:
-  SharkContext* context() const {
-    if (JavaThread::current()->is_Compiler_thread()) {
-      return _normal_context;
-    }
-    else {
-      assert(AdapterHandlerLibrary_lock->owned_by_self(), "should be");
-      return _native_context;
-    }
-  }
-
-  // The LLVM execution engine is the JIT we use to generate native
-  // code.  It is thread safe, but we need to protect it with a lock
-  // of our own because otherwise LLVM's lock and HotSpot's locks
-  // interleave and deadlock.  The SharkMemoryManager is not thread
-  // safe, and is protected by the same lock as the execution engine.
- private:
-  Monitor*               _execution_engine_lock;
-  SharkMemoryManager*    _memory_manager;
-  llvm::ExecutionEngine* _execution_engine;
-
- private:
-  Monitor* execution_engine_lock() const {
-    return _execution_engine_lock;
-  }
-  SharkMemoryManager* memory_manager() const {
-    assert(execution_engine_lock()->owned_by_self(), "should be");
-    return _memory_manager;
-  }
-  llvm::ExecutionEngine* execution_engine() const {
-    assert(execution_engine_lock()->owned_by_self(), "should be");
-    return _execution_engine;
-  }
-
-  // Global access
- public:
-  static SharkCompiler* compiler() {
-    AbstractCompiler *compiler =
-      CompileBroker::compiler(CompLevel_fast_compile);
-    assert(compiler->is_shark() && compiler->is_initialized(), "should be");
-    return (SharkCompiler *) compiler;
-  }
-
-  // Helpers
- private:
-  static const char* methodname(const char* klass, const char* method);
-  void generate_native_code(SharkEntry*     entry,
-                            llvm::Function* function,
-                            const char*     name);
-  void free_queued_methods();
-};
--- a/ports/hotspot/src/share/vm/shark/sharkConstant.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkConstant.cpp.incl"
-
-using namespace llvm;
-
-SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
-  ciConstant constant = iter->get_constant();
-  ciType *type = NULL;
-  if (constant.basic_type() == T_OBJECT) {
-    ciEnv *env = ciEnv::current();
-    if (constant.as_object()->is_klass())
-      type = env->Class_klass();
-    else
-      type = env->String_klass();
-  }
-  return new SharkConstant(constant, type);
-}
-
-SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) {
-  bool will_link;
-  ciField *field = iter->get_field(will_link);
-  assert(will_link, "typeflow responsibility");
-
-  return new SharkConstant(field->constant_value(), field->type());
-}
-
-SharkConstant::SharkConstant(ciConstant constant, ciType *type) {
-  SharkValue *value = NULL;
-
-  switch (constant.basic_type()) {
-  case T_BOOLEAN:
-  case T_BYTE:
-  case T_CHAR:
-  case T_SHORT:
-  case T_INT:
-    value = SharkValue::jint_constant(constant.as_int());
-    break;
-
-  case T_LONG:
-    value = SharkValue::jlong_constant(constant.as_long());
-    break;
-
-  case T_FLOAT:
-    value = SharkValue::jfloat_constant(constant.as_float());
-    break;
-
-  case T_DOUBLE:
-    value = SharkValue::jdouble_constant(constant.as_double());
-    break;
-
-  case T_OBJECT:
-  case T_ARRAY:
-    break;
-
-  case T_ILLEGAL:
-    // out of memory
-    _is_loaded = false;
-    return;
-
-  default:
-    tty->print_cr("Unhandled type %s", type2name(constant.basic_type()));
-    ShouldNotReachHere();
-  }
-
-  // Handle primitive types.  We create SharkValues for these
-  // now; doing so doesn't emit any code, and it allows us to
-  // delegate a bunch of stuff to the SharkValue code.
-  if (value) {
-    _value       = value;
-    _is_loaded   = true;
-    _is_nonzero  = value->zero_checked();
-    _is_two_word = value->is_two_word();
-    return;
-  }
-
-  // Handle reference types.  This is tricky because some
-  // ciObjects are psuedo-objects that refer to oops which
-  // have yet to be created.  We need to spot the unloaded
-  // objects (which differ between ldc* and get*, thanks!)
-  ciObject *object = constant.as_object();
-  assert(type != NULL, "shouldn't be");
-  if (object->is_klass()) {
-    // The constant returned for a klass is the ciKlass
-    // for the entry, but we want the java_mirror.
-    ciKlass *klass = object->as_klass();
-    if (!klass->is_loaded()) {
-      _is_loaded = false;
-      return;
-    }
-    object = klass->java_mirror();
-  }
-  if (object->is_null_object() || !object->can_be_constant()) {
-    _is_loaded = false;
-    return;
-  }
-
-  _value       = NULL;
-  _object      = object;
-  _type        = type;
-  _is_loaded   = true;
-  _is_nonzero  = true;
-  _is_two_word = false;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkConstant.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkConstant : public ResourceObj {
- public:
-  static SharkConstant* for_ldc(ciBytecodeStream* iter);
-  static SharkConstant* for_field(ciBytecodeStream* iter);
-
- private:
-  SharkConstant(ciConstant constant, ciType* type);
-
- private:
-  SharkValue* _value;
-  ciObject*   _object;
-  ciType*     _type;
-  bool        _is_loaded;
-  bool        _is_nonzero;
-  bool        _is_two_word;
-
- public:
-  bool is_loaded() const {
-    return _is_loaded;
-  }
-  bool is_nonzero() const {
-    assert(is_loaded(), "should be");
-    return _is_nonzero;
-  }
-  bool is_two_word() const {
-    assert(is_loaded(), "should be");
-    return _is_two_word;
-  }
-
- public:
-  SharkValue* value(SharkBuilder* builder) {
-    assert(is_loaded(), "should be");
-    if (_value == NULL) {
-      _value = SharkValue::create_generic(
-        _type, builder->CreateInlineOop(_object), _is_nonzero);
-    }
-    return _value;
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkContext.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkContext.cpp.incl"
-
-using namespace llvm;
-
-SharkContext::SharkContext(const char* name)
-  : LLVMContext(),
-    _free_queue(NULL) {
-  // Create a module to build our functions into
-  _module = new Module(name, *this);
-
-  // Create basic types
-  _void_type    = Type::getVoidTy(*this);
-  _bit_type     = Type::getInt1Ty(*this);
-  _jbyte_type   = Type::getInt8Ty(*this);
-  _jshort_type  = Type::getInt16Ty(*this);
-  _jint_type    = Type::getInt32Ty(*this);
-  _jlong_type   = Type::getInt64Ty(*this);
-  _jfloat_type  = Type::getFloatTy(*this);
-  _jdouble_type = Type::getDoubleTy(*this);
-
-  // Create compound types
-  _itableOffsetEntry_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), itableOffsetEntry::size() * wordSize));
-
-  _klass_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(Klass)));
-
-  _jniEnv_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(JNIEnv)));
-
-  _jniHandleBlock_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(JNIHandleBlock)));
-
-  _methodOop_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(methodOopDesc)));
-
-  _monitor_type = ArrayType::get(
-    jbyte_type(), frame::interpreter_frame_monitor_size() * wordSize);
-
-  _oop_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(oopDesc)));
-
-  _thread_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(JavaThread)));
-
-  _zeroStack_type = PointerType::getUnqual(
-    ArrayType::get(jbyte_type(), sizeof(ZeroStack)));
-
-  std::vector<const Type*> params;
-  params.push_back(methodOop_type());
-  params.push_back(intptr_type());
-  params.push_back(thread_type());
-  _entry_point_type = FunctionType::get(jint_type(), params, false);
-
-  params.clear();
-  params.push_back(methodOop_type());
-  params.push_back(PointerType::getUnqual(jbyte_type()));
-  params.push_back(intptr_type());
-  params.push_back(thread_type());
-  _osr_entry_point_type = FunctionType::get(jint_type(), params, false);
-
-  // Create mappings
-  for (int i = 0; i < T_CONFLICT; i++) {
-    switch (i) {
-    case T_BOOLEAN:
-      _to_stackType[i] = jint_type();
-      _to_arrayType[i] = jbyte_type();
-      break;
-
-    case T_BYTE:
-      _to_stackType[i] = jint_type();
-      _to_arrayType[i] = jbyte_type();
-      break;
-
-    case T_CHAR:
-      _to_stackType[i] = jint_type();
-      _to_arrayType[i] = jshort_type();
-      break;
-
-    case T_SHORT:
-      _to_stackType[i] = jint_type();
-      _to_arrayType[i] = jshort_type();
-      break;
-
-    case T_INT:
-      _to_stackType[i] = jint_type();
-      _to_arrayType[i] = jint_type();
-      break;
-
-    case T_LONG:
-      _to_stackType[i] = jlong_type();
-      _to_arrayType[i] = jlong_type();
-      break;
-
-    case T_FLOAT:
-      _to_stackType[i] = jfloat_type();
-      _to_arrayType[i] = jfloat_type();
-      break;
-
-    case T_DOUBLE:
-      _to_stackType[i] = jdouble_type();
-      _to_arrayType[i] = jdouble_type();
-      break;
-
-    case T_OBJECT:
-    case T_ARRAY:
-      _to_stackType[i] = oop_type();
-      _to_arrayType[i] = oop_type();
-      break;
-
-    case T_ADDRESS:
-      _to_stackType[i] = intptr_type();
-      _to_arrayType[i] = NULL;
-      break;
-
-    default:
-      _to_stackType[i] = NULL;
-      _to_arrayType[i] = NULL;
-    }
-  }
-}
-
-class SharkFreeQueueItem : public CHeapObj {
- public:
-  SharkFreeQueueItem(llvm::Function* function, SharkFreeQueueItem *next)
-    : _function(function), _next(next) {}
-
- private:
-  llvm::Function*     _function;
-  SharkFreeQueueItem* _next;
-
- public:
-  llvm::Function* function() const {
-    return _function;
-  }
-  SharkFreeQueueItem* next() const {
-    return _next;
-  }
-};
-
-void SharkContext::push_to_free_queue(Function* function) {
-  _free_queue = new SharkFreeQueueItem(function, _free_queue);
-}
-
-Function* SharkContext::pop_from_free_queue() {
-  if (_free_queue == NULL)
-    return NULL;
-
-  SharkFreeQueueItem *item = _free_queue;
-  Function *function = item->function();
-  _free_queue = item->next();
-  delete item;
-  return function;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkContext.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-// The LLVMContext class allows multiple instances of LLVM to operate
-// independently of each other in a multithreaded context.  We extend
-// this here to store things in Shark that are LLVMContext-specific.
-
-class SharkFreeQueueItem;
-
-class SharkContext : public llvm::LLVMContext {
- public:
-  SharkContext(const char* name);
-
- private:
-  llvm::Module* _module;
-
-#if SHARK_LLVM_VERSION >= 27
- public:
-#else
- private:
-#endif
-  llvm::Module* module() const {
-    return _module;
-  }
-
-  // Get this thread's SharkContext
- public:
-  static SharkContext& current() {
-    return *SharkCompiler::compiler()->context();
-  }
-
-  // Module accessors
- public:
-#if SHARK_LLVM_VERSION < 27
-  llvm::ModuleProvider* module_provider() const {
-    return new llvm::ExistingModuleProvider(module());
-  }
-#endif
-  void add_function(llvm::Function* function) const {
-    module()->getFunctionList().push_back(function);
-  }
-  llvm::Constant* get_external(const char*               name,
-                               const llvm::FunctionType* sig) {
-    return module()->getOrInsertFunction(name, sig);
-  }
-
-  // Basic types
- private:
-  const llvm::Type*        _void_type;
-  const llvm::IntegerType* _bit_type;
-  const llvm::IntegerType* _jbyte_type;
-  const llvm::IntegerType* _jshort_type;
-  const llvm::IntegerType* _jint_type;
-  const llvm::IntegerType* _jlong_type;
-  const llvm::Type*        _jfloat_type;
-  const llvm::Type*        _jdouble_type;
-
- public:
-  const llvm::Type* void_type() const {
-    return _void_type;
-  }
-  const llvm::IntegerType* bit_type() const {
-    return _bit_type;
-  }
-  const llvm::IntegerType* jbyte_type() const {
-    return _jbyte_type;
-  }
-  const llvm::IntegerType* jshort_type() const {
-    return _jshort_type;
-  }
-  const llvm::IntegerType* jint_type() const {
-    return _jint_type;
-  }
-  const llvm::IntegerType* jlong_type() const {
-    return _jlong_type;
-  }
-  const llvm::Type* jfloat_type() const {
-    return _jfloat_type;
-  }
-  const llvm::Type* jdouble_type() const {
-    return _jdouble_type;
-  }
-  const llvm::IntegerType* intptr_type() const {
-    return LP64_ONLY(jlong_type()) NOT_LP64(jint_type());
-  }
-
-  // Compound types
- private:
-  const llvm::PointerType*  _itableOffsetEntry_type;
-  const llvm::PointerType*  _jniEnv_type;
-  const llvm::PointerType*  _jniHandleBlock_type;
-  const llvm::PointerType*  _klass_type;
-  const llvm::PointerType*  _methodOop_type;
-  const llvm::ArrayType*    _monitor_type;
-  const llvm::PointerType*  _oop_type;
-  const llvm::PointerType*  _thread_type;
-  const llvm::PointerType*  _zeroStack_type;
-  const llvm::FunctionType* _entry_point_type;
-  const llvm::FunctionType* _osr_entry_point_type;
-
- public:
-  const llvm::PointerType* itableOffsetEntry_type() const {
-    return _itableOffsetEntry_type;
-  }
-  const llvm::PointerType* jniEnv_type() const {
-    return _jniEnv_type;
-  }
-  const llvm::PointerType* jniHandleBlock_type() const {
-    return _jniHandleBlock_type;
-  }
-  const llvm::PointerType* klass_type() const {
-    return _klass_type;
-  }
-  const llvm::PointerType* methodOop_type() const {
-    return _methodOop_type;
-  }
-  const llvm::ArrayType* monitor_type() const {
-    return _monitor_type;
-  }
-  const llvm::PointerType* oop_type() const {
-    return _oop_type;
-  }
-  const llvm::PointerType* thread_type() const {
-    return _thread_type;
-  }
-  const llvm::PointerType* zeroStack_type() const {
-    return _zeroStack_type;
-  }
-  const llvm::FunctionType* entry_point_type() const {
-    return _entry_point_type;
-  }
-  const llvm::FunctionType* osr_entry_point_type() const {
-    return _osr_entry_point_type;
-  }
-
-  // Mappings
- private:
-  const llvm::Type* _to_stackType[T_CONFLICT];
-  const llvm::Type* _to_arrayType[T_CONFLICT];
-
- private:
-  const llvm::Type* map_type(const llvm::Type* const* table,
-                             BasicType                type) const {
-    assert(type >= 0 && type < T_CONFLICT, "unhandled type");
-    const llvm::Type* result = table[type];
-    assert(type != NULL, "unhandled type");
-    return result;
-  }
-
- public:
-  const llvm::Type* to_stackType(BasicType type) const {
-    return map_type(_to_stackType, type);
-  }
-  const llvm::Type* to_arrayType(BasicType type) const {
-    return map_type(_to_arrayType, type);
-  }
-
-  // Functions queued for freeing
- private:
-  SharkFreeQueueItem* _free_queue;
-
- public:
-  void push_to_free_queue(llvm::Function* function);
-  llvm::Function* pop_from_free_queue();
-};
--- a/ports/hotspot/src/share/vm/shark/sharkEntry.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkContext;
-
-class SharkEntry : public ZeroEntry {
- private:
-  address         _code_limit;
-  SharkContext*   _context;
-  llvm::Function* _function;
-
- public:
-  address code_start() const {
-    return entry_point();
-  }
-  address code_limit() const {
-    return _code_limit;
-  }
-  SharkContext* context() const {
-    return _context;
-  }
-  llvm::Function* function() const {
-    return _function;
-  }
-
- public:
-  void set_code_limit(address code_limit) {
-    _code_limit = code_limit;
-  }
-  void set_context(SharkContext* context) {
-    _context = context;
-  }
-  void set_function(llvm::Function* function) {
-    _function = function;
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkFunction.cpp.incl"
-
-using namespace llvm;
-
-void SharkFunction::initialize(const char *name) {
-  // Create the function
-  _function = Function::Create(
-    entry_point_type(),
-    GlobalVariable::InternalLinkage,
-    name);
-
-  // Get our arguments
-  Function::arg_iterator ai = function()->arg_begin();
-  Argument *method = ai++;
-  method->setName("method");
-  Argument *osr_buf = NULL;
-  if (is_osr()) {
-    osr_buf = ai++;
-    osr_buf->setName("osr_buf");
-  }
-  Argument *base_pc = ai++;
-  base_pc->setName("base_pc");
-  code_buffer()->set_base_pc(base_pc);
-  Argument *thread = ai++;
-  thread->setName("thread");
-  set_thread(thread);
-
-  // Create the list of blocks
-  set_block_insertion_point(NULL);
-  _blocks = NEW_RESOURCE_ARRAY(SharkTopLevelBlock*, block_count());
-  for (int i = 0; i < block_count(); i++) {
-    ciTypeFlow::Block *b = flow()->pre_order_at(i);
-
-    // Work around a bug in pre_order_at() that does not return
-    // the correct pre-ordering.  If pre_order_at() were correct
-    // this line could simply be:
-    // _blocks[i] = new SharkTopLevelBlock(this, b);
-    _blocks[b->pre_order()] = new SharkTopLevelBlock(this, b);
-  }
-
-  // Walk the tree from the start block to determine which
-  // blocks are entered and which blocks require phis
-  SharkTopLevelBlock *start_block = block(flow()->start_block_num());
-  assert(start_block->start() == flow()->start_bci(), "blocks out of order");
-  start_block->enter();
-
-  // Initialize all entered blocks
-  for (int i = 0; i < block_count(); i++) {
-    if (block(i)->entered())
-      block(i)->initialize();
-  }
-
-  // Create and push our stack frame
-  set_block_insertion_point(&function()->front());
-  builder()->SetInsertPoint(CreateBlock());
-  _stack = SharkStack::CreateBuildAndPushFrame(this, method);
-
-  // Create the entry state
-  SharkState *entry_state;
-  if (is_osr()) {
-    entry_state = new SharkOSREntryState(start_block, method, osr_buf);
-
-    // Free the OSR buffer
-    builder()->CreateCall(builder()->osr_migration_end(), osr_buf);
-  }
-  else {
-    entry_state = new SharkNormalEntryState(start_block, method);
-
-    // Lock if necessary
-    if (is_synchronized()) {
-      SharkTopLevelBlock *locker =
-        new SharkTopLevelBlock(this, start_block->ciblock());
-      locker->add_incoming(entry_state);
-
-      set_block_insertion_point(start_block->entry_block());
-      locker->acquire_method_lock();
-
-      entry_state = locker->current_state();
-    }
-  }
-
-  // Transition into the method proper
-  start_block->add_incoming(entry_state);
-  builder()->CreateBr(start_block->entry_block());
-
-  // Parse the blocks
-  for (int i = 0; i < block_count(); i++) {
-    if (!block(i)->entered())
-      continue;
-
-    if (i + 1 < block_count())
-      set_block_insertion_point(block(i + 1)->entry_block());
-    else
-      set_block_insertion_point(NULL);
-
-    block(i)->emit_IR();
-  }
-  do_deferred_zero_checks();
-}
-
-class DeferredZeroCheck : public SharkTargetInvariants {
- public:
-  DeferredZeroCheck(SharkTopLevelBlock* block, SharkValue* value)
-    : SharkTargetInvariants(block),
-      _block(block),
-      _value(value),
-      _bci(block->bci()),
-      _state(block->current_state()->copy()),
-      _check_block(builder()->GetInsertBlock()),
-      _continue_block(function()->CreateBlock("not_zero")) {
-    builder()->SetInsertPoint(continue_block());
-  }
-
- private:
-  SharkTopLevelBlock* _block;
-  SharkValue*         _value;
-  int                 _bci;
-  SharkState*         _state;
-  BasicBlock*         _check_block;
-  BasicBlock*         _continue_block;
-
- public:
-  SharkTopLevelBlock* block() const {
-    return _block;
-  }
-  SharkValue* value() const {
-    return _value;
-  }
-  int bci() const {
-    return _bci;
-  }
-  SharkState* state() const {
-    return _state;
-  }
-  BasicBlock* check_block() const {
-    return _check_block;
-  }
-  BasicBlock* continue_block() const {
-    return _continue_block;
-  }
-
- public:
-  SharkFunction* function() const {
-    return block()->function();
-  }
-
- public:
-  void process() const {
-    builder()->SetInsertPoint(check_block());
-    block()->do_deferred_zero_check(value(), bci(), state(), continue_block());
-  }
-};
-
-void SharkFunction::add_deferred_zero_check(SharkTopLevelBlock* block,
-                                            SharkValue*         value) {
-  deferred_zero_checks()->append(new DeferredZeroCheck(block, value));
-}
-
-void SharkFunction::do_deferred_zero_checks() {
-  for (int i = 0; i < deferred_zero_checks()->length(); i++)
-    deferred_zero_checks()->at(i)->process();
-}
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkTopLevelBlock;
-class DeferredZeroCheck;
-
-class SharkFunction : public SharkTargetInvariants {
- friend class SharkStackWithNormalFrame;
-
- public:
-  static llvm::Function* build(ciEnv*        env,
-                               SharkBuilder* builder,
-                               ciTypeFlow*   flow,
-                               const char*   name) {
-    SharkFunction function(env, builder, flow, name);
-    return function.function();
-  }
-
- private:
-  SharkFunction(ciEnv*        env,
-                SharkBuilder* builder,
-                ciTypeFlow*   flow,
-                const char*   name)
-    : SharkTargetInvariants(env, builder, flow) { initialize(name); }
-
- private:
-  void initialize(const char* name);
-
- private:
-  llvm::Function*                   _function;
-  SharkTopLevelBlock**              _blocks;
-  GrowableArray<DeferredZeroCheck*> _deferred_zero_checks;
-  SharkStack*                       _stack;
-
- public:
-  llvm::Function* function() const {
-    return _function;
-  }
-  int block_count() const {
-    return flow()->block_count();
-  }
-  SharkTopLevelBlock* block(int i) const {
-    assert(i < block_count(), "should be");
-    return _blocks[i];
-  }
-  GrowableArray<DeferredZeroCheck*>* deferred_zero_checks() {
-    return &_deferred_zero_checks;
-  }
-  SharkStack* stack() const {
-    return _stack;
-  }
-
-  // On-stack replacement
- private:
-  bool is_osr() const {
-    return flow()->is_osr_flow();
-  }
-  const llvm::FunctionType* entry_point_type() const {
-    if (is_osr())
-      return SharkType::osr_entry_point_type();
-    else
-      return SharkType::entry_point_type();
-  }
-
-  // Block management
- private:
-  llvm::BasicBlock* _block_insertion_point;
-
-  void set_block_insertion_point(llvm::BasicBlock* block_insertion_point) {
-    _block_insertion_point = block_insertion_point;
-  }
-  llvm::BasicBlock* block_insertion_point() const {
-    return _block_insertion_point;
-  }
-
- public:
-  llvm::BasicBlock* CreateBlock(const char* name = "") const {
-    return llvm::BasicBlock::Create(
-      SharkContext::current(), name, function(), block_insertion_point());
-  }
-
-  // Deferred zero checks
- public:
-  void add_deferred_zero_check(SharkTopLevelBlock* block,
-                               SharkValue*         value);
-
- private:
-  void do_deferred_zero_checks();
-};
--- a/ports/hotspot/src/share/vm/shark/sharkInliner.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,749 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkInliner.cpp.incl"
-
-using namespace llvm;
-
-class SharkInlineBlock : public SharkBlock {
- public:
-  SharkInlineBlock(ciMethod* target, SharkState* state)
-    : SharkBlock(state, target),
-      _outer_state(state),
-      _entry_state(new SharkState(this)) {
-    for (int i = target->max_locals() - 1; i >= 0; i--) {
-      SharkValue *value = NULL;
-      if (i < target->arg_size())
-        value = outer_state()->pop();
-      entry_state()->set_local(i, value);
-    }
-  }
-
- private:
-  SharkState* _outer_state;
-  SharkState* _entry_state;
-
- private:
-  SharkState* outer_state() {
-    return _outer_state;
-  }
-  SharkState* entry_state() {
-    return _entry_state;
-  }
-
- public:
-  void emit_IR() {
-    parse_bytecode(0, target()->code_size());
-  }
-
- private:
-  void do_return(BasicType type) {
-    if (type != T_VOID) {
-      SharkValue *result = pop_result(type);
-      outer_state()->push(result);
-      if (result->is_two_word())
-        outer_state()->push(NULL);
-    }
-  }
-};
-
-class SharkInlinerHelper : public StackObj {
- public:
-  SharkInlinerHelper(ciMethod* target, SharkState* entry_state)
-    : _target(target),
-      _entry_state(entry_state),
-      _iter(target) {}
-
- private:
-  ciBytecodeStream _iter;
-  SharkState*      _entry_state;
-  ciMethod*        _target;
-
- public:
-  ciBytecodeStream* iter() {
-    return &_iter;
-  }
-  SharkState* entry_state() const {
-    return _entry_state;
-  }
-  ciMethod* target() const {
-    return _target;
-  }
-
- public:
-  Bytecodes::Code bc() {
-    return iter()->cur_bc();
-  }
-  int max_locals() const {
-    return target()->max_locals();
-  }
-  int max_stack() const {
-    return target()->max_stack();
-  }
-
-  // Inlinability check
- public:
-  bool is_inlinable();
-
- private:
-  void initialize_for_check();
-
-  bool do_getstatic() {
-    return do_field_access(true, false);
-  }
-  bool do_getfield() {
-    return do_field_access(true, true);
-  }
-  bool do_putfield() {
-    return do_field_access(false, true);
-  }
-  bool do_field_access(bool is_get, bool is_field);
-
-  // Local variables for inlinability check
- private:
-  bool* _locals;
-
- public:
-  bool* local_addr(int index) const {
-    assert(index >= 0 && index < max_locals(), "bad local variable index");
-    return &_locals[index];
-  }
-  bool local(int index) const {
-    return *local_addr(index);
-  }
-  void set_local(int index, bool value) {
-    *local_addr(index) = value;
-  }
-
-  // Expression stack for inlinability check
- private:
-  bool* _stack;
-  bool* _sp;
-
- public:
-  int stack_depth() const {
-    return _sp - _stack;
-  }
-  bool* stack_addr(int slot) const {
-    assert(slot >= 0 && slot < stack_depth(), "bad stack slot");
-    return &_sp[-(slot + 1)];
-  }
-  void push(bool value) {
-    assert(stack_depth() < max_stack(), "stack overrun");
-    *(_sp++) = value;
-  }
-  bool pop() {
-    assert(stack_depth() > 0, "stack underrun");
-    return *(--_sp);
-  }
-
-  // Methods for two-word locals
- public:
-  void push_pair_local(int index) {
-    push(local(index));
-    push(local(index + 1));
-  }
-  void pop_pair_local(int index) {
-    set_local(index + 1, pop());
-    set_local(index, pop());
-  }
-
-  // Code generation
- public:
-  void do_inline() {
-    (new SharkInlineBlock(target(), entry_state()))->emit_IR();
-  }
-};
-
-// Quick checks so we can bail out before doing too much
-bool SharkInliner::may_be_inlinable(ciMethod *target) {
-  // We can't inline native methods
-  if (target->is_native())
-    return false;
-
-  // Not much point inlining abstract ones, and in any
-  // case we'd need a stack frame to throw the exception
-  if (target->is_abstract())
-    return false;
-
-  // Don't inline anything huge
-  if (target->code_size() > SharkMaxInlineSize)
-    return false;
-
-  // Monitors aren't allowed without a frame to put them in
-  if (target->is_synchronized() || target->has_monitor_bytecodes())
-    return false;
-
-  // We don't do control flow
-  if (target->has_exception_handlers() || target->has_jsrs())
-    return false;
-
-  // Don't try to inline constructors, as they must
-  // eventually call Object.<init> which we can't inline.
-  // Note that this catches <clinit> too, but why would
-  // we be compiling that?
-  if (target->is_initializer())
-    return false;
-
-  // Mustn't inline Object.<init>
-  // Should be caught by the above, but just in case...
-  if (target->intrinsic_id() == vmIntrinsics::_Object_init)
-    return false;
-
-  return true;
-}
-
-// Full-on detailed check, for methods that pass the quick checks
-// Inlined methods have no stack frame, so we can't do anything
-// that would require one.  This means no safepoints (and hence
-// no loops) and no VM calls.  No VM calls means, amongst other
-// things, that no exceptions can be created, which means no null
-// checks or divide-by-zero checks are allowed.  The lack of null
-// checks in particular would eliminate practically everything,
-// but we can get around that restriction by relying on the zero-
-// check eliminator to strip the checks.  To do that, we need to
-// walk through the method, tracking which values are and are not
-// zero-checked.
-bool SharkInlinerHelper::is_inlinable() {
-  ResourceMark rm;
-  initialize_for_check();
-
-  SharkConstant *sc;
-  bool a, b, c, d;
-
-  iter()->reset_to_bci(0);
-  while (iter()->next() != ciBytecodeStream::EOBC()) {
-    switch (bc()) {
-    case Bytecodes::_nop:
-      break;
-
-    case Bytecodes::_aconst_null:
-      push(false);
-      break;
-
-    case Bytecodes::_iconst_0:
-      push(false);
-      break;
-    case Bytecodes::_iconst_m1:
-    case Bytecodes::_iconst_1:
-    case Bytecodes::_iconst_2:
-    case Bytecodes::_iconst_3:
-    case Bytecodes::_iconst_4:
-    case Bytecodes::_iconst_5:
-      push(true);
-      break;
-
-    case Bytecodes::_lconst_0:
-      push(false);
-      push(false);
-      break;
-    case Bytecodes::_lconst_1:
-      push(true);
-      push(false);
-      break;
-
-    case Bytecodes::_fconst_0:
-    case Bytecodes::_fconst_1:
-    case Bytecodes::_fconst_2:
-      push(false);
-      break;
-
-    case Bytecodes::_dconst_0:
-    case Bytecodes::_dconst_1:
-      push(false);
-      push(false);
-      break;
-
-    case Bytecodes::_bipush:
-      push(iter()->get_byte() != 0);
-      break;
-    case Bytecodes::_sipush:
-      push(iter()->get_short() != 0);
-      break;
-
-    case Bytecodes::_ldc:
-    case Bytecodes::_ldc_w:
-    case Bytecodes::_ldc2_w:
-      sc = SharkConstant::for_ldc(iter());
-      if (!sc->is_loaded())
-        return false;
-      push(sc->is_nonzero());
-      if (sc->is_two_word())
-        push(false);
-      break;
-
-    case Bytecodes::_iload_0:
-    case Bytecodes::_fload_0:
-    case Bytecodes::_aload_0:
-      push(local(0));
-      break;
-    case Bytecodes::_lload_0:
-    case Bytecodes::_dload_0:
-      push_pair_local(0);
-      break;
-
-    case Bytecodes::_iload_1:
-    case Bytecodes::_fload_1:
-    case Bytecodes::_aload_1:
-      push(local(1));
-      break;
-    case Bytecodes::_lload_1:
-    case Bytecodes::_dload_1:
-      push_pair_local(1);
-      break;
-
-    case Bytecodes::_iload_2:
-    case Bytecodes::_fload_2:
-    case Bytecodes::_aload_2:
-      push(local(2));
-      break;
-    case Bytecodes::_lload_2:
-    case Bytecodes::_dload_2:
-      push_pair_local(2);
-      break;
-
-    case Bytecodes::_iload_3:
-    case Bytecodes::_fload_3:
-    case Bytecodes::_aload_3:
-      push(local(3));
-      break;
-    case Bytecodes::_lload_3:
-    case Bytecodes::_dload_3:
-      push_pair_local(3);
-      break;
-
-    case Bytecodes::_iload:
-    case Bytecodes::_fload:
-    case Bytecodes::_aload:
-      push(local(iter()->get_index()));
-      break;
-    case Bytecodes::_lload:
-    case Bytecodes::_dload:
-      push_pair_local(iter()->get_index());
-      break;
-
-    case Bytecodes::_istore_0:
-    case Bytecodes::_fstore_0:
-    case Bytecodes::_astore_0:
-      set_local(0, pop());
-      break;
-    case Bytecodes::_lstore_0:
-    case Bytecodes::_dstore_0:
-      pop_pair_local(0);
-      break;
-
-    case Bytecodes::_istore_1:
-    case Bytecodes::_fstore_1:
-    case Bytecodes::_astore_1:
-      set_local(1, pop());
-      break;
-    case Bytecodes::_lstore_1:
-    case Bytecodes::_dstore_1:
-      pop_pair_local(1);
-      break;
-
-    case Bytecodes::_istore_2:
-    case Bytecodes::_fstore_2:
-    case Bytecodes::_astore_2:
-      set_local(2, pop());
-      break;
-    case Bytecodes::_lstore_2:
-    case Bytecodes::_dstore_2:
-      pop_pair_local(2);
-      break;
-
-    case Bytecodes::_istore_3:
-    case Bytecodes::_fstore_3:
-    case Bytecodes::_astore_3:
-      set_local(3, pop());
-      break;
-    case Bytecodes::_lstore_3:
-    case Bytecodes::_dstore_3:
-      pop_pair_local(3);
-      break;
-
-    case Bytecodes::_istore:
-    case Bytecodes::_fstore:
-    case Bytecodes::_astore:
-      set_local(iter()->get_index(), pop());
-      break;
-    case Bytecodes::_lstore:
-    case Bytecodes::_dstore:
-      pop_pair_local(iter()->get_index());
-      break;
-
-    case Bytecodes::_pop:
-      pop();
-      break;
-    case Bytecodes::_pop2:
-      pop();
-      pop();
-      break;
-    case Bytecodes::_swap:
-      a = pop();
-      b = pop();
-      push(a);
-      push(b);
-      break;
-    case Bytecodes::_dup:
-      a = pop();
-      push(a);
-      push(a);
-      break;
-    case Bytecodes::_dup_x1:
-      a = pop();
-      b = pop();
-      push(a);
-      push(b);
-      push(a);
-      break;
-    case Bytecodes::_dup_x2:
-      a = pop();
-      b = pop();
-      c = pop();
-      push(a);
-      push(c);
-      push(b);
-      push(a);
-      break;
-    case Bytecodes::_dup2:
-      a = pop();
-      b = pop();
-      push(b);
-      push(a);
-      push(b);
-      push(a);
-      break;
-    case Bytecodes::_dup2_x1:
-      a = pop();
-      b = pop();
-      c = pop();
-      push(b);
-      push(a);
-      push(c);
-      push(b);
-      push(a);
-      break;
-    case Bytecodes::_dup2_x2:
-      a = pop();
-      b = pop();
-      c = pop();
-      d = pop();
-      push(b);
-      push(a);
-      push(d);
-      push(c);
-      push(b);
-      push(a);
-      break;
-
-    case Bytecodes::_getfield:
-      if (!do_getfield())
-        return false;
-      break;
-    case Bytecodes::_getstatic:
-      if (!do_getstatic())
-        return false;
-      break;
-    case Bytecodes::_putfield:
-      if (!do_putfield())
-        return false;
-      break;
-
-    case Bytecodes::_iadd:
-    case Bytecodes::_isub:
-    case Bytecodes::_imul:
-    case Bytecodes::_iand:
-    case Bytecodes::_ixor:
-    case Bytecodes::_ishl:
-    case Bytecodes::_ishr:
-    case Bytecodes::_iushr:
-      pop();
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_ior:
-      a = pop();
-      b = pop();
-      push(a && b);
-      break;
-    case Bytecodes::_idiv:
-    case Bytecodes::_irem:
-      if (!pop())
-        return false;
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_ineg:
-      break;
-
-    case Bytecodes::_ladd:
-    case Bytecodes::_lsub:
-    case Bytecodes::_lmul:
-    case Bytecodes::_land:
-    case Bytecodes::_lxor:
-      pop();
-      pop();
-      pop();
-      pop();
-      push(false);
-      push(false);
-      break;
-    case Bytecodes::_lor:
-      a = pop();
-      b = pop();
-      push(a && b);
-      break;
-    case Bytecodes::_ldiv:
-    case Bytecodes::_lrem:
-      pop();
-      if (!pop())
-        return false;
-      pop();
-      pop();
-      push(false);
-      push(false);
-      break;
-    case Bytecodes::_lneg:
-      break;
-    case Bytecodes::_lshl:
-    case Bytecodes::_lshr:
-    case Bytecodes::_lushr:
-      pop();
-      pop();
-      pop();
-      push(false);
-      push(false);
-      break;
-
-    case Bytecodes::_fadd:
-    case Bytecodes::_fsub:
-    case Bytecodes::_fmul:
-    case Bytecodes::_fdiv:
-    case Bytecodes::_frem:
-      pop();
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_fneg:
-      break;
-
-    case Bytecodes::_dadd:
-    case Bytecodes::_dsub:
-    case Bytecodes::_dmul:
-    case Bytecodes::_ddiv:
-    case Bytecodes::_drem:
-      pop();
-      pop();
-      pop();
-      pop();
-      push(false);
-      push(false);
-      break;
-    case Bytecodes::_dneg:
-      break;
-
-    case Bytecodes::_iinc:
-      set_local(iter()->get_index(), false);
-      break;
-
-    case Bytecodes::_lcmp:
-      pop();
-      pop();
-      pop();
-      pop();
-      push(false);
-      break;
-
-    case Bytecodes::_fcmpl:
-    case Bytecodes::_fcmpg:
-      pop();
-      pop();
-      push(false);
-      break;
-
-    case Bytecodes::_dcmpl:
-    case Bytecodes::_dcmpg:
-      pop();
-      pop();
-      pop();
-      pop();
-      push(false);
-      break;
-
-    case Bytecodes::_i2l:
-      push(false);
-      break;
-    case Bytecodes::_i2f:
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_i2d:
-      pop();
-      push(false);
-      push(false);
-      break;
-
-    case Bytecodes::_l2i:
-    case Bytecodes::_l2f:
-      pop();
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_l2d:
-      pop();
-      pop();
-      push(false);
-      push(false);
-      break;
-
-    case Bytecodes::_f2i:
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_f2l:
-    case Bytecodes::_f2d:
-      pop();
-      push(false);
-      push(false);
-      break;
-
-    case Bytecodes::_d2i:
-    case Bytecodes::_d2f:
-      pop();
-      pop();
-      push(false);
-      break;
-    case Bytecodes::_d2l:
-      pop();
-      pop();
-      push(false);
-      push(false);
-      break;
-
-    case Bytecodes::_i2b:
-    case Bytecodes::_i2c:
-    case Bytecodes::_i2s:
-      pop();
-      push(false);
-      break;
-
-    case Bytecodes::_return:
-    case Bytecodes::_ireturn:
-    case Bytecodes::_lreturn:
-    case Bytecodes::_freturn:
-    case Bytecodes::_dreturn:
-    case Bytecodes::_areturn:
-      break;
-
-    default:
-      return false;
-    }
-  }
-
-  return true;
-}
-
-void SharkInlinerHelper::initialize_for_check() {
-  _locals = NEW_RESOURCE_ARRAY(bool, max_locals());
-  _stack = NEW_RESOURCE_ARRAY(bool, max_stack());
-
-  memset(_locals, 0, max_locals() * sizeof(bool));
-  for (int i = 0; i < target()->arg_size(); i++) {
-    SharkValue *arg = entry_state()->stack(target()->arg_size() - 1 - i);
-    if (arg && arg->zero_checked())
-      set_local(i, true);
-  }
-
-  _sp = _stack;
-}
-
-bool SharkInlinerHelper::do_field_access(bool is_get, bool is_field) {
-  assert(is_get || is_field, "can't inline putstatic");
-
-  // If the holder isn't linked then there isn't a lot we can do
-  if (!target()->holder()->is_linked())
-    return false;
-
-  // Get the field
-  bool will_link;
-  ciField *field = iter()->get_field(will_link);
-  if (!will_link)
-    return false;
-
-  // If the field is mismatched then an exception needs throwing
-  if (is_field == field->is_static())
-    return false;
-
-  // Pop the value off the stack if necessary
-  if (!is_get) {
-    pop();
-    if (field->type()->is_two_word())
-      pop();
-  }
-
-  // Pop and null-check the receiver if necessary
-  if (is_field) {
-    if (!pop())
-      return false;
-  }
-
-  // Push the result if necessary
-  if (is_get) {
-    bool result_pushed = false;
-    if (field->is_constant()) {
-      SharkConstant *sc = SharkConstant::for_field(iter());
-      if (sc->is_loaded()) {
-        push(sc->is_nonzero());
-        result_pushed = true;
-      }
-    }
-
-    if (!result_pushed)
-      push(false);
-
-    if (field->type()->is_two_word())
-      push(false);
-  }
-
-  return true;
-}
-
-bool SharkInliner::attempt_inline(ciMethod *target, SharkState *state) {
-  if (SharkIntrinsics::is_intrinsic(target)) {
-    SharkIntrinsics::inline_intrinsic(target, state);
-    return true;
-  }
-
-  if (may_be_inlinable(target)) {
-    SharkInlinerHelper inliner(target, state);
-    if (inliner.is_inlinable()) {
-      inliner.do_inline();
-      return true;
-    }
-  }
-  return false;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkInliner.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkInliner : public AllStatic {
- public:
-  static bool attempt_inline(ciMethod* target, SharkState* state);
-
- private:
-  static bool may_be_inlinable(ciMethod* target);
-};
--- a/ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkIntrinsics.cpp.incl"
-
-using namespace llvm;
-
-bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
-  switch (target->intrinsic_id()) {
-  case vmIntrinsics::_none:
-    return false;
-
-    // java.lang.Math
-  case vmIntrinsics::_min:
-  case vmIntrinsics::_max:
-  case vmIntrinsics::_dabs:
-  case vmIntrinsics::_dsin:
-  case vmIntrinsics::_dcos:
-  case vmIntrinsics::_dtan:
-  case vmIntrinsics::_datan2:
-  case vmIntrinsics::_dsqrt:
-  case vmIntrinsics::_dlog:
-  case vmIntrinsics::_dlog10:
-  case vmIntrinsics::_dpow:
-  case vmIntrinsics::_dexp:
-    return true;
-
-    // java.lang.Object
-  case vmIntrinsics::_getClass:
-    return true;
-
-    // java.lang.System
-  case vmIntrinsics::_currentTimeMillis:
-    return true;
-
-    // java.lang.Thread
-  case vmIntrinsics::_currentThread:
-    return true;
-
-    // sun.misc.Unsafe
-  case vmIntrinsics::_compareAndSwapInt:
-    return true;
-
-  default:
-    if (SharkPerformanceWarnings) {
-      warning(
-        "unhandled intrinsic vmIntrinsic::%s",
-        vmIntrinsics::name_at(target->intrinsic_id()));
-    }
-  }
-  return false;
-}
-
-void SharkIntrinsics::inline_intrinsic(ciMethod *target, SharkState *state) {
-  SharkIntrinsics intrinsic(state, target);
-  intrinsic.do_intrinsic();
-}
-
-void SharkIntrinsics::do_intrinsic() {
-  switch (target()->intrinsic_id()) {
-    // java.lang.Math
-  case vmIntrinsics::_min:
-    do_Math_minmax(llvm::ICmpInst::ICMP_SLE);
-    break;
-  case vmIntrinsics::_max:
-    do_Math_minmax(llvm::ICmpInst::ICMP_SGE);
-    break;
-  case vmIntrinsics::_dabs:
-    do_Math_1to1(builder()->fabs());
-    break;
-  case vmIntrinsics::_dsin:
-    do_Math_1to1(builder()->sin());
-    break;
-  case vmIntrinsics::_dcos:
-    do_Math_1to1(builder()->cos());
-    break;
-  case vmIntrinsics::_dtan:
-    do_Math_1to1(builder()->tan());
-    break;
-  case vmIntrinsics::_datan2:
-    do_Math_2to1(builder()->atan2());
-    break;
-  case vmIntrinsics::_dsqrt:
-    do_Math_1to1(builder()->sqrt());
-    break;
-  case vmIntrinsics::_dlog:
-    do_Math_1to1(builder()->log());
-    break;
-  case vmIntrinsics::_dlog10:
-    do_Math_1to1(builder()->log10());
-    break;
-  case vmIntrinsics::_dpow:
-    do_Math_2to1(builder()->pow());
-    break;
-  case vmIntrinsics::_dexp:
-    do_Math_1to1(builder()->exp());
-    break;
-
-    // java.lang.Object
-  case vmIntrinsics::_getClass:
-    do_Object_getClass();
-    break;
-
-    // java.lang.System
-  case vmIntrinsics::_currentTimeMillis:
-    do_System_currentTimeMillis();
-    break;
-
-    // java.lang.Thread
-  case vmIntrinsics::_currentThread:
-    do_Thread_currentThread();
-    break;
-
-    // sun.misc.Unsafe
-  case vmIntrinsics::_compareAndSwapInt:
-    do_Unsafe_compareAndSwapInt();
-    break;
-
-  default:
-    ShouldNotReachHere();
-  }
-}
-
-void SharkIntrinsics::do_Math_minmax(ICmpInst::Predicate p) {
-  // Pop the arguments
-  SharkValue *sb = state()->pop();
-  SharkValue *sa = state()->pop();
-  Value *a = sa->jint_value();
-  Value *b = sb->jint_value();
-
-  // Perform the test
-  BasicBlock *ip       = builder()->GetBlockInsertionPoint();
-  BasicBlock *return_a = builder()->CreateBlock(ip, "return_a");
-  BasicBlock *return_b = builder()->CreateBlock(ip, "return_b");
-  BasicBlock *done     = builder()->CreateBlock(ip, "done");
-
-  builder()->CreateCondBr(builder()->CreateICmp(p, a, b), return_a, return_b);
-
-  builder()->SetInsertPoint(return_a);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(return_b);
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(done);
-  PHINode *phi = builder()->CreatePHI(a->getType(), "result");
-  phi->addIncoming(a, return_a);
-  phi->addIncoming(b, return_b);
-
-  // Push the result
-  state()->push(
-    SharkValue::create_jint(
-      phi,
-      sa->zero_checked() && sb->zero_checked()));
-}
-
-void SharkIntrinsics::do_Math_1to1(Value *function) {
-  SharkValue *empty = state()->pop();
-  assert(empty == NULL, "should be");
-  state()->push(
-    SharkValue::create_jdouble(
-      builder()->CreateCall(
-        function, state()->pop()->jdouble_value())));
-  state()->push(NULL);
-}
-
-void SharkIntrinsics::do_Math_2to1(Value *function) {
-  SharkValue *empty = state()->pop();
-  assert(empty == NULL, "should be");
-  Value *y = state()->pop()->jdouble_value();
-  empty = state()->pop();
-  assert(empty == NULL, "should be");
-  Value *x = state()->pop()->jdouble_value();
-
-  state()->push(
-    SharkValue::create_jdouble(
-      builder()->CreateCall2(function, x, y)));
-  state()->push(NULL);
-}
-
-void SharkIntrinsics::do_Object_getClass() {
-  Value *klass = builder()->CreateValueOfStructEntry(
-    state()->pop()->jobject_value(),
-    in_ByteSize(oopDesc::klass_offset_in_bytes()),
-    SharkType::oop_type(),
-    "klass");
-
-  Value *klass_part = builder()->CreateAddressOfStructEntry(
-    klass,
-    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
-    SharkType::klass_type(),
-    "klass_part");
-
-  state()->push(
-    SharkValue::create_jobject(
-      builder()->CreateValueOfStructEntry(
-        klass_part,
-        in_ByteSize(Klass::java_mirror_offset_in_bytes()),
-        SharkType::oop_type(),
-        "java_mirror"),
-      true));
-}
-
-void SharkIntrinsics::do_System_currentTimeMillis() {
-  state()->push(
-    SharkValue::create_jlong(
-      builder()->CreateCall(builder()->current_time_millis()),
-      false));
-  state()->push(NULL);
-}
-
-void SharkIntrinsics::do_Thread_currentThread() {
-  state()->push(
-    SharkValue::create_jobject(
-      builder()->CreateValueOfStructEntry(
-        thread(), JavaThread::threadObj_offset(),
-        SharkType::oop_type(),
-        "threadObj"),
-      true));
-}
-
-void SharkIntrinsics::do_Unsafe_compareAndSwapInt() {
-  // Pop the arguments
-  Value *x      = state()->pop()->jint_value();
-  Value *e      = state()->pop()->jint_value();
-  SharkValue *empty = state()->pop();
-  assert(empty == NULL, "should be");
-  Value *offset = state()->pop()->jlong_value();
-  Value *object = state()->pop()->jobject_value();
-  Value *unsafe = state()->pop()->jobject_value();
-
-  // Convert the offset
-  offset = builder()->CreateCall(
-    builder()->unsafe_field_offset_to_byte_offset(),
-    offset);
-
-  // Locate the field
-  Value *addr = builder()->CreateIntToPtr(
-    builder()->CreateAdd(
-      builder()->CreatePtrToInt(object, SharkType::intptr_type()),
-      builder()->CreateIntCast(offset, SharkType::intptr_type(), true)),
-    PointerType::getUnqual(SharkType::jint_type()),
-    "addr");
-
-  // Perform the operation
-  Value *result = builder()->CreateCmpxchgInt(x, addr, e);
-
-  // Push the result
-  state()->push(
-    SharkValue::create_jint(
-      builder()->CreateIntCast(
-        builder()->CreateICmpEQ(result, e), SharkType::jint_type(), true),
-      false));
-}
--- a/ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkIntrinsics : public SharkTargetInvariants {
- public:
-  static bool is_intrinsic(ciMethod* target);
-  static void inline_intrinsic(ciMethod* target, SharkState* state);
-
- private:
-  SharkIntrinsics(SharkState* state, ciMethod* target)
-    : SharkTargetInvariants(state, target), _state(state) {}
-
- private:
-  SharkState* _state;
-
- private:
-  SharkState* state() const {
-    return _state;
-  }
-
- private:
-  void do_intrinsic();
-
- private:
-  void do_Math_minmax(llvm::ICmpInst::Predicate p);
-  void do_Math_1to1(llvm::Value* function);
-  void do_Math_2to1(llvm::Value* function);
-  void do_Object_getClass();
-  void do_System_currentTimeMillis();
-  void do_Thread_currentThread();
-  void do_Unsafe_compareAndSwapInt();
-};
--- a/ports/hotspot/src/share/vm/shark/sharkInvariants.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkInvariants.cpp.incl"
-
-int SharkTargetInvariants::count_monitors() {
-  int result = 0;
-  if (is_synchronized() || target()->has_monitor_bytecodes()) {
-    for (int i = 0; i < flow()->block_count(); i++) {
-      result = MAX2(result, flow()->pre_order_at(i)->monitor_count());
-    }
-  }
-  return result;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkInvariants.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-// Base classes used to track various values through the compilation.
-// SharkCompileInvariants is used to track values which remain the
-// same for the top-level method and any inlined methods it may have
-// (ie for the whole compilation).  SharkTargetInvariants is used to
-// track values which differ between methods.
-
-class SharkCompileInvariants : public ResourceObj {
- protected:
-  SharkCompileInvariants(ciEnv* env, SharkBuilder* builder)
-    : _env(env),
-      _builder(builder),
-      _thread(NULL) {}
-
-  SharkCompileInvariants(const SharkCompileInvariants* parent)
-    : _env(parent->_env),
-      _builder(parent->_builder),
-      _thread(parent->_thread) {}
-
- private:
-  ciEnv*        _env;
-  SharkBuilder* _builder;
-  llvm::Value*  _thread;
-
-  // Top-level broker for HotSpot's Compiler Interface.
-  //
-  // Its main purpose is to allow the various CI classes to access
-  // oops in the VM without having to worry about safepointing.  In
-  // addition to this it acts as a holder for various recorders and
-  // memory allocators.
-  //
-  // Accessing this directly is kind of ugly, so it's private.  Add
-  // new accessors below if you need something from it.
- private:
-  ciEnv* env() const {
-    assert(_env != NULL, "env not available");
-    return _env;
-  }
-
-  // The SharkBuilder that is used to build LLVM IR.
- protected:
-  SharkBuilder* builder() const {
-    return _builder;
-  }
-
-  // Pointer to this thread's JavaThread object.  This is not
-  // available until a short way into SharkFunction creation
-  // so a setter is required.  Assertions are used to enforce
-  // invariance.
- protected:
-  llvm::Value* thread() const {
-    assert(_thread != NULL, "thread not available");
-    return _thread;
-  }
-  void set_thread(llvm::Value* thread) {
-    assert(_thread == NULL, "thread already set");
-    _thread = thread;
-  }
-
-  // Objects that handle various aspects of the compilation.
- protected:
-  DebugInformationRecorder* debug_info() const {
-    return env()->debug_info();
-  }
-  Dependencies* dependencies() const {
-    return env()->dependencies();
-  }
-  SharkCodeBuffer* code_buffer() const {
-    return builder()->code_buffer();
-  }
-
-  // Commonly used classes
- protected:
-  ciInstanceKlass* java_lang_Object_klass() const {
-    return env()->Object_klass();
-  }
-  ciInstanceKlass* java_lang_Throwable_klass() const {
-    return env()->Throwable_klass();
-  }
-};
-
-class SharkTargetInvariants : public SharkCompileInvariants {
- protected:
-  SharkTargetInvariants(ciEnv* env, SharkBuilder* builder, ciTypeFlow* flow)
-    : SharkCompileInvariants(env, builder),
-      _target(flow->method()),
-      _flow(flow),
-      _max_monitors(count_monitors()) {}
-
-  SharkTargetInvariants(const SharkCompileInvariants* parent, ciMethod* target)
-    : SharkCompileInvariants(parent),
-      _target(target),
-      _flow(NULL),
-      _max_monitors(count_monitors()) {}
-
-  SharkTargetInvariants(const SharkTargetInvariants* parent)
-    : SharkCompileInvariants(parent),
-      _target(parent->_target),
-      _flow(parent->_flow),
-      _max_monitors(parent->_max_monitors) {}
-
- private:
-  int count_monitors();
-
- private:
-  ciMethod*   _target;
-  ciTypeFlow* _flow;
-  int         _max_monitors;
-
-  // The method being compiled.
- protected:
-  ciMethod* target() const {
-    return _target;
-  }
-
-  // Typeflow analysis of the method being compiled.
- protected:
-  ciTypeFlow* flow() const {
-    assert(_flow != NULL, "typeflow not available");
-    return _flow;
-  }
-
-  // Properties of the method.
- protected:
-  int max_locals() const {
-    return target()->max_locals();
-  }
-  int max_stack() const {
-    return target()->max_stack();
-  }
-  int max_monitors() const {
-    return _max_monitors;
-  }
-  int arg_size() const {
-    return target()->arg_size();
-  }
-  bool is_static() const {
-    return target()->is_static();
-  }
-  bool is_synchronized() const {
-    return target()->is_synchronized();
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkMemoryManager.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkMemoryManager.cpp.incl"
-
-using namespace llvm;
-
-void SharkMemoryManager::AllocateGOT() {
-  mm()->AllocateGOT();
-}
-
-unsigned char* SharkMemoryManager::getGOTBase() const {
-  return mm()->getGOTBase();
-}
-
-unsigned char* SharkMemoryManager::allocateStub(const GlobalValue* F,
-                                                unsigned StubSize,
-                                                unsigned Alignment) {
-  return mm()->allocateStub(F, StubSize, Alignment);
-}
-
-unsigned char* SharkMemoryManager::startFunctionBody(const Function* F,
-                                                     uintptr_t& ActualSize) {
-  return mm()->startFunctionBody(F, ActualSize);
-}
-
-void SharkMemoryManager::endFunctionBody(const Function* F,
-                                         unsigned char* FunctionStart,
-                                         unsigned char* FunctionEnd) {
-  mm()->endFunctionBody(F, FunctionStart, FunctionEnd);
-
-  SharkEntry *entry = get_entry_for_function(F);
-  if (entry != NULL)
-    entry->set_code_limit(FunctionEnd);
-}
-
-unsigned char* SharkMemoryManager::startExceptionTable(const Function* F,
-                                                       uintptr_t& ActualSize) {
-  return mm()->startExceptionTable(F, ActualSize);
-}
-
-void SharkMemoryManager::endExceptionTable(const Function* F,
-                                           unsigned char* TableStart,
-                                           unsigned char* TableEnd,
-                                           unsigned char* FrameRegister) {
-  mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
-}
-
-void SharkMemoryManager::setMemoryWritable() {
-  mm()->setMemoryWritable();
-}
-
-void SharkMemoryManager::setMemoryExecutable() {
-  mm()->setMemoryExecutable();
-}
-
-#if SHARK_LLVM_VERSION >= 27
-void SharkMemoryManager::deallocateExceptionTable(void *ptr) {
-  mm()->deallocateExceptionTable(ptr);
-}
-
-void SharkMemoryManager::deallocateFunctionBody(void *ptr) {
-  mm()->deallocateFunctionBody(ptr);
-}
-#else
-void SharkMemoryManager::deallocateMemForFunction(const Function* F) {
-  return mm()->deallocateMemForFunction(F);
-}
-#endif
-
-uint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size,
-                                            unsigned int Alignment) {
-  return mm()->allocateGlobal(Size, Alignment);
-}
-
-#if SHARK_LLVM_VERSION < 27
-void* SharkMemoryManager::getDlsymTable() const {
-  return mm()->getDlsymTable();
-}
-
-void SharkMemoryManager::SetDlsymTable(void *ptr) {
-  mm()->SetDlsymTable(ptr);
-}
-#endif
-
-void SharkMemoryManager::setPoisonMemory(bool poison) {
-  mm()->setPoisonMemory(poison);
-}
-
-unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size,
-                                                 unsigned int Alignment) {
-  return mm()->allocateSpace(Size, Alignment);
-}
--- a/ports/hotspot/src/share/vm/shark/sharkMemoryManager.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-// SharkMemoryManager wraps the LLVM JIT Memory Manager.  We could use
-// this to run our own memory allocation policies, but for now all we
-// use it for is figuring out where the resulting native code ended up.
-
-class SharkMemoryManager : public llvm::JITMemoryManager {
- public:
-  SharkMemoryManager()
-    : _mm(llvm::JITMemoryManager::CreateDefaultMemManager()) {}
-
- private:
-  llvm::JITMemoryManager* _mm;
-
- private:
-  llvm::JITMemoryManager* mm() const {
-    return _mm;
-  }
-
- private:
-  std::map<const llvm::Function*, SharkEntry*> _entry_map;
-
- public:
-  void set_entry_for_function(const llvm::Function* function,
-                              SharkEntry*           entry) {
-    _entry_map[function] = entry;
-  }
-  SharkEntry* get_entry_for_function(const llvm::Function* function) {
-    return _entry_map[function];
-  }
-
- public:
-  void AllocateGOT();
-  unsigned char* getGOTBase() const;
-  unsigned char* allocateStub(const llvm::GlobalValue* F,
-                              unsigned StubSize,
-                              unsigned Alignment);
-  unsigned char* startFunctionBody(const llvm::Function* F,
-                                   uintptr_t& ActualSize);
-  void endFunctionBody(const llvm::Function* F,
-                       unsigned char* FunctionStart,
-                       unsigned char* FunctionEnd);
-  unsigned char* startExceptionTable(const llvm::Function* F,
-                                     uintptr_t& ActualSize);
-  void endExceptionTable(const llvm::Function* F,
-                         unsigned char* TableStart,
-                         unsigned char* TableEnd,
-                         unsigned char* FrameRegister);
-#if SHARK_LLVM_VERSION < 27
-  void* getDlsymTable() const;
-  void SetDlsymTable(void *ptr);
-#endif
-  void setPoisonMemory(bool);
-  uint8_t* allocateGlobal(uintptr_t, unsigned int);
-  void setMemoryWritable();
-  void setMemoryExecutable();
-#if SHARK_LLVM_VERSION >= 27
-  void deallocateExceptionTable(void *ptr);
-  void deallocateFunctionBody(void *ptr);
-#else
-  void deallocateMemForFunction(const llvm::Function* F);
-#endif
-  unsigned char *allocateSpace(intptr_t Size,
-                               unsigned int Alignment);
-};
--- a/ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,352 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkNativeWrapper.cpp.incl"
-
-using namespace llvm;
-
-void SharkNativeWrapper::initialize(const char *name) {
-  // Create the function
-  _function = Function::Create(
-    SharkType::entry_point_type(),
-    GlobalVariable::InternalLinkage,
-    name);
-
-  // Get our arguments
-  Function::arg_iterator ai = function()->arg_begin();
-  Argument *method = ai++;
-  method->setName("method");
-  Argument *base_pc = ai++;
-  base_pc->setName("base_pc");
-  code_buffer()->set_base_pc(base_pc);
-  Argument *thread = ai++;
-  thread->setName("thread");
-  set_thread(thread);
-
-  // Create and push our stack frame
-  builder()->SetInsertPoint(CreateBlock());
-  _stack = SharkStack::CreateBuildAndPushFrame(this, method);
-  NOT_PRODUCT(method = NULL);
-
-  // Create the oopmap.  We use the one oopmap for every call site in
-  // the wrapper, which results in the odd mild inefficiency but is a
-  // damn sight easier to code.
-  OopMap *oopmap = new OopMap(
-    SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
-    SharkStack::oopmap_slot_munge(arg_size()));
-  oopmap->set_oop(SharkStack::slot2reg(stack()->method_slot_offset()));
-
-  // Set up the oop_tmp slot if required:
-  //  - For static methods we use it to handlize the class argument
-  //    for the call, and to protect the same during slow path locks
-  //    (if synchronized).
-  //  - For methods returning oops, we use it to protect the return
-  //    value across safepoints or slow path unlocking.
-  if (is_static() || is_returning_oop()) {
-    _oop_tmp_slot = stack()->slot_addr(
-      stack()->oop_tmp_slot_offset(),
-      SharkType::oop_type(),
-      "oop_tmp_slot");
-
-    oopmap->set_oop(SharkStack::slot2reg(stack()->oop_tmp_slot_offset()));
-  }
-
-  // Set up the monitor slot, for synchronized methods
-  if (is_synchronized()) {
-    Unimplemented();
-    _lock_slot_offset = 23;
-  }
-
-  // Start building the argument list
-  std::vector<const Type*> param_types;
-  std::vector<Value*> param_values;
-  const PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
-
-  // First argument is the JNIEnv
-  param_types.push_back(SharkType::jniEnv_type());
-  param_values.push_back(
-    builder()->CreateAddressOfStructEntry(
-      thread,
-      JavaThread::jni_environment_offset(),
-      SharkType::jniEnv_type(),
-      "jni_environment"));
-
-  // For static methods, the second argument is the class
-  if (is_static()) {
-    builder()->CreateStore(
-      builder()->CreateInlineOop(
-        JNIHandles::make_local(
-          target()->method_holder()->klass_part()->java_mirror())),
-      oop_tmp_slot());
-
-    param_types.push_back(box_type);
-    param_values.push_back(oop_tmp_slot());
-
-    _receiver_slot_offset = stack()->oop_tmp_slot_offset();
-  }
-  else if (is_returning_oop()) {
-    // The oop_tmp slot is registered in the oopmap,
-    // so we need to clear it.  This is one of the
-    // mild inefficiencies I mentioned earlier.
-    builder()->CreateStore(LLVMValue::null(), oop_tmp_slot());
-  }
-
-  // Parse the arguments
-  for (int i = 0; i < arg_size(); i++) {
-    int slot_offset = stack()->locals_slots_offset() + arg_size() - 1 - i;
-    int adjusted_offset = slot_offset;
-    BasicBlock *null, *not_null, *merge;
-    Value *box;
-    PHINode *phi;
-
-    switch (arg_type(i)) {
-    case T_VOID:
-      break;
-
-    case T_OBJECT:
-    case T_ARRAY:
-      null     = CreateBlock("null");
-      not_null = CreateBlock("not_null");
-      merge    = CreateBlock("merge");
-
-      box = stack()->slot_addr(slot_offset, SharkType::oop_type());
-      builder()->CreateCondBr(
-        builder()->CreateICmp(
-          ICmpInst::ICMP_EQ,
-          builder()->CreateLoad(box),
-          LLVMValue::null()),
-        null, not_null);
-
-      builder()->SetInsertPoint(null);
-      builder()->CreateBr(merge);
-
-      builder()->SetInsertPoint(not_null);
-      builder()->CreateBr(merge);
-
-      builder()->SetInsertPoint(merge);
-      phi = builder()->CreatePHI(box_type, "boxed_object");
-      phi->addIncoming(ConstantPointerNull::get(box_type), null);
-      phi->addIncoming(box, not_null);
-      box = phi;
-
-      param_types.push_back(box_type);
-      param_values.push_back(box);
-
-      oopmap->set_oop(SharkStack::slot2reg(slot_offset));
-
-      if (i == 0 && !is_static())
-        _receiver_slot_offset = slot_offset;
-
-      break;
-
-    case T_LONG:
-    case T_DOUBLE:
-      adjusted_offset--;
-      // fall through
-
-    default:
-      const Type *param_type = SharkType::to_stackType(arg_type(i));
-
-      param_types.push_back(param_type);
-      param_values.push_back(
-        builder()->CreateLoad(stack()->slot_addr(adjusted_offset, param_type)));
-    }
-  }
-
-  // The oopmap is now complete, and everything is written
-  // into the frame except the PC.
-  int pc_offset = code_buffer()->create_unique_offset();
-
-  _oop_maps = new OopMapSet();
-  oop_maps()->add_gc_map(pc_offset, oopmap);
-
-  builder()->CreateStore(
-    builder()->code_buffer_address(pc_offset),
-    stack()->slot_addr(stack()->pc_slot_offset()));
-
-  // Set up the Java frame anchor
-  stack()->CreateSetLastJavaFrame();
-
-  // Lock if necessary
-  if (is_synchronized())
-    Unimplemented();
-
-  // Change the thread state to _thread_in_native
-  CreateSetThreadState(_thread_in_native);
-
-  // Make the call
-  BasicType result_type = target()->result_type();
-  const Type* return_type;
-  if (result_type == T_VOID)
-    return_type = SharkType::void_type();
-  else if (is_returning_oop())
-    return_type = box_type;
-  else
-    return_type = SharkType::to_arrayType(result_type);
-  Value* native_function = builder()->CreateIntToPtr(
-     LLVMValue::intptr_constant((intptr_t) target()->native_function()),
-     PointerType::getUnqual(
-       FunctionType::get(return_type, param_types, false)));
-  Value *result = builder()->CreateCall(
-    native_function, param_values.begin(), param_values.end());
-
-  // Start the transition back to _thread_in_Java
-  CreateSetThreadState(_thread_in_native_trans);
-
-  // Make sure new state is visible in the GC thread
-  if (os::is_MP()) {
-    if (UseMembar)
-      builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
-    else
-      CreateWriteMemorySerializePage();
-  }
-
-  // Handle safepoint operations, pending suspend requests,
-  // and pending asynchronous exceptions.
-  BasicBlock *check_thread = CreateBlock("check_thread");
-  BasicBlock *do_safepoint = CreateBlock("do_safepoint");
-  BasicBlock *safepointed  = CreateBlock("safepointed");
-
-  Value *global_state = builder()->CreateLoad(
-    builder()->CreateIntToPtr(
-      LLVMValue::intptr_constant(
-        (intptr_t) SafepointSynchronize::address_of_state()),
-      PointerType::getUnqual(SharkType::jint_type())),
-    "global_state");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpNE(
-      global_state,
-      LLVMValue::jint_constant(SafepointSynchronize::_not_synchronized)),
-    do_safepoint, check_thread);
-
-  builder()->SetInsertPoint(check_thread);
-  Value *thread_state = builder()->CreateValueOfStructEntry(
-    thread,
-    JavaThread::suspend_flags_offset(),
-    SharkType::jint_type(),
-    "thread_state");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpNE(
-      thread_state,
-      LLVMValue::jint_constant(0)),
-    do_safepoint, safepointed);
-
-  builder()->SetInsertPoint(do_safepoint);
-  builder()->CreateCall(
-    builder()->check_special_condition_for_native_trans(), thread);
-  builder()->CreateBr(safepointed);
-
-  // Finally we can change the thread state to _thread_in_Java
-  builder()->SetInsertPoint(safepointed);
-  CreateSetThreadState(_thread_in_Java);
-
-  // Clear the frame anchor
-  stack()->CreateResetLastJavaFrame();
-
-  // If there is a pending exception then we can just unwind and
-  // return.  It seems totally wrong that unlocking is skipped here
-  // but apparently the template interpreter does this so we do too.
-  BasicBlock *exception    = CreateBlock("exception");
-  BasicBlock *no_exception = CreateBlock("no_exception");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(
-      CreateLoadPendingException(),
-      LLVMValue::null()),
-    no_exception, exception);
-
-  builder()->SetInsertPoint(exception);
-  CreateResetHandleBlock();
-  stack()->CreatePopFrame(0);
-  builder()->CreateRet(LLVMValue::jint_constant(0));
-
-  builder()->SetInsertPoint(no_exception);
-
-  // If the result was an oop then unbox it before
-  // releasing the handle it might be protected by
-  if (is_returning_oop()) {
-    BasicBlock *null     = builder()->GetInsertBlock();
-    BasicBlock *not_null = CreateBlock("not_null");
-    BasicBlock *merge    = CreateBlock("merge");
-
-    builder()->CreateCondBr(
-      builder()->CreateICmpNE(result, ConstantPointerNull::get(box_type)),
-      not_null, merge);
-
-    builder()->SetInsertPoint(not_null);
-    Value *unboxed_result = builder()->CreateLoad(result);
-    builder()->CreateBr(merge);
-
-    builder()->SetInsertPoint(merge);
-    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "result");
-    phi->addIncoming(LLVMValue::null(), null);
-    phi->addIncoming(unboxed_result, not_null);
-    result = phi;
-  }
-
-  // Reset handle block
-  CreateResetHandleBlock();
-
-  // Unlock if necessary.
-  if (is_synchronized())
-    Unimplemented();
-
-  // Unwind and return
-  Value *result_addr = stack()->CreatePopFrame(type2size[result_type]);
-  if (result_type != T_VOID) {
-    bool needs_cast = false;
-    bool is_signed = false;
-    switch (result_type) {
-    case T_BOOLEAN:
-      result = builder()->CreateICmpNE(result, LLVMValue::jbyte_constant(0));
-      needs_cast = true;
-      break;
-
-    case T_CHAR:
-      needs_cast = true;
-      break;
-
-    case T_BYTE:
-    case T_SHORT:
-      needs_cast = true;
-      is_signed = true;
-      break;
-    }
-    if (needs_cast) {
-      result = builder()->CreateIntCast(
-        result, SharkType::to_stackType(result_type), is_signed);
-    }
-
-    builder()->CreateStore(
-      result,
-      builder()->CreateIntToPtr(
-        result_addr,
-        PointerType::getUnqual(SharkType::to_stackType(result_type))));
-  }
-  builder()->CreateRet(LLVMValue::jint_constant(0));
-}
--- a/ports/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkNativeWrapper : public SharkCompileInvariants {
-  friend class SharkStackWithNativeFrame;
-
- public:
-  static SharkNativeWrapper* build(SharkBuilder* builder,
-                                   methodHandle  target,
-                                   const char*   name,
-                                   BasicType*    arg_types,
-                                   BasicType     return_type) {
-    return new SharkNativeWrapper(builder,
-                                  target,
-                                  name,
-                                  arg_types,
-                                  return_type);
-  }
-
- private:
-  SharkNativeWrapper(SharkBuilder* builder,
-                     methodHandle  target,
-                     const char*   name,
-                     BasicType*    arg_types,
-                     BasicType     return_type)
-    : SharkCompileInvariants(NULL, builder),
-      _target(target),
-      _arg_types(arg_types),
-      _return_type(return_type),
-      _lock_slot_offset(0) { initialize(name); }
-
- private:
-  void initialize(const char* name);
-
- private:
-  methodHandle    _target;
-  BasicType*      _arg_types;
-  BasicType       _return_type;
-  llvm::Function* _function;
-  SharkStack*     _stack;
-  llvm::Value*    _oop_tmp_slot;
-  OopMapSet*      _oop_maps;
-  int             _receiver_slot_offset;
-  int             _lock_slot_offset;
-
-  // The method being compiled.
- protected:
-  methodHandle target() const {
-    return _target;
-  }
-
-  // Properties of the method.
- protected:
-  int arg_size() const {
-    return target()->size_of_parameters();
-  }
-  BasicType arg_type(int i) const {
-    return _arg_types[i];
-  }
-  BasicType return_type() const {
-    return _return_type;
-  }
-  bool is_static() const {
-    return target()->is_static();
-  }
-  bool is_synchronized() const {
-    return target()->is_synchronized();
-  }
-  bool is_returning_oop() const {
-    return target()->is_returning_oop();
-  }
-
-  // The LLVM function we are building.
- public:
-  llvm::Function* function() const {
-    return _function;
-  }
-
-  // The Zero stack and our frame on it.
- protected:
-  SharkStack* stack() const {
-    return _stack;
-  }
-
-  // Temporary oop storage.
- protected:
-  llvm::Value* oop_tmp_slot() const {
-    assert(is_static() || is_returning_oop(), "should be");
-    return _oop_tmp_slot;
-  }
-
-  // Information required by nmethod::new_native_nmethod().
- public:
-  int frame_size() const {
-    return stack()->oopmap_frame_size();
-  }
-  ByteSize receiver_offset() const {
-    return in_ByteSize(_receiver_slot_offset * wordSize);
-  }
-  ByteSize lock_offset() const {
-    return in_ByteSize(_lock_slot_offset * wordSize);
-  }
-  OopMapSet* oop_maps() const {
-    return _oop_maps;
-  }
-
-  // Helpers.
- private:
-  llvm::BasicBlock* CreateBlock(const char* name = "") const {
-    return llvm::BasicBlock::Create(SharkContext::current(), name, function());
-  }
-  llvm::Value* thread_state_address() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(), JavaThread::thread_state_offset(),
-      llvm::PointerType::getUnqual(SharkType::jint_type()),
-      "thread_state_address");
-  }
-  llvm::Value* pending_exception_address() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(), Thread::pending_exception_offset(),
-      llvm::PointerType::getUnqual(SharkType::oop_type()),
-      "pending_exception_address");
-  }
-  void CreateSetThreadState(JavaThreadState state) const {
-    builder()->CreateStore(
-      LLVMValue::jint_constant(state), thread_state_address());
-  }
-  void CreateWriteMemorySerializePage() const {
-    builder()->CreateStore(
-      LLVMValue::jint_constant(1),
-      builder()->CreateIntToPtr(
-        builder()->CreateAdd(
-          LLVMValue::intptr_constant(
-            (intptr_t) os::get_memory_serialize_page()),
-          builder()->CreateAnd(
-            builder()->CreateLShr(
-              builder()->CreatePtrToInt(thread(), SharkType::intptr_type()),
-              LLVMValue::intptr_constant(os::get_serialize_page_shift_count())),
-            LLVMValue::intptr_constant(os::get_serialize_page_mask()))),
-        llvm::PointerType::getUnqual(SharkType::jint_type())));
-  }
-  void CreateResetHandleBlock() const {
-    llvm::Value *active_handles = builder()->CreateValueOfStructEntry(
-      thread(),
-      JavaThread::active_handles_offset(),
-      SharkType::jniHandleBlock_type(),
-      "active_handles");
-    builder()->CreateStore(
-      LLVMValue::intptr_constant(0),
-      builder()->CreateAddressOfStructEntry(
-        active_handles,
-        in_ByteSize(JNIHandleBlock::top_offset_in_bytes()),
-        llvm::PointerType::getUnqual(SharkType::intptr_type()),
-        "top"));
-  }
-  llvm::LoadInst* CreateLoadPendingException() const {
-    return builder()->CreateLoad(
-      pending_exception_address(), "pending_exception");
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkRuntime.cpp.incl"
-
-using namespace llvm;
-
-JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
-                                                    int*        indexes,
-                                                    int         num_indexes))
-  constantPoolHandle pool(thread, method(thread)->constants());
-  KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass());
-
-  for (int i = 0; i < num_indexes; i++) {
-    klassOop tmp = pool->klass_at(indexes[i], CHECK_0);
-    KlassHandle chk_klass(thread, tmp);
-
-    if (exc_klass() == chk_klass())
-      return i;
-
-    if (exc_klass()->klass_part()->is_subtype_of(chk_klass()))
-      return i;
-  }
-
-  return -1;
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::monitorenter(JavaThread*      thread,
-                                           BasicObjectLock* lock))
-  if (PrintBiasedLockingStatistics)
-    Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
-
-  Handle object(thread, lock->obj());
-  assert(Universe::heap()->is_in_reserved_or_null(object()), "should be");
-  if (UseBiasedLocking) {
-    // Retry fast entry if bias is revoked to avoid unnecessary inflation
-    ObjectSynchronizer::fast_enter(object, lock->lock(), true, CHECK);
-  } else {
-    ObjectSynchronizer::slow_enter(object, lock->lock(), CHECK);
-  }
-  assert(Universe::heap()->is_in_reserved_or_null(lock->obj()), "should be");
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::monitorexit(JavaThread*      thread,
-                                          BasicObjectLock* lock))
-  Handle object(thread, lock->obj());
-  assert(Universe::heap()->is_in_reserved_or_null(object()), "should be");
-  if (lock == NULL || object()->is_unlocked()) {
-    THROW(vmSymbols::java_lang_IllegalMonitorStateException());
-  }
-  ObjectSynchronizer::slow_exit(object(), lock->lock(), thread);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::new_instance(JavaThread* thread, int index))
-  klassOop k_oop = method(thread)->constants()->klass_at(index, CHECK);
-  instanceKlassHandle klass(THREAD, k_oop);
-
-  // Make sure we are not instantiating an abstract klass
-  klass->check_valid_for_instantiation(true, CHECK);
-
-  // Make sure klass is initialized
-  klass->initialize(CHECK);
-
-  // At this point the class may not be fully initialized
-  // because of recursive initialization. If it is fully
-  // initialized & has_finalized is not set, we rewrite
-  // it into its fast version (Note: no locking is needed
-  // here since this is an atomic byte write and can be
-  // done more than once).
-  //
-  // Note: In case of classes with has_finalized we don't
-  //       rewrite since that saves us an extra check in
-  //       the fast version which then would call the
-  //       slow version anyway (and do a call back into
-  //       Java).
-  //       If we have a breakpoint, then we don't rewrite
-  //       because the _breakpoint bytecode would be lost.
-  oop obj = klass->allocate_instance(CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::newarray(JavaThread* thread,
-                                       BasicType   type,
-                                       int         size))
-  oop obj = oopFactory::new_typeArray(type, size, CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::anewarray(JavaThread* thread,
-                                        int         index,
-                                        int         size))
-  klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
-  objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::multianewarray(JavaThread* thread,
-                                             int         index,
-                                             int         ndims,
-                                             int*        dims))
-  klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
-  oop obj = arrayKlass::cast(klass)->multi_allocate(ndims, dims, CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread,
-                                                 oop         object))
-  assert(object->is_oop(), "should be");
-  assert(object->klass()->klass_part()->has_finalizer(), "should have");
-  instanceKlass::register_finalizer(instanceOop(object), CHECK);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::throw_ArithmeticException(JavaThread* thread,
-                                                        const char* file,
-                                                        int         line))
-  Exceptions::_throw_msg(
-    thread, file, line,
-    vmSymbols::java_lang_ArithmeticException(),
-    "");
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::throw_ArrayIndexOutOfBoundsException(
-                                                     JavaThread* thread,
-                                                     const char* file,
-                                                     int         line,
-                                                     int         index))
-  char msg[jintAsStringSize];
-  snprintf(msg, sizeof(msg), "%d", index);
-  Exceptions::_throw_msg(
-    thread, file, line,
-    vmSymbols::java_lang_ArrayIndexOutOfBoundsException(),
-    msg);
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::throw_ClassCastException(JavaThread* thread,
-                                                       const char* file,
-                                                       int         line))
-  Exceptions::_throw_msg(
-    thread, file, line,
-    vmSymbols::java_lang_ClassCastException(),
-    "");
-JRT_END
-
-JRT_ENTRY(void, SharkRuntime::throw_NullPointerException(JavaThread* thread,
-                                                         const char* file,
-                                                         int         line))
-  Exceptions::_throw_msg(
-    thread, file, line,
-    vmSymbols::java_lang_NullPointerException(),
-    "");
-JRT_END
-
-// Non-VM calls
-// Nothing in these must ever GC!
-
-void SharkRuntime::dump(const char *name, intptr_t value) {
-  oop valueOop = (oop) value;
-  tty->print("%s = ", name);
-  if (valueOop->is_oop(true))
-    valueOop->print_on(tty);
-  else if (value >= ' ' && value <= '~')
-    tty->print("'%c' (%d)", value, value);
-  else
-    tty->print("%p", value);
-  tty->print_cr("");
-}
-
-bool SharkRuntime::is_subtype_of(klassOop check_klass, klassOop object_klass) {
-  return object_klass->klass_part()->is_subtype_of(check_klass);
-}
-
-int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) {
-  Thread *THREAD = thread;
-
-  // In C2, uncommon_trap_blob creates a frame, so all the various
-  // deoptimization functions expect to find the frame of the method
-  // being deopted one frame down on the stack.  We create a dummy
-  // frame to mirror this.
-  FakeStubFrame *stubframe = FakeStubFrame::build(CHECK_0);
-  thread->push_zero_frame(stubframe);
-
-  // Initiate the trap
-  thread->set_last_Java_frame();
-  Deoptimization::UnrollBlock *urb =
-    Deoptimization::uncommon_trap(thread, trap_request);
-  thread->reset_last_Java_frame();
-
-  // Pop our dummy frame and the frame being deoptimized
-  thread->pop_zero_frame();
-  thread->pop_zero_frame();
-
-  // Push skeleton frames
-  int number_of_frames = urb->number_of_frames();
-  for (int i = 0; i < number_of_frames; i++) {
-    intptr_t size = urb->frame_sizes()[i];
-    InterpreterFrame *frame = InterpreterFrame::build(size, CHECK_0);
-    thread->push_zero_frame(frame);
-  }
-
-  // Push another dummy frame
-  stubframe = FakeStubFrame::build(CHECK_0);
-  thread->push_zero_frame(stubframe);
-
-  // Fill in the skeleton frames
-  thread->set_last_Java_frame();
-  Deoptimization::unpack_frames(thread, Deoptimization::Unpack_uncommon_trap);
-  thread->reset_last_Java_frame();
-
-  // Pop our dummy frame
-  thread->pop_zero_frame();
-
-  // Fall back into the interpreter
-  return number_of_frames;
-}
-
-FakeStubFrame* FakeStubFrame::build(TRAPS) {
-  ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
-  stack->overflow_check(header_words, CHECK_NULL);
-
-  stack->push(0); // next_frame, filled in later
-  intptr_t *fp = stack->sp();
-  assert(fp - stack->sp() == next_frame_off, "should be");
-
-  stack->push(FAKE_STUB_FRAME);
-  assert(fp - stack->sp() == frame_type_off, "should be");
-
-  return (FakeStubFrame *) fp;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkRuntime : public AllStatic {
-  // VM calls
- public:
-  static int find_exception_handler(JavaThread* thread,
-                                    int*        indexes,
-                                    int         num_indexes);
-
-  static void monitorenter(JavaThread* thread, BasicObjectLock* lock);
-  static void monitorexit(JavaThread* thread, BasicObjectLock* lock);
-
-  static void new_instance(JavaThread* thread, int index);
-  static void newarray(JavaThread* thread, BasicType type, int size);
-  static void anewarray(JavaThread* thread, int index, int size);
-  static void multianewarray(JavaThread* thread,
-                             int         index,
-                             int         ndims,
-                             int*        dims);
-
-  static void register_finalizer(JavaThread* thread, oop object);
-
-  static void throw_ArithmeticException(JavaThread* thread,
-                                        const char* file,
-                                        int         line);
-  static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread,
-                                                   const char* file,
-                                                   int         line,
-                                                   int         index);
-  static void throw_ClassCastException(JavaThread* thread,
-                                       const char* file,
-                                       int         line);
-  static void throw_NullPointerException(JavaThread* thread,
-                                         const char* file,
-                                         int         line);
-
-  // Helpers for VM calls
- private:
-  static const SharkFrame* last_frame(JavaThread *thread) {
-    return thread->last_frame().zero_sharkframe();
-  }
-  static methodOop method(JavaThread *thread) {
-    return last_frame(thread)->method();
-  }
-  static address bcp(JavaThread *thread, int bci) {
-    return method(thread)->code_base() + bci;
-  }
-  static int two_byte_index(JavaThread *thread, int bci) {
-    return Bytes::get_Java_u2(bcp(thread, bci) + 1);
-  }
-  static intptr_t tos_at(JavaThread *thread, int offset) {
-    return *(thread->zero_stack()->sp() + offset);
-  }
-
-  // Non-VM calls
- public:
-  static void dump(const char *name, intptr_t value);
-  static bool is_subtype_of(klassOop check_klass, klassOop object_klass);
-  static int uncommon_trap(JavaThread* thread, int trap_request);
-};
--- a/ports/hotspot/src/share/vm/shark/sharkStack.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkStack.cpp.incl"
-
-using namespace llvm;
-
-void SharkStack::initialize(Value* method) {
-  bool setup_sp_and_method = (method != NULL);
-
-  int locals_words  = max_locals();
-  int extra_locals  = locals_words - arg_size();
-  int header_words  = SharkFrame::header_words;
-  int monitor_words = max_monitors()*frame::interpreter_frame_monitor_size();
-  int stack_words   = max_stack();
-  int frame_words   = header_words + monitor_words + stack_words;
-
-  _extended_frame_size = frame_words + locals_words;
-
-  // Update the stack pointer
-  Value *stack_pointer = builder()->CreateSub(
-    CreateLoadStackPointer(),
-    LLVMValue::intptr_constant((frame_words + extra_locals) * wordSize));
-  CreateStackOverflowCheck(stack_pointer);
-  if (setup_sp_and_method)
-    CreateStoreStackPointer(stack_pointer);
-
-  // Create the frame
-  _frame = builder()->CreateIntToPtr(
-    stack_pointer,
-    PointerType::getUnqual(
-      ArrayType::get(SharkType::intptr_type(), extended_frame_size())),
-    "frame");
-  int offset = 0;
-
-  // Expression stack
-  _stack_slots_offset = offset;
-  offset += stack_words;
-
-  // Monitors
-  _monitors_slots_offset = offset;
-  offset += monitor_words;
-
-  // Temporary oop slot
-  _oop_tmp_slot_offset = offset++;
-
-  // Method pointer
-  _method_slot_offset = offset++;
-  if (setup_sp_and_method) {
-    builder()->CreateStore(
-      method, slot_addr(method_slot_offset(), SharkType::methodOop_type()));
-  }
-
-  // Unextended SP
-  builder()->CreateStore(stack_pointer, slot_addr(offset++));
-
-  // PC
-  _pc_slot_offset = offset++;
-
-  // Frame header
-  builder()->CreateStore(
-    LLVMValue::intptr_constant(ZeroFrame::SHARK_FRAME), slot_addr(offset++));
-  Value *fp = slot_addr(offset++);
-
-  // Local variables
-  _locals_slots_offset = offset;
-  offset += locals_words;
-
-  // Push the frame
-  assert(offset == extended_frame_size(), "should do");
-  builder()->CreateStore(CreateLoadFramePointer(), fp);
-  CreateStoreFramePointer(
-    builder()->CreatePtrToInt(fp, SharkType::intptr_type()));
-}
-
-// This function should match ZeroStack::overflow_check
-void SharkStack::CreateStackOverflowCheck(Value* sp) {
-  BasicBlock *zero_ok  = CreateBlock("zero_stack_ok");
-  BasicBlock *overflow = CreateBlock("stack_overflow");
-  BasicBlock *abi_ok   = CreateBlock("abi_stack_ok");
-
-  // Check the Zero stack
-  builder()->CreateCondBr(
-    builder()->CreateICmpULT(sp, stack_base()),
-    overflow, zero_ok);
-
-  // Check the ABI stack
-  builder()->SetInsertPoint(zero_ok);
-  Value *stack_top = builder()->CreateSub(
-    builder()->CreateValueOfStructEntry(
-      thread(),
-      Thread::stack_base_offset(),
-      SharkType::intptr_type(),
-      "abi_base"),
-    builder()->CreateValueOfStructEntry(
-      thread(),
-      Thread::stack_size_offset(),
-      SharkType::intptr_type(),
-      "abi_size"));
-  Value *free_stack = builder()->CreateSub(
-    builder()->CreatePtrToInt(
-      builder()->CreateGetFrameAddress(),
-      SharkType::intptr_type(),
-      "abi_sp"),
-    stack_top);
-  builder()->CreateCondBr(
-    builder()->CreateICmpULT(
-      free_stack,
-      LLVMValue::intptr_constant(StackShadowPages * os::vm_page_size())),
-    overflow, abi_ok);
-
-  // Handle overflows
-  builder()->SetInsertPoint(overflow);
-  builder()->CreateCall(builder()->throw_StackOverflowError(), thread());
-  builder()->CreateRet(LLVMValue::jint_constant(0));
-
-  builder()->SetInsertPoint(abi_ok);
-}
-
-Value* SharkStack::CreatePopFrame(int result_slots) {
-  assert(result_slots >= 0 && result_slots <= 2, "should be");
-  int locals_to_pop = max_locals() - result_slots;
-
-  Value *fp = CreateLoadFramePointer();
-  Value *sp = builder()->CreateAdd(
-    fp,
-    LLVMValue::intptr_constant((1 + locals_to_pop) * wordSize));
-
-  CreateStoreStackPointer(sp);
-  CreateStoreFramePointer(
-    builder()->CreateLoad(
-      builder()->CreateIntToPtr(
-        fp, PointerType::getUnqual(SharkType::intptr_type()))));
-
-  return sp;
-}
-
-Value* SharkStack::slot_addr(int         offset,
-                             const Type* type,
-                             const char* name) const {
-  bool needs_cast = type && type != SharkType::intptr_type();
-
-  Value* result = builder()->CreateStructGEP(
-    _frame, offset, needs_cast ? "" : name);
-
-  if (needs_cast) {
-    result = builder()->CreateBitCast(
-      result, PointerType::getUnqual(type), name);
-  }
-  return result;
-}
-
-// The bits that differentiate stacks with normal and native frames on top
-
-SharkStack* SharkStack::CreateBuildAndPushFrame(SharkFunction* function,
-                                                Value*         method) {
-  return new SharkStackWithNormalFrame(function, method);
-}
-SharkStack* SharkStack::CreateBuildAndPushFrame(SharkNativeWrapper* wrapper,
-                                                Value*              method) {
-  return new SharkStackWithNativeFrame(wrapper, method);
-}
-
-SharkStackWithNormalFrame::SharkStackWithNormalFrame(SharkFunction* function,
-                                                     Value*         method)
-  : SharkStack(function), _function(function) {
-  // For normal frames, the stack pointer and the method slot will
-  // be set during each decache, so it is not necessary to do them
-  // at the time the frame is created.  However, we set them for
-  // non-PRODUCT builds to make crash dumps easier to understand.
-  initialize(PRODUCT_ONLY(NULL) NOT_PRODUCT(method));
-}
-SharkStackWithNativeFrame::SharkStackWithNativeFrame(SharkNativeWrapper* wrp,
-                                                     Value*              method)
-  : SharkStack(wrp), _wrapper(wrp) {
-  initialize(method);
-}
-
-int SharkStackWithNormalFrame::arg_size() const {
-  return function()->arg_size();
-}
-int SharkStackWithNativeFrame::arg_size() const {
-  return wrapper()->arg_size();
-}
-
-int SharkStackWithNormalFrame::max_locals() const {
-  return function()->max_locals();
-}
-int SharkStackWithNativeFrame::max_locals() const {
-  return wrapper()->arg_size();
-}
-
-int SharkStackWithNormalFrame::max_stack() const {
-  return function()->max_stack();
-}
-int SharkStackWithNativeFrame::max_stack() const {
-  return 0;
-}
-
-int SharkStackWithNormalFrame::max_monitors() const {
-  return function()->max_monitors();
-}
-int SharkStackWithNativeFrame::max_monitors() const {
-  return wrapper()->is_synchronized() ? 1 : 0;
-}
-
-BasicBlock* SharkStackWithNormalFrame::CreateBlock(const char* name) const {
-  return function()->CreateBlock(name);
-}
-BasicBlock* SharkStackWithNativeFrame::CreateBlock(const char* name) const {
-  return wrapper()->CreateBlock(name);
-}
-
-address SharkStackWithNormalFrame::interpreter_entry_point() const {
-  return (address) CppInterpreter::normal_entry;
-}
-address SharkStackWithNativeFrame::interpreter_entry_point() const {
-  return (address) CppInterpreter::native_entry;
-}
-
-#ifndef PRODUCT
-void SharkStack::CreateAssertLastJavaSPIsNull() const {
-#ifdef ASSERT
-  BasicBlock *fail = CreateBlock("assert_failed");
-  BasicBlock *pass = CreateBlock("assert_ok");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(
-      builder()->CreateLoad(last_Java_sp_addr()),
-      LLVMValue::intptr_constant(0)),
-    pass, fail);
-
-  builder()->SetInsertPoint(fail);
-  builder()->CreateShouldNotReachHere(__FILE__, __LINE__);
-  builder()->CreateUnreachable();
-
-  builder()->SetInsertPoint(pass);
-#endif // ASSERT
-}
-#endif // !PRODUCT
--- a/ports/hotspot/src/share/vm/shark/sharkStack.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkFunction;
-class SharkNativeWrapper;
-class SharkStackWithNormalFrame;
-class SharkStackWithNativeFrame;
-
-class SharkStack : public SharkCompileInvariants {
- public:
-  static SharkStack* CreateBuildAndPushFrame(
-    SharkFunction* function, llvm::Value* method);
-  static SharkStack* CreateBuildAndPushFrame(
-    SharkNativeWrapper* wrapper, llvm::Value* method);
-
- protected:
-  SharkStack(const SharkCompileInvariants* parent)
-    : SharkCompileInvariants(parent) {}
-
- protected:
-  void initialize(llvm::Value* method);
-
- protected:
-  void CreateStackOverflowCheck(llvm::Value* sp);
-
-  // Properties of the method being compiled
- protected:
-  virtual int arg_size() const = 0;
-  virtual int max_locals() const = 0;
-  virtual int max_stack() const = 0;
-  virtual int max_monitors() const = 0;
-
-  // BasicBlock creation
- protected:
-  virtual llvm::BasicBlock* CreateBlock(const char* name = "") const = 0;
-
-  // Interpreter entry point for bailouts
- protected:
-  virtual address interpreter_entry_point() const = 0;
-
-  // Interface with the Zero stack
- private:
-  llvm::Value* zero_stack() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(),
-      JavaThread::zero_stack_offset(),
-      SharkType::zeroStack_type(),
-      "zero_stack");
-  }
-  llvm::Value* stack_base() const {
-    return builder()->CreateValueOfStructEntry(
-      zero_stack(),
-      ZeroStack::base_offset(),
-      SharkType::intptr_type(),
-      "stack_base");
-  }
-  llvm::Value* stack_pointer_addr() const {
-    return builder()->CreateAddressOfStructEntry(
-      zero_stack(),
-      ZeroStack::sp_offset(),
-      llvm::PointerType::getUnqual(SharkType::intptr_type()),
-      "stack_pointer_addr");
-  }
-  llvm::Value* frame_pointer_addr() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(),
-      JavaThread::top_zero_frame_offset(),
-      llvm::PointerType::getUnqual(SharkType::intptr_type()),
-      "frame_pointer_addr");
-  }
-
- public:
-  llvm::LoadInst* CreateLoadStackPointer(const char *name = "") {
-    return builder()->CreateLoad(stack_pointer_addr(), name);
-  }
-  llvm::StoreInst* CreateStoreStackPointer(llvm::Value* value) {
-    return builder()->CreateStore(value, stack_pointer_addr());
-  }
-  llvm::LoadInst* CreateLoadFramePointer(const char *name = "") {
-    return builder()->CreateLoad(frame_pointer_addr(), name);
-  }
-  llvm::StoreInst* CreateStoreFramePointer(llvm::Value* value) {
-    return builder()->CreateStore(value, frame_pointer_addr());
-  }
-  llvm::Value* CreatePopFrame(int result_slots);
-
-  // Interface with the frame anchor
- private:
-  llvm::Value* last_Java_sp_addr() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(),
-      JavaThread::last_Java_sp_offset(),
-      llvm::PointerType::getUnqual(SharkType::intptr_type()),
-      "last_Java_sp_addr");
-  }
-  llvm::Value* last_Java_fp_addr() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(),
-      JavaThread::last_Java_fp_offset(),
-      llvm::PointerType::getUnqual(SharkType::intptr_type()),
-      "last_Java_fp_addr");
-  }
-
- public:
-  void CreateSetLastJavaFrame() {
-    // Note that whenever _last_Java_sp != NULL other anchor fields
-    // must be valid.  The profiler apparently depends on this.
-    NOT_PRODUCT(CreateAssertLastJavaSPIsNull());
-    builder()->CreateStore(CreateLoadFramePointer(), last_Java_fp_addr());
-    // XXX There's last_Java_pc as well, but I don't think anything uses it
-    // Also XXX: should we fence here?  Zero doesn't...
-    builder()->CreateStore(CreateLoadStackPointer(), last_Java_sp_addr());
-    // Also also XXX: we could probably cache the sp (and the fp we know??)
-  }
-  void CreateResetLastJavaFrame() {
-    builder()->CreateStore(LLVMValue::intptr_constant(0), last_Java_sp_addr());
-  }
-
- private:
-  void CreateAssertLastJavaSPIsNull() const PRODUCT_RETURN;
-
-  // Our method's frame
- private:
-  llvm::Value* _frame;
-  int          _extended_frame_size;
-  int          _stack_slots_offset;
-
- public:
-  int extended_frame_size() const {
-    return _extended_frame_size;
-  }
-  int oopmap_frame_size() const {
-    return extended_frame_size() - arg_size();
-  }
-
-  // Offsets of things in the frame
- private:
-  int _monitors_slots_offset;
-  int _oop_tmp_slot_offset;
-  int _method_slot_offset;
-  int _pc_slot_offset;
-  int _locals_slots_offset;
-
- public:
-  int stack_slots_offset() const {
-    return _stack_slots_offset;
-  }
-  int oop_tmp_slot_offset() const {
-    return _oop_tmp_slot_offset;
-  }
-  int method_slot_offset() const {
-    return _method_slot_offset;
-  }
-  int pc_slot_offset() const {
-    return _pc_slot_offset;
-  }
-  int locals_slots_offset() const {
-    return _locals_slots_offset;
-  }
-  int monitor_offset(int index) const {
-    assert(index >= 0 && index < max_monitors(), "invalid monitor index");
-    return _monitors_slots_offset +
-      (max_monitors() - 1 - index) * frame::interpreter_frame_monitor_size();
-  }
-  int monitor_object_offset(int index) const {
-    return monitor_offset(index) +
-      (BasicObjectLock::obj_offset_in_bytes() >> LogBytesPerWord);
-  }
-  int monitor_header_offset(int index) const {
-    return monitor_offset(index) +
-      ((BasicObjectLock::lock_offset_in_bytes() +
-        BasicLock::displaced_header_offset_in_bytes()) >> LogBytesPerWord);
-  }
-
-  // Addresses of things in the frame
- public:
-  llvm::Value* slot_addr(int               offset,
-                         const llvm::Type* type = NULL,
-                         const char*       name = "") const;
-
-  llvm::Value* monitor_addr(int index) const {
-    return slot_addr(
-      monitor_offset(index),
-      SharkType::monitor_type(),
-      "monitor");
-  }
-  llvm::Value* monitor_object_addr(int index) const {
-    return slot_addr(
-      monitor_object_offset(index),
-      SharkType::oop_type(),
-      "object_addr");
-  }
-  llvm::Value* monitor_header_addr(int index) const {
-    return slot_addr(
-      monitor_header_offset(index),
-      SharkType::intptr_type(),
-      "displaced_header_addr");
-  }
-
-  // oopmap helpers
- public:
-  static int oopmap_slot_munge(int offset) {
-    return offset << (LogBytesPerWord - LogBytesPerInt);
-  }
-  static VMReg slot2reg(int offset) {
-    return VMRegImpl::stack2reg(oopmap_slot_munge(offset));
-  }
-};
-
-class SharkStackWithNormalFrame : public SharkStack {
-  friend class SharkStack;
-
- protected:
-  SharkStackWithNormalFrame(SharkFunction* function, llvm::Value* method);
-
- private:
-  SharkFunction* _function;
-
- private:
-  SharkFunction* function() const {
-    return _function;
-  }
-
-  // Properties of the method being compiled
- private:
-  int arg_size() const;
-  int max_locals() const;
-  int max_stack() const;
-  int max_monitors() const;
-
-  // BasicBlock creation
- private:
-  llvm::BasicBlock* CreateBlock(const char* name = "") const;
-
-  // Interpreter entry point for bailouts
- private:
-  address interpreter_entry_point() const;
-};
-
-class SharkStackWithNativeFrame : public SharkStack {
-  friend class SharkStack;
-
- protected:
-  SharkStackWithNativeFrame(SharkNativeWrapper* wrapper, llvm::Value* method);
-
- private:
-  SharkNativeWrapper* _wrapper;
-
- private:
-  SharkNativeWrapper* wrapper() const {
-    return _wrapper;
-  }
-
-  // Properties of the method being compiled
- private:
-  int arg_size() const;
-  int max_locals() const;
-  int max_stack() const;
-  int max_monitors() const;
-
-  // BasicBlock creation
- private:
-  llvm::BasicBlock* CreateBlock(const char* name = "") const;
-
-  // Interpreter entry point for bailouts
- private:
-  address interpreter_entry_point() const;
-};
--- a/ports/hotspot/src/share/vm/shark/sharkState.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkState.cpp.incl"
-
-using namespace llvm;
-
-void SharkState::initialize(const SharkState *state) {
-  _locals = NEW_RESOURCE_ARRAY(SharkValue*, max_locals());
-  _stack  = NEW_RESOURCE_ARRAY(SharkValue*, max_stack());
-
-  NOT_PRODUCT(memset(_locals, 23, max_locals() * sizeof(SharkValue *)));
-  NOT_PRODUCT(memset(_stack,  23, max_stack()  * sizeof(SharkValue *)));
-  _sp = _stack;
-
-  if (state) {
-    for (int i = 0; i < max_locals(); i++) {
-      SharkValue *value = state->local(i);
-      if (value)
-        value = value->clone();
-      set_local(i, value);
-    }
-
-    for (int i = state->stack_depth() - 1; i >= 0; i--) {
-      SharkValue *value = state->stack(i);
-      if (value)
-        value = value->clone();
-      push(value);
-    }
-  }
-
-  set_num_monitors(state ? state->num_monitors() : 0);
-}
-
-bool SharkState::equal_to(SharkState *other) {
-  if (target() != other->target())
-    return false;
-
-  if (method() != other->method())
-    return false;
-
-  if (oop_tmp() != other->oop_tmp())
-    return false;
-
-  if (max_locals() != other->max_locals())
-    return false;
-
-  if (stack_depth() != other->stack_depth())
-    return false;
-
-  if (num_monitors() != other->num_monitors())
-    return false;
-
-  if (has_safepointed() != other->has_safepointed())
-    return false;
-
-  // Local variables
-  for (int i = 0; i < max_locals(); i++) {
-    SharkValue *value = local(i);
-    SharkValue *other_value = other->local(i);
-
-    if (value == NULL) {
-      if (other_value != NULL)
-        return false;
-    }
-    else {
-      if (other_value == NULL)
-        return false;
-
-      if (!value->equal_to(other_value))
-        return false;
-    }
-  }
-
-  // Expression stack
-  for (int i = 0; i < stack_depth(); i++) {
-    SharkValue *value = stack(i);
-    SharkValue *other_value = other->stack(i);
-
-    if (value == NULL) {
-      if (other_value != NULL)
-        return false;
-    }
-    else {
-      if (other_value == NULL)
-        return false;
-
-      if (!value->equal_to(other_value))
-        return false;
-    }
-  }
-
-  return true;
-}
-
-void SharkState::merge(SharkState* other,
-                       BasicBlock* other_block,
-                       BasicBlock* this_block) {
-  // Method
-  Value *this_method = this->method();
-  Value *other_method = other->method();
-  if (this_method != other_method) {
-    PHINode *phi = builder()->CreatePHI(SharkType::methodOop_type(), "method");
-    phi->addIncoming(this_method, this_block);
-    phi->addIncoming(other_method, other_block);
-    set_method(phi);
-  }
-
-  // Temporary oop slot
-  Value *this_oop_tmp = this->oop_tmp();
-  Value *other_oop_tmp = other->oop_tmp();
-  if (this_oop_tmp != other_oop_tmp) {
-    assert(this_oop_tmp && other_oop_tmp, "can't merge NULL with non-NULL");
-    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "oop_tmp");
-    phi->addIncoming(this_oop_tmp, this_block);
-    phi->addIncoming(other_oop_tmp, other_block);
-    set_oop_tmp(phi);
-  }
-
-  // Monitors
-  assert(this->num_monitors() == other->num_monitors(), "should be");
-
-  // Local variables
-  assert(this->max_locals() == other->max_locals(), "should be");
-  for (int i = 0; i < max_locals(); i++) {
-    SharkValue *this_value = this->local(i);
-    SharkValue *other_value = other->local(i);
-    assert((this_value == NULL) == (other_value == NULL), "should be");
-    if (this_value != NULL) {
-      char name[18];
-      snprintf(name, sizeof(name), "local_%d_", i);
-      set_local(i, this_value->merge(
-        builder(), other_value, other_block, this_block, name));
-    }
-  }
-
-  // Expression stack
-  assert(this->stack_depth() == other->stack_depth(), "should be");
-  for (int i = 0; i < stack_depth(); i++) {
-    SharkValue *this_value = this->stack(i);
-    SharkValue *other_value = other->stack(i);
-    assert((this_value == NULL) == (other_value == NULL), "should be");
-    if (this_value != NULL) {
-      char name[18];
-      snprintf(name, sizeof(name), "stack_%d_", i);
-      set_stack(i, this_value->merge(
-        builder(), other_value, other_block, this_block, name));
-    }
-  }
-
-  // Safepointed status
-  set_has_safepointed(this->has_safepointed() && other->has_safepointed());
-}
-
-void SharkState::replace_all(SharkValue* old_value, SharkValue* new_value) {
-  // Local variables
-  for (int i = 0; i < max_locals(); i++) {
-    if (local(i) == old_value)
-      set_local(i, new_value);
-  }
-
-  // Expression stack
-  for (int i = 0; i < stack_depth(); i++) {
-    if (stack(i) == old_value)
-      set_stack(i, new_value);
-  }
-}
-
-SharkNormalEntryState::SharkNormalEntryState(SharkTopLevelBlock* block,
-                                             Value*              method)
-  : SharkState(block) {
-  assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
-
-  // Local variables
-  for (int i = 0; i < max_locals(); i++) {
-    ciType *type = block->local_type_at_entry(i);
-
-    SharkValue *value = NULL;
-    switch (type->basic_type()) {
-    case T_INT:
-    case T_LONG:
-    case T_FLOAT:
-    case T_DOUBLE:
-    case T_OBJECT:
-    case T_ARRAY:
-      if (i >= arg_size()) {
-        ShouldNotReachHere();
-      }
-      value = SharkValue::create_generic(type, NULL, i == 0 && !is_static());
-      break;
-
-    case ciTypeFlow::StateVector::T_NULL:
-      value = SharkValue::null();
-      break;
-
-    case ciTypeFlow::StateVector::T_BOTTOM:
-      break;
-
-    case ciTypeFlow::StateVector::T_LONG2:
-    case ciTypeFlow::StateVector::T_DOUBLE2:
-      break;
-
-    default:
-      ShouldNotReachHere();
-    }
-    set_local(i, value);
-  }
-  SharkNormalEntryCacher(block->function(), method).scan(this);
-}
-
-SharkOSREntryState::SharkOSREntryState(SharkTopLevelBlock* block,
-                                       Value*              method,
-                                       Value*              osr_buf)
-  : SharkState(block) {
-  assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
-  set_num_monitors(block->ciblock()->monitor_count());
-
-  // Local variables
-  for (int i = 0; i < max_locals(); i++) {
-    ciType *type = block->local_type_at_entry(i);
-
-    SharkValue *value = NULL;
-    switch (type->basic_type()) {
-    case T_INT:
-    case T_LONG:
-    case T_FLOAT:
-    case T_DOUBLE:
-    case T_OBJECT:
-    case T_ARRAY:
-      value = SharkValue::create_generic(type, NULL, false);
-      break;
-
-    case ciTypeFlow::StateVector::T_NULL:
-      value = SharkValue::null();
-      break;
-
-    case ciTypeFlow::StateVector::T_BOTTOM:
-      break;
-
-    case ciTypeFlow::StateVector::T_LONG2:
-    case ciTypeFlow::StateVector::T_DOUBLE2:
-      break;
-
-    default:
-      ShouldNotReachHere();
-    }
-    set_local(i, value);
-  }
-  SharkOSREntryCacher(block->function(), method, osr_buf).scan(this);
-}
-
-SharkPHIState::SharkPHIState(SharkTopLevelBlock* block)
-  : SharkState(block), _block(block) {
-  BasicBlock *saved_insert_point = builder()->GetInsertBlock();
-  builder()->SetInsertPoint(block->entry_block());
-  char name[18];
-
-  // Method
-  set_method(builder()->CreatePHI(SharkType::methodOop_type(), "method"));
-
-  // Local variables
-  for (int i = 0; i < max_locals(); i++) {
-    ciType *type = block->local_type_at_entry(i);
-    if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
-      // XXX we could do all kinds of clever stuff here
-      type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
-    }
-
-    SharkValue *value = NULL;
-    switch (type->basic_type()) {
-    case T_INT:
-    case T_LONG:
-    case T_FLOAT:
-    case T_DOUBLE:
-    case T_OBJECT:
-    case T_ARRAY:
-      snprintf(name, sizeof(name), "local_%d_", i);
-      value = SharkValue::create_phi(
-        type, builder()->CreatePHI(SharkType::to_stackType(type), name));
-      break;
-
-    case T_ADDRESS:
-      value = SharkValue::address_constant(type->as_return_address()->bci());
-      break;
-
-    case ciTypeFlow::StateVector::T_BOTTOM:
-      break;
-
-    case ciTypeFlow::StateVector::T_LONG2:
-    case ciTypeFlow::StateVector::T_DOUBLE2:
-      break;
-
-    default:
-      ShouldNotReachHere();
-    }
-    set_local(i, value);
-  }
-
-  // Expression stack
-  for (int i = 0; i < block->stack_depth_at_entry(); i++) {
-    ciType *type = block->stack_type_at_entry(i);
-    if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
-      // XXX we could do all kinds of clever stuff here
-      type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
-    }
-
-    SharkValue *value = NULL;
-    switch (type->basic_type()) {
-    case T_INT:
-    case T_LONG:
-    case T_FLOAT:
-    case T_DOUBLE:
-    case T_OBJECT:
-    case T_ARRAY:
-      snprintf(name, sizeof(name), "stack_%d_", i);
-      value = SharkValue::create_phi(
-        type, builder()->CreatePHI(SharkType::to_stackType(type), name));
-      break;
-
-    case T_ADDRESS:
-      value = SharkValue::address_constant(type->as_return_address()->bci());
-      break;
-
-    case ciTypeFlow::StateVector::T_LONG2:
-    case ciTypeFlow::StateVector::T_DOUBLE2:
-      break;
-
-    default:
-      ShouldNotReachHere();
-    }
-    push(value);
-  }
-
-  // Monitors
-  set_num_monitors(block->ciblock()->monitor_count());
-
-  builder()->SetInsertPoint(saved_insert_point);
-}
-
-void SharkPHIState::add_incoming(SharkState* incoming_state) {
-  BasicBlock *predecessor = builder()->GetInsertBlock();
-
-  // Method
-  ((PHINode *) method())->addIncoming(incoming_state->method(), predecessor);
-
-  // Local variables
-  for (int i = 0; i < max_locals(); i++) {
-    if (local(i) != NULL)
-      local(i)->addIncoming(incoming_state->local(i), predecessor);
-  }
-
-  // Expression stack
-  int stack_depth = block()->stack_depth_at_entry();
-  assert(stack_depth == incoming_state->stack_depth(), "should be");
-  for (int i = 0; i < stack_depth; i++) {
-    assert((stack(i) == NULL) == (incoming_state->stack(i) == NULL), "oops");
-    if (stack(i))
-      stack(i)->addIncoming(incoming_state->stack(i), predecessor);
-  }
-
-  // Monitors
-  assert(num_monitors() == incoming_state->num_monitors(), "should be");
-
-  // Temporary oop slot
-  assert(oop_tmp() == incoming_state->oop_tmp(), "should be");
-}
--- a/ports/hotspot/src/share/vm/shark/sharkState.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkState : public SharkTargetInvariants {
- public:
-  SharkState(const SharkTargetInvariants* parent)
-    : SharkTargetInvariants(parent),
-      _method(NULL),
-      _oop_tmp(NULL),
-      _has_safepointed(false) { initialize(NULL); }
-
-  SharkState(const SharkState* state)
-    : SharkTargetInvariants(state),
-      _method(state->_method),
-      _oop_tmp(state->_oop_tmp),
-      _has_safepointed(state->_has_safepointed) { initialize(state); }
-
- private:
-  void initialize(const SharkState* state);
-
- private:
-  llvm::Value* _method;
-  SharkValue** _locals;
-  SharkValue** _stack;
-  SharkValue** _sp;
-  int          _num_monitors;
-  llvm::Value* _oop_tmp;
-  bool         _has_safepointed;
-
-  // Method
- public:
-  llvm::Value** method_addr() {
-    return &_method;
-  }
-  llvm::Value* method() const {
-    return _method;
-  }
- protected:
-  void set_method(llvm::Value* method) {
-    _method = method;
-  }
-
-  // Local variables
- public:
-  SharkValue** local_addr(int index) const {
-    assert(index >= 0 && index < max_locals(), "bad local variable index");
-    return &_locals[index];
-  }
-  SharkValue* local(int index) const {
-    return *local_addr(index);
-  }
-  void set_local(int index, SharkValue* value) {
-    *local_addr(index) = value;
-  }
-
-  // Expression stack
- public:
-  SharkValue** stack_addr(int slot) const {
-    assert(slot >= 0 && slot < stack_depth(), "bad stack slot");
-    return &_sp[-(slot + 1)];
-  }
-  SharkValue* stack(int slot) const {
-    return *stack_addr(slot);
-  }
- protected:
-  void set_stack(int slot, SharkValue* value) {
-    *stack_addr(slot) = value;
-  }
- public:
-  int stack_depth() const {
-    return _sp - _stack;
-  }
-  void push(SharkValue* value) {
-    assert(stack_depth() < max_stack(), "stack overrun");
-    *(_sp++) = value;
-  }
-  SharkValue* pop() {
-    assert(stack_depth() > 0, "stack underrun");
-    return *(--_sp);
-  }
-
-  // Monitors
- public:
-  int num_monitors() const {
-    return _num_monitors;
-  }
-  void set_num_monitors(int num_monitors) {
-    _num_monitors = num_monitors;
-  }
-
-  // Temporary oop slot
- public:
-  llvm::Value** oop_tmp_addr() {
-    return &_oop_tmp;
-  }
-  llvm::Value* oop_tmp() const {
-    return _oop_tmp;
-  }
-  void set_oop_tmp(llvm::Value* oop_tmp) {
-    _oop_tmp = oop_tmp;
-  }
-
-  // Safepointed status
- public:
-  bool has_safepointed() const {
-    return _has_safepointed;
-  }
-  void set_has_safepointed(bool has_safepointed) {
-    _has_safepointed = has_safepointed;
-  }
-
-  // Comparison
- public:
-  bool equal_to(SharkState* other);
-
-  // Copy and merge
- public:
-  SharkState* copy() const {
-    return new SharkState(this);
-  }
-  void merge(SharkState*       other,
-             llvm::BasicBlock* other_block,
-             llvm::BasicBlock* this_block);
-
-  // Value replacement
- public:
-  void replace_all(SharkValue* old_value, SharkValue* new_value);
-};
-
-class SharkTopLevelBlock;
-
-// SharkNormalEntryState objects are used to create the state
-// that the method will be entered with for a normal invocation.
-class SharkNormalEntryState : public SharkState {
- public:
-  SharkNormalEntryState(SharkTopLevelBlock* block,
-                        llvm::Value*        method);
-};
-
-// SharkOSREntryState objects are used to create the state
-// that the method will be entered with for an OSR invocation.
-class SharkOSREntryState : public SharkState {
- public:
-  SharkOSREntryState(SharkTopLevelBlock* block,
-                     llvm::Value*        method,
-                     llvm::Value*        osr_buf);
-};
-
-// SharkPHIState objects are used to manage the entry state
-// for blocks with more than one entry path or for blocks
-// entered from blocks that will be compiled later.
-class SharkPHIState : public SharkState {
- public:
-  SharkPHIState(SharkTopLevelBlock* block);
-
- private:
-  SharkTopLevelBlock* _block;
-
- private:
-  SharkTopLevelBlock* block() const {
-    return _block;
-  }
-
- public:
-  void add_incoming(SharkState* incoming_state);
-};
--- a/ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkStateScanner.cpp.incl"
-
-using namespace llvm;
-
-void SharkStateScanner::scan(SharkState* state) {
-  start_frame();
-
-  // Expression stack
-  stack_integrity_checks(state);
-  start_stack(state->stack_depth());
-  for (int i = state->stack_depth() - 1; i >= 0; i--) {
-    process_stack_slot(
-      i,
-      state->stack_addr(i),
-      stack()->stack_slots_offset() +
-        i + max_stack() - state->stack_depth());
-  }
-  end_stack();
-
-  // Monitors
-  start_monitors(state->num_monitors());
-  for (int i = 0; i < state->num_monitors(); i++) {
-    process_monitor(
-      i,
-      stack()->monitor_offset(i),
-      stack()->monitor_object_offset(i));
-  }
-  end_monitors();
-
-  // Frame header
-  start_frame_header();
-  process_oop_tmp_slot(
-    state->oop_tmp_addr(), stack()->oop_tmp_slot_offset());
-  process_method_slot(state->method_addr(), stack()->method_slot_offset());
-  process_pc_slot(stack()->pc_slot_offset());
-  end_frame_header();
-
-  // Local variables
-  locals_integrity_checks(state);
-  start_locals();
-  for (int i = 0; i < max_locals(); i++) {
-    process_local_slot(
-      i,
-      state->local_addr(i),
-      stack()->locals_slots_offset() + max_locals() - 1 - i);
-  }
-  end_locals();
-
-  end_frame();
-}
-
-#ifndef PRODUCT
-void SharkStateScanner::stack_integrity_checks(SharkState* state) {
-  for (int i = 0; i < state->stack_depth(); i++) {
-    if (state->stack(i)) {
-      if (state->stack(i)->is_two_word())
-        assert(state->stack(i - 1) == NULL, "should be");
-    }
-    else {
-      assert(state->stack(i + 1)->is_two_word(), "should be");
-    }
-  }
-}
-
-void SharkStateScanner::locals_integrity_checks(SharkState* state) {
-  for (int i = 0; i < max_locals(); i++) {
-    if (state->local(i)) {
-      if (state->local(i)->is_two_word())
-        assert(state->local(i + 1) == NULL, "should be");
-    }
-  }
-}
-#endif // !PRODUCT
--- a/ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkState;
-
-class SharkStateScanner : public SharkTargetInvariants {
- protected:
-  SharkStateScanner(SharkFunction* function)
-    : SharkTargetInvariants(function), _stack(function->stack()) {}
-
- private:
-  SharkStack* _stack;
-
- protected:
-  SharkStack* stack() const {
-    return _stack;
-  }
-
-  // Scan the frame
- public:
-  void scan(SharkState* state);
-
-  // Callbacks
-  // Note that the offsets supplied to the various process_* callbacks
-  // are specified in wordSize words from the frame's unextended_sp.
- protected:
-  virtual void start_frame()                                                 {}
-
-  virtual void start_stack(int stack_depth)                                  {}
-  virtual void process_stack_slot(int index, SharkValue** value, int offset) {}
-  virtual void end_stack()                                                   {}
-
-  virtual void start_monitors(int num_monitors)                              {}
-  virtual void process_monitor(int index, int box_offset, int obj_offset)    {}
-  virtual void end_monitors()                                                {}
-
-  virtual void start_frame_header()                                          {}
-  virtual void process_oop_tmp_slot(llvm::Value** value, int offset)         {}
-  virtual void process_method_slot(llvm::Value** value, int offset)          {}
-  virtual void process_pc_slot(int offset)                                   {}
-  virtual void end_frame_header()                                            {}
-
-  virtual void start_locals()                                                {}
-  virtual void process_local_slot(int index, SharkValue** value, int offset) {}
-  virtual void end_locals()                                                  {}
-
-  virtual void end_frame()                                                   {}
-
-  // Integrity checks
- private:
-  void stack_integrity_checks(SharkState* state) PRODUCT_RETURN;
-  void locals_integrity_checks(SharkState* state) PRODUCT_RETURN;
-};
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1991 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkTopLevelBlock.cpp.incl"
-
-using namespace llvm;
-
-void SharkTopLevelBlock::scan_for_traps() {
-  // If typeflow found a trap then don't scan past it
-  int limit_bci = ciblock()->has_trap() ? ciblock()->trap_bci() : limit();
-
-  // Scan the bytecode for traps that are always hit
-  iter()->reset_to_bci(start());
-  while (iter()->next_bci() < limit_bci) {
-    iter()->next();
-
-    ciField *field;
-    ciMethod *method;
-    ciInstanceKlass *klass;
-    bool will_link;
-    bool is_field;
-
-    switch (bc()) {
-    case Bytecodes::_ldc:
-    case Bytecodes::_ldc_w:
-      if (!SharkConstant::for_ldc(iter())->is_loaded()) {
-        set_trap(
-          Deoptimization::make_trap_request(
-            Deoptimization::Reason_uninitialized,
-            Deoptimization::Action_reinterpret), bci());
-        return;
-      }
-      break;
-
-    case Bytecodes::_getfield:
-    case Bytecodes::_getstatic:
-    case Bytecodes::_putfield:
-    case Bytecodes::_putstatic:
-      field = iter()->get_field(will_link);
-      assert(will_link, "typeflow responsibility");
-      is_field = (bc() == Bytecodes::_getfield || bc() == Bytecodes::_putfield);
-
-      // If the bytecode does not match the field then bail out to
-      // the interpreter to throw an IncompatibleClassChangeError
-      if (is_field == field->is_static()) {
-        set_trap(
-          Deoptimization::make_trap_request(
-            Deoptimization::Reason_unhandled,
-            Deoptimization::Action_none), bci());
-        return;
-      }
-
-      // Bail out if we are trying to access a static variable
-      // before the class initializer has completed.
-      if (!is_field && !field->holder()->is_initialized()) {
-        if (!static_field_ok_in_clinit(field)) {
-          set_trap(
-            Deoptimization::make_trap_request(
-              Deoptimization::Reason_uninitialized,
-              Deoptimization::Action_reinterpret), bci());
-          return;
-        }
-      }
-      break;
-
-    case Bytecodes::_invokestatic:
-    case Bytecodes::_invokespecial:
-    case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokeinterface:
-      method = iter()->get_method(will_link);
-      assert(will_link, "typeflow responsibility");
-
-      if (!method->holder()->is_linked()) {
-        set_trap(
-          Deoptimization::make_trap_request(
-            Deoptimization::Reason_uninitialized,
-            Deoptimization::Action_reinterpret), bci());
-          return;
-      }
-
-      if (bc() == Bytecodes::_invokevirtual) {
-        klass = ciEnv::get_instance_klass_for_declared_method_holder(
-          iter()->get_declared_method_holder());
-        if (!klass->is_linked()) {
-          set_trap(
-            Deoptimization::make_trap_request(
-              Deoptimization::Reason_uninitialized,
-              Deoptimization::Action_reinterpret), bci());
-            return;
-        }
-      }
-      break;
-
-    case Bytecodes::_new:
-      klass = iter()->get_klass(will_link)->as_instance_klass();
-      assert(will_link, "typeflow responsibility");
-
-      // Bail out if the class is unloaded
-      if (iter()->is_unresolved_klass() || !klass->is_initialized()) {
-        set_trap(
-          Deoptimization::make_trap_request(
-            Deoptimization::Reason_uninitialized,
-            Deoptimization::Action_reinterpret), bci());
-        return;
-      }
-
-      // Bail out if the class cannot be instantiated
-      if (klass->is_abstract() || klass->is_interface() ||
-          klass->name() == ciSymbol::java_lang_Class()) {
-        set_trap(
-          Deoptimization::make_trap_request(
-            Deoptimization::Reason_unhandled,
-            Deoptimization::Action_reinterpret), bci());
-        return;
-      }
-      break;
-    }
-  }
-
-  // Trap if typeflow trapped (and we didn't before)
-  if (ciblock()->has_trap()) {
-    set_trap(
-      Deoptimization::make_trap_request(
-        Deoptimization::Reason_unloaded,
-        Deoptimization::Action_reinterpret,
-        ciblock()->trap_index()), ciblock()->trap_bci());
-    return;
-  }
-}
-
-bool SharkTopLevelBlock::static_field_ok_in_clinit(ciField* field) {
-  assert(field->is_static(), "should be");
-
-  // This code is lifted pretty much verbatim from C2's
-  // Parse::static_field_ok_in_clinit() in parse3.cpp.
-  bool access_OK = false;
-  if (target()->holder()->is_subclass_of(field->holder())) {
-    if (target()->is_static()) {
-      if (target()->name() == ciSymbol::class_initializer_name()) {
-        // It's OK to access static fields from the class initializer
-        access_OK = true;
-      }
-    }
-    else {
-      if (target()->name() == ciSymbol::object_initializer_name()) {
-        // It's also OK to access static fields inside a constructor,
-        // because any thread calling the constructor must first have
-        // synchronized on the class by executing a "new" bytecode.
-        access_OK = true;
-      }
-    }
-  }
-  return access_OK;
-}
-
-SharkState* SharkTopLevelBlock::entry_state() {
-  if (_entry_state == NULL) {
-    assert(needs_phis(), "should do");
-    _entry_state = new SharkPHIState(this);
-  }
-  return _entry_state;
-}
-
-void SharkTopLevelBlock::add_incoming(SharkState* incoming_state) {
-  if (needs_phis()) {
-    ((SharkPHIState *) entry_state())->add_incoming(incoming_state);
-  }
-  else if (_entry_state == NULL) {
-    _entry_state = incoming_state;
-  }
-  else {
-    assert(entry_state()->equal_to(incoming_state), "should be");
-  }
-}
-
-void SharkTopLevelBlock::enter(SharkTopLevelBlock* predecessor,
-                               bool is_exception) {
-  // This block requires phis:
-  //  - if it is entered more than once
-  //  - if it is an exception handler, because in which
-  //    case we assume it's entered more than once.
-  //  - if the predecessor will be compiled after this
-  //    block, in which case we can't simple propagate
-  //    the state forward.
-  if (!needs_phis() &&
-      (entered() ||
-       is_exception ||
-       (predecessor && predecessor->index() >= index())))
-    _needs_phis = true;
-
-  // Recurse into the tree
-  if (!entered()) {
-    _entered = true;
-
-    scan_for_traps();
-    if (!has_trap()) {
-      for (int i = 0; i < num_successors(); i++) {
-        successor(i)->enter(this, false);
-      }
-    }
-    compute_exceptions();
-    for (int i = 0; i < num_exceptions(); i++) {
-      SharkTopLevelBlock *handler = exception(i);
-      if (handler)
-        handler->enter(this, true);
-    }
-  }
-}
-
-void SharkTopLevelBlock::initialize() {
-  char name[28];
-  snprintf(name, sizeof(name),
-           "bci_%d%s",
-           start(), is_backedge_copy() ? "_backedge_copy" : "");
-  _entry_block = function()->CreateBlock(name);
-}
-
-void SharkTopLevelBlock::decache_for_Java_call(ciMethod *callee) {
-  SharkJavaCallDecacher(function(), bci(), callee).scan(current_state());
-  for (int i = 0; i < callee->arg_size(); i++)
-    xpop();
-}
-
-void SharkTopLevelBlock::cache_after_Java_call(ciMethod *callee) {
-  if (callee->return_type()->size()) {
-    ciType *type;
-    switch (callee->return_type()->basic_type()) {
-    case T_BOOLEAN:
-    case T_BYTE:
-    case T_CHAR:
-    case T_SHORT:
-      type = ciType::make(T_INT);
-      break;
-
-    default:
-      type = callee->return_type();
-    }
-
-    push(SharkValue::create_generic(type, NULL, false));
-  }
-  SharkJavaCallCacher(function(), callee).scan(current_state());
-}
-
-void SharkTopLevelBlock::decache_for_VM_call() {
-  SharkVMCallDecacher(function(), bci()).scan(current_state());
-}
-
-void SharkTopLevelBlock::cache_after_VM_call() {
-  SharkVMCallCacher(function()).scan(current_state());
-}
-
-void SharkTopLevelBlock::decache_for_trap() {
-  SharkTrapDecacher(function(), bci()).scan(current_state());
-}
-
-void SharkTopLevelBlock::emit_IR() {
-  builder()->SetInsertPoint(entry_block());
-
-  // Parse the bytecode
-  parse_bytecode(start(), limit());
-
-  // If this block falls through to the next then it won't have been
-  // terminated by a bytecode and we have to add the branch ourselves
-  if (falls_through() && !has_trap())
-    do_branch(ciTypeFlow::FALL_THROUGH);
-}
-
-SharkTopLevelBlock* SharkTopLevelBlock::bci_successor(int bci) const {
-  // XXX now with Linear Search Technology (tm)
-  for (int i = 0; i < num_successors(); i++) {
-    ciTypeFlow::Block *successor = ciblock()->successors()->at(i);
-    if (successor->start() == bci)
-      return function()->block(successor->pre_order());
-  }
-  ShouldNotReachHere();
-}
-
-void SharkTopLevelBlock::do_zero_check(SharkValue *value) {
-  if (value->is_phi() && value->as_phi()->all_incomers_zero_checked()) {
-    function()->add_deferred_zero_check(this, value);
-  }
-  else {
-    BasicBlock *continue_block = function()->CreateBlock("not_zero");
-    SharkState *saved_state = current_state();
-    set_current_state(saved_state->copy());
-    zero_check_value(value, continue_block);
-    builder()->SetInsertPoint(continue_block);
-    set_current_state(saved_state);
-  }
-
-  value->set_zero_checked(true);
-}
-
-void SharkTopLevelBlock::do_deferred_zero_check(SharkValue* value,
-                                                int         bci,
-                                                SharkState* saved_state,
-                                                BasicBlock* continue_block) {
-  if (value->as_phi()->all_incomers_zero_checked()) {
-    builder()->CreateBr(continue_block);
-  }
-  else {
-    iter()->force_bci(start());
-    set_current_state(saved_state);
-    zero_check_value(value, continue_block);
-  }
-}
-
-void SharkTopLevelBlock::zero_check_value(SharkValue* value,
-                                          BasicBlock* continue_block) {
-  BasicBlock *zero_block = builder()->CreateBlock(continue_block, "zero");
-
-  Value *a, *b;
-  switch (value->basic_type()) {
-  case T_BYTE:
-  case T_CHAR:
-  case T_SHORT:
-  case T_INT:
-    a = value->jint_value();
-    b = LLVMValue::jint_constant(0);
-    break;
-  case T_LONG:
-    a = value->jlong_value();
-    b = LLVMValue::jlong_constant(0);
-    break;
-  case T_OBJECT:
-  case T_ARRAY:
-    a = value->jobject_value();
-    b = LLVMValue::LLVMValue::null();
-    break;
-  default:
-    tty->print_cr("Unhandled type %s", type2name(value->basic_type()));
-    ShouldNotReachHere();
-  }
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpNE(a, b), continue_block, zero_block);
-
-  builder()->SetInsertPoint(zero_block);
-  if (value->is_jobject()) {
-    call_vm(
-      builder()->throw_NullPointerException(),
-      builder()->CreateIntToPtr(
-        LLVMValue::intptr_constant((intptr_t) __FILE__),
-        PointerType::getUnqual(SharkType::jbyte_type())),
-      LLVMValue::jint_constant(__LINE__),
-      EX_CHECK_NONE);
-  }
-  else {
-    call_vm(
-      builder()->throw_ArithmeticException(),
-      builder()->CreateIntToPtr(
-        LLVMValue::intptr_constant((intptr_t) __FILE__),
-        PointerType::getUnqual(SharkType::jbyte_type())),
-      LLVMValue::jint_constant(__LINE__),
-      EX_CHECK_NONE);
-  }
-
-  Value *pending_exception = get_pending_exception();
-  clear_pending_exception();
-  handle_exception(pending_exception, EX_CHECK_FULL);
-}
-
-void SharkTopLevelBlock::check_bounds(SharkValue* array, SharkValue* index) {
-  BasicBlock *out_of_bounds = function()->CreateBlock("out_of_bounds");
-  BasicBlock *in_bounds     = function()->CreateBlock("in_bounds");
-
-  Value *length = builder()->CreateArrayLength(array->jarray_value());
-  // we use an unsigned comparison to catch negative values
-  builder()->CreateCondBr(
-    builder()->CreateICmpULT(index->jint_value(), length),
-    in_bounds, out_of_bounds);
-
-  builder()->SetInsertPoint(out_of_bounds);
-  SharkState *saved_state = current_state()->copy();
-
-  call_vm(
-    builder()->throw_ArrayIndexOutOfBoundsException(),
-    builder()->CreateIntToPtr(
-      LLVMValue::intptr_constant((intptr_t) __FILE__),
-      PointerType::getUnqual(SharkType::jbyte_type())),
-    LLVMValue::jint_constant(__LINE__),
-    index->jint_value(),
-    EX_CHECK_NONE);
-
-  Value *pending_exception = get_pending_exception();
-  clear_pending_exception();
-  handle_exception(pending_exception, EX_CHECK_FULL);
-
-  set_current_state(saved_state);
-
-  builder()->SetInsertPoint(in_bounds);
-}
-
-void SharkTopLevelBlock::check_pending_exception(int action) {
-  assert(action & EAM_CHECK, "should be");
-
-  BasicBlock *exception    = function()->CreateBlock("exception");
-  BasicBlock *no_exception = function()->CreateBlock("no_exception");
-
-  Value *pending_exception = get_pending_exception();
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(pending_exception, LLVMValue::null()),
-    no_exception, exception);
-
-  builder()->SetInsertPoint(exception);
-  SharkState *saved_state = current_state()->copy();
-  if (action & EAM_MONITOR_FUDGE) {
-    // The top monitor is marked live, but the exception was thrown
-    // while setting it up so we need to mark it dead before we enter
-    // any exception handlers as they will not expect it to be there.
-    set_num_monitors(num_monitors() - 1);
-    action ^= EAM_MONITOR_FUDGE;
-  }
-  clear_pending_exception();
-  handle_exception(pending_exception, action);
-  set_current_state(saved_state);
-
-  builder()->SetInsertPoint(no_exception);
-}
-
-void SharkTopLevelBlock::compute_exceptions() {
-  ciExceptionHandlerStream str(target(), start());
-
-  int exc_count = str.count();
-  _exc_handlers = new GrowableArray<ciExceptionHandler*>(exc_count);
-  _exceptions   = new GrowableArray<SharkTopLevelBlock*>(exc_count);
-
-  int index = 0;
-  for (; !str.is_done(); str.next()) {
-    ciExceptionHandler *handler = str.handler();
-    if (handler->handler_bci() == -1)
-      break;
-    _exc_handlers->append(handler);
-
-    // Try and get this exception's handler from typeflow.  We should
-    // do it this way always, really, except that typeflow sometimes
-    // doesn't record exceptions, even loaded ones, and sometimes it
-    // returns them with a different handler bci.  Why???
-    SharkTopLevelBlock *block = NULL;
-    ciInstanceKlass* klass;
-    if (handler->is_catch_all()) {
-      klass = java_lang_Throwable_klass();
-    }
-    else {
-      klass = handler->catch_klass();
-    }
-    for (int i = 0; i < ciblock()->exceptions()->length(); i++) {
-      if (klass == ciblock()->exc_klasses()->at(i)) {
-        block = function()->block(ciblock()->exceptions()->at(i)->pre_order());
-        if (block->start() == handler->handler_bci())
-          break;
-        else
-          block = NULL;
-      }
-    }
-
-    // If typeflow let us down then try and figure it out ourselves
-    if (block == NULL) {
-      for (int i = 0; i < function()->block_count(); i++) {
-        SharkTopLevelBlock *candidate = function()->block(i);
-        if (candidate->start() == handler->handler_bci()) {
-          if (block != NULL) {
-            NOT_PRODUCT(warning("there may be trouble ahead"));
-            block = NULL;
-            break;
-          }
-          block = candidate;
-        }
-      }
-    }
-    _exceptions->append(block);
-  }
-}
-
-void SharkTopLevelBlock::handle_exception(Value* exception, int action) {
-  if (action & EAM_HANDLE && num_exceptions() != 0) {
-    // Clear the stack and push the exception onto it
-    while (xstack_depth())
-      pop();
-    push(SharkValue::create_jobject(exception, true));
-
-    // Work out how many options we have to check
-    bool has_catch_all = exc_handler(num_exceptions() - 1)->is_catch_all();
-    int num_options = num_exceptions();
-    if (has_catch_all)
-      num_options--;
-
-    // Marshal any non-catch-all handlers
-    if (num_options > 0) {
-      bool all_loaded = true;
-      for (int i = 0; i < num_options; i++) {
-        if (!exc_handler(i)->catch_klass()->is_loaded()) {
-          all_loaded = false;
-          break;
-        }
-      }
-
-      if (all_loaded)
-        marshal_exception_fast(num_options);
-      else
-        marshal_exception_slow(num_options);
-    }
-
-    // Install the catch-all handler, if present
-    if (has_catch_all) {
-      builder()->CreateBr(handler_for_exception(num_options));
-      return;
-    }
-  }
-
-  // No exception handler was found; unwind and return
-  handle_return(T_VOID, exception);
-}
-
-void SharkTopLevelBlock::marshal_exception_fast(int num_options) {
-  Value *exception_klass = builder()->CreateValueOfStructEntry(
-    xstack(0)->jobject_value(),
-    in_ByteSize(oopDesc::klass_offset_in_bytes()),
-    SharkType::oop_type(),
-    "exception_klass");
-
-  for (int i = 0; i < num_options; i++) {
-    Value *check_klass =
-      builder()->CreateInlineOop(exc_handler(i)->catch_klass());
-
-    BasicBlock *not_exact   = function()->CreateBlock("not_exact");
-    BasicBlock *not_subtype = function()->CreateBlock("not_subtype");
-
-    builder()->CreateCondBr(
-      builder()->CreateICmpEQ(check_klass, exception_klass),
-      handler_for_exception(i), not_exact);
-
-    builder()->SetInsertPoint(not_exact);
-    builder()->CreateCondBr(
-      builder()->CreateICmpNE(
-        builder()->CreateCall2(
-          builder()->is_subtype_of(), check_klass, exception_klass),
-        LLVMValue::jbyte_constant(0)),
-      handler_for_exception(i), not_subtype);
-
-    builder()->SetInsertPoint(not_subtype);
-  }
-}
-
-void SharkTopLevelBlock::marshal_exception_slow(int num_options) {
-  int *indexes = NEW_RESOURCE_ARRAY(int, num_options);
-  for (int i = 0; i < num_options; i++)
-    indexes[i] = exc_handler(i)->catch_klass_index();
-
-  Value *index = call_vm(
-    builder()->find_exception_handler(),
-    builder()->CreateInlineData(
-      indexes,
-      num_options * sizeof(int),
-      PointerType::getUnqual(SharkType::jint_type())),
-    LLVMValue::jint_constant(num_options),
-    EX_CHECK_NO_CATCH);
-
-  BasicBlock *no_handler = function()->CreateBlock("no_handler");
-  SwitchInst *switchinst = builder()->CreateSwitch(
-    index, no_handler, num_options);
-
-  for (int i = 0; i < num_options; i++) {
-    switchinst->addCase(
-      LLVMValue::jint_constant(i),
-      handler_for_exception(i));
-  }
-
-  builder()->SetInsertPoint(no_handler);
-}
-
-BasicBlock* SharkTopLevelBlock::handler_for_exception(int index) {
-  SharkTopLevelBlock *successor = this->exception(index);
-  if (successor) {
-    successor->add_incoming(current_state());
-    return successor->entry_block();
-  }
-  else {
-    return make_trap(
-      exc_handler(index)->handler_bci(),
-      Deoptimization::make_trap_request(
-        Deoptimization::Reason_unhandled,
-        Deoptimization::Action_reinterpret));
-  }
-}
-
-void SharkTopLevelBlock::maybe_add_safepoint() {
-  if (current_state()->has_safepointed())
-    return;
-
-  BasicBlock *orig_block = builder()->GetInsertBlock();
-  SharkState *orig_state = current_state()->copy();
-
-  BasicBlock *do_safepoint = function()->CreateBlock("do_safepoint");
-  BasicBlock *safepointed  = function()->CreateBlock("safepointed");
-
-  Value *state = builder()->CreateLoad(
-    builder()->CreateIntToPtr(
-      LLVMValue::intptr_constant(
-        (intptr_t) SafepointSynchronize::address_of_state()),
-      PointerType::getUnqual(SharkType::jint_type())),
-    "state");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(
-      state,
-      LLVMValue::jint_constant(SafepointSynchronize::_synchronizing)),
-    do_safepoint, safepointed);
-
-  builder()->SetInsertPoint(do_safepoint);
-  call_vm(builder()->safepoint(), EX_CHECK_FULL);
-  BasicBlock *safepointed_block = builder()->GetInsertBlock();
-  builder()->CreateBr(safepointed);
-
-  builder()->SetInsertPoint(safepointed);
-  current_state()->merge(orig_state, orig_block, safepointed_block);
-
-  current_state()->set_has_safepointed(true);
-}
-
-void SharkTopLevelBlock::maybe_add_backedge_safepoint() {
-  if (current_state()->has_safepointed())
-    return;
-
-  for (int i = 0; i < num_successors(); i++) {
-    if (successor(i)->can_reach(this)) {
-      maybe_add_safepoint();
-      break;
-    }
-  }
-}
-
-bool SharkTopLevelBlock::can_reach(SharkTopLevelBlock* other) {
-  for (int i = 0; i < function()->block_count(); i++)
-    function()->block(i)->_can_reach_visited = false;
-
-  return can_reach_helper(other);
-}
-
-bool SharkTopLevelBlock::can_reach_helper(SharkTopLevelBlock* other) {
-  if (this == other)
-    return true;
-
-  if (_can_reach_visited)
-    return false;
-  _can_reach_visited = true;
-
-  if (!has_trap()) {
-    for (int i = 0; i < num_successors(); i++) {
-      if (successor(i)->can_reach_helper(other))
-        return true;
-    }
-  }
-
-  for (int i = 0; i < num_exceptions(); i++) {
-    SharkTopLevelBlock *handler = exception(i);
-    if (handler && handler->can_reach_helper(other))
-      return true;
-  }
-
-  return false;
-}
-
-BasicBlock* SharkTopLevelBlock::make_trap(int trap_bci, int trap_request) {
-  BasicBlock *trap_block = function()->CreateBlock("trap");
-  BasicBlock *orig_block = builder()->GetInsertBlock();
-  builder()->SetInsertPoint(trap_block);
-
-  int orig_bci = bci();
-  iter()->force_bci(trap_bci);
-
-  do_trap(trap_request);
-
-  builder()->SetInsertPoint(orig_block);
-  iter()->force_bci(orig_bci);
-
-  return trap_block;
-}
-
-void SharkTopLevelBlock::do_trap(int trap_request) {
-  decache_for_trap();
-  builder()->CreateRet(
-    builder()->CreateCall2(
-      builder()->uncommon_trap(),
-      thread(),
-      LLVMValue::jint_constant(trap_request)));
-}
-
-void SharkTopLevelBlock::call_register_finalizer(Value *receiver) {
-  BasicBlock *orig_block = builder()->GetInsertBlock();
-  SharkState *orig_state = current_state()->copy();
-
-  BasicBlock *do_call = function()->CreateBlock("has_finalizer");
-  BasicBlock *done    = function()->CreateBlock("done");
-
-  Value *klass = builder()->CreateValueOfStructEntry(
-    receiver,
-    in_ByteSize(oopDesc::klass_offset_in_bytes()),
-    SharkType::oop_type(),
-    "klass");
-
-  Value *klass_part = builder()->CreateAddressOfStructEntry(
-    klass,
-    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
-    SharkType::klass_type(),
-    "klass_part");
-
-  Value *access_flags = builder()->CreateValueOfStructEntry(
-    klass_part,
-    in_ByteSize(Klass::access_flags_offset_in_bytes()),
-    SharkType::jint_type(),
-    "access_flags");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpNE(
-      builder()->CreateAnd(
-        access_flags,
-        LLVMValue::jint_constant(JVM_ACC_HAS_FINALIZER)),
-      LLVMValue::jint_constant(0)),
-    do_call, done);
-
-  builder()->SetInsertPoint(do_call);
-  call_vm(builder()->register_finalizer(), receiver, EX_CHECK_FULL);
-  BasicBlock *branch_block = builder()->GetInsertBlock();
-  builder()->CreateBr(done);
-
-  builder()->SetInsertPoint(done);
-  current_state()->merge(orig_state, orig_block, branch_block);
-}
-
-void SharkTopLevelBlock::handle_return(BasicType type, Value* exception) {
-  assert (exception == NULL || type == T_VOID, "exception OR result, please");
-
-  if (num_monitors()) {
-    // Protect our exception across possible monitor release decaches
-    if (exception)
-      set_oop_tmp(exception);
-
-    // We don't need to check for exceptions thrown here.  If
-    // we're returning a value then we just carry on as normal:
-    // the caller will see the pending exception and handle it.
-    // If we're returning with an exception then that exception
-    // takes priority and the release_lock one will be ignored.
-    while (num_monitors())
-      release_lock(EX_CHECK_NONE);
-
-    // Reload the exception we're throwing
-    if (exception)
-      exception = get_oop_tmp();
-  }
-
-  if (exception) {
-    builder()->CreateStore(exception, pending_exception_address());
-  }
-
-  Value *result_addr = stack()->CreatePopFrame(type2size[type]);
-  if (type != T_VOID) {
-    builder()->CreateStore(
-      pop_result(type)->generic_value(),
-      builder()->CreateIntToPtr(
-        result_addr,
-        PointerType::getUnqual(SharkType::to_stackType(type))));
-  }
-
-  builder()->CreateRet(LLVMValue::jint_constant(0));
-}
-
-void SharkTopLevelBlock::do_arraylength() {
-  SharkValue *array = pop();
-  check_null(array);
-  Value *length = builder()->CreateArrayLength(array->jarray_value());
-  push(SharkValue::create_jint(length, false));
-}
-
-void SharkTopLevelBlock::do_aload(BasicType basic_type) {
-  SharkValue *index = pop();
-  SharkValue *array = pop();
-
-  check_null(array);
-  check_bounds(array, index);
-
-  Value *value = builder()->CreateLoad(
-    builder()->CreateArrayAddress(
-      array->jarray_value(), basic_type, index->jint_value()));
-
-  const Type *stack_type = SharkType::to_stackType(basic_type);
-  if (value->getType() != stack_type)
-    value = builder()->CreateIntCast(value, stack_type, basic_type != T_CHAR);
-
-  switch (basic_type) {
-  case T_BYTE:
-  case T_CHAR:
-  case T_SHORT:
-  case T_INT:
-    push(SharkValue::create_jint(value, false));
-    break;
-
-  case T_LONG:
-    push(SharkValue::create_jlong(value, false));
-    break;
-
-  case T_FLOAT:
-    push(SharkValue::create_jfloat(value));
-    break;
-
-  case T_DOUBLE:
-    push(SharkValue::create_jdouble(value));
-    break;
-
-  case T_OBJECT:
-    // You might expect that array->type()->is_array_klass() would
-    // always be true, but it isn't.  If ciTypeFlow detects that a
-    // value is always null then that value becomes an untyped null
-    // object.  Shark doesn't presently support this, so a generic
-    // T_OBJECT is created.  In this case we guess the type using
-    // the BasicType we were supplied.  In reality the generated
-    // code will never be used, as the null value will be caught
-    // by the above null pointer check.
-    // http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=324
-    push(
-      SharkValue::create_generic(
-        array->type()->is_array_klass() ?
-          ((ciArrayKlass *) array->type())->element_type() :
-          ciType::make(basic_type),
-        value, false));
-    break;
-
-  default:
-    tty->print_cr("Unhandled type %s", type2name(basic_type));
-    ShouldNotReachHere();
-  }
-}
-
-void SharkTopLevelBlock::do_astore(BasicType basic_type) {
-  SharkValue *svalue = pop();
-  SharkValue *index  = pop();
-  SharkValue *array  = pop();
-
-  check_null(array);
-  check_bounds(array, index);
-
-  Value *value;
-  switch (basic_type) {
-  case T_BYTE:
-  case T_CHAR:
-  case T_SHORT:
-  case T_INT:
-    value = svalue->jint_value();
-    break;
-
-  case T_LONG:
-    value = svalue->jlong_value();
-    break;
-
-  case T_FLOAT:
-    value = svalue->jfloat_value();
-    break;
-
-  case T_DOUBLE:
-    value = svalue->jdouble_value();
-    break;
-
-  case T_OBJECT:
-    value = svalue->jobject_value();
-    // XXX assignability check
-    break;
-
-  default:
-    tty->print_cr("Unhandled type %s", type2name(basic_type));
-    ShouldNotReachHere();
-  }
-
-  const Type *array_type = SharkType::to_arrayType(basic_type);
-  if (value->getType() != array_type)
-    value = builder()->CreateIntCast(value, array_type, basic_type != T_CHAR);
-
-  Value *addr = builder()->CreateArrayAddress(
-    array->jarray_value(), basic_type, index->jint_value(), "addr");
-
-  builder()->CreateStore(value, addr);
-
-  if (basic_type == T_OBJECT) // XXX or T_ARRAY?
-    builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr);
-}
-
-void SharkTopLevelBlock::do_return(BasicType type) {
-  if (target()->intrinsic_id() == vmIntrinsics::_Object_init)
-    call_register_finalizer(local(0)->jobject_value());
-  maybe_add_safepoint();
-  handle_return(type, NULL);
-}
-
-void SharkTopLevelBlock::do_athrow() {
-  SharkValue *exception = pop();
-  check_null(exception);
-  handle_exception(exception->jobject_value(), EX_CHECK_FULL);
-}
-
-void SharkTopLevelBlock::do_goto() {
-  do_branch(ciTypeFlow::GOTO_TARGET);
-}
-
-void SharkTopLevelBlock::do_jsr() {
-  push(SharkValue::address_constant(iter()->next_bci()));
-  do_branch(ciTypeFlow::GOTO_TARGET);
-}
-
-void SharkTopLevelBlock::do_ret() {
-  assert(local(iter()->get_index())->address_value() ==
-         successor(ciTypeFlow::GOTO_TARGET)->start(), "should be");
-  do_branch(ciTypeFlow::GOTO_TARGET);
-}
-
-// All propagation of state from one block to the next (via
-// dest->add_incoming) is handled by these methods:
-//   do_branch
-//   do_if_helper
-//   do_switch
-//   handle_exception
-
-void SharkTopLevelBlock::do_branch(int successor_index) {
-  SharkTopLevelBlock *dest = successor(successor_index);
-  builder()->CreateBr(dest->entry_block());
-  dest->add_incoming(current_state());
-}
-
-void SharkTopLevelBlock::do_if(ICmpInst::Predicate p,
-                               SharkValue*         b,
-                               SharkValue*         a) {
-  Value *llvm_a, *llvm_b;
-  if (a->is_jobject()) {
-    llvm_a = a->intptr_value(builder());
-    llvm_b = b->intptr_value(builder());
-  }
-  else {
-    llvm_a = a->jint_value();
-    llvm_b = b->jint_value();
-  }
-  do_if_helper(p, llvm_b, llvm_a, current_state(), current_state());
-}
-
-void SharkTopLevelBlock::do_if_helper(ICmpInst::Predicate p,
-                                      Value*              b,
-                                      Value*              a,
-                                      SharkState*         if_taken_state,
-                                      SharkState*         not_taken_state) {
-  SharkTopLevelBlock *if_taken  = successor(ciTypeFlow::IF_TAKEN);
-  SharkTopLevelBlock *not_taken = successor(ciTypeFlow::IF_NOT_TAKEN);
-
-  builder()->CreateCondBr(
-    builder()->CreateICmp(p, a, b),
-    if_taken->entry_block(), not_taken->entry_block());
-
-  if_taken->add_incoming(if_taken_state);
-  not_taken->add_incoming(not_taken_state);
-}
-
-void SharkTopLevelBlock::do_switch() {
-  int len = switch_table_length();
-
-  SharkTopLevelBlock *dest_block = successor(ciTypeFlow::SWITCH_DEFAULT);
-  SwitchInst *switchinst = builder()->CreateSwitch(
-    pop()->jint_value(), dest_block->entry_block(), len);
-  dest_block->add_incoming(current_state());
-
-  for (int i = 0; i < len; i++) {
-    int dest_bci = switch_dest(i);
-    if (dest_bci != switch_default_dest()) {
-      dest_block = bci_successor(dest_bci);
-      switchinst->addCase(
-        LLVMValue::jint_constant(switch_key(i)),
-        dest_block->entry_block());
-      dest_block->add_incoming(current_state());
-    }
-  }
-}
-
-ciMethod* SharkTopLevelBlock::improve_virtual_call(ciMethod*   caller,
-                                              ciInstanceKlass* klass,
-                                              ciMethod*        dest_method,
-                                              ciType*          receiver_type) {
-  // If the method is obviously final then we are already done
-  if (dest_method->can_be_statically_bound())
-    return dest_method;
-
-  // Array methods are all inherited from Object and are monomorphic
-  if (receiver_type->is_array_klass() &&
-      dest_method->holder() == java_lang_Object_klass())
-    return dest_method;
-
-#ifdef SHARK_CAN_DEOPTIMIZE_ANYWHERE
-  // This code can replace a virtual call with a direct call if this
-  // class is the only one in the entire set of loaded classes that
-  // implements this method.  This makes the compiled code dependent
-  // on other classes that implement the method not being loaded, a
-  // condition which is enforced by the dependency tracker.  If the
-  // dependency tracker determines a method has become invalid it
-  // will mark it for recompilation, causing running copies to be
-  // deoptimized.  Shark currently can't deoptimize arbitrarily like
-  // that, so this optimization cannot be used.
-  // http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=481
-  
-  // All other interesting cases are instance classes
-  if (!receiver_type->is_instance_klass())
-    return NULL;
-
-  // Attempt to improve the receiver
-  ciInstanceKlass* actual_receiver = klass;
-  ciInstanceKlass *improved_receiver = receiver_type->as_instance_klass();
-  if (improved_receiver->is_loaded() &&
-      improved_receiver->is_initialized() &&
-      !improved_receiver->is_interface() &&
-      improved_receiver->is_subtype_of(actual_receiver)) {
-    actual_receiver = improved_receiver;
-  }
-
-  // Attempt to find a monomorphic target for this call using
-  // class heirachy analysis.
-  ciInstanceKlass *calling_klass = caller->holder();
-  ciMethod* monomorphic_target =
-    dest_method->find_monomorphic_target(calling_klass, klass, actual_receiver);
-  if (monomorphic_target != NULL) {
-    assert(!monomorphic_target->is_abstract(), "shouldn't be");
-
-    // Opto has a bunch of type checking here that I don't
-    // understand.  It's to inhibit casting in one direction,
-    // possibly because objects in Opto can have inexact
-    // types, but I can't even tell which direction it
-    // doesn't like.  For now I'm going to block *any* cast.
-    if (monomorphic_target != dest_method) {
-      if (SharkPerformanceWarnings) {
-        warning("found monomorphic target, but inhibited cast:");
-        tty->print("  dest_method = ");
-        dest_method->print_short_name(tty);
-        tty->cr();
-        tty->print("  monomorphic_target = ");
-        monomorphic_target->print_short_name(tty);
-        tty->cr();
-      }
-      monomorphic_target = NULL;
-    }
-  }
-
-  // Replace the virtual call with a direct one.  This makes
-  // us dependent on that target method not getting overridden
-  // by dynamic class loading.
-  if (monomorphic_target != NULL) {
-    dependencies()->assert_unique_concrete_method(
-      actual_receiver, monomorphic_target);
-    return monomorphic_target;
-  }
-
-  // Because Opto distinguishes exact types from inexact ones
-  // it can perform a further optimization to replace calls
-  // with non-monomorphic targets if the receiver has an exact
-  // type.  We don't mark types this way, so we can't do this.
-
-#endif // SHARK_CAN_DEOPTIMIZE_ANYWHERE
-
-  return NULL;
-}
-
-Value *SharkTopLevelBlock::get_direct_callee(ciMethod* method) {
-  return builder()->CreateBitCast(
-    builder()->CreateInlineOop(method),
-    SharkType::methodOop_type(),
-    "callee");
-}
-
-Value *SharkTopLevelBlock::get_virtual_callee(SharkValue* receiver,
-                                              int vtable_index) {
-  Value *klass = builder()->CreateValueOfStructEntry(
-    receiver->jobject_value(),
-    in_ByteSize(oopDesc::klass_offset_in_bytes()),
-    SharkType::oop_type(),
-    "klass");
-
-  return builder()->CreateLoad(
-    builder()->CreateArrayAddress(
-      klass,
-      SharkType::methodOop_type(),
-      vtableEntry::size() * wordSize,
-      in_ByteSize(instanceKlass::vtable_start_offset() * wordSize),
-      LLVMValue::intptr_constant(vtable_index)),
-    "callee");
-}
-
-Value* SharkTopLevelBlock::get_interface_callee(SharkValue *receiver,
-                                                ciMethod*   method) {
-  BasicBlock *loop       = function()->CreateBlock("loop");
-  BasicBlock *got_null   = function()->CreateBlock("got_null");
-  BasicBlock *not_null   = function()->CreateBlock("not_null");
-  BasicBlock *next       = function()->CreateBlock("next");
-  BasicBlock *got_entry  = function()->CreateBlock("got_entry");
-
-  // Locate the receiver's itable
-  Value *object_klass = builder()->CreateValueOfStructEntry(
-    receiver->jobject_value(), in_ByteSize(oopDesc::klass_offset_in_bytes()),
-    SharkType::oop_type(),
-    "object_klass");
-
-  Value *vtable_start = builder()->CreateAdd(
-    builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()),
-    LLVMValue::intptr_constant(
-      instanceKlass::vtable_start_offset() * HeapWordSize),
-    "vtable_start");
-
-  Value *vtable_length = builder()->CreateValueOfStructEntry(
-    object_klass,
-    in_ByteSize(instanceKlass::vtable_length_offset() * HeapWordSize),
-    SharkType::jint_type(),
-    "vtable_length");
-  vtable_length =
-    builder()->CreateIntCast(vtable_length, SharkType::intptr_type(), false);
-
-  bool needs_aligning = HeapWordsPerLong > 1;
-  Value *itable_start = builder()->CreateAdd(
-    vtable_start,
-    builder()->CreateShl(
-      vtable_length,
-      LLVMValue::intptr_constant(exact_log2(vtableEntry::size() * wordSize))),
-    needs_aligning ? "" : "itable_start");
-  if (needs_aligning) {
-    itable_start = builder()->CreateAnd(
-      builder()->CreateAdd(
-        itable_start, LLVMValue::intptr_constant(BytesPerLong - 1)),
-      LLVMValue::intptr_constant(~(BytesPerLong - 1)),
-      "itable_start");
-  }
-
-  // Locate this interface's entry in the table
-  Value *iklass = builder()->CreateInlineOop(method->holder());
-  BasicBlock *loop_entry = builder()->GetInsertBlock();
-  builder()->CreateBr(loop);
-  builder()->SetInsertPoint(loop);
-  PHINode *itable_entry_addr = builder()->CreatePHI(
-    SharkType::intptr_type(), "itable_entry_addr");
-  itable_entry_addr->addIncoming(itable_start, loop_entry);
-
-  Value *itable_entry = builder()->CreateIntToPtr(
-    itable_entry_addr, SharkType::itableOffsetEntry_type(), "itable_entry");
-
-  Value *itable_iklass = builder()->CreateValueOfStructEntry(
-    itable_entry,
-    in_ByteSize(itableOffsetEntry::interface_offset_in_bytes()),
-    SharkType::oop_type(),
-    "itable_iklass");
-
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(itable_iklass, LLVMValue::null()),
-    got_null, not_null);
-
-  // A null entry means that the class doesn't implement the
-  // interface, and wasn't the same as the class checked when
-  // the interface was resolved.
-  builder()->SetInsertPoint(got_null);
-  builder()->CreateUnimplemented(__FILE__, __LINE__);
-  builder()->CreateUnreachable();
-
-  builder()->SetInsertPoint(not_null);
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(itable_iklass, iklass),
-    got_entry, next);
-
-  builder()->SetInsertPoint(next);
-  Value *next_entry = builder()->CreateAdd(
-    itable_entry_addr,
-    LLVMValue::intptr_constant(itableOffsetEntry::size() * wordSize));
-  builder()->CreateBr(loop);
-  itable_entry_addr->addIncoming(next_entry, next);
-
-  // Locate the method pointer
-  builder()->SetInsertPoint(got_entry);
-  Value *offset = builder()->CreateValueOfStructEntry(
-    itable_entry,
-    in_ByteSize(itableOffsetEntry::offset_offset_in_bytes()),
-    SharkType::jint_type(),
-    "offset");
-  offset =
-    builder()->CreateIntCast(offset, SharkType::intptr_type(), false);
-
-  return builder()->CreateLoad(
-    builder()->CreateIntToPtr(
-      builder()->CreateAdd(
-        builder()->CreateAdd(
-          builder()->CreateAdd(
-            builder()->CreatePtrToInt(
-              object_klass, SharkType::intptr_type()),
-            offset),
-          LLVMValue::intptr_constant(
-            method->itable_index() * itableMethodEntry::size() * wordSize)),
-        LLVMValue::intptr_constant(
-          itableMethodEntry::method_offset_in_bytes())),
-      PointerType::getUnqual(SharkType::methodOop_type())),
-    "callee");
-}
-
-void SharkTopLevelBlock::do_call() {
-  // Set frequently used booleans
-  bool is_static = bc() == Bytecodes::_invokestatic;
-  bool is_virtual = bc() == Bytecodes::_invokevirtual;
-  bool is_interface = bc() == Bytecodes::_invokeinterface;
-
-  // Find the method being called
-  bool will_link;
-  ciMethod *dest_method = iter()->get_method(will_link);
-  assert(will_link, "typeflow responsibility");
-  assert(dest_method->is_static() == is_static, "must match bc");
-
-  // Find the class of the method being called.  Note
-  // that the superclass check in the second assertion
-  // is to cope with a hole in the spec that allows for
-  // invokeinterface instructions where the resolved
-  // method is a virtual method in java.lang.Object.
-  // javac doesn't generate code like that, but there's
-  // no reason a compliant Java compiler might not.
-  ciInstanceKlass *holder_klass  = dest_method->holder();
-  assert(holder_klass->is_loaded(), "scan_for_traps responsibility");
-  assert(holder_klass->is_interface() ||
-         holder_klass->super() == NULL ||
-         !is_interface, "must match bc");
-  ciKlass *holder = iter()->get_declared_method_holder();
-  ciInstanceKlass *klass =
-    ciEnv::get_instance_klass_for_declared_method_holder(holder);
-
-  // Find the receiver in the stack.  We do this before
-  // trying to inline because the inliner can only use
-  // zero-checked values, not being able to perform the
-  // check itself.
-  SharkValue *receiver = NULL;
-  if (!is_static) {
-    receiver = xstack(dest_method->arg_size() - 1);
-    check_null(receiver);
-  }
-
-  // Try to improve non-direct calls
-  bool call_is_virtual = is_virtual || is_interface;
-  ciMethod *call_method = dest_method;
-  if (call_is_virtual) {
-    ciMethod *optimized_method = improve_virtual_call(
-      target(), klass, dest_method, receiver->type());
-    if (optimized_method) {
-      call_method = optimized_method;
-      call_is_virtual = false;
-    }
-  }
-
-  // Try to inline the call
-  if (!call_is_virtual) {
-    if (SharkInliner::attempt_inline(call_method, current_state()))
-      return;
-  }
-
-  // Find the method we are calling
-  Value *callee;
-  if (call_is_virtual) {
-    if (is_virtual) {
-      assert(klass->is_linked(), "scan_for_traps responsibility");
-      int vtable_index = call_method->resolve_vtable_index(
-        target()->holder(), klass);
-      assert(vtable_index >= 0, "should be");
-      callee = get_virtual_callee(receiver, vtable_index);
-    }
-    else {
-      assert(is_interface, "should be");
-      callee = get_interface_callee(receiver, call_method);
-    }
-  }
-  else {
-    callee = get_direct_callee(call_method);
-  }
-
-  // Load the SharkEntry from the callee
-  Value *base_pc = builder()->CreateValueOfStructEntry(
-    callee, methodOopDesc::from_interpreted_offset(),
-    SharkType::intptr_type(),
-    "base_pc");
-
-  // Load the entry point from the SharkEntry
-  Value *entry_point = builder()->CreateLoad(
-    builder()->CreateIntToPtr(
-      builder()->CreateAdd(
-        base_pc,
-        LLVMValue::intptr_constant(in_bytes(ZeroEntry::entry_point_offset()))),
-      PointerType::getUnqual(
-        PointerType::getUnqual(SharkType::entry_point_type()))),
-    "entry_point");
-
-  // Make the call
-  decache_for_Java_call(call_method);
-  Value *deoptimized_frames = builder()->CreateCall3(
-    entry_point, callee, base_pc, thread());
-
-  // If the callee got deoptimized then reexecute in the interpreter
-  BasicBlock *reexecute      = function()->CreateBlock("reexecute");
-  BasicBlock *call_completed = function()->CreateBlock("call_completed");
-  builder()->CreateCondBr(
-    builder()->CreateICmpNE(deoptimized_frames, LLVMValue::jint_constant(0)),
-    reexecute, call_completed);
-
-  builder()->SetInsertPoint(reexecute);
-  builder()->CreateCall2(
-    builder()->deoptimized_entry_point(),
-    builder()->CreateSub(deoptimized_frames, LLVMValue::jint_constant(1)),
-    thread());
-  builder()->CreateBr(call_completed);
-
-  // Cache after the call
-  builder()->SetInsertPoint(call_completed);
-  cache_after_Java_call(call_method);
-
-  // Check for pending exceptions
-  check_pending_exception(EX_CHECK_FULL);
-
-  // Mark that a safepoint check has occurred
-  current_state()->set_has_safepointed(true);
-}
-
-bool SharkTopLevelBlock::static_subtype_check(ciKlass* check_klass,
-                                              ciKlass* object_klass) {
-  // If the class we're checking against is java.lang.Object
-  // then this is a no brainer.  Apparently this can happen
-  // in reflective code...
-  if (check_klass == java_lang_Object_klass())
-    return true;
-
-  // Perform a subtype check.  NB in opto's code for this
-  // (GraphKit::static_subtype_check) it says that static
-  // interface types cannot be trusted, and if opto can't
-  // trust them then I assume we can't either.
-  if (object_klass->is_loaded() && !object_klass->is_interface()) {
-    if (object_klass == check_klass)
-      return true;
-
-    if (check_klass->is_loaded() && object_klass->is_subtype_of(check_klass))
-      return true;
-  }
-
-  return false;
-}
-
-void SharkTopLevelBlock::do_instance_check() {
-  // Get the class we're checking against
-  bool will_link;
-  ciKlass *check_klass = iter()->get_klass(will_link);
-
-  // Get the class of the object we're checking
-  ciKlass *object_klass = xstack(0)->type()->as_klass();
-
-  // Can we optimize this check away?
-  if (static_subtype_check(check_klass, object_klass)) {
-    if (bc() == Bytecodes::_instanceof) {
-      pop();
-      push(SharkValue::jint_constant(1));
-    }
-    return;
-  }
-
-  // Need to check this one at runtime
-  if (will_link)
-    do_full_instance_check(check_klass);
-  else
-    do_trapping_instance_check(check_klass);
-}
-
-bool SharkTopLevelBlock::maybe_do_instanceof_if() {
-  // Get the class we're checking against
-  bool will_link;
-  ciKlass *check_klass = iter()->get_klass(will_link);
-
-  // If the class is unloaded then the instanceof
-  // cannot possibly succeed.
-  if (!will_link)
-    return false;
-
-  // Keep a copy of the object we're checking
-  SharkValue *old_object = xstack(0);
-
-  // Get the class of the object we're checking
-  ciKlass *object_klass = old_object->type()->as_klass();
-
-  // If the instanceof can be optimized away at compile time
-  // then any subsequent checkcasts will be too so we handle
-  // it normally.
-  if (static_subtype_check(check_klass, object_klass))
-    return false;
-
-  // Perform the instance check
-  do_full_instance_check(check_klass);
-  Value *result = pop()->jint_value();
-
-  // Create the casted object
-  SharkValue *new_object = SharkValue::create_generic(
-    check_klass, old_object->jobject_value(), old_object->zero_checked());
-
-  // Create two copies of the current state, one with the
-  // original object and one with all instances of the
-  // original object replaced with the new, casted object.
-  SharkState *new_state = current_state();
-  SharkState *old_state = new_state->copy();
-  new_state->replace_all(old_object, new_object);
-
-  // Perform the check-and-branch
-  switch (iter()->next_bc()) {
-  case Bytecodes::_ifeq:
-    // branch if not an instance
-    do_if_helper(
-      ICmpInst::ICMP_EQ,
-      LLVMValue::jint_constant(0), result,
-      old_state, new_state);
-    break;
-
-  case Bytecodes::_ifne:
-    // branch if an instance
-    do_if_helper(
-      ICmpInst::ICMP_NE,
-      LLVMValue::jint_constant(0), result,
-      new_state, old_state);
-    break;
-
-  default:
-    ShouldNotReachHere();
-  }
-
-  return true;
-}
-
-void SharkTopLevelBlock::do_full_instance_check(ciKlass* klass) {
-  BasicBlock *not_null      = function()->CreateBlock("not_null");
-  BasicBlock *subtype_check = function()->CreateBlock("subtype_check");
-  BasicBlock *is_instance   = function()->CreateBlock("is_instance");
-  BasicBlock *not_instance  = function()->CreateBlock("not_instance");
-  BasicBlock *merge1        = function()->CreateBlock("merge1");
-  BasicBlock *merge2        = function()->CreateBlock("merge2");
-
-  enum InstanceCheckStates {
-    IC_IS_NULL,
-    IC_IS_INSTANCE,
-    IC_NOT_INSTANCE,
-  };
-
-  // Pop the object off the stack
-  Value *object = pop()->jobject_value();
-
-  // Null objects aren't instances of anything
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(object, LLVMValue::null()),
-    merge2, not_null);
-  BasicBlock *null_block = builder()->GetInsertBlock();
-
-  // Get the class we're checking against
-  builder()->SetInsertPoint(not_null);
-  Value *check_klass = builder()->CreateInlineOop(klass);
-
-  // Get the class of the object being tested
-  Value *object_klass = builder()->CreateValueOfStructEntry(
-    object, in_ByteSize(oopDesc::klass_offset_in_bytes()),
-    SharkType::oop_type(),
-    "object_klass");
-
-  // Perform the check
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(check_klass, object_klass),
-    is_instance, subtype_check);
-
-  builder()->SetInsertPoint(subtype_check);
-  builder()->CreateCondBr(
-    builder()->CreateICmpNE(
-      builder()->CreateCall2(
-        builder()->is_subtype_of(), check_klass, object_klass),
-      LLVMValue::jbyte_constant(0)),
-    is_instance, not_instance);
-
-  builder()->SetInsertPoint(is_instance);
-  builder()->CreateBr(merge1);
-
-  builder()->SetInsertPoint(not_instance);
-  builder()->CreateBr(merge1);
-
-  // First merge
-  builder()->SetInsertPoint(merge1);
-  PHINode *nonnull_result = builder()->CreatePHI(
-    SharkType::jint_type(), "nonnull_result");
-  nonnull_result->addIncoming(
-    LLVMValue::jint_constant(IC_IS_INSTANCE), is_instance);
-  nonnull_result->addIncoming(
-    LLVMValue::jint_constant(IC_NOT_INSTANCE), not_instance);
-  BasicBlock *nonnull_block = builder()->GetInsertBlock();
-  builder()->CreateBr(merge2);
-
-  // Second merge
-  builder()->SetInsertPoint(merge2);
-  PHINode *result = builder()->CreatePHI(
-    SharkType::jint_type(), "result");
-  result->addIncoming(LLVMValue::jint_constant(IC_IS_NULL), null_block);
-  result->addIncoming(nonnull_result, nonnull_block);
-
-  // Handle the result
-  if (bc() == Bytecodes::_checkcast) {
-    BasicBlock *failure = function()->CreateBlock("failure");
-    BasicBlock *success = function()->CreateBlock("success");
-
-    builder()->CreateCondBr(
-      builder()->CreateICmpNE(
-        result, LLVMValue::jint_constant(IC_NOT_INSTANCE)),
-      success, failure);
-
-    builder()->SetInsertPoint(failure);
-    SharkState *saved_state = current_state()->copy();
-
-    call_vm(
-      builder()->throw_ClassCastException(),
-      builder()->CreateIntToPtr(
-        LLVMValue::intptr_constant((intptr_t) __FILE__),
-        PointerType::getUnqual(SharkType::jbyte_type())),
-      LLVMValue::jint_constant(__LINE__),
-      EX_CHECK_NONE);
-
-    Value *pending_exception = get_pending_exception();
-    clear_pending_exception();
-    handle_exception(pending_exception, EX_CHECK_FULL);
-
-    set_current_state(saved_state);
-    builder()->SetInsertPoint(success);
-    push(SharkValue::create_generic(klass, object, false));
-  }
-  else {
-    push(
-      SharkValue::create_jint(
-        builder()->CreateIntCast(
-          builder()->CreateICmpEQ(
-            result, LLVMValue::jint_constant(IC_IS_INSTANCE)),
-          SharkType::jint_type(), false), false));
-  }
-}
-
-void SharkTopLevelBlock::do_trapping_instance_check(ciKlass* klass) {
-  BasicBlock *not_null = function()->CreateBlock("not_null");
-  BasicBlock *is_null  = function()->CreateBlock("null");
-
-  // Leave the object on the stack so it's there if we trap
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(xstack(0)->jobject_value(), LLVMValue::null()),
-    is_null, not_null);
-  SharkState *saved_state = current_state()->copy();
-
-  // If it's not null then we need to trap
-  builder()->SetInsertPoint(not_null);
-  set_current_state(saved_state->copy());
-  do_trap(
-    Deoptimization::make_trap_request(
-      Deoptimization::Reason_uninitialized,
-      Deoptimization::Action_reinterpret));
-
-  // If it's null then we're ok
-  builder()->SetInsertPoint(is_null);
-  set_current_state(saved_state);
-  if (bc() == Bytecodes::_checkcast) {
-    push(SharkValue::create_generic(klass, pop()->jobject_value(), false));
-  }
-  else {
-    pop();
-    push(SharkValue::jint_constant(0));
-  }
-}
-
-void SharkTopLevelBlock::do_new() {
-  bool will_link;
-  ciInstanceKlass* klass = iter()->get_klass(will_link)->as_instance_klass();
-  assert(will_link, "typeflow responsibility");
-
-  BasicBlock *got_tlab            = NULL;
-  BasicBlock *heap_alloc          = NULL;
-  BasicBlock *retry               = NULL;
-  BasicBlock *got_heap            = NULL;
-  BasicBlock *initialize          = NULL;
-  BasicBlock *got_fast            = NULL;
-  BasicBlock *slow_alloc_and_init = NULL;
-  BasicBlock *got_slow            = NULL;
-  BasicBlock *push_object         = NULL;
-
-  SharkState *fast_state = NULL;
-
-  Value *tlab_object = NULL;
-  Value *heap_object = NULL;
-  Value *fast_object = NULL;
-  Value *slow_object = NULL;
-  Value *object      = NULL;
-
-  // The fast path
-  if (!Klass::layout_helper_needs_slow_path(klass->layout_helper())) {
-    if (UseTLAB) {
-      got_tlab          = function()->CreateBlock("got_tlab");
-      heap_alloc        = function()->CreateBlock("heap_alloc");
-    }
-    retry               = function()->CreateBlock("retry");
-    got_heap            = function()->CreateBlock("got_heap");
-    initialize          = function()->CreateBlock("initialize");
-    slow_alloc_and_init = function()->CreateBlock("slow_alloc_and_init");
-    push_object         = function()->CreateBlock("push_object");
-
-    size_t size_in_bytes = klass->size_helper() << LogHeapWordSize;
-
-    // Thread local allocation
-    if (UseTLAB) {
-      Value *top_addr = builder()->CreateAddressOfStructEntry(
-        thread(), Thread::tlab_top_offset(),
-        PointerType::getUnqual(SharkType::intptr_type()),
-        "top_addr");
-
-      Value *end = builder()->CreateValueOfStructEntry(
-        thread(), Thread::tlab_end_offset(),
-        SharkType::intptr_type(),
-        "end");
-
-      Value *old_top = builder()->CreateLoad(top_addr, "old_top");
-      Value *new_top = builder()->CreateAdd(
-        old_top, LLVMValue::intptr_constant(size_in_bytes));
-
-      builder()->CreateCondBr(
-        builder()->CreateICmpULE(new_top, end),
-        got_tlab, heap_alloc);
-
-      builder()->SetInsertPoint(got_tlab);
-      tlab_object = builder()->CreateIntToPtr(
-        old_top, SharkType::oop_type(), "tlab_object");
-
-      builder()->CreateStore(new_top, top_addr);
-      builder()->CreateBr(initialize);
-
-      builder()->SetInsertPoint(heap_alloc);
-    }
-
-    // Heap allocation
-    Value *top_addr = builder()->CreateIntToPtr(
-        LLVMValue::intptr_constant((intptr_t) Universe::heap()->top_addr()),
-      PointerType::getUnqual(SharkType::intptr_type()),
-      "top_addr");
-
-    Value *end = builder()->CreateLoad(
-      builder()->CreateIntToPtr(
-        LLVMValue::intptr_constant((intptr_t) Universe::heap()->end_addr()),
-        PointerType::getUnqual(SharkType::intptr_type())),
-      "end");
-
-    builder()->CreateBr(retry);
-    builder()->SetInsertPoint(retry);
-
-    Value *old_top = builder()->CreateLoad(top_addr, "top");
-    Value *new_top = builder()->CreateAdd(
-      old_top, LLVMValue::intptr_constant(size_in_bytes));
-
-    builder()->CreateCondBr(
-      builder()->CreateICmpULE(new_top, end),
-      got_heap, slow_alloc_and_init);
-
-    builder()->SetInsertPoint(got_heap);
-    heap_object = builder()->CreateIntToPtr(
-      old_top, SharkType::oop_type(), "heap_object");
-
-    Value *check = builder()->CreateCmpxchgPtr(new_top, top_addr, old_top);
-    builder()->CreateCondBr(
-      builder()->CreateICmpEQ(old_top, check),
-      initialize, retry);
-
-    // Initialize the object
-    builder()->SetInsertPoint(initialize);
-    if (tlab_object) {
-      PHINode *phi = builder()->CreatePHI(
-        SharkType::oop_type(), "fast_object");
-      phi->addIncoming(tlab_object, got_tlab);
-      phi->addIncoming(heap_object, got_heap);
-      fast_object = phi;
-    }
-    else {
-      fast_object = heap_object;
-    }
-
-    builder()->CreateMemset(
-      builder()->CreateBitCast(
-        fast_object, PointerType::getUnqual(SharkType::jbyte_type())),
-      LLVMValue::jbyte_constant(0),
-      LLVMValue::jint_constant(size_in_bytes),
-      LLVMValue::jint_constant(HeapWordSize));
-
-    Value *mark_addr = builder()->CreateAddressOfStructEntry(
-      fast_object, in_ByteSize(oopDesc::mark_offset_in_bytes()),
-      PointerType::getUnqual(SharkType::intptr_type()),
-      "mark_addr");
-
-    Value *klass_addr = builder()->CreateAddressOfStructEntry(
-      fast_object, in_ByteSize(oopDesc::klass_offset_in_bytes()),
-      PointerType::getUnqual(SharkType::oop_type()),
-      "klass_addr");
-
-    // Set the mark
-    intptr_t mark;
-    if (UseBiasedLocking) {
-      Unimplemented();
-    }
-    else {
-      mark = (intptr_t) markOopDesc::prototype();
-    }
-    builder()->CreateStore(LLVMValue::intptr_constant(mark), mark_addr);
-
-    // Set the class
-    Value *rtklass = builder()->CreateInlineOop(klass);
-    builder()->CreateStore(rtklass, klass_addr);
-    got_fast = builder()->GetInsertBlock();
-
-    builder()->CreateBr(push_object);
-    builder()->SetInsertPoint(slow_alloc_and_init);
-    fast_state = current_state()->copy();
-  }
-
-  // The slow path
-  call_vm(
-    builder()->new_instance(),
-    LLVMValue::jint_constant(iter()->get_klass_index()),
-    EX_CHECK_FULL);
-  slow_object = get_vm_result();
-  got_slow = builder()->GetInsertBlock();
-
-  // Push the object
-  if (push_object) {
-    builder()->CreateBr(push_object);
-    builder()->SetInsertPoint(push_object);
-  }
-  if (fast_object) {
-    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "object");
-    phi->addIncoming(fast_object, got_fast);
-    phi->addIncoming(slow_object, got_slow);
-    object = phi;
-    current_state()->merge(fast_state, got_fast, got_slow);
-  }
-  else {
-    object = slow_object;
-  }
-
-  push(SharkValue::create_jobject(object, true));
-}
-
-void SharkTopLevelBlock::do_newarray() {
-  BasicType type = (BasicType) iter()->get_index();
-
-  call_vm(
-    builder()->newarray(),
-    LLVMValue::jint_constant(type),
-    pop()->jint_value(),
-    EX_CHECK_FULL);
-
-  ciArrayKlass *array_klass = ciArrayKlass::make(ciType::make(type));
-  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
-}
-
-void SharkTopLevelBlock::do_anewarray() {
-  bool will_link;
-  ciKlass *klass = iter()->get_klass(will_link);
-  assert(will_link, "typeflow responsibility");
-
-  ciObjArrayKlass *array_klass = ciObjArrayKlass::make(klass);
-  if (!array_klass->is_loaded()) {
-    Unimplemented();
-  }
-
-  call_vm(
-    builder()->anewarray(),
-    LLVMValue::jint_constant(iter()->get_klass_index()),
-    pop()->jint_value(),
-    EX_CHECK_FULL);
-
-  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
-}
-
-void SharkTopLevelBlock::do_multianewarray() {
-  bool will_link;
-  ciArrayKlass *array_klass = iter()->get_klass(will_link)->as_array_klass();
-  assert(will_link, "typeflow responsibility");
-
-  // The dimensions are stack values, so we use their slots for the
-  // dimensions array.  Note that we are storing them in the reverse
-  // of normal stack order.
-  int ndims = iter()->get_dimensions();
-
-  Value *dimensions = stack()->slot_addr(
-    stack()->stack_slots_offset() + max_stack() - xstack_depth(),
-    ArrayType::get(SharkType::jint_type(), ndims),
-    "dimensions");
-
-  for (int i = 0; i < ndims; i++) {
-    builder()->CreateStore(
-      xstack(ndims - 1 - i)->jint_value(),
-      builder()->CreateStructGEP(dimensions, i));
-  }
-
-  call_vm(
-    builder()->multianewarray(),
-    LLVMValue::jint_constant(iter()->get_klass_index()),
-    LLVMValue::jint_constant(ndims),
-    builder()->CreateStructGEP(dimensions, 0),
-    EX_CHECK_FULL);
-
-  // Now we can pop the dimensions off the stack
-  for (int i = 0; i < ndims; i++)
-    pop();
-
-  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
-}
-
-void SharkTopLevelBlock::acquire_method_lock() {
-  Value *lockee;
-  if (target()->is_static())
-    lockee = builder()->CreateInlineOop(target()->holder()->java_mirror());
-  else
-    lockee = local(0)->jobject_value();
-
-  iter()->force_bci(start()); // for the decache in acquire_lock
-  acquire_lock(lockee, EX_CHECK_NO_CATCH);
-}
-
-void SharkTopLevelBlock::do_monitorenter() {
-  SharkValue *lockee = pop();
-  check_null(lockee);
-  acquire_lock(lockee->jobject_value(), EX_CHECK_FULL);
-}
-
-void SharkTopLevelBlock::do_monitorexit() {
-  pop(); // don't need this (monitors are block structured)
-  release_lock(EX_CHECK_NO_CATCH);
-}
-
-void SharkTopLevelBlock::acquire_lock(Value *lockee, int exception_action) {
-  BasicBlock *try_recursive = function()->CreateBlock("try_recursive");
-  BasicBlock *got_recursive = function()->CreateBlock("got_recursive");
-  BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
-  BasicBlock *acquired_fast = function()->CreateBlock("acquired_fast");
-  BasicBlock *lock_acquired = function()->CreateBlock("lock_acquired");
-
-  int monitor = num_monitors();
-  Value *monitor_addr        = stack()->monitor_addr(monitor);
-  Value *monitor_object_addr = stack()->monitor_object_addr(monitor);
-  Value *monitor_header_addr = stack()->monitor_header_addr(monitor);
-
-  // Store the object and mark the slot as live
-  builder()->CreateStore(lockee, monitor_object_addr);
-  set_num_monitors(monitor + 1);
-
-  // Try a simple lock
-  Value *mark_addr = builder()->CreateAddressOfStructEntry(
-    lockee, in_ByteSize(oopDesc::mark_offset_in_bytes()),
-    PointerType::getUnqual(SharkType::intptr_type()),
-    "mark_addr");
-
-  Value *mark = builder()->CreateLoad(mark_addr, "mark");
-  Value *disp = builder()->CreateOr(
-    mark, LLVMValue::intptr_constant(markOopDesc::unlocked_value), "disp");
-  builder()->CreateStore(disp, monitor_header_addr);
-
-  Value *lock = builder()->CreatePtrToInt(
-    monitor_header_addr, SharkType::intptr_type());
-  Value *check = builder()->CreateCmpxchgPtr(lock, mark_addr, disp);
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(disp, check),
-    acquired_fast, try_recursive);
-
-  // Locking failed, but maybe this thread already owns it
-  builder()->SetInsertPoint(try_recursive);
-  Value *addr = builder()->CreateAnd(
-    disp,
-    LLVMValue::intptr_constant(~markOopDesc::lock_mask_in_place));
-
-  // NB we use the entire stack, but JavaThread::is_lock_owned()
-  // uses a more limited range.  I don't think it hurts though...
-  Value *stack_limit = builder()->CreateValueOfStructEntry(
-    thread(), Thread::stack_base_offset(),
-    SharkType::intptr_type(),
-    "stack_limit");
-
-  assert(sizeof(size_t) == sizeof(intptr_t), "should be");
-  Value *stack_size = builder()->CreateValueOfStructEntry(
-    thread(), Thread::stack_size_offset(),
-    SharkType::intptr_type(),
-    "stack_size");
-
-  Value *stack_start =
-    builder()->CreateSub(stack_limit, stack_size, "stack_start");
-
-  builder()->CreateCondBr(
-    builder()->CreateAnd(
-      builder()->CreateICmpUGE(addr, stack_start),
-      builder()->CreateICmpULT(addr, stack_limit)),
-    got_recursive, not_recursive);
-
-  builder()->SetInsertPoint(got_recursive);
-  builder()->CreateStore(LLVMValue::intptr_constant(0), monitor_header_addr);
-  builder()->CreateBr(acquired_fast);
-
-  // Create an edge for the state merge
-  builder()->SetInsertPoint(acquired_fast);
-  SharkState *fast_state = current_state()->copy();
-  builder()->CreateBr(lock_acquired);
-
-  // It's not a recursive case so we need to drop into the runtime
-  builder()->SetInsertPoint(not_recursive);
-  call_vm(
-    builder()->monitorenter(), monitor_addr,
-    exception_action | EAM_MONITOR_FUDGE);
-  BasicBlock *acquired_slow = builder()->GetInsertBlock();
-  builder()->CreateBr(lock_acquired);
-
-  // All done
-  builder()->SetInsertPoint(lock_acquired);
-  current_state()->merge(fast_state, acquired_fast, acquired_slow);
-}
-
-void SharkTopLevelBlock::release_lock(int exception_action) {
-  BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
-  BasicBlock *released_fast = function()->CreateBlock("released_fast");
-  BasicBlock *slow_path     = function()->CreateBlock("slow_path");
-  BasicBlock *lock_released = function()->CreateBlock("lock_released");
-
-  int monitor = num_monitors() - 1;
-  Value *monitor_addr        = stack()->monitor_addr(monitor);
-  Value *monitor_object_addr = stack()->monitor_object_addr(monitor);
-  Value *monitor_header_addr = stack()->monitor_header_addr(monitor);
-
-  // If it is recursive then we're already done
-  Value *disp = builder()->CreateLoad(monitor_header_addr);
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(disp, LLVMValue::intptr_constant(0)),
-    released_fast, not_recursive);
-
-  // Try a simple unlock
-  builder()->SetInsertPoint(not_recursive);
-
-  Value *lock = builder()->CreatePtrToInt(
-    monitor_header_addr, SharkType::intptr_type());
-
-  Value *lockee = builder()->CreateLoad(monitor_object_addr);
-
-  Value *mark_addr = builder()->CreateAddressOfStructEntry(
-    lockee, in_ByteSize(oopDesc::mark_offset_in_bytes()),
-    PointerType::getUnqual(SharkType::intptr_type()),
-    "mark_addr");
-
-  Value *check = builder()->CreateCmpxchgPtr(disp, mark_addr, lock);
-  builder()->CreateCondBr(
-    builder()->CreateICmpEQ(lock, check),
-    released_fast, slow_path);
-
-  // Create an edge for the state merge
-  builder()->SetInsertPoint(released_fast);
-  SharkState *fast_state = current_state()->copy();
-  builder()->CreateBr(lock_released);
-
-  // Need to drop into the runtime to release this one
-  builder()->SetInsertPoint(slow_path);
-  call_vm(builder()->monitorexit(), monitor_addr, exception_action);
-  BasicBlock *released_slow = builder()->GetInsertBlock();
-  builder()->CreateBr(lock_released);
-
-  // All done
-  builder()->SetInsertPoint(lock_released);
-  current_state()->merge(fast_state, released_fast, released_slow);
-
-  // The object slot is now dead
-  set_num_monitors(monitor);
-}
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,430 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkTopLevelBlock : public SharkBlock {
- public:
-  SharkTopLevelBlock(SharkFunction* function, ciTypeFlow::Block* ciblock)
-    : SharkBlock(function),
-      _function(function),
-      _ciblock(ciblock),
-      _entered(false),
-      _has_trap(false),
-      _needs_phis(false),
-      _entry_state(NULL),
-      _entry_block(NULL) {}
-
- private:
-  SharkFunction*     _function;
-  ciTypeFlow::Block* _ciblock;
-
- public:
-  SharkFunction* function() const {
-    return _function;
-  }
-  ciTypeFlow::Block* ciblock() const {
-    return _ciblock;
-  }
-
-  // Function properties
- public:
-  SharkStack* stack() const {
-    return function()->stack();
-  }
-
-  // Typeflow properties
- public:
-  int index() const {
-    return ciblock()->pre_order();
-  }
-  bool is_backedge_copy() const {
-    return ciblock()->is_backedge_copy();
-  }
-  int stack_depth_at_entry() const {
-    return ciblock()->stack_size();
-  }
-  ciType* local_type_at_entry(int index) const {
-    return ciblock()->local_type_at(index);
-  }
-  ciType* stack_type_at_entry(int slot) const {
-    return ciblock()->stack_type_at(slot);
-  }
-  int start() const {
-    return ciblock()->start();
-  }
-  int limit() const {
-    return ciblock()->limit();
-  }
-  bool falls_through() const {
-    return ciblock()->control() == ciBlock::fall_through_bci;
-  }
-  int num_successors() const {
-    return ciblock()->successors()->length();
-  }
-  SharkTopLevelBlock* successor(int index) const {
-    return function()->block(ciblock()->successors()->at(index)->pre_order());
-  }
-  SharkTopLevelBlock* bci_successor(int bci) const;
-
-  // Exceptions
- private:
-  GrowableArray<ciExceptionHandler*>* _exc_handlers;
-  GrowableArray<SharkTopLevelBlock*>* _exceptions;
-
- private:
-  void compute_exceptions();
-
- private:
-  int num_exceptions() const {
-    return _exc_handlers->length();
-  }
-  ciExceptionHandler* exc_handler(int index) const {
-    return _exc_handlers->at(index);
-  }
-  SharkTopLevelBlock* exception(int index) const {
-    return _exceptions->at(index);
-  }
-
-  // Traps
- private:
-  bool _has_trap;
-  int  _trap_request;
-  int  _trap_bci;
-
-  void set_trap(int trap_request, int trap_bci) {
-    assert(!has_trap(), "shouldn't have");
-    _has_trap     = true;
-    _trap_request = trap_request;
-    _trap_bci     = trap_bci;
-  }
-
- private:
-  bool has_trap() {
-    return _has_trap;
-  }
-  int trap_request() {
-    assert(has_trap(), "should have");
-    return _trap_request;
-  }
-  int trap_bci() {
-    assert(has_trap(), "should have");
-    return _trap_bci;
-  }
-
- private:
-  void scan_for_traps();
-
- private:
-  bool static_field_ok_in_clinit(ciField* field);
-
-  // Entry state
- private:
-  bool _entered;
-  bool _needs_phis;
-
- public:
-  bool entered() const {
-    return _entered;
-  }
-  bool needs_phis() const {
-    return _needs_phis;
-  }
-
- private:
-  void enter(SharkTopLevelBlock* predecessor, bool is_exception);
-
- public:
-  void enter() {
-    enter(NULL, false);
-  }
-
- private:
-  SharkState* _entry_state;
-
- private:
-  SharkState* entry_state();
-
- private:
-  llvm::BasicBlock* _entry_block;
-
- public:
-  llvm::BasicBlock* entry_block() const {
-    return _entry_block;
-  }
-
- public:
-  void initialize();
-
- public:
-  void add_incoming(SharkState* incoming_state);
-
-  // Method
- public:
-  llvm::Value* method() {
-    return current_state()->method();
-  }
-
-  // Temporary oop storage
- public:
-  void set_oop_tmp(llvm::Value* value) {
-    assert(value, "value must be non-NULL (will be reset by get_oop_tmp)");
-    assert(!current_state()->oop_tmp(), "oop_tmp gets and sets must match");
-    current_state()->set_oop_tmp(value);
-  }
-  llvm::Value* get_oop_tmp() {
-    llvm::Value* value = current_state()->oop_tmp();
-    assert(value, "oop_tmp gets and sets must match");
-    current_state()->set_oop_tmp(NULL);
-    return value;
-  }
-
-  // Cache and decache
- private:
-  void decache_for_Java_call(ciMethod* callee);
-  void cache_after_Java_call(ciMethod* callee);
-  void decache_for_VM_call();
-  void cache_after_VM_call();
-  void decache_for_trap();
-
-  // Monitors
- private:
-  int num_monitors() {
-    return current_state()->num_monitors();
-  }
-  int set_num_monitors(int num_monitors) {
-    current_state()->set_num_monitors(num_monitors);
-  }
-
-  // Code generation
- public:
-  void emit_IR();
-
-  // Branch helpers
- private:
-  void do_branch(int successor_index);
-
-  // Zero checks
- private:
-  void do_zero_check(SharkValue* value);
-  void zero_check_value(SharkValue* value, llvm::BasicBlock* continue_block);
-
- public:
-  void do_deferred_zero_check(SharkValue*       value,
-                              int               bci,
-                              SharkState*       saved_state,
-                              llvm::BasicBlock* continue_block);
-  // Exceptions
- private:
-  llvm::Value* pending_exception_address() const {
-    return builder()->CreateAddressOfStructEntry(
-      thread(), Thread::pending_exception_offset(),
-      llvm::PointerType::getUnqual(SharkType::oop_type()),
-      "pending_exception_addr");
-  }
-  llvm::LoadInst* get_pending_exception() const {
-    return builder()->CreateLoad(
-      pending_exception_address(), "pending_exception");
-  }
-  void clear_pending_exception() const {
-    builder()->CreateStore(LLVMValue::null(), pending_exception_address());
-  }
- public:
-  enum ExceptionActionMask {
-    // The actual bitmasks that things test against
-    EAM_CHECK         = 1, // whether to check for pending exceptions
-    EAM_HANDLE        = 2, // whether to attempt to handle pending exceptions
-    EAM_MONITOR_FUDGE = 4, // whether the monitor count needs adjusting
-
-    // More convenient values for passing
-    EX_CHECK_NONE     = 0,
-    EX_CHECK_NO_CATCH = EAM_CHECK,
-    EX_CHECK_FULL     = EAM_CHECK | EAM_HANDLE
-  };
-  void check_pending_exception(int action);
-  void handle_exception(llvm::Value* exception, int action);
-  void marshal_exception_fast(int num_options);
-  void marshal_exception_slow(int num_options);
-  llvm::BasicBlock* handler_for_exception(int index);
-
-  // VM calls
- private:
-  llvm::CallInst* call_vm(llvm::Value*  callee,
-                          llvm::Value** args_start,
-                          llvm::Value** args_end,
-                          int           exception_action) {
-    decache_for_VM_call();
-    stack()->CreateSetLastJavaFrame();
-    llvm::CallInst *res = builder()->CreateCall(callee, args_start, args_end);
-    stack()->CreateResetLastJavaFrame();
-    cache_after_VM_call();
-    if (exception_action & EAM_CHECK) {
-      check_pending_exception(exception_action);
-      current_state()->set_has_safepointed(true);
-    }
-    return res;
-  }
-
- public:
-  llvm::CallInst* call_vm(llvm::Value* callee,
-                          int          exception_action) {
-    llvm::Value *args[] = {thread()};
-    return call_vm(callee, args, args + 1, exception_action);
-  }
-  llvm::CallInst* call_vm(llvm::Value* callee,
-                          llvm::Value* arg1,
-                          int          exception_action) {
-    llvm::Value *args[] = {thread(), arg1};
-    return call_vm(callee, args, args + 2, exception_action);
-  }
-  llvm::CallInst* call_vm(llvm::Value* callee,
-                          llvm::Value* arg1,
-                          llvm::Value* arg2,
-                          int          exception_action) {
-    llvm::Value *args[] = {thread(), arg1, arg2};
-    return call_vm(callee, args, args + 3, exception_action);
-  }
-  llvm::CallInst* call_vm(llvm::Value* callee,
-                          llvm::Value* arg1,
-                          llvm::Value* arg2,
-                          llvm::Value* arg3,
-                          int          exception_action) {
-    llvm::Value *args[] = {thread(), arg1, arg2, arg3};
-    return call_vm(callee, args, args + 4, exception_action);
-  }
-
-  // VM call oop return handling
- private:
-  llvm::LoadInst* get_vm_result() const {
-    llvm::Value *addr = builder()->CreateAddressOfStructEntry(
-      thread(), JavaThread::vm_result_offset(),
-      llvm::PointerType::getUnqual(SharkType::oop_type()),
-      "vm_result_addr");
-    llvm::LoadInst *result = builder()->CreateLoad(addr, "vm_result");
-    builder()->CreateStore(LLVMValue::null(), addr);
-    return result;
-  }
-
-  // Synchronization
- private:
-  void acquire_lock(llvm::Value* lockee, int exception_action);
-  void release_lock(int exception_action);
-
- public:
-  void acquire_method_lock();
-
-  // Bounds checks
- private:
-  void check_bounds(SharkValue* array, SharkValue* index);
-
-  // Safepoints
- private:
-  void maybe_add_safepoint();
-  void maybe_add_backedge_safepoint();
-
-  // Loop safepoint removal
- private:
-  bool _can_reach_visited;
-
-  bool can_reach(SharkTopLevelBlock* other);
-  bool can_reach_helper(SharkTopLevelBlock* other);
-
-  // Traps
- private:
-  llvm::BasicBlock* make_trap(int trap_bci, int trap_request);
-  void do_trap(int trap_request);
-
-  // Returns
- private:
-  void call_register_finalizer(llvm::Value* receiver);
-  void handle_return(BasicType type, llvm::Value* exception);
-
-  // arraylength
- private:
-  void do_arraylength();
-
-  // *aload and *astore
- private:
-  void do_aload(BasicType basic_type);
-  void do_astore(BasicType basic_type);
-
-  // *return and athrow
- private:
-  void do_return(BasicType type);
-  void do_athrow();
-
-  // goto*
- private:
-  void do_goto();
-
-  // jsr* and ret
- private:
-  void do_jsr();
-  void do_ret();
-
-  // if*
- private:
-  void do_if_helper(llvm::ICmpInst::Predicate p,
-                    llvm::Value*              b,
-                    llvm::Value*              a,
-                    SharkState*               if_taken_state,
-                    SharkState*               not_taken_state);
-  void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a);
-
-  // tableswitch and lookupswitch
- private:
-  void do_switch();
-
-  // invoke*
- private:
-  ciMethod* improve_virtual_call(ciMethod*        caller,
-                                 ciInstanceKlass* klass,
-                                 ciMethod*        dest_method,
-                                 ciType*          receiver_type);
-  llvm::Value* get_direct_callee(ciMethod* method);
-  llvm::Value* get_virtual_callee(SharkValue* receiver, int vtable_index);
-  llvm::Value* get_interface_callee(SharkValue* receiver, ciMethod* method);
-
-  void do_call();
-
-  // checkcast and instanceof
- private:
-  bool static_subtype_check(ciKlass* check_klass, ciKlass* object_klass);
-  void do_full_instance_check(ciKlass* klass);
-  void do_trapping_instance_check(ciKlass* klass);
-
-  void do_instance_check();
-  bool maybe_do_instanceof_if();
-
-  // new and *newarray
- private:
-  void do_new();
-  void do_newarray();
-  void do_anewarray();
-  void do_multianewarray();
-
-  // monitorenter and monitorexit
- private:
-  void do_monitorenter();
-  void do_monitorexit();
-};
--- a/ports/hotspot/src/share/vm/shark/sharkType.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-class SharkType : public AllStatic {
- private:
-  static SharkContext& context() {
-    return SharkContext::current();
-  }
-
-  // Basic types
- public:
-  static const llvm::Type* void_type() {
-    return context().void_type();
-  }
-  static const llvm::IntegerType* bit_type() {
-    return context().bit_type();
-  }
-  static const llvm::IntegerType* jbyte_type() {
-    return context().jbyte_type();
-  }
-  static const llvm::IntegerType* jshort_type() {
-    return context().jshort_type();
-  }
-  static const llvm::IntegerType* jint_type() {
-    return context().jint_type();
-  }
-  static const llvm::IntegerType* jlong_type() {
-    return context().jlong_type();
-  }
-  static const llvm::Type* jfloat_type() {
-    return context().jfloat_type();
-  }
-  static const llvm::Type* jdouble_type() {
-    return context().jdouble_type();
-  }
-  static const llvm::IntegerType* intptr_type() {
-    return context().intptr_type();
-  }
-
-  // Compound types
- public:
-  static const llvm::PointerType* itableOffsetEntry_type() {
-    return context().itableOffsetEntry_type();
-  }
-  static const llvm::PointerType* jniEnv_type() {
-    return context().jniEnv_type();
-  }
-  static const llvm::PointerType* jniHandleBlock_type() {
-    return context().jniHandleBlock_type();
-  }
-  static const llvm::PointerType* klass_type() {
-    return context().klass_type();
-  }
-  static const llvm::PointerType* methodOop_type() {
-    return context().methodOop_type();
-  }
-  static const llvm::ArrayType* monitor_type() {
-    return context().monitor_type();
-  }
-  static const llvm::PointerType* oop_type() {
-    return context().oop_type();
-  }
-  static const llvm::PointerType* thread_type() {
-    return context().thread_type();
-  }
-  static const llvm::PointerType* zeroStack_type() {
-    return context().zeroStack_type();
-  }
-  static const llvm::FunctionType* entry_point_type() {
-    return context().entry_point_type();
-  }
-  static const llvm::FunctionType* osr_entry_point_type() {
-    return context().osr_entry_point_type();
-  }
-
-  // Mappings
- public:
-  static const llvm::Type* to_stackType(BasicType type) {
-    return context().to_stackType(type);
-  }
-  static const llvm::Type* to_stackType(ciType* type) {
-    return to_stackType(type->basic_type());
-  }
-  static const llvm::Type* to_arrayType(BasicType type) {
-    return context().to_arrayType(type);
-  }
-  static const llvm::Type* to_arrayType(ciType* type) {
-    return to_arrayType(type->basic_type());
-  }
-};
--- a/ports/hotspot/src/share/vm/shark/sharkValue.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_sharkValue.cpp.incl"
-
-using namespace llvm;
-
-// Cloning
-
-SharkValue* SharkNormalValue::clone() const {
-  return SharkValue::create_generic(type(), generic_value(), zero_checked());
-}
-SharkValue* SharkPHIValue::clone() const {
-  return SharkValue::create_phi(type(), (PHINode *) generic_value(), this);
-}
-SharkValue* SharkAddressValue::clone() const {
-  return SharkValue::address_constant(address_value());
-}
-
-// Casting
-
-bool SharkValue::is_phi() const {
-  return false;
-}
-bool SharkPHIValue::is_phi() const {
-  return true;
-}
-SharkPHIValue* SharkValue::as_phi() {
-  ShouldNotCallThis();
-}
-SharkPHIValue* SharkPHIValue::as_phi() {
-  return this;
-}
-
-// Comparison
-
-bool SharkNormalValue::equal_to(SharkValue *other) const {
-  return (this->type()          == other->type() &&
-          this->generic_value() == other->generic_value() &&
-          this->zero_checked()  == other->zero_checked());
-}
-bool SharkAddressValue::equal_to(SharkValue *other) const {
-  return (this->address_value() == other->address_value());
-}
-
-// Type access
-
-ciType* SharkValue::type() const {
-  ShouldNotCallThis();
-}
-ciType* SharkNormalValue::type() const {
-  return _type;
-}
-
-BasicType SharkNormalValue::basic_type() const {
-  return type()->basic_type();
-}
-BasicType SharkAddressValue::basic_type() const {
-  return T_ADDRESS;
-}
-
-int SharkNormalValue::size() const {
-  return type()->size();
-}
-int SharkAddressValue::size() const {
-  return 1;
-}
-
-bool SharkValue::is_jint() const {
-  return false;
-}
-bool SharkValue::is_jlong() const {
-  return false;
-}
-bool SharkValue::is_jfloat() const {
-  return false;
-}
-bool SharkValue::is_jdouble() const {
-  return false;
-}
-bool SharkValue::is_jobject() const {
-  return false;
-}
-bool SharkValue::is_jarray() const {
-  return false;
-}
-bool SharkValue::is_address() const {
-  return false;
-}
-
-bool SharkNormalValue::is_jint() const {
-  return llvm_value()->getType() == SharkType::jint_type();
-}
-bool SharkNormalValue::is_jlong() const {
-  return llvm_value()->getType() == SharkType::jlong_type();
-}
-bool SharkNormalValue::is_jfloat() const {
-  return llvm_value()->getType() == SharkType::jfloat_type();
-}
-bool SharkNormalValue::is_jdouble() const {
-  return llvm_value()->getType() == SharkType::jdouble_type();
-}
-bool SharkNormalValue::is_jobject() const {
-  return llvm_value()->getType() == SharkType::oop_type();
-}
-bool SharkNormalValue::is_jarray() const {
-  return basic_type() == T_ARRAY;
-}
-bool SharkAddressValue::is_address() const {
-  return true;
-}
-
-// Typed conversions from SharkValues
-
-Value* SharkValue::jint_value() const {
-  ShouldNotCallThis();
-}
-Value* SharkValue::jlong_value() const {
-  ShouldNotCallThis();
-}
-Value* SharkValue::jfloat_value() const {
-  ShouldNotCallThis();
-}
-Value* SharkValue::jdouble_value() const {
-  ShouldNotCallThis();
-}
-Value* SharkValue::jobject_value() const {
-  ShouldNotCallThis();
-}
-Value* SharkValue::jarray_value() const {
-  ShouldNotCallThis();
-}
-int SharkValue::address_value() const {
-  ShouldNotCallThis();
-}
-
-Value* SharkNormalValue::jint_value() const {
-  assert(is_jint(), "should be");
-  return llvm_value();
-}
-Value* SharkNormalValue::jlong_value() const {
-  assert(is_jlong(), "should be");
-  return llvm_value();
-}
-Value* SharkNormalValue::jfloat_value() const {
-  assert(is_jfloat(), "should be");
-  return llvm_value();
-}
-Value* SharkNormalValue::jdouble_value() const {
-  assert(is_jdouble(), "should be");
-  return llvm_value();
-}
-Value* SharkNormalValue::jobject_value() const {
-  assert(is_jobject(), "should be");
-  return llvm_value();
-}
-Value* SharkNormalValue::jarray_value() const {
-  // XXX assert(is_jarray(), "should be");
-  // XXX http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=324
-  assert(is_jobject(), "should be");
-  return llvm_value();
-}
-int SharkAddressValue::address_value() const {
-  return _bci;
-}
-
-// Type-losing conversions -- use with care!
-
-Value* SharkNormalValue::generic_value() const {
-  return llvm_value();
-}
-Value* SharkAddressValue::generic_value() const {
-  return LLVMValue::intptr_constant(address_value());
-}
-
-Value* SharkValue::intptr_value(SharkBuilder* builder) const {
-  ShouldNotCallThis();
-}
-Value* SharkNormalValue::intptr_value(SharkBuilder* builder) const {
-  return builder->CreatePtrToInt(jobject_value(), SharkType::intptr_type());
-}
-
-// Phi-style stuff for SharkPHIState::add_incoming
-
-void SharkValue::addIncoming(SharkValue *value, BasicBlock* block) {
-  ShouldNotCallThis();
-}
-void SharkPHIValue::addIncoming(SharkValue *value, BasicBlock* block) {
-  assert(!is_clone(), "shouldn't be");
-  ((llvm::PHINode *) generic_value())->addIncoming(
-      value->generic_value(), block);
-  if (!value->zero_checked())
-    _all_incomers_zero_checked = false;
-}
-void SharkAddressValue::addIncoming(SharkValue *value, BasicBlock* block) {
-  assert(this->equal_to(value), "should be");
-}
-
-// Phi-style stuff for SharkState::merge
-
-SharkValue* SharkNormalValue::merge(SharkBuilder* builder,
-                                    SharkValue*   other,
-                                    BasicBlock*   other_block,
-                                    BasicBlock*   this_block,
-                                    const char*   name) {
-  assert(type() == other->type(), "should be");
-  assert(zero_checked() == other->zero_checked(), "should be");
-
-  PHINode *phi = builder->CreatePHI(SharkType::to_stackType(type()), name);
-  phi->addIncoming(this->generic_value(), this_block);
-  phi->addIncoming(other->generic_value(), other_block);
-  return SharkValue::create_generic(type(), phi, zero_checked());
-}
-SharkValue* SharkAddressValue::merge(SharkBuilder* builder,
-                                     SharkValue*   other,
-                                     BasicBlock*   other_block,
-                                     BasicBlock*   this_block,
-                                     const char*   name) {
-  assert(this->equal_to(other), "should be");
-  return this;
-}
-
-// Repeated null and divide-by-zero check removal
-
-bool SharkValue::zero_checked() const {
-  ShouldNotCallThis();
-}
-void SharkValue::set_zero_checked(bool zero_checked) {
-  ShouldNotCallThis();
-}
-
-bool SharkNormalValue::zero_checked() const {
-  return _zero_checked;
-}
-void SharkNormalValue::set_zero_checked(bool zero_checked) {
-  _zero_checked = zero_checked;
-}
--- a/ports/hotspot/src/share/vm/shark/sharkValue.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-/*
- * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-// Items on the stack and in local variables are tracked using
-// SharkValue objects.
-//
-// All SharkValues are one of two core types, SharkNormalValue
-// and SharkAddressValue, but no code outside this file should
-// ever refer to those directly.  The split is because of the
-// way JSRs are handled: the typeflow pass expands them into
-// multiple copies, so the return addresses pushed by jsr and
-// popped by ret only exist at compile time.  Having separate
-// classes for these allows us to check that our jsr handling
-// is correct, via assertions.
-//
-// There is one more type, SharkPHIValue, which is a subclass
-// of SharkNormalValue with a couple of extra methods.  Use of
-// SharkPHIValue outside of this file is acceptable, so long
-// as it is obtained via SharkValue::as_phi().
-
-class SharkBuilder;
-class SharkPHIValue;
-
-class SharkValue : public ResourceObj {
- protected:
-  SharkValue() {}
-
-  // Cloning
- public:
-  virtual SharkValue* clone() const = 0;
-
-  // Casting
- public:
-  virtual bool           is_phi() const;
-  virtual SharkPHIValue* as_phi();
-
-  // Comparison
- public:
-  virtual bool equal_to(SharkValue* other) const = 0;
-
-  // Type access
- public:
-  virtual BasicType basic_type() const = 0;
-  virtual ciType*   type()       const;
-
-  virtual bool is_jint()    const;
-  virtual bool is_jlong()   const;
-  virtual bool is_jfloat()  const;
-  virtual bool is_jdouble() const;
-  virtual bool is_jobject() const;
-  virtual bool is_jarray()  const;
-  virtual bool is_address() const;
-
-  virtual int size() const = 0;
-
-  bool is_one_word() const {
-    return size() == 1;
-  }
-  bool is_two_word() const {
-    return size() == 2;
-  }
-
-  // Typed conversion from SharkValues
- public:
-  virtual llvm::Value* jint_value()    const;
-  virtual llvm::Value* jlong_value()   const;
-  virtual llvm::Value* jfloat_value()  const;
-  virtual llvm::Value* jdouble_value() const;
-  virtual llvm::Value* jobject_value() const;
-  virtual llvm::Value* jarray_value()  const;
-  virtual int          address_value() const;
-
-  // Typed conversion to SharkValues
- public:
-  static SharkValue* create_jint(llvm::Value* value, bool zero_checked) {
-    assert(value->getType() == SharkType::jint_type(), "should be");
-    return create_generic(ciType::make(T_INT), value, zero_checked);
-  }
-  static SharkValue* create_jlong(llvm::Value* value, bool zero_checked) {
-    assert(value->getType() == SharkType::jlong_type(), "should be");
-    return create_generic(ciType::make(T_LONG), value, zero_checked);
-  }
-  static SharkValue* create_jfloat(llvm::Value* value) {
-    assert(value->getType() == SharkType::jfloat_type(), "should be");
-    return create_generic(ciType::make(T_FLOAT), value, false);
-  }
-  static SharkValue* create_jdouble(llvm::Value* value) {
-    assert(value->getType() == SharkType::jdouble_type(), "should be");
-    return create_generic(ciType::make(T_DOUBLE), value, false);
-  }
-  static SharkValue* create_jobject(llvm::Value* value, bool zero_checked) {
-    assert(value->getType() == SharkType::oop_type(), "should be");
-    return create_generic(ciType::make(T_OBJECT), value, zero_checked);
-  }
-
-  // Typed conversion from constants of various types
- public:
-  static SharkValue* jint_constant(jint value) {
-    return create_jint(LLVMValue::jint_constant(value), value != 0);
-  }
-  static SharkValue* jlong_constant(jlong value) {
-    return create_jlong(LLVMValue::jlong_constant(value), value != 0);
-  }
-  static SharkValue* jfloat_constant(jfloat value) {
-    return create_jfloat(LLVMValue::jfloat_constant(value));
-  }
-  static SharkValue* jdouble_constant(jdouble value) {
-    return create_jdouble(LLVMValue::jdouble_constant(value));
-  }
-  static SharkValue* null() {
-    return create_jobject(LLVMValue::null(), false);
-  }
-  static inline SharkValue* address_constant(int bci);
-
-  // Type-losing conversions -- use with care!
- public:
-  virtual llvm::Value* generic_value() const = 0;
-  virtual llvm::Value* intptr_value(SharkBuilder* builder) const;
-
-  static inline SharkValue* create_generic(ciType*      type,
-                                           llvm::Value* value,
-                                           bool         zero_checked);
-  static inline SharkValue* create_phi(ciType*              type,
-                                       llvm::PHINode*       phi,
-                                       const SharkPHIValue* parent = NULL);
-
-  // Phi-style stuff
- public:
-  virtual void addIncoming(SharkValue* value, llvm::BasicBlock* block);
-  virtual SharkValue* merge(SharkBuilder*     builder,
-                            SharkValue*       other,
-                            llvm::BasicBlock* other_block,
-                            llvm::BasicBlock* this_block,
-                            const char*       name) = 0;
-
-  // Repeated null and divide-by-zero check removal
- public:
-  virtual bool zero_checked() const;
-  virtual void set_zero_checked(bool zero_checked);
-};
-
-class SharkNormalValue : public SharkValue {
-  friend class SharkValue;
-
- protected:
-  SharkNormalValue(ciType* type, llvm::Value* value, bool zero_checked)
-    : _type(type), _llvm_value(value), _zero_checked(zero_checked) {}
-
- private:
-  ciType*      _type;
-  llvm::Value* _llvm_value;
-  bool         _zero_checked;
-
- private:
-  llvm::Value* llvm_value() const {
-    return _llvm_value;
-  }
-
-  // Cloning
- public:
-  SharkValue* clone() const;
-
-  // Comparison
- public:
-  bool equal_to(SharkValue* other) const;
-
-  // Type access
- public:
-  ciType*   type()       const;
-  BasicType basic_type() const;
-  int       size()       const;
-
- public:
-  bool is_jint()    const;
-  bool is_jlong()   const;
-  bool is_jfloat()  const;
-  bool is_jdouble() const;
-  bool is_jobject() const;
-  bool is_jarray()  const;
-
-  // Typed conversions to LLVM values
- public:
-  llvm::Value* jint_value()    const;
-  llvm::Value* jlong_value()   const;
-  llvm::Value* jfloat_value()  const;
-  llvm::Value* jdouble_value() const;
-  llvm::Value* jobject_value() const;
-  llvm::Value* jarray_value()  const;
-
-  // Type-losing conversions, use with care
- public:
-  llvm::Value* generic_value() const;
-  llvm::Value* intptr_value(SharkBuilder* builder) const;
-
-  // Phi-style stuff
- public:
-  SharkValue* merge(SharkBuilder*     builder,
-                    SharkValue*       other,
-                    llvm::BasicBlock* other_block,
-                    llvm::BasicBlock* this_block,
-                    const char*       name);
-
-  // Repeated null and divide-by-zero check removal
- public:
-  bool zero_checked() const;
-  void set_zero_checked(bool zero_checked);
-};
-
-class SharkPHIValue : public SharkNormalValue {
-  friend class SharkValue;
-
- protected:
-  SharkPHIValue(ciType* type, llvm::PHINode* phi, const SharkPHIValue *parent)
-    : SharkNormalValue(type, phi, parent && parent->zero_checked()),
-      _parent(parent),
-      _all_incomers_zero_checked(true) {}
-
- private:
-  const SharkPHIValue* _parent;
-  bool                 _all_incomers_zero_checked;
-
- private:
-  const SharkPHIValue* parent() const {
-    return _parent;
-  }
-  bool is_clone() const {
-    return parent() != NULL;
-  }
-
- public:
-  bool all_incomers_zero_checked() const {
-    if (is_clone())
-      return parent()->all_incomers_zero_checked();
-
-    return _all_incomers_zero_checked;
-  }
-
-  // Cloning
- public:
-  SharkValue* clone() const;
-
-  // Casting
- public:
-  bool           is_phi() const;
-  SharkPHIValue* as_phi();
-
-  // Phi-style stuff
- public:
-  void addIncoming(SharkValue *value, llvm::BasicBlock* block);
-};
-
-class SharkAddressValue : public SharkValue {
-  friend class SharkValue;
-
- protected:
-  SharkAddressValue(int bci)
-    : _bci(bci) {}
-
- private:
-  int _bci;
-
-  // Cloning
- public:
-  SharkValue* clone() const;
-
-  // Comparison
- public:
-  bool equal_to(SharkValue* other) const;
-
-  // Type access
- public:
-  BasicType basic_type() const;
-  int       size()       const;
-  bool      is_address() const;
-
-  // Typed conversion from SharkValues
- public:
-  int address_value() const;
-
-  // Type-losing conversion -- use with care!
- public:
-  llvm::Value* generic_value() const;
-
-  // Phi-style stuff
- public:
-  void addIncoming(SharkValue *value, llvm::BasicBlock* block);
-  SharkValue* merge(SharkBuilder*     builder,
-                    SharkValue*       other,
-                    llvm::BasicBlock* other_block,
-                    llvm::BasicBlock* this_block,
-                    const char*       name);
-};
-
-// SharkValue methods that can't be declared above
-
-inline SharkValue* SharkValue::create_generic(ciType*      type,
-                                              llvm::Value* value,
-                                              bool         zero_checked) {
-  return new SharkNormalValue(type, value, zero_checked);
-}
-
-inline SharkValue* SharkValue::create_phi(ciType*              type,
-                                          llvm::PHINode*       phi,
-                                          const SharkPHIValue* parent) {
-  return new SharkPHIValue(type, phi, parent);
-}
-
-inline SharkValue* SharkValue::address_constant(int bci) {
-  return new SharkAddressValue(bci);
-}
--- a/ports/hotspot/src/share/vm/shark/shark_globals.cpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_shark_globals.cpp.incl"
-
-SHARK_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG)
--- a/ports/hotspot/src/share/vm/shark/shark_globals.hpp	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#define SHARK_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
-                                                                              \
-  product(intx, MaxNodeLimit, 65000,                                          \
-          "Maximum number of nodes")                                          \
-                                                                              \
-  /* inlining */                                                              \
-  product(intx, SharkMaxInlineSize, 32,                                       \
-          "Maximum bytecode size of methods to inline when using Shark")      \
-                                                                              \
-  /* compiler debugging */                                                    \
-  develop(ccstr, SharkPrintTypeflowOf, NULL,                                  \
-          "Print the typeflow of the specified method")                       \
-                                                                              \
-  diagnostic(ccstr, SharkPrintBitcodeOf, NULL,                                \
-          "Print the LLVM bitcode of the specified method")                   \
-                                                                              \
-  diagnostic(ccstr, SharkPrintAsmOf, NULL,                                    \
-          "Print the asm of the specified method")                            \
-                                                                              \
-  develop(bool, SharkTraceBytecodes, false,                                   \
-          "Trace bytecode compilation")                                       \
-                                                                              \
-  diagnostic(bool, SharkTraceInstalls, false,                                 \
-          "Trace method installation")                                        \
-                                                                              \
-  diagnostic(bool, SharkPerformanceWarnings, false,                           \
-          "Warn about things that could be made faster")                      \
-
-SHARK_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
--- a/ports/hotspot/tools/mkbc.c	Tue Sep 21 17:37:58 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,607 +0,0 @@
-/*
- * Copyright 2009 Edward Nevill
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#define DEFAULT_PREFIX	"do_"
-
-static char *prefix = (char *)DEFAULT_PREFIX;
-
-#define ISALPHA(c) (isalpha(c) || (c) == '_')
-#define ISALNUM(c) (isalnum(c) || (c) == '_')
-
-FILE *source_f, *bci_f;
-
-typedef struct Bytecode {
-	char	*name;
-	int	len;
-} Bytecode;
-
-typedef struct StringList {
-	struct StringList *next;
-	char 		*line;
-} StringList;
-
-typedef struct OpcodeList {
-	struct OpcodeList *next;
-	long	 	opcode;
-} OpcodeList;
-
-typedef struct OpcodeSequence {
-	struct OpcodeSequence *next;
-	OpcodeList	*opcode_list;
-} OpcodeSequence;
-
-typedef struct BytecodeImpl {
-	struct BytecodeImpl *next;
-	OpcodeSequence	*opcode_seq;
-	StringList	*macro_impl;
-	StringList	*direct_impl;
-	int		len;
-	char		*name;
-	char		*do_name;
-} BytecodeImpl;
-
-Bytecode bytecodes[256];
-
-BytecodeImpl *the_impl = 0;
-BytecodeImpl **the_impl_ptr = &the_impl;
-
-#define BUFLEN 1024
-
-static int lineno = 1;
-
-void fatal(const char *s)
-{
-	fputs(s, stderr);
-	fputc('\n', stderr);
-	exit(1);
-}
-
-void outmem(void)
-{
-	fprintf(stderr, "Out of memory\n");
-	exit(1);
-}
-
-void synerr(void)
-{
-	fprintf(stderr, "Syntax error at line %d\n", lineno);
-	exit(1);
-}
-
-int readchar()
-{
-	int c;
-
-	c = getc(source_f);
-	if (c == '\n') lineno++;
-	return c;
-}
-
-int readwhitespace(int c, char *buf, int len)
-{
-	int i = 0;
-
-	while ((isspace)(c)) {
-		if (buf && i < len-1) buf[i++] = c;
-		c = (readchar)();
-	}
-	if (buf && i < len) buf[i] = 0;
-	return c;
-}
-
-int skipwhitespace(int c)
-{
-	while ((isspace)(c)) {
-		c = (readchar)();
-	}
-	return c;
-}
-
-int readeol(int c, char *buf, int len)
-{
-	int i = 0;
-
-	while (c != '\n' && c != EOF) {
-		if (buf && i < len-1) buf[i++] = c;
-		c = (readchar)();
-	}
-	if (buf && i < len) buf[i] = 0;
-	if (c == '\n') c = (readchar)();
-	return c;
-}
-
-int skipeol(int c)
-{
-	while (c != '\n' && c != EOF) c = (readchar)();
-	if (c == '\n') c = (readchar)();
-	return c;
-}
-
-int readsymbol(int c, char *buf, int len)
-{
-	int i = 0;
-
-	while (ISALNUM(c)) {
-		if (buf && i < len-1) buf[i++] = c;
-		c = (readchar)();
-	}
-	if (buf && i < len) buf[i] = 0;
-	return c;
-}
-
-int bcdef(int c, char *buf, int len)
-{
-	BytecodeImpl *def;
-	OpcodeSequence *seq;
-	OpcodeSequence **seqp;
-	OpcodeList *opc;
-	OpcodeList **opcp;
-	StringList *macro, **macrop;
-	StringList *direct, **directp;
-	char *name;
-	char *line;
-	int i;
-	int length, overall_len;
-
-	def = (BytecodeImpl *)malloc(sizeof(BytecodeImpl));
-	if (!def) outmem();
-	def->next = 0;
-	def->opcode_seq = 0;
-	def->macro_impl = 0;
-	def->direct_impl = 0;
-	def->len = -1;
-	*the_impl_ptr = def;
-	the_impl_ptr = &(def->next);
-	seqp = &(def->opcode_seq);
-	overall_len = 0;
-	do {
-		seq = (OpcodeSequence *)malloc(sizeof(OpcodeSequence));
-		if (!seq) outmem();
-		seq->next = 0;
-		seq->opcode_list = 0;
-		*seqp = seq;
-		seqp = &(seq->next);
-		opcp = &(seq->opcode_list);
-		length = -2;
-		do {
-			c = (readchar)();
-			c = skipwhitespace(c);
-			if (!ISALPHA(c)) synerr();
-			c = readsymbol(c, buf, len);
-			c = skipwhitespace(c);
-			opc = (OpcodeList *)malloc(sizeof(OpcodeList));
-			if (!opc) outmem();
-			opc->next = 0;
-			opc->opcode = -1;
-			*opcp = opc;
-			opcp = &(opc->next);
-			name = strdup(buf);
-			if (!name) outmem();
-			for (i = 0; i < 256; i++) {
-				if (strcmp(name, bytecodes[i].name) == 0) {
-					opc->opcode = i;
-					break;
-				}
-			}
-			if (i == 256) {
-				fprintf(stderr, "No such opcode '%s'\n", name);
-				exit(1);
-			}
-			if (length == -2) length = bytecodes[i].len;
-		} while (c == ',');
-		overall_len += length;
-		if (c != ')') synerr();
-		c = (readchar)();
-		c = skipwhitespace(c);
-	} while (c == '(');
-//	strcpy(buf, "do_");
-	*buf = 0;
-	if (ISALPHA(c)) {
-		c = readsymbol(c, buf, len);
-		c = skipwhitespace(c);
-	} else {
-		seq = def->opcode_seq;
-//		strcat(buf, "bytecode");
-		while (seq) {
-			opc = seq->opcode_list;
-			if (*buf) strcat(buf, "_");
-			strcat(buf, bytecodes[opc->opcode].name);
-//			sprintf(buf+strlen(buf), "_%ld", opc->opcode);
-			seq = seq->next;
-		}
-	}
-	name = strdup(buf);
-	if (!name) outmem();
-	def->name = name;
-	def->do_name = name;
-	def->len = overall_len;
-	if (c != '{') synerr();
-	c = (readchar)();
-	while (c != '\n' && isspace(c)) c = (readchar)();
-	if (c != '\n') synerr();
-	c = (readchar)();
-	c = readwhitespace(c, buf, len);
-	macrop = &(def->macro_impl);
-	while (c != '}' && c != EOF) {
-		c = readeol(c, buf + strlen(buf), len - strlen(buf));
-		line = strdup(buf);
-		if (!line) outmem();
-		macro = (StringList *)malloc(sizeof(StringList));
-		if (!macro) outmem();
-		*macrop = macro;
-		macrop = &(macro->next);
-		macro->next = 0;
-		macro->line = line;
-		c = readwhitespace(c, buf, len);
-	}
-	if (c != '}') synerr();
-	c = (readchar)();
-	c = skipwhitespace(c);
-	if (ISALPHA(c)) {
-		c = readsymbol(c, buf, len);
-		c = skipwhitespace(c);
-		name = strdup(buf);
-		if (!name) outmem();
-		def->do_name = name;
-	}
-	if (c == '[') {
-		c = (readchar)();
-		while (c != '\n' && isspace(c)) c = (readchar)();
-		if (c != '\n') synerr();
-		c = (readchar)();
-		c = readwhitespace(c, buf, len);
-		directp = &(def->direct_impl);
-		while (c != ']' && c != EOF) {
-			c = readeol(c, buf + strlen(buf), len - strlen(buf));
-			line = strdup(buf);
-			if (!line) outmem();
-			direct = (StringList *)malloc(sizeof(StringList));
-			if (!direct) outmem();
-			*directp = direct;
-			directp = &(direct->next);
-			direct->next = 0;
-			direct->line = line;
-			c = readwhitespace(c, buf, len);
-		}
-		if (c != ']') synerr();
-		c = (readchar)();
-	}
-	return c;
-}
-
-void mkbc(void)
-{
-	char buf[BUFLEN];
-	char *endptr;
-	int c;
-	char *name;
-	long opcode, len;
-
-	c = (readchar)();
-	c = skipwhitespace(c);
-	while (c != EOF) {
-		if (c == '@' || c == '#') {
-			c = skipeol(c);
-		} else if (ISALPHA(c)) {
-			c = readsymbol(c, buf, BUFLEN);
-			c = skipwhitespace(c);
-			if (c == '=') {
-				name = strdup(buf);
-				if (!name) outmem();
-				c = (readchar)();
-				c = skipwhitespace(c);
-				if (!(isdigit)(c)) synerr();
-				c = readsymbol(c, buf, BUFLEN);
-				opcode = strtol(buf, &endptr, 0);
-				if (*endptr != 0) synerr();
-				c = skipwhitespace(c);
-				if (c != ',') synerr();
-				c = (readchar)();
-				c = skipwhitespace(c);
-				if (!(isdigit)(c)) synerr();
-				c = readsymbol(c, buf, BUFLEN);
-				len = strtol(buf, &endptr, 0);
-				if (*endptr != 0) synerr();
-				bytecodes[opcode].name = name;
-				bytecodes[opcode].len = len;
-			}
-		} else if (c == '(') {
-			c = bcdef(c, buf, BUFLEN);
-		} else synerr();
-		c = skipwhitespace(c);
-	}
-}
-
-typedef struct TableEntry {
-	BytecodeImpl *impl;
-	char *impl_name;
-	char *def_name;
-	struct TableEntry *subtable;
-} TableEntry;
-
-TableEntry *the_table;
-
-int is_duplicate(TableEntry *a, TableEntry *b)
-{
-	int i;
-	char buf[256];
-
-	for (i = 0; i < 256; i++) {
-		if (a[i].subtable || b[i].subtable) {
-			if (!(a[i].subtable) || !(b[i].subtable)) return 0;
-			if (!is_duplicate(a[i].subtable, b[i].subtable)) return 0;
-		} else if (a[i].impl_name && b[i].impl_name) {
-			if (strcmp(a[i].impl_name, b[i].impl_name) != 0)
-				return 0;
-		} else if (a[i].def_name && b[i].def_name) {
-			if (strcmp(a[i].def_name, b[i].def_name) != 0)
-				return 0;
-		} else return 0;
-	}
-	return 1;
-}
-
-void remove_duplicates(TableEntry *table, int start, int *table_indices, int depth)
-{
-	TableEntry *start_entry = table[start].subtable;
-	int i, j;
-
-	if (!start_entry) fatal("Subtable is NULL in remove_duplicates!!!");
-	for (i = start+1; i < 256; i++) {
-		if (table[i].subtable) {
-			if (is_duplicate(start_entry, table[i].subtable)) {
-				fputs("dispatch", bci_f);
-				for (j = 0; j < depth; j++) {
-					fputc('_', bci_f);
-					fputs(bytecodes[table_indices[j]].name, bci_f);
-				}
-				fputc('_', bci_f);
-				fputs(bytecodes[i].name, bci_f);
-				fputs(":\n", bci_f);
-				free(table[i].subtable);
-				table[i].subtable = 0;
-			}
-		}
-	}
-}
-
-void writeouttable(TableEntry *table, int *table_indices, int depth)
-{
-	int i, j;
-	int len;
-
-	for (i = 0; i < 256; i++) {
-		if (table[i].subtable) {
-			len = 0;
-			fputs("\t.word\tdispatch", bci_f);
-			table_indices[depth] = i;
-			for (j = 0; j <= depth; j++) {
-				fputc('_', bci_f);
-				fputs(bytecodes[table_indices[j]].name, bci_f);
-				len += bytecodes[table_indices[j]].len;
-			}
-			fprintf(bci_f, "+%d\n", len);
-		} else {
-			if (table[i].impl_name)
-				fprintf(bci_f, "\t.word\t%s%s\n", prefix, table[i].impl_name);
-			else
-				fprintf(bci_f, "\t.word\t%s%s\n", prefix, table[i].def_name);
-		}
-	}
-	if (depth == 0) {
-		fputs("\t.endm\n", bci_f);
-		fputs("\t.macro\tSUB_DISPATCH_TABLES\n", bci_f);
-	}
-	for (i = 0; i < 256; i++) {
-		if (table[i].subtable) {
-			fputs("dispatch", bci_f);
-			table_indices[depth] = i;
-			for (j = 0; j <= depth; j++) {
-				fputc('_', bci_f);
-				fputs(bytecodes[table_indices[j]].name, bci_f);
-			}
-			fputs(":\n", bci_f);
-			remove_duplicates(table, i, table_indices, depth);
-			writeouttable(table[i].subtable, table_indices, depth+1);
-		}
-	}
-}
-
-void do_tableentry(BytecodeImpl *impl, TableEntry **tablep, int *table_indices, int depth)
-{
-	TableEntry *table;
-	char *def = (char *)"undefined";
-	int i,j;
-
-	if (depth == 0) fatal("Depth = 0 for tableentry\n");
-	for (i = 0; i < depth; i++) {
-		table = *tablep;
-		if (!table) {
-			table = (TableEntry *)malloc(sizeof(TableEntry) * 256);
-			if (!table) outmem();
-			*tablep = table;
-			def = strdup(def);
-			if (!def) outmem();
-			for (j = 0; j < 256; j++) {
-				table[j].impl_name = 0;
-				table[j].def_name = def;
-				table[j].subtable = 0;
-			}
-		}
-		table = &table[table_indices[i]];
-		tablep = &(table->subtable);
-		if (table->impl_name) def = table->def_name;
-	}
-	if (!table->impl_name)
-		table->impl_name = impl->do_name;
-	table->def_name = impl->do_name;
-}
-
-void dumpseq(BytecodeImpl *impl, OpcodeSequence *seq, int *table_indices, int depth)
-{
-	OpcodeList *opc;
-
-	opc = seq->opcode_list;
-	while (opc) {
-		table_indices[depth++] = opc->opcode;
-		if (seq->next != NULL) {
-			dumpseq(impl, seq->next, table_indices, depth);
-		} else {
-			do_tableentry(impl, &the_table, table_indices, depth);
-		}
-		depth--;
-		opc = opc->next;
-	}
-}
-
-void dumptable(void)
-{
-	BytecodeImpl *impl = the_impl;
-	int table_indices[256];
-	int j;
-	char	buf[256];
-	char *def;
-
-	the_table = (TableEntry *)malloc(sizeof(TableEntry) * 256);
-	if (!the_table) outmem();
-	for (j = 0; j < 256; j++) {
-		sprintf(buf, "%s", bytecodes[j].name);
-		def = strdup(buf);
-		if (!def) outmem();
-		the_table[j].impl_name = 0;
-		the_table[j].def_name = def;
-		the_table[j].subtable = 0;
-	}
-	while (impl) {
-		dumpseq(impl, impl->opcode_seq, table_indices, 0);
-		impl = impl->next;
-	}
-	fputs("\t.macro\tMAIN_DISPATCH_TABLE\n", bci_f);
-	writeouttable(the_table, table_indices, 0);
-	fputs("\t.endm\n", bci_f);
-}
-
-void dumpimpl(void)
-{
-	BytecodeImpl *impl = the_impl;
-	OpcodeList *opc;
-	StringList *code;
-	StringList *sl;
-	char buf[BUFLEN];
-	char macro[BUFLEN];
-
-	while (impl) {
-		buf[0] = 0;
-		fprintf(bci_f, "@-----------------------------------------------------------------------------\n");
-		fprintf(bci_f, "\t.macro\t%s\tjpc_off=0, seq_len=%d\n", impl->name, impl->len);
-		sl = impl->macro_impl;
-		while (sl) {
-			fputs(sl->line, bci_f);
-			fputc('\n', bci_f);
-			sl = sl->next;
-		}
-		fprintf(bci_f, "\t.endm\n\n");
-		sl = impl->direct_impl;
-		if (sl) {
-			do {
-				fputs(sl->line, bci_f);
-				fputc('\n', bci_f);
-				sl = sl->next;
-			} while (sl);
-		} else {
-			fprintf(bci_f, "\tOpcode\t%s\n", impl->do_name);
-//			fprintf(bci_f, "%s:\n", impl->do_name);
-			fprintf(bci_f, "\t%s\n", impl->name);
-//			fprintf(bci_f, "\tDISPATCH\t%d\n", impl->len);
-		}
-		impl = impl->next;
-	}
-}
-
-void dumpbc()
-{
-	int i;
-
-	for (i = 0; i < 256; i++) {
-		if (strcmp(bytecodes[i].name, "undefined") != 0)
-			fprintf(bci_f, "#define opc_%s\t\t0x%02x\n", bytecodes[i].name, i);
-	}
-	fputc('\n', bci_f);
-	dumpimpl();
-	dumptable();
-}
-
-void usage(void)
-{
-	fatal("Usage: mkbc <bytecode definition file> <asm output file>");
-}
-
-int main(int argc, char **argv)
-{
-	int i;
-	char *source, *bci;
-	char *s;
-
-	source = bci = 0;
-	while (s = *++argv) {
-		if (s[0] == '-' && s[1] != 0) {
-			if (s[1] == 'P') {
-				prefix = s+2;
-			} else {
-				fprintf(stderr, "Unrecognized option %s\n", s);
-				usage();
-			}
-		} else {
-			if (!source) source = s;
-			else if (!bci) bci = s;
-			else {
-				fprintf(stderr, "Too many arguments\n");
-				usage();
-			}
-		}
-	}
-	if (!bci) {
-		fprintf(stderr, "Too few arguments\n");
-		usage();
-	}
-	if (strcmp(source, "-") == 0) {
-		source_f = stdin;
-	} else {
-		source_f = fopen(source, "r");
-		if (!source_f) fatal("Error opening source file");
-	}
-	if (strcmp(bci, "-") == 0) {
-		bci_f = stdout;
-	} else {
-		bci_f = fopen(bci, "w");
-		if (!bci_f) fatal("Error opening bci file for write");
-	}
-	for (i = 0; i < 256; i++) {
-		bytecodes[i].name = (char *)"undefined";
-		bytecodes[i].len = -1;
-	}
-	mkbc();
-	dumpbc();
-	if (ferror(source_f)) fatal("Error reading source");
-	if (ferror(bci_f)) fatal("Error writing bci");
-	if (source_f != stdin) fclose(source_f);
-	if (bci_f != stdout) fclose(bci_f);
-
-	return 0;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/make/linux/makefiles/shark.make	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,32 @@
+#
+# Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2008, 2010 Red Hat, Inc.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code 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
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+#
+
+# Sets make macros for making Shark version of VM
+
+TYPE = SHARK
+
+VM_SUBDIR = server
+
+CFLAGS += -DSHARK
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+// Set the default values for platform dependent flags used by the
+// Shark compiler.  See globals.hpp for details of what they do.
+
+define_pd_global(bool,     BackgroundCompilation,        true );
+define_pd_global(bool,     UseTLAB,                      true );
+define_pd_global(bool,     ResizeTLAB,                   true );
+define_pd_global(bool,     InlineIntrinsics,             false);
+define_pd_global(bool,     PreferInterpreterNativeStubs, false);
+define_pd_global(bool,     ProfileTraps,                 false);
+define_pd_global(bool,     UseOnStackReplacement,        true );
+define_pd_global(bool,     TieredCompilation,            false);
+
+define_pd_global(intx,     CompileThreshold,             1500);
+define_pd_global(intx,     Tier2CompileThreshold,        1500);
+define_pd_global(intx,     Tier3CompileThreshold,        2500);
+define_pd_global(intx,     Tier4CompileThreshold,        4500);
+
+define_pd_global(intx,     BackEdgeThreshold,            100000);
+define_pd_global(intx,     Tier2BackEdgeThreshold,       100000);
+define_pd_global(intx,     Tier3BackEdgeThreshold,       100000);
+define_pd_global(intx,     Tier4BackEdgeThreshold,       100000);
+
+define_pd_global(intx,     OnStackReplacePercentage,     933  );
+define_pd_global(intx,     FreqInlineSize,               325  );
+define_pd_global(intx,     InlineSmallCode,              1000 );
+define_pd_global(intx,     NewRatio,                     12   );
+define_pd_global(intx,     NewSizeThreadIncrease,        4*K  );
+define_pd_global(intx,     InitialCodeCacheSize,         160*K);
+define_pd_global(intx,     ReservedCodeCacheSize,        32*M );
+define_pd_global(bool,     ProfileInterpreter,           false);
+define_pd_global(intx,     CodeCacheExpansionSize,       32*K );
+define_pd_global(uintx,    CodeCacheMinBlockLength,      1    );
+define_pd_global(uintx,    PermSize,                     12*M );
+define_pd_global(uintx,    MaxPermSize,                  64*M );
+define_pd_global(bool,     NeverActAsServerClassMachine, true );
+define_pd_global(uintx,    DefaultMaxRAM,                1*G  );
+define_pd_global(bool,     CICompileOSR,                 true );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/includeDB_shark	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,369 @@
+//
+// Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+// Copyright 2008, 2009, 2010 Red Hat, Inc.
+// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+//
+// This code is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License version 2 only, as
+// published by the Free Software Foundation.
+//
+// This code 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
+// version 2 for more details (a copy is included in the LICENSE file that
+// accompanied this code).
+//
+// You should have received a copy of the GNU General Public License version
+// 2 along with this work; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+// CA 95054 USA or visit www.sun.com if you need additional information or
+// have any questions.
+//
+//
+
+// NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps!
+
+ciMethod.cpp                            ciTypeFlow.hpp
+ciMethod.cpp                            methodOop.hpp
+
+ciTypeFlow.cpp                          allocation.inline.hpp
+ciTypeFlow.cpp                          bytecode.hpp
+ciTypeFlow.cpp                          bytecodes.hpp
+ciTypeFlow.cpp                          ciConstant.hpp
+ciTypeFlow.cpp                          ciField.hpp
+ciTypeFlow.cpp                          ciMethod.hpp
+ciTypeFlow.cpp                          ciMethodData.hpp
+ciTypeFlow.cpp                          ciObjArrayKlass.hpp
+ciTypeFlow.cpp                          ciStreams.hpp
+ciTypeFlow.cpp                          ciTypeArrayKlass.hpp
+ciTypeFlow.cpp                          ciTypeFlow.hpp
+ciTypeFlow.cpp                          compileLog.hpp
+ciTypeFlow.cpp                          deoptimization.hpp
+ciTypeFlow.cpp                          growableArray.hpp
+ciTypeFlow.cpp                          shark_globals.hpp
+
+ciTypeFlow.hpp                          ciEnv.hpp
+ciTypeFlow.hpp                          ciKlass.hpp
+ciTypeFlow.hpp                          ciMethodBlocks.hpp
+
+cppInterpreter_<arch>.cpp               shark_globals.hpp
+
+compileBroker.cpp                       sharkCompiler.hpp
+
+globals.hpp                             shark_globals_<arch>.hpp
+
+globals.cpp                             shark_globals.hpp
+
+llvmValue.hpp                           llvmHeaders.hpp
+llvmValue.hpp                           sharkContext.hpp
+llvmValue.hpp                           sharkType.hpp
+
+nmethod.cpp                             sharkCompiler.hpp
+
+sharedRuntime_<arch>.cpp                compileBroker.hpp
+sharedRuntime_<arch>.cpp                sharkCompiler.hpp
+
+shark_globals.cpp                       shark_globals.hpp
+
+shark_globals.hpp                       shark_globals_<arch>.hpp
+shark_globals.hpp                       globals.hpp
+
+sharkBlock.cpp                          debug.hpp
+sharkBlock.cpp                          bytecodes.hpp
+sharkBlock.cpp                          llvmHeaders.hpp
+sharkBlock.cpp                          llvmValue.hpp
+sharkBlock.cpp                          shark_globals.hpp
+sharkBlock.cpp                          sharkBlock.hpp
+sharkBlock.cpp                          sharkBuilder.hpp
+sharkBlock.cpp                          sharkConstant.hpp
+sharkBlock.cpp                          sharkState.hpp
+sharkBlock.cpp                          sharkValue.hpp
+
+sharkBlock.hpp                          allocation.hpp
+sharkBlock.hpp                          ciMethod.hpp
+sharkBlock.hpp                          ciStreams.hpp
+sharkBlock.hpp                          debug.hpp
+sharkBlock.hpp                          llvmHeaders.hpp
+sharkBlock.hpp                          sharkBuilder.hpp
+sharkBlock.hpp                          sharkConstant.hpp
+sharkBlock.hpp                          sharkInvariants.hpp
+sharkBlock.hpp                          sharkState.hpp
+sharkBlock.hpp                          sharkValue.hpp
+
+sharkBuilder.cpp                        ciMethod.hpp
+sharkBuilder.cpp                        debug.hpp
+sharkBuilder.cpp                        llvmHeaders.hpp
+sharkBuilder.cpp                        llvmValue.hpp
+sharkBuilder.cpp                        methodOop.hpp
+sharkBuilder.cpp                        os.hpp
+sharkBuilder.cpp                        resourceArea.hpp
+sharkBuilder.cpp                        llvmHeaders.hpp
+sharkBuilder.cpp                        sharkBuilder.hpp
+sharkBuilder.cpp                        sharkContext.hpp
+sharkBuilder.cpp                        sharkRuntime.hpp
+sharkBuilder.cpp                        synchronizer.hpp
+sharkBuilder.cpp                        thread.hpp
+
+sharkBuilder.hpp                        barrierSet.hpp
+sharkBuilder.hpp                        cardTableModRefBS.hpp
+sharkBuilder.hpp                        ciType.hpp
+sharkBuilder.hpp                        debug.hpp
+sharkBuilder.hpp                        llvmHeaders.hpp
+sharkBuilder.hpp                        llvmValue.hpp
+sharkBuilder.hpp                        sizes.hpp
+sharkBuilder.hpp                        sharkCodeBuffer.hpp
+sharkBuilder.hpp                        sharkType.hpp
+sharkBuilder.hpp                        sharkValue.hpp
+sharkBuilder.hpp                        sharkEntry.hpp
+
+sharkCacheDecache.cpp                   ciMethod.hpp
+sharkCacheDecache.cpp                   debugInfoRec.hpp
+sharkCacheDecache.cpp                   llvmValue.hpp
+sharkCacheDecache.cpp                   sharkBuilder.hpp
+sharkCacheDecache.cpp                   sharkCacheDecache.hpp
+sharkCacheDecache.cpp                   sharkFunction.hpp
+sharkCacheDecache.cpp                   sharkState.hpp
+
+sharkCacheDecache.hpp                   ciMethod.hpp
+sharkCacheDecache.hpp                   debugInfoRec.hpp
+sharkCacheDecache.hpp                   sharkBuilder.hpp
+sharkCacheDecache.hpp                   sharkFunction.hpp
+sharkCacheDecache.hpp                   sharkStateScanner.hpp
+
+sharkCodeBuffer.hpp                     allocation.hpp
+sharkCodeBuffer.hpp                     codeBuffer.hpp
+sharkCodeBuffer.hpp                     llvmHeaders.hpp
+
+sharkCompiler.cpp                       abstractCompiler.hpp
+sharkCompiler.cpp                       ciEnv.hpp
+sharkCompiler.cpp                       ciMethod.hpp
+sharkCompiler.cpp                       debug.hpp
+sharkCompiler.cpp                       debugInfoRec.hpp
+sharkCompiler.cpp                       dependencies.hpp
+sharkCompiler.cpp                       exceptionHandlerTable.hpp
+sharkCompiler.cpp                       llvmHeaders.hpp
+sharkCompiler.cpp                       oopMap.hpp
+sharkCompiler.cpp                       oopRecorder.hpp
+sharkCompiler.cpp                       shark_globals.hpp
+sharkCompiler.cpp                       sharkBuilder.hpp
+sharkCompiler.cpp                       sharkCodeBuffer.hpp
+sharkCompiler.cpp                       sharkCompiler.hpp
+sharkCompiler.cpp                       sharkContext.hpp
+sharkCompiler.cpp                       sharkEntry.hpp
+sharkCompiler.cpp                       sharkFunction.hpp
+sharkCompiler.cpp                       sharkMemoryManager.hpp
+sharkCompiler.cpp                       sharkNativeWrapper.hpp
+
+sharkCompiler.hpp                       abstractCompiler.hpp
+sharkCompiler.hpp                       ciEnv.hpp
+sharkCompiler.hpp                       ciMethod.hpp
+sharkCompiler.hpp                       compileBroker.hpp
+sharkCompiler.hpp                       llvmHeaders.hpp
+sharkCompiler.hpp                       sharkMemoryManager.hpp
+
+sharkContext.cpp                        arrayOop.hpp
+sharkContext.cpp                        globalDefinitions.hpp
+sharkContext.cpp                        llvmHeaders.hpp
+sharkContext.cpp                        oop.hpp
+sharkContext.cpp                        sharkContext.hpp
+
+sharkContext.hpp                        llvmHeaders.hpp
+sharkContext.hpp                        sharkCompiler.hpp
+
+sharkConstant.cpp                       ciInstance.hpp
+sharkConstant.cpp                       ciStreams.hpp
+sharkConstant.cpp                       sharkBuilder.hpp
+sharkConstant.cpp                       sharkConstant.hpp
+sharkConstant.cpp                       sharkValue.hpp
+
+sharkConstant.hpp                       allocation.hpp
+sharkConstant.hpp                       ciStreams.hpp
+sharkConstant.hpp                       sharkBuilder.hpp
+sharkConstant.hpp                       sharkValue.hpp
+
+sharkEntry.hpp                          llvmHeaders.hpp
+
+sharkFunction.cpp                       allocation.hpp
+sharkFunction.cpp                       ciTypeFlow.hpp
+sharkFunction.cpp                       debug.hpp
+sharkFunction.cpp                       llvmHeaders.hpp
+sharkFunction.cpp                       llvmValue.hpp
+sharkFunction.cpp                       shark_globals.hpp
+sharkFunction.cpp                       sharkBuilder.hpp
+sharkFunction.cpp                       sharkEntry.hpp
+sharkFunction.cpp                       sharkFunction.hpp
+sharkFunction.cpp                       sharkState.hpp
+sharkFunction.cpp                       sharkTopLevelBlock.hpp
+
+sharkFunction.hpp                       allocation.hpp
+sharkFunction.hpp                       ciEnv.hpp
+sharkFunction.hpp                       ciStreams.hpp
+sharkFunction.hpp                       ciTypeFlow.hpp
+sharkFunction.hpp                       llvmHeaders.hpp
+sharkFunction.hpp                       llvmValue.hpp
+sharkFunction.hpp                       sharkBuilder.hpp
+sharkFunction.hpp                       sharkContext.hpp
+sharkFunction.hpp                       sharkInvariants.hpp
+sharkFunction.hpp                       sharkStack.hpp
+
+sharkInliner.cpp                        allocation.hpp
+sharkInliner.cpp                        bytecodes.hpp
+sharkInliner.cpp                        ciField.hpp
+sharkInliner.cpp                        ciMethod.hpp
+sharkInliner.cpp                        ciStreams.hpp
+sharkInliner.cpp                        shark_globals.hpp
+sharkInliner.cpp                        sharkBlock.hpp
+sharkInliner.cpp                        sharkConstant.hpp
+sharkInliner.cpp                        sharkInliner.hpp
+sharkInliner.cpp                        sharkIntrinsics.hpp
+sharkInliner.cpp                        sharkState.hpp
+sharkInliner.cpp                        sharkValue.hpp
+
+sharkInliner.hpp                        allocation.hpp
+sharkInliner.hpp                        ciMethod.hpp
+sharkInliner.hpp                        llvmHeaders.hpp
+sharkInliner.hpp                        sharkState.hpp
+
+sharkIntrinsics.cpp                     ciMethod.hpp
+sharkIntrinsics.cpp                     llvmHeaders.hpp
+sharkIntrinsics.cpp                     shark_globals.hpp
+sharkIntrinsics.cpp                     sharkIntrinsics.hpp
+sharkIntrinsics.cpp                     sharkState.hpp
+sharkIntrinsics.cpp                     sharkValue.hpp
+
+sharkIntrinsics.hpp                     allocation.hpp
+sharkIntrinsics.hpp                     ciMethod.hpp
+sharkIntrinsics.hpp                     llvmHeaders.hpp
+sharkIntrinsics.hpp                     sharkState.hpp
+
+sharkInvariants.cpp                     sharkInvariants.hpp
+
+sharkInvariants.hpp                     allocation.hpp
+sharkInvariants.hpp                     ciEnv.hpp
+sharkInvariants.hpp                     ciMethod.hpp
+sharkInvariants.hpp                     ciInstanceKlass.hpp
+sharkInvariants.hpp                     ciTypeFlow.hpp
+sharkInvariants.hpp                     debugInfoRec.hpp
+sharkInvariants.hpp                     dependencies.hpp
+sharkInvariants.hpp                     llvmHeaders.hpp
+sharkInvariants.hpp                     sharkBuilder.hpp
+
+sharkMemoryManager.hpp                  llvmHeaders.hpp
+sharkMemoryManager.hpp                  sharkEntry.hpp
+
+sharkMemoryManager.cpp                  llvmHeaders.hpp
+sharkMemoryManager.cpp                  sharkEntry.hpp
+sharkMemoryManager.cpp                  sharkMemoryManager.hpp
+
+sharkNativeWrapper.cpp                  llvmHeaders.hpp
+sharkNativeWrapper.cpp                  sharkNativeWrapper.hpp
+sharkNativeWrapper.cpp                  sharkType.hpp
+
+sharkNativeWrapper.hpp                  handles.hpp
+sharkNativeWrapper.hpp                  llvmHeaders.hpp
+sharkNativeWrapper.hpp                  sharkBuilder.hpp
+sharkNativeWrapper.hpp                  sharkContext.hpp
+sharkNativeWrapper.hpp                  sharkInvariants.hpp
+sharkNativeWrapper.hpp                  sharkStack.hpp
+
+sharkRuntime.cpp                        biasedLocking.hpp
+sharkRuntime.cpp                        deoptimization.hpp
+sharkRuntime.cpp                        llvmHeaders.hpp
+sharkRuntime.cpp                        klassOop.hpp
+sharkRuntime.cpp                        sharkRuntime.hpp
+sharkRuntime.cpp                        stack_<arch>.inline.hpp
+sharkRuntime.cpp                        thread.hpp
+
+sharkRuntime.hpp                        allocation.hpp
+sharkRuntime.hpp                        llvmHeaders.hpp
+sharkRuntime.hpp                        llvmValue.hpp
+sharkRuntime.hpp                        klassOop.hpp
+sharkRuntime.hpp                        thread.hpp
+
+sharkStack.cpp                          llvmHeaders.hpp
+sharkStack.cpp                          sharkFunction.hpp
+sharkStack.cpp                          sharkNativeWrapper.hpp
+sharkStack.cpp                          sharkStack.hpp
+sharkStack.cpp                          sharkType.hpp
+
+sharkStack.hpp                          llvmHeaders.hpp
+sharkStack.hpp                          sharkInvariants.hpp
+sharkStack.hpp                          sharkType.hpp
+
+sharkState.cpp                          allocation.hpp
+sharkState.cpp                          ciType.hpp
+sharkState.cpp                          ciTypeFlow.hpp
+sharkState.cpp                          sharkBuilder.hpp
+sharkState.cpp                          sharkCacheDecache.hpp
+sharkState.cpp                          sharkState.hpp
+sharkState.cpp                          sharkTopLevelBlock.hpp
+sharkState.cpp                          sharkType.hpp
+sharkState.cpp                          sharkValue.hpp
+
+sharkState.hpp                          allocation.hpp
+sharkState.hpp                          ciMethod.hpp
+sharkState.hpp                          llvmHeaders.hpp
+sharkState.hpp                          sharkBuilder.hpp
+sharkState.hpp                          sharkInvariants.hpp
+sharkState.hpp                          sharkValue.hpp
+
+sharkStateScanner.cpp                   sharkState.hpp
+sharkStateScanner.cpp                   sharkStateScanner.hpp
+
+sharkStateScanner.hpp                   allocation.hpp
+sharkStateScanner.hpp                   llvmHeaders.hpp
+sharkStateScanner.hpp                   sharkFunction.hpp
+sharkStateScanner.hpp                   sharkInvariants.hpp
+
+sharkTopLevelBlock.cpp                  allocation.hpp
+sharkTopLevelBlock.cpp                  bytecodes.hpp
+sharkTopLevelBlock.cpp                  ciField.hpp
+sharkTopLevelBlock.cpp                  ciInstance.hpp
+sharkTopLevelBlock.cpp                  ciObjArrayKlass.hpp
+sharkTopLevelBlock.cpp                  ciStreams.hpp
+sharkTopLevelBlock.cpp                  ciType.hpp
+sharkTopLevelBlock.cpp                  ciTypeFlow.hpp
+sharkTopLevelBlock.cpp                  debug.hpp
+sharkTopLevelBlock.cpp                  deoptimization.hpp
+sharkTopLevelBlock.cpp                  llvmHeaders.hpp
+sharkTopLevelBlock.cpp                  llvmValue.hpp
+sharkTopLevelBlock.cpp                  shark_globals.hpp
+sharkTopLevelBlock.cpp                  sharkCacheDecache.hpp
+sharkTopLevelBlock.cpp                  sharkTopLevelBlock.hpp
+sharkTopLevelBlock.cpp                  sharkBuilder.hpp
+sharkTopLevelBlock.cpp                  sharkConstant.hpp
+sharkTopLevelBlock.cpp                  sharkInliner.hpp
+sharkTopLevelBlock.cpp                  sharkState.hpp
+sharkTopLevelBlock.cpp                  sharkValue.hpp
+
+sharkTopLevelBlock.hpp                  allocation.hpp
+sharkTopLevelBlock.hpp                  bytecodes.hpp
+sharkTopLevelBlock.hpp                  ciStreams.hpp
+sharkTopLevelBlock.hpp                  ciType.hpp
+sharkTopLevelBlock.hpp                  ciTypeFlow.hpp
+sharkTopLevelBlock.hpp                  llvmHeaders.hpp
+sharkTopLevelBlock.hpp                  sharkBlock.hpp
+sharkTopLevelBlock.hpp                  sharkBuilder.hpp
+sharkTopLevelBlock.hpp                  sharkFunction.hpp
+sharkTopLevelBlock.hpp                  sharkState.hpp
+sharkTopLevelBlock.hpp                  sharkValue.hpp
+
+sharkType.hpp                           allocation.hpp
+sharkType.hpp                           ciType.hpp
+sharkType.hpp                           globalDefinitions.hpp
+sharkType.hpp                           llvmHeaders.hpp
+sharkType.hpp                           sharkContext.hpp
+
+sharkValue.cpp                          ciType.hpp
+sharkValue.cpp                          llvmHeaders.hpp
+sharkValue.cpp                          llvmValue.hpp
+sharkValue.cpp                          sharkBuilder.hpp
+sharkValue.cpp                          sharkValue.hpp
+
+sharkValue.hpp                          allocation.hpp
+sharkValue.hpp                          ciType.hpp
+sharkValue.hpp                          llvmHeaders.hpp
+sharkValue.hpp                          llvmValue.hpp
+sharkValue.hpp                          sharkType.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/llvmHeaders.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#ifdef assert
+  #undef assert
+#endif
+
+#ifdef DEBUG
+  #define SHARK_DEBUG
+  #undef DEBUG
+#endif
+
+#include <llvm/Argument.h>
+#include <llvm/Constants.h>
+#include <llvm/DerivedTypes.h>
+#include <llvm/ExecutionEngine/ExecutionEngine.h>
+#include <llvm/Instructions.h>
+#include <llvm/LLVMContext.h>
+#include <llvm/Module.h>
+#if SHARK_LLVM_VERSION < 27
+#include <llvm/ModuleProvider.h>
+#endif
+#include <llvm/Support/IRBuilder.h>
+#include <llvm/System/Threading.h>
+#include <llvm/Target/TargetSelect.h>
+#include <llvm/Type.h>
+#include <llvm/ExecutionEngine/JITMemoryManager.h>
+#include <llvm/Support/CommandLine.h>
+#if SHARK_LLVM_VERSION >= 27
+#include <llvm/ExecutionEngine/JIT.h>
+#include <llvm/ADT/StringMap.h>
+#include <llvm/Support/Debug.h>
+#include <llvm/System/Host.h>
+#endif
+
+#include <map>
+
+#ifdef assert
+  #undef assert
+#endif
+
+// from hotspot/src/share/vm/utilities/debug.hpp
+#ifdef ASSERT
+  #define assert(p, msg)                                          \
+    if (!(p)) {                                                  \
+      report_assertion_failure(__FILE__, __LINE__,               \
+                              "assert(" XSTR(p) ",\"" msg "\")");\
+      BREAKPOINT;                                                \
+    }
+#else
+  #define assert(p, msg)
+#endif
+
+#ifdef DEBUG
+  #undef DEBUG
+#endif
+#ifdef SHARK_DEBUG
+  #define DEBUG
+  #undef SHARK_DEBUG
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/llvmValue.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class LLVMValue : public AllStatic {
+ public:
+  static llvm::ConstantInt* jbyte_constant(jbyte value)
+  {
+    return llvm::ConstantInt::get(SharkType::jbyte_type(), value, true);
+  }
+  static llvm::ConstantInt* jint_constant(jint value)
+  {
+    return llvm::ConstantInt::get(SharkType::jint_type(), value, true);
+  }
+  static llvm::ConstantInt* jlong_constant(jlong value)
+  {
+    return llvm::ConstantInt::get(SharkType::jlong_type(), value, true);
+  }
+  static llvm::ConstantFP* jfloat_constant(jfloat value)
+  {
+    return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value));
+  }
+  static llvm::ConstantFP* jdouble_constant(jdouble value)
+  {
+    return llvm::ConstantFP::get(SharkContext::current(), llvm::APFloat(value));
+  }
+  static llvm::ConstantPointerNull* null()
+  {
+    return llvm::ConstantPointerNull::get(SharkType::oop_type());
+  }
+
+ public:
+  static llvm::ConstantInt* bit_constant(int value)
+  {
+    return llvm::ConstantInt::get(SharkType::bit_type(), value, false);
+  }
+  static llvm::ConstantInt* intptr_constant(intptr_t value)
+  {
+    return llvm::ConstantInt::get(SharkType::intptr_type(), value, false);
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkBlock.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,1260 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkBlock.cpp.incl"
+
+using namespace llvm;
+
+void SharkBlock::parse_bytecode(int start, int limit) {
+  SharkValue *a, *b, *c, *d;
+  int i;
+
+  // Ensure the current state is initialized before we emit any code,
+  // so that any setup code for the state is at the start of the block
+  current_state();
+
+  // Parse the bytecodes
+  iter()->reset_to_bci(start);
+  while (iter()->next_bci() < limit) {
+    NOT_PRODUCT(a = b = c = d = NULL);
+    iter()->next();
+
+    if (SharkTraceBytecodes)
+      tty->print_cr("%4d: %s", bci(), Bytecodes::name(bc()));
+
+    if (has_trap() && trap_bci() == bci()) {
+      do_trap(trap_request());
+      return;
+    }
+
+    if (UseLoopSafepoints) {
+      // XXX if a lcmp is followed by an if_?? then C2 maybe-inserts
+      // the safepoint before the lcmp rather than before the if.
+      // Maybe we should do this too.  See parse2.cpp for details.
+      switch (bc()) {
+      case Bytecodes::_goto:
+      case Bytecodes::_ifnull:
+      case Bytecodes::_ifnonnull:
+      case Bytecodes::_if_acmpeq:
+      case Bytecodes::_if_acmpne:
+      case Bytecodes::_ifeq:
+      case Bytecodes::_ifne:
+      case Bytecodes::_iflt:
+      case Bytecodes::_ifle:
+      case Bytecodes::_ifgt:
+      case Bytecodes::_ifge:
+      case Bytecodes::_if_icmpeq:
+      case Bytecodes::_if_icmpne:
+      case Bytecodes::_if_icmplt:
+      case Bytecodes::_if_icmple:
+      case Bytecodes::_if_icmpgt:
+      case Bytecodes::_if_icmpge:
+        if (iter()->get_dest() <= bci())
+          maybe_add_backedge_safepoint();
+        break;
+
+      case Bytecodes::_goto_w:
+        if (iter()->get_far_dest() <= bci())
+          maybe_add_backedge_safepoint();
+        break;
+
+      case Bytecodes::_tableswitch:
+      case Bytecodes::_lookupswitch:
+        if (switch_default_dest() <= bci()) {
+          maybe_add_backedge_safepoint();
+          break;
+        }
+        int len = switch_table_length();
+        for (int i = 0; i < len; i++) {
+          if (switch_dest(i) <= bci()) {
+            maybe_add_backedge_safepoint();
+            break;
+          }
+        }
+        break;
+      }
+    }
+
+    switch (bc()) {
+    case Bytecodes::_nop:
+      break;
+
+    case Bytecodes::_aconst_null:
+      push(SharkValue::null());
+      break;
+
+    case Bytecodes::_iconst_m1:
+      push(SharkValue::jint_constant(-1));
+      break;
+    case Bytecodes::_iconst_0:
+      push(SharkValue::jint_constant(0));
+      break;
+    case Bytecodes::_iconst_1:
+      push(SharkValue::jint_constant(1));
+      break;
+    case Bytecodes::_iconst_2:
+      push(SharkValue::jint_constant(2));
+      break;
+    case Bytecodes::_iconst_3:
+      push(SharkValue::jint_constant(3));
+      break;
+    case Bytecodes::_iconst_4:
+      push(SharkValue::jint_constant(4));
+      break;
+    case Bytecodes::_iconst_5:
+      push(SharkValue::jint_constant(5));
+      break;
+
+    case Bytecodes::_lconst_0:
+      push(SharkValue::jlong_constant(0));
+      break;
+    case Bytecodes::_lconst_1:
+      push(SharkValue::jlong_constant(1));
+      break;
+
+    case Bytecodes::_fconst_0:
+      push(SharkValue::jfloat_constant(0));
+      break;
+    case Bytecodes::_fconst_1:
+      push(SharkValue::jfloat_constant(1));
+      break;
+    case Bytecodes::_fconst_2:
+      push(SharkValue::jfloat_constant(2));
+      break;
+
+    case Bytecodes::_dconst_0:
+      push(SharkValue::jdouble_constant(0));
+      break;
+    case Bytecodes::_dconst_1:
+      push(SharkValue::jdouble_constant(1));
+      break;
+
+    case Bytecodes::_bipush:
+      push(SharkValue::jint_constant(iter()->get_byte()));
+      break;
+    case Bytecodes::_sipush:
+      push(SharkValue::jint_constant(iter()->get_short()));
+      break;
+
+    case Bytecodes::_ldc:
+    case Bytecodes::_ldc_w:
+    case Bytecodes::_ldc2_w:
+      push(SharkConstant::for_ldc(iter())->value(builder()));
+      break;
+
+    case Bytecodes::_iload_0:
+    case Bytecodes::_lload_0:
+    case Bytecodes::_fload_0:
+    case Bytecodes::_dload_0:
+    case Bytecodes::_aload_0:
+      push(local(0));
+      break;
+    case Bytecodes::_iload_1:
+    case Bytecodes::_lload_1:
+    case Bytecodes::_fload_1:
+    case Bytecodes::_dload_1:
+    case Bytecodes::_aload_1:
+      push(local(1));
+      break;
+    case Bytecodes::_iload_2:
+    case Bytecodes::_lload_2:
+    case Bytecodes::_fload_2:
+    case Bytecodes::_dload_2:
+    case Bytecodes::_aload_2:
+      push(local(2));
+      break;
+    case Bytecodes::_iload_3:
+    case Bytecodes::_lload_3:
+    case Bytecodes::_fload_3:
+    case Bytecodes::_dload_3:
+    case Bytecodes::_aload_3:
+      push(local(3));
+      break;
+    case Bytecodes::_iload:
+    case Bytecodes::_lload:
+    case Bytecodes::_fload:
+    case Bytecodes::_dload:
+    case Bytecodes::_aload:
+      push(local(iter()->get_index()));
+      break;
+
+    case Bytecodes::_baload:
+      do_aload(T_BYTE);
+      break;
+    case Bytecodes::_caload:
+      do_aload(T_CHAR);
+      break;
+    case Bytecodes::_saload:
+      do_aload(T_SHORT);
+      break;
+    case Bytecodes::_iaload:
+      do_aload(T_INT);
+      break;
+    case Bytecodes::_laload:
+      do_aload(T_LONG);
+      break;
+    case Bytecodes::_faload:
+      do_aload(T_FLOAT);
+      break;
+    case Bytecodes::_daload:
+      do_aload(T_DOUBLE);
+      break;
+    case Bytecodes::_aaload:
+      do_aload(T_OBJECT);
+      break;
+
+    case Bytecodes::_istore_0:
+    case Bytecodes::_lstore_0:
+    case Bytecodes::_fstore_0:
+    case Bytecodes::_dstore_0:
+    case Bytecodes::_astore_0:
+      set_local(0, pop());
+      break;
+    case Bytecodes::_istore_1:
+    case Bytecodes::_lstore_1:
+    case Bytecodes::_fstore_1:
+    case Bytecodes::_dstore_1:
+    case Bytecodes::_astore_1:
+      set_local(1, pop());
+      break;
+    case Bytecodes::_istore_2:
+    case Bytecodes::_lstore_2:
+    case Bytecodes::_fstore_2:
+    case Bytecodes::_dstore_2:
+    case Bytecodes::_astore_2:
+      set_local(2, pop());
+      break;
+    case Bytecodes::_istore_3:
+    case Bytecodes::_lstore_3:
+    case Bytecodes::_fstore_3:
+    case Bytecodes::_dstore_3:
+    case Bytecodes::_astore_3:
+      set_local(3, pop());
+      break;
+    case Bytecodes::_istore:
+    case Bytecodes::_lstore:
+    case Bytecodes::_fstore:
+    case Bytecodes::_dstore:
+    case Bytecodes::_astore:
+      set_local(iter()->get_index(), pop());
+      break;
+
+    case Bytecodes::_bastore:
+      do_astore(T_BYTE);
+      break;
+    case Bytecodes::_castore:
+      do_astore(T_CHAR);
+      break;
+    case Bytecodes::_sastore:
+      do_astore(T_SHORT);
+      break;
+    case Bytecodes::_iastore:
+      do_astore(T_INT);
+      break;
+    case Bytecodes::_lastore:
+      do_astore(T_LONG);
+      break;
+    case Bytecodes::_fastore:
+      do_astore(T_FLOAT);
+      break;
+    case Bytecodes::_dastore:
+      do_astore(T_DOUBLE);
+      break;
+    case Bytecodes::_aastore:
+      do_astore(T_OBJECT);
+      break;
+
+    case Bytecodes::_pop:
+      xpop();
+      break;
+    case Bytecodes::_pop2:
+      xpop();
+      xpop();
+      break;
+    case Bytecodes::_swap:
+      a = xpop();
+      b = xpop();
+      xpush(a);
+      xpush(b);
+      break;
+    case Bytecodes::_dup:
+      a = xpop();
+      xpush(a);
+      xpush(a);
+      break;
+    case Bytecodes::_dup_x1:
+      a = xpop();
+      b = xpop();
+      xpush(a);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup_x2:
+      a = xpop();
+      b = xpop();
+      c = xpop();
+      xpush(a);
+      xpush(c);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup2:
+      a = xpop();
+      b = xpop();
+      xpush(b);
+      xpush(a);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup2_x1:
+      a = xpop();
+      b = xpop();
+      c = xpop();
+      xpush(b);
+      xpush(a);
+      xpush(c);
+      xpush(b);
+      xpush(a);
+      break;
+    case Bytecodes::_dup2_x2:
+      a = xpop();
+      b = xpop();
+      c = xpop();
+      d = xpop();
+      xpush(b);
+      xpush(a);
+      xpush(d);
+      xpush(c);
+      xpush(b);
+      xpush(a);
+      break;
+
+    case Bytecodes::_arraylength:
+      do_arraylength();
+      break;
+
+    case Bytecodes::_getfield:
+      do_getfield();
+      break;
+    case Bytecodes::_getstatic:
+      do_getstatic();
+      break;
+    case Bytecodes::_putfield:
+      do_putfield();
+      break;
+    case Bytecodes::_putstatic:
+      do_putstatic();
+      break;
+
+    case Bytecodes::_iadd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateAdd(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_isub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateSub(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_imul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateMul(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_idiv:
+      do_idiv();
+      break;
+    case Bytecodes::_irem:
+      do_irem();
+      break;
+    case Bytecodes::_ineg:
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateNeg(a->jint_value()), a->zero_checked()));
+      break;
+    case Bytecodes::_ishl:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateShl(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
+      break;
+    case Bytecodes::_ishr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateAShr(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
+      break;
+    case Bytecodes::_iushr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateLShr(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))), false));
+      break;
+    case Bytecodes::_iand:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateAnd(a->jint_value(), b->jint_value()), false));
+      break;
+    case Bytecodes::_ior:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateOr(a->jint_value(), b->jint_value()),
+        a->zero_checked() && b->zero_checked()));
+      break;
+    case Bytecodes::_ixor:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jint(
+        builder()->CreateXor(a->jint_value(), b->jint_value()), false));
+      break;
+
+    case Bytecodes::_ladd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateAdd(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_lsub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateSub(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_lmul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateMul(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_ldiv:
+      do_ldiv();
+      break;
+    case Bytecodes::_lrem:
+      do_lrem();
+      break;
+    case Bytecodes::_lneg:
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateNeg(a->jlong_value()), a->zero_checked()));
+      break;
+    case Bytecodes::_lshl:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateShl(
+          a->jlong_value(),
+          builder()->CreateIntCast(
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true)), false));
+      break;
+    case Bytecodes::_lshr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateAShr(
+          a->jlong_value(),
+          builder()->CreateIntCast(
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true)), false));
+      break;
+    case Bytecodes::_lushr:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateLShr(
+          a->jlong_value(),
+          builder()->CreateIntCast(
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true)), false));
+      break;
+    case Bytecodes::_land:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateAnd(a->jlong_value(), b->jlong_value()), false));
+      break;
+    case Bytecodes::_lor:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateOr(a->jlong_value(), b->jlong_value()),
+        a->zero_checked() && b->zero_checked()));
+      break;
+    case Bytecodes::_lxor:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateXor(a->jlong_value(), b->jlong_value()), false));
+      break;
+
+    case Bytecodes::_fadd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFAdd(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fsub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFSub(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fmul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFMul(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fdiv:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFDiv(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_frem:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFRem(a->jfloat_value(), b->jfloat_value())));
+      break;
+    case Bytecodes::_fneg:
+      a = pop();
+      push(SharkValue::create_jfloat(
+        builder()->CreateFNeg(a->jfloat_value())));
+      break;
+
+    case Bytecodes::_dadd:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFAdd(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_dsub:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFSub(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_dmul:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFMul(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_ddiv:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFDiv(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_drem:
+      b = pop();
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFRem(a->jdouble_value(), b->jdouble_value())));
+      break;
+    case Bytecodes::_dneg:
+      a = pop();
+      push(SharkValue::create_jdouble(
+        builder()->CreateFNeg(a->jdouble_value())));
+      break;
+
+    case Bytecodes::_iinc:
+      i = iter()->get_index();
+      set_local(
+        i,
+        SharkValue::create_jint(
+          builder()->CreateAdd(
+            LLVMValue::jint_constant(iter()->get_iinc_con()),
+            local(i)->jint_value()), false));
+      break;
+
+    case Bytecodes::_lcmp:
+      do_lcmp();
+      break;
+
+    case Bytecodes::_fcmpl:
+      do_fcmp(false, false);
+      break;
+    case Bytecodes::_fcmpg:
+      do_fcmp(false, true);
+      break;
+    case Bytecodes::_dcmpl:
+      do_fcmp(true, false);
+      break;
+    case Bytecodes::_dcmpg:
+      do_fcmp(true, true);
+      break;
+
+    case Bytecodes::_i2l:
+      a = pop();
+      push(SharkValue::create_jlong(
+        builder()->CreateIntCast(
+          a->jint_value(), SharkType::jlong_type(), true), a->zero_checked()));
+      break;
+    case Bytecodes::_i2f:
+      push(SharkValue::create_jfloat(
+        builder()->CreateSIToFP(
+          pop()->jint_value(), SharkType::jfloat_type())));
+      break;
+    case Bytecodes::_i2d:
+      push(SharkValue::create_jdouble(
+        builder()->CreateSIToFP(
+          pop()->jint_value(), SharkType::jdouble_type())));
+      break;
+
+    case Bytecodes::_l2i:
+      push(SharkValue::create_jint(
+        builder()->CreateIntCast(
+          pop()->jlong_value(), SharkType::jint_type(), true), false));
+      break;
+    case Bytecodes::_l2f:
+      push(SharkValue::create_jfloat(
+        builder()->CreateSIToFP(
+          pop()->jlong_value(), SharkType::jfloat_type())));
+      break;
+    case Bytecodes::_l2d:
+      push(SharkValue::create_jdouble(
+        builder()->CreateSIToFP(
+          pop()->jlong_value(), SharkType::jdouble_type())));
+      break;
+
+    case Bytecodes::_f2i:
+      push(SharkValue::create_jint(
+        builder()->CreateCall(
+          builder()->f2i(), pop()->jfloat_value()), false));
+      break;
+    case Bytecodes::_f2l:
+      push(SharkValue::create_jlong(
+        builder()->CreateCall(
+          builder()->f2l(), pop()->jfloat_value()), false));
+      break;
+    case Bytecodes::_f2d:
+      push(SharkValue::create_jdouble(
+        builder()->CreateFPExt(
+          pop()->jfloat_value(), SharkType::jdouble_type())));
+      break;
+
+    case Bytecodes::_d2i:
+      push(SharkValue::create_jint(
+        builder()->CreateCall(
+          builder()->d2i(), pop()->jdouble_value()), false));
+      break;
+    case Bytecodes::_d2l:
+      push(SharkValue::create_jlong(
+        builder()->CreateCall(
+          builder()->d2l(), pop()->jdouble_value()), false));
+      break;
+    case Bytecodes::_d2f:
+      push(SharkValue::create_jfloat(
+        builder()->CreateFPTrunc(
+          pop()->jdouble_value(), SharkType::jfloat_type())));
+      break;
+
+    case Bytecodes::_i2b:
+      push(SharkValue::create_jint(
+        builder()->CreateAShr(
+          builder()->CreateShl(
+            pop()->jint_value(),
+            LLVMValue::jint_constant(24)),
+          LLVMValue::jint_constant(24)), false));
+      break;
+    case Bytecodes::_i2c:
+      push(SharkValue::create_jint(
+        builder()->CreateAnd(
+            pop()->jint_value(),
+            LLVMValue::jint_constant(0xffff)), false));
+      break;
+    case Bytecodes::_i2s:
+      push(SharkValue::create_jint(
+        builder()->CreateAShr(
+          builder()->CreateShl(
+            pop()->jint_value(),
+            LLVMValue::jint_constant(16)),
+          LLVMValue::jint_constant(16)), false));
+      break;
+
+    case Bytecodes::_return:
+      do_return(T_VOID);
+      break;
+    case Bytecodes::_ireturn:
+      do_return(T_INT);
+      break;
+    case Bytecodes::_lreturn:
+      do_return(T_LONG);
+      break;
+    case Bytecodes::_freturn:
+      do_return(T_FLOAT);
+      break;
+    case Bytecodes::_dreturn:
+      do_return(T_DOUBLE);
+      break;
+    case Bytecodes::_areturn:
+      do_return(T_OBJECT);
+      break;
+
+    case Bytecodes::_athrow:
+      do_athrow();
+      break;
+
+    case Bytecodes::_goto:
+    case Bytecodes::_goto_w:
+      do_goto();
+      break;
+
+    case Bytecodes::_jsr:
+    case Bytecodes::_jsr_w:
+      do_jsr();
+      break;
+
+    case Bytecodes::_ret:
+      do_ret();
+      break;
+
+    case Bytecodes::_ifnull:
+      do_if(ICmpInst::ICMP_EQ, SharkValue::null(), pop());
+      break;
+    case Bytecodes::_ifnonnull:
+      do_if(ICmpInst::ICMP_NE, SharkValue::null(), pop());
+      break;
+    case Bytecodes::_if_acmpeq:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_EQ, b, a);
+      break;
+    case Bytecodes::_if_acmpne:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_NE, b, a);
+      break;
+    case Bytecodes::_ifeq:
+      do_if(ICmpInst::ICMP_EQ, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifne:
+      do_if(ICmpInst::ICMP_NE, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_iflt:
+      do_if(ICmpInst::ICMP_SLT, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifle:
+      do_if(ICmpInst::ICMP_SLE, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifgt:
+      do_if(ICmpInst::ICMP_SGT, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_ifge:
+      do_if(ICmpInst::ICMP_SGE, SharkValue::jint_constant(0), pop());
+      break;
+    case Bytecodes::_if_icmpeq:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_EQ, b, a);
+      break;
+    case Bytecodes::_if_icmpne:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_NE, b, a);
+      break;
+    case Bytecodes::_if_icmplt:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SLT, b, a);
+      break;
+    case Bytecodes::_if_icmple:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SLE, b, a);
+      break;
+    case Bytecodes::_if_icmpgt:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SGT, b, a);
+      break;
+    case Bytecodes::_if_icmpge:
+      b = pop();
+      a = pop();
+      do_if(ICmpInst::ICMP_SGE, b, a);
+      break;
+
+    case Bytecodes::_tableswitch:
+    case Bytecodes::_lookupswitch:
+      do_switch();
+      break;
+
+    case Bytecodes::_invokestatic:
+    case Bytecodes::_invokespecial:
+    case Bytecodes::_invokevirtual:
+    case Bytecodes::_invokeinterface:
+      do_call();
+      break;
+
+    case Bytecodes::_instanceof:
+      // This is a very common construct:
+      //
+      //  if (object instanceof Klass) {
+      //    something = (Klass) object;
+      //    ...
+      //  }
+      //
+      // which gets compiled to something like this:
+      //
+      //  28: aload 9
+      //  30: instanceof <Class Klass>
+      //  33: ifeq 52
+      //  36: aload 9
+      //  38: checkcast <Class Klass>
+      //
+      // Handling both bytecodes at once allows us
+      // to eliminate the checkcast.
+      if (iter()->next_bci() < limit &&
+          (iter()->next_bc() == Bytecodes::_ifeq ||
+           iter()->next_bc() == Bytecodes::_ifne) &&
+          (!UseLoopSafepoints ||
+           iter()->next_get_dest() > iter()->next_bci())) {
+        if (maybe_do_instanceof_if()) {
+          iter()->next();
+          if (SharkTraceBytecodes)
+            tty->print_cr("%4d: %s", bci(), Bytecodes::name(bc()));
+          break;
+        }
+      }
+      // fall through
+    case Bytecodes::_checkcast:
+      do_instance_check();
+      break;
+
+    case Bytecodes::_new:
+      do_new();
+      break;
+    case Bytecodes::_newarray:
+      do_newarray();
+      break;
+    case Bytecodes::_anewarray:
+      do_anewarray();
+      break;
+    case Bytecodes::_multianewarray:
+      do_multianewarray();
+      break;
+
+    case Bytecodes::_monitorenter:
+      do_monitorenter();
+      break;
+    case Bytecodes::_monitorexit:
+      do_monitorexit();
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+  }
+}
+
+SharkState* SharkBlock::initial_current_state() {
+  return entry_state()->copy();
+}
+
+int SharkBlock::switch_default_dest() {
+  return iter()->get_dest_table(0);
+}
+
+int SharkBlock::switch_table_length() {
+  switch(bc()) {
+  case Bytecodes::_tableswitch:
+    return iter()->get_int_table(2) - iter()->get_int_table(1) + 1;
+
+  case Bytecodes::_lookupswitch:
+    return iter()->get_int_table(1);
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+int SharkBlock::switch_key(int i) {
+  switch(bc()) {
+  case Bytecodes::_tableswitch:
+    return iter()->get_int_table(1) + i;
+
+  case Bytecodes::_lookupswitch:
+    return iter()->get_int_table(2 + 2 * i);
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+int SharkBlock::switch_dest(int i) {
+  switch(bc()) {
+  case Bytecodes::_tableswitch:
+    return iter()->get_dest_table(i + 3);
+
+  case Bytecodes::_lookupswitch:
+    return iter()->get_dest_table(2 + 2 * i + 1);
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+void SharkBlock::do_div_or_rem(bool is_long, bool is_rem) {
+  SharkValue *sb = pop();
+  SharkValue *sa = pop();
+
+  check_divide_by_zero(sb);
+
+  Value *a, *b, *p, *q;
+  if (is_long) {
+    a = sa->jlong_value();
+    b = sb->jlong_value();
+    p = LLVMValue::jlong_constant(0x8000000000000000LL);
+    q = LLVMValue::jlong_constant(-1);
+  }
+  else {
+    a = sa->jint_value();
+    b = sb->jint_value();
+    p = LLVMValue::jint_constant(0x80000000);
+    q = LLVMValue::jint_constant(-1);
+  }
+
+  BasicBlock *ip           = builder()->GetBlockInsertionPoint();
+  BasicBlock *special_case = builder()->CreateBlock(ip, "special_case");
+  BasicBlock *general_case = builder()->CreateBlock(ip, "general_case");
+  BasicBlock *done         = builder()->CreateBlock(ip, "done");
+
+  builder()->CreateCondBr(
+    builder()->CreateAnd(
+      builder()->CreateICmpEQ(a, p),
+      builder()->CreateICmpEQ(b, q)),
+    special_case, general_case);
+
+  builder()->SetInsertPoint(special_case);
+  Value *special_result;
+  if (is_rem) {
+    if (is_long)
+      special_result = LLVMValue::jlong_constant(0);
+    else
+      special_result = LLVMValue::jint_constant(0);
+  }
+  else {
+    special_result = a;
+  }
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(general_case);
+  Value *general_result;
+  if (is_rem)
+    general_result = builder()->CreateSRem(a, b);
+  else
+    general_result = builder()->CreateSDiv(a, b);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *result;
+  if (is_long)
+    result = builder()->CreatePHI(SharkType::jlong_type(), "result");
+  else
+    result = builder()->CreatePHI(SharkType::jint_type(), "result");
+  result->addIncoming(special_result, special_case);
+  result->addIncoming(general_result, general_case);
+
+  if (is_long)
+    push(SharkValue::create_jlong(result, false));
+  else
+    push(SharkValue::create_jint(result, false));
+}
+
+void SharkBlock::do_field_access(bool is_get, bool is_field) {
+  bool will_link;
+  ciField *field = iter()->get_field(will_link);
+  assert(will_link, "typeflow responsibility");
+  assert(is_field != field->is_static(), "mismatch");
+
+  // Pop the value off the stack where necessary
+  SharkValue *value = NULL;
+  if (!is_get)
+    value = pop();
+
+  // Find the object we're accessing, if necessary
+  Value *object = NULL;
+  if (is_field) {
+    SharkValue *value = pop();
+    check_null(value);
+    object = value->generic_value();
+  }
+  if (is_get && field->is_constant()) {
+    SharkConstant *constant = SharkConstant::for_field(iter());
+    if (constant->is_loaded())
+      value = constant->value(builder());
+  }
+  if (!is_get || value == NULL) {
+    if (!is_field)
+      object = builder()->CreateInlineOop(field->holder());
+
+    BasicType   basic_type = field->type()->basic_type();
+    const Type *stack_type = SharkType::to_stackType(basic_type);
+    const Type *field_type = SharkType::to_arrayType(basic_type);
+
+    Value *addr = builder()->CreateAddressOfStructEntry(
+      object, in_ByteSize(field->offset_in_bytes()),
+      PointerType::getUnqual(field_type),
+      "addr");
+
+    // Do the access
+    if (is_get) {
+      Value *field_value = builder()->CreateLoad(addr);
+
+      if (field_type != stack_type) {
+        field_value = builder()->CreateIntCast(
+          field_value, stack_type, basic_type != T_CHAR);
+      }
+
+      value = SharkValue::create_generic(field->type(), field_value, false);
+    }
+    else {
+      Value *field_value = value->generic_value();
+
+      if (field_type != stack_type) {
+        field_value = builder()->CreateIntCast(
+          field_value, field_type, basic_type != T_CHAR);
+      }
+
+      builder()->CreateStore(field_value, addr);
+
+      if (!field->type()->is_primitive_type())
+        builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr);
+
+      if (field->is_volatile())
+        builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
+    }
+  }
+
+  // Push the value onto the stack where necessary
+  if (is_get)
+    push(value);
+}
+
+void SharkBlock::do_lcmp() {
+  Value *b = pop()->jlong_value();
+  Value *a = pop()->jlong_value();
+
+  BasicBlock *ip   = builder()->GetBlockInsertionPoint();
+  BasicBlock *ne   = builder()->CreateBlock(ip, "lcmp_ne");
+  BasicBlock *lt   = builder()->CreateBlock(ip, "lcmp_lt");
+  BasicBlock *gt   = builder()->CreateBlock(ip, "lcmp_gt");
+  BasicBlock *done = builder()->CreateBlock(ip, "done");
+
+  BasicBlock *eq = builder()->GetInsertBlock();
+  builder()->CreateCondBr(builder()->CreateICmpEQ(a, b), done, ne);
+
+  builder()->SetInsertPoint(ne);
+  builder()->CreateCondBr(builder()->CreateICmpSLT(a, b), lt, gt);
+
+  builder()->SetInsertPoint(lt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(gt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result");
+  result->addIncoming(LLVMValue::jint_constant(-1), lt);
+  result->addIncoming(LLVMValue::jint_constant(0),  eq);
+  result->addIncoming(LLVMValue::jint_constant(1),  gt);
+
+  push(SharkValue::create_jint(result, false));
+}
+
+void SharkBlock::do_fcmp(bool is_double, bool unordered_is_greater) {
+  Value *a, *b;
+  if (is_double) {
+    b = pop()->jdouble_value();
+    a = pop()->jdouble_value();
+  }
+  else {
+    b = pop()->jfloat_value();
+    a = pop()->jfloat_value();
+  }
+
+  BasicBlock *ip      = builder()->GetBlockInsertionPoint();
+  BasicBlock *ordered = builder()->CreateBlock(ip, "ordered");
+  BasicBlock *ge      = builder()->CreateBlock(ip, "fcmp_ge");
+  BasicBlock *lt      = builder()->CreateBlock(ip, "fcmp_lt");
+  BasicBlock *eq      = builder()->CreateBlock(ip, "fcmp_eq");
+  BasicBlock *gt      = builder()->CreateBlock(ip, "fcmp_gt");
+  BasicBlock *done    = builder()->CreateBlock(ip, "done");
+
+  builder()->CreateCondBr(
+    builder()->CreateFCmpUNO(a, b),
+    unordered_is_greater ? gt : lt, ordered);
+
+  builder()->SetInsertPoint(ordered);
+  builder()->CreateCondBr(builder()->CreateFCmpULT(a, b), lt, ge);
+
+  builder()->SetInsertPoint(ge);
+  builder()->CreateCondBr(builder()->CreateFCmpUGT(a, b), gt, eq);
+
+  builder()->SetInsertPoint(lt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(gt);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(eq);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result");
+  result->addIncoming(LLVMValue::jint_constant(-1), lt);
+  result->addIncoming(LLVMValue::jint_constant(0),  eq);
+  result->addIncoming(LLVMValue::jint_constant(1),  gt);
+
+  push(SharkValue::create_jint(result, false));
+}
+
+void SharkBlock::emit_IR() {
+  ShouldNotCallThis();
+}
+
+SharkState* SharkBlock::entry_state() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_zero_check(SharkValue* value) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::maybe_add_backedge_safepoint() {
+  ShouldNotCallThis();
+}
+
+bool SharkBlock::has_trap() {
+  return false;
+}
+
+int SharkBlock::trap_request() {
+  ShouldNotCallThis();
+}
+
+int SharkBlock::trap_bci() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_trap(int trap_request) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_arraylength() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_aload(BasicType basic_type) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_astore(BasicType basic_type) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_return(BasicType type) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_athrow() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_goto() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_jsr() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_ret() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_if(ICmpInst::Predicate p, SharkValue* b, SharkValue* a) {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_switch() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_call() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_instance_check() {
+  ShouldNotCallThis();
+}
+
+bool SharkBlock::maybe_do_instanceof_if() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_new() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_newarray() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_anewarray() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_multianewarray() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_monitorenter() {
+  ShouldNotCallThis();
+}
+
+void SharkBlock::do_monitorexit() {
+  ShouldNotCallThis();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkBlock.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,281 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkState;
+
+class SharkBlock : public SharkTargetInvariants {
+ protected:
+  SharkBlock(const SharkTargetInvariants* parent)
+    : SharkTargetInvariants(parent),
+      _iter(target()),
+      _current_state(NULL) {}
+
+  SharkBlock(const SharkCompileInvariants* parent, ciMethod* target)
+    : SharkTargetInvariants(parent, target),
+      _iter(target),
+      _current_state(NULL) {}
+
+ private:
+  ciBytecodeStream _iter;
+  SharkState*      _current_state;
+
+ public:
+  ciBytecodeStream* iter() {
+    return &_iter;
+  }
+  Bytecodes::Code bc() {
+    return iter()->cur_bc();
+  }
+  int bci() {
+    return iter()->cur_bci();
+  }
+
+  // Entry state
+ protected:
+  virtual SharkState* entry_state();
+
+  // Current state
+ private:
+  SharkState* initial_current_state();
+
+ public:
+  SharkState* current_state() {
+    if (_current_state == NULL)
+      set_current_state(initial_current_state());
+    return _current_state;
+  }
+
+ protected:
+  void set_current_state(SharkState* current_state) {
+    _current_state = current_state;
+  }
+
+  // Local variables
+ protected:
+  SharkValue* local(int index) {
+    SharkValue *value = current_state()->local(index);
+    assert(value != NULL, "shouldn't be");
+    assert(value->is_one_word() ||
+           (index + 1 < max_locals() &&
+            current_state()->local(index + 1) == NULL), "should be");
+    return value;
+  }
+  void set_local(int index, SharkValue* value) {
+    assert(value != NULL, "shouldn't be");
+    current_state()->set_local(index, value);
+    if (value->is_two_word())
+      current_state()->set_local(index + 1, NULL);
+  }
+
+  // Expression stack (raw)
+ protected:
+  void xpush(SharkValue* value) {
+    current_state()->push(value);
+  }
+  SharkValue* xpop() {
+    return current_state()->pop();
+  }
+  SharkValue* xstack(int slot) {
+    SharkValue *value = current_state()->stack(slot);
+    assert(value != NULL, "shouldn't be");
+    assert(value->is_one_word() ||
+           (slot > 0 &&
+            current_state()->stack(slot - 1) == NULL), "should be");
+    return value;
+  }
+  int xstack_depth() {
+    return current_state()->stack_depth();
+  }
+
+  // Expression stack (cooked)
+ protected:
+  void push(SharkValue* value) {
+    assert(value != NULL, "shouldn't be");
+    xpush(value);
+    if (value->is_two_word())
+      xpush(NULL);
+  }
+  SharkValue* pop() {
+    int size = current_state()->stack(0) == NULL ? 2 : 1;
+    if (size == 2)
+      xpop();
+    SharkValue *value = xpop();
+    assert(value && value->size() == size, "should be");
+    return value;
+  }
+  SharkValue* pop_result(BasicType type) {
+    SharkValue *result = pop();
+
+#ifdef ASSERT
+    switch (result->basic_type()) {
+    case T_BOOLEAN:
+    case T_BYTE:
+    case T_CHAR:
+    case T_SHORT:
+      assert(type == T_INT, "type mismatch");
+      break;
+
+    case T_ARRAY:
+      assert(type == T_OBJECT, "type mismatch");
+      break;
+
+    default:
+      assert(result->basic_type() == type, "type mismatch");
+    }
+#endif // ASSERT
+
+    return result;
+  }
+
+  // Code generation
+ public:
+  virtual void emit_IR();
+
+ protected:
+  void parse_bytecode(int start, int limit);
+
+  // Helpers
+ protected:
+  virtual void do_zero_check(SharkValue* value);
+
+  // Zero checking
+ protected:
+  void check_null(SharkValue* object) {
+    zero_check(object);
+  }
+  void check_divide_by_zero(SharkValue* value) {
+    zero_check(value);
+  }
+ private:
+  void zero_check(SharkValue* value) {
+    if (!value->zero_checked())
+      do_zero_check(value);
+  }
+
+  // Safepoints
+ protected:
+  virtual void maybe_add_backedge_safepoint();
+
+  // Traps
+ protected:
+  virtual bool has_trap();
+  virtual int  trap_request();
+  virtual int  trap_bci();
+  virtual void do_trap(int trap_request);
+
+  // arraylength
+ protected:
+  virtual void do_arraylength();
+
+  // *aload and *astore
+ protected:
+  virtual void do_aload(BasicType basic_type);
+  virtual void do_astore(BasicType basic_type);
+
+  // *div and *rem
+ private:
+  void do_idiv() {
+    do_div_or_rem(false, false);
+  }
+  void do_irem() {
+    do_div_or_rem(false, true);
+  }
+  void do_ldiv() {
+    do_div_or_rem(true, false);
+  }
+  void do_lrem() {
+    do_div_or_rem(true, true);
+  }
+  void do_div_or_rem(bool is_long, bool is_rem);
+
+  // get* and put*
+ private:
+  void do_getstatic() {
+    do_field_access(true, false);
+  }
+  void do_getfield() {
+    do_field_access(true, true);
+  }
+  void do_putstatic() {
+    do_field_access(false, false);
+  }
+  void do_putfield() {
+    do_field_access(false, true);
+  }
+  void do_field_access(bool is_get, bool is_field);
+
+  // lcmp and [fd]cmp[lg]
+ private:
+  void do_lcmp();
+  void do_fcmp(bool is_double, bool unordered_is_greater);
+
+  // *return and athrow
+ protected:
+  virtual void do_return(BasicType type);
+  virtual void do_athrow();
+
+  // goto*
+ protected:
+  virtual void do_goto();
+
+  // jsr* and ret
+ protected:
+  virtual void do_jsr();
+  virtual void do_ret();
+
+  // if*
+ protected:
+  virtual void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a);
+
+  // *switch
+ protected:
+  int switch_default_dest();
+  int switch_table_length();
+  int switch_key(int i);
+  int switch_dest(int i);
+
+  virtual void do_switch();
+
+  // invoke*
+ protected:
+  virtual void do_call();
+
+  // checkcast and instanceof
+ protected:
+  virtual void do_instance_check();
+  virtual bool maybe_do_instanceof_if();
+
+  // new and *newarray
+ protected:
+  virtual void do_new();
+  virtual void do_newarray();
+  virtual void do_anewarray();
+  virtual void do_multianewarray();
+
+  // monitorenter and monitorexit
+ protected:
+  virtual void do_monitorenter();
+  virtual void do_monitorexit();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkBuilder.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,591 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkBuilder.cpp.incl"
+
+using namespace llvm;
+
+SharkBuilder::SharkBuilder(SharkCodeBuffer* code_buffer)
+  : IRBuilder<>(SharkContext::current()),
+    _code_buffer(code_buffer) {
+}
+
+// Helpers for accessing structures
+Value* SharkBuilder::CreateAddressOfStructEntry(Value*      base,
+                                                ByteSize    offset,
+                                                const Type* type,
+                                                const char* name) {
+  return CreateBitCast(CreateStructGEP(base, in_bytes(offset)), type, name);
+}
+
+LoadInst* SharkBuilder::CreateValueOfStructEntry(Value*      base,
+                                                 ByteSize    offset,
+                                                 const Type* type,
+                                                 const char* name) {
+  return CreateLoad(
+    CreateAddressOfStructEntry(
+      base, offset, PointerType::getUnqual(type)),
+    name);
+}
+
+// Helpers for accessing arrays
+
+LoadInst* SharkBuilder::CreateArrayLength(Value* arrayoop) {
+  return CreateValueOfStructEntry(
+    arrayoop, in_ByteSize(arrayOopDesc::length_offset_in_bytes()),
+    SharkType::jint_type(), "length");
+}
+
+Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
+                                        const Type* element_type,
+                                        int         element_bytes,
+                                        ByteSize    base_offset,
+                                        Value*      index,
+                                        const char* name) {
+  Value* offset = CreateIntCast(index, SharkType::intptr_type(), false);
+  if (element_bytes != 1)
+    offset = CreateShl(
+      offset,
+      LLVMValue::intptr_constant(exact_log2(element_bytes)));
+  offset = CreateAdd(
+    LLVMValue::intptr_constant(in_bytes(base_offset)), offset);
+
+  return CreateIntToPtr(
+    CreateAdd(CreatePtrToInt(arrayoop, SharkType::intptr_type()), offset),
+    PointerType::getUnqual(element_type),
+    name);
+}
+
+Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
+                                        BasicType   basic_type,
+                                        ByteSize    base_offset,
+                                        Value*      index,
+                                        const char* name) {
+  return CreateArrayAddress(
+    arrayoop,
+    SharkType::to_arrayType(basic_type),
+    type2aelembytes(basic_type),
+    base_offset, index, name);
+}
+
+Value* SharkBuilder::CreateArrayAddress(Value*      arrayoop,
+                                        BasicType   basic_type,
+                                        Value*      index,
+                                        const char* name) {
+  return CreateArrayAddress(
+    arrayoop, basic_type,
+    in_ByteSize(arrayOopDesc::base_offset_in_bytes(basic_type)),
+    index, name);
+}
+
+// Helpers for creating intrinsics and external functions.
+
+const Type* SharkBuilder::make_type(char type, bool void_ok) {
+  switch (type) {
+    // Primitive types
+  case 'c':
+    return SharkType::jbyte_type();
+  case 'i':
+    return SharkType::jint_type();
+  case 'l':
+    return SharkType::jlong_type();
+  case 'x':
+    return SharkType::intptr_type();
+  case 'f':
+    return SharkType::jfloat_type();
+  case 'd':
+    return SharkType::jdouble_type();
+
+    // Pointers to primitive types
+  case 'C':
+  case 'I':
+  case 'L':
+  case 'X':
+  case 'F':
+  case 'D':
+    return PointerType::getUnqual(make_type(tolower(type), false));
+
+    // VM objects
+  case 'T':
+    return SharkType::thread_type();
+  case 'M':
+    return PointerType::getUnqual(SharkType::monitor_type());
+  case 'O':
+    return SharkType::oop_type();
+
+    // Miscellaneous
+  case 'v':
+    assert(void_ok, "should be");
+    return SharkType::void_type();
+  case '1':
+    return SharkType::bit_type();
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+const FunctionType* SharkBuilder::make_ftype(const char* params,
+                                             const char* ret) {
+  std::vector<const Type*> param_types;
+  for (const char* c = params; *c; c++)
+    param_types.push_back(make_type(*c, false));
+
+  assert(strlen(ret) == 1, "should be");
+  const Type *return_type = make_type(*ret, true);
+
+  return FunctionType::get(return_type, param_types, false);
+}
+
+// Create an object representing an intrinsic or external function by
+// referencing the symbol by name.  This is the LLVM-style approach,
+// but it cannot be used on functions within libjvm.so its symbols
+// are not exported.  Note that you cannot make this work simply by
+// exporting the symbols, as some symbols have the same names as
+// symbols in the standard libraries (eg, atan2, fabs) and would
+// obscure them were they visible.
+Value* SharkBuilder::make_function(const char* name,
+                                   const char* params,
+                                   const char* ret) {
+  return SharkContext::current().get_external(name, make_ftype(params, ret));
+}
+
+// Create an object representing an external function by inlining a
+// function pointer in the code.  This is not the LLVM way, but it's
+// the only way to access functions in libjvm.so and functions like
+// __kernel_dmb on ARM which is accessed via an absolute address.
+Value* SharkBuilder::make_function(address     func,
+                                   const char* params,
+                                   const char* ret) {
+  return CreateIntToPtr(
+    LLVMValue::intptr_constant((intptr_t) func),
+    PointerType::getUnqual(make_ftype(params, ret)));
+}
+
+// VM calls
+
+Value* SharkBuilder::find_exception_handler() {
+  return make_function(
+    (address) SharkRuntime::find_exception_handler, "TIi", "i");
+}
+
+Value* SharkBuilder::monitorenter() {
+  return make_function((address) SharkRuntime::monitorenter, "TM", "v");
+}
+
+Value* SharkBuilder::monitorexit() {
+  return make_function((address) SharkRuntime::monitorexit, "TM", "v");
+}
+
+Value* SharkBuilder::new_instance() {
+  return make_function((address) SharkRuntime::new_instance, "Ti", "v");
+}
+
+Value* SharkBuilder::newarray() {
+  return make_function((address) SharkRuntime::newarray, "Tii", "v");
+}
+
+Value* SharkBuilder::anewarray() {
+  return make_function((address) SharkRuntime::anewarray, "Tii", "v");
+}
+
+Value* SharkBuilder::multianewarray() {
+  return make_function((address) SharkRuntime::multianewarray, "TiiI", "v");
+}
+
+Value* SharkBuilder::register_finalizer() {
+  return make_function((address) SharkRuntime::register_finalizer, "TO", "v");
+}
+
+Value* SharkBuilder::safepoint() {
+  return make_function((address) SafepointSynchronize::block, "T", "v");
+}
+
+Value* SharkBuilder::throw_ArithmeticException() {
+  return make_function(
+    (address) SharkRuntime::throw_ArithmeticException, "TCi", "v");
+}
+
+Value* SharkBuilder::throw_ArrayIndexOutOfBoundsException() {
+  return make_function(
+    (address) SharkRuntime::throw_ArrayIndexOutOfBoundsException, "TCii", "v");
+}
+
+Value* SharkBuilder::throw_ClassCastException() {
+  return make_function(
+    (address) SharkRuntime::throw_ClassCastException, "TCi", "v");
+}
+
+Value* SharkBuilder::throw_NullPointerException() {
+  return make_function(
+    (address) SharkRuntime::throw_NullPointerException, "TCi", "v");
+}
+
+// High-level non-VM calls
+
+Value* SharkBuilder::f2i() {
+  return make_function((address) SharedRuntime::f2i, "f", "i");
+}
+
+Value* SharkBuilder::f2l() {
+  return make_function((address) SharedRuntime::f2l, "f", "l");
+}
+
+Value* SharkBuilder::d2i() {
+  return make_function((address) SharedRuntime::d2i, "d", "i");
+}
+
+Value* SharkBuilder::d2l() {
+  return make_function((address) SharedRuntime::d2l, "d", "l");
+}
+
+Value* SharkBuilder::is_subtype_of() {
+  return make_function((address) SharkRuntime::is_subtype_of, "OO", "c");
+}
+
+Value* SharkBuilder::current_time_millis() {
+  return make_function((address) os::javaTimeMillis, "", "l");
+}
+
+Value* SharkBuilder::sin() {
+  return make_function("llvm.sin.f64", "d", "d");
+}
+
+Value* SharkBuilder::cos() {
+  return make_function("llvm.cos.f64", "d", "d");
+}
+
+Value* SharkBuilder::tan() {
+  return make_function((address) ::tan, "d", "d");
+}
+
+Value* SharkBuilder::atan2() {
+  return make_function((address) ::atan2, "dd", "d");
+}
+
+Value* SharkBuilder::sqrt() {
+  return make_function("llvm.sqrt.f64", "d", "d");
+}
+
+Value* SharkBuilder::log() {
+  return make_function("llvm.log.f64", "d", "d");
+}
+
+Value* SharkBuilder::log10() {
+  return make_function("llvm.log10.f64", "d", "d");
+}
+
+Value* SharkBuilder::pow() {
+  return make_function("llvm.pow.f64", "dd", "d");
+}
+
+Value* SharkBuilder::exp() {
+  return make_function("llvm.exp.f64", "d", "d");
+}
+
+Value* SharkBuilder::fabs() {
+  return make_function((address) ::fabs, "d", "d");
+}
+
+Value* SharkBuilder::unsafe_field_offset_to_byte_offset() {
+  extern jlong Unsafe_field_offset_to_byte_offset(jlong field_offset);
+  return make_function((address) Unsafe_field_offset_to_byte_offset, "l", "l");
+}
+
+Value* SharkBuilder::osr_migration_end() {
+  return make_function((address) SharedRuntime::OSR_migration_end, "C", "v");
+}
+
+// Semi-VM calls
+
+Value* SharkBuilder::throw_StackOverflowError() {
+  return make_function((address) ZeroStack::handle_overflow, "T", "v");
+}
+
+Value* SharkBuilder::uncommon_trap() {
+  return make_function((address) SharkRuntime::uncommon_trap, "Ti", "i");
+}
+
+Value* SharkBuilder::deoptimized_entry_point() {
+  return make_function((address) CppInterpreter::main_loop, "iT", "v");
+}
+
+// Native-Java transition
+
+Value* SharkBuilder::check_special_condition_for_native_trans() {
+  return make_function(
+    (address) JavaThread::check_special_condition_for_native_trans,
+    "T", "v");
+}
+
+// Low-level non-VM calls
+
+// The ARM-specific code here is to work around unimplemented
+// atomic exchange and memory barrier intrinsics in LLVM.
+//
+// Delegating to external functions for these would normally
+// incur a speed penalty, but Linux on ARM is a special case
+// in that atomic operations on that platform are handled by
+// external functions anyway.  It would be *preferable* for
+// the calls to be hidden away in LLVM, but it's not hurting
+// performance so having the calls here is acceptable.
+//
+// If you are building Shark on a platform without atomic
+// exchange and/or memory barrier intrinsics then it is only
+// acceptable to mimic this approach if your platform cannot
+// perform these operations without delegating to a function.
+
+#ifdef ARM
+static jint zero_cmpxchg_int(volatile jint *ptr, jint oldval, jint newval) {
+  return Atomic::cmpxchg(newval, ptr, oldval);
+}
+#endif // ARM
+
+Value* SharkBuilder::cmpxchg_int() {
+  return make_function(
+#ifdef ARM
+    (address) zero_cmpxchg_int,
+#else
+    "llvm.atomic.cmp.swap.i32.p0i32",
+#endif // ARM
+    "Iii", "i");
+}
+
+#ifdef ARM
+static intptr_t zero_cmpxchg_ptr(volatile intptr_t* ptr,
+                                 intptr_t           oldval,
+                                 intptr_t           newval) {
+  return Atomic::cmpxchg_ptr(newval, ptr, oldval);
+}
+#endif // ARM
+
+Value* SharkBuilder::cmpxchg_ptr() {
+  return make_function(
+#ifdef ARM
+    (address) zero_cmpxchg_ptr,
+#else
+    "llvm.atomic.cmp.swap.i" LP64_ONLY("64") NOT_LP64("32") ".p0i" LP64_ONLY("64") NOT_LP64("32"),
+#endif // ARM
+    "Xxx", "x");
+}
+
+Value* SharkBuilder::frame_address() {
+  return make_function("llvm.frameaddress", "i", "C");
+}
+
+Value* SharkBuilder::memory_barrier() {
+  return make_function(
+#ifdef ARM
+    (address) 0xffff0fa0, // __kernel_dmb
+#else
+    "llvm.memory.barrier",
+#endif // ARM
+    "11111", "v");
+}
+
+Value* SharkBuilder::memset() {
+#if SHARK_LLVM_VERSION >= 28
+  // LLVM 2.8 added a fifth isVolatile field for memset
+  // introduced with LLVM r100304
+  return make_function("llvm.memset.i32", "Cciii", "v");
+#else
+  return make_function("llvm.memset.i32", "Ccii", "v");
+#endif
+}
+
+Value* SharkBuilder::unimplemented() {
+  return make_function((address) report_unimplemented, "Ci", "v");
+}
+
+Value* SharkBuilder::should_not_reach_here() {
+  return make_function((address) report_should_not_reach_here, "Ci", "v");
+}
+
+Value* SharkBuilder::dump() {
+  return make_function((address) SharkRuntime::dump, "Cx", "v");
+}
+
+// Public interface to low-level non-VM calls
+
+CallInst* SharkBuilder::CreateCmpxchgInt(Value* exchange_value,
+                                         Value* dst,
+                                         Value* compare_value) {
+  return CreateCall3(cmpxchg_int(), dst, compare_value, exchange_value);
+}
+
+CallInst* SharkBuilder::CreateCmpxchgPtr(Value* exchange_value,
+                                         Value* dst,
+                                         Value* compare_value) {
+  return CreateCall3(cmpxchg_ptr(), dst, compare_value, exchange_value);
+}
+
+CallInst* SharkBuilder::CreateGetFrameAddress() {
+  return CreateCall(frame_address(), LLVMValue::jint_constant(0));
+}
+
+CallInst *SharkBuilder::CreateMemoryBarrier(int flags) {
+  Value *args[] = {
+    LLVMValue::bit_constant((flags & BARRIER_LOADLOAD) ? 1 : 0),
+    LLVMValue::bit_constant((flags & BARRIER_LOADSTORE) ? 1 : 0),
+    LLVMValue::bit_constant((flags & BARRIER_STORELOAD) ? 1 : 0),
+    LLVMValue::bit_constant((flags & BARRIER_STORESTORE) ? 1 : 0),
+    LLVMValue::bit_constant(1)};
+
+  return CreateCall(memory_barrier(), args, args + 5);
+}
+
+CallInst* SharkBuilder::CreateMemset(Value* dst,
+                                     Value* value,
+                                     Value* len,
+                                     Value* align) {
+#if SHARK_LLVM_VERSION >= 28
+  return CreateCall5(memset(), dst, value, len, align,
+                     LLVMValue::jint_constant(0));
+#else
+  return CreateCall4(memset(), dst, value, len, align);
+#endif
+}
+
+CallInst* SharkBuilder::CreateUnimplemented(const char* file, int line) {
+  return CreateCall2(
+    unimplemented(),
+    CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) file),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    LLVMValue::jint_constant(line));
+}
+
+CallInst* SharkBuilder::CreateShouldNotReachHere(const char* file, int line) {
+  return CreateCall2(
+    should_not_reach_here(),
+    CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) file),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    LLVMValue::jint_constant(line));
+}
+
+#ifndef PRODUCT
+CallInst* SharkBuilder::CreateDump(Value* value) {
+  const char *name;
+  if (value->hasName())
+    // XXX this leaks, but it's only debug code
+    name = strdup(value->getName().str().c_str());
+  else
+    name = "unnamed_value";
+
+  if (isa<PointerType>(value->getType()))
+    value = CreatePtrToInt(value, SharkType::intptr_type());
+  else if (value->getType()->
+#if SHARK_LLVM_VERSION >= 27
+           isIntegerTy()
+#else
+           isInteger()
+#endif
+           )
+    value = CreateIntCast(value, SharkType::intptr_type(), false);
+  else
+    Unimplemented();
+
+  return CreateCall2(
+    dump(),
+    CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) name),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    value);
+}
+#endif // PRODUCT
+
+// HotSpot memory barriers
+
+void SharkBuilder::CreateUpdateBarrierSet(BarrierSet* bs, Value* field) {
+  if (bs->kind() != BarrierSet::CardTableModRef)
+    Unimplemented();
+
+  CreateStore(
+    LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card),
+    CreateIntToPtr(
+      CreateAdd(
+        LLVMValue::intptr_constant(
+          (intptr_t) ((CardTableModRefBS *) bs)->byte_map_base),
+        CreateLShr(
+          CreatePtrToInt(field, SharkType::intptr_type()),
+          LLVMValue::intptr_constant(CardTableModRefBS::card_shift))),
+      PointerType::getUnqual(SharkType::jbyte_type())));
+}
+
+// Helpers for accessing the code buffer
+
+Value* SharkBuilder::code_buffer_address(int offset) {
+  return CreateAdd(
+    code_buffer()->base_pc(),
+    LLVMValue::intptr_constant(offset));
+}
+
+Value* SharkBuilder::CreateInlineOop(jobject object, const char* name) {
+  return CreateLoad(
+    CreateIntToPtr(
+      code_buffer_address(code_buffer()->inline_oop(object)),
+      PointerType::getUnqual(SharkType::oop_type())),
+    name);
+}
+
+Value* SharkBuilder::CreateInlineData(void*       data,
+                                      size_t      size,
+                                      const Type* type, 
+                                      const char* name) {
+  return CreateIntToPtr(
+    code_buffer_address(code_buffer()->inline_data(data, size)),
+    type,
+    name);
+}
+
+// Helpers for creating basic blocks.
+
+BasicBlock* SharkBuilder::GetBlockInsertionPoint() const {
+  BasicBlock *cur = GetInsertBlock();
+
+  // BasicBlock::Create takes an insertBefore argument, so
+  // we need to find the block _after_ the current block
+  Function::iterator iter = cur->getParent()->begin();
+  Function::iterator end  = cur->getParent()->end();
+  while (iter != end) {
+    iter++;
+    if (&*iter == cur) {
+      iter++;
+      break;
+    }
+  }
+
+  if (iter == end)
+    return NULL;
+  else
+    return iter;
+}
+
+BasicBlock* SharkBuilder::CreateBlock(BasicBlock* ip, const char* name) const {
+  return BasicBlock::Create(
+    SharkContext::current(), name, GetInsertBlock()->getParent(), ip);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkBuilder.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,209 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkBuilder : public llvm::IRBuilder<> {
+  friend class SharkCompileInvariants;
+
+ public:
+  SharkBuilder(SharkCodeBuffer* code_buffer);
+
+  // The code buffer we are building into.
+ private:
+  SharkCodeBuffer* _code_buffer;
+
+ protected:
+  SharkCodeBuffer* code_buffer() const {
+    return _code_buffer;
+  }
+
+  // Helpers for accessing structures.
+ public:
+  llvm::Value* CreateAddressOfStructEntry(llvm::Value* base,
+                                          ByteSize offset,
+                                          const llvm::Type* type,
+                                          const char *name = "");
+  llvm::LoadInst* CreateValueOfStructEntry(llvm::Value* base,
+                                           ByteSize offset,
+                                           const llvm::Type* type,
+                                           const char *name = "");
+
+  // Helpers for accessing arrays.
+ public:
+  llvm::LoadInst* CreateArrayLength(llvm::Value* arrayoop);
+  llvm::Value* CreateArrayAddress(llvm::Value*      arrayoop,
+                                  const llvm::Type* element_type,
+                                  int               element_bytes,
+                                  ByteSize          base_offset,
+                                  llvm::Value*      index,
+                                  const char*       name = "");
+  llvm::Value* CreateArrayAddress(llvm::Value* arrayoop,
+                                  BasicType    basic_type,
+                                  ByteSize     base_offset,
+                                  llvm::Value* index,
+                                  const char*  name = "");
+  llvm::Value* CreateArrayAddress(llvm::Value* arrayoop,
+                                  BasicType    basic_type,
+                                  llvm::Value* index,
+                                  const char*  name = "");
+
+  // Helpers for creating intrinsics and external functions.
+ private:
+  static const llvm::Type* make_type(char type, bool void_ok);
+  static const llvm::FunctionType* make_ftype(const char* params,
+                                              const char* ret);
+  llvm::Value* make_function(const char* name,
+                             const char* params,
+                             const char* ret);
+  llvm::Value* make_function(address     func,
+                             const char* params,
+                             const char* ret);
+
+  // Intrinsics and external functions, part 1: VM calls.
+  //   These are functions declared with JRT_ENTRY and JRT_EXIT,
+  //   macros which flip the thread from _thread_in_Java to
+  //   _thread_in_vm and back.  VM calls always safepoint, and can
+  //   therefore throw exceptions.  VM calls require of setup and
+  //   teardown, and must be called with SharkTopLevelBlock::call_vm.
+ public:
+  llvm::Value* find_exception_handler();
+  llvm::Value* monitorenter();
+  llvm::Value* monitorexit();
+  llvm::Value* new_instance();
+  llvm::Value* newarray();
+  llvm::Value* anewarray();
+  llvm::Value* multianewarray();
+  llvm::Value* register_finalizer();
+  llvm::Value* safepoint();
+  llvm::Value* throw_ArithmeticException();
+  llvm::Value* throw_ArrayIndexOutOfBoundsException();
+  llvm::Value* throw_ClassCastException();
+  llvm::Value* throw_NullPointerException();
+
+  // Intrinsics and external functions, part 2: High-level non-VM calls.
+  //   These are called like normal functions.  The stack is not set
+  //   up for walking so they must not safepoint or throw exceptions,
+  //   or call anything that might.
+ public:
+  llvm::Value* f2i();
+  llvm::Value* f2l();
+  llvm::Value* d2i();
+  llvm::Value* d2l();
+  llvm::Value* is_subtype_of();
+  llvm::Value* current_time_millis();
+  llvm::Value* sin();
+  llvm::Value* cos();
+  llvm::Value* tan();
+  llvm::Value* atan2();
+  llvm::Value* sqrt();
+  llvm::Value* log();
+  llvm::Value* log10();
+  llvm::Value* pow();
+  llvm::Value* exp();
+  llvm::Value* fabs();
+  llvm::Value* unsafe_field_offset_to_byte_offset();
+  llvm::Value* osr_migration_end();
+
+  // Intrinsics and external functions, part 3: semi-VM calls.
+  //   These are special cases that do VM call stuff but are invoked
+  //   as though they were normal calls.  This is acceptable so long
+  //   as the method that calls them returns to its immediately that
+  //   the semi VM call returns.
+ public:
+  llvm::Value* throw_StackOverflowError();
+  llvm::Value* uncommon_trap();
+  llvm::Value* deoptimized_entry_point();
+
+  // Intrinsics and external functions, part 4: Native-Java transition.
+  //   This is a special case in that it is invoked during a thread
+  //   state transition.  The stack must be set up for walking, and it
+  //   may throw exceptions, but the state is _thread_in_native_trans.
+ public:
+  llvm::Value* check_special_condition_for_native_trans();
+
+  // Intrinsics and external functions, part 5: Low-level non-VM calls.
+  //   These have the same caveats as the high-level non-VM calls
+  //   above.  They are not accessed directly; rather, you should
+  //   access them via the various Create* methods below.
+ private:
+  llvm::Value* cmpxchg_int();
+  llvm::Value* cmpxchg_ptr();
+  llvm::Value* frame_address();
+  llvm::Value* memory_barrier();
+  llvm::Value* memset();
+  llvm::Value* unimplemented();
+  llvm::Value* should_not_reach_here();
+  llvm::Value* dump();
+
+  // Public interface to low-level non-VM calls.
+ public:
+  llvm::CallInst* CreateCmpxchgInt(llvm::Value* exchange_value,
+                                   llvm::Value* dst,
+                                   llvm::Value* compare_value);
+  llvm::CallInst* CreateCmpxchgPtr(llvm::Value* exchange_value,
+                                   llvm::Value* dst,
+                                   llvm::Value* compare_value);
+  llvm::CallInst* CreateGetFrameAddress();
+  llvm::CallInst* CreateMemoryBarrier(int flags);
+  llvm::CallInst* CreateMemset(llvm::Value* dst,
+                               llvm::Value* value,
+                               llvm::Value* len,
+                               llvm::Value* align);
+  llvm::CallInst* CreateUnimplemented(const char* file, int line);
+  llvm::CallInst* CreateShouldNotReachHere(const char* file, int line);
+  NOT_PRODUCT(llvm::CallInst* CreateDump(llvm::Value* value));
+
+  // Flags for CreateMemoryBarrier.
+ public:
+  enum BarrierFlags {
+    BARRIER_LOADLOAD   = 1,
+    BARRIER_LOADSTORE  = 2,
+    BARRIER_STORELOAD  = 4,
+    BARRIER_STORESTORE = 8
+  };
+
+  // HotSpot memory barriers
+ public:
+  void CreateUpdateBarrierSet(BarrierSet* bs, llvm::Value* field);
+
+  // Helpers for accessing the code buffer.
+ public:
+  llvm::Value* code_buffer_address(int offset);
+  llvm::Value* CreateInlineOop(jobject object, const char* name = "");
+  llvm::Value* CreateInlineOop(ciObject* object, const char* name = "") {
+    return CreateInlineOop(object->constant_encoding(), name);
+  }
+  llvm::Value* CreateInlineData(void*             data,
+                                size_t            size,
+                                const llvm::Type* type, 
+                                const char*       name = ""); 
+
+  // Helpers for creating basic blocks.
+  // NB don't use unless SharkFunction::CreateBlock is unavailable.
+  // XXX these are hacky and should be removed.
+ public:
+  llvm::BasicBlock* GetBlockInsertionPoint() const;
+  llvm::BasicBlock* CreateBlock(llvm::BasicBlock* ip,
+                                const char*       name="") const;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkCacheDecache.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,259 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkCacheDecache.cpp.incl"
+
+using namespace llvm;
+
+void SharkDecacher::start_frame() {
+  // Start recording the debug information
+  _pc_offset = code_buffer()->create_unique_offset();
+  _oopmap = new OopMap(
+    oopmap_slot_munge(stack()->oopmap_frame_size()),
+    oopmap_slot_munge(arg_size()));
+  debug_info()->add_safepoint(pc_offset(), oopmap());
+}
+
+void SharkDecacher::start_stack(int stack_depth) {
+  // Create the array we'll record our stack slots in
+  _exparray = new GrowableArray<ScopeValue*>(stack_depth);
+
+  // Set the stack pointer
+  stack()->CreateStoreStackPointer(
+    builder()->CreatePtrToInt(
+      stack()->slot_addr(
+        stack()->stack_slots_offset() + max_stack() - stack_depth),
+      SharkType::intptr_type()));
+}
+
+void SharkDecacher::process_stack_slot(int          index,
+                                       SharkValue** addr,
+                                       int          offset) {
+  SharkValue *value = *addr;
+
+  // Write the value to the frame if necessary
+  if (stack_slot_needs_write(index, value)) {
+    write_value_to_frame(
+      SharkType::to_stackType(value->basic_type()),
+      value->generic_value(),
+      adjusted_offset(value, offset));
+  }
+
+  // Record the value in the oopmap if necessary
+  if (stack_slot_needs_oopmap(index, value)) {
+    oopmap()->set_oop(slot2reg(offset));
+  }
+
+  // Record the value in the debuginfo if necessary
+  if (stack_slot_needs_debuginfo(index, value)) {
+    exparray()->append(slot2lv(offset, stack_location_type(index, addr)));
+  }
+}
+
+void SharkDecacher::start_monitors(int num_monitors) {
+  // Create the array we'll record our monitors in
+  _monarray = new GrowableArray<MonitorValue*>(num_monitors);
+}
+
+void SharkDecacher::process_monitor(int index, int box_offset, int obj_offset) {
+  oopmap()->set_oop(slot2reg(obj_offset));
+
+  monarray()->append(new MonitorValue(
+    slot2lv (obj_offset, Location::oop),
+    slot2loc(box_offset, Location::normal)));
+}
+
+void SharkDecacher::process_oop_tmp_slot(Value** value, int offset) {
+  // Decache the temporary oop slot
+  if (*value) {
+    write_value_to_frame(
+      SharkType::oop_type(),
+      *value,
+      offset);
+
+    oopmap()->set_oop(slot2reg(offset));
+  }
+}
+
+void SharkDecacher::process_method_slot(Value** value, int offset) {
+  // Decache the method pointer
+  write_value_to_frame(
+    SharkType::methodOop_type(),
+    *value,
+    offset);
+
+  oopmap()->set_oop(slot2reg(offset));
+}
+
+void SharkDecacher::process_pc_slot(int offset) {
+  // Record the PC
+  builder()->CreateStore(
+    builder()->code_buffer_address(pc_offset()),
+    stack()->slot_addr(offset));
+}
+
+void SharkDecacher::start_locals() {
+  // Create the array we'll record our local variables in
+  _locarray = new GrowableArray<ScopeValue*>(max_locals());}
+
+void SharkDecacher::process_local_slot(int          index,
+                                       SharkValue** addr,
+                                       int          offset) {
+  SharkValue *value = *addr;
+
+  // Write the value to the frame if necessary
+  if (local_slot_needs_write(index, value)) {
+    write_value_to_frame(
+      SharkType::to_stackType(value->basic_type()),
+      value->generic_value(),
+      adjusted_offset(value, offset));
+  }
+
+  // Record the value in the oopmap if necessary
+  if (local_slot_needs_oopmap(index, value)) {
+    oopmap()->set_oop(slot2reg(offset));
+  }
+
+  // Record the value in the debuginfo if necessary
+  if (local_slot_needs_debuginfo(index, value)) {
+    locarray()->append(slot2lv(offset, local_location_type(index, addr)));
+  }
+}
+
+void SharkDecacher::end_frame() {
+  // Record the scope
+  debug_info()->describe_scope(
+    pc_offset(),
+    target(),
+    bci(),
+    true,
+    false,
+    false,
+    debug_info()->create_scope_values(locarray()),
+    debug_info()->create_scope_values(exparray()),
+    debug_info()->create_monitor_values(monarray()));
+
+  // Finish recording the debug information
+  debug_info()->end_safepoint(pc_offset());
+}
+
+void SharkCacher::process_stack_slot(int          index,
+                                     SharkValue** addr,
+                                     int          offset) {
+  SharkValue *value = *addr;
+
+  // Read the value from the frame if necessary
+  if (stack_slot_needs_read(index, value)) {
+    *addr = SharkValue::create_generic(
+      value->type(),
+      read_value_from_frame(
+        SharkType::to_stackType(value->basic_type()),
+        adjusted_offset(value, offset)),
+      value->zero_checked());
+  }
+}
+
+void SharkOSREntryCacher::process_monitor(int index,
+                                          int box_offset,
+                                          int obj_offset) {
+  // Copy the monitor from the OSR buffer to the frame
+  int src_offset = max_locals() + index * 2;
+  builder()->CreateStore(
+    builder()->CreateLoad(
+      CreateAddressOfOSRBufEntry(src_offset, SharkType::intptr_type())),
+    stack()->slot_addr(box_offset, SharkType::intptr_type()));
+  builder()->CreateStore(
+    builder()->CreateLoad(
+      CreateAddressOfOSRBufEntry(src_offset + 1, SharkType::oop_type())),
+    stack()->slot_addr(obj_offset, SharkType::oop_type()));
+}
+
+void SharkCacher::process_oop_tmp_slot(Value** value, int offset) {
+  // Cache the temporary oop
+  if (*value)
+    *value = read_value_from_frame(SharkType::oop_type(), offset);
+}
+
+void SharkCacher::process_method_slot(Value** value, int offset) {
+  // Cache the method pointer
+  *value = read_value_from_frame(SharkType::methodOop_type(), offset);
+}
+
+void SharkFunctionEntryCacher::process_method_slot(Value** value, int offset) {
+  // "Cache" the method pointer
+  *value = method();
+}
+
+void SharkCacher::process_local_slot(int          index,
+                                     SharkValue** addr,
+                                     int          offset) {
+  SharkValue *value = *addr;
+
+  // Read the value from the frame if necessary
+  if (local_slot_needs_read(index, value)) {
+    *addr = SharkValue::create_generic(
+      value->type(),
+      read_value_from_frame(
+        SharkType::to_stackType(value->basic_type()),
+        adjusted_offset(value, offset)),
+      value->zero_checked());
+  }
+}
+
+Value* SharkOSREntryCacher::CreateAddressOfOSRBufEntry(int         offset,
+                                                       const Type* type) {
+  Value *result = builder()->CreateStructGEP(osr_buf(), offset);
+  if (type != SharkType::intptr_type())
+    result = builder()->CreateBitCast(result, PointerType::getUnqual(type));
+  return result;
+}
+
+void SharkOSREntryCacher::process_local_slot(int          index,
+                                             SharkValue** addr,
+                                             int          offset) {
+  SharkValue *value = *addr;
+
+  // Read the value from the OSR buffer if necessary
+  if (local_slot_needs_read(index, value)) {
+    *addr = SharkValue::create_generic(
+      value->type(),
+      builder()->CreateLoad(
+        CreateAddressOfOSRBufEntry(
+          adjusted_offset(value, max_locals() - 1 - index),
+          SharkType::to_stackType(value->basic_type()))),
+      value->zero_checked());
+  }
+}
+
+void SharkDecacher::write_value_to_frame(const Type* type,
+                                         Value*      value,
+                                         int         offset) {
+  builder()->CreateStore(value, stack()->slot_addr(offset, type));
+}
+
+Value* SharkCacher::read_value_from_frame(const Type* type, int offset) {
+  return builder()->CreateLoad(stack()->slot_addr(offset, type));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkCacheDecache.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,417 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+// Class hierarchy:
+// - SharkStateScanner
+//   - SharkCacherDecacher
+//     - SharkDecacher
+//       - SharkJavaCallDecacher
+//       - SharkVMCallDecacher
+//       - SharkTrapDecacher
+//     - SharkCacher
+//       - SharkJavaCallCacher
+//       - SharkVMCallCacher
+//       - SharkFunctionEntryCacher
+//         - SharkNormalEntryCacher
+//         - SharkOSREntryCacher
+
+class SharkCacherDecacher : public SharkStateScanner {
+ protected:
+  SharkCacherDecacher(SharkFunction* function)
+    : SharkStateScanner(function) {}
+
+  // Helper
+ protected:
+  static int adjusted_offset(SharkValue* value, int offset) {
+    if (value->is_two_word())
+      offset--;
+    return offset;
+  }
+};
+
+class SharkDecacher : public SharkCacherDecacher {
+ protected:
+  SharkDecacher(SharkFunction* function, int bci)
+    : SharkCacherDecacher(function), _bci(bci) {}
+
+ private:
+  int _bci;
+
+ protected:
+  int bci() const {
+    return _bci;
+  }
+
+ private:
+  int                           _pc_offset;
+  OopMap*                       _oopmap;
+  GrowableArray<ScopeValue*>*   _exparray;
+  GrowableArray<MonitorValue*>* _monarray;
+  GrowableArray<ScopeValue*>*   _locarray;
+
+ private:
+  int pc_offset() const {
+    return _pc_offset;
+  }
+  OopMap* oopmap() const {
+    return _oopmap;
+  }
+  GrowableArray<ScopeValue*>* exparray() const {
+    return _exparray;
+  }
+  GrowableArray<MonitorValue*>* monarray() const {
+    return _monarray;
+  }
+  GrowableArray<ScopeValue*>* locarray() const {
+    return _locarray;
+  }
+
+  // Callbacks
+ protected:
+  void start_frame();
+
+  void start_stack(int stack_depth);
+  void process_stack_slot(int index, SharkValue** value, int offset);
+
+  void start_monitors(int num_monitors);
+  void process_monitor(int index, int box_offset, int obj_offset);
+
+  void process_oop_tmp_slot(llvm::Value** value, int offset);
+  void process_method_slot(llvm::Value** value, int offset);
+  void process_pc_slot(int offset);
+
+  void start_locals();
+  void process_local_slot(int index, SharkValue** value, int offset);
+
+  void end_frame();
+
+  // oopmap and debuginfo helpers
+ private:
+  static int oopmap_slot_munge(int offset) {
+    return SharkStack::oopmap_slot_munge(offset);
+  }
+  static VMReg slot2reg(int offset) {
+    return SharkStack::slot2reg(offset);
+  }
+  static Location slot2loc(int offset, Location::Type type) {
+    return Location::new_stk_loc(type, offset * wordSize);
+  }
+  static LocationValue* slot2lv(int offset, Location::Type type) {
+    return new LocationValue(slot2loc(offset, type));
+  }
+  static Location::Type location_type(SharkValue** addr, bool maybe_two_word) {
+    // low addresses this end
+    //                           Type       32-bit    64-bit
+    //   ----------------------------------------------------
+    //   stack[0]    local[3]    jobject    oop       oop
+    //   stack[1]    local[2]    NULL       normal    lng
+    //   stack[2]    local[1]    jlong      normal    invalid
+    //   stack[3]    local[0]    jint       normal    normal
+    //
+    // high addresses this end
+
+    SharkValue *value = *addr;
+    if (value) {
+      if (value->is_jobject())
+        return Location::oop;
+#ifdef _LP64
+      if (value->is_two_word())
+        return Location::invalid;
+#endif // _LP64
+      return Location::normal;
+    }
+    else {
+      if (maybe_two_word) {
+        value = *(addr - 1);
+        if (value && value->is_two_word()) {
+#ifdef _LP64
+          if (value->is_jlong())
+            return Location::lng;
+          if (value->is_jdouble())
+            return Location::dbl;
+          ShouldNotReachHere();
+#else
+          return Location::normal;
+#endif // _LP64
+        }
+      }
+      return Location::invalid;
+    }
+  }
+
+  // Stack slot helpers
+ protected:
+  virtual bool stack_slot_needs_write(int index, SharkValue* value) = 0;
+  virtual bool stack_slot_needs_oopmap(int index, SharkValue* value) = 0;
+  virtual bool stack_slot_needs_debuginfo(int index, SharkValue* value) = 0;
+
+  static Location::Type stack_location_type(int index, SharkValue** addr) {
+    return location_type(addr, *addr == NULL);
+  }
+
+  // Local slot helpers
+ protected:
+  virtual bool local_slot_needs_write(int index, SharkValue* value) = 0;
+  virtual bool local_slot_needs_oopmap(int index, SharkValue* value) = 0;
+  virtual bool local_slot_needs_debuginfo(int index, SharkValue* value) = 0;
+
+  static Location::Type local_location_type(int index, SharkValue** addr) {
+    return location_type(addr, index > 0);
+  }
+
+  // Writer helper
+ protected:
+  void write_value_to_frame(const llvm::Type* type,
+                            llvm::Value*      value,
+                            int               offset);
+};
+
+class SharkJavaCallDecacher : public SharkDecacher {
+ public:
+  SharkJavaCallDecacher(SharkFunction* function, int bci, ciMethod* callee)
+    : SharkDecacher(function, bci), _callee(callee) {}
+
+ private:
+  ciMethod* _callee;
+
+ protected:
+  ciMethod* callee() const {
+    return _callee;
+  }
+
+  // Stack slot helpers
+ protected:
+  bool stack_slot_needs_write(int index, SharkValue* value) {
+    return value && (index < callee()->arg_size() || value->is_jobject());
+  }
+  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject() && index >= callee()->arg_size();
+  }
+  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
+    return index >= callee()->arg_size();
+  }
+
+  // Local slot helpers
+ protected:
+  bool local_slot_needs_write(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+};
+
+class SharkVMCallDecacher : public SharkDecacher {
+ public:
+  SharkVMCallDecacher(SharkFunction* function, int bci)
+    : SharkDecacher(function, bci) {}
+
+  // Stack slot helpers
+ protected:
+  bool stack_slot_needs_write(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+
+  // Local slot helpers
+ protected:
+  bool local_slot_needs_write(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+};
+
+class SharkTrapDecacher : public SharkDecacher {
+ public:
+  SharkTrapDecacher(SharkFunction* function, int bci)
+    : SharkDecacher(function, bci) {}
+
+  // Stack slot helpers
+ protected:
+  bool stack_slot_needs_write(int index, SharkValue* value) {
+    return value != NULL;
+  }
+  bool stack_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool stack_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+
+  // Local slot helpers
+ protected:
+  bool local_slot_needs_write(int index, SharkValue* value) {
+    return value != NULL;
+  }
+  bool local_slot_needs_oopmap(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+  bool local_slot_needs_debuginfo(int index, SharkValue* value) {
+    return true;
+  }
+};
+
+class SharkCacher : public SharkCacherDecacher {
+ protected:
+  SharkCacher(SharkFunction* function)
+    : SharkCacherDecacher(function) {}
+
+  // Callbacks
+ protected:
+  void process_stack_slot(int index, SharkValue** value, int offset);
+
+  void process_oop_tmp_slot(llvm::Value** value, int offset);
+  virtual void process_method_slot(llvm::Value** value, int offset);
+
+  virtual void process_local_slot(int index, SharkValue** value, int offset);
+
+  // Stack slot helper
+ protected:
+  virtual bool stack_slot_needs_read(int index, SharkValue* value) = 0;
+
+  // Local slot helper
+ protected:
+  virtual bool local_slot_needs_read(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+
+  // Writer helper
+ protected:
+  llvm::Value* read_value_from_frame(const llvm::Type* type, int offset);
+};
+
+class SharkJavaCallCacher : public SharkCacher {
+ public:
+  SharkJavaCallCacher(SharkFunction* function, ciMethod* callee)
+    : SharkCacher(function), _callee(callee) {}
+
+ private:
+  ciMethod* _callee;
+
+ protected:
+  ciMethod* callee() const {
+    return _callee;
+  }
+
+  // Stack slot helper
+ protected:
+  bool stack_slot_needs_read(int index, SharkValue* value) {
+    return value && (index < callee()->return_type()->size() ||
+                     value->is_jobject());
+  }
+};
+
+class SharkVMCallCacher : public SharkCacher {
+ public:
+  SharkVMCallCacher(SharkFunction* function)
+    : SharkCacher(function) {}
+
+  // Stack slot helper
+ protected:
+  bool stack_slot_needs_read(int index, SharkValue* value) {
+    return value && value->is_jobject();
+  }
+};
+
+class SharkFunctionEntryCacher : public SharkCacher {
+ public:
+  SharkFunctionEntryCacher(SharkFunction* function, llvm::Value* method)
+    : SharkCacher(function), _method(method) {}
+
+ private:
+  llvm::Value* _method;
+
+ private:
+  llvm::Value* method() const {
+    return _method;
+  }
+
+  // Method slot callback
+ protected:
+  void process_method_slot(llvm::Value** value, int offset);
+
+  // Stack slot helper
+ protected:
+  bool stack_slot_needs_read(int index, SharkValue* value) {
+    ShouldNotReachHere(); // entry block shouldn't have stack
+  }
+
+  // Local slot helper
+ protected:
+  bool local_slot_needs_read(int index, SharkValue* value) {
+    return value != NULL;
+  }
+};
+
+class SharkNormalEntryCacher : public SharkFunctionEntryCacher {
+ public:
+  SharkNormalEntryCacher(SharkFunction* function, llvm::Value* method)
+    : SharkFunctionEntryCacher(function, method) {}
+};
+
+class SharkOSREntryCacher : public SharkFunctionEntryCacher {
+ public:
+  SharkOSREntryCacher(SharkFunction* function,
+                      llvm::Value*   method,
+                      llvm::Value*   osr_buf)
+    : SharkFunctionEntryCacher(function, method),
+      _osr_buf(
+        builder()->CreateBitCast(
+          osr_buf,
+          llvm::PointerType::getUnqual(
+            llvm::ArrayType::get(
+              SharkType::intptr_type(),
+              max_locals() + max_monitors() * 2)))) {}
+
+ private:
+  llvm::Value* _osr_buf;
+
+ private:
+  llvm::Value* osr_buf() const {
+    return _osr_buf;
+  }
+
+  // Callbacks
+ protected:
+  void process_monitor(int index, int box_offset, int obj_offset);
+  void process_local_slot(int index, SharkValue** value, int offset);
+
+  // Helper
+ private:
+  llvm::Value* CreateAddressOfOSRBufEntry(int offset, const llvm::Type* type);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkCodeBuffer.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,87 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkCodeBuffer : public StackObj {
+ public:
+  SharkCodeBuffer(MacroAssembler* masm)
+    : _masm(masm), _base_pc(NULL) {}
+
+ private:
+  MacroAssembler* _masm;
+  llvm::Value*    _base_pc;
+
+ private:
+  MacroAssembler* masm() const {
+    return _masm;
+  }
+
+ public:
+  llvm::Value* base_pc() const {
+    return _base_pc;
+  }
+  void set_base_pc(llvm::Value* base_pc) {
+    assert(_base_pc == NULL, "only do this once");
+    _base_pc = base_pc;
+  }
+
+  // Allocate some space in the buffer and return its address.
+  // This buffer will have been relocated by the time the method
+  // is installed, so you can't inline the result in code.
+ public:
+  void* malloc(size_t size) const {
+    masm()->align(BytesPerWord);
+    void *result = masm()->pc();
+    masm()->advance(size);
+    return result;
+  }
+
+  // Create a unique offset in the buffer.
+ public:
+  int create_unique_offset() const {
+    int offset = masm()->offset();
+    masm()->advance(1);
+    return offset;
+  }
+
+  // Inline an oop into the buffer and return its offset.
+ public:
+  int inline_oop(jobject object) const {
+    masm()->align(BytesPerWord);
+    int offset = masm()->offset();
+    masm()->store_oop(object);
+    return offset;
+  }
+
+  // Inline a block of non-oop data into the buffer and return its offset.
+ public:
+  int inline_data(void *src, size_t size) const {
+    masm()->align(BytesPerWord);
+    int offset = masm()->offset();
+    void *dst = masm()->pc();
+    masm()->advance(size);
+    memcpy(dst, src, size);
+    return offset;
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkCompiler.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,340 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkCompiler.cpp.incl"
+
+#include <fnmatch.h>
+
+using namespace llvm;
+
+#if SHARK_LLVM_VERSION >= 27
+namespace {
+  cl::opt<std::string>
+  MCPU("mcpu");
+
+  cl::list<std::string>
+  MAttrs("mattr",
+         cl::CommaSeparated);
+}
+#endif
+
+SharkCompiler::SharkCompiler()
+  : AbstractCompiler() {
+  // Create the lock to protect the memory manager and execution engine
+  _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock");
+  MutexLocker locker(execution_engine_lock());
+
+  // Make LLVM safe for multithreading
+  if (!llvm_start_multithreaded())
+    fatal("llvm_start_multithreaded() failed");
+
+  // Initialize the native target
+  InitializeNativeTarget();
+
+  // Create the two contexts which we'll use
+  _normal_context = new SharkContext("normal");
+  _native_context = new SharkContext("native");
+
+  // Create the memory manager
+  _memory_manager = new SharkMemoryManager();
+
+#if SHARK_LLVM_VERSION >= 27
+  // Finetune LLVM for the current host CPU.
+  StringMap<bool> Features;
+  bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features);
+  std::string cpu("-mcpu=" + llvm::sys::getHostCPUName());
+
+  std::vector<const char*> args;
+  args.push_back(""); // program name
+  args.push_back(cpu.c_str());
+
+  std::string mattr("-mattr=");
+  if(gotCpuFeatures){
+    for(StringMap<bool>::iterator I = Features.begin(),
+      E = Features.end(); I != E; ++I){
+      if(I->second){
+        std::string attr(I->first());
+        mattr+="+"+attr+",";
+      }
+    }
+    args.push_back(mattr.c_str());
+  }
+
+  args.push_back(0);  // terminator
+  cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
+
+  // Create the JIT
+  std::string ErrorMsg;
+
+  EngineBuilder builder(_normal_context->module());
+  builder.setMCPU(MCPU);
+  builder.setMAttrs(MAttrs);
+  builder.setJITMemoryManager(memory_manager());
+  builder.setEngineKind(EngineKind::JIT);
+  builder.setErrorStr(&ErrorMsg);
+  _execution_engine = builder.create();
+
+  if (!execution_engine()) {
+    if (!ErrorMsg.empty())
+      printf("Error while creating Shark JIT: %s\n",ErrorMsg.c_str());
+    else
+      printf("Unknown error while creating Shark JIT\n");
+    exit(1);
+  }
+
+  execution_engine()->addModule(
+    _native_context->module());
+#else
+  _execution_engine = ExecutionEngine::createJIT(
+    _normal_context->module_provider(),
+    NULL, memory_manager(), CodeGenOpt::Default);
+  execution_engine()->addModuleProvider(
+    _native_context->module_provider());
+#endif
+
+  // All done
+  mark_initialized();
+}
+
+void SharkCompiler::initialize() {
+  ShouldNotCallThis();
+}
+
+void SharkCompiler::compile_method(ciEnv*    env,
+                                   ciMethod* target,
+                                   int       entry_bci) {
+  assert(is_initialized(), "should be");
+  ResourceMark rm;
+  const char *name = methodname(
+    target->holder()->name()->as_utf8(), target->name()->as_utf8());
+
+  // Do the typeflow analysis
+  ciTypeFlow *flow;
+  if (entry_bci == InvocationEntryBci)
+    flow = target->get_flow_analysis();
+  else
+    flow = target->get_osr_flow_analysis(entry_bci);
+  if (flow->failing())
+    return;
+  if (SharkPrintTypeflowOf != NULL) {
+    if (!fnmatch(SharkPrintTypeflowOf, name, 0))
+      flow->print_on(tty);
+  }
+
+  // Create the recorders
+  Arena arena;
+  env->set_oop_recorder(new OopRecorder(&arena));
+  OopMapSet oopmaps;
+  env->set_debug_info(new DebugInformationRecorder(env->oop_recorder()));
+  env->debug_info()->set_oopmaps(&oopmaps);
+  env->set_dependencies(new Dependencies(env));
+
+  // Create the code buffer and builder
+  CodeBuffer hscb("Shark", 256 * K, 64 * K);
+  hscb.initialize_oop_recorder(env->oop_recorder());
+  MacroAssembler *masm = new MacroAssembler(&hscb);
+  SharkCodeBuffer cb(masm);
+  SharkBuilder builder(&cb);
+
+  // Emit the entry point
+  SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry));
+
+  // Build the LLVM IR for the method
+  Function *function = SharkFunction::build(env, &builder, flow, name);
+
+  // Generate native code.  It's unpleasant that we have to drop into
+  // the VM to do this -- it blocks safepoints -- but I can't see any
+  // other way to handle the locking.
+  {
+    ThreadInVMfromNative tiv(JavaThread::current());
+    generate_native_code(entry, function, name);
+  }
+
+  // Install the method into the VM
+  CodeOffsets offsets;
+  offsets.set_value(CodeOffsets::Deopt, 0);
+  offsets.set_value(CodeOffsets::Exceptions, 0);
+  offsets.set_value(CodeOffsets::Verified_Entry,
+                    target->is_static() ? 0 : wordSize);
+
+  ExceptionHandlerTable handler_table;
+  ImplicitExceptionTable inc_table;
+
+  env->register_method(target,
+                       entry_bci,
+                       &offsets,
+                       0,
+                       &hscb,
+                       0,
+                       &oopmaps,
+                       &handler_table,
+                       &inc_table,
+                       this,
+                       env->comp_level(),
+                       false,
+                       false);
+}
+
+nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
+                                                methodHandle    target,
+                                                BasicType*      arg_types,
+                                                BasicType       return_type) {
+  assert(is_initialized(), "should be");
+  ResourceMark rm;
+  const char *name = methodname(
+    target->klass_name()->as_utf8(), target->name()->as_utf8());
+
+  // Create the code buffer and builder
+  SharkCodeBuffer cb(masm);
+  SharkBuilder builder(&cb);
+
+  // Emit the entry point
+  SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry));
+
+  // Build the LLVM IR for the method
+  SharkNativeWrapper *wrapper = SharkNativeWrapper::build(
+    &builder, target, name, arg_types, return_type);
+
+  // Generate native code
+  generate_native_code(entry, wrapper->function(), name);
+
+  // Return the nmethod for installation in the VM
+  return nmethod::new_native_nmethod(target,
+                                     masm->code(),
+                                     0,
+                                     0,
+                                     wrapper->frame_size(),
+                                     wrapper->receiver_offset(),
+                                     wrapper->lock_offset(),
+                                     wrapper->oop_maps());
+}
+
+void SharkCompiler::generate_native_code(SharkEntry* entry,
+                                         Function*   function,
+                                         const char* name) {
+  // Print the LLVM bitcode, if requested
+  if (SharkPrintBitcodeOf != NULL) {
+    if (!fnmatch(SharkPrintBitcodeOf, name, 0))
+      function->dump();
+  }
+
+  // Compile to native code
+  address code = NULL;
+  context()->add_function(function);
+  {
+    MutexLocker locker(execution_engine_lock());
+    free_queued_methods();
+
+    if (SharkPrintAsmOf != NULL) {
+#if SHARK_LLVM_VERSION >= 27
+#ifndef NDEBUG
+      if (!fnmatch(SharkPrintAsmOf, name, 0)) {
+        llvm::SetCurrentDebugType(X86_ONLY("x86-emitter") NOT_X86("jit"));
+        llvm::DebugFlag = true;
+      }
+      else {
+        llvm::SetCurrentDebugType("");
+        llvm::DebugFlag = false;
+      }
+#endif // !NDEBUG
+#else
+      // NB you need to patch LLVM with http://tinyurl.com/yf3baln for this
+      std::vector<const char*> args;
+      args.push_back(""); // program name
+      if (!fnmatch(SharkPrintAsmOf, name, 0))
+        args.push_back("-debug-only=x86-emitter");
+      else
+        args.push_back("-debug-only=none");
+      args.push_back(0);  // terminator
+      cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
+#endif // SHARK_LLVM_VERSION
+    }
+    memory_manager()->set_entry_for_function(function, entry);
+    code = (address) execution_engine()->getPointerToFunction(function);
+  }
+  entry->set_entry_point(code);
+  entry->set_function(function);
+  entry->set_context(context());
+  address code_start = entry->code_start();
+  address code_limit = entry->code_limit();
+
+  // Register generated code for profiling, etc
+  if (JvmtiExport::should_post_dynamic_code_generated())
+    JvmtiExport::post_dynamic_code_generated(name, code_start, code_limit);
+
+  // Print debug information, if requested
+  if (SharkTraceInstalls) {
+    tty->print_cr(
+      " [%p-%p): %s (%d bytes code)",
+      code_start, code_limit, name, code_limit - code_start);
+  }
+}
+
+void SharkCompiler::free_compiled_method(address code) {
+  // This method may only be called when the VM is at a safepoint.
+  // All _thread_in_vm threads will be waiting for the safepoint to
+  // finish with the exception of the VM thread, so we can consider
+  // ourself the owner of the execution engine lock even though we
+  // can't actually acquire it at this time.
+  assert(Thread::current()->is_VM_thread(), "must be called by VM thread");
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+
+  SharkEntry *entry = (SharkEntry *) code;
+  entry->context()->push_to_free_queue(entry->function());
+}
+
+void SharkCompiler::free_queued_methods() {
+  // The free queue is protected by the execution engine lock
+  assert(execution_engine_lock()->owned_by_self(), "should be");
+
+  while (true) {
+    Function *function = context()->pop_from_free_queue();
+    if (function == NULL)
+      break;
+
+    execution_engine()->freeMachineCodeForFunction(function);
+    function->eraseFromParent();
+  }
+}
+
+const char* SharkCompiler::methodname(const char* klass, const char* method) {
+  char *buf = NEW_RESOURCE_ARRAY(char, strlen(klass) + 2 + strlen(method) + 1);
+
+  char *dst = buf;
+  for (const char *c = klass; *c; c++) {
+    if (*c == '/')
+      *(dst++) = '.';
+    else
+      *(dst++) = *c;
+  }
+  *(dst++) = ':';
+  *(dst++) = ':';
+  for (const char *c = method; *c; c++) {
+    *(dst++) = *c;
+  }
+  *(dst++) = '\0';
+  return buf;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkCompiler.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,119 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkContext;
+
+class SharkCompiler : public AbstractCompiler {
+ public:
+  // Creation
+  SharkCompiler();
+
+  // Name of this compiler
+  const char *name()     { return "shark"; }
+
+  // Missing feature tests
+  bool supports_native() { return true; }
+  bool supports_osr()    { return true; }
+
+  // Customization
+  bool needs_adapters()  { return false; }
+  bool needs_stubs()     { return false; }
+
+  // Initialization
+  void initialize();
+
+  // Compile a normal (bytecode) method and install it in the VM
+  void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
+
+  // Generate a wrapper for a native (JNI) method
+  nmethod* generate_native_wrapper(MacroAssembler* masm,
+                                   methodHandle    target,
+                                   BasicType*      arg_types,
+                                   BasicType       return_type);
+
+  // Free compiled methods (and native wrappers)
+  void free_compiled_method(address code);
+
+  // Each thread generating IR needs its own context.  The normal
+  // context is used for bytecode methods, and is protected from
+  // multiple simultaneous accesses by being restricted to the
+  // compiler thread.  The native context is used for JNI methods,
+  // and is protected from multiple simultaneous accesses by the
+  // adapter handler library lock.
+ private:
+  SharkContext* _normal_context;
+  SharkContext* _native_context;
+
+ public:
+  SharkContext* context() const {
+    if (JavaThread::current()->is_Compiler_thread()) {
+      return _normal_context;
+    }
+    else {
+      assert(AdapterHandlerLibrary_lock->owned_by_self(), "should be");
+      return _native_context;
+    }
+  }
+
+  // The LLVM execution engine is the JIT we use to generate native
+  // code.  It is thread safe, but we need to protect it with a lock
+  // of our own because otherwise LLVM's lock and HotSpot's locks
+  // interleave and deadlock.  The SharkMemoryManager is not thread
+  // safe, and is protected by the same lock as the execution engine.
+ private:
+  Monitor*               _execution_engine_lock;
+  SharkMemoryManager*    _memory_manager;
+  llvm::ExecutionEngine* _execution_engine;
+
+ private:
+  Monitor* execution_engine_lock() const {
+    return _execution_engine_lock;
+  }
+  SharkMemoryManager* memory_manager() const {
+    assert(execution_engine_lock()->owned_by_self(), "should be");
+    return _memory_manager;
+  }
+  llvm::ExecutionEngine* execution_engine() const {
+    assert(execution_engine_lock()->owned_by_self(), "should be");
+    return _execution_engine;
+  }
+
+  // Global access
+ public:
+  static SharkCompiler* compiler() {
+    AbstractCompiler *compiler =
+      CompileBroker::compiler(CompLevel_fast_compile);
+    assert(compiler->is_shark() && compiler->is_initialized(), "should be");
+    return (SharkCompiler *) compiler;
+  }
+
+  // Helpers
+ private:
+  static const char* methodname(const char* klass, const char* method);
+  void generate_native_code(SharkEntry*     entry,
+                            llvm::Function* function,
+                            const char*     name);
+  void free_queued_methods();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkConstant.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,128 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkConstant.cpp.incl"
+
+using namespace llvm;
+
+SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
+  ciConstant constant = iter->get_constant();
+  ciType *type = NULL;
+  if (constant.basic_type() == T_OBJECT) {
+    ciEnv *env = ciEnv::current();
+    if (constant.as_object()->is_klass())
+      type = env->Class_klass();
+    else
+      type = env->String_klass();
+  }
+  return new SharkConstant(constant, type);
+}
+
+SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) {
+  bool will_link;
+  ciField *field = iter->get_field(will_link);
+  assert(will_link, "typeflow responsibility");
+
+  return new SharkConstant(field->constant_value(), field->type());
+}
+
+SharkConstant::SharkConstant(ciConstant constant, ciType *type) {
+  SharkValue *value = NULL;
+
+  switch (constant.basic_type()) {
+  case T_BOOLEAN:
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    value = SharkValue::jint_constant(constant.as_int());
+    break;
+
+  case T_LONG:
+    value = SharkValue::jlong_constant(constant.as_long());
+    break;
+
+  case T_FLOAT:
+    value = SharkValue::jfloat_constant(constant.as_float());
+    break;
+
+  case T_DOUBLE:
+    value = SharkValue::jdouble_constant(constant.as_double());
+    break;
+
+  case T_OBJECT:
+  case T_ARRAY:
+    break;
+
+  case T_ILLEGAL:
+    // out of memory
+    _is_loaded = false;
+    return;
+
+  default:
+    tty->print_cr("Unhandled type %s", type2name(constant.basic_type()));
+    ShouldNotReachHere();
+  }
+
+  // Handle primitive types.  We create SharkValues for these
+  // now; doing so doesn't emit any code, and it allows us to
+  // delegate a bunch of stuff to the SharkValue code.
+  if (value) {
+    _value       = value;
+    _is_loaded   = true;
+    _is_nonzero  = value->zero_checked();
+    _is_two_word = value->is_two_word();
+    return;
+  }
+
+  // Handle reference types.  This is tricky because some
+  // ciObjects are psuedo-objects that refer to oops which
+  // have yet to be created.  We need to spot the unloaded
+  // objects (which differ between ldc* and get*, thanks!)
+  ciObject *object = constant.as_object();
+  assert(type != NULL, "shouldn't be");
+  if (object->is_klass()) {
+    // The constant returned for a klass is the ciKlass
+    // for the entry, but we want the java_mirror.
+    ciKlass *klass = object->as_klass();
+    if (!klass->is_loaded()) {
+      _is_loaded = false;
+      return;
+    }
+    object = klass->java_mirror();
+  }
+  if (object->is_null_object() || !object->can_be_constant()) {
+    _is_loaded = false;
+    return;
+  }
+
+  _value       = NULL;
+  _object      = object;
+  _type        = type;
+  _is_loaded   = true;
+  _is_nonzero  = true;
+  _is_two_word = false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkConstant.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkConstant : public ResourceObj {
+ public:
+  static SharkConstant* for_ldc(ciBytecodeStream* iter);
+  static SharkConstant* for_field(ciBytecodeStream* iter);
+
+ private:
+  SharkConstant(ciConstant constant, ciType* type);
+
+ private:
+  SharkValue* _value;
+  ciObject*   _object;
+  ciType*     _type;
+  bool        _is_loaded;
+  bool        _is_nonzero;
+  bool        _is_two_word;
+
+ public:
+  bool is_loaded() const {
+    return _is_loaded;
+  }
+  bool is_nonzero() const {
+    assert(is_loaded(), "should be");
+    return _is_nonzero;
+  }
+  bool is_two_word() const {
+    assert(is_loaded(), "should be");
+    return _is_two_word;
+  }
+
+ public:
+  SharkValue* value(SharkBuilder* builder) {
+    assert(is_loaded(), "should be");
+    if (_value == NULL) {
+      _value = SharkValue::create_generic(
+        _type, builder->CreateInlineOop(_object), _is_nonzero);
+    }
+    return _value;
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkContext.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,180 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkContext.cpp.incl"
+
+using namespace llvm;
+
+SharkContext::SharkContext(const char* name)
+  : LLVMContext(),
+    _free_queue(NULL) {
+  // Create a module to build our functions into
+  _module = new Module(name, *this);
+
+  // Create basic types
+  _void_type    = Type::getVoidTy(*this);
+  _bit_type     = Type::getInt1Ty(*this);
+  _jbyte_type   = Type::getInt8Ty(*this);
+  _jshort_type  = Type::getInt16Ty(*this);
+  _jint_type    = Type::getInt32Ty(*this);
+  _jlong_type   = Type::getInt64Ty(*this);
+  _jfloat_type  = Type::getFloatTy(*this);
+  _jdouble_type = Type::getDoubleTy(*this);
+
+  // Create compound types
+  _itableOffsetEntry_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), itableOffsetEntry::size() * wordSize));
+
+  _klass_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(Klass)));
+
+  _jniEnv_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(JNIEnv)));
+
+  _jniHandleBlock_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(JNIHandleBlock)));
+
+  _methodOop_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(methodOopDesc)));
+
+  _monitor_type = ArrayType::get(
+    jbyte_type(), frame::interpreter_frame_monitor_size() * wordSize);
+
+  _oop_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(oopDesc)));
+
+  _thread_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(JavaThread)));
+
+  _zeroStack_type = PointerType::getUnqual(
+    ArrayType::get(jbyte_type(), sizeof(ZeroStack)));
+
+  std::vector<const Type*> params;
+  params.push_back(methodOop_type());
+  params.push_back(intptr_type());
+  params.push_back(thread_type());
+  _entry_point_type = FunctionType::get(jint_type(), params, false);
+
+  params.clear();
+  params.push_back(methodOop_type());
+  params.push_back(PointerType::getUnqual(jbyte_type()));
+  params.push_back(intptr_type());
+  params.push_back(thread_type());
+  _osr_entry_point_type = FunctionType::get(jint_type(), params, false);
+
+  // Create mappings
+  for (int i = 0; i < T_CONFLICT; i++) {
+    switch (i) {
+    case T_BOOLEAN:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jbyte_type();
+      break;
+
+    case T_BYTE:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jbyte_type();
+      break;
+
+    case T_CHAR:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jshort_type();
+      break;
+
+    case T_SHORT:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jshort_type();
+      break;
+
+    case T_INT:
+      _to_stackType[i] = jint_type();
+      _to_arrayType[i] = jint_type();
+      break;
+
+    case T_LONG:
+      _to_stackType[i] = jlong_type();
+      _to_arrayType[i] = jlong_type();
+      break;
+
+    case T_FLOAT:
+      _to_stackType[i] = jfloat_type();
+      _to_arrayType[i] = jfloat_type();
+      break;
+
+    case T_DOUBLE:
+      _to_stackType[i] = jdouble_type();
+      _to_arrayType[i] = jdouble_type();
+      break;
+
+    case T_OBJECT:
+    case T_ARRAY:
+      _to_stackType[i] = oop_type();
+      _to_arrayType[i] = oop_type();
+      break;
+
+    case T_ADDRESS:
+      _to_stackType[i] = intptr_type();
+      _to_arrayType[i] = NULL;
+      break;
+
+    default:
+      _to_stackType[i] = NULL;
+      _to_arrayType[i] = NULL;
+    }
+  }
+}
+
+class SharkFreeQueueItem : public CHeapObj {
+ public:
+  SharkFreeQueueItem(llvm::Function* function, SharkFreeQueueItem *next)
+    : _function(function), _next(next) {}
+
+ private:
+  llvm::Function*     _function;
+  SharkFreeQueueItem* _next;
+
+ public:
+  llvm::Function* function() const {
+    return _function;
+  }
+  SharkFreeQueueItem* next() const {
+    return _next;
+  }
+};
+
+void SharkContext::push_to_free_queue(Function* function) {
+  _free_queue = new SharkFreeQueueItem(function, _free_queue);
+}
+
+Function* SharkContext::pop_from_free_queue() {
+  if (_free_queue == NULL)
+    return NULL;
+
+  SharkFreeQueueItem *item = _free_queue;
+  Function *function = item->function();
+  _free_queue = item->next();
+  delete item;
+  return function;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkContext.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,187 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+// The LLVMContext class allows multiple instances of LLVM to operate
+// independently of each other in a multithreaded context.  We extend
+// this here to store things in Shark that are LLVMContext-specific.
+
+class SharkFreeQueueItem;
+
+class SharkContext : public llvm::LLVMContext {
+ public:
+  SharkContext(const char* name);
+
+ private:
+  llvm::Module* _module;
+
+#if SHARK_LLVM_VERSION >= 27
+ public:
+#else
+ private:
+#endif
+  llvm::Module* module() const {
+    return _module;
+  }
+
+  // Get this thread's SharkContext
+ public:
+  static SharkContext& current() {
+    return *SharkCompiler::compiler()->context();
+  }
+
+  // Module accessors
+ public:
+#if SHARK_LLVM_VERSION < 27
+  llvm::ModuleProvider* module_provider() const {
+    return new llvm::ExistingModuleProvider(module());
+  }
+#endif
+  void add_function(llvm::Function* function) const {
+    module()->getFunctionList().push_back(function);
+  }
+  llvm::Constant* get_external(const char*               name,
+                               const llvm::FunctionType* sig) {
+    return module()->getOrInsertFunction(name, sig);
+  }
+
+  // Basic types
+ private:
+  const llvm::Type*        _void_type;
+  const llvm::IntegerType* _bit_type;
+  const llvm::IntegerType* _jbyte_type;
+  const llvm::IntegerType* _jshort_type;
+  const llvm::IntegerType* _jint_type;
+  const llvm::IntegerType* _jlong_type;
+  const llvm::Type*        _jfloat_type;
+  const llvm::Type*        _jdouble_type;
+
+ public:
+  const llvm::Type* void_type() const {
+    return _void_type;
+  }
+  const llvm::IntegerType* bit_type() const {
+    return _bit_type;
+  }
+  const llvm::IntegerType* jbyte_type() const {
+    return _jbyte_type;
+  }
+  const llvm::IntegerType* jshort_type() const {
+    return _jshort_type;
+  }
+  const llvm::IntegerType* jint_type() const {
+    return _jint_type;
+  }
+  const llvm::IntegerType* jlong_type() const {
+    return _jlong_type;
+  }
+  const llvm::Type* jfloat_type() const {
+    return _jfloat_type;
+  }
+  const llvm::Type* jdouble_type() const {
+    return _jdouble_type;
+  }
+  const llvm::IntegerType* intptr_type() const {
+    return LP64_ONLY(jlong_type()) NOT_LP64(jint_type());
+  }
+
+  // Compound types
+ private:
+  const llvm::PointerType*  _itableOffsetEntry_type;
+  const llvm::PointerType*  _jniEnv_type;
+  const llvm::PointerType*  _jniHandleBlock_type;
+  const llvm::PointerType*  _klass_type;
+  const llvm::PointerType*  _methodOop_type;
+  const llvm::ArrayType*    _monitor_type;
+  const llvm::PointerType*  _oop_type;
+  const llvm::PointerType*  _thread_type;
+  const llvm::PointerType*  _zeroStack_type;
+  const llvm::FunctionType* _entry_point_type;
+  const llvm::FunctionType* _osr_entry_point_type;
+
+ public:
+  const llvm::PointerType* itableOffsetEntry_type() const {
+    return _itableOffsetEntry_type;
+  }
+  const llvm::PointerType* jniEnv_type() const {
+    return _jniEnv_type;
+  }
+  const llvm::PointerType* jniHandleBlock_type() const {
+    return _jniHandleBlock_type;
+  }
+  const llvm::PointerType* klass_type() const {
+    return _klass_type;
+  }
+  const llvm::PointerType* methodOop_type() const {
+    return _methodOop_type;
+  }
+  const llvm::ArrayType* monitor_type() const {
+    return _monitor_type;
+  }
+  const llvm::PointerType* oop_type() const {
+    return _oop_type;
+  }
+  const llvm::PointerType* thread_type() const {
+    return _thread_type;
+  }
+  const llvm::PointerType* zeroStack_type() const {
+    return _zeroStack_type;
+  }
+  const llvm::FunctionType* entry_point_type() const {
+    return _entry_point_type;
+  }
+  const llvm::FunctionType* osr_entry_point_type() const {
+    return _osr_entry_point_type;
+  }
+
+  // Mappings
+ private:
+  const llvm::Type* _to_stackType[T_CONFLICT];
+  const llvm::Type* _to_arrayType[T_CONFLICT];
+
+ private:
+  const llvm::Type* map_type(const llvm::Type* const* table,
+                             BasicType                type) const {
+    assert(type >= 0 && type < T_CONFLICT, "unhandled type");
+    const llvm::Type* result = table[type];
+    assert(type != NULL, "unhandled type");
+    return result;
+  }
+
+ public:
+  const llvm::Type* to_stackType(BasicType type) const {
+    return map_type(_to_stackType, type);
+  }
+  const llvm::Type* to_arrayType(BasicType type) const {
+    return map_type(_to_arrayType, type);
+  }
+
+  // Functions queued for freeing
+ private:
+  SharkFreeQueueItem* _free_queue;
+
+ public:
+  void push_to_free_queue(llvm::Function* function);
+  llvm::Function* pop_from_free_queue();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkEntry.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkContext;
+
+class SharkEntry : public ZeroEntry {
+ private:
+  address         _code_limit;
+  SharkContext*   _context;
+  llvm::Function* _function;
+
+ public:
+  address code_start() const {
+    return entry_point();
+  }
+  address code_limit() const {
+    return _code_limit;
+  }
+  SharkContext* context() const {
+    return _context;
+  }
+  llvm::Function* function() const {
+    return _function;
+  }
+
+ public:
+  void set_code_limit(address code_limit) {
+    _code_limit = code_limit;
+  }
+  void set_context(SharkContext* context) {
+    _context = context;
+  }
+  void set_function(llvm::Function* function) {
+    _function = function;
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkFunction.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,188 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkFunction.cpp.incl"
+
+using namespace llvm;
+
+void SharkFunction::initialize(const char *name) {
+  // Create the function
+  _function = Function::Create(
+    entry_point_type(),
+    GlobalVariable::InternalLinkage,
+    name);
+
+  // Get our arguments
+  Function::arg_iterator ai = function()->arg_begin();
+  Argument *method = ai++;
+  method->setName("method");
+  Argument *osr_buf = NULL;
+  if (is_osr()) {
+    osr_buf = ai++;
+    osr_buf->setName("osr_buf");
+  }
+  Argument *base_pc = ai++;
+  base_pc->setName("base_pc");
+  code_buffer()->set_base_pc(base_pc);
+  Argument *thread = ai++;
+  thread->setName("thread");
+  set_thread(thread);
+
+  // Create the list of blocks
+  set_block_insertion_point(NULL);
+  _blocks = NEW_RESOURCE_ARRAY(SharkTopLevelBlock*, block_count());
+  for (int i = 0; i < block_count(); i++) {
+    ciTypeFlow::Block *b = flow()->pre_order_at(i);
+
+    // Work around a bug in pre_order_at() that does not return
+    // the correct pre-ordering.  If pre_order_at() were correct
+    // this line could simply be:
+    // _blocks[i] = new SharkTopLevelBlock(this, b);
+    _blocks[b->pre_order()] = new SharkTopLevelBlock(this, b);
+  }
+
+  // Walk the tree from the start block to determine which
+  // blocks are entered and which blocks require phis
+  SharkTopLevelBlock *start_block = block(flow()->start_block_num());
+  assert(start_block->start() == flow()->start_bci(), "blocks out of order");
+  start_block->enter();
+
+  // Initialize all entered blocks
+  for (int i = 0; i < block_count(); i++) {
+    if (block(i)->entered())
+      block(i)->initialize();
+  }
+
+  // Create and push our stack frame
+  set_block_insertion_point(&function()->front());
+  builder()->SetInsertPoint(CreateBlock());
+  _stack = SharkStack::CreateBuildAndPushFrame(this, method);
+
+  // Create the entry state
+  SharkState *entry_state;
+  if (is_osr()) {
+    entry_state = new SharkOSREntryState(start_block, method, osr_buf);
+
+    // Free the OSR buffer
+    builder()->CreateCall(builder()->osr_migration_end(), osr_buf);
+  }
+  else {
+    entry_state = new SharkNormalEntryState(start_block, method);
+
+    // Lock if necessary
+    if (is_synchronized()) {
+      SharkTopLevelBlock *locker =
+        new SharkTopLevelBlock(this, start_block->ciblock());
+      locker->add_incoming(entry_state);
+
+      set_block_insertion_point(start_block->entry_block());
+      locker->acquire_method_lock();
+
+      entry_state = locker->current_state();
+    }
+  }
+
+  // Transition into the method proper
+  start_block->add_incoming(entry_state);
+  builder()->CreateBr(start_block->entry_block());
+
+  // Parse the blocks
+  for (int i = 0; i < block_count(); i++) {
+    if (!block(i)->entered())
+      continue;
+
+    if (i + 1 < block_count())
+      set_block_insertion_point(block(i + 1)->entry_block());
+    else
+      set_block_insertion_point(NULL);
+
+    block(i)->emit_IR();
+  }
+  do_deferred_zero_checks();
+}
+
+class DeferredZeroCheck : public SharkTargetInvariants {
+ public:
+  DeferredZeroCheck(SharkTopLevelBlock* block, SharkValue* value)
+    : SharkTargetInvariants(block),
+      _block(block),
+      _value(value),
+      _bci(block->bci()),
+      _state(block->current_state()->copy()),
+      _check_block(builder()->GetInsertBlock()),
+      _continue_block(function()->CreateBlock("not_zero")) {
+    builder()->SetInsertPoint(continue_block());
+  }
+
+ private:
+  SharkTopLevelBlock* _block;
+  SharkValue*         _value;
+  int                 _bci;
+  SharkState*         _state;
+  BasicBlock*         _check_block;
+  BasicBlock*         _continue_block;
+
+ public:
+  SharkTopLevelBlock* block() const {
+    return _block;
+  }
+  SharkValue* value() const {
+    return _value;
+  }
+  int bci() const {
+    return _bci;
+  }
+  SharkState* state() const {
+    return _state;
+  }
+  BasicBlock* check_block() const {
+    return _check_block;
+  }
+  BasicBlock* continue_block() const {
+    return _continue_block;
+  }
+
+ public:
+  SharkFunction* function() const {
+    return block()->function();
+  }
+
+ public:
+  void process() const {
+    builder()->SetInsertPoint(check_block());
+    block()->do_deferred_zero_check(value(), bci(), state(), continue_block());
+  }
+};
+
+void SharkFunction::add_deferred_zero_check(SharkTopLevelBlock* block,
+                                            SharkValue*         value) {
+  deferred_zero_checks()->append(new DeferredZeroCheck(block, value));
+}
+
+void SharkFunction::do_deferred_zero_checks() {
+  for (int i = 0; i < deferred_zero_checks()->length(); i++)
+    deferred_zero_checks()->at(i)->process();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkFunction.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkTopLevelBlock;
+class DeferredZeroCheck;
+
+class SharkFunction : public SharkTargetInvariants {
+ friend class SharkStackWithNormalFrame;
+
+ public:
+  static llvm::Function* build(ciEnv*        env,
+                               SharkBuilder* builder,
+                               ciTypeFlow*   flow,
+                               const char*   name) {
+    SharkFunction function(env, builder, flow, name);
+    return function.function();
+  }
+
+ private:
+  SharkFunction(ciEnv*        env,
+                SharkBuilder* builder,
+                ciTypeFlow*   flow,
+                const char*   name)
+    : SharkTargetInvariants(env, builder, flow) { initialize(name); }
+
+ private:
+  void initialize(const char* name);
+
+ private:
+  llvm::Function*                   _function;
+  SharkTopLevelBlock**              _blocks;
+  GrowableArray<DeferredZeroCheck*> _deferred_zero_checks;
+  SharkStack*                       _stack;
+
+ public:
+  llvm::Function* function() const {
+    return _function;
+  }
+  int block_count() const {
+    return flow()->block_count();
+  }
+  SharkTopLevelBlock* block(int i) const {
+    assert(i < block_count(), "should be");
+    return _blocks[i];
+  }
+  GrowableArray<DeferredZeroCheck*>* deferred_zero_checks() {
+    return &_deferred_zero_checks;
+  }
+  SharkStack* stack() const {
+    return _stack;
+  }
+
+  // On-stack replacement
+ private:
+  bool is_osr() const {
+    return flow()->is_osr_flow();
+  }
+  const llvm::FunctionType* entry_point_type() const {
+    if (is_osr())
+      return SharkType::osr_entry_point_type();
+    else
+      return SharkType::entry_point_type();
+  }
+
+  // Block management
+ private:
+  llvm::BasicBlock* _block_insertion_point;
+
+  void set_block_insertion_point(llvm::BasicBlock* block_insertion_point) {
+    _block_insertion_point = block_insertion_point;
+  }
+  llvm::BasicBlock* block_insertion_point() const {
+    return _block_insertion_point;
+  }
+
+ public:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const {
+    return llvm::BasicBlock::Create(
+      SharkContext::current(), name, function(), block_insertion_point());
+  }
+
+  // Deferred zero checks
+ public:
+  void add_deferred_zero_check(SharkTopLevelBlock* block,
+                               SharkValue*         value);
+
+ private:
+  void do_deferred_zero_checks();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkInliner.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,749 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkInliner.cpp.incl"
+
+using namespace llvm;
+
+class SharkInlineBlock : public SharkBlock {
+ public:
+  SharkInlineBlock(ciMethod* target, SharkState* state)
+    : SharkBlock(state, target),
+      _outer_state(state),
+      _entry_state(new SharkState(this)) {
+    for (int i = target->max_locals() - 1; i >= 0; i--) {
+      SharkValue *value = NULL;
+      if (i < target->arg_size())
+        value = outer_state()->pop();
+      entry_state()->set_local(i, value);
+    }
+  }
+
+ private:
+  SharkState* _outer_state;
+  SharkState* _entry_state;
+
+ private:
+  SharkState* outer_state() {
+    return _outer_state;
+  }
+  SharkState* entry_state() {
+    return _entry_state;
+  }
+
+ public:
+  void emit_IR() {
+    parse_bytecode(0, target()->code_size());
+  }
+
+ private:
+  void do_return(BasicType type) {
+    if (type != T_VOID) {
+      SharkValue *result = pop_result(type);
+      outer_state()->push(result);
+      if (result->is_two_word())
+        outer_state()->push(NULL);
+    }
+  }
+};
+
+class SharkInlinerHelper : public StackObj {
+ public:
+  SharkInlinerHelper(ciMethod* target, SharkState* entry_state)
+    : _target(target),
+      _entry_state(entry_state),
+      _iter(target) {}
+
+ private:
+  ciBytecodeStream _iter;
+  SharkState*      _entry_state;
+  ciMethod*        _target;
+
+ public:
+  ciBytecodeStream* iter() {
+    return &_iter;
+  }
+  SharkState* entry_state() const {
+    return _entry_state;
+  }
+  ciMethod* target() const {
+    return _target;
+  }
+
+ public:
+  Bytecodes::Code bc() {
+    return iter()->cur_bc();
+  }
+  int max_locals() const {
+    return target()->max_locals();
+  }
+  int max_stack() const {
+    return target()->max_stack();
+  }
+
+  // Inlinability check
+ public:
+  bool is_inlinable();
+
+ private:
+  void initialize_for_check();
+
+  bool do_getstatic() {
+    return do_field_access(true, false);
+  }
+  bool do_getfield() {
+    return do_field_access(true, true);
+  }
+  bool do_putfield() {
+    return do_field_access(false, true);
+  }
+  bool do_field_access(bool is_get, bool is_field);
+
+  // Local variables for inlinability check
+ private:
+  bool* _locals;
+
+ public:
+  bool* local_addr(int index) const {
+    assert(index >= 0 && index < max_locals(), "bad local variable index");
+    return &_locals[index];
+  }
+  bool local(int index) const {
+    return *local_addr(index);
+  }
+  void set_local(int index, bool value) {
+    *local_addr(index) = value;
+  }
+
+  // Expression stack for inlinability check
+ private:
+  bool* _stack;
+  bool* _sp;
+
+ public:
+  int stack_depth() const {
+    return _sp - _stack;
+  }
+  bool* stack_addr(int slot) const {
+    assert(slot >= 0 && slot < stack_depth(), "bad stack slot");
+    return &_sp[-(slot + 1)];
+  }
+  void push(bool value) {
+    assert(stack_depth() < max_stack(), "stack overrun");
+    *(_sp++) = value;
+  }
+  bool pop() {
+    assert(stack_depth() > 0, "stack underrun");
+    return *(--_sp);
+  }
+
+  // Methods for two-word locals
+ public:
+  void push_pair_local(int index) {
+    push(local(index));
+    push(local(index + 1));
+  }
+  void pop_pair_local(int index) {
+    set_local(index + 1, pop());
+    set_local(index, pop());
+  }
+
+  // Code generation
+ public:
+  void do_inline() {
+    (new SharkInlineBlock(target(), entry_state()))->emit_IR();
+  }
+};
+
+// Quick checks so we can bail out before doing too much
+bool SharkInliner::may_be_inlinable(ciMethod *target) {
+  // We can't inline native methods
+  if (target->is_native())
+    return false;
+
+  // Not much point inlining abstract ones, and in any
+  // case we'd need a stack frame to throw the exception
+  if (target->is_abstract())
+    return false;
+
+  // Don't inline anything huge
+  if (target->code_size() > SharkMaxInlineSize)
+    return false;
+
+  // Monitors aren't allowed without a frame to put them in
+  if (target->is_synchronized() || target->has_monitor_bytecodes())
+    return false;
+
+  // We don't do control flow
+  if (target->has_exception_handlers() || target->has_jsrs())
+    return false;
+
+  // Don't try to inline constructors, as they must
+  // eventually call Object.<init> which we can't inline.
+  // Note that this catches <clinit> too, but why would
+  // we be compiling that?
+  if (target->is_initializer())
+    return false;
+
+  // Mustn't inline Object.<init>
+  // Should be caught by the above, but just in case...
+  if (target->intrinsic_id() == vmIntrinsics::_Object_init)
+    return false;
+
+  return true;
+}
+
+// Full-on detailed check, for methods that pass the quick checks
+// Inlined methods have no stack frame, so we can't do anything
+// that would require one.  This means no safepoints (and hence
+// no loops) and no VM calls.  No VM calls means, amongst other
+// things, that no exceptions can be created, which means no null
+// checks or divide-by-zero checks are allowed.  The lack of null
+// checks in particular would eliminate practically everything,
+// but we can get around that restriction by relying on the zero-
+// check eliminator to strip the checks.  To do that, we need to
+// walk through the method, tracking which values are and are not
+// zero-checked.
+bool SharkInlinerHelper::is_inlinable() {
+  ResourceMark rm;
+  initialize_for_check();
+
+  SharkConstant *sc;
+  bool a, b, c, d;
+
+  iter()->reset_to_bci(0);
+  while (iter()->next() != ciBytecodeStream::EOBC()) {
+    switch (bc()) {
+    case Bytecodes::_nop:
+      break;
+
+    case Bytecodes::_aconst_null:
+      push(false);
+      break;
+
+    case Bytecodes::_iconst_0:
+      push(false);
+      break;
+    case Bytecodes::_iconst_m1:
+    case Bytecodes::_iconst_1:
+    case Bytecodes::_iconst_2:
+    case Bytecodes::_iconst_3:
+    case Bytecodes::_iconst_4:
+    case Bytecodes::_iconst_5:
+      push(true);
+      break;
+
+    case Bytecodes::_lconst_0:
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_lconst_1:
+      push(true);
+      push(false);
+      break;
+
+    case Bytecodes::_fconst_0:
+    case Bytecodes::_fconst_1:
+    case Bytecodes::_fconst_2:
+      push(false);
+      break;
+
+    case Bytecodes::_dconst_0:
+    case Bytecodes::_dconst_1:
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_bipush:
+      push(iter()->get_byte() != 0);
+      break;
+    case Bytecodes::_sipush:
+      push(iter()->get_short() != 0);
+      break;
+
+    case Bytecodes::_ldc:
+    case Bytecodes::_ldc_w:
+    case Bytecodes::_ldc2_w:
+      sc = SharkConstant::for_ldc(iter());
+      if (!sc->is_loaded())
+        return false;
+      push(sc->is_nonzero());
+      if (sc->is_two_word())
+        push(false);
+      break;
+
+    case Bytecodes::_iload_0:
+    case Bytecodes::_fload_0:
+    case Bytecodes::_aload_0:
+      push(local(0));
+      break;
+    case Bytecodes::_lload_0:
+    case Bytecodes::_dload_0:
+      push_pair_local(0);
+      break;
+
+    case Bytecodes::_iload_1:
+    case Bytecodes::_fload_1:
+    case Bytecodes::_aload_1:
+      push(local(1));
+      break;
+    case Bytecodes::_lload_1:
+    case Bytecodes::_dload_1:
+      push_pair_local(1);
+      break;
+
+    case Bytecodes::_iload_2:
+    case Bytecodes::_fload_2:
+    case Bytecodes::_aload_2:
+      push(local(2));
+      break;
+    case Bytecodes::_lload_2:
+    case Bytecodes::_dload_2:
+      push_pair_local(2);
+      break;
+
+    case Bytecodes::_iload_3:
+    case Bytecodes::_fload_3:
+    case Bytecodes::_aload_3:
+      push(local(3));
+      break;
+    case Bytecodes::_lload_3:
+    case Bytecodes::_dload_3:
+      push_pair_local(3);
+      break;
+
+    case Bytecodes::_iload:
+    case Bytecodes::_fload:
+    case Bytecodes::_aload:
+      push(local(iter()->get_index()));
+      break;
+    case Bytecodes::_lload:
+    case Bytecodes::_dload:
+      push_pair_local(iter()->get_index());
+      break;
+
+    case Bytecodes::_istore_0:
+    case Bytecodes::_fstore_0:
+    case Bytecodes::_astore_0:
+      set_local(0, pop());
+      break;
+    case Bytecodes::_lstore_0:
+    case Bytecodes::_dstore_0:
+      pop_pair_local(0);
+      break;
+
+    case Bytecodes::_istore_1:
+    case Bytecodes::_fstore_1:
+    case Bytecodes::_astore_1:
+      set_local(1, pop());
+      break;
+    case Bytecodes::_lstore_1:
+    case Bytecodes::_dstore_1:
+      pop_pair_local(1);
+      break;
+
+    case Bytecodes::_istore_2:
+    case Bytecodes::_fstore_2:
+    case Bytecodes::_astore_2:
+      set_local(2, pop());
+      break;
+    case Bytecodes::_lstore_2:
+    case Bytecodes::_dstore_2:
+      pop_pair_local(2);
+      break;
+
+    case Bytecodes::_istore_3:
+    case Bytecodes::_fstore_3:
+    case Bytecodes::_astore_3:
+      set_local(3, pop());
+      break;
+    case Bytecodes::_lstore_3:
+    case Bytecodes::_dstore_3:
+      pop_pair_local(3);
+      break;
+
+    case Bytecodes::_istore:
+    case Bytecodes::_fstore:
+    case Bytecodes::_astore:
+      set_local(iter()->get_index(), pop());
+      break;
+    case Bytecodes::_lstore:
+    case Bytecodes::_dstore:
+      pop_pair_local(iter()->get_index());
+      break;
+
+    case Bytecodes::_pop:
+      pop();
+      break;
+    case Bytecodes::_pop2:
+      pop();
+      pop();
+      break;
+    case Bytecodes::_swap:
+      a = pop();
+      b = pop();
+      push(a);
+      push(b);
+      break;
+    case Bytecodes::_dup:
+      a = pop();
+      push(a);
+      push(a);
+      break;
+    case Bytecodes::_dup_x1:
+      a = pop();
+      b = pop();
+      push(a);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup_x2:
+      a = pop();
+      b = pop();
+      c = pop();
+      push(a);
+      push(c);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup2:
+      a = pop();
+      b = pop();
+      push(b);
+      push(a);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup2_x1:
+      a = pop();
+      b = pop();
+      c = pop();
+      push(b);
+      push(a);
+      push(c);
+      push(b);
+      push(a);
+      break;
+    case Bytecodes::_dup2_x2:
+      a = pop();
+      b = pop();
+      c = pop();
+      d = pop();
+      push(b);
+      push(a);
+      push(d);
+      push(c);
+      push(b);
+      push(a);
+      break;
+
+    case Bytecodes::_getfield:
+      if (!do_getfield())
+        return false;
+      break;
+    case Bytecodes::_getstatic:
+      if (!do_getstatic())
+        return false;
+      break;
+    case Bytecodes::_putfield:
+      if (!do_putfield())
+        return false;
+      break;
+
+    case Bytecodes::_iadd:
+    case Bytecodes::_isub:
+    case Bytecodes::_imul:
+    case Bytecodes::_iand:
+    case Bytecodes::_ixor:
+    case Bytecodes::_ishl:
+    case Bytecodes::_ishr:
+    case Bytecodes::_iushr:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_ior:
+      a = pop();
+      b = pop();
+      push(a && b);
+      break;
+    case Bytecodes::_idiv:
+    case Bytecodes::_irem:
+      if (!pop())
+        return false;
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_ineg:
+      break;
+
+    case Bytecodes::_ladd:
+    case Bytecodes::_lsub:
+    case Bytecodes::_lmul:
+    case Bytecodes::_land:
+    case Bytecodes::_lxor:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_lor:
+      a = pop();
+      b = pop();
+      push(a && b);
+      break;
+    case Bytecodes::_ldiv:
+    case Bytecodes::_lrem:
+      pop();
+      if (!pop())
+        return false;
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_lneg:
+      break;
+    case Bytecodes::_lshl:
+    case Bytecodes::_lshr:
+    case Bytecodes::_lushr:
+      pop();
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_fadd:
+    case Bytecodes::_fsub:
+    case Bytecodes::_fmul:
+    case Bytecodes::_fdiv:
+    case Bytecodes::_frem:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_fneg:
+      break;
+
+    case Bytecodes::_dadd:
+    case Bytecodes::_dsub:
+    case Bytecodes::_dmul:
+    case Bytecodes::_ddiv:
+    case Bytecodes::_drem:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+    case Bytecodes::_dneg:
+      break;
+
+    case Bytecodes::_iinc:
+      set_local(iter()->get_index(), false);
+      break;
+
+    case Bytecodes::_lcmp:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_fcmpl:
+    case Bytecodes::_fcmpg:
+      pop();
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_dcmpl:
+    case Bytecodes::_dcmpg:
+      pop();
+      pop();
+      pop();
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_i2l:
+      push(false);
+      break;
+    case Bytecodes::_i2f:
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_i2d:
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_l2i:
+    case Bytecodes::_l2f:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_l2d:
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_f2i:
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_f2l:
+    case Bytecodes::_f2d:
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_d2i:
+    case Bytecodes::_d2f:
+      pop();
+      pop();
+      push(false);
+      break;
+    case Bytecodes::_d2l:
+      pop();
+      pop();
+      push(false);
+      push(false);
+      break;
+
+    case Bytecodes::_i2b:
+    case Bytecodes::_i2c:
+    case Bytecodes::_i2s:
+      pop();
+      push(false);
+      break;
+
+    case Bytecodes::_return:
+    case Bytecodes::_ireturn:
+    case Bytecodes::_lreturn:
+    case Bytecodes::_freturn:
+    case Bytecodes::_dreturn:
+    case Bytecodes::_areturn:
+      break;
+
+    default:
+      return false;
+    }
+  }
+
+  return true;
+}
+
+void SharkInlinerHelper::initialize_for_check() {
+  _locals = NEW_RESOURCE_ARRAY(bool, max_locals());
+  _stack = NEW_RESOURCE_ARRAY(bool, max_stack());
+
+  memset(_locals, 0, max_locals() * sizeof(bool));
+  for (int i = 0; i < target()->arg_size(); i++) {
+    SharkValue *arg = entry_state()->stack(target()->arg_size() - 1 - i);
+    if (arg && arg->zero_checked())
+      set_local(i, true);
+  }
+
+  _sp = _stack;
+}
+
+bool SharkInlinerHelper::do_field_access(bool is_get, bool is_field) {
+  assert(is_get || is_field, "can't inline putstatic");
+
+  // If the holder isn't linked then there isn't a lot we can do
+  if (!target()->holder()->is_linked())
+    return false;
+
+  // Get the field
+  bool will_link;
+  ciField *field = iter()->get_field(will_link);
+  if (!will_link)
+    return false;
+
+  // If the field is mismatched then an exception needs throwing
+  if (is_field == field->is_static())
+    return false;
+
+  // Pop the value off the stack if necessary
+  if (!is_get) {
+    pop();
+    if (field->type()->is_two_word())
+      pop();
+  }
+
+  // Pop and null-check the receiver if necessary
+  if (is_field) {
+    if (!pop())
+      return false;
+  }
+
+  // Push the result if necessary
+  if (is_get) {
+    bool result_pushed = false;
+    if (field->is_constant()) {
+      SharkConstant *sc = SharkConstant::for_field(iter());
+      if (sc->is_loaded()) {
+        push(sc->is_nonzero());
+        result_pushed = true;
+      }
+    }
+
+    if (!result_pushed)
+      push(false);
+
+    if (field->type()->is_two_word())
+      push(false);
+  }
+
+  return true;
+}
+
+bool SharkInliner::attempt_inline(ciMethod *target, SharkState *state) {
+  if (SharkIntrinsics::is_intrinsic(target)) {
+    SharkIntrinsics::inline_intrinsic(target, state);
+    return true;
+  }
+
+  if (may_be_inlinable(target)) {
+    SharkInlinerHelper inliner(target, state);
+    if (inliner.is_inlinable()) {
+      inliner.do_inline();
+      return true;
+    }
+  }
+  return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkInliner.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkInliner : public AllStatic {
+ public:
+  static bool attempt_inline(ciMethod* target, SharkState* state);
+
+ private:
+  static bool may_be_inlinable(ciMethod* target);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkIntrinsics.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,277 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkIntrinsics.cpp.incl"
+
+using namespace llvm;
+
+bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
+  switch (target->intrinsic_id()) {
+  case vmIntrinsics::_none:
+    return false;
+
+    // java.lang.Math
+  case vmIntrinsics::_min:
+  case vmIntrinsics::_max:
+  case vmIntrinsics::_dabs:
+  case vmIntrinsics::_dsin:
+  case vmIntrinsics::_dcos:
+  case vmIntrinsics::_dtan:
+  case vmIntrinsics::_datan2:
+  case vmIntrinsics::_dsqrt:
+  case vmIntrinsics::_dlog:
+  case vmIntrinsics::_dlog10:
+  case vmIntrinsics::_dpow:
+  case vmIntrinsics::_dexp:
+    return true;
+
+    // java.lang.Object
+  case vmIntrinsics::_getClass:
+    return true;
+
+    // java.lang.System
+  case vmIntrinsics::_currentTimeMillis:
+    return true;
+
+    // java.lang.Thread
+  case vmIntrinsics::_currentThread:
+    return true;
+
+    // sun.misc.Unsafe
+  case vmIntrinsics::_compareAndSwapInt:
+    return true;
+
+  default:
+    if (SharkPerformanceWarnings) {
+      warning(
+        "unhandled intrinsic vmIntrinsic::%s",
+        vmIntrinsics::name_at(target->intrinsic_id()));
+    }
+  }
+  return false;
+}
+
+void SharkIntrinsics::inline_intrinsic(ciMethod *target, SharkState *state) {
+  SharkIntrinsics intrinsic(state, target);
+  intrinsic.do_intrinsic();
+}
+
+void SharkIntrinsics::do_intrinsic() {
+  switch (target()->intrinsic_id()) {
+    // java.lang.Math
+  case vmIntrinsics::_min:
+    do_Math_minmax(llvm::ICmpInst::ICMP_SLE);
+    break;
+  case vmIntrinsics::_max:
+    do_Math_minmax(llvm::ICmpInst::ICMP_SGE);
+    break;
+  case vmIntrinsics::_dabs:
+    do_Math_1to1(builder()->fabs());
+    break;
+  case vmIntrinsics::_dsin:
+    do_Math_1to1(builder()->sin());
+    break;
+  case vmIntrinsics::_dcos:
+    do_Math_1to1(builder()->cos());
+    break;
+  case vmIntrinsics::_dtan:
+    do_Math_1to1(builder()->tan());
+    break;
+  case vmIntrinsics::_datan2:
+    do_Math_2to1(builder()->atan2());
+    break;
+  case vmIntrinsics::_dsqrt:
+    do_Math_1to1(builder()->sqrt());
+    break;
+  case vmIntrinsics::_dlog:
+    do_Math_1to1(builder()->log());
+    break;
+  case vmIntrinsics::_dlog10:
+    do_Math_1to1(builder()->log10());
+    break;
+  case vmIntrinsics::_dpow:
+    do_Math_2to1(builder()->pow());
+    break;
+  case vmIntrinsics::_dexp:
+    do_Math_1to1(builder()->exp());
+    break;
+
+    // java.lang.Object
+  case vmIntrinsics::_getClass:
+    do_Object_getClass();
+    break;
+
+    // java.lang.System
+  case vmIntrinsics::_currentTimeMillis:
+    do_System_currentTimeMillis();
+    break;
+
+    // java.lang.Thread
+  case vmIntrinsics::_currentThread:
+    do_Thread_currentThread();
+    break;
+
+    // sun.misc.Unsafe
+  case vmIntrinsics::_compareAndSwapInt:
+    do_Unsafe_compareAndSwapInt();
+    break;
+
+  default:
+    ShouldNotReachHere();
+  }
+}
+
+void SharkIntrinsics::do_Math_minmax(ICmpInst::Predicate p) {
+  // Pop the arguments
+  SharkValue *sb = state()->pop();
+  SharkValue *sa = state()->pop();
+  Value *a = sa->jint_value();
+  Value *b = sb->jint_value();
+
+  // Perform the test
+  BasicBlock *ip       = builder()->GetBlockInsertionPoint();
+  BasicBlock *return_a = builder()->CreateBlock(ip, "return_a");
+  BasicBlock *return_b = builder()->CreateBlock(ip, "return_b");
+  BasicBlock *done     = builder()->CreateBlock(ip, "done");
+
+  builder()->CreateCondBr(builder()->CreateICmp(p, a, b), return_a, return_b);
+
+  builder()->SetInsertPoint(return_a);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(return_b);
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  PHINode *phi = builder()->CreatePHI(a->getType(), "result");
+  phi->addIncoming(a, return_a);
+  phi->addIncoming(b, return_b);
+
+  // Push the result
+  state()->push(
+    SharkValue::create_jint(
+      phi,
+      sa->zero_checked() && sb->zero_checked()));
+}
+
+void SharkIntrinsics::do_Math_1to1(Value *function) {
+  SharkValue *empty = state()->pop();
+  assert(empty == NULL, "should be");
+  state()->push(
+    SharkValue::create_jdouble(
+      builder()->CreateCall(
+        function, state()->pop()->jdouble_value())));
+  state()->push(NULL);
+}
+
+void SharkIntrinsics::do_Math_2to1(Value *function) {
+  SharkValue *empty = state()->pop();
+  assert(empty == NULL, "should be");
+  Value *y = state()->pop()->jdouble_value();
+  empty = state()->pop();
+  assert(empty == NULL, "should be");
+  Value *x = state()->pop()->jdouble_value();
+
+  state()->push(
+    SharkValue::create_jdouble(
+      builder()->CreateCall2(function, x, y)));
+  state()->push(NULL);
+}
+
+void SharkIntrinsics::do_Object_getClass() {
+  Value *klass = builder()->CreateValueOfStructEntry(
+    state()->pop()->jobject_value(),
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "klass");
+
+  Value *klass_part = builder()->CreateAddressOfStructEntry(
+    klass,
+    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
+    SharkType::klass_type(),
+    "klass_part");
+
+  state()->push(
+    SharkValue::create_jobject(
+      builder()->CreateValueOfStructEntry(
+        klass_part,
+        in_ByteSize(Klass::java_mirror_offset_in_bytes()),
+        SharkType::oop_type(),
+        "java_mirror"),
+      true));
+}
+
+void SharkIntrinsics::do_System_currentTimeMillis() {
+  state()->push(
+    SharkValue::create_jlong(
+      builder()->CreateCall(builder()->current_time_millis()),
+      false));
+  state()->push(NULL);
+}
+
+void SharkIntrinsics::do_Thread_currentThread() {
+  state()->push(
+    SharkValue::create_jobject(
+      builder()->CreateValueOfStructEntry(
+        thread(), JavaThread::threadObj_offset(),
+        SharkType::oop_type(),
+        "threadObj"),
+      true));
+}
+
+void SharkIntrinsics::do_Unsafe_compareAndSwapInt() {
+  // Pop the arguments
+  Value *x      = state()->pop()->jint_value();
+  Value *e      = state()->pop()->jint_value();
+  SharkValue *empty = state()->pop();
+  assert(empty == NULL, "should be");
+  Value *offset = state()->pop()->jlong_value();
+  Value *object = state()->pop()->jobject_value();
+  Value *unsafe = state()->pop()->jobject_value();
+
+  // Convert the offset
+  offset = builder()->CreateCall(
+    builder()->unsafe_field_offset_to_byte_offset(),
+    offset);
+
+  // Locate the field
+  Value *addr = builder()->CreateIntToPtr(
+    builder()->CreateAdd(
+      builder()->CreatePtrToInt(object, SharkType::intptr_type()),
+      builder()->CreateIntCast(offset, SharkType::intptr_type(), true)),
+    PointerType::getUnqual(SharkType::jint_type()),
+    "addr");
+
+  // Perform the operation
+  Value *result = builder()->CreateCmpxchgInt(x, addr, e);
+
+  // Push the result
+  state()->push(
+    SharkValue::create_jint(
+      builder()->CreateIntCast(
+        builder()->CreateICmpEQ(result, e), SharkType::jint_type(), true),
+      false));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkIntrinsics.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,54 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkIntrinsics : public SharkTargetInvariants {
+ public:
+  static bool is_intrinsic(ciMethod* target);
+  static void inline_intrinsic(ciMethod* target, SharkState* state);
+
+ private:
+  SharkIntrinsics(SharkState* state, ciMethod* target)
+    : SharkTargetInvariants(state, target), _state(state) {}
+
+ private:
+  SharkState* _state;
+
+ private:
+  SharkState* state() const {
+    return _state;
+  }
+
+ private:
+  void do_intrinsic();
+
+ private:
+  void do_Math_minmax(llvm::ICmpInst::Predicate p);
+  void do_Math_1to1(llvm::Value* function);
+  void do_Math_2to1(llvm::Value* function);
+  void do_Object_getClass();
+  void do_System_currentTimeMillis();
+  void do_Thread_currentThread();
+  void do_Unsafe_compareAndSwapInt();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkInvariants.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkInvariants.cpp.incl"
+
+int SharkTargetInvariants::count_monitors() {
+  int result = 0;
+  if (is_synchronized() || target()->has_monitor_bytecodes()) {
+    for (int i = 0; i < flow()->block_count(); i++) {
+      result = MAX2(result, flow()->pre_order_at(i)->monitor_count());
+    }
+  }
+  return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkInvariants.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,167 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+// Base classes used to track various values through the compilation.
+// SharkCompileInvariants is used to track values which remain the
+// same for the top-level method and any inlined methods it may have
+// (ie for the whole compilation).  SharkTargetInvariants is used to
+// track values which differ between methods.
+
+class SharkCompileInvariants : public ResourceObj {
+ protected:
+  SharkCompileInvariants(ciEnv* env, SharkBuilder* builder)
+    : _env(env),
+      _builder(builder),
+      _thread(NULL) {}
+
+  SharkCompileInvariants(const SharkCompileInvariants* parent)
+    : _env(parent->_env),
+      _builder(parent->_builder),
+      _thread(parent->_thread) {}
+
+ private:
+  ciEnv*        _env;
+  SharkBuilder* _builder;
+  llvm::Value*  _thread;
+
+  // Top-level broker for HotSpot's Compiler Interface.
+  //
+  // Its main purpose is to allow the various CI classes to access
+  // oops in the VM without having to worry about safepointing.  In
+  // addition to this it acts as a holder for various recorders and
+  // memory allocators.
+  //
+  // Accessing this directly is kind of ugly, so it's private.  Add
+  // new accessors below if you need something from it.
+ private:
+  ciEnv* env() const {
+    assert(_env != NULL, "env not available");
+    return _env;
+  }
+
+  // The SharkBuilder that is used to build LLVM IR.
+ protected:
+  SharkBuilder* builder() const {
+    return _builder;
+  }
+
+  // Pointer to this thread's JavaThread object.  This is not
+  // available until a short way into SharkFunction creation
+  // so a setter is required.  Assertions are used to enforce
+  // invariance.
+ protected:
+  llvm::Value* thread() const {
+    assert(_thread != NULL, "thread not available");
+    return _thread;
+  }
+  void set_thread(llvm::Value* thread) {
+    assert(_thread == NULL, "thread already set");
+    _thread = thread;
+  }
+
+  // Objects that handle various aspects of the compilation.
+ protected:
+  DebugInformationRecorder* debug_info() const {
+    return env()->debug_info();
+  }
+  Dependencies* dependencies() const {
+    return env()->dependencies();
+  }
+  SharkCodeBuffer* code_buffer() const {
+    return builder()->code_buffer();
+  }
+
+  // Commonly used classes
+ protected:
+  ciInstanceKlass* java_lang_Object_klass() const {
+    return env()->Object_klass();
+  }
+  ciInstanceKlass* java_lang_Throwable_klass() const {
+    return env()->Throwable_klass();
+  }
+};
+
+class SharkTargetInvariants : public SharkCompileInvariants {
+ protected:
+  SharkTargetInvariants(ciEnv* env, SharkBuilder* builder, ciTypeFlow* flow)
+    : SharkCompileInvariants(env, builder),
+      _target(flow->method()),
+      _flow(flow),
+      _max_monitors(count_monitors()) {}
+
+  SharkTargetInvariants(const SharkCompileInvariants* parent, ciMethod* target)
+    : SharkCompileInvariants(parent),
+      _target(target),
+      _flow(NULL),
+      _max_monitors(count_monitors()) {}
+
+  SharkTargetInvariants(const SharkTargetInvariants* parent)
+    : SharkCompileInvariants(parent),
+      _target(parent->_target),
+      _flow(parent->_flow),
+      _max_monitors(parent->_max_monitors) {}
+
+ private:
+  int count_monitors();
+
+ private:
+  ciMethod*   _target;
+  ciTypeFlow* _flow;
+  int         _max_monitors;
+
+  // The method being compiled.
+ protected:
+  ciMethod* target() const {
+    return _target;
+  }
+
+  // Typeflow analysis of the method being compiled.
+ protected:
+  ciTypeFlow* flow() const {
+    assert(_flow != NULL, "typeflow not available");
+    return _flow;
+  }
+
+  // Properties of the method.
+ protected:
+  int max_locals() const {
+    return target()->max_locals();
+  }
+  int max_stack() const {
+    return target()->max_stack();
+  }
+  int max_monitors() const {
+    return _max_monitors;
+  }
+  int arg_size() const {
+    return target()->arg_size();
+  }
+  bool is_static() const {
+    return target()->is_static();
+  }
+  bool is_synchronized() const {
+    return target()->is_synchronized();
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkMemoryManager.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,116 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkMemoryManager.cpp.incl"
+
+using namespace llvm;
+
+void SharkMemoryManager::AllocateGOT() {
+  mm()->AllocateGOT();
+}
+
+unsigned char* SharkMemoryManager::getGOTBase() const {
+  return mm()->getGOTBase();
+}
+
+unsigned char* SharkMemoryManager::allocateStub(const GlobalValue* F,
+                                                unsigned StubSize,
+                                                unsigned Alignment) {
+  return mm()->allocateStub(F, StubSize, Alignment);
+}
+
+unsigned char* SharkMemoryManager::startFunctionBody(const Function* F,
+                                                     uintptr_t& ActualSize) {
+  return mm()->startFunctionBody(F, ActualSize);
+}
+
+void SharkMemoryManager::endFunctionBody(const Function* F,
+                                         unsigned char* FunctionStart,
+                                         unsigned char* FunctionEnd) {
+  mm()->endFunctionBody(F, FunctionStart, FunctionEnd);
+
+  SharkEntry *entry = get_entry_for_function(F);
+  if (entry != NULL)
+    entry->set_code_limit(FunctionEnd);
+}
+
+unsigned char* SharkMemoryManager::startExceptionTable(const Function* F,
+                                                       uintptr_t& ActualSize) {
+  return mm()->startExceptionTable(F, ActualSize);
+}
+
+void SharkMemoryManager::endExceptionTable(const Function* F,
+                                           unsigned char* TableStart,
+                                           unsigned char* TableEnd,
+                                           unsigned char* FrameRegister) {
+  mm()->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
+}
+
+void SharkMemoryManager::setMemoryWritable() {
+  mm()->setMemoryWritable();
+}
+
+void SharkMemoryManager::setMemoryExecutable() {
+  mm()->setMemoryExecutable();
+}
+
+#if SHARK_LLVM_VERSION >= 27
+void SharkMemoryManager::deallocateExceptionTable(void *ptr) {
+  mm()->deallocateExceptionTable(ptr);
+}
+
+void SharkMemoryManager::deallocateFunctionBody(void *ptr) {
+  mm()->deallocateFunctionBody(ptr);
+}
+#else
+void SharkMemoryManager::deallocateMemForFunction(const Function* F) {
+  return mm()->deallocateMemForFunction(F);
+}
+#endif
+
+uint8_t* SharkMemoryManager::allocateGlobal(uintptr_t Size,
+                                            unsigned int Alignment) {
+  return mm()->allocateGlobal(Size, Alignment);
+}
+
+#if SHARK_LLVM_VERSION < 27
+void* SharkMemoryManager::getDlsymTable() const {
+  return mm()->getDlsymTable();
+}
+
+void SharkMemoryManager::SetDlsymTable(void *ptr) {
+  mm()->SetDlsymTable(ptr);
+}
+#endif
+
+void SharkMemoryManager::setPoisonMemory(bool poison) {
+  mm()->setPoisonMemory(poison);
+}
+
+unsigned char *SharkMemoryManager::allocateSpace(intptr_t Size,
+                                                 unsigned int Alignment) {
+  return mm()->allocateSpace(Size, Alignment);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkMemoryManager.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+// SharkMemoryManager wraps the LLVM JIT Memory Manager.  We could use
+// this to run our own memory allocation policies, but for now all we
+// use it for is figuring out where the resulting native code ended up.
+
+class SharkMemoryManager : public llvm::JITMemoryManager {
+ public:
+  SharkMemoryManager()
+    : _mm(llvm::JITMemoryManager::CreateDefaultMemManager()) {}
+
+ private:
+  llvm::JITMemoryManager* _mm;
+
+ private:
+  llvm::JITMemoryManager* mm() const {
+    return _mm;
+  }
+
+ private:
+  std::map<const llvm::Function*, SharkEntry*> _entry_map;
+
+ public:
+  void set_entry_for_function(const llvm::Function* function,
+                              SharkEntry*           entry) {
+    _entry_map[function] = entry;
+  }
+  SharkEntry* get_entry_for_function(const llvm::Function* function) {
+    return _entry_map[function];
+  }
+
+ public:
+  void AllocateGOT();
+  unsigned char* getGOTBase() const;
+  unsigned char* allocateStub(const llvm::GlobalValue* F,
+                              unsigned StubSize,
+                              unsigned Alignment);
+  unsigned char* startFunctionBody(const llvm::Function* F,
+                                   uintptr_t& ActualSize);
+  void endFunctionBody(const llvm::Function* F,
+                       unsigned char* FunctionStart,
+                       unsigned char* FunctionEnd);
+  unsigned char* startExceptionTable(const llvm::Function* F,
+                                     uintptr_t& ActualSize);
+  void endExceptionTable(const llvm::Function* F,
+                         unsigned char* TableStart,
+                         unsigned char* TableEnd,
+                         unsigned char* FrameRegister);
+#if SHARK_LLVM_VERSION < 27
+  void* getDlsymTable() const;
+  void SetDlsymTable(void *ptr);
+#endif
+  void setPoisonMemory(bool);
+  uint8_t* allocateGlobal(uintptr_t, unsigned int);
+  void setMemoryWritable();
+  void setMemoryExecutable();
+#if SHARK_LLVM_VERSION >= 27
+  void deallocateExceptionTable(void *ptr);
+  void deallocateFunctionBody(void *ptr);
+#else
+  void deallocateMemForFunction(const llvm::Function* F);
+#endif
+  unsigned char *allocateSpace(intptr_t Size,
+                               unsigned int Alignment);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,352 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkNativeWrapper.cpp.incl"
+
+using namespace llvm;
+
+void SharkNativeWrapper::initialize(const char *name) {
+  // Create the function
+  _function = Function::Create(
+    SharkType::entry_point_type(),
+    GlobalVariable::InternalLinkage,
+    name);
+
+  // Get our arguments
+  Function::arg_iterator ai = function()->arg_begin();
+  Argument *method = ai++;
+  method->setName("method");
+  Argument *base_pc = ai++;
+  base_pc->setName("base_pc");
+  code_buffer()->set_base_pc(base_pc);
+  Argument *thread = ai++;
+  thread->setName("thread");
+  set_thread(thread);
+
+  // Create and push our stack frame
+  builder()->SetInsertPoint(CreateBlock());
+  _stack = SharkStack::CreateBuildAndPushFrame(this, method);
+  NOT_PRODUCT(method = NULL);
+
+  // Create the oopmap.  We use the one oopmap for every call site in
+  // the wrapper, which results in the odd mild inefficiency but is a
+  // damn sight easier to code.
+  OopMap *oopmap = new OopMap(
+    SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
+    SharkStack::oopmap_slot_munge(arg_size()));
+  oopmap->set_oop(SharkStack::slot2reg(stack()->method_slot_offset()));
+
+  // Set up the oop_tmp slot if required:
+  //  - For static methods we use it to handlize the class argument
+  //    for the call, and to protect the same during slow path locks
+  //    (if synchronized).
+  //  - For methods returning oops, we use it to protect the return
+  //    value across safepoints or slow path unlocking.
+  if (is_static() || is_returning_oop()) {
+    _oop_tmp_slot = stack()->slot_addr(
+      stack()->oop_tmp_slot_offset(),
+      SharkType::oop_type(),
+      "oop_tmp_slot");
+
+    oopmap->set_oop(SharkStack::slot2reg(stack()->oop_tmp_slot_offset()));
+  }
+
+  // Set up the monitor slot, for synchronized methods
+  if (is_synchronized()) {
+    Unimplemented();
+    _lock_slot_offset = 23;
+  }
+
+  // Start building the argument list
+  std::vector<const Type*> param_types;
+  std::vector<Value*> param_values;
+  const PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
+
+  // First argument is the JNIEnv
+  param_types.push_back(SharkType::jniEnv_type());
+  param_values.push_back(
+    builder()->CreateAddressOfStructEntry(
+      thread,
+      JavaThread::jni_environment_offset(),
+      SharkType::jniEnv_type(),
+      "jni_environment"));
+
+  // For static methods, the second argument is the class
+  if (is_static()) {
+    builder()->CreateStore(
+      builder()->CreateInlineOop(
+        JNIHandles::make_local(
+          target()->method_holder()->klass_part()->java_mirror())),
+      oop_tmp_slot());
+
+    param_types.push_back(box_type);
+    param_values.push_back(oop_tmp_slot());
+
+    _receiver_slot_offset = stack()->oop_tmp_slot_offset();
+  }
+  else if (is_returning_oop()) {
+    // The oop_tmp slot is registered in the oopmap,
+    // so we need to clear it.  This is one of the
+    // mild inefficiencies I mentioned earlier.
+    builder()->CreateStore(LLVMValue::null(), oop_tmp_slot());
+  }
+
+  // Parse the arguments
+  for (int i = 0; i < arg_size(); i++) {
+    int slot_offset = stack()->locals_slots_offset() + arg_size() - 1 - i;
+    int adjusted_offset = slot_offset;
+    BasicBlock *null, *not_null, *merge;
+    Value *box;
+    PHINode *phi;
+
+    switch (arg_type(i)) {
+    case T_VOID:
+      break;
+
+    case T_OBJECT:
+    case T_ARRAY:
+      null     = CreateBlock("null");
+      not_null = CreateBlock("not_null");
+      merge    = CreateBlock("merge");
+
+      box = stack()->slot_addr(slot_offset, SharkType::oop_type());
+      builder()->CreateCondBr(
+        builder()->CreateICmp(
+          ICmpInst::ICMP_EQ,
+          builder()->CreateLoad(box),
+          LLVMValue::null()),
+        null, not_null);
+
+      builder()->SetInsertPoint(null);
+      builder()->CreateBr(merge);
+
+      builder()->SetInsertPoint(not_null);
+      builder()->CreateBr(merge);
+
+      builder()->SetInsertPoint(merge);
+      phi = builder()->CreatePHI(box_type, "boxed_object");
+      phi->addIncoming(ConstantPointerNull::get(box_type), null);
+      phi->addIncoming(box, not_null);
+      box = phi;
+
+      param_types.push_back(box_type);
+      param_values.push_back(box);
+
+      oopmap->set_oop(SharkStack::slot2reg(slot_offset));
+
+      if (i == 0 && !is_static())
+        _receiver_slot_offset = slot_offset;
+
+      break;
+
+    case T_LONG:
+    case T_DOUBLE:
+      adjusted_offset--;
+      // fall through
+
+    default:
+      const Type *param_type = SharkType::to_stackType(arg_type(i));
+
+      param_types.push_back(param_type);
+      param_values.push_back(
+        builder()->CreateLoad(stack()->slot_addr(adjusted_offset, param_type)));
+    }
+  }
+
+  // The oopmap is now complete, and everything is written
+  // into the frame except the PC.
+  int pc_offset = code_buffer()->create_unique_offset();
+
+  _oop_maps = new OopMapSet();
+  oop_maps()->add_gc_map(pc_offset, oopmap);
+
+  builder()->CreateStore(
+    builder()->code_buffer_address(pc_offset),
+    stack()->slot_addr(stack()->pc_slot_offset()));
+
+  // Set up the Java frame anchor
+  stack()->CreateSetLastJavaFrame();
+
+  // Lock if necessary
+  if (is_synchronized())
+    Unimplemented();
+
+  // Change the thread state to _thread_in_native
+  CreateSetThreadState(_thread_in_native);
+
+  // Make the call
+  BasicType result_type = target()->result_type();
+  const Type* return_type;
+  if (result_type == T_VOID)
+    return_type = SharkType::void_type();
+  else if (is_returning_oop())
+    return_type = box_type;
+  else
+    return_type = SharkType::to_arrayType(result_type);
+  Value* native_function = builder()->CreateIntToPtr(
+     LLVMValue::intptr_constant((intptr_t) target()->native_function()),
+     PointerType::getUnqual(
+       FunctionType::get(return_type, param_types, false)));
+  Value *result = builder()->CreateCall(
+    native_function, param_values.begin(), param_values.end());
+
+  // Start the transition back to _thread_in_Java
+  CreateSetThreadState(_thread_in_native_trans);
+
+  // Make sure new state is visible in the GC thread
+  if (os::is_MP()) {
+    if (UseMembar)
+      builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
+    else
+      CreateWriteMemorySerializePage();
+  }
+
+  // Handle safepoint operations, pending suspend requests,
+  // and pending asynchronous exceptions.
+  BasicBlock *check_thread = CreateBlock("check_thread");
+  BasicBlock *do_safepoint = CreateBlock("do_safepoint");
+  BasicBlock *safepointed  = CreateBlock("safepointed");
+
+  Value *global_state = builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant(
+        (intptr_t) SafepointSynchronize::address_of_state()),
+      PointerType::getUnqual(SharkType::jint_type())),
+    "global_state");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      global_state,
+      LLVMValue::jint_constant(SafepointSynchronize::_not_synchronized)),
+    do_safepoint, check_thread);
+
+  builder()->SetInsertPoint(check_thread);
+  Value *thread_state = builder()->CreateValueOfStructEntry(
+    thread,
+    JavaThread::suspend_flags_offset(),
+    SharkType::jint_type(),
+    "thread_state");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      thread_state,
+      LLVMValue::jint_constant(0)),
+    do_safepoint, safepointed);
+
+  builder()->SetInsertPoint(do_safepoint);
+  builder()->CreateCall(
+    builder()->check_special_condition_for_native_trans(), thread);
+  builder()->CreateBr(safepointed);
+
+  // Finally we can change the thread state to _thread_in_Java
+  builder()->SetInsertPoint(safepointed);
+  CreateSetThreadState(_thread_in_Java);
+
+  // Clear the frame anchor
+  stack()->CreateResetLastJavaFrame();
+
+  // If there is a pending exception then we can just unwind and
+  // return.  It seems totally wrong that unlocking is skipped here
+  // but apparently the template interpreter does this so we do too.
+  BasicBlock *exception    = CreateBlock("exception");
+  BasicBlock *no_exception = CreateBlock("no_exception");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(
+      CreateLoadPendingException(),
+      LLVMValue::null()),
+    no_exception, exception);
+
+  builder()->SetInsertPoint(exception);
+  CreateResetHandleBlock();
+  stack()->CreatePopFrame(0);
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+
+  builder()->SetInsertPoint(no_exception);
+
+  // If the result was an oop then unbox it before
+  // releasing the handle it might be protected by
+  if (is_returning_oop()) {
+    BasicBlock *null     = builder()->GetInsertBlock();
+    BasicBlock *not_null = CreateBlock("not_null");
+    BasicBlock *merge    = CreateBlock("merge");
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpNE(result, ConstantPointerNull::get(box_type)),
+      not_null, merge);
+
+    builder()->SetInsertPoint(not_null);
+    Value *unboxed_result = builder()->CreateLoad(result);
+    builder()->CreateBr(merge);
+
+    builder()->SetInsertPoint(merge);
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "result");
+    phi->addIncoming(LLVMValue::null(), null);
+    phi->addIncoming(unboxed_result, not_null);
+    result = phi;
+  }
+
+  // Reset handle block
+  CreateResetHandleBlock();
+
+  // Unlock if necessary.
+  if (is_synchronized())
+    Unimplemented();
+
+  // Unwind and return
+  Value *result_addr = stack()->CreatePopFrame(type2size[result_type]);
+  if (result_type != T_VOID) {
+    bool needs_cast = false;
+    bool is_signed = false;
+    switch (result_type) {
+    case T_BOOLEAN:
+      result = builder()->CreateICmpNE(result, LLVMValue::jbyte_constant(0));
+      needs_cast = true;
+      break;
+
+    case T_CHAR:
+      needs_cast = true;
+      break;
+
+    case T_BYTE:
+    case T_SHORT:
+      needs_cast = true;
+      is_signed = true;
+      break;
+    }
+    if (needs_cast) {
+      result = builder()->CreateIntCast(
+        result, SharkType::to_stackType(result_type), is_signed);
+    }
+
+    builder()->CreateStore(
+      result,
+      builder()->CreateIntToPtr(
+        result_addr,
+        PointerType::getUnqual(SharkType::to_stackType(result_type))));
+  }
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkNativeWrapper.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkNativeWrapper : public SharkCompileInvariants {
+  friend class SharkStackWithNativeFrame;
+
+ public:
+  static SharkNativeWrapper* build(SharkBuilder* builder,
+                                   methodHandle  target,
+                                   const char*   name,
+                                   BasicType*    arg_types,
+                                   BasicType     return_type) {
+    return new SharkNativeWrapper(builder,
+                                  target,
+                                  name,
+                                  arg_types,
+                                  return_type);
+  }
+
+ private:
+  SharkNativeWrapper(SharkBuilder* builder,
+                     methodHandle  target,
+                     const char*   name,
+                     BasicType*    arg_types,
+                     BasicType     return_type)
+    : SharkCompileInvariants(NULL, builder),
+      _target(target),
+      _arg_types(arg_types),
+      _return_type(return_type),
+      _lock_slot_offset(0) { initialize(name); }
+
+ private:
+  void initialize(const char* name);
+
+ private:
+  methodHandle    _target;
+  BasicType*      _arg_types;
+  BasicType       _return_type;
+  llvm::Function* _function;
+  SharkStack*     _stack;
+  llvm::Value*    _oop_tmp_slot;
+  OopMapSet*      _oop_maps;
+  int             _receiver_slot_offset;
+  int             _lock_slot_offset;
+
+  // The method being compiled.
+ protected:
+  methodHandle target() const {
+    return _target;
+  }
+
+  // Properties of the method.
+ protected:
+  int arg_size() const {
+    return target()->size_of_parameters();
+  }
+  BasicType arg_type(int i) const {
+    return _arg_types[i];
+  }
+  BasicType return_type() const {
+    return _return_type;
+  }
+  bool is_static() const {
+    return target()->is_static();
+  }
+  bool is_synchronized() const {
+    return target()->is_synchronized();
+  }
+  bool is_returning_oop() const {
+    return target()->is_returning_oop();
+  }
+
+  // The LLVM function we are building.
+ public:
+  llvm::Function* function() const {
+    return _function;
+  }
+
+  // The Zero stack and our frame on it.
+ protected:
+  SharkStack* stack() const {
+    return _stack;
+  }
+
+  // Temporary oop storage.
+ protected:
+  llvm::Value* oop_tmp_slot() const {
+    assert(is_static() || is_returning_oop(), "should be");
+    return _oop_tmp_slot;
+  }
+
+  // Information required by nmethod::new_native_nmethod().
+ public:
+  int frame_size() const {
+    return stack()->oopmap_frame_size();
+  }
+  ByteSize receiver_offset() const {
+    return in_ByteSize(_receiver_slot_offset * wordSize);
+  }
+  ByteSize lock_offset() const {
+    return in_ByteSize(_lock_slot_offset * wordSize);
+  }
+  OopMapSet* oop_maps() const {
+    return _oop_maps;
+  }
+
+  // Helpers.
+ private:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const {
+    return llvm::BasicBlock::Create(SharkContext::current(), name, function());
+  }
+  llvm::Value* thread_state_address() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(), JavaThread::thread_state_offset(),
+      llvm::PointerType::getUnqual(SharkType::jint_type()),
+      "thread_state_address");
+  }
+  llvm::Value* pending_exception_address() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(), Thread::pending_exception_offset(),
+      llvm::PointerType::getUnqual(SharkType::oop_type()),
+      "pending_exception_address");
+  }
+  void CreateSetThreadState(JavaThreadState state) const {
+    builder()->CreateStore(
+      LLVMValue::jint_constant(state), thread_state_address());
+  }
+  void CreateWriteMemorySerializePage() const {
+    builder()->CreateStore(
+      LLVMValue::jint_constant(1),
+      builder()->CreateIntToPtr(
+        builder()->CreateAdd(
+          LLVMValue::intptr_constant(
+            (intptr_t) os::get_memory_serialize_page()),
+          builder()->CreateAnd(
+            builder()->CreateLShr(
+              builder()->CreatePtrToInt(thread(), SharkType::intptr_type()),
+              LLVMValue::intptr_constant(os::get_serialize_page_shift_count())),
+            LLVMValue::intptr_constant(os::get_serialize_page_mask()))),
+        llvm::PointerType::getUnqual(SharkType::jint_type())));
+  }
+  void CreateResetHandleBlock() const {
+    llvm::Value *active_handles = builder()->CreateValueOfStructEntry(
+      thread(),
+      JavaThread::active_handles_offset(),
+      SharkType::jniHandleBlock_type(),
+      "active_handles");
+    builder()->CreateStore(
+      LLVMValue::intptr_constant(0),
+      builder()->CreateAddressOfStructEntry(
+        active_handles,
+        in_ByteSize(JNIHandleBlock::top_offset_in_bytes()),
+        llvm::PointerType::getUnqual(SharkType::intptr_type()),
+        "top"));
+  }
+  llvm::LoadInst* CreateLoadPendingException() const {
+    return builder()->CreateLoad(
+      pending_exception_address(), "pending_exception");
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkRuntime.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,251 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkRuntime.cpp.incl"
+
+using namespace llvm;
+
+JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
+                                                    int*        indexes,
+                                                    int         num_indexes))
+  constantPoolHandle pool(thread, method(thread)->constants());
+  KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass());
+
+  for (int i = 0; i < num_indexes; i++) {
+    klassOop tmp = pool->klass_at(indexes[i], CHECK_0);
+    KlassHandle chk_klass(thread, tmp);
+
+    if (exc_klass() == chk_klass())
+      return i;
+
+    if (exc_klass()->klass_part()->is_subtype_of(chk_klass()))
+      return i;
+  }
+
+  return -1;
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::monitorenter(JavaThread*      thread,
+                                           BasicObjectLock* lock))
+  if (PrintBiasedLockingStatistics)
+    Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
+
+  Handle object(thread, lock->obj());
+  assert(Universe::heap()->is_in_reserved_or_null(object()), "should be");
+  if (UseBiasedLocking) {
+    // Retry fast entry if bias is revoked to avoid unnecessary inflation
+    ObjectSynchronizer::fast_enter(object, lock->lock(), true, CHECK);
+  } else {
+    ObjectSynchronizer::slow_enter(object, lock->lock(), CHECK);
+  }
+  assert(Universe::heap()->is_in_reserved_or_null(lock->obj()), "should be");
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::monitorexit(JavaThread*      thread,
+                                          BasicObjectLock* lock))
+  Handle object(thread, lock->obj());
+  assert(Universe::heap()->is_in_reserved_or_null(object()), "should be");
+  if (lock == NULL || object()->is_unlocked()) {
+    THROW(vmSymbols::java_lang_IllegalMonitorStateException());
+  }
+  ObjectSynchronizer::slow_exit(object(), lock->lock(), thread);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::new_instance(JavaThread* thread, int index))
+  klassOop k_oop = method(thread)->constants()->klass_at(index, CHECK);
+  instanceKlassHandle klass(THREAD, k_oop);
+
+  // Make sure we are not instantiating an abstract klass
+  klass->check_valid_for_instantiation(true, CHECK);
+
+  // Make sure klass is initialized
+  klass->initialize(CHECK);
+
+  // At this point the class may not be fully initialized
+  // because of recursive initialization. If it is fully
+  // initialized & has_finalized is not set, we rewrite
+  // it into its fast version (Note: no locking is needed
+  // here since this is an atomic byte write and can be
+  // done more than once).
+  //
+  // Note: In case of classes with has_finalized we don't
+  //       rewrite since that saves us an extra check in
+  //       the fast version which then would call the
+  //       slow version anyway (and do a call back into
+  //       Java).
+  //       If we have a breakpoint, then we don't rewrite
+  //       because the _breakpoint bytecode would be lost.
+  oop obj = klass->allocate_instance(CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::newarray(JavaThread* thread,
+                                       BasicType   type,
+                                       int         size))
+  oop obj = oopFactory::new_typeArray(type, size, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::anewarray(JavaThread* thread,
+                                        int         index,
+                                        int         size))
+  klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
+  objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::multianewarray(JavaThread* thread,
+                                             int         index,
+                                             int         ndims,
+                                             int*        dims))
+  klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
+  oop obj = arrayKlass::cast(klass)->multi_allocate(ndims, dims, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread,
+                                                 oop         object))
+  assert(object->is_oop(), "should be");
+  assert(object->klass()->klass_part()->has_finalizer(), "should have");
+  instanceKlass::register_finalizer(instanceOop(object), CHECK);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_ArithmeticException(JavaThread* thread,
+                                                        const char* file,
+                                                        int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ArithmeticException(),
+    "");
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_ArrayIndexOutOfBoundsException(
+                                                     JavaThread* thread,
+                                                     const char* file,
+                                                     int         line,
+                                                     int         index))
+  char msg[jintAsStringSize];
+  snprintf(msg, sizeof(msg), "%d", index);
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ArrayIndexOutOfBoundsException(),
+    msg);
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_ClassCastException(JavaThread* thread,
+                                                       const char* file,
+                                                       int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ClassCastException(),
+    "");
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::throw_NullPointerException(JavaThread* thread,
+                                                         const char* file,
+                                                         int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_NullPointerException(),
+    "");
+JRT_END
+
+// Non-VM calls
+// Nothing in these must ever GC!
+
+void SharkRuntime::dump(const char *name, intptr_t value) {
+  oop valueOop = (oop) value;
+  tty->print("%s = ", name);
+  if (valueOop->is_oop(true))
+    valueOop->print_on(tty);
+  else if (value >= ' ' && value <= '~')
+    tty->print("'%c' (%d)", value, value);
+  else
+    tty->print("%p", value);
+  tty->print_cr("");
+}
+
+bool SharkRuntime::is_subtype_of(klassOop check_klass, klassOop object_klass) {
+  return object_klass->klass_part()->is_subtype_of(check_klass);
+}
+
+int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) {
+  Thread *THREAD = thread;
+
+  // In C2, uncommon_trap_blob creates a frame, so all the various
+  // deoptimization functions expect to find the frame of the method
+  // being deopted one frame down on the stack.  We create a dummy
+  // frame to mirror this.
+  FakeStubFrame *stubframe = FakeStubFrame::build(CHECK_0);
+  thread->push_zero_frame(stubframe);
+
+  // Initiate the trap
+  thread->set_last_Java_frame();
+  Deoptimization::UnrollBlock *urb =
+    Deoptimization::uncommon_trap(thread, trap_request);
+  thread->reset_last_Java_frame();
+
+  // Pop our dummy frame and the frame being deoptimized
+  thread->pop_zero_frame();
+  thread->pop_zero_frame();
+
+  // Push skeleton frames
+  int number_of_frames = urb->number_of_frames();
+  for (int i = 0; i < number_of_frames; i++) {
+    intptr_t size = urb->frame_sizes()[i];
+    InterpreterFrame *frame = InterpreterFrame::build(size, CHECK_0);
+    thread->push_zero_frame(frame);
+  }
+
+  // Push another dummy frame
+  stubframe = FakeStubFrame::build(CHECK_0);
+  thread->push_zero_frame(stubframe);
+
+  // Fill in the skeleton frames
+  thread->set_last_Java_frame();
+  Deoptimization::unpack_frames(thread, Deoptimization::Unpack_uncommon_trap);
+  thread->reset_last_Java_frame();
+
+  // Pop our dummy frame
+  thread->pop_zero_frame();
+
+  // Fall back into the interpreter
+  return number_of_frames;
+}
+
+FakeStubFrame* FakeStubFrame::build(TRAPS) {
+  ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
+  stack->overflow_check(header_words, CHECK_NULL);
+
+  stack->push(0); // next_frame, filled in later
+  intptr_t *fp = stack->sp();
+  assert(fp - stack->sp() == next_frame_off, "should be");
+
+  stack->push(FAKE_STUB_FRAME);
+  assert(fp - stack->sp() == frame_type_off, "should be");
+
+  return (FakeStubFrame *) fp;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkRuntime.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,83 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkRuntime : public AllStatic {
+  // VM calls
+ public:
+  static int find_exception_handler(JavaThread* thread,
+                                    int*        indexes,
+                                    int         num_indexes);
+
+  static void monitorenter(JavaThread* thread, BasicObjectLock* lock);
+  static void monitorexit(JavaThread* thread, BasicObjectLock* lock);
+
+  static void new_instance(JavaThread* thread, int index);
+  static void newarray(JavaThread* thread, BasicType type, int size);
+  static void anewarray(JavaThread* thread, int index, int size);
+  static void multianewarray(JavaThread* thread,
+                             int         index,
+                             int         ndims,
+                             int*        dims);
+
+  static void register_finalizer(JavaThread* thread, oop object);
+
+  static void throw_ArithmeticException(JavaThread* thread,
+                                        const char* file,
+                                        int         line);
+  static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread,
+                                                   const char* file,
+                                                   int         line,
+                                                   int         index);
+  static void throw_ClassCastException(JavaThread* thread,
+                                       const char* file,
+                                       int         line);
+  static void throw_NullPointerException(JavaThread* thread,
+                                         const char* file,
+                                         int         line);
+
+  // Helpers for VM calls
+ private:
+  static const SharkFrame* last_frame(JavaThread *thread) {
+    return thread->last_frame().zero_sharkframe();
+  }
+  static methodOop method(JavaThread *thread) {
+    return last_frame(thread)->method();
+  }
+  static address bcp(JavaThread *thread, int bci) {
+    return method(thread)->code_base() + bci;
+  }
+  static int two_byte_index(JavaThread *thread, int bci) {
+    return Bytes::get_Java_u2(bcp(thread, bci) + 1);
+  }
+  static intptr_t tos_at(JavaThread *thread, int offset) {
+    return *(thread->zero_stack()->sp() + offset);
+  }
+
+  // Non-VM calls
+ public:
+  static void dump(const char *name, intptr_t value);
+  static bool is_subtype_of(klassOop check_klass, klassOop object_klass);
+  static int uncommon_trap(JavaThread* thread, int trap_request);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkStack.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,263 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkStack.cpp.incl"
+
+using namespace llvm;
+
+void SharkStack::initialize(Value* method) {
+  bool setup_sp_and_method = (method != NULL);
+
+  int locals_words  = max_locals();
+  int extra_locals  = locals_words - arg_size();
+  int header_words  = SharkFrame::header_words;
+  int monitor_words = max_monitors()*frame::interpreter_frame_monitor_size();
+  int stack_words   = max_stack();
+  int frame_words   = header_words + monitor_words + stack_words;
+
+  _extended_frame_size = frame_words + locals_words;
+
+  // Update the stack pointer
+  Value *stack_pointer = builder()->CreateSub(
+    CreateLoadStackPointer(),
+    LLVMValue::intptr_constant((frame_words + extra_locals) * wordSize));
+  CreateStackOverflowCheck(stack_pointer);
+  if (setup_sp_and_method)
+    CreateStoreStackPointer(stack_pointer);
+
+  // Create the frame
+  _frame = builder()->CreateIntToPtr(
+    stack_pointer,
+    PointerType::getUnqual(
+      ArrayType::get(SharkType::intptr_type(), extended_frame_size())),
+    "frame");
+  int offset = 0;
+
+  // Expression stack
+  _stack_slots_offset = offset;
+  offset += stack_words;
+
+  // Monitors
+  _monitors_slots_offset = offset;
+  offset += monitor_words;
+
+  // Temporary oop slot
+  _oop_tmp_slot_offset = offset++;
+
+  // Method pointer
+  _method_slot_offset = offset++;
+  if (setup_sp_and_method) {
+    builder()->CreateStore(
+      method, slot_addr(method_slot_offset(), SharkType::methodOop_type()));
+  }
+
+  // Unextended SP
+  builder()->CreateStore(stack_pointer, slot_addr(offset++));
+
+  // PC
+  _pc_slot_offset = offset++;
+
+  // Frame header
+  builder()->CreateStore(
+    LLVMValue::intptr_constant(ZeroFrame::SHARK_FRAME), slot_addr(offset++));
+  Value *fp = slot_addr(offset++);
+
+  // Local variables
+  _locals_slots_offset = offset;
+  offset += locals_words;
+
+  // Push the frame
+  assert(offset == extended_frame_size(), "should do");
+  builder()->CreateStore(CreateLoadFramePointer(), fp);
+  CreateStoreFramePointer(
+    builder()->CreatePtrToInt(fp, SharkType::intptr_type()));
+}
+
+// This function should match ZeroStack::overflow_check
+void SharkStack::CreateStackOverflowCheck(Value* sp) {
+  BasicBlock *zero_ok  = CreateBlock("zero_stack_ok");
+  BasicBlock *overflow = CreateBlock("stack_overflow");
+  BasicBlock *abi_ok   = CreateBlock("abi_stack_ok");
+
+  // Check the Zero stack
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(sp, stack_base()),
+    overflow, zero_ok);
+
+  // Check the ABI stack
+  builder()->SetInsertPoint(zero_ok);
+  Value *stack_top = builder()->CreateSub(
+    builder()->CreateValueOfStructEntry(
+      thread(),
+      Thread::stack_base_offset(),
+      SharkType::intptr_type(),
+      "abi_base"),
+    builder()->CreateValueOfStructEntry(
+      thread(),
+      Thread::stack_size_offset(),
+      SharkType::intptr_type(),
+      "abi_size"));
+  Value *free_stack = builder()->CreateSub(
+    builder()->CreatePtrToInt(
+      builder()->CreateGetFrameAddress(),
+      SharkType::intptr_type(),
+      "abi_sp"),
+    stack_top);
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(
+      free_stack,
+      LLVMValue::intptr_constant(StackShadowPages * os::vm_page_size())),
+    overflow, abi_ok);
+
+  // Handle overflows
+  builder()->SetInsertPoint(overflow);
+  builder()->CreateCall(builder()->throw_StackOverflowError(), thread());
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+
+  builder()->SetInsertPoint(abi_ok);
+}
+
+Value* SharkStack::CreatePopFrame(int result_slots) {
+  assert(result_slots >= 0 && result_slots <= 2, "should be");
+  int locals_to_pop = max_locals() - result_slots;
+
+  Value *fp = CreateLoadFramePointer();
+  Value *sp = builder()->CreateAdd(
+    fp,
+    LLVMValue::intptr_constant((1 + locals_to_pop) * wordSize));
+
+  CreateStoreStackPointer(sp);
+  CreateStoreFramePointer(
+    builder()->CreateLoad(
+      builder()->CreateIntToPtr(
+        fp, PointerType::getUnqual(SharkType::intptr_type()))));
+
+  return sp;
+}
+
+Value* SharkStack::slot_addr(int         offset,
+                             const Type* type,
+                             const char* name) const {
+  bool needs_cast = type && type != SharkType::intptr_type();
+
+  Value* result = builder()->CreateStructGEP(
+    _frame, offset, needs_cast ? "" : name);
+
+  if (needs_cast) {
+    result = builder()->CreateBitCast(
+      result, PointerType::getUnqual(type), name);
+  }
+  return result;
+}
+
+// The bits that differentiate stacks with normal and native frames on top
+
+SharkStack* SharkStack::CreateBuildAndPushFrame(SharkFunction* function,
+                                                Value*         method) {
+  return new SharkStackWithNormalFrame(function, method);
+}
+SharkStack* SharkStack::CreateBuildAndPushFrame(SharkNativeWrapper* wrapper,
+                                                Value*              method) {
+  return new SharkStackWithNativeFrame(wrapper, method);
+}
+
+SharkStackWithNormalFrame::SharkStackWithNormalFrame(SharkFunction* function,
+                                                     Value*         method)
+  : SharkStack(function), _function(function) {
+  // For normal frames, the stack pointer and the method slot will
+  // be set during each decache, so it is not necessary to do them
+  // at the time the frame is created.  However, we set them for
+  // non-PRODUCT builds to make crash dumps easier to understand.
+  initialize(PRODUCT_ONLY(NULL) NOT_PRODUCT(method));
+}
+SharkStackWithNativeFrame::SharkStackWithNativeFrame(SharkNativeWrapper* wrp,
+                                                     Value*              method)
+  : SharkStack(wrp), _wrapper(wrp) {
+  initialize(method);
+}
+
+int SharkStackWithNormalFrame::arg_size() const {
+  return function()->arg_size();
+}
+int SharkStackWithNativeFrame::arg_size() const {
+  return wrapper()->arg_size();
+}
+
+int SharkStackWithNormalFrame::max_locals() const {
+  return function()->max_locals();
+}
+int SharkStackWithNativeFrame::max_locals() const {
+  return wrapper()->arg_size();
+}
+
+int SharkStackWithNormalFrame::max_stack() const {
+  return function()->max_stack();
+}
+int SharkStackWithNativeFrame::max_stack() const {
+  return 0;
+}
+
+int SharkStackWithNormalFrame::max_monitors() const {
+  return function()->max_monitors();
+}
+int SharkStackWithNativeFrame::max_monitors() const {
+  return wrapper()->is_synchronized() ? 1 : 0;
+}
+
+BasicBlock* SharkStackWithNormalFrame::CreateBlock(const char* name) const {
+  return function()->CreateBlock(name);
+}
+BasicBlock* SharkStackWithNativeFrame::CreateBlock(const char* name) const {
+  return wrapper()->CreateBlock(name);
+}
+
+address SharkStackWithNormalFrame::interpreter_entry_point() const {
+  return (address) CppInterpreter::normal_entry;
+}
+address SharkStackWithNativeFrame::interpreter_entry_point() const {
+  return (address) CppInterpreter::native_entry;
+}
+
+#ifndef PRODUCT
+void SharkStack::CreateAssertLastJavaSPIsNull() const {
+#ifdef ASSERT
+  BasicBlock *fail = CreateBlock("assert_failed");
+  BasicBlock *pass = CreateBlock("assert_ok");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(
+      builder()->CreateLoad(last_Java_sp_addr()),
+      LLVMValue::intptr_constant(0)),
+    pass, fail);
+
+  builder()->SetInsertPoint(fail);
+  builder()->CreateShouldNotReachHere(__FILE__, __LINE__);
+  builder()->CreateUnreachable();
+
+  builder()->SetInsertPoint(pass);
+#endif // ASSERT
+}
+#endif // !PRODUCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkStack.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,290 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkFunction;
+class SharkNativeWrapper;
+class SharkStackWithNormalFrame;
+class SharkStackWithNativeFrame;
+
+class SharkStack : public SharkCompileInvariants {
+ public:
+  static SharkStack* CreateBuildAndPushFrame(
+    SharkFunction* function, llvm::Value* method);
+  static SharkStack* CreateBuildAndPushFrame(
+    SharkNativeWrapper* wrapper, llvm::Value* method);
+
+ protected:
+  SharkStack(const SharkCompileInvariants* parent)
+    : SharkCompileInvariants(parent) {}
+
+ protected:
+  void initialize(llvm::Value* method);
+
+ protected:
+  void CreateStackOverflowCheck(llvm::Value* sp);
+
+  // Properties of the method being compiled
+ protected:
+  virtual int arg_size() const = 0;
+  virtual int max_locals() const = 0;
+  virtual int max_stack() const = 0;
+  virtual int max_monitors() const = 0;
+
+  // BasicBlock creation
+ protected:
+  virtual llvm::BasicBlock* CreateBlock(const char* name = "") const = 0;
+
+  // Interpreter entry point for bailouts
+ protected:
+  virtual address interpreter_entry_point() const = 0;
+
+  // Interface with the Zero stack
+ private:
+  llvm::Value* zero_stack() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::zero_stack_offset(),
+      SharkType::zeroStack_type(),
+      "zero_stack");
+  }
+  llvm::Value* stack_base() const {
+    return builder()->CreateValueOfStructEntry(
+      zero_stack(),
+      ZeroStack::base_offset(),
+      SharkType::intptr_type(),
+      "stack_base");
+  }
+  llvm::Value* stack_pointer_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      zero_stack(),
+      ZeroStack::sp_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "stack_pointer_addr");
+  }
+  llvm::Value* frame_pointer_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::top_zero_frame_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "frame_pointer_addr");
+  }
+
+ public:
+  llvm::LoadInst* CreateLoadStackPointer(const char *name = "") {
+    return builder()->CreateLoad(stack_pointer_addr(), name);
+  }
+  llvm::StoreInst* CreateStoreStackPointer(llvm::Value* value) {
+    return builder()->CreateStore(value, stack_pointer_addr());
+  }
+  llvm::LoadInst* CreateLoadFramePointer(const char *name = "") {
+    return builder()->CreateLoad(frame_pointer_addr(), name);
+  }
+  llvm::StoreInst* CreateStoreFramePointer(llvm::Value* value) {
+    return builder()->CreateStore(value, frame_pointer_addr());
+  }
+  llvm::Value* CreatePopFrame(int result_slots);
+
+  // Interface with the frame anchor
+ private:
+  llvm::Value* last_Java_sp_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::last_Java_sp_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "last_Java_sp_addr");
+  }
+  llvm::Value* last_Java_fp_addr() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(),
+      JavaThread::last_Java_fp_offset(),
+      llvm::PointerType::getUnqual(SharkType::intptr_type()),
+      "last_Java_fp_addr");
+  }
+
+ public:
+  void CreateSetLastJavaFrame() {
+    // Note that whenever _last_Java_sp != NULL other anchor fields
+    // must be valid.  The profiler apparently depends on this.
+    NOT_PRODUCT(CreateAssertLastJavaSPIsNull());
+    builder()->CreateStore(CreateLoadFramePointer(), last_Java_fp_addr());
+    // XXX There's last_Java_pc as well, but I don't think anything uses it
+    // Also XXX: should we fence here?  Zero doesn't...
+    builder()->CreateStore(CreateLoadStackPointer(), last_Java_sp_addr());
+    // Also also XXX: we could probably cache the sp (and the fp we know??)
+  }
+  void CreateResetLastJavaFrame() {
+    builder()->CreateStore(LLVMValue::intptr_constant(0), last_Java_sp_addr());
+  }
+
+ private:
+  void CreateAssertLastJavaSPIsNull() const PRODUCT_RETURN;
+
+  // Our method's frame
+ private:
+  llvm::Value* _frame;
+  int          _extended_frame_size;
+  int          _stack_slots_offset;
+
+ public:
+  int extended_frame_size() const {
+    return _extended_frame_size;
+  }
+  int oopmap_frame_size() const {
+    return extended_frame_size() - arg_size();
+  }
+
+  // Offsets of things in the frame
+ private:
+  int _monitors_slots_offset;
+  int _oop_tmp_slot_offset;
+  int _method_slot_offset;
+  int _pc_slot_offset;
+  int _locals_slots_offset;
+
+ public:
+  int stack_slots_offset() const {
+    return _stack_slots_offset;
+  }
+  int oop_tmp_slot_offset() const {
+    return _oop_tmp_slot_offset;
+  }
+  int method_slot_offset() const {
+    return _method_slot_offset;
+  }
+  int pc_slot_offset() const {
+    return _pc_slot_offset;
+  }
+  int locals_slots_offset() const {
+    return _locals_slots_offset;
+  }
+  int monitor_offset(int index) const {
+    assert(index >= 0 && index < max_monitors(), "invalid monitor index");
+    return _monitors_slots_offset +
+      (max_monitors() - 1 - index) * frame::interpreter_frame_monitor_size();
+  }
+  int monitor_object_offset(int index) const {
+    return monitor_offset(index) +
+      (BasicObjectLock::obj_offset_in_bytes() >> LogBytesPerWord);
+  }
+  int monitor_header_offset(int index) const {
+    return monitor_offset(index) +
+      ((BasicObjectLock::lock_offset_in_bytes() +
+        BasicLock::displaced_header_offset_in_bytes()) >> LogBytesPerWord);
+  }
+
+  // Addresses of things in the frame
+ public:
+  llvm::Value* slot_addr(int               offset,
+                         const llvm::Type* type = NULL,
+                         const char*       name = "") const;
+
+  llvm::Value* monitor_addr(int index) const {
+    return slot_addr(
+      monitor_offset(index),
+      SharkType::monitor_type(),
+      "monitor");
+  }
+  llvm::Value* monitor_object_addr(int index) const {
+    return slot_addr(
+      monitor_object_offset(index),
+      SharkType::oop_type(),
+      "object_addr");
+  }
+  llvm::Value* monitor_header_addr(int index) const {
+    return slot_addr(
+      monitor_header_offset(index),
+      SharkType::intptr_type(),
+      "displaced_header_addr");
+  }
+
+  // oopmap helpers
+ public:
+  static int oopmap_slot_munge(int offset) {
+    return offset << (LogBytesPerWord - LogBytesPerInt);
+  }
+  static VMReg slot2reg(int offset) {
+    return VMRegImpl::stack2reg(oopmap_slot_munge(offset));
+  }
+};
+
+class SharkStackWithNormalFrame : public SharkStack {
+  friend class SharkStack;
+
+ protected:
+  SharkStackWithNormalFrame(SharkFunction* function, llvm::Value* method);
+
+ private:
+  SharkFunction* _function;
+
+ private:
+  SharkFunction* function() const {
+    return _function;
+  }
+
+  // Properties of the method being compiled
+ private:
+  int arg_size() const;
+  int max_locals() const;
+  int max_stack() const;
+  int max_monitors() const;
+
+  // BasicBlock creation
+ private:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const;
+
+  // Interpreter entry point for bailouts
+ private:
+  address interpreter_entry_point() const;
+};
+
+class SharkStackWithNativeFrame : public SharkStack {
+  friend class SharkStack;
+
+ protected:
+  SharkStackWithNativeFrame(SharkNativeWrapper* wrapper, llvm::Value* method);
+
+ private:
+  SharkNativeWrapper* _wrapper;
+
+ private:
+  SharkNativeWrapper* wrapper() const {
+    return _wrapper;
+  }
+
+  // Properties of the method being compiled
+ private:
+  int arg_size() const;
+  int max_locals() const;
+  int max_stack() const;
+  int max_monitors() const;
+
+  // BasicBlock creation
+ private:
+  llvm::BasicBlock* CreateBlock(const char* name = "") const;
+
+  // Interpreter entry point for bailouts
+ private:
+  address interpreter_entry_point() const;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkState.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,389 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkState.cpp.incl"
+
+using namespace llvm;
+
+void SharkState::initialize(const SharkState *state) {
+  _locals = NEW_RESOURCE_ARRAY(SharkValue*, max_locals());
+  _stack  = NEW_RESOURCE_ARRAY(SharkValue*, max_stack());
+
+  NOT_PRODUCT(memset(_locals, 23, max_locals() * sizeof(SharkValue *)));
+  NOT_PRODUCT(memset(_stack,  23, max_stack()  * sizeof(SharkValue *)));
+  _sp = _stack;
+
+  if (state) {
+    for (int i = 0; i < max_locals(); i++) {
+      SharkValue *value = state->local(i);
+      if (value)
+        value = value->clone();
+      set_local(i, value);
+    }
+
+    for (int i = state->stack_depth() - 1; i >= 0; i--) {
+      SharkValue *value = state->stack(i);
+      if (value)
+        value = value->clone();
+      push(value);
+    }
+  }
+
+  set_num_monitors(state ? state->num_monitors() : 0);
+}
+
+bool SharkState::equal_to(SharkState *other) {
+  if (target() != other->target())
+    return false;
+
+  if (method() != other->method())
+    return false;
+
+  if (oop_tmp() != other->oop_tmp())
+    return false;
+
+  if (max_locals() != other->max_locals())
+    return false;
+
+  if (stack_depth() != other->stack_depth())
+    return false;
+
+  if (num_monitors() != other->num_monitors())
+    return false;
+
+  if (has_safepointed() != other->has_safepointed())
+    return false;
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    SharkValue *value = local(i);
+    SharkValue *other_value = other->local(i);
+
+    if (value == NULL) {
+      if (other_value != NULL)
+        return false;
+    }
+    else {
+      if (other_value == NULL)
+        return false;
+
+      if (!value->equal_to(other_value))
+        return false;
+    }
+  }
+
+  // Expression stack
+  for (int i = 0; i < stack_depth(); i++) {
+    SharkValue *value = stack(i);
+    SharkValue *other_value = other->stack(i);
+
+    if (value == NULL) {
+      if (other_value != NULL)
+        return false;
+    }
+    else {
+      if (other_value == NULL)
+        return false;
+
+      if (!value->equal_to(other_value))
+        return false;
+    }
+  }
+
+  return true;
+}
+
+void SharkState::merge(SharkState* other,
+                       BasicBlock* other_block,
+                       BasicBlock* this_block) {
+  // Method
+  Value *this_method = this->method();
+  Value *other_method = other->method();
+  if (this_method != other_method) {
+    PHINode *phi = builder()->CreatePHI(SharkType::methodOop_type(), "method");
+    phi->addIncoming(this_method, this_block);
+    phi->addIncoming(other_method, other_block);
+    set_method(phi);
+  }
+
+  // Temporary oop slot
+  Value *this_oop_tmp = this->oop_tmp();
+  Value *other_oop_tmp = other->oop_tmp();
+  if (this_oop_tmp != other_oop_tmp) {
+    assert(this_oop_tmp && other_oop_tmp, "can't merge NULL with non-NULL");
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "oop_tmp");
+    phi->addIncoming(this_oop_tmp, this_block);
+    phi->addIncoming(other_oop_tmp, other_block);
+    set_oop_tmp(phi);
+  }
+
+  // Monitors
+  assert(this->num_monitors() == other->num_monitors(), "should be");
+
+  // Local variables
+  assert(this->max_locals() == other->max_locals(), "should be");
+  for (int i = 0; i < max_locals(); i++) {
+    SharkValue *this_value = this->local(i);
+    SharkValue *other_value = other->local(i);
+    assert((this_value == NULL) == (other_value == NULL), "should be");
+    if (this_value != NULL) {
+      char name[18];
+      snprintf(name, sizeof(name), "local_%d_", i);
+      set_local(i, this_value->merge(
+        builder(), other_value, other_block, this_block, name));
+    }
+  }
+
+  // Expression stack
+  assert(this->stack_depth() == other->stack_depth(), "should be");
+  for (int i = 0; i < stack_depth(); i++) {
+    SharkValue *this_value = this->stack(i);
+    SharkValue *other_value = other->stack(i);
+    assert((this_value == NULL) == (other_value == NULL), "should be");
+    if (this_value != NULL) {
+      char name[18];
+      snprintf(name, sizeof(name), "stack_%d_", i);
+      set_stack(i, this_value->merge(
+        builder(), other_value, other_block, this_block, name));
+    }
+  }
+
+  // Safepointed status
+  set_has_safepointed(this->has_safepointed() && other->has_safepointed());
+}
+
+void SharkState::replace_all(SharkValue* old_value, SharkValue* new_value) {
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    if (local(i) == old_value)
+      set_local(i, new_value);
+  }
+
+  // Expression stack
+  for (int i = 0; i < stack_depth(); i++) {
+    if (stack(i) == old_value)
+      set_stack(i, new_value);
+  }
+}
+
+SharkNormalEntryState::SharkNormalEntryState(SharkTopLevelBlock* block,
+                                             Value*              method)
+  : SharkState(block) {
+  assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    ciType *type = block->local_type_at_entry(i);
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      if (i >= arg_size()) {
+        ShouldNotReachHere();
+      }
+      value = SharkValue::create_generic(type, NULL, i == 0 && !is_static());
+      break;
+
+    case ciTypeFlow::StateVector::T_NULL:
+      value = SharkValue::null();
+      break;
+
+    case ciTypeFlow::StateVector::T_BOTTOM:
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    set_local(i, value);
+  }
+  SharkNormalEntryCacher(block->function(), method).scan(this);
+}
+
+SharkOSREntryState::SharkOSREntryState(SharkTopLevelBlock* block,
+                                       Value*              method,
+                                       Value*              osr_buf)
+  : SharkState(block) {
+  assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
+  set_num_monitors(block->ciblock()->monitor_count());
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    ciType *type = block->local_type_at_entry(i);
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      value = SharkValue::create_generic(type, NULL, false);
+      break;
+
+    case ciTypeFlow::StateVector::T_NULL:
+      value = SharkValue::null();
+      break;
+
+    case ciTypeFlow::StateVector::T_BOTTOM:
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    set_local(i, value);
+  }
+  SharkOSREntryCacher(block->function(), method, osr_buf).scan(this);
+}
+
+SharkPHIState::SharkPHIState(SharkTopLevelBlock* block)
+  : SharkState(block), _block(block) {
+  BasicBlock *saved_insert_point = builder()->GetInsertBlock();
+  builder()->SetInsertPoint(block->entry_block());
+  char name[18];
+
+  // Method
+  set_method(builder()->CreatePHI(SharkType::methodOop_type(), "method"));
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    ciType *type = block->local_type_at_entry(i);
+    if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
+      // XXX we could do all kinds of clever stuff here
+      type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
+    }
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      snprintf(name, sizeof(name), "local_%d_", i);
+      value = SharkValue::create_phi(
+        type, builder()->CreatePHI(SharkType::to_stackType(type), name));
+      break;
+
+    case T_ADDRESS:
+      value = SharkValue::address_constant(type->as_return_address()->bci());
+      break;
+
+    case ciTypeFlow::StateVector::T_BOTTOM:
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    set_local(i, value);
+  }
+
+  // Expression stack
+  for (int i = 0; i < block->stack_depth_at_entry(); i++) {
+    ciType *type = block->stack_type_at_entry(i);
+    if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
+      // XXX we could do all kinds of clever stuff here
+      type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
+    }
+
+    SharkValue *value = NULL;
+    switch (type->basic_type()) {
+    case T_INT:
+    case T_LONG:
+    case T_FLOAT:
+    case T_DOUBLE:
+    case T_OBJECT:
+    case T_ARRAY:
+      snprintf(name, sizeof(name), "stack_%d_", i);
+      value = SharkValue::create_phi(
+        type, builder()->CreatePHI(SharkType::to_stackType(type), name));
+      break;
+
+    case T_ADDRESS:
+      value = SharkValue::address_constant(type->as_return_address()->bci());
+      break;
+
+    case ciTypeFlow::StateVector::T_LONG2:
+    case ciTypeFlow::StateVector::T_DOUBLE2:
+      break;
+
+    default:
+      ShouldNotReachHere();
+    }
+    push(value);
+  }
+
+  // Monitors
+  set_num_monitors(block->ciblock()->monitor_count());
+
+  builder()->SetInsertPoint(saved_insert_point);
+}
+
+void SharkPHIState::add_incoming(SharkState* incoming_state) {
+  BasicBlock *predecessor = builder()->GetInsertBlock();
+
+  // Method
+  ((PHINode *) method())->addIncoming(incoming_state->method(), predecessor);
+
+  // Local variables
+  for (int i = 0; i < max_locals(); i++) {
+    if (local(i) != NULL)
+      local(i)->addIncoming(incoming_state->local(i), predecessor);
+  }
+
+  // Expression stack
+  int stack_depth = block()->stack_depth_at_entry();
+  assert(stack_depth == incoming_state->stack_depth(), "should be");
+  for (int i = 0; i < stack_depth; i++) {
+    assert((stack(i) == NULL) == (incoming_state->stack(i) == NULL), "oops");
+    if (stack(i))
+      stack(i)->addIncoming(incoming_state->stack(i), predecessor);
+  }
+
+  // Monitors
+  assert(num_monitors() == incoming_state->num_monitors(), "should be");
+
+  // Temporary oop slot
+  assert(oop_tmp() == incoming_state->oop_tmp(), "should be");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkState.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,188 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkState : public SharkTargetInvariants {
+ public:
+  SharkState(const SharkTargetInvariants* parent)
+    : SharkTargetInvariants(parent),
+      _method(NULL),
+      _oop_tmp(NULL),
+      _has_safepointed(false) { initialize(NULL); }
+
+  SharkState(const SharkState* state)
+    : SharkTargetInvariants(state),
+      _method(state->_method),
+      _oop_tmp(state->_oop_tmp),
+      _has_safepointed(state->_has_safepointed) { initialize(state); }
+
+ private:
+  void initialize(const SharkState* state);
+
+ private:
+  llvm::Value* _method;
+  SharkValue** _locals;
+  SharkValue** _stack;
+  SharkValue** _sp;
+  int          _num_monitors;
+  llvm::Value* _oop_tmp;
+  bool         _has_safepointed;
+
+  // Method
+ public:
+  llvm::Value** method_addr() {
+    return &_method;
+  }
+  llvm::Value* method() const {
+    return _method;
+  }
+ protected:
+  void set_method(llvm::Value* method) {
+    _method = method;
+  }
+
+  // Local variables
+ public:
+  SharkValue** local_addr(int index) const {
+    assert(index >= 0 && index < max_locals(), "bad local variable index");
+    return &_locals[index];
+  }
+  SharkValue* local(int index) const {
+    return *local_addr(index);
+  }
+  void set_local(int index, SharkValue* value) {
+    *local_addr(index) = value;
+  }
+
+  // Expression stack
+ public:
+  SharkValue** stack_addr(int slot) const {
+    assert(slot >= 0 && slot < stack_depth(), "bad stack slot");
+    return &_sp[-(slot + 1)];
+  }
+  SharkValue* stack(int slot) const {
+    return *stack_addr(slot);
+  }
+ protected:
+  void set_stack(int slot, SharkValue* value) {
+    *stack_addr(slot) = value;
+  }
+ public:
+  int stack_depth() const {
+    return _sp - _stack;
+  }
+  void push(SharkValue* value) {
+    assert(stack_depth() < max_stack(), "stack overrun");
+    *(_sp++) = value;
+  }
+  SharkValue* pop() {
+    assert(stack_depth() > 0, "stack underrun");
+    return *(--_sp);
+  }
+
+  // Monitors
+ public:
+  int num_monitors() const {
+    return _num_monitors;
+  }
+  void set_num_monitors(int num_monitors) {
+    _num_monitors = num_monitors;
+  }
+
+  // Temporary oop slot
+ public:
+  llvm::Value** oop_tmp_addr() {
+    return &_oop_tmp;
+  }
+  llvm::Value* oop_tmp() const {
+    return _oop_tmp;
+  }
+  void set_oop_tmp(llvm::Value* oop_tmp) {
+    _oop_tmp = oop_tmp;
+  }
+
+  // Safepointed status
+ public:
+  bool has_safepointed() const {
+    return _has_safepointed;
+  }
+  void set_has_safepointed(bool has_safepointed) {
+    _has_safepointed = has_safepointed;
+  }
+
+  // Comparison
+ public:
+  bool equal_to(SharkState* other);
+
+  // Copy and merge
+ public:
+  SharkState* copy() const {
+    return new SharkState(this);
+  }
+  void merge(SharkState*       other,
+             llvm::BasicBlock* other_block,
+             llvm::BasicBlock* this_block);
+
+  // Value replacement
+ public:
+  void replace_all(SharkValue* old_value, SharkValue* new_value);
+};
+
+class SharkTopLevelBlock;
+
+// SharkNormalEntryState objects are used to create the state
+// that the method will be entered with for a normal invocation.
+class SharkNormalEntryState : public SharkState {
+ public:
+  SharkNormalEntryState(SharkTopLevelBlock* block,
+                        llvm::Value*        method);
+};
+
+// SharkOSREntryState objects are used to create the state
+// that the method will be entered with for an OSR invocation.
+class SharkOSREntryState : public SharkState {
+ public:
+  SharkOSREntryState(SharkTopLevelBlock* block,
+                     llvm::Value*        method,
+                     llvm::Value*        osr_buf);
+};
+
+// SharkPHIState objects are used to manage the entry state
+// for blocks with more than one entry path or for blocks
+// entered from blocks that will be compiled later.
+class SharkPHIState : public SharkState {
+ public:
+  SharkPHIState(SharkTopLevelBlock* block);
+
+ private:
+  SharkTopLevelBlock* _block;
+
+ private:
+  SharkTopLevelBlock* block() const {
+    return _block;
+  }
+
+ public:
+  void add_incoming(SharkState* incoming_state);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkStateScanner.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,99 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkStateScanner.cpp.incl"
+
+using namespace llvm;
+
+void SharkStateScanner::scan(SharkState* state) {
+  start_frame();
+
+  // Expression stack
+  stack_integrity_checks(state);
+  start_stack(state->stack_depth());
+  for (int i = state->stack_depth() - 1; i >= 0; i--) {
+    process_stack_slot(
+      i,
+      state->stack_addr(i),
+      stack()->stack_slots_offset() +
+        i + max_stack() - state->stack_depth());
+  }
+  end_stack();
+
+  // Monitors
+  start_monitors(state->num_monitors());
+  for (int i = 0; i < state->num_monitors(); i++) {
+    process_monitor(
+      i,
+      stack()->monitor_offset(i),
+      stack()->monitor_object_offset(i));
+  }
+  end_monitors();
+
+  // Frame header
+  start_frame_header();
+  process_oop_tmp_slot(
+    state->oop_tmp_addr(), stack()->oop_tmp_slot_offset());
+  process_method_slot(state->method_addr(), stack()->method_slot_offset());
+  process_pc_slot(stack()->pc_slot_offset());
+  end_frame_header();
+
+  // Local variables
+  locals_integrity_checks(state);
+  start_locals();
+  for (int i = 0; i < max_locals(); i++) {
+    process_local_slot(
+      i,
+      state->local_addr(i),
+      stack()->locals_slots_offset() + max_locals() - 1 - i);
+  }
+  end_locals();
+
+  end_frame();
+}
+
+#ifndef PRODUCT
+void SharkStateScanner::stack_integrity_checks(SharkState* state) {
+  for (int i = 0; i < state->stack_depth(); i++) {
+    if (state->stack(i)) {
+      if (state->stack(i)->is_two_word())
+        assert(state->stack(i - 1) == NULL, "should be");
+    }
+    else {
+      assert(state->stack(i + 1)->is_two_word(), "should be");
+    }
+  }
+}
+
+void SharkStateScanner::locals_integrity_checks(SharkState* state) {
+  for (int i = 0; i < max_locals(); i++) {
+    if (state->local(i)) {
+      if (state->local(i)->is_two_word())
+        assert(state->local(i + 1) == NULL, "should be");
+    }
+  }
+}
+#endif // !PRODUCT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkStateScanner.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,75 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkState;
+
+class SharkStateScanner : public SharkTargetInvariants {
+ protected:
+  SharkStateScanner(SharkFunction* function)
+    : SharkTargetInvariants(function), _stack(function->stack()) {}
+
+ private:
+  SharkStack* _stack;
+
+ protected:
+  SharkStack* stack() const {
+    return _stack;
+  }
+
+  // Scan the frame
+ public:
+  void scan(SharkState* state);
+
+  // Callbacks
+  // Note that the offsets supplied to the various process_* callbacks
+  // are specified in wordSize words from the frame's unextended_sp.
+ protected:
+  virtual void start_frame()                                                 {}
+
+  virtual void start_stack(int stack_depth)                                  {}
+  virtual void process_stack_slot(int index, SharkValue** value, int offset) {}
+  virtual void end_stack()                                                   {}
+
+  virtual void start_monitors(int num_monitors)                              {}
+  virtual void process_monitor(int index, int box_offset, int obj_offset)    {}
+  virtual void end_monitors()                                                {}
+
+  virtual void start_frame_header()                                          {}
+  virtual void process_oop_tmp_slot(llvm::Value** value, int offset)         {}
+  virtual void process_method_slot(llvm::Value** value, int offset)          {}
+  virtual void process_pc_slot(int offset)                                   {}
+  virtual void end_frame_header()                                            {}
+
+  virtual void start_locals()                                                {}
+  virtual void process_local_slot(int index, SharkValue** value, int offset) {}
+  virtual void end_locals()                                                  {}
+
+  virtual void end_frame()                                                   {}
+
+  // Integrity checks
+ private:
+  void stack_integrity_checks(SharkState* state) PRODUCT_RETURN;
+  void locals_integrity_checks(SharkState* state) PRODUCT_RETURN;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,1991 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkTopLevelBlock.cpp.incl"
+
+using namespace llvm;
+
+void SharkTopLevelBlock::scan_for_traps() {
+  // If typeflow found a trap then don't scan past it
+  int limit_bci = ciblock()->has_trap() ? ciblock()->trap_bci() : limit();
+
+  // Scan the bytecode for traps that are always hit
+  iter()->reset_to_bci(start());
+  while (iter()->next_bci() < limit_bci) {
+    iter()->next();
+
+    ciField *field;
+    ciMethod *method;
+    ciInstanceKlass *klass;
+    bool will_link;
+    bool is_field;
+
+    switch (bc()) {
+    case Bytecodes::_ldc:
+    case Bytecodes::_ldc_w:
+      if (!SharkConstant::for_ldc(iter())->is_loaded()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_uninitialized,
+            Deoptimization::Action_reinterpret), bci());
+        return;
+      }
+      break;
+
+    case Bytecodes::_getfield:
+    case Bytecodes::_getstatic:
+    case Bytecodes::_putfield:
+    case Bytecodes::_putstatic:
+      field = iter()->get_field(will_link);
+      assert(will_link, "typeflow responsibility");
+      is_field = (bc() == Bytecodes::_getfield || bc() == Bytecodes::_putfield);
+
+      // If the bytecode does not match the field then bail out to
+      // the interpreter to throw an IncompatibleClassChangeError
+      if (is_field == field->is_static()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_unhandled,
+            Deoptimization::Action_none), bci());
+        return;
+      }
+
+      // Bail out if we are trying to access a static variable
+      // before the class initializer has completed.
+      if (!is_field && !field->holder()->is_initialized()) {
+        if (!static_field_ok_in_clinit(field)) {
+          set_trap(
+            Deoptimization::make_trap_request(
+              Deoptimization::Reason_uninitialized,
+              Deoptimization::Action_reinterpret), bci());
+          return;
+        }
+      }
+      break;
+
+    case Bytecodes::_invokestatic:
+    case Bytecodes::_invokespecial:
+    case Bytecodes::_invokevirtual:
+    case Bytecodes::_invokeinterface:
+      method = iter()->get_method(will_link);
+      assert(will_link, "typeflow responsibility");
+
+      if (!method->holder()->is_linked()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_uninitialized,
+            Deoptimization::Action_reinterpret), bci());
+          return;
+      }
+
+      if (bc() == Bytecodes::_invokevirtual) {
+        klass = ciEnv::get_instance_klass_for_declared_method_holder(
+          iter()->get_declared_method_holder());
+        if (!klass->is_linked()) {
+          set_trap(
+            Deoptimization::make_trap_request(
+              Deoptimization::Reason_uninitialized,
+              Deoptimization::Action_reinterpret), bci());
+            return;
+        }
+      }
+      break;
+
+    case Bytecodes::_new:
+      klass = iter()->get_klass(will_link)->as_instance_klass();
+      assert(will_link, "typeflow responsibility");
+
+      // Bail out if the class is unloaded
+      if (iter()->is_unresolved_klass() || !klass->is_initialized()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_uninitialized,
+            Deoptimization::Action_reinterpret), bci());
+        return;
+      }
+
+      // Bail out if the class cannot be instantiated
+      if (klass->is_abstract() || klass->is_interface() ||
+          klass->name() == ciSymbol::java_lang_Class()) {
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_unhandled,
+            Deoptimization::Action_reinterpret), bci());
+        return;
+      }
+      break;
+    }
+  }
+
+  // Trap if typeflow trapped (and we didn't before)
+  if (ciblock()->has_trap()) {
+    set_trap(
+      Deoptimization::make_trap_request(
+        Deoptimization::Reason_unloaded,
+        Deoptimization::Action_reinterpret,
+        ciblock()->trap_index()), ciblock()->trap_bci());
+    return;
+  }
+}
+
+bool SharkTopLevelBlock::static_field_ok_in_clinit(ciField* field) {
+  assert(field->is_static(), "should be");
+
+  // This code is lifted pretty much verbatim from C2's
+  // Parse::static_field_ok_in_clinit() in parse3.cpp.
+  bool access_OK = false;
+  if (target()->holder()->is_subclass_of(field->holder())) {
+    if (target()->is_static()) {
+      if (target()->name() == ciSymbol::class_initializer_name()) {
+        // It's OK to access static fields from the class initializer
+        access_OK = true;
+      }
+    }
+    else {
+      if (target()->name() == ciSymbol::object_initializer_name()) {
+        // It's also OK to access static fields inside a constructor,
+        // because any thread calling the constructor must first have
+        // synchronized on the class by executing a "new" bytecode.
+        access_OK = true;
+      }
+    }
+  }
+  return access_OK;
+}
+
+SharkState* SharkTopLevelBlock::entry_state() {
+  if (_entry_state == NULL) {
+    assert(needs_phis(), "should do");
+    _entry_state = new SharkPHIState(this);
+  }
+  return _entry_state;
+}
+
+void SharkTopLevelBlock::add_incoming(SharkState* incoming_state) {
+  if (needs_phis()) {
+    ((SharkPHIState *) entry_state())->add_incoming(incoming_state);
+  }
+  else if (_entry_state == NULL) {
+    _entry_state = incoming_state;
+  }
+  else {
+    assert(entry_state()->equal_to(incoming_state), "should be");
+  }
+}
+
+void SharkTopLevelBlock::enter(SharkTopLevelBlock* predecessor,
+                               bool is_exception) {
+  // This block requires phis:
+  //  - if it is entered more than once
+  //  - if it is an exception handler, because in which
+  //    case we assume it's entered more than once.
+  //  - if the predecessor will be compiled after this
+  //    block, in which case we can't simple propagate
+  //    the state forward.
+  if (!needs_phis() &&
+      (entered() ||
+       is_exception ||
+       (predecessor && predecessor->index() >= index())))
+    _needs_phis = true;
+
+  // Recurse into the tree
+  if (!entered()) {
+    _entered = true;
+
+    scan_for_traps();
+    if (!has_trap()) {
+      for (int i = 0; i < num_successors(); i++) {
+        successor(i)->enter(this, false);
+      }
+    }
+    compute_exceptions();
+    for (int i = 0; i < num_exceptions(); i++) {
+      SharkTopLevelBlock *handler = exception(i);
+      if (handler)
+        handler->enter(this, true);
+    }
+  }
+}
+
+void SharkTopLevelBlock::initialize() {
+  char name[28];
+  snprintf(name, sizeof(name),
+           "bci_%d%s",
+           start(), is_backedge_copy() ? "_backedge_copy" : "");
+  _entry_block = function()->CreateBlock(name);
+}
+
+void SharkTopLevelBlock::decache_for_Java_call(ciMethod *callee) {
+  SharkJavaCallDecacher(function(), bci(), callee).scan(current_state());
+  for (int i = 0; i < callee->arg_size(); i++)
+    xpop();
+}
+
+void SharkTopLevelBlock::cache_after_Java_call(ciMethod *callee) {
+  if (callee->return_type()->size()) {
+    ciType *type;
+    switch (callee->return_type()->basic_type()) {
+    case T_BOOLEAN:
+    case T_BYTE:
+    case T_CHAR:
+    case T_SHORT:
+      type = ciType::make(T_INT);
+      break;
+
+    default:
+      type = callee->return_type();
+    }
+
+    push(SharkValue::create_generic(type, NULL, false));
+  }
+  SharkJavaCallCacher(function(), callee).scan(current_state());
+}
+
+void SharkTopLevelBlock::decache_for_VM_call() {
+  SharkVMCallDecacher(function(), bci()).scan(current_state());
+}
+
+void SharkTopLevelBlock::cache_after_VM_call() {
+  SharkVMCallCacher(function()).scan(current_state());
+}
+
+void SharkTopLevelBlock::decache_for_trap() {
+  SharkTrapDecacher(function(), bci()).scan(current_state());
+}
+
+void SharkTopLevelBlock::emit_IR() {
+  builder()->SetInsertPoint(entry_block());
+
+  // Parse the bytecode
+  parse_bytecode(start(), limit());
+
+  // If this block falls through to the next then it won't have been
+  // terminated by a bytecode and we have to add the branch ourselves
+  if (falls_through() && !has_trap())
+    do_branch(ciTypeFlow::FALL_THROUGH);
+}
+
+SharkTopLevelBlock* SharkTopLevelBlock::bci_successor(int bci) const {
+  // XXX now with Linear Search Technology (tm)
+  for (int i = 0; i < num_successors(); i++) {
+    ciTypeFlow::Block *successor = ciblock()->successors()->at(i);
+    if (successor->start() == bci)
+      return function()->block(successor->pre_order());
+  }
+  ShouldNotReachHere();
+}
+
+void SharkTopLevelBlock::do_zero_check(SharkValue *value) {
+  if (value->is_phi() && value->as_phi()->all_incomers_zero_checked()) {
+    function()->add_deferred_zero_check(this, value);
+  }
+  else {
+    BasicBlock *continue_block = function()->CreateBlock("not_zero");
+    SharkState *saved_state = current_state();
+    set_current_state(saved_state->copy());
+    zero_check_value(value, continue_block);
+    builder()->SetInsertPoint(continue_block);
+    set_current_state(saved_state);
+  }
+
+  value->set_zero_checked(true);
+}
+
+void SharkTopLevelBlock::do_deferred_zero_check(SharkValue* value,
+                                                int         bci,
+                                                SharkState* saved_state,
+                                                BasicBlock* continue_block) {
+  if (value->as_phi()->all_incomers_zero_checked()) {
+    builder()->CreateBr(continue_block);
+  }
+  else {
+    iter()->force_bci(start());
+    set_current_state(saved_state);
+    zero_check_value(value, continue_block);
+  }
+}
+
+void SharkTopLevelBlock::zero_check_value(SharkValue* value,
+                                          BasicBlock* continue_block) {
+  BasicBlock *zero_block = builder()->CreateBlock(continue_block, "zero");
+
+  Value *a, *b;
+  switch (value->basic_type()) {
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    a = value->jint_value();
+    b = LLVMValue::jint_constant(0);
+    break;
+  case T_LONG:
+    a = value->jlong_value();
+    b = LLVMValue::jlong_constant(0);
+    break;
+  case T_OBJECT:
+  case T_ARRAY:
+    a = value->jobject_value();
+    b = LLVMValue::LLVMValue::null();
+    break;
+  default:
+    tty->print_cr("Unhandled type %s", type2name(value->basic_type()));
+    ShouldNotReachHere();
+  }
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(a, b), continue_block, zero_block);
+
+  builder()->SetInsertPoint(zero_block);
+  if (value->is_jobject()) {
+    call_vm(
+      builder()->throw_NullPointerException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+  }
+  else {
+    call_vm(
+      builder()->throw_ArithmeticException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+  }
+
+  Value *pending_exception = get_pending_exception();
+  clear_pending_exception();
+  handle_exception(pending_exception, EX_CHECK_FULL);
+}
+
+void SharkTopLevelBlock::check_bounds(SharkValue* array, SharkValue* index) {
+  BasicBlock *out_of_bounds = function()->CreateBlock("out_of_bounds");
+  BasicBlock *in_bounds     = function()->CreateBlock("in_bounds");
+
+  Value *length = builder()->CreateArrayLength(array->jarray_value());
+  // we use an unsigned comparison to catch negative values
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(index->jint_value(), length),
+    in_bounds, out_of_bounds);
+
+  builder()->SetInsertPoint(out_of_bounds);
+  SharkState *saved_state = current_state()->copy();
+
+  call_vm(
+    builder()->throw_ArrayIndexOutOfBoundsException(),
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) __FILE__),
+      PointerType::getUnqual(SharkType::jbyte_type())),
+    LLVMValue::jint_constant(__LINE__),
+    index->jint_value(),
+    EX_CHECK_NONE);
+
+  Value *pending_exception = get_pending_exception();
+  clear_pending_exception();
+  handle_exception(pending_exception, EX_CHECK_FULL);
+
+  set_current_state(saved_state);
+
+  builder()->SetInsertPoint(in_bounds);
+}
+
+void SharkTopLevelBlock::check_pending_exception(int action) {
+  assert(action & EAM_CHECK, "should be");
+
+  BasicBlock *exception    = function()->CreateBlock("exception");
+  BasicBlock *no_exception = function()->CreateBlock("no_exception");
+
+  Value *pending_exception = get_pending_exception();
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(pending_exception, LLVMValue::null()),
+    no_exception, exception);
+
+  builder()->SetInsertPoint(exception);
+  SharkState *saved_state = current_state()->copy();
+  if (action & EAM_MONITOR_FUDGE) {
+    // The top monitor is marked live, but the exception was thrown
+    // while setting it up so we need to mark it dead before we enter
+    // any exception handlers as they will not expect it to be there.
+    set_num_monitors(num_monitors() - 1);
+    action ^= EAM_MONITOR_FUDGE;
+  }
+  clear_pending_exception();
+  handle_exception(pending_exception, action);
+  set_current_state(saved_state);
+
+  builder()->SetInsertPoint(no_exception);
+}
+
+void SharkTopLevelBlock::compute_exceptions() {
+  ciExceptionHandlerStream str(target(), start());
+
+  int exc_count = str.count();
+  _exc_handlers = new GrowableArray<ciExceptionHandler*>(exc_count);
+  _exceptions   = new GrowableArray<SharkTopLevelBlock*>(exc_count);
+
+  int index = 0;
+  for (; !str.is_done(); str.next()) {
+    ciExceptionHandler *handler = str.handler();
+    if (handler->handler_bci() == -1)
+      break;
+    _exc_handlers->append(handler);
+
+    // Try and get this exception's handler from typeflow.  We should
+    // do it this way always, really, except that typeflow sometimes
+    // doesn't record exceptions, even loaded ones, and sometimes it
+    // returns them with a different handler bci.  Why???
+    SharkTopLevelBlock *block = NULL;
+    ciInstanceKlass* klass;
+    if (handler->is_catch_all()) {
+      klass = java_lang_Throwable_klass();
+    }
+    else {
+      klass = handler->catch_klass();
+    }
+    for (int i = 0; i < ciblock()->exceptions()->length(); i++) {
+      if (klass == ciblock()->exc_klasses()->at(i)) {
+        block = function()->block(ciblock()->exceptions()->at(i)->pre_order());
+        if (block->start() == handler->handler_bci())
+          break;
+        else
+          block = NULL;
+      }
+    }
+
+    // If typeflow let us down then try and figure it out ourselves
+    if (block == NULL) {
+      for (int i = 0; i < function()->block_count(); i++) {
+        SharkTopLevelBlock *candidate = function()->block(i);
+        if (candidate->start() == handler->handler_bci()) {
+          if (block != NULL) {
+            NOT_PRODUCT(warning("there may be trouble ahead"));
+            block = NULL;
+            break;
+          }
+          block = candidate;
+        }
+      }
+    }
+    _exceptions->append(block);
+  }
+}
+
+void SharkTopLevelBlock::handle_exception(Value* exception, int action) {
+  if (action & EAM_HANDLE && num_exceptions() != 0) {
+    // Clear the stack and push the exception onto it
+    while (xstack_depth())
+      pop();
+    push(SharkValue::create_jobject(exception, true));
+
+    // Work out how many options we have to check
+    bool has_catch_all = exc_handler(num_exceptions() - 1)->is_catch_all();
+    int num_options = num_exceptions();
+    if (has_catch_all)
+      num_options--;
+
+    // Marshal any non-catch-all handlers
+    if (num_options > 0) {
+      bool all_loaded = true;
+      for (int i = 0; i < num_options; i++) {
+        if (!exc_handler(i)->catch_klass()->is_loaded()) {
+          all_loaded = false;
+          break;
+        }
+      }
+
+      if (all_loaded)
+        marshal_exception_fast(num_options);
+      else
+        marshal_exception_slow(num_options);
+    }
+
+    // Install the catch-all handler, if present
+    if (has_catch_all) {
+      builder()->CreateBr(handler_for_exception(num_options));
+      return;
+    }
+  }
+
+  // No exception handler was found; unwind and return
+  handle_return(T_VOID, exception);
+}
+
+void SharkTopLevelBlock::marshal_exception_fast(int num_options) {
+  Value *exception_klass = builder()->CreateValueOfStructEntry(
+    xstack(0)->jobject_value(),
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "exception_klass");
+
+  for (int i = 0; i < num_options; i++) {
+    Value *check_klass =
+      builder()->CreateInlineOop(exc_handler(i)->catch_klass());
+
+    BasicBlock *not_exact   = function()->CreateBlock("not_exact");
+    BasicBlock *not_subtype = function()->CreateBlock("not_subtype");
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpEQ(check_klass, exception_klass),
+      handler_for_exception(i), not_exact);
+
+    builder()->SetInsertPoint(not_exact);
+    builder()->CreateCondBr(
+      builder()->CreateICmpNE(
+        builder()->CreateCall2(
+          builder()->is_subtype_of(), check_klass, exception_klass),
+        LLVMValue::jbyte_constant(0)),
+      handler_for_exception(i), not_subtype);
+
+    builder()->SetInsertPoint(not_subtype);
+  }
+}
+
+void SharkTopLevelBlock::marshal_exception_slow(int num_options) {
+  int *indexes = NEW_RESOURCE_ARRAY(int, num_options);
+  for (int i = 0; i < num_options; i++)
+    indexes[i] = exc_handler(i)->catch_klass_index();
+
+  Value *index = call_vm(
+    builder()->find_exception_handler(),
+    builder()->CreateInlineData(
+      indexes,
+      num_options * sizeof(int),
+      PointerType::getUnqual(SharkType::jint_type())),
+    LLVMValue::jint_constant(num_options),
+    EX_CHECK_NO_CATCH);
+
+  BasicBlock *no_handler = function()->CreateBlock("no_handler");
+  SwitchInst *switchinst = builder()->CreateSwitch(
+    index, no_handler, num_options);
+
+  for (int i = 0; i < num_options; i++) {
+    switchinst->addCase(
+      LLVMValue::jint_constant(i),
+      handler_for_exception(i));
+  }
+
+  builder()->SetInsertPoint(no_handler);
+}
+
+BasicBlock* SharkTopLevelBlock::handler_for_exception(int index) {
+  SharkTopLevelBlock *successor = this->exception(index);
+  if (successor) {
+    successor->add_incoming(current_state());
+    return successor->entry_block();
+  }
+  else {
+    return make_trap(
+      exc_handler(index)->handler_bci(),
+      Deoptimization::make_trap_request(
+        Deoptimization::Reason_unhandled,
+        Deoptimization::Action_reinterpret));
+  }
+}
+
+void SharkTopLevelBlock::maybe_add_safepoint() {
+  if (current_state()->has_safepointed())
+    return;
+
+  BasicBlock *orig_block = builder()->GetInsertBlock();
+  SharkState *orig_state = current_state()->copy();
+
+  BasicBlock *do_safepoint = function()->CreateBlock("do_safepoint");
+  BasicBlock *safepointed  = function()->CreateBlock("safepointed");
+
+  Value *state = builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant(
+        (intptr_t) SafepointSynchronize::address_of_state()),
+      PointerType::getUnqual(SharkType::jint_type())),
+    "state");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(
+      state,
+      LLVMValue::jint_constant(SafepointSynchronize::_synchronizing)),
+    do_safepoint, safepointed);
+
+  builder()->SetInsertPoint(do_safepoint);
+  call_vm(builder()->safepoint(), EX_CHECK_FULL);
+  BasicBlock *safepointed_block = builder()->GetInsertBlock();
+  builder()->CreateBr(safepointed);
+
+  builder()->SetInsertPoint(safepointed);
+  current_state()->merge(orig_state, orig_block, safepointed_block);
+
+  current_state()->set_has_safepointed(true);
+}
+
+void SharkTopLevelBlock::maybe_add_backedge_safepoint() {
+  if (current_state()->has_safepointed())
+    return;
+
+  for (int i = 0; i < num_successors(); i++) {
+    if (successor(i)->can_reach(this)) {
+      maybe_add_safepoint();
+      break;
+    }
+  }
+}
+
+bool SharkTopLevelBlock::can_reach(SharkTopLevelBlock* other) {
+  for (int i = 0; i < function()->block_count(); i++)
+    function()->block(i)->_can_reach_visited = false;
+
+  return can_reach_helper(other);
+}
+
+bool SharkTopLevelBlock::can_reach_helper(SharkTopLevelBlock* other) {
+  if (this == other)
+    return true;
+
+  if (_can_reach_visited)
+    return false;
+  _can_reach_visited = true;
+
+  if (!has_trap()) {
+    for (int i = 0; i < num_successors(); i++) {
+      if (successor(i)->can_reach_helper(other))
+        return true;
+    }
+  }
+
+  for (int i = 0; i < num_exceptions(); i++) {
+    SharkTopLevelBlock *handler = exception(i);
+    if (handler && handler->can_reach_helper(other))
+      return true;
+  }
+
+  return false;
+}
+
+BasicBlock* SharkTopLevelBlock::make_trap(int trap_bci, int trap_request) {
+  BasicBlock *trap_block = function()->CreateBlock("trap");
+  BasicBlock *orig_block = builder()->GetInsertBlock();
+  builder()->SetInsertPoint(trap_block);
+
+  int orig_bci = bci();
+  iter()->force_bci(trap_bci);
+
+  do_trap(trap_request);
+
+  builder()->SetInsertPoint(orig_block);
+  iter()->force_bci(orig_bci);
+
+  return trap_block;
+}
+
+void SharkTopLevelBlock::do_trap(int trap_request) {
+  decache_for_trap();
+  builder()->CreateRet(
+    builder()->CreateCall2(
+      builder()->uncommon_trap(),
+      thread(),
+      LLVMValue::jint_constant(trap_request)));
+}
+
+void SharkTopLevelBlock::call_register_finalizer(Value *receiver) {
+  BasicBlock *orig_block = builder()->GetInsertBlock();
+  SharkState *orig_state = current_state()->copy();
+
+  BasicBlock *do_call = function()->CreateBlock("has_finalizer");
+  BasicBlock *done    = function()->CreateBlock("done");
+
+  Value *klass = builder()->CreateValueOfStructEntry(
+    receiver,
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "klass");
+
+  Value *klass_part = builder()->CreateAddressOfStructEntry(
+    klass,
+    in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
+    SharkType::klass_type(),
+    "klass_part");
+
+  Value *access_flags = builder()->CreateValueOfStructEntry(
+    klass_part,
+    in_ByteSize(Klass::access_flags_offset_in_bytes()),
+    SharkType::jint_type(),
+    "access_flags");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      builder()->CreateAnd(
+        access_flags,
+        LLVMValue::jint_constant(JVM_ACC_HAS_FINALIZER)),
+      LLVMValue::jint_constant(0)),
+    do_call, done);
+
+  builder()->SetInsertPoint(do_call);
+  call_vm(builder()->register_finalizer(), receiver, EX_CHECK_FULL);
+  BasicBlock *branch_block = builder()->GetInsertBlock();
+  builder()->CreateBr(done);
+
+  builder()->SetInsertPoint(done);
+  current_state()->merge(orig_state, orig_block, branch_block);
+}
+
+void SharkTopLevelBlock::handle_return(BasicType type, Value* exception) {
+  assert (exception == NULL || type == T_VOID, "exception OR result, please");
+
+  if (num_monitors()) {
+    // Protect our exception across possible monitor release decaches
+    if (exception)
+      set_oop_tmp(exception);
+
+    // We don't need to check for exceptions thrown here.  If
+    // we're returning a value then we just carry on as normal:
+    // the caller will see the pending exception and handle it.
+    // If we're returning with an exception then that exception
+    // takes priority and the release_lock one will be ignored.
+    while (num_monitors())
+      release_lock(EX_CHECK_NONE);
+
+    // Reload the exception we're throwing
+    if (exception)
+      exception = get_oop_tmp();
+  }
+
+  if (exception) {
+    builder()->CreateStore(exception, pending_exception_address());
+  }
+
+  Value *result_addr = stack()->CreatePopFrame(type2size[type]);
+  if (type != T_VOID) {
+    builder()->CreateStore(
+      pop_result(type)->generic_value(),
+      builder()->CreateIntToPtr(
+        result_addr,
+        PointerType::getUnqual(SharkType::to_stackType(type))));
+  }
+
+  builder()->CreateRet(LLVMValue::jint_constant(0));
+}
+
+void SharkTopLevelBlock::do_arraylength() {
+  SharkValue *array = pop();
+  check_null(array);
+  Value *length = builder()->CreateArrayLength(array->jarray_value());
+  push(SharkValue::create_jint(length, false));
+}
+
+void SharkTopLevelBlock::do_aload(BasicType basic_type) {
+  SharkValue *index = pop();
+  SharkValue *array = pop();
+
+  check_null(array);
+  check_bounds(array, index);
+
+  Value *value = builder()->CreateLoad(
+    builder()->CreateArrayAddress(
+      array->jarray_value(), basic_type, index->jint_value()));
+
+  const Type *stack_type = SharkType::to_stackType(basic_type);
+  if (value->getType() != stack_type)
+    value = builder()->CreateIntCast(value, stack_type, basic_type != T_CHAR);
+
+  switch (basic_type) {
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    push(SharkValue::create_jint(value, false));
+    break;
+
+  case T_LONG:
+    push(SharkValue::create_jlong(value, false));
+    break;
+
+  case T_FLOAT:
+    push(SharkValue::create_jfloat(value));
+    break;
+
+  case T_DOUBLE:
+    push(SharkValue::create_jdouble(value));
+    break;
+
+  case T_OBJECT:
+    // You might expect that array->type()->is_array_klass() would
+    // always be true, but it isn't.  If ciTypeFlow detects that a
+    // value is always null then that value becomes an untyped null
+    // object.  Shark doesn't presently support this, so a generic
+    // T_OBJECT is created.  In this case we guess the type using
+    // the BasicType we were supplied.  In reality the generated
+    // code will never be used, as the null value will be caught
+    // by the above null pointer check.
+    // http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=324
+    push(
+      SharkValue::create_generic(
+        array->type()->is_array_klass() ?
+          ((ciArrayKlass *) array->type())->element_type() :
+          ciType::make(basic_type),
+        value, false));
+    break;
+
+  default:
+    tty->print_cr("Unhandled type %s", type2name(basic_type));
+    ShouldNotReachHere();
+  }
+}
+
+void SharkTopLevelBlock::do_astore(BasicType basic_type) {
+  SharkValue *svalue = pop();
+  SharkValue *index  = pop();
+  SharkValue *array  = pop();
+
+  check_null(array);
+  check_bounds(array, index);
+
+  Value *value;
+  switch (basic_type) {
+  case T_BYTE:
+  case T_CHAR:
+  case T_SHORT:
+  case T_INT:
+    value = svalue->jint_value();
+    break;
+
+  case T_LONG:
+    value = svalue->jlong_value();
+    break;
+
+  case T_FLOAT:
+    value = svalue->jfloat_value();
+    break;
+
+  case T_DOUBLE:
+    value = svalue->jdouble_value();
+    break;
+
+  case T_OBJECT:
+    value = svalue->jobject_value();
+    // XXX assignability check
+    break;
+
+  default:
+    tty->print_cr("Unhandled type %s", type2name(basic_type));
+    ShouldNotReachHere();
+  }
+
+  const Type *array_type = SharkType::to_arrayType(basic_type);
+  if (value->getType() != array_type)
+    value = builder()->CreateIntCast(value, array_type, basic_type != T_CHAR);
+
+  Value *addr = builder()->CreateArrayAddress(
+    array->jarray_value(), basic_type, index->jint_value(), "addr");
+
+  builder()->CreateStore(value, addr);
+
+  if (basic_type == T_OBJECT) // XXX or T_ARRAY?
+    builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr);
+}
+
+void SharkTopLevelBlock::do_return(BasicType type) {
+  if (target()->intrinsic_id() == vmIntrinsics::_Object_init)
+    call_register_finalizer(local(0)->jobject_value());
+  maybe_add_safepoint();
+  handle_return(type, NULL);
+}
+
+void SharkTopLevelBlock::do_athrow() {
+  SharkValue *exception = pop();
+  check_null(exception);
+  handle_exception(exception->jobject_value(), EX_CHECK_FULL);
+}
+
+void SharkTopLevelBlock::do_goto() {
+  do_branch(ciTypeFlow::GOTO_TARGET);
+}
+
+void SharkTopLevelBlock::do_jsr() {
+  push(SharkValue::address_constant(iter()->next_bci()));
+  do_branch(ciTypeFlow::GOTO_TARGET);
+}
+
+void SharkTopLevelBlock::do_ret() {
+  assert(local(iter()->get_index())->address_value() ==
+         successor(ciTypeFlow::GOTO_TARGET)->start(), "should be");
+  do_branch(ciTypeFlow::GOTO_TARGET);
+}
+
+// All propagation of state from one block to the next (via
+// dest->add_incoming) is handled by these methods:
+//   do_branch
+//   do_if_helper
+//   do_switch
+//   handle_exception
+
+void SharkTopLevelBlock::do_branch(int successor_index) {
+  SharkTopLevelBlock *dest = successor(successor_index);
+  builder()->CreateBr(dest->entry_block());
+  dest->add_incoming(current_state());
+}
+
+void SharkTopLevelBlock::do_if(ICmpInst::Predicate p,
+                               SharkValue*         b,
+                               SharkValue*         a) {
+  Value *llvm_a, *llvm_b;
+  if (a->is_jobject()) {
+    llvm_a = a->intptr_value(builder());
+    llvm_b = b->intptr_value(builder());
+  }
+  else {
+    llvm_a = a->jint_value();
+    llvm_b = b->jint_value();
+  }
+  do_if_helper(p, llvm_b, llvm_a, current_state(), current_state());
+}
+
+void SharkTopLevelBlock::do_if_helper(ICmpInst::Predicate p,
+                                      Value*              b,
+                                      Value*              a,
+                                      SharkState*         if_taken_state,
+                                      SharkState*         not_taken_state) {
+  SharkTopLevelBlock *if_taken  = successor(ciTypeFlow::IF_TAKEN);
+  SharkTopLevelBlock *not_taken = successor(ciTypeFlow::IF_NOT_TAKEN);
+
+  builder()->CreateCondBr(
+    builder()->CreateICmp(p, a, b),
+    if_taken->entry_block(), not_taken->entry_block());
+
+  if_taken->add_incoming(if_taken_state);
+  not_taken->add_incoming(not_taken_state);
+}
+
+void SharkTopLevelBlock::do_switch() {
+  int len = switch_table_length();
+
+  SharkTopLevelBlock *dest_block = successor(ciTypeFlow::SWITCH_DEFAULT);
+  SwitchInst *switchinst = builder()->CreateSwitch(
+    pop()->jint_value(), dest_block->entry_block(), len);
+  dest_block->add_incoming(current_state());
+
+  for (int i = 0; i < len; i++) {
+    int dest_bci = switch_dest(i);
+    if (dest_bci != switch_default_dest()) {
+      dest_block = bci_successor(dest_bci);
+      switchinst->addCase(
+        LLVMValue::jint_constant(switch_key(i)),
+        dest_block->entry_block());
+      dest_block->add_incoming(current_state());
+    }
+  }
+}
+
+ciMethod* SharkTopLevelBlock::improve_virtual_call(ciMethod*   caller,
+                                              ciInstanceKlass* klass,
+                                              ciMethod*        dest_method,
+                                              ciType*          receiver_type) {
+  // If the method is obviously final then we are already done
+  if (dest_method->can_be_statically_bound())
+    return dest_method;
+
+  // Array methods are all inherited from Object and are monomorphic
+  if (receiver_type->is_array_klass() &&
+      dest_method->holder() == java_lang_Object_klass())
+    return dest_method;
+
+#ifdef SHARK_CAN_DEOPTIMIZE_ANYWHERE
+  // This code can replace a virtual call with a direct call if this
+  // class is the only one in the entire set of loaded classes that
+  // implements this method.  This makes the compiled code dependent
+  // on other classes that implement the method not being loaded, a
+  // condition which is enforced by the dependency tracker.  If the
+  // dependency tracker determines a method has become invalid it
+  // will mark it for recompilation, causing running copies to be
+  // deoptimized.  Shark currently can't deoptimize arbitrarily like
+  // that, so this optimization cannot be used.
+  // http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=481
+  
+  // All other interesting cases are instance classes
+  if (!receiver_type->is_instance_klass())
+    return NULL;
+
+  // Attempt to improve the receiver
+  ciInstanceKlass* actual_receiver = klass;
+  ciInstanceKlass *improved_receiver = receiver_type->as_instance_klass();
+  if (improved_receiver->is_loaded() &&
+      improved_receiver->is_initialized() &&
+      !improved_receiver->is_interface() &&
+      improved_receiver->is_subtype_of(actual_receiver)) {
+    actual_receiver = improved_receiver;
+  }
+
+  // Attempt to find a monomorphic target for this call using
+  // class heirachy analysis.
+  ciInstanceKlass *calling_klass = caller->holder();
+  ciMethod* monomorphic_target =
+    dest_method->find_monomorphic_target(calling_klass, klass, actual_receiver);
+  if (monomorphic_target != NULL) {
+    assert(!monomorphic_target->is_abstract(), "shouldn't be");
+
+    // Opto has a bunch of type checking here that I don't
+    // understand.  It's to inhibit casting in one direction,
+    // possibly because objects in Opto can have inexact
+    // types, but I can't even tell which direction it
+    // doesn't like.  For now I'm going to block *any* cast.
+    if (monomorphic_target != dest_method) {
+      if (SharkPerformanceWarnings) {
+        warning("found monomorphic target, but inhibited cast:");
+        tty->print("  dest_method = ");
+        dest_method->print_short_name(tty);
+        tty->cr();
+        tty->print("  monomorphic_target = ");
+        monomorphic_target->print_short_name(tty);
+        tty->cr();
+      }
+      monomorphic_target = NULL;
+    }
+  }
+
+  // Replace the virtual call with a direct one.  This makes
+  // us dependent on that target method not getting overridden
+  // by dynamic class loading.
+  if (monomorphic_target != NULL) {
+    dependencies()->assert_unique_concrete_method(
+      actual_receiver, monomorphic_target);
+    return monomorphic_target;
+  }
+
+  // Because Opto distinguishes exact types from inexact ones
+  // it can perform a further optimization to replace calls
+  // with non-monomorphic targets if the receiver has an exact
+  // type.  We don't mark types this way, so we can't do this.
+
+#endif // SHARK_CAN_DEOPTIMIZE_ANYWHERE
+
+  return NULL;
+}
+
+Value *SharkTopLevelBlock::get_direct_callee(ciMethod* method) {
+  return builder()->CreateBitCast(
+    builder()->CreateInlineOop(method),
+    SharkType::methodOop_type(),
+    "callee");
+}
+
+Value *SharkTopLevelBlock::get_virtual_callee(SharkValue* receiver,
+                                              int vtable_index) {
+  Value *klass = builder()->CreateValueOfStructEntry(
+    receiver->jobject_value(),
+    in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "klass");
+
+  return builder()->CreateLoad(
+    builder()->CreateArrayAddress(
+      klass,
+      SharkType::methodOop_type(),
+      vtableEntry::size() * wordSize,
+      in_ByteSize(instanceKlass::vtable_start_offset() * wordSize),
+      LLVMValue::intptr_constant(vtable_index)),
+    "callee");
+}
+
+Value* SharkTopLevelBlock::get_interface_callee(SharkValue *receiver,
+                                                ciMethod*   method) {
+  BasicBlock *loop       = function()->CreateBlock("loop");
+  BasicBlock *got_null   = function()->CreateBlock("got_null");
+  BasicBlock *not_null   = function()->CreateBlock("not_null");
+  BasicBlock *next       = function()->CreateBlock("next");
+  BasicBlock *got_entry  = function()->CreateBlock("got_entry");
+
+  // Locate the receiver's itable
+  Value *object_klass = builder()->CreateValueOfStructEntry(
+    receiver->jobject_value(), in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "object_klass");
+
+  Value *vtable_start = builder()->CreateAdd(
+    builder()->CreatePtrToInt(object_klass, SharkType::intptr_type()),
+    LLVMValue::intptr_constant(
+      instanceKlass::vtable_start_offset() * HeapWordSize),
+    "vtable_start");
+
+  Value *vtable_length = builder()->CreateValueOfStructEntry(
+    object_klass,
+    in_ByteSize(instanceKlass::vtable_length_offset() * HeapWordSize),
+    SharkType::jint_type(),
+    "vtable_length");
+  vtable_length =
+    builder()->CreateIntCast(vtable_length, SharkType::intptr_type(), false);
+
+  bool needs_aligning = HeapWordsPerLong > 1;
+  Value *itable_start = builder()->CreateAdd(
+    vtable_start,
+    builder()->CreateShl(
+      vtable_length,
+      LLVMValue::intptr_constant(exact_log2(vtableEntry::size() * wordSize))),
+    needs_aligning ? "" : "itable_start");
+  if (needs_aligning) {
+    itable_start = builder()->CreateAnd(
+      builder()->CreateAdd(
+        itable_start, LLVMValue::intptr_constant(BytesPerLong - 1)),
+      LLVMValue::intptr_constant(~(BytesPerLong - 1)),
+      "itable_start");
+  }
+
+  // Locate this interface's entry in the table
+  Value *iklass = builder()->CreateInlineOop(method->holder());
+  BasicBlock *loop_entry = builder()->GetInsertBlock();
+  builder()->CreateBr(loop);
+  builder()->SetInsertPoint(loop);
+  PHINode *itable_entry_addr = builder()->CreatePHI(
+    SharkType::intptr_type(), "itable_entry_addr");
+  itable_entry_addr->addIncoming(itable_start, loop_entry);
+
+  Value *itable_entry = builder()->CreateIntToPtr(
+    itable_entry_addr, SharkType::itableOffsetEntry_type(), "itable_entry");
+
+  Value *itable_iklass = builder()->CreateValueOfStructEntry(
+    itable_entry,
+    in_ByteSize(itableOffsetEntry::interface_offset_in_bytes()),
+    SharkType::oop_type(),
+    "itable_iklass");
+
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(itable_iklass, LLVMValue::null()),
+    got_null, not_null);
+
+  // A null entry means that the class doesn't implement the
+  // interface, and wasn't the same as the class checked when
+  // the interface was resolved.
+  builder()->SetInsertPoint(got_null);
+  builder()->CreateUnimplemented(__FILE__, __LINE__);
+  builder()->CreateUnreachable();
+
+  builder()->SetInsertPoint(not_null);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(itable_iklass, iklass),
+    got_entry, next);
+
+  builder()->SetInsertPoint(next);
+  Value *next_entry = builder()->CreateAdd(
+    itable_entry_addr,
+    LLVMValue::intptr_constant(itableOffsetEntry::size() * wordSize));
+  builder()->CreateBr(loop);
+  itable_entry_addr->addIncoming(next_entry, next);
+
+  // Locate the method pointer
+  builder()->SetInsertPoint(got_entry);
+  Value *offset = builder()->CreateValueOfStructEntry(
+    itable_entry,
+    in_ByteSize(itableOffsetEntry::offset_offset_in_bytes()),
+    SharkType::jint_type(),
+    "offset");
+  offset =
+    builder()->CreateIntCast(offset, SharkType::intptr_type(), false);
+
+  return builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      builder()->CreateAdd(
+        builder()->CreateAdd(
+          builder()->CreateAdd(
+            builder()->CreatePtrToInt(
+              object_klass, SharkType::intptr_type()),
+            offset),
+          LLVMValue::intptr_constant(
+            method->itable_index() * itableMethodEntry::size() * wordSize)),
+        LLVMValue::intptr_constant(
+          itableMethodEntry::method_offset_in_bytes())),
+      PointerType::getUnqual(SharkType::methodOop_type())),
+    "callee");
+}
+
+void SharkTopLevelBlock::do_call() {
+  // Set frequently used booleans
+  bool is_static = bc() == Bytecodes::_invokestatic;
+  bool is_virtual = bc() == Bytecodes::_invokevirtual;
+  bool is_interface = bc() == Bytecodes::_invokeinterface;
+
+  // Find the method being called
+  bool will_link;
+  ciMethod *dest_method = iter()->get_method(will_link);
+  assert(will_link, "typeflow responsibility");
+  assert(dest_method->is_static() == is_static, "must match bc");
+
+  // Find the class of the method being called.  Note
+  // that the superclass check in the second assertion
+  // is to cope with a hole in the spec that allows for
+  // invokeinterface instructions where the resolved
+  // method is a virtual method in java.lang.Object.
+  // javac doesn't generate code like that, but there's
+  // no reason a compliant Java compiler might not.
+  ciInstanceKlass *holder_klass  = dest_method->holder();
+  assert(holder_klass->is_loaded(), "scan_for_traps responsibility");
+  assert(holder_klass->is_interface() ||
+         holder_klass->super() == NULL ||
+         !is_interface, "must match bc");
+  ciKlass *holder = iter()->get_declared_method_holder();
+  ciInstanceKlass *klass =
+    ciEnv::get_instance_klass_for_declared_method_holder(holder);
+
+  // Find the receiver in the stack.  We do this before
+  // trying to inline because the inliner can only use
+  // zero-checked values, not being able to perform the
+  // check itself.
+  SharkValue *receiver = NULL;
+  if (!is_static) {
+    receiver = xstack(dest_method->arg_size() - 1);
+    check_null(receiver);
+  }
+
+  // Try to improve non-direct calls
+  bool call_is_virtual = is_virtual || is_interface;
+  ciMethod *call_method = dest_method;
+  if (call_is_virtual) {
+    ciMethod *optimized_method = improve_virtual_call(
+      target(), klass, dest_method, receiver->type());
+    if (optimized_method) {
+      call_method = optimized_method;
+      call_is_virtual = false;
+    }
+  }
+
+  // Try to inline the call
+  if (!call_is_virtual) {
+    if (SharkInliner::attempt_inline(call_method, current_state()))
+      return;
+  }
+
+  // Find the method we are calling
+  Value *callee;
+  if (call_is_virtual) {
+    if (is_virtual) {
+      assert(klass->is_linked(), "scan_for_traps responsibility");
+      int vtable_index = call_method->resolve_vtable_index(
+        target()->holder(), klass);
+      assert(vtable_index >= 0, "should be");
+      callee = get_virtual_callee(receiver, vtable_index);
+    }
+    else {
+      assert(is_interface, "should be");
+      callee = get_interface_callee(receiver, call_method);
+    }
+  }
+  else {
+    callee = get_direct_callee(call_method);
+  }
+
+  // Load the SharkEntry from the callee
+  Value *base_pc = builder()->CreateValueOfStructEntry(
+    callee, methodOopDesc::from_interpreted_offset(),
+    SharkType::intptr_type(),
+    "base_pc");
+
+  // Load the entry point from the SharkEntry
+  Value *entry_point = builder()->CreateLoad(
+    builder()->CreateIntToPtr(
+      builder()->CreateAdd(
+        base_pc,
+        LLVMValue::intptr_constant(in_bytes(ZeroEntry::entry_point_offset()))),
+      PointerType::getUnqual(
+        PointerType::getUnqual(SharkType::entry_point_type()))),
+    "entry_point");
+
+  // Make the call
+  decache_for_Java_call(call_method);
+  Value *deoptimized_frames = builder()->CreateCall3(
+    entry_point, callee, base_pc, thread());
+
+  // If the callee got deoptimized then reexecute in the interpreter
+  BasicBlock *reexecute      = function()->CreateBlock("reexecute");
+  BasicBlock *call_completed = function()->CreateBlock("call_completed");
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(deoptimized_frames, LLVMValue::jint_constant(0)),
+    reexecute, call_completed);
+
+  builder()->SetInsertPoint(reexecute);
+  builder()->CreateCall2(
+    builder()->deoptimized_entry_point(),
+    builder()->CreateSub(deoptimized_frames, LLVMValue::jint_constant(1)),
+    thread());
+  builder()->CreateBr(call_completed);
+
+  // Cache after the call
+  builder()->SetInsertPoint(call_completed);
+  cache_after_Java_call(call_method);
+
+  // Check for pending exceptions
+  check_pending_exception(EX_CHECK_FULL);
+
+  // Mark that a safepoint check has occurred
+  current_state()->set_has_safepointed(true);
+}
+
+bool SharkTopLevelBlock::static_subtype_check(ciKlass* check_klass,
+                                              ciKlass* object_klass) {
+  // If the class we're checking against is java.lang.Object
+  // then this is a no brainer.  Apparently this can happen
+  // in reflective code...
+  if (check_klass == java_lang_Object_klass())
+    return true;
+
+  // Perform a subtype check.  NB in opto's code for this
+  // (GraphKit::static_subtype_check) it says that static
+  // interface types cannot be trusted, and if opto can't
+  // trust them then I assume we can't either.
+  if (object_klass->is_loaded() && !object_klass->is_interface()) {
+    if (object_klass == check_klass)
+      return true;
+
+    if (check_klass->is_loaded() && object_klass->is_subtype_of(check_klass))
+      return true;
+  }
+
+  return false;
+}
+
+void SharkTopLevelBlock::do_instance_check() {
+  // Get the class we're checking against
+  bool will_link;
+  ciKlass *check_klass = iter()->get_klass(will_link);
+
+  // Get the class of the object we're checking
+  ciKlass *object_klass = xstack(0)->type()->as_klass();
+
+  // Can we optimize this check away?
+  if (static_subtype_check(check_klass, object_klass)) {
+    if (bc() == Bytecodes::_instanceof) {
+      pop();
+      push(SharkValue::jint_constant(1));
+    }
+    return;
+  }
+
+  // Need to check this one at runtime
+  if (will_link)
+    do_full_instance_check(check_klass);
+  else
+    do_trapping_instance_check(check_klass);
+}
+
+bool SharkTopLevelBlock::maybe_do_instanceof_if() {
+  // Get the class we're checking against
+  bool will_link;
+  ciKlass *check_klass = iter()->get_klass(will_link);
+
+  // If the class is unloaded then the instanceof
+  // cannot possibly succeed.
+  if (!will_link)
+    return false;
+
+  // Keep a copy of the object we're checking
+  SharkValue *old_object = xstack(0);
+
+  // Get the class of the object we're checking
+  ciKlass *object_klass = old_object->type()->as_klass();
+
+  // If the instanceof can be optimized away at compile time
+  // then any subsequent checkcasts will be too so we handle
+  // it normally.
+  if (static_subtype_check(check_klass, object_klass))
+    return false;
+
+  // Perform the instance check
+  do_full_instance_check(check_klass);
+  Value *result = pop()->jint_value();
+
+  // Create the casted object
+  SharkValue *new_object = SharkValue::create_generic(
+    check_klass, old_object->jobject_value(), old_object->zero_checked());
+
+  // Create two copies of the current state, one with the
+  // original object and one with all instances of the
+  // original object replaced with the new, casted object.
+  SharkState *new_state = current_state();
+  SharkState *old_state = new_state->copy();
+  new_state->replace_all(old_object, new_object);
+
+  // Perform the check-and-branch
+  switch (iter()->next_bc()) {
+  case Bytecodes::_ifeq:
+    // branch if not an instance
+    do_if_helper(
+      ICmpInst::ICMP_EQ,
+      LLVMValue::jint_constant(0), result,
+      old_state, new_state);
+    break;
+
+  case Bytecodes::_ifne:
+    // branch if an instance
+    do_if_helper(
+      ICmpInst::ICMP_NE,
+      LLVMValue::jint_constant(0), result,
+      new_state, old_state);
+    break;
+
+  default:
+    ShouldNotReachHere();
+  }
+
+  return true;
+}
+
+void SharkTopLevelBlock::do_full_instance_check(ciKlass* klass) {
+  BasicBlock *not_null      = function()->CreateBlock("not_null");
+  BasicBlock *subtype_check = function()->CreateBlock("subtype_check");
+  BasicBlock *is_instance   = function()->CreateBlock("is_instance");
+  BasicBlock *not_instance  = function()->CreateBlock("not_instance");
+  BasicBlock *merge1        = function()->CreateBlock("merge1");
+  BasicBlock *merge2        = function()->CreateBlock("merge2");
+
+  enum InstanceCheckStates {
+    IC_IS_NULL,
+    IC_IS_INSTANCE,
+    IC_NOT_INSTANCE,
+  };
+
+  // Pop the object off the stack
+  Value *object = pop()->jobject_value();
+
+  // Null objects aren't instances of anything
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(object, LLVMValue::null()),
+    merge2, not_null);
+  BasicBlock *null_block = builder()->GetInsertBlock();
+
+  // Get the class we're checking against
+  builder()->SetInsertPoint(not_null);
+  Value *check_klass = builder()->CreateInlineOop(klass);
+
+  // Get the class of the object being tested
+  Value *object_klass = builder()->CreateValueOfStructEntry(
+    object, in_ByteSize(oopDesc::klass_offset_in_bytes()),
+    SharkType::oop_type(),
+    "object_klass");
+
+  // Perform the check
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(check_klass, object_klass),
+    is_instance, subtype_check);
+
+  builder()->SetInsertPoint(subtype_check);
+  builder()->CreateCondBr(
+    builder()->CreateICmpNE(
+      builder()->CreateCall2(
+        builder()->is_subtype_of(), check_klass, object_klass),
+      LLVMValue::jbyte_constant(0)),
+    is_instance, not_instance);
+
+  builder()->SetInsertPoint(is_instance);
+  builder()->CreateBr(merge1);
+
+  builder()->SetInsertPoint(not_instance);
+  builder()->CreateBr(merge1);
+
+  // First merge
+  builder()->SetInsertPoint(merge1);
+  PHINode *nonnull_result = builder()->CreatePHI(
+    SharkType::jint_type(), "nonnull_result");
+  nonnull_result->addIncoming(
+    LLVMValue::jint_constant(IC_IS_INSTANCE), is_instance);
+  nonnull_result->addIncoming(
+    LLVMValue::jint_constant(IC_NOT_INSTANCE), not_instance);
+  BasicBlock *nonnull_block = builder()->GetInsertBlock();
+  builder()->CreateBr(merge2);
+
+  // Second merge
+  builder()->SetInsertPoint(merge2);
+  PHINode *result = builder()->CreatePHI(
+    SharkType::jint_type(), "result");
+  result->addIncoming(LLVMValue::jint_constant(IC_IS_NULL), null_block);
+  result->addIncoming(nonnull_result, nonnull_block);
+
+  // Handle the result
+  if (bc() == Bytecodes::_checkcast) {
+    BasicBlock *failure = function()->CreateBlock("failure");
+    BasicBlock *success = function()->CreateBlock("success");
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpNE(
+        result, LLVMValue::jint_constant(IC_NOT_INSTANCE)),
+      success, failure);
+
+    builder()->SetInsertPoint(failure);
+    SharkState *saved_state = current_state()->copy();
+
+    call_vm(
+      builder()->throw_ClassCastException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+
+    Value *pending_exception = get_pending_exception();
+    clear_pending_exception();
+    handle_exception(pending_exception, EX_CHECK_FULL);
+
+    set_current_state(saved_state);
+    builder()->SetInsertPoint(success);
+    push(SharkValue::create_generic(klass, object, false));
+  }
+  else {
+    push(
+      SharkValue::create_jint(
+        builder()->CreateIntCast(
+          builder()->CreateICmpEQ(
+            result, LLVMValue::jint_constant(IC_IS_INSTANCE)),
+          SharkType::jint_type(), false), false));
+  }
+}
+
+void SharkTopLevelBlock::do_trapping_instance_check(ciKlass* klass) {
+  BasicBlock *not_null = function()->CreateBlock("not_null");
+  BasicBlock *is_null  = function()->CreateBlock("null");
+
+  // Leave the object on the stack so it's there if we trap
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(xstack(0)->jobject_value(), LLVMValue::null()),
+    is_null, not_null);
+  SharkState *saved_state = current_state()->copy();
+
+  // If it's not null then we need to trap
+  builder()->SetInsertPoint(not_null);
+  set_current_state(saved_state->copy());
+  do_trap(
+    Deoptimization::make_trap_request(
+      Deoptimization::Reason_uninitialized,
+      Deoptimization::Action_reinterpret));
+
+  // If it's null then we're ok
+  builder()->SetInsertPoint(is_null);
+  set_current_state(saved_state);
+  if (bc() == Bytecodes::_checkcast) {
+    push(SharkValue::create_generic(klass, pop()->jobject_value(), false));
+  }
+  else {
+    pop();
+    push(SharkValue::jint_constant(0));
+  }
+}
+
+void SharkTopLevelBlock::do_new() {
+  bool will_link;
+  ciInstanceKlass* klass = iter()->get_klass(will_link)->as_instance_klass();
+  assert(will_link, "typeflow responsibility");
+
+  BasicBlock *got_tlab            = NULL;
+  BasicBlock *heap_alloc          = NULL;
+  BasicBlock *retry               = NULL;
+  BasicBlock *got_heap            = NULL;
+  BasicBlock *initialize          = NULL;
+  BasicBlock *got_fast            = NULL;
+  BasicBlock *slow_alloc_and_init = NULL;
+  BasicBlock *got_slow            = NULL;
+  BasicBlock *push_object         = NULL;
+
+  SharkState *fast_state = NULL;
+
+  Value *tlab_object = NULL;
+  Value *heap_object = NULL;
+  Value *fast_object = NULL;
+  Value *slow_object = NULL;
+  Value *object      = NULL;
+
+  // The fast path
+  if (!Klass::layout_helper_needs_slow_path(klass->layout_helper())) {
+    if (UseTLAB) {
+      got_tlab          = function()->CreateBlock("got_tlab");
+      heap_alloc        = function()->CreateBlock("heap_alloc");
+    }
+    retry               = function()->CreateBlock("retry");
+    got_heap            = function()->CreateBlock("got_heap");
+    initialize          = function()->CreateBlock("initialize");
+    slow_alloc_and_init = function()->CreateBlock("slow_alloc_and_init");
+    push_object         = function()->CreateBlock("push_object");
+
+    size_t size_in_bytes = klass->size_helper() << LogHeapWordSize;
+
+    // Thread local allocation
+    if (UseTLAB) {
+      Value *top_addr = builder()->CreateAddressOfStructEntry(
+        thread(), Thread::tlab_top_offset(),
+        PointerType::getUnqual(SharkType::intptr_type()),
+        "top_addr");
+
+      Value *end = builder()->CreateValueOfStructEntry(
+        thread(), Thread::tlab_end_offset(),
+        SharkType::intptr_type(),
+        "end");
+
+      Value *old_top = builder()->CreateLoad(top_addr, "old_top");
+      Value *new_top = builder()->CreateAdd(
+        old_top, LLVMValue::intptr_constant(size_in_bytes));
+
+      builder()->CreateCondBr(
+        builder()->CreateICmpULE(new_top, end),
+        got_tlab, heap_alloc);
+
+      builder()->SetInsertPoint(got_tlab);
+      tlab_object = builder()->CreateIntToPtr(
+        old_top, SharkType::oop_type(), "tlab_object");
+
+      builder()->CreateStore(new_top, top_addr);
+      builder()->CreateBr(initialize);
+
+      builder()->SetInsertPoint(heap_alloc);
+    }
+
+    // Heap allocation
+    Value *top_addr = builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) Universe::heap()->top_addr()),
+      PointerType::getUnqual(SharkType::intptr_type()),
+      "top_addr");
+
+    Value *end = builder()->CreateLoad(
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) Universe::heap()->end_addr()),
+        PointerType::getUnqual(SharkType::intptr_type())),
+      "end");
+
+    builder()->CreateBr(retry);
+    builder()->SetInsertPoint(retry);
+
+    Value *old_top = builder()->CreateLoad(top_addr, "top");
+    Value *new_top = builder()->CreateAdd(
+      old_top, LLVMValue::intptr_constant(size_in_bytes));
+
+    builder()->CreateCondBr(
+      builder()->CreateICmpULE(new_top, end),
+      got_heap, slow_alloc_and_init);
+
+    builder()->SetInsertPoint(got_heap);
+    heap_object = builder()->CreateIntToPtr(
+      old_top, SharkType::oop_type(), "heap_object");
+
+    Value *check = builder()->CreateCmpxchgPtr(new_top, top_addr, old_top);
+    builder()->CreateCondBr(
+      builder()->CreateICmpEQ(old_top, check),
+      initialize, retry);
+
+    // Initialize the object
+    builder()->SetInsertPoint(initialize);
+    if (tlab_object) {
+      PHINode *phi = builder()->CreatePHI(
+        SharkType::oop_type(), "fast_object");
+      phi->addIncoming(tlab_object, got_tlab);
+      phi->addIncoming(heap_object, got_heap);
+      fast_object = phi;
+    }
+    else {
+      fast_object = heap_object;
+    }
+
+    builder()->CreateMemset(
+      builder()->CreateBitCast(
+        fast_object, PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jbyte_constant(0),
+      LLVMValue::jint_constant(size_in_bytes),
+      LLVMValue::jint_constant(HeapWordSize));
+
+    Value *mark_addr = builder()->CreateAddressOfStructEntry(
+      fast_object, in_ByteSize(oopDesc::mark_offset_in_bytes()),
+      PointerType::getUnqual(SharkType::intptr_type()),
+      "mark_addr");
+
+    Value *klass_addr = builder()->CreateAddressOfStructEntry(
+      fast_object, in_ByteSize(oopDesc::klass_offset_in_bytes()),
+      PointerType::getUnqual(SharkType::oop_type()),
+      "klass_addr");
+
+    // Set the mark
+    intptr_t mark;
+    if (UseBiasedLocking) {
+      Unimplemented();
+    }
+    else {
+      mark = (intptr_t) markOopDesc::prototype();
+    }
+    builder()->CreateStore(LLVMValue::intptr_constant(mark), mark_addr);
+
+    // Set the class
+    Value *rtklass = builder()->CreateInlineOop(klass);
+    builder()->CreateStore(rtklass, klass_addr);
+    got_fast = builder()->GetInsertBlock();
+
+    builder()->CreateBr(push_object);
+    builder()->SetInsertPoint(slow_alloc_and_init);
+    fast_state = current_state()->copy();
+  }
+
+  // The slow path
+  call_vm(
+    builder()->new_instance(),
+    LLVMValue::jint_constant(iter()->get_klass_index()),
+    EX_CHECK_FULL);
+  slow_object = get_vm_result();
+  got_slow = builder()->GetInsertBlock();
+
+  // Push the object
+  if (push_object) {
+    builder()->CreateBr(push_object);
+    builder()->SetInsertPoint(push_object);
+  }
+  if (fast_object) {
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "object");
+    phi->addIncoming(fast_object, got_fast);
+    phi->addIncoming(slow_object, got_slow);
+    object = phi;
+    current_state()->merge(fast_state, got_fast, got_slow);
+  }
+  else {
+    object = slow_object;
+  }
+
+  push(SharkValue::create_jobject(object, true));
+}
+
+void SharkTopLevelBlock::do_newarray() {
+  BasicType type = (BasicType) iter()->get_index();
+
+  call_vm(
+    builder()->newarray(),
+    LLVMValue::jint_constant(type),
+    pop()->jint_value(),
+    EX_CHECK_FULL);
+
+  ciArrayKlass *array_klass = ciArrayKlass::make(ciType::make(type));
+  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
+}
+
+void SharkTopLevelBlock::do_anewarray() {
+  bool will_link;
+  ciKlass *klass = iter()->get_klass(will_link);
+  assert(will_link, "typeflow responsibility");
+
+  ciObjArrayKlass *array_klass = ciObjArrayKlass::make(klass);
+  if (!array_klass->is_loaded()) {
+    Unimplemented();
+  }
+
+  call_vm(
+    builder()->anewarray(),
+    LLVMValue::jint_constant(iter()->get_klass_index()),
+    pop()->jint_value(),
+    EX_CHECK_FULL);
+
+  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
+}
+
+void SharkTopLevelBlock::do_multianewarray() {
+  bool will_link;
+  ciArrayKlass *array_klass = iter()->get_klass(will_link)->as_array_klass();
+  assert(will_link, "typeflow responsibility");
+
+  // The dimensions are stack values, so we use their slots for the
+  // dimensions array.  Note that we are storing them in the reverse
+  // of normal stack order.
+  int ndims = iter()->get_dimensions();
+
+  Value *dimensions = stack()->slot_addr(
+    stack()->stack_slots_offset() + max_stack() - xstack_depth(),
+    ArrayType::get(SharkType::jint_type(), ndims),
+    "dimensions");
+
+  for (int i = 0; i < ndims; i++) {
+    builder()->CreateStore(
+      xstack(ndims - 1 - i)->jint_value(),
+      builder()->CreateStructGEP(dimensions, i));
+  }
+
+  call_vm(
+    builder()->multianewarray(),
+    LLVMValue::jint_constant(iter()->get_klass_index()),
+    LLVMValue::jint_constant(ndims),
+    builder()->CreateStructGEP(dimensions, 0),
+    EX_CHECK_FULL);
+
+  // Now we can pop the dimensions off the stack
+  for (int i = 0; i < ndims; i++)
+    pop();
+
+  push(SharkValue::create_generic(array_klass, get_vm_result(), true));
+}
+
+void SharkTopLevelBlock::acquire_method_lock() {
+  Value *lockee;
+  if (target()->is_static())
+    lockee = builder()->CreateInlineOop(target()->holder()->java_mirror());
+  else
+    lockee = local(0)->jobject_value();
+
+  iter()->force_bci(start()); // for the decache in acquire_lock
+  acquire_lock(lockee, EX_CHECK_NO_CATCH);
+}
+
+void SharkTopLevelBlock::do_monitorenter() {
+  SharkValue *lockee = pop();
+  check_null(lockee);
+  acquire_lock(lockee->jobject_value(), EX_CHECK_FULL);
+}
+
+void SharkTopLevelBlock::do_monitorexit() {
+  pop(); // don't need this (monitors are block structured)
+  release_lock(EX_CHECK_NO_CATCH);
+}
+
+void SharkTopLevelBlock::acquire_lock(Value *lockee, int exception_action) {
+  BasicBlock *try_recursive = function()->CreateBlock("try_recursive");
+  BasicBlock *got_recursive = function()->CreateBlock("got_recursive");
+  BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
+  BasicBlock *acquired_fast = function()->CreateBlock("acquired_fast");
+  BasicBlock *lock_acquired = function()->CreateBlock("lock_acquired");
+
+  int monitor = num_monitors();
+  Value *monitor_addr        = stack()->monitor_addr(monitor);
+  Value *monitor_object_addr = stack()->monitor_object_addr(monitor);
+  Value *monitor_header_addr = stack()->monitor_header_addr(monitor);
+
+  // Store the object and mark the slot as live
+  builder()->CreateStore(lockee, monitor_object_addr);
+  set_num_monitors(monitor + 1);
+
+  // Try a simple lock
+  Value *mark_addr = builder()->CreateAddressOfStructEntry(
+    lockee, in_ByteSize(oopDesc::mark_offset_in_bytes()),
+    PointerType::getUnqual(SharkType::intptr_type()),
+    "mark_addr");
+
+  Value *mark = builder()->CreateLoad(mark_addr, "mark");
+  Value *disp = builder()->CreateOr(
+    mark, LLVMValue::intptr_constant(markOopDesc::unlocked_value), "disp");
+  builder()->CreateStore(disp, monitor_header_addr);
+
+  Value *lock = builder()->CreatePtrToInt(
+    monitor_header_addr, SharkType::intptr_type());
+  Value *check = builder()->CreateCmpxchgPtr(lock, mark_addr, disp);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(disp, check),
+    acquired_fast, try_recursive);
+
+  // Locking failed, but maybe this thread already owns it
+  builder()->SetInsertPoint(try_recursive);
+  Value *addr = builder()->CreateAnd(
+    disp,
+    LLVMValue::intptr_constant(~markOopDesc::lock_mask_in_place));
+
+  // NB we use the entire stack, but JavaThread::is_lock_owned()
+  // uses a more limited range.  I don't think it hurts though...
+  Value *stack_limit = builder()->CreateValueOfStructEntry(
+    thread(), Thread::stack_base_offset(),
+    SharkType::intptr_type(),
+    "stack_limit");
+
+  assert(sizeof(size_t) == sizeof(intptr_t), "should be");
+  Value *stack_size = builder()->CreateValueOfStructEntry(
+    thread(), Thread::stack_size_offset(),
+    SharkType::intptr_type(),
+    "stack_size");
+
+  Value *stack_start =
+    builder()->CreateSub(stack_limit, stack_size, "stack_start");
+
+  builder()->CreateCondBr(
+    builder()->CreateAnd(
+      builder()->CreateICmpUGE(addr, stack_start),
+      builder()->CreateICmpULT(addr, stack_limit)),
+    got_recursive, not_recursive);
+
+  builder()->SetInsertPoint(got_recursive);
+  builder()->CreateStore(LLVMValue::intptr_constant(0), monitor_header_addr);
+  builder()->CreateBr(acquired_fast);
+
+  // Create an edge for the state merge
+  builder()->SetInsertPoint(acquired_fast);
+  SharkState *fast_state = current_state()->copy();
+  builder()->CreateBr(lock_acquired);
+
+  // It's not a recursive case so we need to drop into the runtime
+  builder()->SetInsertPoint(not_recursive);
+  call_vm(
+    builder()->monitorenter(), monitor_addr,
+    exception_action | EAM_MONITOR_FUDGE);
+  BasicBlock *acquired_slow = builder()->GetInsertBlock();
+  builder()->CreateBr(lock_acquired);
+
+  // All done
+  builder()->SetInsertPoint(lock_acquired);
+  current_state()->merge(fast_state, acquired_fast, acquired_slow);
+}
+
+void SharkTopLevelBlock::release_lock(int exception_action) {
+  BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
+  BasicBlock *released_fast = function()->CreateBlock("released_fast");
+  BasicBlock *slow_path     = function()->CreateBlock("slow_path");
+  BasicBlock *lock_released = function()->CreateBlock("lock_released");
+
+  int monitor = num_monitors() - 1;
+  Value *monitor_addr        = stack()->monitor_addr(monitor);
+  Value *monitor_object_addr = stack()->monitor_object_addr(monitor);
+  Value *monitor_header_addr = stack()->monitor_header_addr(monitor);
+
+  // If it is recursive then we're already done
+  Value *disp = builder()->CreateLoad(monitor_header_addr);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(disp, LLVMValue::intptr_constant(0)),
+    released_fast, not_recursive);
+
+  // Try a simple unlock
+  builder()->SetInsertPoint(not_recursive);
+
+  Value *lock = builder()->CreatePtrToInt(
+    monitor_header_addr, SharkType::intptr_type());
+
+  Value *lockee = builder()->CreateLoad(monitor_object_addr);
+
+  Value *mark_addr = builder()->CreateAddressOfStructEntry(
+    lockee, in_ByteSize(oopDesc::mark_offset_in_bytes()),
+    PointerType::getUnqual(SharkType::intptr_type()),
+    "mark_addr");
+
+  Value *check = builder()->CreateCmpxchgPtr(disp, mark_addr, lock);
+  builder()->CreateCondBr(
+    builder()->CreateICmpEQ(lock, check),
+    released_fast, slow_path);
+
+  // Create an edge for the state merge
+  builder()->SetInsertPoint(released_fast);
+  SharkState *fast_state = current_state()->copy();
+  builder()->CreateBr(lock_released);
+
+  // Need to drop into the runtime to release this one
+  builder()->SetInsertPoint(slow_path);
+  call_vm(builder()->monitorexit(), monitor_addr, exception_action);
+  BasicBlock *released_slow = builder()->GetInsertBlock();
+  builder()->CreateBr(lock_released);
+
+  // All done
+  builder()->SetInsertPoint(lock_released);
+  current_state()->merge(fast_state, released_fast, released_slow);
+
+  // The object slot is now dead
+  set_num_monitors(monitor);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,430 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkTopLevelBlock : public SharkBlock {
+ public:
+  SharkTopLevelBlock(SharkFunction* function, ciTypeFlow::Block* ciblock)
+    : SharkBlock(function),
+      _function(function),
+      _ciblock(ciblock),
+      _entered(false),
+      _has_trap(false),
+      _needs_phis(false),
+      _entry_state(NULL),
+      _entry_block(NULL) {}
+
+ private:
+  SharkFunction*     _function;
+  ciTypeFlow::Block* _ciblock;
+
+ public:
+  SharkFunction* function() const {
+    return _function;
+  }
+  ciTypeFlow::Block* ciblock() const {
+    return _ciblock;
+  }
+
+  // Function properties
+ public:
+  SharkStack* stack() const {
+    return function()->stack();
+  }
+
+  // Typeflow properties
+ public:
+  int index() const {
+    return ciblock()->pre_order();
+  }
+  bool is_backedge_copy() const {
+    return ciblock()->is_backedge_copy();
+  }
+  int stack_depth_at_entry() const {
+    return ciblock()->stack_size();
+  }
+  ciType* local_type_at_entry(int index) const {
+    return ciblock()->local_type_at(index);
+  }
+  ciType* stack_type_at_entry(int slot) const {
+    return ciblock()->stack_type_at(slot);
+  }
+  int start() const {
+    return ciblock()->start();
+  }
+  int limit() const {
+    return ciblock()->limit();
+  }
+  bool falls_through() const {
+    return ciblock()->control() == ciBlock::fall_through_bci;
+  }
+  int num_successors() const {
+    return ciblock()->successors()->length();
+  }
+  SharkTopLevelBlock* successor(int index) const {
+    return function()->block(ciblock()->successors()->at(index)->pre_order());
+  }
+  SharkTopLevelBlock* bci_successor(int bci) const;
+
+  // Exceptions
+ private:
+  GrowableArray<ciExceptionHandler*>* _exc_handlers;
+  GrowableArray<SharkTopLevelBlock*>* _exceptions;
+
+ private:
+  void compute_exceptions();
+
+ private:
+  int num_exceptions() const {
+    return _exc_handlers->length();
+  }
+  ciExceptionHandler* exc_handler(int index) const {
+    return _exc_handlers->at(index);
+  }
+  SharkTopLevelBlock* exception(int index) const {
+    return _exceptions->at(index);
+  }
+
+  // Traps
+ private:
+  bool _has_trap;
+  int  _trap_request;
+  int  _trap_bci;
+
+  void set_trap(int trap_request, int trap_bci) {
+    assert(!has_trap(), "shouldn't have");
+    _has_trap     = true;
+    _trap_request = trap_request;
+    _trap_bci     = trap_bci;
+  }
+
+ private:
+  bool has_trap() {
+    return _has_trap;
+  }
+  int trap_request() {
+    assert(has_trap(), "should have");
+    return _trap_request;
+  }
+  int trap_bci() {
+    assert(has_trap(), "should have");
+    return _trap_bci;
+  }
+
+ private:
+  void scan_for_traps();
+
+ private:
+  bool static_field_ok_in_clinit(ciField* field);
+
+  // Entry state
+ private:
+  bool _entered;
+  bool _needs_phis;
+
+ public:
+  bool entered() const {
+    return _entered;
+  }
+  bool needs_phis() const {
+    return _needs_phis;
+  }
+
+ private:
+  void enter(SharkTopLevelBlock* predecessor, bool is_exception);
+
+ public:
+  void enter() {
+    enter(NULL, false);
+  }
+
+ private:
+  SharkState* _entry_state;
+
+ private:
+  SharkState* entry_state();
+
+ private:
+  llvm::BasicBlock* _entry_block;
+
+ public:
+  llvm::BasicBlock* entry_block() const {
+    return _entry_block;
+  }
+
+ public:
+  void initialize();
+
+ public:
+  void add_incoming(SharkState* incoming_state);
+
+  // Method
+ public:
+  llvm::Value* method() {
+    return current_state()->method();
+  }
+
+  // Temporary oop storage
+ public:
+  void set_oop_tmp(llvm::Value* value) {
+    assert(value, "value must be non-NULL (will be reset by get_oop_tmp)");
+    assert(!current_state()->oop_tmp(), "oop_tmp gets and sets must match");
+    current_state()->set_oop_tmp(value);
+  }
+  llvm::Value* get_oop_tmp() {
+    llvm::Value* value = current_state()->oop_tmp();
+    assert(value, "oop_tmp gets and sets must match");
+    current_state()->set_oop_tmp(NULL);
+    return value;
+  }
+
+  // Cache and decache
+ private:
+  void decache_for_Java_call(ciMethod* callee);
+  void cache_after_Java_call(ciMethod* callee);
+  void decache_for_VM_call();
+  void cache_after_VM_call();
+  void decache_for_trap();
+
+  // Monitors
+ private:
+  int num_monitors() {
+    return current_state()->num_monitors();
+  }
+  int set_num_monitors(int num_monitors) {
+    current_state()->set_num_monitors(num_monitors);
+  }
+
+  // Code generation
+ public:
+  void emit_IR();
+
+  // Branch helpers
+ private:
+  void do_branch(int successor_index);
+
+  // Zero checks
+ private:
+  void do_zero_check(SharkValue* value);
+  void zero_check_value(SharkValue* value, llvm::BasicBlock* continue_block);
+
+ public:
+  void do_deferred_zero_check(SharkValue*       value,
+                              int               bci,
+                              SharkState*       saved_state,
+                              llvm::BasicBlock* continue_block);
+  // Exceptions
+ private:
+  llvm::Value* pending_exception_address() const {
+    return builder()->CreateAddressOfStructEntry(
+      thread(), Thread::pending_exception_offset(),
+      llvm::PointerType::getUnqual(SharkType::oop_type()),
+      "pending_exception_addr");
+  }
+  llvm::LoadInst* get_pending_exception() const {
+    return builder()->CreateLoad(
+      pending_exception_address(), "pending_exception");
+  }
+  void clear_pending_exception() const {
+    builder()->CreateStore(LLVMValue::null(), pending_exception_address());
+  }
+ public:
+  enum ExceptionActionMask {
+    // The actual bitmasks that things test against
+    EAM_CHECK         = 1, // whether to check for pending exceptions
+    EAM_HANDLE        = 2, // whether to attempt to handle pending exceptions
+    EAM_MONITOR_FUDGE = 4, // whether the monitor count needs adjusting
+
+    // More convenient values for passing
+    EX_CHECK_NONE     = 0,
+    EX_CHECK_NO_CATCH = EAM_CHECK,
+    EX_CHECK_FULL     = EAM_CHECK | EAM_HANDLE
+  };
+  void check_pending_exception(int action);
+  void handle_exception(llvm::Value* exception, int action);
+  void marshal_exception_fast(int num_options);
+  void marshal_exception_slow(int num_options);
+  llvm::BasicBlock* handler_for_exception(int index);
+
+  // VM calls
+ private:
+  llvm::CallInst* call_vm(llvm::Value*  callee,
+                          llvm::Value** args_start,
+                          llvm::Value** args_end,
+                          int           exception_action) {
+    decache_for_VM_call();
+    stack()->CreateSetLastJavaFrame();
+    llvm::CallInst *res = builder()->CreateCall(callee, args_start, args_end);
+    stack()->CreateResetLastJavaFrame();
+    cache_after_VM_call();
+    if (exception_action & EAM_CHECK) {
+      check_pending_exception(exception_action);
+      current_state()->set_has_safepointed(true);
+    }
+    return res;
+  }
+
+ public:
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread()};
+    return call_vm(callee, args, args + 1, exception_action);
+  }
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          llvm::Value* arg1,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread(), arg1};
+    return call_vm(callee, args, args + 2, exception_action);
+  }
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          llvm::Value* arg1,
+                          llvm::Value* arg2,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread(), arg1, arg2};
+    return call_vm(callee, args, args + 3, exception_action);
+  }
+  llvm::CallInst* call_vm(llvm::Value* callee,
+                          llvm::Value* arg1,
+                          llvm::Value* arg2,
+                          llvm::Value* arg3,
+                          int          exception_action) {
+    llvm::Value *args[] = {thread(), arg1, arg2, arg3};
+    return call_vm(callee, args, args + 4, exception_action);
+  }
+
+  // VM call oop return handling
+ private:
+  llvm::LoadInst* get_vm_result() const {
+    llvm::Value *addr = builder()->CreateAddressOfStructEntry(
+      thread(), JavaThread::vm_result_offset(),
+      llvm::PointerType::getUnqual(SharkType::oop_type()),
+      "vm_result_addr");
+    llvm::LoadInst *result = builder()->CreateLoad(addr, "vm_result");
+    builder()->CreateStore(LLVMValue::null(), addr);
+    return result;
+  }
+
+  // Synchronization
+ private:
+  void acquire_lock(llvm::Value* lockee, int exception_action);
+  void release_lock(int exception_action);
+
+ public:
+  void acquire_method_lock();
+
+  // Bounds checks
+ private:
+  void check_bounds(SharkValue* array, SharkValue* index);
+
+  // Safepoints
+ private:
+  void maybe_add_safepoint();
+  void maybe_add_backedge_safepoint();
+
+  // Loop safepoint removal
+ private:
+  bool _can_reach_visited;
+
+  bool can_reach(SharkTopLevelBlock* other);
+  bool can_reach_helper(SharkTopLevelBlock* other);
+
+  // Traps
+ private:
+  llvm::BasicBlock* make_trap(int trap_bci, int trap_request);
+  void do_trap(int trap_request);
+
+  // Returns
+ private:
+  void call_register_finalizer(llvm::Value* receiver);
+  void handle_return(BasicType type, llvm::Value* exception);
+
+  // arraylength
+ private:
+  void do_arraylength();
+
+  // *aload and *astore
+ private:
+  void do_aload(BasicType basic_type);
+  void do_astore(BasicType basic_type);
+
+  // *return and athrow
+ private:
+  void do_return(BasicType type);
+  void do_athrow();
+
+  // goto*
+ private:
+  void do_goto();
+
+  // jsr* and ret
+ private:
+  void do_jsr();
+  void do_ret();
+
+  // if*
+ private:
+  void do_if_helper(llvm::ICmpInst::Predicate p,
+                    llvm::Value*              b,
+                    llvm::Value*              a,
+                    SharkState*               if_taken_state,
+                    SharkState*               not_taken_state);
+  void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a);
+
+  // tableswitch and lookupswitch
+ private:
+  void do_switch();
+
+  // invoke*
+ private:
+  ciMethod* improve_virtual_call(ciMethod*        caller,
+                                 ciInstanceKlass* klass,
+                                 ciMethod*        dest_method,
+                                 ciType*          receiver_type);
+  llvm::Value* get_direct_callee(ciMethod* method);
+  llvm::Value* get_virtual_callee(SharkValue* receiver, int vtable_index);
+  llvm::Value* get_interface_callee(SharkValue* receiver, ciMethod* method);
+
+  void do_call();
+
+  // checkcast and instanceof
+ private:
+  bool static_subtype_check(ciKlass* check_klass, ciKlass* object_klass);
+  void do_full_instance_check(ciKlass* klass);
+  void do_trapping_instance_check(ciKlass* klass);
+
+  void do_instance_check();
+  bool maybe_do_instanceof_if();
+
+  // new and *newarray
+ private:
+  void do_new();
+  void do_newarray();
+  void do_anewarray();
+  void do_multianewarray();
+
+  // monitorenter and monitorexit
+ private:
+  void do_monitorenter();
+  void do_monitorexit();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkType.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,112 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+class SharkType : public AllStatic {
+ private:
+  static SharkContext& context() {
+    return SharkContext::current();
+  }
+
+  // Basic types
+ public:
+  static const llvm::Type* void_type() {
+    return context().void_type();
+  }
+  static const llvm::IntegerType* bit_type() {
+    return context().bit_type();
+  }
+  static const llvm::IntegerType* jbyte_type() {
+    return context().jbyte_type();
+  }
+  static const llvm::IntegerType* jshort_type() {
+    return context().jshort_type();
+  }
+  static const llvm::IntegerType* jint_type() {
+    return context().jint_type();
+  }
+  static const llvm::IntegerType* jlong_type() {
+    return context().jlong_type();
+  }
+  static const llvm::Type* jfloat_type() {
+    return context().jfloat_type();
+  }
+  static const llvm::Type* jdouble_type() {
+    return context().jdouble_type();
+  }
+  static const llvm::IntegerType* intptr_type() {
+    return context().intptr_type();
+  }
+
+  // Compound types
+ public:
+  static const llvm::PointerType* itableOffsetEntry_type() {
+    return context().itableOffsetEntry_type();
+  }
+  static const llvm::PointerType* jniEnv_type() {
+    return context().jniEnv_type();
+  }
+  static const llvm::PointerType* jniHandleBlock_type() {
+    return context().jniHandleBlock_type();
+  }
+  static const llvm::PointerType* klass_type() {
+    return context().klass_type();
+  }
+  static const llvm::PointerType* methodOop_type() {
+    return context().methodOop_type();
+  }
+  static const llvm::ArrayType* monitor_type() {
+    return context().monitor_type();
+  }
+  static const llvm::PointerType* oop_type() {
+    return context().oop_type();
+  }
+  static const llvm::PointerType* thread_type() {
+    return context().thread_type();
+  }
+  static const llvm::PointerType* zeroStack_type() {
+    return context().zeroStack_type();
+  }
+  static const llvm::FunctionType* entry_point_type() {
+    return context().entry_point_type();
+  }
+  static const llvm::FunctionType* osr_entry_point_type() {
+    return context().osr_entry_point_type();
+  }
+
+  // Mappings
+ public:
+  static const llvm::Type* to_stackType(BasicType type) {
+    return context().to_stackType(type);
+  }
+  static const llvm::Type* to_stackType(ciType* type) {
+    return to_stackType(type->basic_type());
+  }
+  static const llvm::Type* to_arrayType(BasicType type) {
+    return context().to_arrayType(type);
+  }
+  static const llvm::Type* to_arrayType(ciType* type) {
+    return to_arrayType(type->basic_type());
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkValue.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,260 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkValue.cpp.incl"
+
+using namespace llvm;
+
+// Cloning
+
+SharkValue* SharkNormalValue::clone() const {
+  return SharkValue::create_generic(type(), generic_value(), zero_checked());
+}
+SharkValue* SharkPHIValue::clone() const {
+  return SharkValue::create_phi(type(), (PHINode *) generic_value(), this);
+}
+SharkValue* SharkAddressValue::clone() const {
+  return SharkValue::address_constant(address_value());
+}
+
+// Casting
+
+bool SharkValue::is_phi() const {
+  return false;
+}
+bool SharkPHIValue::is_phi() const {
+  return true;
+}
+SharkPHIValue* SharkValue::as_phi() {
+  ShouldNotCallThis();
+}
+SharkPHIValue* SharkPHIValue::as_phi() {
+  return this;
+}
+
+// Comparison
+
+bool SharkNormalValue::equal_to(SharkValue *other) const {
+  return (this->type()          == other->type() &&
+          this->generic_value() == other->generic_value() &&
+          this->zero_checked()  == other->zero_checked());
+}
+bool SharkAddressValue::equal_to(SharkValue *other) const {
+  return (this->address_value() == other->address_value());
+}
+
+// Type access
+
+ciType* SharkValue::type() const {
+  ShouldNotCallThis();
+}
+ciType* SharkNormalValue::type() const {
+  return _type;
+}
+
+BasicType SharkNormalValue::basic_type() const {
+  return type()->basic_type();
+}
+BasicType SharkAddressValue::basic_type() const {
+  return T_ADDRESS;
+}
+
+int SharkNormalValue::size() const {
+  return type()->size();
+}
+int SharkAddressValue::size() const {
+  return 1;
+}
+
+bool SharkValue::is_jint() const {
+  return false;
+}
+bool SharkValue::is_jlong() const {
+  return false;
+}
+bool SharkValue::is_jfloat() const {
+  return false;
+}
+bool SharkValue::is_jdouble() const {
+  return false;
+}
+bool SharkValue::is_jobject() const {
+  return false;
+}
+bool SharkValue::is_jarray() const {
+  return false;
+}
+bool SharkValue::is_address() const {
+  return false;
+}
+
+bool SharkNormalValue::is_jint() const {
+  return llvm_value()->getType() == SharkType::jint_type();
+}
+bool SharkNormalValue::is_jlong() const {
+  return llvm_value()->getType() == SharkType::jlong_type();
+}
+bool SharkNormalValue::is_jfloat() const {
+  return llvm_value()->getType() == SharkType::jfloat_type();
+}
+bool SharkNormalValue::is_jdouble() const {
+  return llvm_value()->getType() == SharkType::jdouble_type();
+}
+bool SharkNormalValue::is_jobject() const {
+  return llvm_value()->getType() == SharkType::oop_type();
+}
+bool SharkNormalValue::is_jarray() const {
+  return basic_type() == T_ARRAY;
+}
+bool SharkAddressValue::is_address() const {
+  return true;
+}
+
+// Typed conversions from SharkValues
+
+Value* SharkValue::jint_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jlong_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jfloat_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jdouble_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jobject_value() const {
+  ShouldNotCallThis();
+}
+Value* SharkValue::jarray_value() const {
+  ShouldNotCallThis();
+}
+int SharkValue::address_value() const {
+  ShouldNotCallThis();
+}
+
+Value* SharkNormalValue::jint_value() const {
+  assert(is_jint(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jlong_value() const {
+  assert(is_jlong(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jfloat_value() const {
+  assert(is_jfloat(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jdouble_value() const {
+  assert(is_jdouble(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jobject_value() const {
+  assert(is_jobject(), "should be");
+  return llvm_value();
+}
+Value* SharkNormalValue::jarray_value() const {
+  // XXX assert(is_jarray(), "should be");
+  // XXX http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=324
+  assert(is_jobject(), "should be");
+  return llvm_value();
+}
+int SharkAddressValue::address_value() const {
+  return _bci;
+}
+
+// Type-losing conversions -- use with care!
+
+Value* SharkNormalValue::generic_value() const {
+  return llvm_value();
+}
+Value* SharkAddressValue::generic_value() const {
+  return LLVMValue::intptr_constant(address_value());
+}
+
+Value* SharkValue::intptr_value(SharkBuilder* builder) const {
+  ShouldNotCallThis();
+}
+Value* SharkNormalValue::intptr_value(SharkBuilder* builder) const {
+  return builder->CreatePtrToInt(jobject_value(), SharkType::intptr_type());
+}
+
+// Phi-style stuff for SharkPHIState::add_incoming
+
+void SharkValue::addIncoming(SharkValue *value, BasicBlock* block) {
+  ShouldNotCallThis();
+}
+void SharkPHIValue::addIncoming(SharkValue *value, BasicBlock* block) {
+  assert(!is_clone(), "shouldn't be");
+  ((llvm::PHINode *) generic_value())->addIncoming(
+      value->generic_value(), block);
+  if (!value->zero_checked())
+    _all_incomers_zero_checked = false;
+}
+void SharkAddressValue::addIncoming(SharkValue *value, BasicBlock* block) {
+  assert(this->equal_to(value), "should be");
+}
+
+// Phi-style stuff for SharkState::merge
+
+SharkValue* SharkNormalValue::merge(SharkBuilder* builder,
+                                    SharkValue*   other,
+                                    BasicBlock*   other_block,
+                                    BasicBlock*   this_block,
+                                    const char*   name) {
+  assert(type() == other->type(), "should be");
+  assert(zero_checked() == other->zero_checked(), "should be");
+
+  PHINode *phi = builder->CreatePHI(SharkType::to_stackType(type()), name);
+  phi->addIncoming(this->generic_value(), this_block);
+  phi->addIncoming(other->generic_value(), other_block);
+  return SharkValue::create_generic(type(), phi, zero_checked());
+}
+SharkValue* SharkAddressValue::merge(SharkBuilder* builder,
+                                     SharkValue*   other,
+                                     BasicBlock*   other_block,
+                                     BasicBlock*   this_block,
+                                     const char*   name) {
+  assert(this->equal_to(other), "should be");
+  return this;
+}
+
+// Repeated null and divide-by-zero check removal
+
+bool SharkValue::zero_checked() const {
+  ShouldNotCallThis();
+}
+void SharkValue::set_zero_checked(bool zero_checked) {
+  ShouldNotCallThis();
+}
+
+bool SharkNormalValue::zero_checked() const {
+  return _zero_checked;
+}
+void SharkNormalValue::set_zero_checked(bool zero_checked) {
+  _zero_checked = zero_checked;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/sharkValue.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,332 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+// Items on the stack and in local variables are tracked using
+// SharkValue objects.
+//
+// All SharkValues are one of two core types, SharkNormalValue
+// and SharkAddressValue, but no code outside this file should
+// ever refer to those directly.  The split is because of the
+// way JSRs are handled: the typeflow pass expands them into
+// multiple copies, so the return addresses pushed by jsr and
+// popped by ret only exist at compile time.  Having separate
+// classes for these allows us to check that our jsr handling
+// is correct, via assertions.
+//
+// There is one more type, SharkPHIValue, which is a subclass
+// of SharkNormalValue with a couple of extra methods.  Use of
+// SharkPHIValue outside of this file is acceptable, so long
+// as it is obtained via SharkValue::as_phi().
+
+class SharkBuilder;
+class SharkPHIValue;
+
+class SharkValue : public ResourceObj {
+ protected:
+  SharkValue() {}
+
+  // Cloning
+ public:
+  virtual SharkValue* clone() const = 0;
+
+  // Casting
+ public:
+  virtual bool           is_phi() const;
+  virtual SharkPHIValue* as_phi();
+
+  // Comparison
+ public:
+  virtual bool equal_to(SharkValue* other) const = 0;
+
+  // Type access
+ public:
+  virtual BasicType basic_type() const = 0;
+  virtual ciType*   type()       const;
+
+  virtual bool is_jint()    const;
+  virtual bool is_jlong()   const;
+  virtual bool is_jfloat()  const;
+  virtual bool is_jdouble() const;
+  virtual bool is_jobject() const;
+  virtual bool is_jarray()  const;
+  virtual bool is_address() const;
+
+  virtual int size() const = 0;
+
+  bool is_one_word() const {
+    return size() == 1;
+  }
+  bool is_two_word() const {
+    return size() == 2;
+  }
+
+  // Typed conversion from SharkValues
+ public:
+  virtual llvm::Value* jint_value()    const;
+  virtual llvm::Value* jlong_value()   const;
+  virtual llvm::Value* jfloat_value()  const;
+  virtual llvm::Value* jdouble_value() const;
+  virtual llvm::Value* jobject_value() const;
+  virtual llvm::Value* jarray_value()  const;
+  virtual int          address_value() const;
+
+  // Typed conversion to SharkValues
+ public:
+  static SharkValue* create_jint(llvm::Value* value, bool zero_checked) {
+    assert(value->getType() == SharkType::jint_type(), "should be");
+    return create_generic(ciType::make(T_INT), value, zero_checked);
+  }
+  static SharkValue* create_jlong(llvm::Value* value, bool zero_checked) {
+    assert(value->getType() == SharkType::jlong_type(), "should be");
+    return create_generic(ciType::make(T_LONG), value, zero_checked);
+  }
+  static SharkValue* create_jfloat(llvm::Value* value) {
+    assert(value->getType() == SharkType::jfloat_type(), "should be");
+    return create_generic(ciType::make(T_FLOAT), value, false);
+  }
+  static SharkValue* create_jdouble(llvm::Value* value) {
+    assert(value->getType() == SharkType::jdouble_type(), "should be");
+    return create_generic(ciType::make(T_DOUBLE), value, false);
+  }
+  static SharkValue* create_jobject(llvm::Value* value, bool zero_checked) {
+    assert(value->getType() == SharkType::oop_type(), "should be");
+    return create_generic(ciType::make(T_OBJECT), value, zero_checked);
+  }
+
+  // Typed conversion from constants of various types
+ public:
+  static SharkValue* jint_constant(jint value) {
+    return create_jint(LLVMValue::jint_constant(value), value != 0);
+  }
+  static SharkValue* jlong_constant(jlong value) {
+    return create_jlong(LLVMValue::jlong_constant(value), value != 0);
+  }
+  static SharkValue* jfloat_constant(jfloat value) {
+    return create_jfloat(LLVMValue::jfloat_constant(value));
+  }
+  static SharkValue* jdouble_constant(jdouble value) {
+    return create_jdouble(LLVMValue::jdouble_constant(value));
+  }
+  static SharkValue* null() {
+    return create_jobject(LLVMValue::null(), false);
+  }
+  static inline SharkValue* address_constant(int bci);
+
+  // Type-losing conversions -- use with care!
+ public:
+  virtual llvm::Value* generic_value() const = 0;
+  virtual llvm::Value* intptr_value(SharkBuilder* builder) const;
+
+  static inline SharkValue* create_generic(ciType*      type,
+                                           llvm::Value* value,
+                                           bool         zero_checked);
+  static inline SharkValue* create_phi(ciType*              type,
+                                       llvm::PHINode*       phi,
+                                       const SharkPHIValue* parent = NULL);
+
+  // Phi-style stuff
+ public:
+  virtual void addIncoming(SharkValue* value, llvm::BasicBlock* block);
+  virtual SharkValue* merge(SharkBuilder*     builder,
+                            SharkValue*       other,
+                            llvm::BasicBlock* other_block,
+                            llvm::BasicBlock* this_block,
+                            const char*       name) = 0;
+
+  // Repeated null and divide-by-zero check removal
+ public:
+  virtual bool zero_checked() const;
+  virtual void set_zero_checked(bool zero_checked);
+};
+
+class SharkNormalValue : public SharkValue {
+  friend class SharkValue;
+
+ protected:
+  SharkNormalValue(ciType* type, llvm::Value* value, bool zero_checked)
+    : _type(type), _llvm_value(value), _zero_checked(zero_checked) {}
+
+ private:
+  ciType*      _type;
+  llvm::Value* _llvm_value;
+  bool         _zero_checked;
+
+ private:
+  llvm::Value* llvm_value() const {
+    return _llvm_value;
+  }
+
+  // Cloning
+ public:
+  SharkValue* clone() const;
+
+  // Comparison
+ public:
+  bool equal_to(SharkValue* other) const;
+
+  // Type access
+ public:
+  ciType*   type()       const;
+  BasicType basic_type() const;
+  int       size()       const;
+
+ public:
+  bool is_jint()    const;
+  bool is_jlong()   const;
+  bool is_jfloat()  const;
+  bool is_jdouble() const;
+  bool is_jobject() const;
+  bool is_jarray()  const;
+
+  // Typed conversions to LLVM values
+ public:
+  llvm::Value* jint_value()    const;
+  llvm::Value* jlong_value()   const;
+  llvm::Value* jfloat_value()  const;
+  llvm::Value* jdouble_value() const;
+  llvm::Value* jobject_value() const;
+  llvm::Value* jarray_value()  const;
+
+  // Type-losing conversions, use with care
+ public:
+  llvm::Value* generic_value() const;
+  llvm::Value* intptr_value(SharkBuilder* builder) const;
+
+  // Phi-style stuff
+ public:
+  SharkValue* merge(SharkBuilder*     builder,
+                    SharkValue*       other,
+                    llvm::BasicBlock* other_block,
+                    llvm::BasicBlock* this_block,
+                    const char*       name);
+
+  // Repeated null and divide-by-zero check removal
+ public:
+  bool zero_checked() const;
+  void set_zero_checked(bool zero_checked);
+};
+
+class SharkPHIValue : public SharkNormalValue {
+  friend class SharkValue;
+
+ protected:
+  SharkPHIValue(ciType* type, llvm::PHINode* phi, const SharkPHIValue *parent)
+    : SharkNormalValue(type, phi, parent && parent->zero_checked()),
+      _parent(parent),
+      _all_incomers_zero_checked(true) {}
+
+ private:
+  const SharkPHIValue* _parent;
+  bool                 _all_incomers_zero_checked;
+
+ private:
+  const SharkPHIValue* parent() const {
+    return _parent;
+  }
+  bool is_clone() const {
+    return parent() != NULL;
+  }
+
+ public:
+  bool all_incomers_zero_checked() const {
+    if (is_clone())
+      return parent()->all_incomers_zero_checked();
+
+    return _all_incomers_zero_checked;
+  }
+
+  // Cloning
+ public:
+  SharkValue* clone() const;
+
+  // Casting
+ public:
+  bool           is_phi() const;
+  SharkPHIValue* as_phi();
+
+  // Phi-style stuff
+ public:
+  void addIncoming(SharkValue *value, llvm::BasicBlock* block);
+};
+
+class SharkAddressValue : public SharkValue {
+  friend class SharkValue;
+
+ protected:
+  SharkAddressValue(int bci)
+    : _bci(bci) {}
+
+ private:
+  int _bci;
+
+  // Cloning
+ public:
+  SharkValue* clone() const;
+
+  // Comparison
+ public:
+  bool equal_to(SharkValue* other) const;
+
+  // Type access
+ public:
+  BasicType basic_type() const;
+  int       size()       const;
+  bool      is_address() const;
+
+  // Typed conversion from SharkValues
+ public:
+  int address_value() const;
+
+  // Type-losing conversion -- use with care!
+ public:
+  llvm::Value* generic_value() const;
+
+  // Phi-style stuff
+ public:
+  void addIncoming(SharkValue *value, llvm::BasicBlock* block);
+  SharkValue* merge(SharkBuilder*     builder,
+                    SharkValue*       other,
+                    llvm::BasicBlock* other_block,
+                    llvm::BasicBlock* this_block,
+                    const char*       name);
+};
+
+// SharkValue methods that can't be declared above
+
+inline SharkValue* SharkValue::create_generic(ciType*      type,
+                                              llvm::Value* value,
+                                              bool         zero_checked) {
+  return new SharkNormalValue(type, value, zero_checked);
+}
+
+inline SharkValue* SharkValue::create_phi(ciType*              type,
+                                          llvm::PHINode*       phi,
+                                          const SharkPHIValue* parent) {
+  return new SharkPHIValue(type, phi, parent);
+}
+
+inline SharkValue* SharkValue::address_constant(int bci) {
+  return new SharkAddressValue(bci);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/shark_globals.cpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_shark_globals.cpp.incl"
+
+SHARK_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shark/hotspot/src/share/vm/shark/shark_globals.hpp	Wed Sep 22 16:27:14 2010 +0100
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#define SHARK_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
+                                                                              \
+  product(intx, MaxNodeLimit, 65000,                                          \
+          "Maximum number of nodes")                                          \
+                                                                              \
+  /* inlining */                                                              \
+  product(intx, SharkMaxInlineSize, 32,                                       \
+          "Maximum bytecode size of methods to inline when using Shark")      \
+                                                                              \
+  /* compiler debugging */                                                    \
+  develop(ccstr, SharkPrintTypeflowOf, NULL,                                  \
+          "Print the typeflow of the specified method")                       \
+                                                                              \
+  diagnostic(ccstr, SharkPrintBitcodeOf, NULL,                                \
+          "Print the LLVM bitcode of the specified method")                   \
+                                                                              \
+  diagnostic(ccstr, SharkPrintAsmOf, NULL,                                    \
+          "Print the asm of the specified method")                            \
+                                                                              \
+  develop(bool, SharkTraceBytecodes, false,                                   \
+          "Trace bytecode compilation")                                       \
+                                                                              \
+  diagnostic(bool, SharkTraceInstalls, false,                                 \
+          "Trace method installation")                                        \
+                                                                              \
+  diagnostic(bool, SharkPerformanceWarnings, false,                           \
+          "Warn about things that could be made faster")                      \
+
+SHARK_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)