# HG changeset patch # User Andreas Woess # Date 1327497317 -3600 # Node ID e02b67e39aa339a55f71b2d5601429cdc147d54f # Parent 125678ef7587bce95035fa791c57bb98b5ca0548# Parent e3374bccaa5f78cb4caa3f244fc39dc521e0b8db Merge diff -r 125678ef7587 -r e02b67e39aa3 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java --- 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 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 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); diff -r 125678ef7587 -r e02b67e39aa3 graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java --- 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); diff -r 125678ef7587 -r e02b67e39aa3 src/share/vm/graal/graalCompilerToVM.cpp --- 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);