changeset 23098:a7801d761e17

Add flat to repeat Truffle compilations for compile time stress testing
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 26 Nov 2015 22:23:37 -0800
parents acd3ba0ddffa
children 1705cb8e3dfe
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Thu Nov 26 22:22:48 2015 -0800
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Thu Nov 26 22:23:37 2015 -0800
@@ -340,8 +340,23 @@
         getCompilationNotify().notifyShutdown(this);
     }
 
+    protected void doCompile(OptimizedCallTarget optimizedCallTarget) {
+        int repeats = TruffleCompilerOptions.TruffleCompilationRepeats.getValue();
+        if (repeats <= 1) {
+            /* Normal compilation. */
+            doCompile0(optimizedCallTarget);
+
+        } else {
+            /* Repeated compilation for compilation time benchmarking. */
+            for (int i = 0; i < repeats; i++) {
+                doCompile0(optimizedCallTarget);
+            }
+            System.exit(0);
+        }
+    }
+
     @SuppressWarnings("try")
-    protected void doCompile(OptimizedCallTarget optimizedCallTarget) {
+    private void doCompile0(OptimizedCallTarget optimizedCallTarget) {
         boolean success = true;
         try (Scope s = Debug.scope("Truffle", new TruffleDebugJavaMethod(optimizedCallTarget))) {
             truffleCompiler.compileMethod(optimizedCallTarget);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Thu Nov 26 22:22:48 2015 -0800
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Thu Nov 26 22:23:37 2015 -0800
@@ -126,6 +126,9 @@
     @Option(help = "Print information for compilation results", type = OptionType.Debug)
     public static final OptionValue<Boolean> TraceTruffleCompilation = new OptionValue<>(false);
 
+    @Option(help = "Compile time benchmarking: repeat Truffle compilation n times and then exit the VM", type = OptionType.Debug)
+    public static final OptionValue<Integer> TruffleCompilationRepeats = new OptionValue<>(0);
+
     @Option(help = "Print information for compilation queuing", type = OptionType.Debug)
     public static final OptionValue<Boolean> TraceTruffleCompilationDetails = new OptionValue<>(false);