# HG changeset patch # User Doug Simon # Date 1335436720 -7200 # Node ID 31110c447ad2991b4048f0f8fdc520688c3b9798 # Parent 55bf72fafc4132919a933e34e4aff95f40c560dd fixed bug in XIR for checkcast & instanceof: klassOop of hint object was not being used so compare always failed diff -r 55bf72fafc41 -r 31110c447ad2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Apr 25 14:34:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Thu Apr 26 12:38:40 2012 +0200 @@ -26,7 +26,6 @@ import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.phases.*; -import com.oracle.graal.cri.*; import com.oracle.graal.debug.*; import com.oracle.graal.hotspot.ri.*; import com.oracle.graal.nodes.*; diff -r 55bf72fafc41 -r 31110c447ad2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Wed Apr 25 14:34:29 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Thu Apr 26 12:38:40 2012 +0200 @@ -488,15 +488,15 @@ // -- out of line ------------------------------------------------------- asm.bindOutOfLine(slowPath); } else { - XirOperand scratchObject = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); // if we get an exact match: succeed immediately + XirOperand hintHub = asm.createTemp("hintHub", CiKind.Object); for (int i = 0; i < hintCount; i++) { - XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, CiKind.Object); - asm.mov(scratchObject, hintHub); + XirParameter hintMirror = asm.createConstantInputParameter("hintMirror" + i, CiKind.Object); + asm.pload(CiKind.Object, hintHub, hintMirror, asm.i(config.klassOopOffset), false); if (i < hintCount - 1) { - asm.jeq(end, objHub, scratchObject); + asm.jeq(end, objHub, hintHub); } else { - asm.jneq(slowPath, objHub, scratchObject); + asm.jneq(slowPath, objHub, hintHub); } } asm.bindInline(end); @@ -545,21 +545,21 @@ asm.jmp(trueSucc); } else { XirLabel slowPath = null; - XirOperand scratchObject = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); + XirOperand hintHub = asm.createTemp("hintHub", CiKind.Object); // if we get an exact match: succeed immediately for (int i = 0; i < hintCount; i++) { - XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, CiKind.Object); - asm.mov(scratchObject, hintHub); + XirParameter hintMirror = asm.createConstantInputParameter("hintMirror" + i, CiKind.Object); + asm.pload(CiKind.Object, hintHub, hintMirror, asm.i(config.klassOopOffset), false); if (i < hintCount - 1) { - asm.jeq(trueSucc, objHub, scratchObject); + asm.jeq(trueSucc, objHub, hintHub); } else { if (is(EXACT_HINTS, flags)) { - asm.jneq(falseSucc, objHub, scratchObject); + asm.jneq(falseSucc, objHub, hintHub); asm.jmp(trueSucc); } else { slowPath = asm.createOutOfLineLabel("slow path"); - asm.jneq(slowPath, objHub, scratchObject); + asm.jneq(slowPath, objHub, hintHub); asm.jmp(trueSucc); } } @@ -610,20 +610,20 @@ asm.bindInline(end); } else { XirLabel slowPath = null; - XirOperand scratchObject = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); + XirOperand hintHub = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); // if we get an exact match: succeed immediately for (int i = 0; i < hintCount; i++) { - XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, CiKind.Object); - asm.mov(scratchObject, hintHub); + XirParameter hintMirror = asm.createConstantInputParameter("hintMirror" + i, CiKind.Object); + asm.pload(CiKind.Object, hintHub, hintMirror, asm.i(config.klassOopOffset), false); if (i < hintCount - 1) { - asm.jeq(end, objHub, scratchObject); + asm.jeq(end, objHub, hintHub); } else { if (is(EXACT_HINTS, flags)) { - asm.jeq(end, objHub, scratchObject); + asm.jeq(end, objHub, hintHub); } else { slowPath = asm.createOutOfLineLabel("slow path"); - asm.jeq(end, objHub, scratchObject); + asm.jeq(end, objHub, hintHub); asm.jmp(slowPath); } } @@ -906,7 +906,8 @@ params[i++] = hub; } for (RiResolvedType hint : hints) { - params[i++] = XirArgument.forObject(hint); + Object hintMirror = hint.toJava(); + params[i++] = XirArgument.forObject(hintMirror); } XirTemplate template = hintsExact ? checkCastTemplates.get(site, hints.length, EXACT_HINTS) : checkCastTemplates.get(site, hints.length); return new XirSnippet(template, params); @@ -925,7 +926,8 @@ params[i++] = hub; } for (RiResolvedType hint : hints) { - params[i++] = XirArgument.forObject(hint); + Object hintMirror = hint.toJava(); + params[i++] = XirArgument.forObject(hintMirror); } XirTemplate template = hintsExact ? instanceOfTemplates.get(site, hints.length, EXACT_HINTS) : instanceOfTemplates.get(site, hints.length); return new XirSnippet(template, params); @@ -946,7 +948,8 @@ params[i++] = trueValue; params[i++] = falseValue; for (RiResolvedType hint : hints) { - params[i++] = XirArgument.forObject(hint); + Object hintMirror = hint.toJava(); + params[i++] = XirArgument.forObject(hintMirror); } XirTemplate template = hintsExact ? materializeInstanceOfTemplates.get(site, hints.length, EXACT_HINTS) : materializeInstanceOfTemplates.get(site, hints.length); return new XirSnippet(template, params);