Wed, 22 Feb 2012 08:19:27 -0800
Merge
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Feb 17 15:11:32 2012 -0800 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Wed Feb 22 08:19:27 2012 -0800 1.3 @@ -648,7 +648,12 @@ 1.4 } 1.5 1.6 public void printValueOn(PrintStream tty) { 1.7 - tty.print("ConstantPool for " + getPoolHolder().getName().asString()); 1.8 + Oop holder = poolHolder.getValue(this); 1.9 + if (holder instanceof Klass) { 1.10 + tty.print("ConstantPool for " + ((Klass)holder).getName().asString()); 1.11 + } else { 1.12 + tty.print("ConstantPool for partially loaded class"); 1.13 + } 1.14 } 1.15 1.16 public long getObjectSize() {
2.1 --- a/src/cpu/x86/vm/vm_version_x86.cpp Fri Feb 17 15:11:32 2012 -0800 2.2 +++ b/src/cpu/x86/vm/vm_version_x86.cpp Wed Feb 22 08:19:27 2012 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -65,8 +65,8 @@ 2.11 2.12 address generate_getPsrInfo() { 2.13 // Flags to test CPU type. 2.14 - const uint32_t EFL_AC = 0x40000; 2.15 - const uint32_t EFL_ID = 0x200000; 2.16 + const uint32_t HS_EFL_AC = 0x40000; 2.17 + const uint32_t HS_EFL_ID = 0x200000; 2.18 // Values for when we don't have a CPUID instruction. 2.19 const int CPU_FAMILY_SHIFT = 8; 2.20 const uint32_t CPU_FAMILY_386 = (3 << CPU_FAMILY_SHIFT); 2.21 @@ -100,7 +100,7 @@ 2.22 // 2.23 // if we are unable to change the AC flag, we have a 386 2.24 // 2.25 - __ xorl(rax, EFL_AC); 2.26 + __ xorl(rax, HS_EFL_AC); 2.27 __ push(rax); 2.28 __ popf(); 2.29 __ pushf(); 2.30 @@ -118,7 +118,7 @@ 2.31 // 2.32 __ bind(detect_486); 2.33 __ mov(rax, rcx); 2.34 - __ xorl(rax, EFL_ID); 2.35 + __ xorl(rax, HS_EFL_ID); 2.36 __ push(rax); 2.37 __ popf(); 2.38 __ pushf();
3.1 --- a/src/os/bsd/vm/osThread_bsd.cpp Fri Feb 17 15:11:32 2012 -0800 3.2 +++ b/src/os/bsd/vm/osThread_bsd.cpp Wed Feb 22 08:19:27 2012 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -49,7 +49,11 @@ 3.11 3.12 void OSThread::pd_initialize() { 3.13 assert(this != NULL, "check"); 3.14 +#ifdef __APPLE__ 3.15 + _thread_id = 0; 3.16 +#else 3.17 _thread_id = NULL; 3.18 +#endif 3.19 _pthread_id = NULL; 3.20 _siginfo = NULL; 3.21 _ucontext = NULL;
4.1 --- a/src/os/bsd/vm/osThread_bsd.hpp Fri Feb 17 15:11:32 2012 -0800 4.2 +++ b/src/os/bsd/vm/osThread_bsd.hpp Wed Feb 22 08:19:27 2012 -0800 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -40,10 +40,17 @@ 4.11 private: 4.12 4.13 #ifdef _ALLBSD_SOURCE 4.14 - // _thread_id and _pthread_id are the same on BSD 4.15 - // keep both to minimize code divergence in os_bsd.cpp 4.16 + 4.17 +#ifdef __APPLE__ 4.18 + thread_t _thread_id; 4.19 +#else 4.20 pthread_t _thread_id; 4.21 +#endif 4.22 + 4.23 + // _pthread_id is the pthread id, which is used by library calls 4.24 + // (e.g. pthread_kill). 4.25 pthread_t _pthread_id; 4.26 + 4.27 #else 4.28 // _thread_id is kernel thread id (similar to LWP id on Solaris). Each 4.29 // thread has a unique thread_id (BsdThreads or NPTL). It can be used 4.30 @@ -64,9 +71,15 @@ 4.31 void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; } 4.32 4.33 #ifdef _ALLBSD_SOURCE 4.34 +#ifdef __APPLE__ 4.35 + thread_t thread_id() const { 4.36 + return _thread_id; 4.37 + } 4.38 +#else 4.39 pthread_t thread_id() const { 4.40 return _thread_id; 4.41 } 4.42 +#endif 4.43 #else 4.44 pid_t thread_id() const { 4.45 return _thread_id; 4.46 @@ -84,9 +97,15 @@ 4.47 } 4.48 #endif // ASSERT 4.49 #ifdef _ALLBSD_SOURCE 4.50 +#ifdef __APPLE__ 4.51 + void set_thread_id(thread_t id) { 4.52 + _thread_id = id; 4.53 + } 4.54 +#else 4.55 void set_thread_id(pthread_t id) { 4.56 _thread_id = id; 4.57 } 4.58 +#endif 4.59 #else 4.60 void set_thread_id(pid_t id) { 4.61 _thread_id = id;
5.1 --- a/src/os/bsd/vm/os_bsd.cpp Fri Feb 17 15:11:32 2012 -0800 5.2 +++ b/src/os/bsd/vm/os_bsd.cpp Wed Feb 22 08:19:27 2012 -0800 5.3 @@ -568,6 +568,25 @@ 5.4 sprintf(ld_library_path, "%s:%s", v, t); 5.5 free(t); 5.6 } 5.7 + 5.8 +#ifdef __APPLE__ 5.9 + // Apple's Java6 has "." at the beginning of java.library.path. 5.10 + // OpenJDK on Windows has "." at the end of java.library.path. 5.11 + // OpenJDK on Linux and Solaris don't have "." in java.library.path 5.12 + // at all. To ease the transition from Apple's Java6 to OpenJDK7, 5.13 + // "." is appended to the end of java.library.path. Yes, this 5.14 + // could cause a change in behavior, but Apple's Java6 behavior 5.15 + // can be achieved by putting "." at the beginning of the 5.16 + // JAVA_LIBRARY_PATH environment variable. 5.17 + { 5.18 + char *t = ld_library_path; 5.19 + // that's +3 for appending ":." and the trailing '\0' 5.20 + ld_library_path = (char *) malloc(strlen(t) + 3); 5.21 + sprintf(ld_library_path, "%s:%s", t, "."); 5.22 + free(t); 5.23 + } 5.24 +#endif 5.25 + 5.26 Arguments::set_library_path(ld_library_path); 5.27 } 5.28 5.29 @@ -979,8 +998,13 @@ 5.30 } 5.31 5.32 #ifdef _ALLBSD_SOURCE 5.33 +#ifdef __APPLE__ 5.34 + // thread_id is mach thread on macos 5.35 + osthread->set_thread_id(::mach_thread_self()); 5.36 +#else 5.37 // thread_id is pthread_id on BSD 5.38 osthread->set_thread_id(::pthread_self()); 5.39 +#endif 5.40 #else 5.41 // thread_id is kernel thread id (similar to Solaris LWP id) 5.42 osthread->set_thread_id(os::Bsd::gettid()); 5.43 @@ -1171,7 +1195,11 @@ 5.44 5.45 // Store pthread info into the OSThread 5.46 #ifdef _ALLBSD_SOURCE 5.47 +#ifdef __APPLE__ 5.48 + osthread->set_thread_id(::mach_thread_self()); 5.49 +#else 5.50 osthread->set_thread_id(::pthread_self()); 5.51 +#endif 5.52 #else 5.53 osthread->set_thread_id(os::Bsd::gettid()); 5.54 #endif 5.55 @@ -1788,7 +1816,13 @@ 5.56 return n; 5.57 } 5.58 5.59 -intx os::current_thread_id() { return (intx)pthread_self(); } 5.60 +intx os::current_thread_id() { 5.61 +#ifdef __APPLE__ 5.62 + return (intx)::mach_thread_self(); 5.63 +#else 5.64 + return (intx)::pthread_self(); 5.65 +#endif 5.66 +} 5.67 int os::current_process_id() { 5.68 5.69 // Under the old bsd thread library, bsd gives each thread 5.70 @@ -5133,9 +5167,9 @@ 5.71 struct thread_basic_info tinfo; 5.72 mach_msg_type_number_t tcount = THREAD_INFO_MAX; 5.73 kern_return_t kr; 5.74 - mach_port_t mach_thread; 5.75 - 5.76 - mach_thread = pthread_mach_thread_np(thread->osthread()->thread_id()); 5.77 + thread_t mach_thread; 5.78 + 5.79 + mach_thread = thread->osthread()->thread_id(); 5.80 kr = thread_info(mach_thread, THREAD_BASIC_INFO, (thread_info_t)&tinfo, &tcount); 5.81 if (kr != KERN_SUCCESS) 5.82 return -1;
6.1 --- a/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp Fri Feb 17 15:11:32 2012 -0800 6.2 +++ b/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp Wed Feb 22 08:19:27 2012 -0800 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -29,12 +29,18 @@ 6.11 // constants required by the Serviceability Agent. This file is 6.12 // referenced by vmStructs.cpp. 6.13 6.14 +#ifdef __APPLE__ 6.15 +#define OS_THREAD_ID_TYPE thread_t 6.16 +#else 6.17 +#define OS_THREAD_ID_TYPE pthread_t 6.18 +#endif 6.19 + 6.20 #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ 6.21 \ 6.22 /******************************/ \ 6.23 /* Threads (NOTE: incomplete) */ \ 6.24 /******************************/ \ 6.25 - nonstatic_field(OSThread, _thread_id, pthread_t) \ 6.26 + nonstatic_field(OSThread, _thread_id, OS_THREAD_ID_TYPE) \ 6.27 nonstatic_field(OSThread, _pthread_id, pthread_t) \ 6.28 /* This must be the last entry, and must be present */ \ 6.29 last_entry() 6.30 @@ -46,7 +52,7 @@ 6.31 /* Posix Thread IDs */ \ 6.32 /**********************/ \ 6.33 \ 6.34 - declare_integer_type(pid_t) \ 6.35 + declare_unsigned_integer_type(thread_t) \ 6.36 declare_unsigned_integer_type(pthread_t) \ 6.37 \ 6.38 /* This must be the last entry, and must be present */ \
7.1 --- a/src/share/vm/utilities/globalDefinitions_gcc.hpp Fri Feb 17 15:11:32 2012 -0800 7.2 +++ b/src/share/vm/utilities/globalDefinitions_gcc.hpp Wed Feb 22 08:19:27 2012 -0800 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -87,14 +87,7 @@ 7.11 #endif 7.12 #ifdef __APPLE__ 7.13 #include <AvailabilityMacros.h> 7.14 - #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4) 7.15 - // Mac OS X 10.4 defines EFL_AC and EFL_ID, 7.16 - // which conflict with hotspot variable names. 7.17 - // 7.18 - // This has been fixed in Mac OS X 10.5. 7.19 - #undef EFL_AC 7.20 - #undef EFL_ID 7.21 - #endif 7.22 + #include <mach/mach.h> 7.23 #endif 7.24 #include <sys/time.h> 7.25 #endif // LINUX || _ALLBSD_SOURCE