changeset 5067:bb290d53a338

Remove method callback.
author Andreas Woess <andreas.woess@jku.at>
date Fri, 09 Mar 2012 17:12:20 +0100
parents f2d2fb93daad
children 6e7c1fb1980f
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java src/share/vm/graal/graalJavaAccess.hpp
diffstat 3 files changed, 2 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Thu Mar 08 16:39:16 2012 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Fri Mar 09 17:12:20 2012 +0100
@@ -56,7 +56,6 @@
     private HotSpotMethodData methodData;
     private byte[] code;
     private boolean canBeInlined;
-    private CiGenericCallback callback;
     private int compilationComplexity;
 
     private HotSpotMethodResolvedImpl() {
@@ -339,19 +338,12 @@
 
     @Override
     public boolean canBeInlined() {
-        return canBeInlined && callback == null;
+        return canBeInlined;
     }
     public void neverInline() {
         this.canBeInlined = false;
     }
 
-    public CiGenericCallback callback() {
-        return callback;
-    }
-    public void setCallback(CiGenericCallback callback) {
-        this.callback = callback;
-    }
-
     @Override
     public int vtableEntryOffset() {
         return compiler.getVMEntries().RiMethod_vtableEntryOffset(this);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Thu Mar 08 16:39:16 2012 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Fri Mar 09 17:12:20 2012 +0100
@@ -43,7 +43,6 @@
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.DeoptimizeNode.DeoptAction;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
@@ -408,13 +407,7 @@
 
     @Override
     public void installMethod(RiResolvedMethod method, CiTargetMethod code) {
-        synchronized (method) {
-            if (((HotSpotMethodResolvedImpl) method).callback() == null) {
-                compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), true);
-            } else {
-                // callback stub is installed.
-            }
-        }
+        compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), true);
     }
 
     @Override
@@ -422,69 +415,11 @@
         return compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), false);
     }
 
-    public void installMethodCallback(RiResolvedMethod method, CiGenericCallback callback) {
-        synchronized (method) {
-            ((HotSpotMethodResolvedImpl) method).setCallback(callback);
-            CiTargetMethod callbackStub = createCallbackStub(method, callback);
-            compiler.getVMEntries().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, callbackStub), true);
-        }
-    }
-
     @Override
     public RiRegisterConfig getGlobalStubRegisterConfig() {
         return globalStubRegConfig;
     }
 
-    private CiTargetMethod createCallbackStub(RiResolvedMethod method, CiGenericCallback callback) {
-        StructuredGraph graph = new StructuredGraph();
-        FrameStateBuilder frameState = new FrameStateBuilder(method, graph, false);
-        ValueNode local0 = frameState.loadLocal(0);
-
-        FrameState initialFrameState = frameState.create(0);
-        graph.start().setStateAfter(initialFrameState);
-
-        ConstantNode callbackNode = ConstantNode.forObject(callback, this, graph);
-
-        RuntimeCallNode runtimeCall = graph.add(new RuntimeCallNode(CiRuntimeCall.GenericCallback, new ValueNode[] {callbackNode, local0}));
-        runtimeCall.setStateAfter(initialFrameState.duplicateModified(0, false, CiKind.Void, runtimeCall));
-
-        @SuppressWarnings("unused")
-        HotSpotCompiledMethod hotSpotCompiledMethod = new HotSpotCompiledMethod(null, null); // initialize class...
-        RiResolvedType compiledMethodClass = getType(HotSpotCompiledMethod.class);
-        RiResolvedField nmethodField = null;
-        for (RiResolvedField field : compiledMethodClass.declaredFields()) {
-            if (field.name().equals("nmethod")) {
-                nmethodField = field;
-                break;
-            }
-        }
-        assert nmethodField != null;
-        LoadFieldNode loadField = graph.add(new LoadFieldNode(runtimeCall, nmethodField));
-
-        CompareNode compare = graph.unique(new CompareNode(loadField, Condition.EQ, ConstantNode.forLong(0, graph)));
-
-        IfNode ifNull = graph.add(new IfNode(compare, 0.01));
-
-        BeginNode beginInvalidated = graph.add(new BeginNode());
-        DeoptimizeNode deoptInvalidated = graph.add(new DeoptimizeNode(DeoptAction.None));
-
-        BeginNode beginTailcall = graph.add(new BeginNode());
-        TailcallNode tailcall = graph.add(new TailcallNode(loadField, initialFrameState));
-        DeoptimizeNode deoptEnd = graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile));
-
-        graph.start().setNext(runtimeCall);
-        runtimeCall.setNext(loadField);
-        loadField.setNext(ifNull);
-        ifNull.setTrueSuccessor(beginInvalidated);
-        ifNull.setFalseSuccessor(beginTailcall);
-        beginInvalidated.setNext(deoptInvalidated);
-        beginTailcall.setNext(tailcall);
-        tailcall.setNext(deoptEnd);
-
-        CiTargetMethod result = compiler.getCompiler().compileMethod(method, graph, -1, PhasePlan.DEFAULT);
-        return result;
-    }
-
     @Override
     public CiTargetMethod compile(RiResolvedMethod method, StructuredGraph graph) {
         final PhasePlan plan = new PhasePlan();
--- a/src/share/vm/graal/graalJavaAccess.hpp	Thu Mar 08 16:39:16 2012 -0800
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Fri Mar 09 17:12:20 2012 +0100
@@ -68,7 +68,6 @@
     int_field(HotSpotMethodResolved, maxLocals)                                         \
     int_field(HotSpotMethodResolved, maxStackSize)                                      \
     boolean_field(HotSpotMethodResolved, canBeInlined)                                  \
-    oop_field(HotSpotMethodResolved, callback, "Lcom/oracle/max/cri/ci/CiGenericCallback;") \
   end_class                                                                             \
   start_class(HotSpotMethodData)                                                        \
     oop_field(HotSpotMethodData, compiler, "Lcom/oracle/graal/hotspot/Compiler;")   \