changeset 20971:018c536858cc

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 15 Apr 2015 10:21:02 -0700
parents a560c9b81f0f (current diff) d3b276db28b8 (diff)
children 23d6b95bd687 319fbbdb8fb1
files
diffstat 15 files changed, 90 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Wed Apr 15 10:21:02 2015 -0700
@@ -1790,4 +1790,8 @@
     public void fpadd32(Register rs1, Register rs2, Register rd) {
         op3(Impdep1, Fpadd32, rs1, rs2, rd);
     }
+
+    public boolean isCbcond(int i) {
+        return (i & 0xC1C00000) == 0xC00000;
+    }
 }
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java	Wed Apr 15 10:21:02 2015 -0700
@@ -87,7 +87,7 @@
             case Bpr:
                 boolean isCBcond = (inst & CBCOND_MASK) != 0;
                 if (isCBcond) {
-                    assert isSimm10(disp);
+                    assert isSimm10(disp) : String.format("%d: instruction: 0x%x", disp, inst);
                     int d10Split = 0;
                     d10Split |= (disp & 0b11_0000_0000) << D10HI_SHIFT - 8;
                     d10Split |= (disp & 0b00_1111_1111) << D10LO_SHIFT;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Wed Apr 15 10:21:02 2015 -0700
@@ -40,7 +40,7 @@
         boolean originalSetting = ExitVMOnException.getValue();
         // Compile a couple classes in rt.jar
         String file = System.getProperty("java.home") + "/lib/rt.jar";
-        new CompileTheWorld(file, new Config(null), 1, 5, null, false).compile();
+        new CompileTheWorld(file, new Config(null), 1, 5, null, null, false).compile();
         ExitVMOnException.setValue(originalSetting);
     }
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Wed Apr 15 10:21:02 2015 -0700
@@ -180,7 +180,7 @@
         compileAndTime("complex");
         if (CompileTheWorldClasspath.getValue() != SUN_BOOT_CLASS_PATH) {
             CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
-                            CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
+                            CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldExcludeMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
             try {
                 ctw.compile();
             } catch (Throwable e) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Wed Apr 15 10:21:02 2015 -0700
@@ -70,6 +70,8 @@
         public static final OptionValue<Integer> CompileTheWorldIterations = new OptionValue<>(1);
         @Option(help = "Only compile methods matching this filter", type = OptionType.Debug)
         public static final OptionValue<String> CompileTheWorldMethodFilter = new OptionValue<>(null);
+        @Option(help = "Exclude methods matching this filter from compilation", type = OptionType.Debug)
+        public static final OptionValue<String> CompileTheWorldExcludeMethodFilter = new OptionValue<>(null);
         @Option(help = "First class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
         public static final OptionValue<Integer> CompileTheWorldStartAt = new OptionValue<>(1);
         @Option(help = "Last class to consider when using -XX:+CompileTheWorld", type = OptionType.Debug)
@@ -158,6 +160,9 @@
     /** Only compile methods matching one of the filters in this array if the array is non-null. */
     private final MethodFilter[] methodFilters;
 
+    /** Exclude methods matching one of the filters in this array if the array is non-null. */
+    private final MethodFilter[] excludeMethodFilters;
+
     // Counters
     private int classFileCounter = 0;
     private AtomicLong compiledMethodsCounter = new AtomicLong();
@@ -180,12 +185,15 @@
      * @param files {@link File#pathSeparator} separated list of Zip/Jar files to compile
      * @param startAt index of the class file to start compilation at
      * @param stopAt index of the class file to stop compilation at
+     * @param methodFilters
+     * @param excludeMethodFilters
      */
-    public CompileTheWorld(String files, Config config, int startAt, int stopAt, String methodFilters, boolean verbose) {
+    public CompileTheWorld(String files, Config config, int startAt, int stopAt, String methodFilters, String excludeMethodFilters, boolean verbose) {
         this.files = files;
         this.startAt = startAt;
         this.stopAt = stopAt;
         this.methodFilters = methodFilters == null || methodFilters.isEmpty() ? null : MethodFilter.parse(methodFilters);
+        this.excludeMethodFilters = excludeMethodFilters == null || excludeMethodFilters.isEmpty() ? null : MethodFilter.parse(excludeMethodFilters);
         this.verbose = verbose;
         this.config = config;
 
@@ -292,8 +300,12 @@
                 if (methodFilters == null || methodFilters.length == 0) {
                     println("CompileTheWorld : Compiling all classes in " + entry);
                 } else {
-                    println("CompileTheWorld : Compiling all methods in " + entry + " matching one of the following filters: " +
-                                    Arrays.asList(methodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", ")));
+                    String include = Arrays.asList(methodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
+                    println("CompileTheWorld : Compiling all methods in " + entry + " matching one of the following filters: " + include);
+                }
+                if (excludeMethodFilters != null && excludeMethodFilters.length > 0) {
+                    String exclude = Arrays.asList(excludeMethodFilters).stream().map(MethodFilter::toString).collect(Collectors.joining(", "));
+                    println("CompileTheWorld : Excluding all methods matching one of the follwing filters: " + exclude);
                 }
                 println();
 
@@ -321,6 +333,9 @@
                     if (methodFilters != null && !MethodFilter.matchesClassName(methodFilters, dottedClassName)) {
                         continue;
                     }
+                    if (excludeMethodFilters != null && MethodFilter.matchesClassName(excludeMethodFilters, dottedClassName)) {
+                        continue;
+                    }
 
                     if (dottedClassName.startsWith("jdk.management.") || dottedClassName.startsWith("jdk.internal.cmm.*")) {
                         continue;
@@ -427,6 +442,9 @@
         if (methodFilters != null && !MethodFilter.matches(methodFilters, method)) {
             return;
         }
+        if (excludeMethodFilters != null && MethodFilter.matches(excludeMethodFilters, method)) {
+            return;
+        }
         Future<?> task = threadPool.submit(new Runnable() {
             public void run() {
                 waitToRun();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Wed Apr 15 10:21:02 2015 -0700
@@ -552,7 +552,7 @@
             getCompilerToVM().resetCompilationStatistics();
             TTY.println("CompileTheWorld : iteration " + i);
             CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
-                            CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
+                            CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldExcludeMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
             ctw.compile();
         }
         System.exit(0);
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java	Wed Apr 15 10:21:02 2015 -0700
@@ -225,8 +225,12 @@
                     SPARCMove.move(crb, masm, scratchValue, actualY, SPARCDelayedControlTransfer.DUMMY);
                     actualY = scratchValue;
                 }
+                // Test if the previous instruction was cbcond, if so, put a nop inbetween (See
+                // SPARC Architecture 2011 manual)
+                if (masm.isCbcond(masm.getInt(masm.position() - 1))) {
+                    masm.nop();
+                }
                 emitCBCond(masm, actualX, actualY, actualTrueTarget, actualConditionFlag);
-                masm.nop();
             }
             if (needJump) {
                 masm.jmp(actualFalseTarget);
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java	Wed Apr 15 10:21:02 2015 -0700
@@ -1683,12 +1683,7 @@
             if (var == null) {
                 TypeMirror targetType;
                 if (specialization == null) {
-                    List<TypeMirror> genericTypes = node.getGenericTypes(execution);
-                    if (genericTypes.isEmpty()) {
-                        targetType = genericType;
-                    } else {
-                        targetType = genericTypes.get(0);
-                    }
+                    targetType = node.getGenericType(execution);
                 } else {
                     targetType = specialization.findParameterOrDie(execution).getType();
                 }
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java	Wed Apr 15 10:21:02 2015 -0700
@@ -168,6 +168,8 @@
         if (element1 == null || element2 == null) {
             if (element1 != null) {
                 return type1;
+            } else if (element2 != null) {
+                return type2;
             }
             return context.getType(Object.class);
         }
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/ExecutableTypeData.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/ExecutableTypeData.java	Wed Apr 15 10:21:02 2015 -0700
@@ -192,9 +192,7 @@
         for (int i = from.getEvaluatedCount(); i < to.getEvaluatedCount(); i++) {
             TypeMirror delegateToParameter = to.getEvaluatedParameters().get(i);
             if (i < node.getChildExecutions().size()) {
-                List<TypeMirror> genericTypes = node.getGenericTypes(node.getChildExecutions().get(i));
-
-                TypeMirror genericType = ElementUtils.getCommonSuperType(context, genericTypes);
+                TypeMirror genericType = node.getGenericType(node.getChildExecutions().get(i));
                 if (!isSubtypeBoxed(context, genericType, delegateToParameter)) {
                     return false;
                 }
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeData.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeData.java	Wed Apr 15 10:21:02 2015 -0700
@@ -554,6 +554,10 @@
         return getNodeId().compareTo(o.getNodeId());
     }
 
+    public TypeMirror getGenericType(NodeExecutionData execution) {
+        return ElementUtils.getCommonSuperType(getContext(), getGenericTypes(execution));
+    }
+
     public List<TypeMirror> getGenericTypes(NodeExecutionData execution) {
         List<TypeMirror> types = new ArrayList<>();
 
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeMethodParser.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeMethodParser.java	Wed Apr 15 10:21:02 2015 -0700
@@ -58,12 +58,7 @@
     }
 
     protected Collection<TypeMirror> getPossibleReturnTypes() {
-        List<TypeMirror> possibleTypes = getNode().getGenericTypes(getNode().getThisExecution());
-        if (possibleTypes.size() > 1) {
-            return Arrays.asList(ElementUtils.getCommonSuperType(getContext(), possibleTypes));
-        } else {
-            return possibleTypes;
-        }
+        return Arrays.asList(getNode().getGenericType(getNode().getThisExecution()));
     }
 
     @Override
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java	Tue Apr 14 22:20:07 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java	Wed Apr 15 10:21:02 2015 -0700
@@ -1288,7 +1288,7 @@
         if (execution == null) {
             allowedTypes = spec.getAllowedTypes();
         } else {
-            allowedTypes = node.getGenericTypes(execution);
+            allowedTypes = Arrays.asList(node.getGenericType(execution));
         }
         if (allowedTypes.size() == 1) {
             return allowedTypes.iterator().next();
--- a/mx/mx_graal.py	Tue Apr 14 22:20:07 2015 -0700
+++ b/mx/mx_graal.py	Wed Apr 15 10:21:02 2015 -0700
@@ -1482,6 +1482,7 @@
         jar = os.path.abspath(args.jar)
     else:
         jar = join(_jdk(installJars=False), 'jre', 'lib', 'rt.jar')
+        vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*')
 
     vmargs += ['-XX:+CompileTheWorld']
     vm_ = _get_vm()
@@ -1492,7 +1493,7 @@
     else:
         vmargs += ['-Xbootclasspath/p:' + jar]
 
-    # suppress menubar and dock when running on Mac
+    # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris)
     vmargs = ['-Djava.awt.headless=true'] + vmargs
 
     vm(vmargs)
--- a/mxtool/mx.py	Tue Apr 14 22:20:07 2015 -0700
+++ b/mxtool/mx.py	Wed Apr 15 10:21:02 2015 -0700
@@ -2097,7 +2097,9 @@
         return cmp(self.parts, other.parts)
 
 def _filter_non_existant_paths(paths):
-    return os.pathsep.join([path for path in _separatedCygpathW2U(paths).split(os.pathsep) if exists(path)])
+    if paths:
+        return os.pathsep.join([path for path in _separatedCygpathW2U(paths).split(os.pathsep) if exists(path)])
+    return None
 
 """
 A JavaConfig object encapsulates info on how Java commands are run.
@@ -2161,11 +2163,14 @@
         if not exists(outDir):
             os.makedirs(outDir)
         javaSource = join(myDir, 'ClasspathDump.java')
-        if not exists(join(outDir, 'ClasspathDump.class')):
+        javaClass = join(outDir, 'ClasspathDump.class')
+        if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource):
             subprocess.check_call([self.javac, '-d', _cygpathU2W(outDir), _cygpathU2W(javaSource)], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
         self._bootclasspath, self._extdirs, self._endorseddirs = [x if x != 'null' else None for x in subprocess.check_output([self.java, '-cp', _cygpathU2W(outDir), 'ClasspathDump'], stderr=subprocess.PIPE).split('|')]
-        if not self._bootclasspath or not self._extdirs or not self._endorseddirs:
-            warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'")
+        if self.javaCompliance <= JavaCompliance('1.8'):
+            # All 3 system properties accessed by ClasspathDump are expected to exist
+            if not self._bootclasspath or not self._extdirs or not self._endorseddirs:
+                warn("Could not find all classpaths: boot='" + str(self._bootclasspath) + "' extdirs='" + str(self._extdirs) + "' endorseddirs='" + str(self._endorseddirs) + "'")
         self._bootclasspath = _filter_non_existant_paths(self._bootclasspath)
         self._extdirs = _filter_non_existant_paths(self._extdirs)
         self._endorseddirs = _filter_non_existant_paths(self._endorseddirs)
@@ -2214,6 +2219,33 @@
             self._init_classpaths()
         return _separatedCygpathU2W(self._endorseddirs)
 
+    """
+    Add javadoc style options for the library paths of this JDK.
+    """
+    def javadocLibOptions(self, args):
+        if args is None:
+            args = []
+        if self.bootclasspath():
+            args.append('-bootclasspath')
+            args.append(self.bootclasspath())
+        if self.endorseddirs():
+            args.append('-endorseddirs')
+            args.append(self.endorseddirs())
+        if self.extdirs():
+            args.append('-extdirs')
+            args.append(self.extdirs())
+        return args
+
+    """
+    Add javac style options for the library paths of this JDK.
+    """
+    def javacLibOptions(self, args):
+        args = self.javadocLibOptions(args)
+        if self.endorseddirs():
+            args.append('-endorseddirs')
+            args.append(self.endorseddirs())
+        return args
+
     def containsJar(self, jar):
         if self._bootclasspath is None:
             self._init_classpaths()
@@ -2447,7 +2479,8 @@
                 if not args.error_prone:
                     javac = args.alt_javac if args.alt_javac else mainJava.javac
                     self.logCompilation('javac' if not args.alt_javac else args.alt_javac)
-                    javacCmd = [javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir, '-bootclasspath', jdk.bootclasspath(), '-endorseddirs', jdk.endorseddirs(), '-extdirs', jdk.extdirs()]
+                    javacCmd = [javac, '-g', '-J-Xmx1g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir]
+                    jdk.javacLibOptions(javacCmd)
                     if jdk.debug_port is not None:
                         javacCmd += ['-J-Xdebug', '-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(jdk.debug_port)]
                     javacCmd += processorArgs
@@ -2459,7 +2492,8 @@
                 else:
                     self.logCompilation('javac (with error-prone)')
                     javaArgs = ['-Xmx1g']
-                    javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir, '-bootclasspath', jdk.bootclasspath(), '-endorseddirs', jdk.endorseddirs(), '-extdirs', jdk.extdirs()]
+                    javacArgs = ['-g', '-source', compliance, '-target', compliance, '-classpath', cp, '-d', outputDir]
+                    jdk.javacLibOptions(javacCmd)
                     javacArgs += processorArgs
                     javacArgs += ['@' + argfile.name]
                     if not args.warnAPI:
@@ -2472,10 +2506,8 @@
 
                 jdtArgs = ['-' + compliance,
                          '-cp', cp, '-g', '-enableJavadoc',
-                         '-d', outputDir,
-                         '-bootclasspath', jdk.bootclasspath(),
-                         '-endorseddirs', jdk.endorseddirs(),
-                         '-extdirs', jdk.extdirs()]
+                         '-d', outputDir]
+                jdk.javacLibOptions(jdtArgs)
                 jdtArgs += processorArgs
 
                 jdtProperties = join(self.proj.dir, '.settings', 'org.eclipse.jdt.core.prefs')
@@ -4840,9 +4872,8 @@
                      '-d', out,
                      '-overview', overviewFile,
                      '-sourcepath', sp,
-                     '-source', str(projectJava.javaCompliance),
-                     '-bootclasspath', projectJava.bootclasspath(),
-                     '-extdirs', projectJava.extdirs()] +
+                     '-source', str(projectJava.javaCompliance)] +
+                     projectJava.javadocLibOptions() +
                      ([] if projectJava.javaCompliance < JavaCompliance('1.8') else ['-Xdoclint:none']) +
                      links +
                      extraArgs +