# HG changeset patch # User Doug Simon # Date 1331467897 -3600 # Node ID b593e82d9309dac77b0023fd3756a9628a6168df # Parent 8f5fa253e37f103bae70bc607c39fd79eac2926f# Parent 6e7c1fb1980f1d30103dff1237a77a3e6b56ff53 Merge. diff -r 8f5fa253e37f -r b593e82d9309 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Mar 09 08:03:20 2012 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Sun Mar 11 13:11:37 2012 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.compiler; +import java.lang.reflect.*; import java.util.*; import java.util.concurrent.*; @@ -78,6 +79,7 @@ } public CiTargetMethod compileMethod(final RiResolvedMethod method, final StructuredGraph graph, int osrBCI, final PhasePlan plan) { + assert (method.accessFlags() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; if (osrBCI != -1) { throw new CiBailout("No OSR supported"); } diff -r 8f5fa253e37f -r b593e82d9309 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Fri Mar 09 08:03:20 2012 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Sun Mar 11 13:11:37 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); diff -r 8f5fa253e37f -r b593e82d9309 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Fri Mar 09 08:03:20 2012 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Sun Mar 11 13:11:37 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(); diff -r 8f5fa253e37f -r b593e82d9309 src/share/vm/graal/graalCompiler.hpp --- a/src/share/vm/graal/graalCompiler.hpp Fri Mar 09 08:03:20 2012 +0100 +++ b/src/share/vm/graal/graalCompiler.hpp Sun Mar 11 13:11:37 2012 +0100 @@ -41,7 +41,7 @@ virtual const char* name() { return "G"; } // Native / OSR not supported - virtual bool supports_native() { return false; } + virtual bool supports_native() { return true; } virtual bool supports_osr () { return false; } // Pretend to be C1 diff -r 8f5fa253e37f -r b593e82d9309 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Fri Mar 09 08:03:20 2012 +0100 +++ b/src/share/vm/graal/graalJavaAccess.hpp Sun Mar 11 13:11:37 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;") \ diff -r 8f5fa253e37f -r b593e82d9309 src/share/vm/utilities/ostream.cpp --- a/src/share/vm/utilities/ostream.cpp Fri Mar 09 08:03:20 2012 +0100 +++ b/src/share/vm/utilities/ostream.cpp Sun Mar 11 13:11:37 2012 +0100 @@ -102,6 +102,7 @@ result_len = strlen(result); } else { DEBUG_ONLY(warning("increase O_BUFLEN in ostream.hpp -- output truncated");) + result = buffer; result_len = buflen - 1; buffer[result_len] = 0; @@ -615,7 +616,9 @@ // Print it as a java-style property list. // System properties don't generally contain newlines, so don't bother with unparsing. for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) { - xs->text()->print_cr("%s=%s", p->key(), p->value()); + xs->text()->print(p->key()); + xs->text()->print("="); + xs->text()->print_cr(p->value()); } xs->tail("properties"); }