Mercurial > hg > graal-compiler
changeset 22070:2bca65cc5f3a
Make it possible to disable unsafe access tracking
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 23 Jun 2015 12:32:16 +0200 |
parents | b3a22c989adb |
children | bc502be71702 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java |
diffstat | 6 files changed, 35 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Tue Jun 23 12:03:39 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Tue Jun 23 12:32:16 2015 +0200 @@ -199,6 +199,7 @@ StructuredGraph graph = new StructuredGraph(toString(), null, AllowAssumptions.NO); graph.disableInlinedMethodRecording(); + graph.disableUnsafeAccessTracking(); GraphKit kit = new GraphKit(graph, providers, wordTypes, providers.getGraphBuilderPlugins()); ParameterNode[] params = createParameters(kit, args);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Tue Jun 23 12:03:39 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Tue Jun 23 12:32:16 2015 +0200 @@ -101,6 +101,7 @@ // evolved or have breakpoints. final StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO); graph.disableInlinedMethodRecording(); + graph.disableUnsafeAccessTracking(); if (SnippetGraphUnderConstruction != null) { assert SnippetGraphUnderConstruction.get() == null : SnippetGraphUnderConstruction.get().toString() + " " + graph;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Tue Jun 23 12:03:39 2015 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Tue Jun 23 12:32:16 2015 +0200 @@ -125,7 +125,13 @@ */ private Map<ResolvedJavaMethod, Integer> inlinedMethods = new HashMap<>(); - private boolean hasUnsafeAccess = false; + private static enum UnsafeAccessState { + NO_ACCESS, + HAS_ACCESS, + DISABLED + } + + private UnsafeAccessState hasUnsafeAccess = UnsafeAccessState.NO_ACCESS; /** * Creates a new Graph containing a single {@link AbstractBeginNode} as the {@link #start() @@ -251,6 +257,7 @@ if (!enableInlinedMethodRecording) { copy.disableInlinedMethodRecording(); } + copy.hasUnsafeAccess = hasUnsafeAccess; copy.setGuardsStage(getGuardsStage()); copy.isAfterFloatingReadPhase = isAfterFloatingReadPhase; copy.hasValueProxies = hasValueProxies; @@ -625,11 +632,22 @@ } public boolean hasUnsafeAccess() { - return hasUnsafeAccess; + return hasUnsafeAccess == UnsafeAccessState.HAS_ACCESS; } public void markUnsafeAccess() { - hasUnsafeAccess = true; + if (hasUnsafeAccess == UnsafeAccessState.DISABLED) { + return; + } + hasUnsafeAccess = UnsafeAccessState.HAS_ACCESS; + } + + public void disableUnsafeAccessTracking() { + hasUnsafeAccess = UnsafeAccessState.DISABLED; + } + + public boolean isUnsafeAccessTrackingEnabled() { + return hasUnsafeAccess != UnsafeAccessState.DISABLED; } public SpeculationLog getSpeculationLog() {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java Tue Jun 23 12:03:39 2015 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java Tue Jun 23 12:32:16 2015 +0200 @@ -122,10 +122,8 @@ /** * This method detects: * <ul> - * <li> - * constants among the arguments to the <code>invoke</code></li> - * <li> - * arguments with more precise type than that declared by the corresponding parameter</li> + * <li>constants among the arguments to the <code>invoke</code></li> + * <li>arguments with more precise type than that declared by the corresponding parameter</li> * </ul> * * <p> @@ -181,7 +179,7 @@ /** * This method builds the IR nodes for the given <code>method</code> and canonicalizes them. * Provided profiling info is mature, the resulting graph is cached. The caller is responsible - * for cloning before modification.</p> + * for cloning before modification. </p> */ private static StructuredGraph parseBytecodes(ResolvedJavaMethod method, HighTierContext context, CanonicalizerPhase canonicalizer, StructuredGraph caller) { StructuredGraph newGraph = new StructuredGraph(method, AllowAssumptions.from(caller.getAssumptions() != null)); @@ -193,6 +191,9 @@ // ok since the graph cache is compilation local. newGraph.disableInlinedMethodRecording(); } + if (!caller.isUnsafeAccessTrackingEnabled()) { + newGraph.disableUnsafeAccessTracking(); + } if (context.getGraphBuilderSuite() != null) { context.getGraphBuilderSuite().apply(newGraph, context); }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Tue Jun 23 12:03:39 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Tue Jun 23 12:32:16 2015 +0200 @@ -558,6 +558,8 @@ // They will also never evolve or have breakpoints set in them graph.disableInlinedMethodRecording(); + // They are not user code so they do not participate in unsafe access tracking + graph.disableUnsafeAccessTracking(); try (Scope s = Debug.scope("buildInitialGraph", graph)) { MetaAccessProvider metaAccess = replacements.providers.getMetaAccess();
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Tue Jun 23 12:03:39 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Tue Jun 23 12:32:16 2015 +0200 @@ -586,6 +586,9 @@ if (!snippetGraph.isInlinedMethodRecordingEnabled()) { snippetCopy.disableInlinedMethodRecording(); } + if (!snippetGraph.isUnsafeAccessTrackingEnabled()) { + snippetCopy.disableUnsafeAccessTracking(); + } Map<Node, Node> nodeReplacements = Node.newIdentityMap(); nodeReplacements.put(snippetGraph.start(), snippetCopy.start()); @@ -678,7 +681,7 @@ exploded = false; ExplodeLoopNode explodeLoop = snippetCopy.getNodes().filter(ExplodeLoopNode.class).first(); if (explodeLoop != null) { // Earlier canonicalization may have removed the loop - // altogether + // altogether LoopBeginNode loopBegin = explodeLoop.findLoopBegin(); if (loopBegin != null) { LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin);