changeset 1206:668862175b0a

. Changes to the BSD specific files equivalent to the changes to the Linux specific files for b79.
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 16 Jan 2010 20:41:44 -0800
parents bd7ed11db07e
children ede59353e649
files make/bsd/makefiles/debug.make make/bsd/makefiles/fastdebug.make make/bsd/makefiles/jsig.make make/bsd/makefiles/jvmg.make make/bsd/makefiles/launcher.make make/bsd/makefiles/saproc.make make/bsd/makefiles/vm.make src/os/bsd/vm/os_bsd.cpp
diffstat 8 files changed, 40 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/make/bsd/makefiles/debug.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/debug.make	Sat Jan 16 20:41:44 2010 -0800
@@ -38,7 +38,7 @@
  "Please use 'make jvmg' to build debug JVM.                            \n" \
  "----------------------------------------------------------------------\n")
 
-G_SUFFIX =
+G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/bsd/makefiles/fastdebug.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/fastdebug.make	Sat Jan 16 20:41:44 2010 -0800
@@ -58,7 +58,7 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
 
-G_SUFFIX =
+G_SUFFIX = _g
 VERSION = optimized
 SYSDEFS += -DASSERT -DFASTDEBUG
 PICFLAGS = DEFAULT
--- a/make/bsd/makefiles/jsig.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/jsig.make	Sat Jan 16 20:41:44 2010 -0800
@@ -25,12 +25,15 @@
 # Rules to build signal interposition library, used by vm.make
 
 # libjsig[_g].so: signal interposition library
-JSIG = jsig$(G_SUFFIX)
+JSIG   = jsig
+JSIG_G = $(JSIG)$(G_SUFFIX)
 
 ifeq ($(OS_VENDOR), Darwin)
-  LIBJSIG = lib$(JSIG).dylib
+  LIBJSIG   = lib$(JSIG).dylib
+  LIBJSIG_G = lib$(JSIG_G).dylib
 else
-  LIBJSIG = lib$(JSIG).so
+  LIBJSIG   = lib$(JSIG).so
+  LIBJSIG_G = lib$(JSIG_G).so
 endif
 
 JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
@@ -55,6 +58,7 @@
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
                          $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
+	$(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
 
 install_jsig: $(LIBJSIG)
 	@echo "Copying $(LIBJSIG) to $(DEST_JSIG)"
--- a/make/bsd/makefiles/jvmg.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/jvmg.make	Sat Jan 16 20:41:44 2010 -0800
@@ -35,7 +35,7 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
 
-G_SUFFIX =
+G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/bsd/makefiles/launcher.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/launcher.make	Sat Jan 16 20:41:44 2010 -0800
@@ -25,7 +25,9 @@
 # Rules to build gamma launcher, used by vm.make
 
 # gamma[_g]: launcher
-LAUNCHER = gamma$(G_SUFFIX)
+
+LAUNCHER   = gamma
+LAUNCHER_G = $(LAUNCHER)$(G_SUFFIX)
 
 LAUNCHERDIR   = $(GAMMADIR)/src/os/$(Platform_os_family)/launcher
 LAUNCHERFLAGS = $(ARCHFLAG) \
@@ -70,4 +72,5 @@
 	    $(LINK_LAUNCHER/PRE_HOOK) \
 	    $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER); \
 	    $(LINK_LAUNCHER/POST_HOOK) \
+	    [ -f $(LAUNCHER_G) ] || { ln -s $@ $(LAUNCHER_G); }; \
         }
--- a/make/bsd/makefiles/saproc.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/saproc.make	Sat Jan 16 20:41:44 2010 -0800
@@ -25,12 +25,15 @@
 # Rules to build serviceability agent library, used by vm.make
 
 # libsaproc[_g].so: serviceability agent
-SAPROC = saproc$(G_SUFFIX)
+SAPROC   = saproc
+SAPROC_G = $(SAPROC)$(G_SUFFIX)
 
 ifeq ($(OS_VENDOR), Darwin)
