changeset 5315:8ab14908fb3c

undid fix for non-issue in checkcast/instanceof XIR snippets
author Doug Simon <doug.simon@oracle.com>
date Fri, 27 Apr 2012 13:12:39 +0200
parents 474ae8316c5a
children 8ac40aed34bf
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java
diffstat 1 files changed, 26 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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);