7130404: [macosx] "os.arch" value should be "x86_64" for compatibility with Apple JDK6
authorjmelvin
Fri, 16 Mar 2012 15:13:22 -0400
changeset 12115 2419c3f9a119
parent 12114 9a825a536095
child 12119 3d871accf6ac
7130404: [macosx] "os.arch" value should be "x86_64" for compatibility with Apple JDK6 Summary: On Mac OS X, align system property "os.arch" with Apple legacy JDKs. Also, improve os.name string matching by using contains() method instead of .startsWith(). Reviewed-by: dcubed, phh, ohair, katleman Contributed-by: james.melvin@oracle.com
hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	Wed Mar 14 20:06:48 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	Fri Mar 16 15:13:22 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -217,8 +217,8 @@
     }
 
     protected void checkNativeLink(SecurityManager sm, String os) {
-        if (os.equals("SunOS") || os.equals("Linux")) {
-            // link "saproc" - SA native library on SunOS and Linux?
+        if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) {
+            // link "saproc" - SA native library on SunOS, Linux, and Mac OS X
             sm.checkLink("saproc");
         } else if (os.startsWith("Windows")) {
             // link "sawindbg" - SA native library on Windows.
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java	Wed Mar 14 20:06:48 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java	Fri Mar 16 15:13:22 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
       return "bsd";
     } else if (os.equals("OpenBSD")) {
       return "bsd";
-    } else if (os.equals("Darwin") || os.startsWith("Mac OS X")) {
+    } else if (os.equals("Darwin") || os.contains("OS X")) {
       return "bsd";
     } else if (os.startsWith("Windows")) {
       return "win32";
@@ -52,17 +52,17 @@
     }
   }
 
-  /* Returns "sparc" if on SPARC, "x86" if on x86. */
+  /* Returns "sparc" for SPARC based platforms and "x86" for x86 based
+     platforms. Otherwise returns the value of os.arch.  If the value
+     is not recognized as supported, an exception is thrown instead. */
   public static String getCPU() throws UnsupportedPlatformException {
     String cpu = System.getProperty("os.arch");
-    if (cpu.equals("i386")) {
+    if (cpu.equals("i386") || cpu.equals("x86")) {
       return "x86";
-    } else if (cpu.equals("sparc") || cpu.equals("x86") || cpu.equals("ia64")) {
+    } else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
+      return "sparc";
+    } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
       return cpu;
-    } else if (cpu.equals("sparcv9")) {
-      return "sparc";
-    } else if (cpu.equals("x86_64") || cpu.equals("amd64")) {
-      return "amd64";
     } else {
       throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
     }