# HG changeset patch # User Doug Simon # Date 1335525159 -7200 # Node ID 8ab14908fb3c9f8a7c3a7181acfd39d72a0be73b # Parent 474ae8316c5ab8cdf720c222d318459a7643e016 undid fix for non-issue in checkcast/instanceof XIR snippets diff -r 474ae8316c5a -r 8ab14908fb3c 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 Fri Apr 27 11:16:43 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Fri Apr 27 13:12:39 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 hintMirror = asm.createConstantInputParameter("hintMirror" + i, CiKind.Object); - asm.pload(CiKind.Object, hintHub, hintMirror, asm.i(config.klassOopOffset), false); + XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, CiKind.Object); + asm.mov(scratchObject, hintHub); if (i < hintCount - 1) { - asm.jeq(end, objHub, hintHub); + asm.jeq(end, objHub, scratchObject); } else { - asm.jneq(slowPath, objHub, hintHub); + asm.jneq(slowPath, objHub, scratchObject); } } asm.bindInline(end); @@ -545,21 +545,21 @@ asm.jmp(trueSucc); } else { XirLabel slowPath = null; - XirOperand hintHub = asm.createTemp("hintHub", CiKind.Object); + XirOperand scratchObject = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); // if we get an exact match: succeed immediately for (int i = 0; i < hintCount; i++) { - XirParameter hintMirror = asm.createConstantInputParameter("hintMirror" + i, CiKind.Object); - asm.pload(CiKind.Object, hintHub, hintMirror, asm.i(config.klassOopOffset), false); + XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, CiKind.Object); + asm.mov(scratchObject, hintHub); if (i < hintCount - 1) { - asm.jeq(trueSucc, objHub, hintHub); + asm.jeq(trueSucc, objHub, scratchObject); } else { if (is(EXACT_HINTS, flags)) { - asm.jneq(falseSucc, objHub, hintHub); + asm.jneq(falseSucc, objHub, scratchObject); asm.jmp(trueSucc); } else { slowPath = asm.createOutOfLineLabel("slow path"); - asm.jneq(slowPath, objHub, hintHub); + asm.jneq(slowPath, objHub, scratchObject); asm.jmp(trueSucc); } } @@ -610,20 +610,20 @@ asm.bindInline(end); } else { XirLabel slowPath = null; - XirOperand hintHub = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); + XirOperand scratchObject = asm.createRegisterTemp("scratch", CiKind.Object, AMD64.r10); // if we get an exact match: succeed immediately for (int i = 0; i < hintCount; i++) { - XirParameter hintMirror = asm.createConstantInputParameter("hintMirror" + i, CiKind.Object); - asm.pload(CiKind.Object, hintHub, hintMirror, asm.i(config.klassOopOffset), false); + XirParameter hintHub = asm.createConstantInputParameter("hintHub" + i, CiKind.Object); + asm.mov(scratchObject, hintHub); if (i < hintCount - 1) { - asm.jeq(end, objHub, hintHub); + asm.jeq(end, objHub, scratchObject); } else { if (is(EXACT_HINTS, flags)) { - asm.jeq(end, objHub, hintHub); + asm.jeq(end, objHub, scratchObject); } else { slowPath = asm.createOutOfLineLabel("slow path"); - asm.jeq(end, objHub, hintHub); + asm.jeq(end, objHub, scratchObject); asm.jmp(slowPath); } } @@ -906,8 +906,9 @@ params[i++] = hub; } for (RiResolvedType hint : hints) { - Object hintMirror = hint.toJava(); - params[i++] = XirArgument.forObject(hintMirror); + // The Graal C++ code auto-magically converts HotSpotTypeResolvedImpl into the corresponding klassOop. + // See CodeInstaller::site_DataPatch in graalCodeInstaller.cpp. + params[i++] = XirArgument.forObject(hint); } XirTemplate template = hintsExact ? checkCastTemplates.get(site, hints.length, EXACT_HINTS) : checkCastTemplates.get(site, hints.length); return new XirSnippet(template, params); @@ -926,8 +927,9 @@ params[i++] = hub; } for (RiResolvedType hint : hints) { - Object hintMirror = hint.toJava(); - params[i++] = XirArgument.forObject(hintMirror); + // The Graal C++ code auto-magically converts HotSpotTypeResolvedImpl into the corresponding klassOop. + // See CodeInstaller::site_DataPatch in graalCodeInstaller.cpp. + params[i++] = XirArgument.forObject(hint); } XirTemplate template = hintsExact ? instanceOfTemplates.get(site, hints.length, EXACT_HINTS) : instanceOfTemplates.get(site, hints.length); return new XirSnippet(template, params); @@ -948,8 +950,9 @@ params[i++] = trueValue; params[i++] = falseValue; for (RiResolvedType hint : hints) { - Object hintMirror = hint.toJava(); - params[i++] = XirArgument.forObject(hintMirror); + // The Graal C++ code auto-magically converts HotSpotTypeResolvedImpl into the corresponding klassOop. + // See CodeInstaller::site_DataPatch in graalCodeInstaller.cpp. + params[i++] = XirArgument.forObject(hint); } XirTemplate template = hintsExact ? materializeInstanceOfTemplates.get(site, hints.length, EXACT_HINTS) : materializeInstanceOfTemplates.get(site, hints.length); return new XirSnippet(template, params);