# HG changeset patch # User jmelvin # Date 1332474679 14400 # Node ID ad5eb0a72fb1d6d7aa6ec7e9cfd06045aef51728 # Parent b5ab741f2be12031f4adcfc4eb094c7cb44faea7 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 diff -r b5ab741f2be1 -r ad5eb0a72fb1 agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java Thu Mar 22 15:28:53 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java Thu Mar 22 23:51:19 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. diff -r b5ab741f2be1 -r ad5eb0a72fb1 agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Thu Mar 22 15:28:53 2012 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Thu Mar 22 23:51:19 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"); }