changeset 17379:21015ffe0a1e

Merge.
author Doug Simon <doug.simon@oracle.com>
date Thu, 09 Oct 2014 00:23:17 +0200
parents d42e11af980d (diff) b888ded3ee42 (current diff)
children 4b94e5f3d823 538cbc117324
files
diffstat 6 files changed, 36 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Wed Oct 08 11:52:00 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Thu Oct 09 00:23:17 2014 +0200
@@ -138,7 +138,7 @@
         long ctask = 0L;
 
         try (MemoryUsageCloseable c = label == null ? null : new MemoryUsageCloseable(label)) {
-            CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id);
+            CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id, false);
             task.runCompilation();
         }
     }
@@ -154,7 +154,7 @@
             int id = method.allocateCompileId(INVOCATION_ENTRY_BCI);
             long ctask = 0L;
             try (AllocSpy as = AllocSpy.open(methodName)) {
-                CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id);
+                CompilationTask task = new CompilationTask(backend, method, INVOCATION_ENTRY_BCI, ctask, id, false);
                 task.runCompilation();
             }
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Wed Oct 08 11:52:00 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Oct 09 00:23:17 2014 +0200
@@ -79,6 +79,12 @@
     private final int entryBCI;
     private final int id;
 
+    /**
+     * Specifies whether the compilation result is installed as the
+     * {@linkplain HotSpotNmethod#isDefault() default} nmethod for the compiled method.
+     */
+    private final boolean installAsDefault;
+
     private StructuredGraph graph;
 
     /**
@@ -93,12 +99,13 @@
      */
     private final long ctask;
 
-    public CompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method, int entryBCI, long ctask, int id) {
+    public CompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method, int entryBCI, long ctask, int id, boolean installAsDefault) {
         this.backend = backend;
         this.method = method;
         this.entryBCI = entryBCI;
         this.id = id;
         this.ctask = ctask;
+        this.installAsDefault = installAsDefault;
     }
 
     public ResolvedJavaMethod getMethod() {
@@ -315,7 +322,7 @@
         final HotSpotCodeCacheProvider codeCache = backend.getProviders().getCodeCache();
         InstalledCode installedCode = null;
         try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(id), true), codeCache, method)) {
-            installedCode = codeCache.installMethod(method, compResult, ctask);
+            installedCode = codeCache.installMethod(method, compResult, ctask, installAsDefault);
         } catch (Throwable e) {
             throw Debug.handle(e);
         }
