Merge
authoriveresov
Sat, 12 Aug 2017 01:21:21 +0000
changeset 46808 76fb4ae9fd2f
parent 46806 22196b3c7dfd (diff)
parent 46807 8b2c620d7092 (current diff)
child 46809 057f21a10f5f
Merge
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/ArrayDuplicationBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/ArrayListBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/BoxingBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/ConcurrentSkipListBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/GuardedIntrinsicBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/HashBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/MathFunctionBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/SimpleSyncBenchmark.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/micro/benchmarks/package-info.java
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java	Fri Aug 11 17:36:26 2017 -0700
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java	Sat Aug 12 01:21:21 2017 +0000
@@ -247,7 +247,7 @@
 
     public static class Options {
         public List<SearchFor> files = new LinkedList<>();
-        public String outputName = "unnamed.so";
+        public String outputName = defaultOutputName();
         public String methodList;
         public List<ClassSource> sources = new ArrayList<>();
         public String linkerpath = null;
@@ -269,6 +269,30 @@
         public boolean version;
         public boolean compileWithAssertions;
         public boolean tiered;
+
+        private static String defaultOutputName() {
+            String osName = System.getProperty("os.name");
+            String name = "unnamed.";
+            String ext;
+
+            switch (osName) {
+                case "Linux":
+                case "SunOS":
+                    ext = "so";
+                    break;
+                case "Mac OS X":
+                    ext = "dylib";
+                    break;
+                default:
+                    if (osName.startsWith("Windows")) {
+                        ext = "dll";
+                    } else {
+                        ext = "so";
+                    }
+            }
+
+            return name + ext;
+        }
     }
 
     /* package */final Options options = new Options();
@@ -529,45 +553,41 @@
             String name = options.outputName;
             String objectFileName = name;
 
-            // [TODO] The jtregs tests expect .so extension so don't
-            // override with platform specific file extension until the
-            // tests are fixed.
             String libraryFileName = name;
 
             String linkerCmd;
             String linkerPath;
             String osName = System.getProperty("os.name");
 
-            if (name.endsWith(".so")) {
-                objectFileName = name.substring(0, name.length() - ".so".length());
-            } else if (name.endsWith(".dylib")) {
-                objectFileName = name.substring(0, name.length() - ".dylib".length());
-            } else if (name.endsWith(".dll")) {
-                objectFileName = name.substring(0, name.length() - ".dll".length());
-            }
-
             switch (osName) {
                 case "Linux":
-                    // libraryFileName = options.outputName + ".so";
-                    objectFileName = objectFileName + ".o";
+                    if (name.endsWith(".so")) {
+                        objectFileName = name.substring(0, name.length() - ".so".length());
+                    }
                     linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
                     linkerCmd = linkerPath + " -shared -z noexecstack -o " + libraryFileName + " " + objectFileName;
                     break;
                 case "SunOS":
-                    // libraryFileName = options.outputName + ".so";
+                    if (name.endsWith(".so")) {
+                        objectFileName = name.substring(0, name.length() - ".so".length());
+                    }
                     objectFileName = objectFileName + ".o";
                     linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
                     linkerCmd = linkerPath + " -shared -o " + libraryFileName + " " + objectFileName;
                     break;
                 case "Mac OS X":
-                    // libraryFileName = options.outputName + ".dylib";
+                    if (name.endsWith(".dylib")) {
+                        objectFileName = name.substring(0, name.length() - ".dylib".length());
+                    }
                     objectFileName = objectFileName + ".o";
                     linkerPath = (options.linkerpath != null) ? options.linkerpath : "ld";
                     linkerCmd = linkerPath + " -dylib -o " + libraryFileName + " " + objectFileName;
                     break;
                 default:
                     if (osName.startsWith("Windows")) {
-                        // libraryFileName = options.outputName + ".dll";
+                        if (name.endsWith(".dll")) {
+                            objectFileName = name.substring(0, name.length() - ".dll".length());
+                        }
                         objectFileName = objectFileName + ".obj";
                         linkerPath = (options.linkerpath != null) ? options.linkerpath : getWindowsLinkPath();
                         if (linkerPath == null) {
@@ -575,8 +595,9 @@
                         }
                         linkerCmd = linkerPath + " /DLL /OPT:NOREF /NOLOGO /NOENTRY" + " /OUT:" + libraryFileName + " " + objectFileName;
                         break;
-                    } else
+                    } else {
                         throw new InternalError("Unsupported platform: " + osName);
+                    }
             }
 
             try (Timer t = new Timer(this, "Creating binary: " + objectFileName)) {
--- a/hotspot/test/compiler/aot/cli/jaotc/JaotcTestHelper.java	Fri Aug 11 17:36:26 2017 -0700
+++ b/hotspot/test/compiler/aot/cli/jaotc/JaotcTestHelper.java	Sat Aug 12 01:21:21 2017 +0000
@@ -26,13 +26,14 @@
 import java.io.File;
 import java.io.IOException;
 import jdk.test.lib.process.ExitCode;
+import jdk.test.lib.Platform;
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.Utils;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class JaotcTestHelper {
-    public static final String DEFAULT_LIB_PATH = "./unnamed.so";
+    public static final String DEFAULT_LIB_PATH = "./unnamed." + Platform.sharedLibraryExt();
     public static final String DEFAULT_LIBRARY_LOAD_MESSAGE = "loaded    " + DEFAULT_LIB_PATH
             + "  aot library";
     private static final String ENABLE_AOT = "-XX:+UseAOT";