RTC: fix for fast bytecodes with ARM / Shark

Edward Nevill ed at camswl.com
Mon Mar 29 08:07:06 PDT 2010

Hi folks,

The attached patch fixes the problem with Shark calling main_loop when
a method is made non entrant.

This patches hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp to
recognise the rewritten bytecodes.

Basically what happens is, where it would normally crash with the
"unimplemented opcode" message it looks up what the original bytecode
was before it was rewritten and executes that instead. This is very
similar to the 'breakpoint' opcode just a few lines above it.

So if, originally we had


which was rewritten as


then it will just execute a single iload. It will then execute the
second iload normally as this has not been rewritten.

This does mean that it will execute in the C interpreter and will
therefore execute more slowly, however this will only be very

The table for converting rewritten bytecodes back to original bytecodes
is in


Basically, all the mechanism is there to do it in OpenJDK. Shark already
does this, otherwise it wouldn't compile the methods at all.

This is undoubtedly the cleanest fix for the problem. Unfortunately it
is in shared code. However, I think it is a patch that is worthwhile
pushing upstream. Note, I haven't conditionalised it because it is a
generic fix.

The patch has already been reviewed by Gary and Xerxes. Gary has kindly
volunteered to push it upstream. Xerxes has tested it with Shark / ARM.

Thanks to Gary and Xerxes for their help,


--- CUT HERE ---------------------------------------------------------
diff -r 2bf01e9fe8b0 Makefile.am
--- a/Makefile.am	Fri Mar 19 10:13:31 2010 +0100
+++ b/Makefile.am	Fri Mar 19 15:06:03 2010 +0100
@@ -220,6 +220,7 @@
 	patches/zero/6909153.patch \
 	patches/zero/6913869.patch \
 	patches/zero/6914622.patch \
+	patches/zero/cppInterpreter-fast-bytecodes.patch \
 	patches/icedtea-notice-safepoints.patch \
 	patches/icedtea-parisc-opt.patch \
 	patches/icedtea-lucene-crash.patch \
diff -r 2bf01e9fe8b0 patches/zero/cppInterpreter-fast-bytecodes.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/zero/cppInterpreter-fast-bytecodes.patch	Fri Mar 19
15:06:03 2010 +0100
@@ -0,0 +1,15 @@
+Index: openjdk/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
2010-03-19 10:35:14.000000000 +0100
++++ openjdk/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
2010-03-19 10:39:01.000000000 +0100
+@@ -2328,6 +2328,10 @@
+       }
+       DEFAULT:
++         if (Bytecodes::is_defined((Bytecodes::Code)opcode)) {
++           opcode =
++           goto opcode_switch;
++         }
+           fatal2("\t*** Unimplemented opcode: %d = %s\n",
+                  opcode, Bytecodes::name((Bytecodes::Code)opcode));
+           goto finish;

More information about the distro-pkg-dev mailing list