@@ -357,7 +364,7 @@
      */
     static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long ctask, int id) {
         HotSpotBackend backend = runtime().getHostBackend();
-        CompilationTask task = new CompilationTask(backend, method, entryBCI, ctask, id);
+        CompilationTask task = new CompilationTask(backend, method, entryBCI, ctask, id, true);
         task.runCompilation();
         return;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Wed Oct 08 11:52:00 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Thu Oct 09 00:23:17 2014 +0200
@@ -320,7 +320,7 @@
     class CTWCompilationTask extends CompilationTask {
 
         CTWCompilationTask(HotSpotBackend backend, HotSpotResolvedJavaMethod method) {
-            super(backend, method, INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(INVOCATION_ENTRY_BCI));
+            super(backend, method, INVOCATION_ENTRY_BCI, 0L, method.allocateCompileId(INVOCATION_ENTRY_BCI), false);
         }
 
         /**
@@ -348,7 +348,6 @@
             memoryUsed += getCurrentThreadAllocatedBytes() - allocatedAtStart;
             compileTime += (System.currentTimeMillis() - start);
             compiledMethodsCounter++;
-            method.reprofile();  // makes the method also not-entrant
         } catch (Throwable t) {
             // Catch everything and print a message
             println("CompileTheWorld (%d) : Error compiling method: %s", classFileCounter, method.format("%H.%n(%p):%r"));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Wed Oct 08 11:52:00 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Thu Oct 09 00:23:17 2014 +0200
@@ -206,11 +206,11 @@
         return installedCode;
     }
 
-    public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long ctask) {
+    public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long ctask, boolean isDefault) {
         if (compResult.getId() == -1) {
             compResult.setId(method.allocateCompileId(compResult.getEntryBCI()));
         }
-        HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), true);
+        HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
         runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(target, method, compResult, ctask), installedCode, method.getSpeculationLog());
         return logOrDump(installedCode, compResult);
     }
@@ -236,7 +236,7 @@
     @Override
     public InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult) {
         HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
-        return installMethod(hotspotMethod, compResult, 0L);
+        return installMethod(hotspotMethod, compResult, 0L, true);
     }
 
     public HotSpotNmethod addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) {
--- a/mx/mx_graal.py	Wed Oct 08 11:52:00 2014 -0700
+++ b/mx/mx_graal.py	Thu Oct 09 00:23:17 2014 +0200
@@ -1358,38 +1358,26 @@
 
 def ctw(args):
     """run CompileTheWorld"""
-    from sanitycheck import CTWMode
-    modes = {
-             'noinline' : CTWMode.NoInline,
-             'nocomplex' : CTWMode.NoComplex,
-             'full' : CTWMode.Full
-             }
-    mode = sanitycheck.CTWMode.NoInline
-    vmargs = []
-    for a in args:
-        m = modes.get(a, None)
-        if m:
-            mode = m
-        else:
-            vmargs.append(a)
+
+    parser = ArgumentParser(prog='mx ctw')
+    parser.add_argument('--ctwopts', action='store', help='space separated Graal options (without the -G: prefix) used for CTW compilations')
+    parser.add_argument('--jar', action='store', help='jar of classes to compiled instead of rt.jar')
+    parser.add_argument('vmargs', nargs=REMAINDER, metavar='VM options...')
+
+    args, vmargs = parser.parse_known_args(args)
 
-    jdk = _jdk(installJars=False)
-    rtjar = join(jdk, 'jre', 'lib', 'rt.jar')
-
-    vm_ = _get_vm()
+    if args.ctwopts:
+        vmargs.append('-G:CompileTheWorldConfig=' + args.ctwopts)
 
-    args = vmargs + ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + rtjar]
-    if vm_ == 'graal':
-        args += ['-XX:+BootstrapGraal']
-    if mode >= CTWMode.NoInline:
-        if not isGraalEnabled(vm_):
-            args.append('-XX:-Inline')
-        else:
-            args.append('-G:-Inline')
-    if mode >= CTWMode.NoComplex:
-        if isGraalEnabled(vm_):
-            args += ['-G:-OptLoopTransform', '-G:-OptTailDuplication', '-G:-FullUnroll', '-G:-MemoryAwareScheduling', '-G:-NewMemoryAwareScheduling', '-G:-PartialEscapeAnalysis']
-    vm(args)
+    if args.jar:
+        jar = args.jar
+    else:
+        jar = join(_jdk(installJars=False), 'jre', 'lib', 'rt.jar')
+
+    vmargs += ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + jar]
+    if _get_vm() == 'graal':
+        vmargs += ['-XX:+BootstrapGraal']
+    vm(vmargs)
 
 def _basic_gate_body(args, tasks):
     t = Task('BuildHotSpotGraal: fastdebug,product')
@@ -1748,8 +1736,6 @@
         benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full))
     if 'ctw-noinline' in args:
         benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline))
-    if 'ctw-nocomplex' in args:
-        benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoComplex))
 
     for test in benchmarks:
         for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items():
--- a/mx/sanitycheck.py	Wed Oct 08 11:52:00 2014 -0700
+++ b/mx/sanitycheck.py	Thu Oct 09 00:23:17 2014 +0200
@@ -264,7 +264,7 @@
     return tests
 
 class CTWMode:
-    Full, NoInline, NoComplex = range(3)
+    Full, NoInline = range(2)
 
 def getCTW(vm, mode):
     time = re.compile(r"CompileTheWorld : Done \([0-9]+ classes, [0-9]+ methods, (?P<time>[0-9]+) ms\)")
@@ -283,10 +283,7 @@
         if not mx_graal.isGraalEnabled(vm):
             args.append('-XX:-Inline')
         else:
-            args.append('-G:-Inline')
-    if mode >= CTWMode.NoComplex:
-        if mx_graal.isGraalEnabled(vm):
-            args += ['-G:-OptLoopTransform', '-G:-OptTailDuplication', '-G:-FullUnroll', '-G:-MemoryAwareScheduling', '-G:-NewMemoryAwareScheduling', '-G:-PartialEscapeAnalysis']
+            args.append('-G:CompileTheWordConfig=-Inline')
 
     return Test("CompileTheWorld", args, successREs=[time], scoreMatchers=[scoreMatcher], benchmarkCompilationRate=False)