-  LIBSAPROC = lib$(SAPROC).dylib
+  LIBSAPROC   = lib$(SAPROC).dylib
+  LIBSAPROC_G = lib$(SAPROC_G).dylib
 else
-  LIBSAPROC = lib$(SAPROC).so
+  LIBSAPROC   = lib$(SAPROC).so
+  LIBSAPROC_G = lib$(SAPROC_G).so
 endif
 
 AGENT_DIR = $(GAMMADIR)/agent
@@ -90,6 +93,7 @@
 	           $(SA_DEBUG_CFLAGS)                                   \
 	           -o $@                                                \
 	           $(SALIBS)
+	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 
 install_saproc: checkAndBuildSA
 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
--- a/make/bsd/makefiles/vm.make	Sat Jan 16 12:50:31 2010 -0800
+++ b/make/bsd/makefiles/vm.make	Sat Jan 16 20:41:44 2010 -0800
@@ -113,12 +113,14 @@
 #----------------------------------------------------------------------
 # JVM
 
-JVM    = jvm$(G_SUFFIX)
+JVM    = jvm
 ifeq ($(OS_VENDOR), Darwin)
-  LIBJVM = lib$(JVM).dylib
-  CFLAGS += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
+  LIBJVM   = lib$(JVM).dylib
+  LIBJVM_G = lib$(JVM)$(G_SUFFIX).dylib
+  CFLAGS  += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
 else
-  LIBJVM = lib$(JVM).so
+  LIBJVM   = lib$(JVM).so
+  LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 endif
 
 JVM_OBJ_FILES = $(Obj_Files)
@@ -197,6 +199,7 @@
 		       $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM);       \
 	    $(LINK_LIB.CC/POST_HOOK)                                    \
 	    rm -f $@.1; ln -s $@ $@.1;                                  \
+	    [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
 	}
 
 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
--- a/src/os/bsd/vm/os_bsd.cpp	Sat Jan 16 12:50:31 2010 -0800
+++ b/src/os/bsd/vm/os_bsd.cpp	Sat Jan 16 20:41:44 2010 -0800
@@ -268,11 +268,12 @@
   mib[0] = CTL_HW;
   mib[1] = HW_NCPU;
   len = sizeof(cpu_val);
-  if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1)
-        _processor_count = cpu_val;
-
-  if (_processor_count < 1)
-       _processor_count = 1;   // fallback
+  if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1 && cpu_val >= 1) {
+       set_processor_count(cpu_val);
+  }
+  else {
+       set_processor_count(1);   // fallback
+  }
 
   /* get physical memory via hw.usermem sysctl (hw.usermem is used
    * instead of hw.physmem because we need size of allocatable memory
@@ -297,8 +298,8 @@
 }
 #else
 void os::Bsd::initialize_system_info() {
-  _processor_count = sysconf(_SC_NPROCESSORS_CONF);
-  if (_processor_count == 1) {
+  set_processor_count(sysconf(_SC_NPROCESSORS_CONF));
+  if (processor_count() == 1) {
     pid_t pid = os::Bsd::gettid();
     char fname[32];
     jio_snprintf(fname, sizeof(fname), "/proc/%d", pid);
@@ -310,7 +311,7 @@
     }
   }
   _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE);
-  assert(_processor_count > 0, "bsd error");
+  assert(processor_count() > 0, "bsd error");
 }
 #endif
 
@@ -5095,6 +5096,7 @@
   // Return immediately if a permit is available.
   if (_counter > 0) {
       _counter = 0 ;
+      OrderAccess::fence();
       return ;
   }
 
@@ -5137,6 +5139,7 @@
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
+    OrderAccess::fence();
     return;
   }
 
@@ -5177,6 +5180,7 @@
     jt->java_suspend_self();
   }
 
+  OrderAccess::fence();
 }
 
 void Parker::unpark() {