changeset 10629:3c2a77f01e89

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Mon, 08 Jul 2013 09:58:00 +0200
parents 703d00fe2703 (diff) cb2d97f002d4 (current diff)
children add96a4e79f7 08e06d4a9e73
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java
diffstat 3 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Sun Jul 07 21:30:00 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Mon Jul 08 09:58:00 2013 +0200
@@ -40,8 +40,6 @@
 import com.oracle.graal.nodes.spi.Lowerable.LoweringType;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
-import com.oracle.graal.phases.common.InliningUtil.InlineInfo;
-import com.oracle.graal.phases.common.InliningUtil.InliningPolicy;
 import com.oracle.graal.phases.tiers.*;
 
 /**
@@ -206,7 +204,7 @@
             public void run() {
                 StructuredGraph graph = parse(snippet);
                 HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements);
-                new InliningPhase(runtime(), replacements, context.getAssumptions(), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new InlineAllPolicy()).apply(graph);
+                new InliningPhase(runtime(), replacements, context.getAssumptions(), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new InliningPhase.InlineEverythingPolicy()).apply(graph);
                 new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context);
                 new WriteBarrierAdditionPhase().apply(graph);
                 Debug.dump(graph, "After Write Barrier Addition");
@@ -253,17 +251,4 @@
         HotSpotInstalledCode code = getInstalledCode(snippet);
         code.execute(a, b, c);
     }
-
-    final class InlineAllPolicy implements InliningPolicy {
-
-        @Override
-        public boolean continueInlining(StructuredGraph graph) {
-            return true;
-        }
-
-        @Override
-        public boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) {
-            return true;
-        }
-    }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Sun Jul 07 21:30:00 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Mon Jul 08 09:58:00 2013 +0200
@@ -431,7 +431,7 @@
         }
     }
 
-    private static class GreedyInliningPolicy extends AbstractInliningPolicy {
+    private static final class GreedyInliningPolicy extends AbstractInliningPolicy {
 
         public GreedyInliningPolicy(Replacements replacements, Map<Invoke, Double> hints) {
             super(replacements, hints);
@@ -488,6 +488,20 @@
         }
     }
 
+    public static final class InlineEverythingPolicy implements InliningPolicy {
+
+        public boolean continueInlining(StructuredGraph graph) {
+            if (graph.getNodeCount() >= MaximumDesiredSize.getValue()) {
+                throw new BailoutException("Inline all calls failed. The resulting graph is too large.");
+            }
+            return true;
+        }
+
+        public boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) {
+            return true;
+        }
+    }
+
     private static class InliningIterator {
 
         private final FixedNode start;
--- a/src/share/vm/code/nmethod.cpp	Sun Jul 07 21:30:00 2013 +0200
+++ b/src/share/vm/code/nmethod.cpp	Mon Jul 08 09:58:00 2013 +0200
@@ -518,7 +518,7 @@
                                             code_buffer, frame_size,
                                             basic_lock_owner_sp_offset,
                                             basic_lock_sp_offset, oop_maps);
-    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_native_nmethod(nm));
+    if (nm != NULL)  nmethod_stats.note_native_nmethod(nm);
     if (PrintAssembly && nm != NULL) {
       Disassembler::decode(nm);
     }
@@ -554,7 +554,7 @@
     nm = new (nmethod_size) nmethod(method(), nmethod_size,
                                     &offsets, code_buffer, frame_size);
 
-    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
+    if (nm != NULL)  nmethod_stats.note_nmethod(nm);
     if (PrintAssembly && nm != NULL) {
       Disassembler::decode(nm);
     }
@@ -639,7 +639,7 @@
         InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
       }
     }
-    NOT_PRODUCT(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
+    if (nm != NULL)  nmethod_stats.note_nmethod(nm);
     if (PrintAssembly && nm != NULL) {
       Disassembler::decode(nm);
     }