comparison agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java @ 5936:970cbbba54b0

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
author jmelvin
date Fri, 16 Mar 2012 15:13:22 -0400
parents 436b4a3231bf
children a9fed06c01d2
comparison
equal deleted inserted replaced
5935:a735aec54ea4 5936:970cbbba54b0
1 /* 1 /*
2 * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
41 return "bsd"; 41 return "bsd";
42 } else if (os.equals("NetBSD")) { 42 } else if (os.equals("NetBSD")) {
43 return "bsd"; 43 return "bsd";
44 } else if (os.equals("OpenBSD")) { 44 } else if (os.equals("OpenBSD")) {
45 return "bsd"; 45 return "bsd";
46 } else if (os.equals("Darwin") || os.startsWith("Mac OS X")) { 46 } else if (os.equals("Darwin") || os.contains("OS X")) {
47 return "bsd"; 47 return "bsd";
48 } else if (os.startsWith("Windows")) { 48 } else if (os.startsWith("Windows")) {
49 return "win32"; 49 return "win32";
50 } else { 50 } else {
51 throw new UnsupportedPlatformException("Operating system " + os + " not yet supported"); 51 throw new UnsupportedPlatformException("Operating system " + os + " not yet supported");
52 } 52 }
53 } 53 }
54 54
55 /* Returns "sparc" if on SPARC, "x86" if on x86. */ 55 /* Returns "sparc" for SPARC based platforms and "x86" for x86 based
56 platforms. Otherwise returns the value of os.arch. If the value
57 is not recognized as supported, an exception is thrown instead. */
56 public static String getCPU() throws UnsupportedPlatformException { 58 public static String getCPU() throws UnsupportedPlatformException {
57 String cpu = System.getProperty("os.arch"); 59 String cpu = System.getProperty("os.arch");
58 if (cpu.equals("i386")) { 60 if (cpu.equals("i386") || cpu.equals("x86")) {
59 return "x86"; 61 return "x86";
60 } else if (cpu.equals("sparc") || cpu.equals("x86") || cpu.equals("ia64")) { 62 } else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
63 return "sparc";
64 } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
61 return cpu; 65 return cpu;
62 } else if (cpu.equals("sparcv9")) {
63 return "sparc";
64 } else if (cpu.equals("x86_64") || cpu.equals("amd64")) {
65 return "amd64";
66 } else { 66 } else {
67 throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported"); 67 throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
68 } 68 }
69 } 69 }
70 70