changeset 7002:74f0207b82f5

fixed bug in bytecode reconstitution
author Doug Simon <doug.simon@oracle.com>
date Thu, 22 Nov 2012 12:56:52 +0100
parents 46bec43bdfc3
children bb524ee6b8e9
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java src/share/vm/graal/graalCompilerToVM.cpp
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Wed Nov 21 23:36:06 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Thu Nov 22 12:56:52 2012 +0100
@@ -40,6 +40,7 @@
 
     @Override
     public Object lookupConstant(int cpi) {
+        assert cpi != 0;
         Object constant = HotSpotGraalRuntime.getInstance().getCompilerToVM().lookupConstantInPool(type, cpi);
         return constant;
     }
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Wed Nov 21 23:36:06 2012 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Thu Nov 22 12:56:52 2012 +0100
@@ -99,7 +99,7 @@
           assert(i < method->constants()->length(), "sanity check");
           Bytes::put_Java_u2((address) reconstituted_code + bci + 1, (u2)i);
         } else if (opcode == Bytecodes::_fast_aldc) {
-          int cpci = reconstituted_code[bci + 1];
+          int cpci = reconstituted_code[bci + 1] & 0xff;
           int i = method->constants()->object_to_cp_index(cpci);
           assert(i < method->constants()->length(), "sanity check");
           reconstituted_code[bci + 1] = (jbyte)i;
@@ -398,8 +398,7 @@
     assert(obj->is_instance(), "must be an instance");
     result = VMToCompiler::createConstantObject(obj, CHECK_NULL);
   } else {
-    tty->print("unknown constant pool tag at cpi %d in %s: ", index, cp->pool_holder()->name()->as_C_string());
-    tag.print_on(tty);
+    tty->print("unknown constant pool tag (%s) at cpi %d in %s: ", tag.internal_name(), index, cp->pool_holder()->name()->as_C_string());
     ShouldNotReachHere();
   }