Skip to content

Instantly share code, notes, and snippets.

@woess

woess/pe.patch Secret

Created March 12, 2014 17:11
Show Gist options
  • Save woess/d3276080dc18f8926f2f to your computer and use it in GitHub Desktop.
Save woess/d3276080dc18f8926f2f to your computer and use it in GitHub Desktop.
diff --git a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
@@ -43,6 +43,7 @@
import com.oracle.graal.nodes.java.*;
import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
import com.oracle.graal.nodes.util.*;
import com.oracle.graal.nodes.virtual.*;
import com.oracle.graal.phases.*;
@@ -72,6 +73,7 @@
private Set<Constant> constantReceivers;
private final GraphCache cache;
private final TruffleCache truffleCache;
+ private final ResolvedJavaType frameType;
public PartialEvaluator(RuntimeProvider runtime, Providers providers, TruffleCache truffleCache, GraphBuilderConfiguration config) {
this.providers = providers;
@@ -80,6 +82,7 @@
this.config = config;
this.cache = runtime.getGraphCache();
this.truffleCache = truffleCache;
+ this.frameType = providers.getMetaAccess().lookupJavaType(FrameWithoutBoxing.class);
try {
executeHelperMethod = providers.getMetaAccess().lookupJavaMethod(OptimizedCallTarget.class.getDeclaredMethod("executeHelper", PackedFrame.class, Arguments.class));
} catch (NoSuchMethodException ex) {
@@ -183,7 +186,7 @@
changed = false;
for (MethodCallTargetNode methodCallTargetNode : graph.getNodes(MethodCallTargetNode.class)) {
InvokeKind kind = methodCallTargetNode.invokeKind();
- if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || methodCallTargetNode.receiver() instanceof NewFrameNode))) {
+ if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || isFrame(methodCallTargetNode.receiver())))) {
if (TraceTruffleCompilationHistogram.getValue() && kind == InvokeKind.Special) {
ConstantNode constantNode = (ConstantNode) methodCallTargetNode.arguments().first();
constantReceivers.add(constantNode.asConstant());
@@ -237,6 +240,10 @@
}
}
+ private boolean isFrame(ValueNode receiver) {
+ return receiver instanceof NewFrameNode || ObjectStamp.typeOrNull(receiver.stamp()) == frameType;
+ }
+
private StructuredGraph parseGraph(final ResolvedJavaMethod targetMethod, final NodeInputList<ValueNode> arguments, final Assumptions assumptions, final PhaseContext phaseContext) {
StructuredGraph graph = truffleCache.lookup(targetMethod, arguments, assumptions, canonicalizer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment