Merge
authordholmes
Wed, 30 May 2012 17:45:02 -0400 (2012-05-30)
changeset 12775 af4561ebb66f
parent 12774 43fb26683ef1 (current diff)
parent 12771 2be1e92d8eb5 (diff)
child 12782 8ed9182bc606
Merge
--- a/hotspot/make/solaris/makefiles/defs.make	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/make/solaris/makefiles/defs.make	Wed May 30 17:45:02 2012 -0400
@@ -123,25 +123,10 @@
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
     # Default OBJCOPY comes from the SUNWbinutils package:
     DEF_OBJCOPY=/usr/sfw/bin/gobjcopy
-    ifeq ($(VM_PLATFORM),solaris_amd64)
-      # On Solaris AMD64/X64, gobjcopy is not happy and fails:
-      #
-      # usr/sfw/bin/gobjcopy --add-gnu-debuglink=<lib>.debuginfo <lib>.so
-      # BFD: stKPaiop: Not enough room for program headers, try linking with -N
-      # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
-      # BFD: stKPaiop: Not enough room for program headers, try linking with -N
-      # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value
-      # BFD: stKPaiop: Not enough room for program headers, try linking with -N
-      # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
-      _JUNK_ := $(shell \
-        echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64")
-      OBJCOPY=
-    else
-      OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
-      ifneq ($(ALT_OBJCOPY),)
-        _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
-        OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
-      endif
+    OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
+    ifneq ($(ALT_OBJCOPY),)
+      _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
+      OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
     endif
   else
     OBJCOPY=
--- a/hotspot/make/solaris/makefiles/dtrace.make	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/make/solaris/makefiles/dtrace.make	Wed May 30 17:45:02 2012 -0400
@@ -108,15 +108,24 @@
 XLIBJVM_DTRACE_G_DEBUGINFO = 64/$(LIBJVM_DTRACE_G_DEBUGINFO)
 XLIBJVM_DTRACE_G_DIZ       = 64/$(LIBJVM_DTRACE_G_DIZ)
 
-$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
+$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) mkdir -p 64/ ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 	[ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DB_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DB_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -133,15 +142,19 @@
   endif
 endif
 
-$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) mkdir -p 64/ ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 	[ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(XLIBJVM_DTRACE_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(XLIBJVM_DTRACE_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -198,14 +211,18 @@
 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
 	$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
 
-$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
+$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 	[ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -222,14 +239,18 @@
   endif
 endif
 
-$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 	[ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make	Wed May 30 17:45:02 2012 -0400
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#  
+#
+
+# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris
+
+GENERATED                       = ../generated
+FIX_EMPTY_SEC_HDR_FLAGS         = $(GENERATED)/fix_empty_sec_hdr_flags
+
+FIX_EMPTY_SEC_HDR_FLAGS_DIR     = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags
+FIX_EMPTY_SEC_HDR_FLAGS_SRC     = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c
+FIX_EMPTY_SEC_HDR_FLAGS_FLAGS   = 
+LIBS_FIX_EMPTY_SEC_HDR_FLAGS   += -lelf
+
+ifeq ("${Platform_compiler}", "sparcWorks")
+# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to
+# compare the built ELF objects.
+#
+# The -g option makes static data global and the "-W0,-noglobal"
+# option tells the compiler to not globalize static data using a unique
+# globalization prefix. Instead force the use of a static globalization
+# prefix based on the source filepath so the objects from two identical
+# compilations are the same.
+#
+# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
+#       seem to work. I got "-W0,-noglobal" from Kelly and that works.
+#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal
+endif # Platform_compiler == sparcWorks
+
+$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC)
+	$(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
--- a/hotspot/make/solaris/makefiles/jsig.make	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/make/solaris/makefiles/jsig.make	Wed May 30 17:45:02 2012 -0400
@@ -52,14 +52,23 @@
 LFLAGS_JSIG += -mt -xnolib
 endif
 
-$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
+$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
-                         $(LFLAGS_JSIG) -o $@ $< -ldl
+                         $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
 	[ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
--- a/hotspot/make/solaris/makefiles/saproc.make	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/make/solaris/makefiles/saproc.make	Wed May 30 17:45:02 2012 -0400
@@ -90,7 +90,7 @@
 # when actually building on Nevada-B158 or earlier:
 #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
 
-$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
+$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
 	  exit 1; \
@@ -109,8 +109,17 @@
 	           -ldl -ldemangle -lthread -lc
 	[ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
+	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
--- a/hotspot/make/solaris/makefiles/vm.make	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/make/solaris/makefiles/vm.make	Wed May 30 17:45:02 2012 -0400
@@ -149,6 +149,10 @@
 include $(MAKEFILES_DIR)/add_gnu_debuglink.make
 
 #----------------------------------------------------------------------
+# fix_empty_sec_hdr_flags tool
+include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make
+
+#----------------------------------------------------------------------
 # JVM
 
 JVM      = jvm
@@ -280,7 +284,7 @@
 LINK_VM = $(LINK_LIB.CXX)
 endif
 # making the library:
-$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(LIBJVM.o) $(LIBJVM_MAPFILE) 
+$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) 
 ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
 	@echo Linking vm...
 	$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
@@ -290,10 +294,15 @@
 	$(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
 	$(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+# Clear the SHF_ALLOC flag (if set) from empty section headers.
+# An empty section header has sh_addr == 0 and sh_size == 0.
+# This problem has only been seen on Solaris X64, but we call this tool
+# on all Solaris builds just in case.
+	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts the SUNW_dof section
-# in libjvm.so. Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY)
-# is available.
+# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
 #	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
 	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
--- a/hotspot/make/windows/makefiles/defs.make	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/make/windows/makefiles/defs.make	Wed May 30 17:45:02 2012 -0400
@@ -143,14 +143,7 @@
 MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)
 
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-  # Disable ZIP_DEBUGINFO_FILES by default because various tests are
-  # failing in nightly when the debug info files are ZIP'ed.
-  #ZIP_DEBUGINFO_FILES ?= 0
-  # The above conditional setting logic is unreliable on Windows for
-  # unknown reasons. We force ZIP_DEBUGINFO_FILES to be disabled on
-  # Windows until we figure out why the various tests are failing
-  # AND why the conditional setting logic is unreliable.
-  ZIP_DEBUGINFO_FILES=0
+  ZIP_DEBUGINFO_FILES ?= 1
 else
   ZIP_DEBUGINFO_FILES=0
 endif
--- a/hotspot/src/os/bsd/vm/osThread_bsd.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os/bsd/vm/osThread_bsd.hpp	Wed May 30 17:45:02 2012 -0400
@@ -42,26 +42,19 @@
 #ifdef _ALLBSD_SOURCE
 
 #ifdef __APPLE__
-  thread_t  _thread_id;
+  typedef thread_t thread_id_t;
 #else
-  pthread_t _thread_id;
+  typedef pthread_t thread_id_t;
+#endif
+
+#else
+  typedef pid_t thread_id_t;
 #endif
 
   // _pthread_id is the pthread id, which is used by library calls
   // (e.g. pthread_kill).
   pthread_t _pthread_id;
 
-#else
-  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
-  // thread has a unique thread_id (BsdThreads or NPTL). It can be used
-  // to access /proc.
-  pid_t     _thread_id;
-
-  // _pthread_id is the pthread id, which is used by library calls
-  // (e.g. pthread_kill).
-  pthread_t _pthread_id;
-#endif
-
   sigset_t _caller_sigmask; // Caller's signal mask
 
  public:
@@ -70,28 +63,11 @@
   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
 
-#ifdef _ALLBSD_SOURCE
-#ifdef __APPLE__
-  static size_t thread_id_size()         { return sizeof(thread_t); }
-  thread_t thread_id() const {
-    return _thread_id;
-  }
-#else
-  static size_t thread_id_size()         { return sizeof(pthread_t); }
-  pthread_t thread_id() const {
-    return _thread_id;
-  }
-#endif
-#else
-  static size_t thread_id_size()         { return sizeof(pid_t); }
-  pid_t thread_id() const {
-    return _thread_id;
-  }
-#endif
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
   intptr_t thread_identifier() const   { return (intptr_t)_pthread_id; }
 #endif
+
 #ifdef ASSERT
   // We expect no reposition failures so kill vm if we get one.
   //
@@ -99,21 +75,7 @@
     return false;
   }
 #endif // ASSERT
-#ifdef _ALLBSD_SOURCE
-#ifdef __APPLE__
-  void set_thread_id(thread_t id) {
-    _thread_id = id;
-  }
-#else
-  void set_thread_id(pthread_t id) {
-    _thread_id = id;
-  }
-#endif
-#else
-  void set_thread_id(pid_t id) {
-    _thread_id = id;
-  }
-#endif
+
   pthread_t pthread_id() const {
     return _pthread_id;
   }
--- a/hotspot/src/os/linux/vm/osThread_linux.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os/linux/vm/osThread_linux.hpp	Wed May 30 17:45:02 2012 -0400
@@ -24,6 +24,8 @@
 
 #ifndef OS_LINUX_VM_OSTHREAD_LINUX_HPP
 #define OS_LINUX_VM_OSTHREAD_LINUX_HPP
+ public:
+  typedef pid_t thread_id_t;
 
  private:
   int _thread_type;
@@ -37,13 +39,6 @@
     _thread_type = type;
   }
 
- private:
-
-  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
-  // thread has a unique thread_id (LinuxThreads or NPTL). It can be used
-  // to access /proc.
-  pid_t     _thread_id;
-
   // _pthread_id is the pthread id, which is used by library calls
   // (e.g. pthread_kill).
   pthread_t _pthread_id;
@@ -56,11 +51,6 @@
   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
 
-  static size_t thread_id_size()         { return sizeof(pid_t); }
-
-  pid_t thread_id() const {
-    return _thread_id;
-  }
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
   int thread_identifier() const   { return _thread_id; }
@@ -72,9 +62,6 @@
     return false;
   }
 #endif // ASSERT
-  void set_thread_id(pid_t id) {
-    _thread_id = id;
-  }
   pthread_t pthread_id() const {
     return _pthread_id;
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c	Wed May 30 17:45:02 2012 -0400
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * Name:        fix_empty_sec_hdr_flags.c
+ *
+ * Description: Remove the SHF_ALLOC flag from "empty" section headers.
+ *     An "empty" section header has sh_addr == 0 and sh_size == 0.
+ *
+ *     This program is adapted from the example program shown on the
+ *     elf(3elf) man page and from code from the Solaris compiler
+ *     driver.
+ */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <libelf.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void failure(void);
+
+void
+main(int argc, char ** argv) {
+    void *        ehdr;           /* ELF header */
+    unsigned int  i;              /* section counter */
+    int           fd;             /* descriptor for file */
+    Elf *         elf;            /* ELF descriptor */
+    char *        elf_ident;      /* ELF identity string */
+    char *        elf_obj;        /* elf_obj file */
+    int           fix_count;      /* number of flags fixed */
+    int           is_elfclass64;  /* is an ELFCLASS64 file? */
+    Elf_Scn *     scn;            /* ELF section descriptor */
+    void *        shdr;           /* ELF section header */
+    Elf_Data *    shstrtab;       /* ELF section header string table */
+
+    if (argc != 2) {
+        (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
+        exit(2);
+    }
+
+    /* open the elf_obj */
+    elf_obj = argv[1];
+    if ((fd = open(elf_obj, O_RDWR)) == -1) {
+        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
+        exit(3);
+    }
+
+    (void) printf("Opening '%s' for update\n", elf_obj);
+    (void) fflush(stdout);
+    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
+
+    /* obtain the ELF descriptors from the input file */
+    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
+        failure();
+    }
+
+    /* determine if ELFCLASS64 or not? */
+    elf_ident = elf_getident(elf, NULL);
+    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
+
+    /* get the ELF header */
+    if (is_elfclass64) {
+        ehdr = elf64_getehdr(elf);
+    } else {
+        ehdr = elf32_getehdr(elf);
+    }
+    if (ehdr == NULL) {
+        failure();
+    }
+
+    /* get the ELF section descriptor */
+    if (is_elfclass64) {
+        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
+    } else {
+        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
+    }
+    if (scn == NULL) {
+        failure();
+    }
+
+    /* get the section header string table */
+    shstrtab = elf_getdata(scn, NULL);
+    if (shstrtab == NULL) {
+        failure();
+    }
+
+    fix_count = 0;
+
+    /* traverse the sections of the input file */
+    for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
+        int    has_flag_set;  /* is SHF_ALLOC flag set? */
+        int    is_empty;      /* is section empty? */
+        char * name;          /* short hand pointer */
+
+        /* get the section header */
+        if (is_elfclass64) {
+            shdr = elf64_getshdr(scn);
+        } else {
+            shdr = elf32_getshdr(scn);
+        }
+        if (shdr == NULL) {
+            failure();
+        }
+
+        if (is_elfclass64) {
+            name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
+        } else {
+            name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
+        }
+
+        if (is_elfclass64) {
+            has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
+            is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
+                ((Elf64_Shdr *) shdr)->sh_size == 0;
+        } else {
+            has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
+            is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
+                ((Elf32_Shdr *) shdr)->sh_size == 0;
+        }
+
+        if (is_empty && has_flag_set) {
+            (void) printf("section[%u] '%s' is empty, "
+                "but SHF_ALLOC flag is set.\n", i, name);
+            (void) printf("Clearing the SHF_ALLOC flag.\n");
+
+            if (is_elfclass64) {
+                ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
+            } else {
+                ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
+            }
+            fix_count++;
+        }
+    }  /* end for each ELF section */
+
+    if (fix_count > 0) {
+        (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
+        (void) fflush(stdout);
+        (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
+        (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
+    } else {
+        (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
+    }
+
+    (void) elf_end(elf);                  /* done with ELF obj */
+    (void) close(fd);
+
+    (void) printf("Done %s '%s'\n",
+               (fix_count > 0) ? "updating" : "with", elf_obj);
+    (void) fflush(stdout);
+    exit(0);
+}  /* end main */
+
+
+static void
+failure() {
+    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
+    exit(6);
+}
--- a/hotspot/src/os/solaris/vm/osThread_solaris.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os/solaris/vm/osThread_solaris.hpp	Wed May 30 17:45:02 2012 -0400
@@ -26,9 +26,10 @@
 #define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
 
 // This is embedded via include into the class OSThread
+ public:
+  typedef thread_t thread_id_t;
 
  private:
-  thread_t _thread_id;         // Solaris thread id
   uint     _lwp_id;            // lwp ID, only used with bound threads
   int      _native_priority;   // Saved native priority when starting
                                // a bound thread
@@ -36,8 +37,6 @@
   bool     _vm_created_thread; // true if the VM created this thread,
                                // false if primary thread or attached thread
  public:
-  static size_t thread_id_size()   { return sizeof(thread_t); }
-  thread_t thread_id() const       { return _thread_id; }
   uint     lwp_id() const          { return _lwp_id; }
   int      native_priority() const { return _native_priority; }
 
@@ -63,7 +62,6 @@
     return true;
   }
 #endif
-  void set_thread_id(thread_t id)    { _thread_id = id; }
   void set_lwp_id(uint id)           { _lwp_id = id; }
   void set_native_priority(int prio) { _native_priority = prio; }
 
--- a/hotspot/src/os/windows/vm/osThread_windows.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os/windows/vm/osThread_windows.hpp	Wed May 30 17:45:02 2012 -0400
@@ -25,12 +25,13 @@
 #ifndef OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
 #define OS_WINDOWS_VM_OSTHREAD_WINDOWS_HPP
 
-typedef void* HANDLE;
+  typedef void* HANDLE;
+ public:
+  typedef unsigned long thread_id_t;
 
  private:
   // Win32-specific thread information
   HANDLE _thread_handle;        // Win32 thread handle
-  unsigned long _thread_id;     // Win32 thread id
   HANDLE _interrupt_event;      // Event signalled on thread interrupt
   ThreadState _last_state;
 
@@ -42,9 +43,6 @@
   HANDLE interrupt_event() const                   { return _interrupt_event; }
   void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; }
 
-
-  static size_t thread_id_size()                   { return sizeof(unsigned long); }
-  unsigned long thread_id() const                  { return _thread_id; }
 #ifndef PRODUCT
   // Used for debugging, return a unique integer for each thread.
   int thread_identifier() const                    { return _thread_id; }
@@ -56,8 +54,6 @@
     return false;
   }
 #endif // ASSERT
-  void set_thread_id(unsigned long thread_id)      { _thread_id = thread_id; }
-
   bool is_try_mutex_enter()                        { return false; }
 
   // This is a temporary fix for the thread states during
--- a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Wed May 30 17:45:02 2012 -0400
@@ -29,18 +29,12 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#ifdef __APPLE__
-#define OS_THREAD_ID_TYPE thread_t
-#else
-#define OS_THREAD_ID_TYPE pthread_t
-#endif
-
 #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) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
-  nonstatic_field(OSThread,                      _thread_id,                                      OS_THREAD_ID_TYPE)                 \
+  nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
   nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)                         \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -52,7 +46,7 @@
   /* Posix Thread IDs   */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(thread_t)                                 \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
   declare_unsigned_integer_type(pthread_t)                                \
                                                                           \
   /* This must be the last entry, and must be present */                  \
--- a/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp	Wed May 30 17:45:02 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -36,7 +36,7 @@
   /******************************/                                                                                                   \
                                                                                                                                      \
   nonstatic_field(JavaThread,                  _base_of_stack_pointer,                        intptr_t*)                             \
-  nonstatic_field(OSThread,                    _thread_id,                                    pid_t)                                 \
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
   nonstatic_field(OSThread,                    _pthread_id,                                   pthread_t)                             \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -48,7 +48,7 @@
   /* POSIX Thread IDs */                                                  \
   /**********************/                                                \
                                                                           \
-  declare_integer_type(pid_t)                                             \
+  declare_integer_type(OSThread::thread_id_t)                             \
   declare_unsigned_integer_type(pthread_t)                                \
                                                                           \
   /* This must be the last entry, and must be present */                  \
--- a/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp	Wed May 30 17:45:02 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -34,7 +34,7 @@
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
-  nonstatic_field(OSThread,                      _thread_id,                                      pid_t)                             \
+  nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
   nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)                         \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -46,7 +46,7 @@
   /* Posix Thread IDs   */                                                \
   /**********************/                                                \
                                                                           \
-  declare_integer_type(pid_t)                                             \
+  declare_integer_type(OSThread::thread_id_t)                             \
   declare_unsigned_integer_type(pthread_t)                                \
                                                                           \
   /* This must be the last entry, and must be present */                  \
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp	Wed May 30 17:45:02 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -36,7 +36,7 @@
   /******************************/                                                                                                   \
                                                                                                                                      \
   nonstatic_field(JavaThread,                  _base_of_stack_pointer,                        intptr_t*)                             \
-  nonstatic_field(OSThread,                    _thread_id,                                    thread_t)                              \
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
 
@@ -47,7 +47,7 @@
   /* Solaris Thread IDs */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(thread_t)                                 \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
                                                                           \
   /* This must be the last entry, and must be present */                  \
   last_entry()
--- a/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp	Wed May 30 17:45:02 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -35,7 +35,7 @@
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
-  nonstatic_field(OSThread,                      _thread_id,                                    thread_t)                              \
+  nonstatic_field(OSThread,                      _thread_id,                                    OSThread::thread_id_t)               \
                                                                                                                                      \
   /* This must be the last entry, and must be present */                                                                             \
   last_entry()
@@ -46,7 +46,7 @@
   /* Solaris Thread IDs */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(thread_t)                                 \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
                                                                           \
   /* This must be the last entry, and must be present */                  \
   last_entry()
--- a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp	Wed May 30 17:45:02 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, 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
@@ -35,7 +35,7 @@
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
-  nonstatic_field(OSThread,                    _thread_id,                                    unsigned long)                         \
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
   unchecked_nonstatic_field(OSThread,          _thread_handle,                                sizeof(HANDLE)) /* NOTE: no type */    \
                                                                                                                                      \
   /* This must be the last entry, and must be present */                                                                             \
@@ -43,6 +43,7 @@
 
 #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
                                                                           \
+  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
   /* This must be the last entry, and must be present */                  \
   last_entry()
 
--- a/hotspot/src/share/vm/runtime/osThread.hpp	Sat May 26 08:49:05 2012 -0400
+++ b/hotspot/src/share/vm/runtime/osThread.hpp	Wed May 30 17:45:02 2012 -0400
@@ -61,7 +61,6 @@
 class OSThread: public CHeapObj {
   friend class VMStructs;
  private:
-  //void* _start_proc;            // Thread start routine
   OSThreadStartFunc _start_proc;  // Thread start routine
   void* _start_parm;              // Thread start routine parameter
   volatile ThreadState _state;    // Thread state *hint*
@@ -77,10 +76,7 @@
   void set_state(ThreadState state)                { _state = state; }
   ThreadState get_state()                          { return _state; }
 
-  // Constructor
   OSThread(OSThreadStartFunc start_proc, void* start_parm);
-
-  // Destructor
   ~OSThread();
 
   // Accessors
@@ -98,7 +94,6 @@
 
   // For java intrinsics:
   static ByteSize interrupted_offset()            { return byte_offset_of(OSThread, _interrupted); }
-  static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
 
   // Platform dependent stuff
 #ifdef TARGET_OS_FAMILY_linux
@@ -114,6 +109,19 @@
 # include "osThread_bsd.hpp"
 #endif
 
+ public:
+  static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
+  static size_t thread_id_size()                  { return sizeof(thread_id_t); }
+
+  thread_id_t thread_id() const                   { return _thread_id; }
+
+  void set_thread_id(thread_id_t id)              { _thread_id = id; }
+
+ private:
+  // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
+  // thread has a unique thread_id (BsdThreads or NPTL). It can be used
+  // to access /proc.
+  thread_id_t _thread_id;
 };