changeset 4321:e02b67e39aa3

Merge
author Andreas Woess <andreas.woess@jku.at>
date Wed, 25 Jan 2012 14:15:17 +0100
parents 125678ef7587 (current diff) e3374bccaa5f (diff)
children 49b33f8fcad7
files
diffstat 3 files changed, 30 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java	Wed Jan 25 14:09:59 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java	Wed Jan 25 14:15:17 2012 +0100
@@ -147,7 +147,9 @@
     private CiValue use(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
         allowed(curInstruction, value, mode, flags);
 
-        if (beforeRegisterAllocation && isVariable(value)) {
+        if (isVariable(value)) {
+            assert beforeRegisterAllocation;
+
             int variableIdx = asVariable(value).index;
             if (!curVariablesLive.get(variableIdx)) {
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
@@ -159,9 +161,13 @@
                 throw Util.shouldNotReachHere();
             }
 
-        } else if (beforeRegisterAllocation && isAllocatableRegister(value)) {
+        } else if (isAllocatableRegister(value)) {
             int regNum = asRegister(value).number;
-            if (curRegistersLive[regNum] != value) {
+            if (mode == OperandMode.Alive) {
+                curRegistersDefined.set(regNum);
+            }
+
+            if (beforeRegisterAllocation && curRegistersLive[regNum] != value) {
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
                 TTY.println("live registers: %s", Arrays.toString(curRegistersLive));
                 TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value);
@@ -174,7 +180,9 @@
     private CiValue def(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
         allowed(curInstruction, value, mode, flags);
 
-        if (beforeRegisterAllocation && isVariable(value)) {
+        if (isVariable(value)) {
+            assert beforeRegisterAllocation;
+
             int variableIdx = asVariable(value).index;
             if (variableDefinitions[variableIdx] != null) {
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
@@ -190,7 +198,7 @@
                 curVariablesLive.set(variableIdx);
             }
 
-        } else if (beforeRegisterAllocation && isAllocatableRegister(value)) {
+        } else if (isAllocatableRegister(value)) {
             int regNum = asRegister(value).number;
             if (curRegistersDefined.get(regNum)) {
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Jan 25 14:09:59 2012 +0100
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Jan 25 14:15:17 2012 +0100
@@ -383,14 +383,11 @@
     }
 
     private void genLoadConstant(int cpi, int opcode) {
-        Object con = constantPool.lookupConstant(cpi);
+        Object con = lookupConstant(cpi, opcode);
 
         if (con instanceof RiType) {
             // this is a load of class constant which might be unresolved
             RiType riType = (RiType) con;
-            if (config.eagerResolving() && !(riType instanceof RiResolvedType)) {
-                riType = lookupType(cpi, opcode);
-            }
             if (riType instanceof RiResolvedType) {
                 frameState.push(CiKind.Object, append(ConstantNode.forCiConstant(((RiResolvedType) riType).getEncoding(Representation.JavaClass), runtime, currentGraph)));
             } else {
@@ -674,6 +671,19 @@
         return result;
     }
 
+    private Object lookupConstant(int cpi, int opcode) {
+        eagerResolving(cpi, opcode);
+        Object result = constantPool.lookupConstant(cpi);
+        assert !config.eagerResolving() || !(result instanceof RiType) || (result instanceof RiResolvedType);
+        return result;
+    }
+
+    private void eagerResolving(int cpi, int bytecode) {
+        if (config.eagerResolving()) {
+            constantPool.loadReferencedType(cpi, bytecode);
+        }
+    }
+
     private void eagerResolvingForSnippets(int cpi, int bytecode) {
         if (config.eagerResolvingForSnippets()) {
             constantPool.loadReferencedType(cpi, bytecode);
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Wed Jan 25 14:09:59 2012 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Wed Jan 25 14:15:17 2012 +0100
@@ -506,7 +506,9 @@
   
   constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
   int byteCode = (op & 0xFF);
-  if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray && byteCode != Bytecodes::_multianewarray) {
+  if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray
+      && byteCode != Bytecodes::_multianewarray && byteCode != Bytecodes::_ldc && byteCode != Bytecodes::_ldc_w && byteCode != Bytecodes::_ldc2_w)
+  {
     index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index));
   }
   constantTag tag = cp->tag_at(index);