changeset 2108:f4799d68d052

. Sync with Linux/Solaris changes.
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 22 Jan 2011 22:41:33 -0800
parents 3dc2c88a3126
children f74ef06f34d0
files agent/src/os/bsd/StubDebuggerLocal.c agent/src/os/bsd/libproc_impl.c agent/src/os/bsd/ps_core.c agent/src/os/bsd/ps_proc.c agent/src/os/bsd/symtab.c agent/src/os/bsd/symtab.h make/bsd/makefiles/adlc.make make/bsd/makefiles/amd64.make make/bsd/makefiles/build_vm_def.sh make/bsd/makefiles/buildtree.make make/bsd/makefiles/core.make make/bsd/makefiles/defs.make make/bsd/makefiles/gcc.make make/bsd/makefiles/i486.make make/bsd/makefiles/jvmti.make make/bsd/makefiles/launcher.make make/bsd/makefiles/makedeps.make make/bsd/makefiles/mapfile-vers-debug make/bsd/makefiles/mapfile-vers-product make/bsd/makefiles/product.make make/bsd/makefiles/rules.make make/bsd/makefiles/saproc.make make/bsd/makefiles/shark.make make/bsd/makefiles/sparc.make make/bsd/makefiles/sparcWorks.make make/bsd/makefiles/sparcv9.make make/bsd/makefiles/top.make make/bsd/makefiles/vm.make make/bsd/makefiles/zero.make make/templates/bsd-header src/cpu/x86/vm/bytes_x86.hpp src/cpu/x86/vm/copy_x86.hpp src/cpu/x86/vm/interp_masm_x86_32.cpp src/cpu/x86/vm/interp_masm_x86_64.cpp src/cpu/x86/vm/stubGenerator_x86_32.cpp src/cpu/x86/vm/stubGenerator_x86_64.cpp src/cpu/x86/vm/stubRoutines_x86_32.cpp src/cpu/x86/vm/stubRoutines_x86_64.cpp src/cpu/x86/vm/vm_version_x86.cpp src/cpu/zero/vm/bytes_zero.hpp src/cpu/zero/vm/interp_masm_zero.cpp src/cpu/zero/vm/stubGenerator_zero.cpp src/cpu/zero/vm/stubRoutines_zero.cpp src/cpu/zero/vm/vm_version_zero.cpp src/os/bsd/launcher/java.c src/os/bsd/launcher/java.h src/os/bsd/launcher/java_md.c src/os/bsd/launcher/java_md.h src/os/bsd/vm/attachListener_bsd.cpp src/os/bsd/vm/c1_globals_bsd.hpp src/os/bsd/vm/c2_globals_bsd.hpp src/os/bsd/vm/chaitin_bsd.cpp src/os/bsd/vm/decoder_bsd.cpp src/os/bsd/vm/dtraceJSDT_bsd.cpp src/os/bsd/vm/globals_bsd.hpp src/os/bsd/vm/hpi_bsd.cpp src/os/bsd/vm/hpi_bsd.hpp src/os/bsd/vm/interfaceSupport_bsd.hpp src/os/bsd/vm/jsig.c src/os/bsd/vm/jvm_bsd.cpp src/os/bsd/vm/jvm_bsd.h src/os/bsd/vm/mutex_bsd.cpp src/os/bsd/vm/mutex_bsd.inline.hpp src/os/bsd/vm/objectMonitor_bsd.cpp src/os/bsd/vm/objectMonitor_bsd.hpp src/os/bsd/vm/objectMonitor_bsd.inline.hpp src/os/bsd/vm/osThread_bsd.cpp src/os/bsd/vm/osThread_bsd.hpp src/os/bsd/vm/os_bsd.cpp src/os/bsd/vm/os_bsd.hpp src/os/bsd/vm/os_bsd.inline.hpp src/os/bsd/vm/os_share_bsd.hpp src/os/bsd/vm/perfMemory_bsd.cpp src/os/bsd/vm/stubRoutines_bsd.cpp src/os/bsd/vm/threadCritical_bsd.cpp src/os/bsd/vm/thread_bsd.inline.hpp src/os/bsd/vm/vmError_bsd.cpp src/os/bsd/vm/vtune_bsd.cpp src/os/posix/launcher/java_md.c src/os/posix/launcher/launcher.script src/os_cpu/bsd_x86/vm/assembler_bsd_x86.cpp src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/bsd_x86_32.s src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/copy_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp src/os_cpu/bsd_x86/vm/os_bsd_x86.hpp src/os_cpu/bsd_x86/vm/prefetch_bsd_x86.inline.hpp src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp src/os_cpu/bsd_x86/vm/vm_version_bsd_x86.cpp src/os_cpu/bsd_zero/vm/assembler_bsd_zero.cpp src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp src/os_cpu/bsd_zero/vm/bytes_bsd_zero.inline.hpp src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp src/os_cpu/bsd_zero/vm/os_bsd_zero.hpp src/os_cpu/bsd_zero/vm/prefetch_bsd_zero.inline.hpp src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.hpp src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp src/os_cpu/bsd_zero/vm/vm_version_bsd_zero.cpp src/share/vm/c1/c1_globals.hpp src/share/vm/classfile/classLoader.cpp src/share/vm/classfile/javaClasses.cpp src/share/vm/code/stubs.hpp src/share/vm/compiler/disassembler.hpp src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp src/share/vm/gc_implementation/g1/ptrQueue.cpp src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp src/share/vm/gc_interface/collectedHeap.cpp src/share/vm/gc_interface/collectedHeap.inline.hpp src/share/vm/interpreter/abstractInterpreter.hpp src/share/vm/interpreter/bytecodeInterpreter.cpp src/share/vm/interpreter/interpreterRuntime.hpp src/share/vm/interpreter/linkResolver.cpp src/share/vm/memory/allocation.cpp src/share/vm/memory/collectorPolicy.cpp src/share/vm/memory/defNewGeneration.cpp src/share/vm/memory/gcLocker.hpp src/share/vm/memory/genMarkSweep.cpp src/share/vm/memory/resourceArea.cpp src/share/vm/memory/resourceArea.hpp src/share/vm/memory/space.hpp src/share/vm/memory/threadLocalAllocBuffer.cpp src/share/vm/memory/universe.cpp src/share/vm/oops/constantPoolKlass.cpp src/share/vm/oops/instanceKlass.cpp src/share/vm/oops/markOop.cpp src/share/vm/oops/oop.cpp src/share/vm/oops/oopsHierarchy.cpp src/share/vm/opto/c2_globals.hpp src/share/vm/prims/jni.cpp src/share/vm/prims/jvm.cpp src/share/vm/prims/jvm.h src/share/vm/prims/jvmtiEnv.cpp src/share/vm/prims/jvmtiImpl.cpp src/share/vm/prims/nativeLookup.cpp src/share/vm/runtime/arguments.cpp src/share/vm/runtime/atomic.cpp src/share/vm/runtime/fprofiler.hpp src/share/vm/runtime/globals.hpp src/share/vm/runtime/handles.cpp src/share/vm/runtime/handles.inline.hpp src/share/vm/runtime/interfaceSupport.hpp src/share/vm/runtime/java.cpp src/share/vm/runtime/javaCalls.cpp src/share/vm/runtime/javaCalls.hpp src/share/vm/runtime/javaFrameAnchor.hpp src/share/vm/runtime/jniHandles.cpp src/share/vm/runtime/memprofiler.cpp src/share/vm/runtime/mutex.cpp src/share/vm/runtime/mutexLocker.cpp src/share/vm/runtime/mutexLocker.hpp src/share/vm/runtime/objectMonitor.cpp src/share/vm/runtime/os.cpp src/share/vm/runtime/os.hpp src/share/vm/runtime/osThread.hpp src/share/vm/runtime/safepoint.cpp src/share/vm/runtime/synchronizer.cpp src/share/vm/runtime/task.cpp src/share/vm/runtime/thread.cpp src/share/vm/runtime/thread.hpp src/share/vm/runtime/threadLocalStorage.cpp src/share/vm/runtime/threadLocalStorage.hpp src/share/vm/runtime/timer.cpp src/share/vm/runtime/virtualspace.cpp src/share/vm/runtime/vmStructs.cpp src/share/vm/runtime/vmThread.cpp src/share/vm/runtime/vmThread.hpp src/share/vm/runtime/vm_operations.cpp src/share/vm/utilities/accessFlags.cpp src/share/vm/utilities/array.cpp src/share/vm/utilities/bitMap.cpp src/share/vm/utilities/debug.cpp src/share/vm/utilities/elfFile.hpp src/share/vm/utilities/events.cpp src/share/vm/utilities/exceptions.cpp src/share/vm/utilities/growableArray.cpp src/share/vm/utilities/histogram.hpp src/share/vm/utilities/ostream.cpp src/share/vm/utilities/preserveException.hpp src/share/vm/utilities/taskqueue.cpp src/share/vm/utilities/taskqueue.hpp src/share/vm/utilities/workgroup.hpp
diffstat 200 files changed, 1549 insertions(+), 4809 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/os/bsd/StubDebuggerLocal.c	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright 2002-2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- */
-
-#include <stdlib.h>
-#include <jni.h>
-
-#define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
-#define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
-#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
-#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
-
-static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
-  (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    init0
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0
-  (JNIEnv *env, jclass cls) {
-}
-
-JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
-  (JNIEnv *env, jclass cls)
-{
-#ifdef _LP64
- return 8;
-#else
- return 4;
-#endif
-
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    attach0
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I
-  (JNIEnv *env, jobject this_obj, jint jpid) {
-
-  THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    attach0
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2
-  (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) {
-  THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file");
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    detach0
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0
-  (JNIEnv *env, jobject this_obj) {
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    lookupByName0
- * Signature: (Ljava/lang/String;Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0
-  (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
-  return 0;
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    lookupByAddress0
- * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
- */
-JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
-  (JNIEnv *env, jobject this_obj, jlong addr) {
-  return 0;
-}
-
-/*
- * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
- * Method:    readBytesFromProcess0
- * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
- */
-JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0
-  (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
-  return 0;
-}
-
-JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
-  (JNIEnv *env, jobject this_obj, jint lwp_id) {
-  return 0;
-}
--- a/agent/src/os/bsd/libproc_impl.c	Sat Jan 22 22:27:24 2011 -0800
+++ b/agent/src/os/bsd/libproc_impl.c	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
--- a/agent/src/os/bsd/ps_core.c	Sat Jan 22 22:27:24 2011 -0800
+++ b/agent/src/os/bsd/ps_core.c	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
--- a/agent/src/os/bsd/ps_proc.c	Sat Jan 22 22:27:24 2011 -0800
+++ b/agent/src/os/bsd/ps_proc.c	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
--- a/agent/src/os/bsd/symtab.c	Sat Jan 22 22:27:24 2011 -0800
+++ b/agent/src/os/bsd/symtab.c	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
--- a/agent/src/os/bsd/symtab.h	Sat Jan 22 22:27:24 2011 -0800
+++ b/agent/src/os/bsd/symtab.h	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
--- a/make/bsd/makefiles/adlc.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/adlc.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, 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
@@ -42,16 +42,14 @@
 SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
 	     $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad 
 
-Src_Dirs += $(GAMMADIR)/src/share/vm/adlc
-
 EXEC	= $(OUTDIR)/adlc
 
 # set VPATH so make knows where to look for source files
-Src_Dirs_V = ${Src_Dirs} $(GENERATED)/incls
-VPATH    += $(Src_Dirs_V:%=%:)
+Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc
+VPATH += $(Src_Dirs_V:%=%:)
 
 # set INCLUDES for C preprocessor
-Src_Dirs_I = ${Src_Dirs} $(GENERATED)
+Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)
 INCLUDES += $(Src_Dirs_I:%=-I%)
 
 # set flags for adlc compilation
--- a/make/bsd/makefiles/amd64.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/amd64.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2010, 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
@@ -22,9 +22,6 @@
 #  
 #
 
-# Not included in includeDB because it has no dependencies
-Obj_Files += bsd_x86_64.o
-
 # The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
 OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
 # The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized
--- a/make/bsd/makefiles/build_vm_def.sh	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/build_vm_def.sh	Sat Jan 22 22:41:33 2011 -0800
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 # If we're cross compiling use that path for nm
-if [ "$ALT_COMPILER_PATH" != "" ]; then 
+if [ "$CROSS_COMPILE_ARCH" != "" ]; then 
 NM=$ALT_COMPILER_PATH/nm
 else
 NM=nm
--- a/make/bsd/makefiles/buildtree.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/buildtree.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, 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
@@ -37,7 +37,7 @@
 # OS_FAMILY	- operating system
 # VARIANT	- core, compiler1, compiler2, or tiered
 # HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
-# HOTSPOT_BUILD_VERSION   - internal, PRTjob ID, JPRTjob ID
+# HOTSPOT_BUILD_VERSION   - internal, internal-$(USER_RELEASE_SUFFIX) or empty
 # JRE_RELEASE_VERSION     - <major>.<minor>.<micro> (1.7.0)
 #
 # Builds the directory trees with makefiles plus some convenience files in
@@ -113,7 +113,7 @@
 COMPILER	= $(shell sed -n 's/^compiler[ 	]*=[ 	]*//p' $(PLATFORM_FILE))
 
 SIMPLE_DIRS	= \
-	$(PLATFORM_DIR)/generated/incls \
+	$(PLATFORM_DIR)/generated/dependencies \
 	$(PLATFORM_DIR)/generated/adfiles \
 	$(PLATFORM_DIR)/generated/jvmtifiles
 
@@ -124,7 +124,7 @@
 BUILDTREE_MAKE	= $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make
 
 BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make sa.make \
-        env.sh env.csh .dbxrc test_gamma
+        env.sh env.csh jdkpath.sh .dbxrc test_gamma
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
 	ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
@@ -197,11 +197,27 @@
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
 	echo; \
-	echo "Src_Dirs = \\"; \
+	echo "# Used for platform dispatching"; \
+	echo "TARGET_DEFINES  = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \
+	echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \
+	echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \
+	echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \
+	echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \
+	echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \
+	echo "CFLAGS += \$$(TARGET_DEFINES)"; \
+	echo; \
+	echo "Src_Dirs_V = \\"; \
 	sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
 	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
 	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
 	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo; \
+	echo "Src_Dirs_I = \\"; \
+	echo "\$$(GAMMADIR)/src/share/vm \\"; \
+	echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \
+	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
+	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
+	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
 	[ -n "$(CFLAGS_BROWSE)" ] && \
 	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
 	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
@@ -303,6 +319,13 @@
 	sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \
 	) > $@
 
+jdkpath.sh: $(BUILDTREE_MAKE)
+	@echo Creating $@ ...
+	$(QUIETLY) ( \
+	$(BUILDTREE_COMMENT); \
+	echo "JDK=${JAVA_HOME}"; \
+	) > $@	   
+
 .dbxrc:  $(BUILDTREE_MAKE)
 	@echo Creating $@ ...
 	$(QUIETLY) ( \
--- a/make/bsd/makefiles/core.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/core.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, 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
@@ -24,8 +24,7 @@
 
 # Sets make macros for making core version of VM
 
-# Note the effect on includeDB lists in top.make:
-# includeDB_compiler* and ad_<arch>.*pp are excluded from the build,
+# Select which files to use (in top.make)
 TYPE=CORE
 
 # There is no "core" directory in JDK. Install core build in server directory.
--- a/make/bsd/makefiles/defs.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/defs.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2010, 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
--- a/make/bsd/makefiles/gcc.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/gcc.make	Sat Jan 22 22:41:33 2011 -0800
@@ -27,7 +27,9 @@
 #------------------------------------------------------------------------
 # CC, CPP & AS
 
-ifdef ALT_COMPILER_PATH
+# When cross-compiling the ALT_COMPILER_PATH points
+# to the cross-compilation toolset
+ifdef CROSS_COMPILE_ARCH
 CXX = $(ALT_COMPILER_PATH)/g++
 CPP = $(ALT_COMPILER_PATH)/g++
 CC  = $(ALT_COMPILER_PATH)/gcc
@@ -46,9 +48,13 @@
 
 # check for precompiled headers support
 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
+# Allow the user to turn off precompiled headers from the command line.
+ifneq ($(USE_PRECOMPILED_HEADER),0)
 USE_PRECOMPILED_HEADER=1
 PRECOMPILED_HEADER_DIR=.
-PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/incls/_precompiled.incl.gch
+PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled.hpp
+PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
+endif
 endif
 
 
@@ -155,6 +161,16 @@
 OPT_CFLAGS/mulnode.o += -O0
 endif
 
+# Flags for generating make dependency flags.
+ifneq ("${CC_VER_MAJOR}", "2")
+DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
+endif
+
+# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
+ifneq ($(USE_PRECOMPILED_HEADER),1)
+CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
+endif
+
 #------------------------------------------------------------------------
 # Linker flags
 
--- a/make/bsd/makefiles/i486.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/i486.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, 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
@@ -23,8 +23,6 @@
 #
 
 # TLS helper, assembled from .s file
-# Not included in includeDB because it has no dependencies
-Obj_Files += bsd_x86_32.o
 
 # The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
 OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
--- a/make/bsd/makefiles/jvmti.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/jvmti.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2010, 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
@@ -37,11 +37,10 @@
 
 JvmtiSrcDir = $(GAMMADIR)/src/share/vm/prims
 InterpreterSrcDir = $(GAMMADIR)/src/share/vm/interpreter
-Src_Dirs += $(JvmtiSrcDir)
 
 # set VPATH so make knows where to look for source files
-Src_Dirs_V = ${Src_Dirs}
-VPATH    += $(Src_Dirs_V:%=%:)
+Src_Dirs_V += $(JvmtiSrcDir)
+VPATH += $(Src_Dirs_V:%=%:)
 
 JvmtiGeneratedNames = \
         jvmtiEnv.hpp \
--- a/make/bsd/makefiles/launcher.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/launcher.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, 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
@@ -24,19 +24,23 @@
 
 # Rules to build gamma launcher, used by vm.make
 
-# gamma[_g]: launcher
 
+LAUNCHER_SCRIPT = hotspot
 LAUNCHER   = gamma
-LAUNCHER_G = $(LAUNCHER)$(G_SUFFIX)
 
-LAUNCHERDIR   = $(GAMMADIR)/src/os/$(Platform_os_family)/launcher
-LAUNCHERFLAGS = $(ARCHFLAG) \
+LAUNCHERDIR   := $(GAMMADIR)/src/os/posix/launcher
+LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
+LAUNCHERFLAGS := $(ARCHFLAG) \
                 -I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
+                -I$(LAUNCHERDIR_SHARE) \
                 -DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
+                -DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
+                -DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
                 -DARCH=\"$(LIBARCH)\" \
                 -DGAMMA \
                 -DLAUNCHER_TYPE=\"gamma\" \
-                -DLINK_INTO_$(LINK_INTO)
+                -DLINK_INTO_$(LINK_INTO) \
+                $(TARGET_DEFINES)
 
 ifeq ($(LINK_INTO),AOUT)
   LAUNCHER.o                 = launcher.o $(JVM_OBJ_FILES)
@@ -55,22 +59,35 @@
 LINK_LAUNCHER/PRE_HOOK  = $(LINK_LIB.CC/PRE_HOOK)
 LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CC/POST_HOOK)
 
-launcher.o: launcher.c $(LAUNCHERDIR)/java.c $(LAUNCHERDIR)/java_md.c
-	$(CC) -g -c -o $@ launcher.c $(LAUNCHERFLAGS) $(CPPFLAGS)
+LAUNCHER_OUT = launcher
 
-launcher.c:
-	@echo Generating $@
-	$(QUIETLY) { \
-	echo '#define debug launcher_debug'; \
-	echo '#include "java.c"'; \
-	echo '#include "java_md.c"'; \
-	} > $@
+SUFFIXES += .d
 
-$(LAUNCHER): $(LAUNCHER.o) $(LIBJVM) $(LAUNCHER_MAPFILE)
-	$(QUIETLY) { \
-	    echo Linking launcher...; \
-	    $(LINK_LAUNCHER/PRE_HOOK) \
-	    $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(LAUNCHER.o) $(LIBS_LAUNCHER); \
-	    $(LINK_LAUNCHER/POST_HOOK) \
-	    [ -f $(LAUNCHER_G) ] || { ln -s $@ $(LAUNCHER_G); }; \
-        }
+SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
+SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
+
+OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
+
+DEPFILES := $(patsubst %.o,%.d,$(OBJS))
+-include $(DEPFILES)
+
+$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
+	$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
+	$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CPPFLAGS)
+
+$(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
+	$(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
+	$(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CPPFLAGS)
+
+$(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
+	$(QUIETLY) echo Linking launcher...
+	$(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
+	$(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(OBJS) $(LIBS_LAUNCHER)
+	$(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
+
+$(LAUNCHER): $(LAUNCHER_SCRIPT)
+
+$(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
+	$(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
+	$(QUIETLY) chmod +x $@
+
--- a/make/bsd/makefiles/makedeps.make	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#
-# Copyright (c) 2000, 2008, 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.
-#  
-#
-
-include $(GAMMADIR)/make/bsd/makefiles/rules.make
-
-COMPILE.JAVAC.FLAGS += -d $(OUTDIR)
-
-MakeDepsSources=\
-	$(GAMMADIR)/src/share/tools/MakeDeps/Database.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/DirectoryTree.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/DirectoryTreeNode.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/FileFormatException.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/FileList.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/FileName.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/Macro.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/MacroDefinitions.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/MakeDeps.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/MetroWerksMacPlatform.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/Platform.java \
-	$(GAMMADIR)/src/share/tools/MakeDeps/UnixPlatform.java        
-
-MakeDepsOptions=
--- a/make/bsd/makefiles/mapfile-vers-debug	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/mapfile-vers-debug	Sat Jan 22 22:41:33 2011 -0800
@@ -3,7 +3,7 @@
 #
 
 #
-# Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2010, 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
--- a/make/bsd/makefiles/mapfile-vers-product	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/mapfile-vers-product	Sat Jan 22 22:41:33 2011 -0800
@@ -3,7 +3,7 @@
 #
 
 #
-# Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2010, 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
--- a/make/bsd/makefiles/product.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/product.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, 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
--- a/make/bsd/makefiles/rules.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/rules.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2010, 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
@@ -151,20 +151,20 @@
 %.o: %.cpp
 	@echo Compiling $<
 	$(QUIETLY) $(REMOVE_TARGET)
-	$(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
+	$(QUIETLY) $(COMPILE.CC) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
 else
 %.o: %.cpp
 	@echo Compiling $<
 	$(QUIETLY) $(REMOVE_TARGET)
 	$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
-	   $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \
-	   $(COMPILE.CC) -o $@ $< $(COMPILE_DONE))
+	   $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \
+	   $(COMPILE.CC) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE))
 endif
 
 %.o: %.s
 	@echo Assembling $<
 	$(QUIETLY) $(REMOVE_TARGET)
-	$(QUIETLY) $(AS.S) -o $@ $< $(COMPILE_DONE)
+	$(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
 
 %.s: %.cpp
 	@echo Generating assembly for $<
--- a/make/bsd/makefiles/saproc.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/saproc.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, 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
@@ -66,10 +66,12 @@
 # if $(AGENT_DIR) does not exist, we don't build SA
 # also, we don't build SA on Itanium, PPC, ARM or zero.
 
-checkAndBuildSA:
-	$(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" -a "$(SRCARCH)" != "arm" -a "$(SRCARCH)" != "ppc" -a "$(SRCARCH)" != "zero" ] ; then \
-	   $(MAKE) -f vm.make $(LIBSAPROC); \
-	fi
+ifneq ($(wildcard $(AGENT_DIR)),)
+ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
+  BUILDLIBSAPROC = $(LIBSAPROC)
+endif
+endif
+
 
 ifneq ($(OS_VENDOR), Darwin)
 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
@@ -95,10 +97,10 @@
 	           $(SALIBS)
 	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 
-install_saproc: checkAndBuildSA
+install_saproc: $(BUILDLIBSAPROC)
 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
 	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
 	  cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
 	fi
 
-.PHONY: checkAndBuildSA install_saproc
+.PHONY: install_saproc
--- a/make/bsd/makefiles/shark.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/shark.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2008, 2010 Red Hat, Inc.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
--- a/make/bsd/makefiles/sparc.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/sparc.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, 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
@@ -22,6 +22,3 @@
 #  
 #
 
-# Not included in includeDB because it has no dependencies
-Obj_Files += bsd_sparc.o
-
--- a/make/bsd/makefiles/sparcWorks.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/sparcWorks.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, 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
@@ -74,6 +74,14 @@
 OPT_CFLAGS+=-xO4
 OPT_CFLAGS/NOOPT=-xO0
 
+# Flags for creating the dependency files.
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
+DEPFLAGS = -xMMD -xMF $(DEP_DIR)/$(@:%=%.d)
+endif
+
+# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
+CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
+
 #------------------------------------------------------------------------
 # Linker flags
 
--- a/make/bsd/makefiles/sparcv9.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/sparcv9.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, 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
@@ -21,10 +21,6 @@
 # questions.
 #  
 
-#
-# Not included in includeDB because it has no dependencies
-Obj_Files += bsd_sparc.o
-
 # gcc 4.0 miscompiles this code in -m64
 OPT_CFLAGS/macro.o = -O0
 
--- a/make/bsd/makefiles/top.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/top.make	Sat Jan 22 22:41:33 2011 -0800
@@ -31,7 +31,7 @@
 #   -generate sa-jdi.jar (JDI binding to core files)
 
 # It assumes the following flags are set:
-# CFLAGS Platform_file, Src_Dirs, SYSDEFS, AOUT, Obj_Files
+# CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files
 
 # -- D. Ungar (5/97) from a file by Bill Bush
 
@@ -45,10 +45,6 @@
 Plat_File   = $(Platform_file)
 CDG         = cd $(GENERATED); 
 
-# Pick up MakeDeps' sources and definitions
-include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/makedeps.make
-MakeDepsClass = MakeDeps.class
-
 ifdef USE_PRECOMPILED_HEADER
 PrecompiledOption = -DUSE_PRECOMPILED_HEADER
 UpdatePCH         = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) 
@@ -57,33 +53,7 @@
 PrecompiledOption = 
 endif
 
-MakeDeps    = $(RUN.JAVA) $(PrecompiledOption) -classpath $(GENERATED) MakeDeps
-
-Include_DBs/GC          = $(VM)/includeDB_gc \
-                          $(VM)/includeDB_gc_parallel \
-                          $(VM)/gc_implementation/includeDB_gc_parallelScavenge \
-                          $(VM)/gc_implementation/includeDB_gc_concurrentMarkSweep \
-                          $(VM)/gc_implementation/includeDB_gc_parNew \
-                          $(VM)/gc_implementation/includeDB_gc_g1     \
-                          $(VM)/gc_implementation/includeDB_gc_serial \
-                          $(VM)/gc_implementation/includeDB_gc_shared
-
-Include_DBs/CORE        = $(VM)/includeDB_core   $(Include_DBs/GC) \
-                          $(VM)/includeDB_jvmti \
-                          $(VM)/includeDB_features
-Include_DBs/COMPILER1   = $(Include_DBs/CORE) $(VM)/includeDB_compiler1
-Include_DBs/COMPILER2   = $(Include_DBs/CORE) $(VM)/includeDB_compiler2
-Include_DBs/TIERED      = $(Include_DBs/CORE) $(VM)/includeDB_compiler1 $(VM)/includeDB_compiler2
-Include_DBs/ZERO        = $(Include_DBs/CORE) $(VM)/includeDB_zero
-Include_DBs/SHARK       = $(Include_DBs/ZERO) $(VM)/includeDB_shark
-Include_DBs = $(Include_DBs/$(TYPE))
-
 Cached_plat = $(GENERATED)/platform.current
-Cached_db   = $(GENERATED)/includeDB.current
-
-Incremental_Lists = $(Cached_db)
-# list generation also creates $(GENERATED)/$(Cached_plat)
-
 
 AD_Dir   = $(GENERATED)/adfiles
 ADLC     = $(AD_Dir)/adlc
@@ -102,7 +72,7 @@
 MFLAGS-adjusted = -r `$(adjust-mflags) "$(MFLAGS)" "$(HOTSPOT_BUILD_JOBS)"`
 
 
-# default target: make makeDeps, update lists, make vm
+# default target: update lists, make vm
 # done in stages to force sequential order with parallel make
 #
 
@@ -110,39 +80,18 @@
 	@echo All done.
 
 # This is an explicit dependency for the sake of parallel makes.
-vm_build_preliminaries:  checks $(Incremental_Lists) $(AD_Files_If_Required) jvmti_stuff sa_stuff
+vm_build_preliminaries:  checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff sa_stuff
 	@# We need a null action here, so implicit rules don't get consulted.
 
-# make makeDeps: (and zap the cached db files to force a nonincremental run)
-
-$(GENERATED)/$(MakeDepsClass): $(MakeDepsSources)
-	@$(REMOTE) $(COMPILE.JAVAC) -classpath $(GAMMADIR)/src/share/tools/MakeDeps -d $(GENERATED) $(MakeDepsSources)
-	@echo Removing $(Incremental_Lists) to force regeneration.
-	@rm -f $(Incremental_Lists)
-	@$(CDG) echo >$(Cached_plat)
-
-# make incremental_lists, if cached files out of date, run makeDeps
-
-$(Incremental_Lists): $(Include_DBs) $(Plat_File) $(GENERATED)/$(MakeDepsClass)
-	$(CDG) cat $(Include_DBs) > $(GENERATED)/includeDB
-	$(CDG) if [ ! -r incls ] ; then \
-	mkdir incls ; \
-	fi
-	$(CDG) (echo $(CDG) echo $(MakeDeps) diffs UnixPlatform $(Cached_plat) $(Cached_db) $(Plat_File) $(GENERATED)/includeDB $(MakeDepsOptions)) > makeDeps.sh
-	$(CDG) $(REMOTE) sh $(GENERATED)/makeDeps.sh
-	$(CDG) cp includeDB    $(Cached_db)
+$(Cached_plat): $(Plat_File)
 	$(CDG) cp $(Plat_File) $(Cached_plat)
 
-# symbolic target for command lines
-lists: $(Incremental_Lists)
-	@: lists are now up to date
-
 # make AD files as necessary
-ad_stuff: $(Incremental_Lists) $(adjust-mflags)
+ad_stuff: $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f adlc.make $(MFLAGS-adjusted)
 
 # generate JVMTI files from the spec
-jvmti_stuff: $(Incremental_Lists) $(adjust-mflags)
+jvmti_stuff: $(Cached_plat) $(adjust-mflags)
 	@$(MAKE) -f jvmti.make $(MFLAGS-adjusted)
 
 # generate SA jar files and native header
@@ -169,7 +118,7 @@
 install: the_vm
 	@$(MAKE) -f vm.make install
 
-# next rules support "make foo.[oi]"
+# next rules support "make foo.[ois]"
 
 %.o %.i %.s:
 	$(UpdatePCH) 
@@ -179,7 +128,6 @@
 # this should force everything to be rebuilt
 clean: 
 	rm -f $(GENERATED)/*.class
-	$(MAKE) $(MFLAGS) $(GENERATED)/$(MakeDepsClass)
 	$(MAKE) -f vm.make $(MFLAGS) clean
 
 # just in case it doesn't, this should do it
--- a/make/bsd/makefiles/vm.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/vm.make	Sat Jan 22 22:41:33 2011 -0800
@@ -35,9 +35,10 @@
 # Defs
 
 GENERATED     = ../generated
+DEP_DIR       = $(GENERATED)/dependencies
 
-# read a generated file defining the set of .o's and the .o .h dependencies
-include $(GENERATED)/Dependencies
+# reads the generated files defining the set of .o's and the .o .h dependencies
+-include $(DEP_DIR)/*.d
 
 # read machine-specific adjustments (%%% should do this via buildtree.make?)
 ifeq ($(ZERO_BUILD), true)
@@ -47,16 +48,16 @@
 endif
 
 # set VPATH so make knows where to look for source files
-# Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
-# The incls directory contains generated header file lists for inclusion.
+# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
 # The adfiles directory contains ad_<arch>.[ch]pp.
 # The jvmtifiles directory contains jvmti*.[ch]pp
-Src_Dirs_V = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)/incls
-VPATH    += $(Src_Dirs_V:%=%:)
+Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles
+VPATH += $(Src_Dirs_V:%=%:)
 
-# set INCLUDES for C preprocessor
-Src_Dirs_I = $(PRECOMPILED_HEADER_DIR) $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)
-INCLUDES += $(Src_Dirs_I:%=-I%)
+# set INCLUDES for C preprocessor.
+Src_Dirs_I += $(GENERATED)
+# The order is important for the precompiled headers to work.
+INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
 
 ifeq (${VERSION}, debug)
   SYMFLAG = -g
@@ -128,6 +129,64 @@
   LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 endif
 
+CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \))
+CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm
+CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm
+CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm
+CORE_PATHS += $(GENERATED)/jvmtifiles
+
+COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1
+
+COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto
+COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt
+COMPILER2_PATHS +=  $(GENERATED)/adfiles
+
+# Include dirs per type.
+Src_Dirs/CORE      := $(CORE_PATHS)
+Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
+Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
+Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
+Src_Dirs/ZERO      := $(CORE_PATHS)
+Src_Dirs/SHARK     := $(CORE_PATHS)
+Src_Dirs := $(Src_Dirs/$(TYPE))
+
+COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp chaitin\* c2_\* runtime_\*
+COMPILER1_SPECIFIC_FILES := c1_\*
+SHARK_SPECIFIC_FILES     := shark
+ZERO_SPECIFIC_FILES      := zero
+
+# Always exclude these.
+Src_Files_EXCLUDE := jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
+
+# Exclude per type.
+Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
+Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
+Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES)
+
+Src_Files_EXCLUDE +=  $(Src_Files_EXCLUDE/$(TYPE))
+
+# Special handling of arch model.
+ifeq ($(Platform_arch_model), x86_32)
+Src_Files_EXCLUDE += \*x86_64\*
+endif
+ifeq ($(Platform_arch_model), x86_64)
+Src_Files_EXCLUDE += \*x86_32\*
+endif
+
+# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
+define findsrc
+	$(notdir $(shell find $(1)/. ! -name . -prune \
+		-a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \
+		-a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \)))
+endef
+
+Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e)))
+
+Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))))
+
 JVM_OBJ_FILES = $(Obj_Files)
 
 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
@@ -188,10 +247,10 @@
 
 
 # rule for building precompiled header
-$(PRECOMPILED_HEADER): $(Precompiled_Files)
+$(PRECOMPILED_HEADER):
 	$(QUIETLY) echo Generating precompiled header $@
-	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)/incls
-	$(QUIETLY) $(COMPILE.CC) -x c++-header -c $(GENERATED)/incls/_precompiled.incl -o $@ $(COMPILE_DONE)
+	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
+	$(QUIETLY) $(COMPILE.CC) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
 
 # making the library:
 
@@ -244,7 +303,7 @@
 
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) checkAndBuildSA
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
 
 install: install_jvm install_jsig install_saproc
 
--- a/make/bsd/makefiles/zero.make	Sat Jan 22 22:27:24 2011 -0800
+++ b/make/bsd/makefiles/zero.make	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2009 Red Hat, Inc.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
@@ -25,7 +25,7 @@
 
 # Setup for Zero (non-Shark) version of VM
 
-# Select which includeDB files to use (in top.make)
+# Select which files to use (in top.make)
 TYPE = ZERO
 
 # Install libjvm.so, etc in in server directory.
--- a/make/templates/bsd-header	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-Copyright (c) %YEARS%, Oracle and/or its affiliates. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-  - Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-  - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
-
-  - Neither the name of Oracle nor the names of its
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- a/src/cpu/x86/vm/bytes_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/bytes_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -81,6 +81,9 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "bytes_windows_x86.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "bytes_bsd_x86.inline.hpp"
+#endif
 
 
 #endif // CPU_X86_VM_BYTES_X86_HPP
--- a/src/cpu/x86/vm/copy_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/copy_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "copy_windows_x86.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "copy_bsd_x86.inline.hpp"
+#endif
 
 
 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -45,6 +45,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 // Implementation of InterpreterMacroAssembler
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -45,6 +45,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 // Implementation of InterpreterMacroAssembler
--- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -47,6 +47,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -47,6 +47,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/x86/vm/stubRoutines_x86_32.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/stubRoutines_x86_32.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Implementation of the platform-specific part of StubRoutines - for
 // a description of how to extend it, see the stubRoutines.hpp file.
--- a/src/cpu/x86/vm/stubRoutines_x86_64.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/stubRoutines_x86_64.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Implementation of the platform-specific part of StubRoutines - for
 // a description of how to extend it, see the stubRoutines.hpp file.
--- a/src/cpu/x86/vm/vm_version_x86.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/x86/vm/vm_version_x86.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 int VM_Version::_cpu;
--- a/src/cpu/zero/vm/bytes_zero.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/zero/vm/bytes_zero.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -168,6 +168,9 @@
 #ifdef TARGET_OS_ARCH_linux_zero
 # include "bytes_linux_zero.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "bytes_bsd_zero.inline.hpp"
+#endif
 
 #endif // VM_LITTLE_ENDIAN
 
--- a/src/cpu/zero/vm/interp_masm_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/zero/vm/interp_masm_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -40,5 +40,8 @@
 #ifdef TARGET_OS_FAMILY_linux
 # include "thread_linux.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // This file is intentionally empty
--- a/src/cpu/zero/vm/stubGenerator_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/zero/vm/stubGenerator_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -43,6 +43,9 @@
 #ifdef TARGET_OS_FAMILY_linux
 # include "thread_linux.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/zero/vm/stubRoutines_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/zero/vm/stubRoutines_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -30,6 +30,9 @@
 #ifdef TARGET_OS_FAMILY_linux
 # include "thread_linux.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifdef IA32
 address StubRoutines::x86::_call_stub_compiled_return = NULL;
--- a/src/cpu/zero/vm/vm_version_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/cpu/zero/vm/vm_version_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -32,5 +32,8 @@
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 // This file is intentionally empty
--- a/src/os/bsd/launcher/java.c	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1842 +0,0 @@
-/*
- * Copyright (c) 1999, 2008, 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.
- *
- */
-
-/*
- * Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
- * search "GAMMA" for gamma specific changes.
- *
- * GAMMA: gamma launcher is much simpler than regular java launcher in that
- *        JVM is either statically linked in or it is installed in the
- *        same directory where the launcher exists, so we don't have to
- *        worry about choosing the right JVM based on command line flag, jar
- *        file and/or ergonomics. Intead of removing unused logic from source
- *        they are commented out with #ifndef GAMMA, hopefully it'll be easier
- *        to maintain this file in sync with regular JDK launcher.
- */
-
-/*
- * Shared source for 'java' command line tool.
- *
- * If JAVA_ARGS is defined, then acts as a launcher for applications. For
- * instance, the JDK command line tools such as javac and javadoc (see
- * makefiles for more details) are built with this program.  Any arguments
- * prefixed with '-J' will be passed directly to the 'java' command.
- */
-
-#ifdef GAMMA
-#  ifdef JAVA_ARGS
-#    error Do NOT define JAVA_ARGS when building gamma launcher
-#  endif
-#  if !defined(LINK_INTO_AOUT) && !defined(LINK_INTO_LIBJVM)
-#    error Either LINK_INTO_AOUT or LINK_INTO_LIBJVM must be defined
-#  endif
-#endif
-
-/*
- * One job of the launcher is to remove command line options which the
- * vm does not understand and will not process.  These options include
- * options which select which style of vm is run (e.g. -client and
- * -server) as well as options which select the data model to use.
- * Additionally, for tools which invoke an underlying vm "-J-foo"
- * options are turned into "-foo" options to the vm.  This option
- * filtering is handled in a number of places in the launcher, some of
- * it in machine-dependent code.  In this file, the function
- * CheckJVMType removes vm style options and TranslateDashJArgs
- * removes "-J" prefixes.  On unix platforms, the
- * CreateExecutionEnvironment function from the unix java_md.c file
- * processes and removes -d<n> options.  However, in case
- * CreateExecutionEnvironment does not need to exec because
- * LD_LIBRARY_PATH is set acceptably and the data model does not need
- * to be changed, ParseArguments will screen out the redundant -d<n>
- * options and prevent them from being passed to the vm; this is done
- * by using the machine-dependent call
- * RemovableMachineDependentOption.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <jni.h>
-#include "java.h"
-
-#ifndef GAMMA
-#include "manifest_info.h"
-#include "version_comp.h"
-#endif
-
-#ifndef FULL_VERSION
-#define FULL_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
-#endif
-
-/*
- * The following environment variable is used to influence the behavior
- * of the jre exec'd through the SelectVersion routine.  The command line
- * options which specify the version are not passed to the exec'd version,
- * because that jre may be an older version which wouldn't recognize them.
- * This environment variable is known to this (and later) version and serves
- * to suppress the version selection code.  This is not only for efficiency,
- * but also for correctness, since any command line options have been
- * removed which would cause any value found in the manifest to be used.
- * This would be incorrect because the command line options are defined
- * to take precedence.
- *
- * The value associated with this environment variable is the MainClass
- * name from within the executable jar file (if any). This is strictly a
- * performance enhancement to avoid re-reading the jar file manifest.
- *
- * A NOTE TO DEVELOPERS: For performance reasons it is important that
- * the program image remain relatively small until after SelectVersion
- * CreateExecutionEnvironment have finished their possibly recursive
- * processing. Watch everything, but resist all temptations to use Java
- * interfaces.
- */
-#define ENV_ENTRY "_JAVA_VERSION_SET"
-
-static jboolean printVersion = JNI_FALSE; /* print and exit */
-static jboolean showVersion = JNI_FALSE;  /* print but continue */
-static char *progname;
-jboolean _launcher_debug = JNI_FALSE;
-
-/*
- * List of VM options to be specified when the VM is created.
- */
-static JavaVMOption *options;
-static int numOptions, maxOptions;
-
-/*
- * Prototypes for functions internal to launcher.
- */
-static void AddOption(char *str, void *info);
-static void SetClassPath(char *s);
-static void SelectVersion(int argc, char **argv, char **main_class);
-static jboolean ParseArguments(int *pargc, char ***pargv, char **pjarfile,
-                               char **pclassname, int *pret);
-static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
-                              InvocationFunctions *ifn);
-static jstring NewPlatformString(JNIEnv *env, char *s);
-static jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc);
-static jclass LoadClass(JNIEnv *env, char *name);
-static jstring GetMainClassName(JNIEnv *env, char *jarname);
-static void SetJavaCommandLineProp(char* classname, char* jarfile, int argc, char** argv);
-#ifdef GAMMA
-static void SetJavaLauncherProp(void);
-#endif
-
-#ifdef JAVA_ARGS
-static void TranslateDashJArgs(int *pargc, char ***pargv);
-static jboolean AddApplicationOptions(void);
-#endif
-
-static void PrintJavaVersion(JNIEnv *env);
-static void PrintUsage(void);
-static jint PrintXUsage(void);
-
-static void SetPaths(int argc, char **argv);
-
-/* Maximum supported entries from jvm.cfg. */
-#define INIT_MAX_KNOWN_VMS      10
-/* Values for vmdesc.flag */
-#define VM_UNKNOWN              -1
-#define VM_KNOWN                 0
-#define VM_ALIASED_TO            1
-#define VM_WARN                  2
-#define VM_ERROR                 3
-#define VM_IF_SERVER_CLASS       4
-#define VM_IGNORE                5
-struct vmdesc {
-    char *name;
-    int flag;
-    char *alias;
-    char *server_class;
-};
-static struct vmdesc *knownVMs = NULL;
-static int knownVMsCount = 0;
-static int knownVMsLimit = 0;
-
-static void GrowKnownVMs();
-static int  KnownVMIndex(const char* name);
-static void FreeKnownVMs();
-
-jboolean ServerClassMachine();
-
-/* flag which if set suppresses error messages from the launcher */
-static int noExitErrorMessage = 0;
-
-/*
- * Entry point.
- */
-int
-main(int argc, char ** argv)
-{
-    JavaVM *vm = 0;
-    JNIEnv *env = 0;
-    char *jarfile = 0;
-    char *classname = 0;
-    char *s = 0;
-    char *main_class = NULL;
-    jstring mainClassName;
-    jclass mainClass;
-    jmethodID mainID;
-    jobjectArray mainArgs;
-    int ret;
-    InvocationFunctions ifn;
-    jlong start, end;
-    char jrepath[MAXPATHLEN], jvmpath[MAXPATHLEN];
-    char ** original_argv = argv;
-
-    /*
-     * Error message to print or display; by default the message will
-     * only be displayed in a window.
-     */
-    char * message = "Fatal exception occurred.  Program will exit.";
-    jboolean messageDest = JNI_FALSE;
-
-    if (getenv("_JAVA_LAUNCHER_DEBUG") != 0) {
-        _launcher_debug = JNI_TRUE;
-        printf("----_JAVA_LAUNCHER_DEBUG----\n");
-    }
-
-#ifndef GAMMA
-    /*
-     * Make sure the specified version of the JRE is running.
-     *
-     * There are three things to note about the SelectVersion() routine:
-     *  1) If the version running isn't correct, this routine doesn't
-     *     return (either the correct version has been exec'd or an error
-     *     was issued).
-     *  2) Argc and Argv in this scope are *not* altered by this routine.
-     *     It is the responsibility of subsequent code to ignore the
-     *     arguments handled by this routine.
-     *  3) As a side-effect, the variable "main_class" is guaranteed to
-     *     be set (if it should ever be set).  This isn't exactly the
-     *     poster child for structured programming, but it is a small
-     *     price to pay for not processing a jar file operand twice.
-     *     (Note: This side effect has been disabled.  See comment on
-     *     bugid 5030265 below.)
-     */
-    SelectVersion(argc, argv, &main_class);
-#endif /* ifndef GAMMA */
-
-    /* copy original argv */
-    {
-      int i;
-      original_argv = (char**)MemAlloc(sizeof(char*)*(argc+1));
-      for(i = 0; i < argc+1; i++)
-        original_argv[i] = argv[i];
-    }
-
-    CreateExecutionEnvironment(&argc, &argv,
-                               jrepath, sizeof(jrepath),
-                               jvmpath, sizeof(jvmpath),
-                               original_argv);
-    ifn.CreateJavaVM = 0;
-    ifn.GetDefaultJavaVMInitArgs = 0;
-
-    if (_launcher_debug)
-      start = CounterGet();
-    if (!LoadJavaVM(jvmpath, &ifn)) {
-      exit(6);
-    }
-    if (_launcher_debug) {
-      end   = CounterGet();
-      printf("%ld micro seconds to LoadJavaVM\n",
-             (long)(jint)Counter2Micros(end-start));
-    }
-
-#ifdef JAVA_ARGS  /* javac, jar and friends. */
-    progname = "java";
-#else             /* java, oldjava, javaw and friends */
-#ifdef PROGNAME
-    progname = PROGNAME;
-#else
-    progname = *argv;
-    if ((s = strrchr(progname, FILE_SEPARATOR)) != 0) {
-        progname = s + 1;
-    }
-#endif /* PROGNAME */
-#endif /* JAVA_ARGS */
-    ++argv;
-    --argc;
-
-#ifdef JAVA_ARGS
-    /* Preprocess wrapper arguments */
-    TranslateDashJArgs(&argc, &argv);
-    if (!AddApplicationOptions()) {
-        exit(1);
-    }
-#endif
-
-    /* Set default CLASSPATH */
-    if ((s = getenv("CLASSPATH")) == 0) {
-        s = ".";
-    }
-#ifndef JAVA_ARGS
-    SetClassPath(s);
-#endif
-
-    /*
-     *  Parse command line options; if the return value of
-     *  ParseArguments is false, the program should exit.
-     */
-    if (!ParseArguments(&argc, &argv, &jarfile, &classname, &ret)) {
-      exit(ret);
-    }
-
-    /* Override class path if -jar flag was specified */
-    if (jarfile != 0) {
-        SetClassPath(jarfile);
-    }
-
-    /* set the -Dsun.java.command pseudo property */
-    SetJavaCommandLineProp(classname, jarfile, argc, argv);
-
-#ifdef GAMMA
-    /* Set the -Dsun.java.launcher pseudo property */
-    SetJavaLauncherProp();
-#endif
-
-    /*
-     * Done with all command line processing and potential re-execs so
-     * clean up the environment.
-     */
-    (void)UnsetEnv(ENV_ENTRY);
-
-    /* Initialize the virtual machine */
-
-    if (_launcher_debug)
-        start = CounterGet();
-    if (!InitializeJVM(&vm, &env, &ifn)) {
-        ReportErrorMessage("Could not create the Java virtual machine.",
-                           JNI_TRUE);
-        exit(1);
-    }
-
-    if (printVersion || showVersion) {
-        PrintJavaVersion(env);
-        if ((*env)->ExceptionOccurred(env)) {
-            ReportExceptionDescription(env);
-            goto leave;
-        }
-        if (printVersion) {
-            ret = 0;
-            message = NULL;
-            goto leave;
-        }
-        if (showVersion) {
-            fprintf(stderr, "\n");
-        }
-    }
-
-    /* If the user specified neither a class name nor a JAR file */
-    if (jarfile == 0 && classname == 0) {
-        PrintUsage();
-        message = NULL;
-        goto leave;
-    }
-
-#ifndef GAMMA
-    FreeKnownVMs();  /* after last possible PrintUsage() */
-#endif
-
-    if (_launcher_debug) {
-        end   = CounterGet();
-        printf("%ld micro seconds to InitializeJVM\n",
-               (long)(jint)Counter2Micros(end-start));
-    }
-
-    /* At this stage, argc/argv have the applications' arguments */
-    if (_launcher_debug) {
-        int i = 0;
-        printf("Main-Class is '%s'\n", classname ? classname : "");
-        printf("Apps' argc is %d\n", argc);
-        for (; i < argc; i++) {
-            printf("    argv[%2d] = '%s'\n", i, argv[i]);
-        }
-    }
-
-    ret = 1;
-
-    /*
-     * Get the application's main class.
-     *
-     * See bugid 5030265.  The Main-Class name has already been parsed
-     * from the manifest, but not parsed properly for UTF-8 support.
-     * Hence the code here ignores the value previously extracted and
-     * uses the pre-existing code to reextract the value.  This is
-     * possibly an end of release cycle expedient.  However, it has
-     * also been discovered that passing some character sets through
-     * the environment has "strange" behavior on some variants of
-     * Windows.  Hence, maybe the manifest parsing code local to the
-     * launcher should never be enhanced.
-     *
-     * Hence, future work should either:
-     *     1)   Correct the local parsing code and verify that the
-     *          Main-Class attribute gets properly passed through
-     *          all environments,
-     *     2)   Remove the vestages of maintaining main_class through
-     *          the environment (and remove these comments).
-     */
-    if (jarfile != 0) {
-        mainClassName = GetMainClassName(env, jarfile);
-        if ((*env)->ExceptionOccurred(env)) {
-            ReportExceptionDescription(env);
-            goto leave;
-        }
-        if (mainClassName == NULL) {
-          const char * format = "Failed to load Main-Class manifest "
-                                "attribute from\n%s";
-          message = (char*)MemAlloc((strlen(format) + strlen(jarfile)) *
-                                    sizeof(char));
-          sprintf(message, format, jarfile);
-          messageDest = JNI_TRUE;
-          goto leave;
-        }
-        classname = (char *)(*env)->GetStringUTFChars(env, mainClassName, 0);
-        if (classname == NULL) {
-            ReportExceptionDescription(env);
-            goto leave;
-        }
-        mainClass = LoadClass(env, classname);
-        if(mainClass == NULL) { /* exception occurred */
-            ReportExceptionDescription(env);
-            message = "Could not find the main class.  Program will exit.";
-            goto leave;
-        }
-        (*env)->ReleaseStringUTFChars(env, mainClassName, classname);
-    } else {
-      mainClassName = NewPlatformString(env, classname);
-      if (mainClassName == NULL) {
-        const char * format = "Failed to load Main Class: %s";
-        message = (char *)MemAlloc((strlen(format) + strlen(classname)) *
-                                   sizeof(char) );
-        sprintf(message, format, classname);
-        messageDest = JNI_TRUE;
-        goto leave;
-      }
-      classname = (char *)(*env)->GetStringUTFChars(env, mainClassName, 0);
-      if (classname == NULL) {
-        ReportExceptionDescription(env);
-        goto leave;
-      }
-      mainClass = LoadClass(env, classname);
-      if(mainClass == NULL) { /* exception occurred */
-        ReportExceptionDescription(env);
-        message = "Could not find the main class. Program will exit.";
-        goto leave;
-      }
-      (*env)->ReleaseStringUTFChars(env, mainClassName, classname);
-    }
-
-    /* Get the application's main method */
-    mainID = (*env)->GetStaticMethodID(env, mainClass, "main",
-                                       "([Ljava/lang/String;)V");
-    if (mainID == NULL) {
-        if ((*env)->ExceptionOccurred(env)) {
-            ReportExceptionDescription(env);
-        } else {
-          message = "No main method found in specified class.";
-          messageDest = JNI_TRUE;
-        }
-        goto leave;
-    }
-
-    {    /* Make sure the main method is public */
-        jint mods;
-        jmethodID mid;
-        jobject obj = (*env)->ToReflectedMethod(env, mainClass,
-                                                mainID, JNI_TRUE);
-
-        if( obj == NULL) { /* exception occurred */
-            ReportExceptionDescription(env);
-            goto leave;
-        }
-
-        mid =
-          (*env)->GetMethodID(env,
-                              (*env)->GetObjectClass(env, obj),
-                              "getModifiers", "()I");
-        if ((*env)->ExceptionOccurred(env)) {
-            ReportExceptionDescription(env);
-            goto leave;
-        }
-
-        mods = (*env)->CallIntMethod(env, obj, mid);
-        if ((mods & 1) == 0) { /* if (!Modifier.isPublic(mods)) ... */
-            message = "Main method not public.";
-            messageDest = JNI_TRUE;
-            goto leave;
-        }
-    }
-
-    /* Build argument array */
-    mainArgs = NewPlatformStringArray(env, argv, argc);
-    if (mainArgs == NULL) {
-        ReportExceptionDescription(env);
-        goto leave;
-    }
-
-    /* Invoke main method. */
-    (*env)->CallStaticVoidMethod(env, mainClass, mainID, mainArgs);
-
-    /*
-     * The launcher's exit code (in the absence of calls to
-     * System.exit) will be non-zero if main threw an exception.
-     */
-    ret = (*env)->ExceptionOccurred(env) == NULL ? 0 : 1;
-
-    /*
-     * Detach the main thread so that it appears to have ended when
-     * the application's main method exits.  This will invoke the
-     * uncaught exception handler machinery if main threw an
-     * exception.  An uncaught exception handler cannot change the
-     * launcher's return code except by calling System.exit.
-     */
-    if ((*vm)->DetachCurrentThread(vm) != 0) {
-        message = "Could not detach main thread.";
-        messageDest = JNI_TRUE;
-        ret = 1;
-        goto leave;
-    }
-
-    message = NULL;
-
- leave:
-    /*
-     * Wait for all non-daemon threads to end, then destroy the VM.
-     * This will actually create a trivial new Java waiter thread
-     * named "DestroyJavaVM", but this will be seen as a different
-     * thread from the one that executed main, even though they are
-     * the same C thread.  This allows mainThread.join() and
-     * mainThread.isAlive() to work as expected.
-     */
-    (*vm)->DestroyJavaVM(vm);
-
-    if(message != NULL && !noExitErrorMessage)
-      ReportErrorMessage(message, messageDest);
-    return ret;
-}
-
-
-#ifndef GAMMA
-/*
- * Checks the command line options to find which JVM type was
- * specified.  If no command line option was given for the JVM type,
- * the default type is used.  The environment variable
- * JDK_ALTERNATE_VM and the command line option -XXaltjvm= are also
- * checked as ways of specifying which JVM type to invoke.
- */
-char *
-CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
-    int i, argi;
-    int argc;
-    char **newArgv;
-    int newArgvIdx = 0;
-    int isVMType;
-    int jvmidx = -1;
-    char *jvmtype = getenv("JDK_ALTERNATE_VM");
-
-    argc = *pargc;
-
-    /* To make things simpler we always copy the argv array */
-    newArgv = MemAlloc((argc + 1) * sizeof(char *));
-
-    /* The program name is always present */
-    newArgv[newArgvIdx++] = (*argv)[0];
-
-    for (argi = 1; argi < argc; argi++) {
-        char *arg = (*argv)[argi];
-        isVMType = 0;
-
-#ifdef JAVA_ARGS
-        if (arg[0] != '-') {
-            newArgv[newArgvIdx++] = arg;
-            continue;
-        }
-#else
-        if (strcmp(arg, "-classpath") == 0 ||
-            strcmp(arg, "-cp") == 0) {
-            newArgv[newArgvIdx++] = arg;
-            argi++;
-            if (argi < argc) {
-                newArgv[newArgvIdx++] = (*argv)[argi];
-            }
-            continue;
-        }
-        if (arg[0] != '-') break;
-#endif
-
-        /* Did the user pass an explicit VM type? */
-        i = KnownVMIndex(arg);
-        if (i >= 0) {
-            jvmtype = knownVMs[jvmidx = i].name + 1; /* skip the - */
-            isVMType = 1;
-            *pargc = *pargc - 1;
-        }
-
-        /* Did the user specify an "alternate" VM? */
-        else if (strncmp(arg, "-XXaltjvm=", 10) == 0 || strncmp(arg, "-J-XXaltjvm=", 12) == 0) {
-            isVMType = 1;
-            jvmtype = arg+((arg[1]=='X')? 10 : 12);
-            jvmidx = -1;
-        }
-
-        if (!isVMType) {
-            newArgv[newArgvIdx++] = arg;
-        }
-    }
-
-    /*
-     * Finish copying the arguments if we aborted the above loop.
-     * NOTE that if we aborted via "break" then we did NOT copy the
-     * last argument above, and in addition argi will be less than
-     * argc.
-     */
-    while (argi < argc) {
-        newArgv[newArgvIdx++] = (*argv)[argi];
-        argi++;
-    }
-
-    /* argv is null-terminated */
-    newArgv[newArgvIdx] = 0;
-
-    /* Copy back argv */
-    *argv = newArgv;
-    *pargc = newArgvIdx;
-
-    /* use the default VM type if not specified (no alias processing) */
-    if (jvmtype == NULL) {
-      char* result = knownVMs[0].name+1;
-      /* Use a different VM type if we are on a server class machine? */
-      if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) &&
-          (ServerClassMachine() == JNI_TRUE)) {
-        result = knownVMs[0].server_class+1;
-      }
-      if (_launcher_debug) {
-        printf("Default VM: %s\n", result);
-      }
-      return result;
-    }
-
-    /* if using an alternate VM, no alias processing */
-    if (jvmidx < 0)
-      return jvmtype;
-
-    /* Resolve aliases first */
-    {
-      int loopCount = 0;
-      while (knownVMs[jvmidx].flag == VM_ALIASED_TO) {
-        int nextIdx = KnownVMIndex(knownVMs[jvmidx].alias);
-
-        if (loopCount > knownVMsCount) {
-          if (!speculative) {
-            ReportErrorMessage("Error: Corrupt jvm.cfg file; cycle in alias list.",
-                               JNI_TRUE);
-            exit(1);
-          } else {
-            return "ERROR";
-            /* break; */
-          }
-        }
-
-        if (nextIdx < 0) {
-          if (!speculative) {
-            ReportErrorMessage2("Error: Unable to resolve VM alias %s",
-                                knownVMs[jvmidx].alias, JNI_TRUE);
-            exit(1);
-          } else {
-            return "ERROR";
-          }
-        }
-        jvmidx = nextIdx;
-        jvmtype = knownVMs[jvmidx].name+1;
-        loopCount++;
-      }
-    }
-
-    switch (knownVMs[jvmidx].flag) {
-    case VM_WARN:
-        if (!speculative) {
-            fprintf(stderr, "Warning: %s VM not supported; %s VM will be used\n",
-                    jvmtype, knownVMs[0].name + 1);
-        }
-        /* fall through */
-    case VM_IGNORE:
-        jvmtype = knownVMs[jvmidx=0].name + 1;
-        /* fall through */
-    case VM_KNOWN:
-        break;
-    case VM_ERROR:
-        if (!speculative) {
-            ReportErrorMessage2("Error: %s VM not supported", jvmtype, JNI_TRUE);
-            exit(1);
-        } else {
-            return "ERROR";
-        }
-    }
-
-    return jvmtype;
-}
-#endif /* ifndef GAMMA */
-
-/*
- * Adds a new VM option with the given given name and value.
- */
-static void
-AddOption(char *str, void *info)
-{
-    /*
-     * Expand options array if needed to accommodate at least one more
-     * VM option.
-     */
-    if (numOptions >= maxOptions) {
-        if (options == 0) {
-            maxOptions = 4;
-            options = MemAlloc(maxOptions * sizeof(JavaVMOption));
-        } else {
-            JavaVMOption *tmp;
-            maxOptions *= 2;
-            tmp = MemAlloc(maxOptions * sizeof(JavaVMOption));
-            memcpy(tmp, options, numOptions * sizeof(JavaVMOption));
-            free(options);
-            options = tmp;
-        }
-    }
-    options[numOptions].optionString = str;
-    options[numOptions++].extraInfo = info;
-}
-
-static void
-SetClassPath(char *s)
-{
-    char *def = MemAlloc(strlen(s) + 40);
-    sprintf(def, "-Djava.class.path=%s", s);
-    AddOption(def, NULL);
-}
-
-#ifndef GAMMA
-/*
- * The SelectVersion() routine ensures that an appropriate version of
- * the JRE is running.  The specification for the appropriate version
- * is obtained from either the manifest of a jar file (preferred) or
- * from command line options.
- */
-static void
-SelectVersion(int argc, char **argv, char **main_class)
-{
-    char    *arg;
-    char    **new_argv;
-    char    **new_argp;
-    char    *operand;
-    char    *version = NULL;
-    char    *jre = NULL;
-    int     jarflag = 0;
-    int     restrict_search = -1;               /* -1 implies not known */
-    manifest_info info;
-    char    env_entry[MAXNAMELEN + 24] = ENV_ENTRY "=";
-    char    *env_in;
-    int     res;
-
-    /*
-     * If the version has already been selected, set *main_class
-     * with the value passed through the environment (if any) and
-     * simply return.
-     */
-    if ((env_in = getenv(ENV_ENTRY)) != NULL) {
-        if (*env_in != '\0')
-            *main_class = strdup(env_in);
-        return;
-    }
-
-    /*
-     * Scan through the arguments for options relevant to multiple JRE
-     * support.  For reference, the command line syntax is defined as:
-     *
-     * SYNOPSIS
-     *      java [options] class [argument...]
-     *
-     *      java [options] -jar file.jar [argument...]
-     *
-     * As the scan is performed, make a copy of the argument list with
-     * the version specification options (new to 1.5) removed, so that
-     * a version less than 1.5 can be exec'd.
-     */
-    new_argv = MemAlloc((argc + 1) * sizeof(char*));
-    new_argv[0] = argv[0];
-    new_argp = &new_argv[1];
-    argc--;
-    argv++;
-    while ((arg = *argv) != 0 && *arg == '-') {
-        if (strncmp(arg, "-version:", 9) == 0) {
-            version = arg + 9;
-        } else if (strcmp(arg, "-jre-restrict-search") == 0) {
-            restrict_search = 1;
-        } else if (strcmp(arg, "-no-jre-restrict-search") == 0) {
-            restrict_search = 0;
-        } else {
-            if (strcmp(arg, "-jar") == 0)
-                jarflag = 1;
-            /* deal with "unfortunate" classpath syntax */
-            if ((strcmp(arg, "-classpath") == 0 || strcmp(arg, "-cp") == 0) &&
-              (argc >= 2)) {
-                *new_argp++ = arg;
-                argc--;
-                argv++;
-                arg = *argv;
-            }
-            *new_argp++ = arg;
-        }
-        argc--;
-        argv++;
-    }
-    if (argc <= 0) {    /* No operand? Possibly legit with -[full]version */
-        operand = NULL;
-    } else {
-        argc--;
-        *new_argp++ = operand = *argv++;
-    }
-    while (argc-- > 0)  /* Copy over [argument...] */
-        *new_argp++ = *argv++;
-    *new_argp = NULL;
-
-    /*
-     * If there is a jar file, read the manifest. If the jarfile can't be
-     * read, the manifest can't be read from the jar file, or the manifest
-     * is corrupt, issue the appropriate error messages and exit.
-     *
-     * Even if there isn't a jar file, construct a manifest_info structure
-     * containing the command line information.  It's a convenient way to carry
-     * this data around.
-     */
-    if (jarflag && operand) {
-        if ((res = parse_manifest(operand, &info)) != 0) {
-            if (res == -1)
-                ReportErrorMessage2("Unable to access jarfile %s",
-                  operand, JNI_TRUE);
-            else
-                ReportErrorMessage2("Invalid or corrupt jarfile %s",
-                  operand, JNI_TRUE);
-            exit(1);
-        }
-    } else {
-        info.manifest_version = NULL;
-        info.main_class = NULL;
-        info.jre_version = NULL;
-        info.jre_restrict_search = 0;
-    }
-
-    /*
-     * The JRE-Version and JRE-Restrict-Search values (if any) from the
-     * manifest are overwritten by any specified on the command line.
-     */
-    if (version != NULL)
-        info.jre_version = version;
-    if (restrict_search != -1)
-        info.jre_restrict_search = restrict_search;
-
-    /*
-     * "Valid" returns (other than unrecoverable errors) follow.  Set
-     * main_class as a side-effect of this routine.
-     */
-    if (info.main_class != NULL)
-        *main_class = strdup(info.main_class);
-
-    /*
-     * If no version selection information is found either on the command
-     * line or in the manifest, simply return.
-     */
-    if (info.jre_version == NULL) {
-        free_manifest();
-        free(new_argv);
-        return;
-    }
-
-    /*
-     * Check for correct syntax of the version specification (JSR 56).
-     */
-    if (!valid_version_string(info.jre_version)) {
-        ReportErrorMessage2("Syntax error in version specification \"%s\"",
-          info.jre_version, JNI_TRUE);
-        exit(1);
-    }
-
-    /*
-     * Find the appropriate JVM on the system. Just to be as forgiving as
-     * possible, if the standard algorithms don't locate an appropriate
-     * jre, check to see if the one running will satisfy the requirements.
-     * This can happen on systems which haven't been set-up for multiple
-     * JRE support.
-     */
-    jre = LocateJRE(&info);
-    if (_launcher_debug)
-        printf("JRE-Version = %s, JRE-Restrict-Search = %s Selected = %s\n",
-          (info.jre_version?info.jre_version:"null"),
-          (info.jre_restrict_search?"true":"false"), (jre?jre:"null"));
-    if (jre == NULL) {
-        if (acceptable_release(FULL_VERSION, info.jre_version)) {
-            free_manifest();
-            free(new_argv);
-            return;
-        } else {
-            ReportErrorMessage2(
-              "Unable to locate JRE meeting specification \"%s\"",
-              info.jre_version, JNI_TRUE);
-            exit(1);
-        }
-    }
-
-    /*
-     * If I'm not the chosen one, exec the chosen one.  Returning from
-     * ExecJRE indicates that I am indeed the chosen one.
-     *
-     * The private environment variable _JAVA_VERSION_SET is used to
-     * prevent the chosen one from re-reading the manifest file and
-     * using the values found within to override the (potential) command
-     * line flags stripped from argv (because the target may not
-     * understand them).  Passing the MainClass value is an optimization
-     * to avoid locating, expanding and parsing the manifest extra
-     * times.
-     */
-    if (info.main_class != NULL)
-        (void)strcat(env_entry, info.main_class);
-    (void)putenv(env_entry);
-    ExecJRE(jre, new_argv);
-    free_manifest();
-    free(new_argv);
-    return;
-}
-#endif /* ifndef GAMMA */
-
-/*
- * Parses command line arguments.  Returns JNI_FALSE if launcher
- * should exit without starting vm (e.g. certain version and usage
- * options); returns JNI_TRUE if vm needs to be started to process
- * given options.  *pret (the launcher process return value) is set to
- * 0 for a normal exit.
- */
-static jboolean
-ParseArguments(int *pargc, char ***pargv, char **pjarfile,
-                       char **pclassname, int *pret)
-{
-    int argc = *pargc;
-    char **argv = *pargv;
-    jboolean jarflag = JNI_FALSE;
-    char *arg;
-
-    *pret = 1;
-    while ((arg = *argv) != 0 && *arg == '-') {
-        argv++; --argc;
-        if (strcmp(arg, "-classpath") == 0 || strcmp(arg, "-cp") == 0) {
-            if (argc < 1) {
-                ReportErrorMessage2("%s requires class path specification",
-                                    arg, JNI_TRUE);
-                PrintUsage();
-                return JNI_FALSE;
-            }
-            SetClassPath(*argv);
-            argv++; --argc;
-        } else if (strcmp(arg, "-jar") == 0) {
-            jarflag = JNI_TRUE;
-        } else if (strcmp(arg, "-help") == 0 ||
-                   strcmp(arg, "-h") == 0 ||
-                   strcmp(arg, "-?") == 0) {
-            PrintUsage();
-            *pret = 0;
-            return JNI_FALSE;
-        } else if (strcmp(arg, "-version") == 0) {
-            printVersion = JNI_TRUE;
-            return JNI_TRUE;
-        } else if (strcmp(arg, "-showversion") == 0) {
-            showVersion = JNI_TRUE;
-        } else if (strcmp(arg, "-X") == 0) {
-            *pret = PrintXUsage();
-            return JNI_FALSE;
-/*
- * The following case provide backward compatibility with old-style
- * command line options.
- */
-        } else if (strcmp(arg, "-fullversion") == 0) {
-            fprintf(stderr, "%s full version \"%s\"\n", progname,
-                    FULL_VERSION);
-            *pret = 0;
-            return JNI_FALSE;
-        } else if (strcmp(arg, "-verbosegc") == 0) {
-            AddOption("-verbose:gc", NULL);
-        } else if (strcmp(arg, "-t") == 0) {
-            AddOption("-Xt", NULL);
-        } else if (strcmp(arg, "-tm") == 0) {
-            AddOption("-Xtm", NULL);
-        } else if (strcmp(arg, "-debug") == 0) {
-            AddOption("-Xdebug", NULL);
-        } else if (strcmp(arg, "-noclassgc") == 0) {
-            AddOption("-Xnoclassgc", NULL);
-        } else if (strcmp(arg, "-Xfuture") == 0) {
-            AddOption("-Xverify:all", NULL);
-        } else if (strcmp(arg, "-verify") == 0) {
-            AddOption("-Xverify:all", NULL);
-        } else if (strcmp(arg, "-verifyremote") == 0) {
-            AddOption("-Xverify:remote", NULL);
-        } else if (strcmp(arg, "-noverify") == 0) {
-            AddOption("-Xverify:none", NULL);
-        } else if (strcmp(arg, "-XXsuppressExitMessage") == 0) {
-            noExitErrorMessage = 1;
-        } else if (strncmp(arg, "-prof", 5) == 0) {
-            char *p = arg + 5;
-            char *tmp = MemAlloc(strlen(arg) + 50);
-            if (*p) {
-                sprintf(tmp, "-Xrunhprof:cpu=old,file=%s", p + 1);
-            } else {
-                sprintf(tmp, "-Xrunhprof:cpu=old,file=java.prof");
-            }
-            AddOption(tmp, NULL);
-        } else if (strncmp(arg, "-ss", 3) == 0 ||
-                   strncmp(arg, "-oss", 4) == 0 ||
-                   strncmp(arg, "-ms", 3) == 0 ||
-                   strncmp(arg, "-mx", 3) == 0) {
-            char *tmp = MemAlloc(strlen(arg) + 6);
-            sprintf(tmp, "-X%s", arg + 1); /* skip '-' */
-            AddOption(tmp, NULL);
-        } else if (strcmp(arg, "-checksource") == 0 ||
-                   strcmp(arg, "-cs") == 0 ||
-                   strcmp(arg, "-noasyncgc") == 0) {
-            /* No longer supported */
-            fprintf(stderr,
-                    "Warning: %s option is no longer supported.\n",
-                    arg);
-        } else if (strncmp(arg, "-version:", 9) == 0 ||
-                   strcmp(arg, "-no-jre-restrict-search") == 0 ||
-                   strcmp(arg, "-jre-restrict-search") == 0) {
-            ; /* Ignore machine independent options already handled */
-        } else if (RemovableMachineDependentOption(arg) ) {
-            ; /* Do not pass option to vm. */
-        }
-        else {
-            AddOption(arg, NULL);
-        }
-    }
-
-    if (--argc >= 0) {
-        if (jarflag) {
-            *pjarfile = *argv++;
-            *pclassname = 0;
-        } else {
-            *pjarfile = 0;
-            *pclassname = *argv++;
-        }
-        *pargc = argc;
-        *pargv = argv;
-    }
-
-    return JNI_TRUE;
-}
-
-/*
- * Initializes the Java Virtual Machine. Also frees options array when
- * finished.
- */
-static jboolean
-InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
-{
-    JavaVMInitArgs args;
-    jint r;
-
-    memset(&args, 0, sizeof(args));
-    args.version  = JNI_VERSION_1_2;
-    args.nOptions = numOptions;
-    args.options  = options;
-    args.ignoreUnrecognized = JNI_FALSE;
-
-    if (_launcher_debug) {
-        int i = 0;
-        printf("JavaVM args:\n    ");
-        printf("version 0x%08lx, ", (long)args.version);
-        printf("ignoreUnrecognized is %s, ",
-               args.ignoreUnrecognized ? "JNI_TRUE" : "JNI_FALSE");
-        printf("nOptions is %ld\n", (long)args.nOptions);
-        for (i = 0; i < numOptions; i++)
-            printf("    option[%2d] = '%s'\n",
-                   i, args.options[i].optionString);
-    }
-
-    r = ifn->CreateJavaVM(pvm, (void **)penv, &args);
-    free(options);
-    return r == JNI_OK;
-}
-
-
-#define NULL_CHECK0(e) if ((e) == 0) return 0
-#define NULL_CHECK(e) if ((e) == 0) return
-
-/*
- * Returns a pointer to a block of at least 'size' bytes of memory.
- * Prints error message and exits if the memory could not be allocated.
- */
-void *
-MemAlloc(size_t size)
-{
-    void *p = malloc(size);
-    if (p == 0) {
-        perror("malloc");
-        exit(1);
-    }
-    return p;
-}
-
-static jstring platformEncoding = NULL;
-static jstring getPlatformEncoding(JNIEnv *env) {
-    if (platformEncoding == NULL) {
-        jstring propname = (*env)->NewStringUTF(env, "sun.jnu.encoding");
-        if (propname) {
-            jclass cls;
-            jmethodID mid;
-            NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System"));
-            NULL_CHECK0 (mid = (*env)->GetStaticMethodID(
-                                   env, cls,
-                                   "getProperty",
-                                   "(Ljava/lang/String;)Ljava/lang/String;"));
-            platformEncoding = (*env)->CallStaticObjectMethod (
-                                    env, cls, mid, propname);
-        }
-    }
-    return platformEncoding;
-}
-
-static jboolean isEncodingSupported(JNIEnv *env, jstring enc) {
-    jclass cls;
-    jmethodID mid;
-    NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset"));
-    NULL_CHECK0 (mid = (*env)->GetStaticMethodID(
-                           env, cls,
-                           "isSupported",
-                           "(Ljava/lang/String;)Z"));
-    return (*env)->CallStaticBooleanMethod (env, cls, mid, enc);
-}
-
-/*
- * Returns a new Java string object for the specified platform string.
- */
-static jstring
-NewPlatformString(JNIEnv *env, char *s)
-{
-    int len = (int)strlen(s);
-    jclass cls;
-    jmethodID mid;
-    jbyteArray ary;
-    jstring enc;
-
-    if (s == NULL)
-        return 0;
-    enc = getPlatformEncoding(env);
-
-    ary = (*env)->NewByteArray(env, len);
-    if (ary != 0) {
-        jstring str = 0;
-        (*env)->SetByteArrayRegion(env, ary, 0, len, (jbyte *)s);
-        if (!(*env)->ExceptionOccurred(env)) {
-#ifdef GAMMA
-            /* We support running JVM with older JDK, so here we have to deal */
-            /* with the case that sun.jnu.encoding is undefined (enc == NULL) */
-            if (enc != NULL && isEncodingSupported(env, enc) == JNI_TRUE) {
-#else
-            if (isEncodingSupported(env, enc) == JNI_TRUE) {
-#endif
-                NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
-                NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
-                                          "([BLjava/lang/String;)V"));
-                str = (*env)->NewObject(env, cls, mid, ary, enc);
-            } else {
-                /*If the encoding specified in sun.jnu.encoding is not
-                  endorsed by "Charset.isSupported" we have to fall back
-                  to use String(byte[]) explicitly here without specifying
-                  the encoding name, in which the StringCoding class will
-                  pickup the iso-8859-1 as the fallback converter for us.
-                */
-                NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
-                NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
-                                          "([B)V"));
-                str = (*env)->NewObject(env, cls, mid, ary);
-            }
-            (*env)->DeleteLocalRef(env, ary);
-            return str;
-        }
-    }
-    return 0;
-}
-
-/*
- * Returns a new array of Java string objects for the specified
- * array of platform strings.
- */
-static jobjectArray
-NewPlatformStringArray(JNIEnv *env, char **strv, int strc)
-{
-    jarray cls;
-    jarray ary;
-    int i;
-
-    NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String"));
-    NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0));
-    for (i = 0; i < strc; i++) {
-        jstring str = NewPlatformString(env, *strv++);
-        NULL_CHECK0(str);
-        (*env)->SetObjectArrayElement(env, ary, i, str);
-        (*env)->DeleteLocalRef(env, str);
-    }
-    return ary;
-}
-
-/*
- * Loads a class, convert the '.' to '/'.
- */
-static jclass
-LoadClass(JNIEnv *env, char *name)
-{
-    char *buf = MemAlloc(strlen(name) + 1);
-    char *s = buf, *t = name, c;
-    jclass cls;
-    jlong start, end;
-
-    if (_launcher_debug)
-        start = CounterGet();
-
-    do {
-        c = *t++;
-        *s++ = (c == '.') ? '/' : c;
-    } while (c != '\0');
-    // use the application class loader for main-class
-    cls = (*env)->FindClass(env, buf);
-    free(buf);
-
-    if (_launcher_debug) {
-        end   = CounterGet();
-        printf("%ld micro seconds to load main class\n",
-               (long)(jint)Counter2Micros(end-start));
-        printf("----_JAVA_LAUNCHER_DEBUG----\n");
-    }
-
-    return cls;
-}
-
-
-/*
- * Returns the main class name for the specified jar file.
- */
-static jstring
-GetMainClassName(JNIEnv *env, char *jarname)
-{
-#define MAIN_CLASS "Main-Class"
-    jclass cls;
-    jmethodID mid;
-    jobject jar, man, attr;
-    jstring str, result = 0;
-
-    NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile"));
-    NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>",
-                                          "(Ljava/lang/String;)V"));
-    NULL_CHECK0(str = NewPlatformString(env, jarname));
-    NULL_CHECK0(jar = (*env)->NewObject(env, cls, mid, str));
-    NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "getManifest",
-                                          "()Ljava/util/jar/Manifest;"));
-    man = (*env)->CallObjectMethod(env, jar, mid);
-    if (man != 0) {
-        NULL_CHECK0(mid = (*env)->GetMethodID(env,
-                                    (*env)->GetObjectClass(env, man),
-                                    "getMainAttributes",
-                                    "()Ljava/util/jar/Attributes;"));
-        attr = (*env)->CallObjectMethod(env, man, mid);
-        if (attr != 0) {
-            NULL_CHECK0(mid = (*env)->GetMethodID(env,
-                                    (*env)->GetObjectClass(env, attr),
-                                    "getValue",
-                                    "(Ljava/lang/String;)Ljava/lang/String;"));
-            NULL_CHECK0(str = NewPlatformString(env, MAIN_CLASS));
-            result = (*env)->CallObjectMethod(env, attr, mid, str);
-        }
-    }
-    return result;
-}
-
-#ifdef JAVA_ARGS
-static char *java_args[] = JAVA_ARGS;
-static char *app_classpath[] = APP_CLASSPATH;
-
-/*
- * For tools convert 'javac -J-ms32m' to 'java -ms32m ...'
- */
-static void
-TranslateDashJArgs(int *pargc, char ***pargv)
-{
-    const int NUM_ARGS = (sizeof(java_args) / sizeof(char *));
-    int argc = *pargc;
-    char **argv = *pargv;
-    int nargc = argc + NUM_ARGS;
-    char **nargv = MemAlloc((nargc + 1) * sizeof(char *));
-    int i;
-
-    *pargc = nargc;
-    *pargv = nargv;
-
-    /* Copy the VM arguments (i.e. prefixed with -J) */
-    for (i = 0; i < NUM_ARGS; i++) {
-        char *arg = java_args[i];
-        if (arg[0] == '-' && arg[1] == 'J') {
-            *nargv++ = arg + 2;
-        }
-    }
-
-    for (i = 0; i < argc; i++) {
-        char *arg = argv[i];
-        if (arg[0] == '-' && arg[1] == 'J') {
-            if (arg[2] == '\0') {
-                ReportErrorMessage("Error: the -J option should not be "
-                                   "followed by a space.", JNI_TRUE);
-                exit(1);
-            }
-            *nargv++ = arg + 2;
-        }
-    }
-
-    /* Copy the rest of the arguments */
-    for (i = 0; i < NUM_ARGS; i++) {
-        char *arg = java_args[i];
-        if (arg[0] != '-' || arg[1] != 'J') {
-            *nargv++ = arg;
-        }
-    }
-    for (i = 0; i < argc; i++) {
-        char *arg = argv[i];
-        if (arg[0] != '-' || arg[1] != 'J') {
-            *nargv++ = arg;
-        }
-    }
-    *nargv = 0;
-}
-
-/*
- * For our tools, we try to add 3 VM options:
- *      -Denv.class.path=<envcp>
- *      -Dapplication.home=<apphome>
- *      -Djava.class.path=<appcp>
- * <envcp>   is the user's setting of CLASSPATH -- for instance the user
- *           tells javac where to find binary classes through this environment
- *           variable.  Notice that users will be able to compile against our
- *           tools classes (sun.tools.javac.Main) only if they explicitly add
- *           tools.jar to CLASSPATH.
- * <apphome> is the directory where the application is installed.
- * <appcp>   is the classpath to where our apps' classfiles are.
- */
-static jboolean
-AddApplicationOptions()
-{
-    const int NUM_APP_CLASSPATH = (sizeof(app_classpath) / sizeof(char *));
-    char *s, *envcp, *appcp, *apphome;
-    char home[MAXPATHLEN]; /* application home */
-    char separator[] = { PATH_SEPARATOR, '\0' };
-    int size, i;
-    int strlenHome;
-
-    s = getenv("CLASSPATH");
-    if (s) {
-        /* 40 for -Denv.class.path= */
-        envcp = (char *)MemAlloc(strlen(s) + 40);
-        sprintf(envcp, "-Denv.class.path=%s", s);
-        AddOption(envcp, NULL);
-    }
-
-    if (!GetApplicationHome(home, sizeof(home))) {
-        ReportErrorMessage("Can't determine application home", JNI_TRUE);
-        return JNI_FALSE;
-    }
-
-    /* 40 for '-Dapplication.home=' */
-    apphome = (char *)MemAlloc(strlen(home) + 40);
-    sprintf(apphome, "-Dapplication.home=%s", home);
-    AddOption(apphome, NULL);
-
-    /* How big is the application's classpath? */
-    size = 40;                                 /* 40: "-Djava.class.path=" */
-    strlenHome = (int)strlen(home);
-    for (i = 0; i < NUM_APP_CLASSPATH; i++) {
-        size += strlenHome + (int)strlen(app_classpath[i]) + 1; /* 1: separator */
-    }
-    appcp = (char *)MemAlloc(size + 1);
-    strcpy(appcp, "-Djava.class.path=");
-    for (i = 0; i < NUM_APP_CLASSPATH; i++) {
-        strcat(appcp, home);                    /* c:\program files\myapp */
-        strcat(appcp, app_classpath[i]);        /* \lib\myapp.jar         */
-        strcat(appcp, separator);               /* ;                      */
-    }
-    appcp[strlen(appcp)-1] = '\0';  /* remove trailing path separator */
-    AddOption(appcp, NULL);
-    return JNI_TRUE;
-}
-#endif
-
-/*
- * inject the -Dsun.java.command pseudo property into the args structure
- * this pseudo property is used in the HotSpot VM to expose the
- * Java class name and arguments to the main method to the VM. The
- * HotSpot VM uses this pseudo property to store the Java class name
- * (or jar file name) and the arguments to the class's main method
- * to the instrumentation memory region. The sun.java.command pseudo
- * property is not exported by HotSpot to the Java layer.
- */
-void
-SetJavaCommandLineProp(char *classname, char *jarfile,
-                       int argc, char **argv)
-{
-
-    int i = 0;
-    size_t len = 0;
-    char* javaCommand = NULL;
-    char* dashDstr = "-Dsun.java.command=";
-
-    if (classname == NULL && jarfile == NULL) {
-        /* unexpected, one of these should be set. just return without
-         * setting the property
-         */
-        return;
-    }
-
-    /* if the class name is not set, then use the jarfile name */
-    if (classname == NULL) {
-        classname = jarfile;
-    }
-
-    /* determine the amount of memory to allocate assuming
-     * the individual components will be space separated
-     */
-    len = strlen(classname);
-    for (i = 0; i < argc; i++) {
-        len += strlen(argv[i]) + 1;
-    }
-
-    /* allocate the memory */
-    javaCommand = (char*) MemAlloc(len + strlen(dashDstr) + 1);
-
-    /* build the -D string */
-    *javaCommand = '\0';
-    strcat(javaCommand, dashDstr);
-    strcat(javaCommand, classname);
-
-    for (i = 0; i < argc; i++) {
-        /* the components of the string are space separated. In
-         * the case of embedded white space, the relationship of
-         * the white space separated components to their true
-         * positional arguments will be ambiguous. This issue may
-         * be addressed in a future release.
-         */
-        strcat(javaCommand, " ");
-        strcat(javaCommand, argv[i]);
-    }
-
-    AddOption(javaCommand, NULL);
-}
-
-/*
- * JVM wants to know launcher type, so tell it.
- */
-#ifdef GAMMA
-void SetJavaLauncherProp() {
-  AddOption("-Dsun.java.launcher=" LAUNCHER_TYPE, NULL);
-}
-#endif
-
-/*
- * Prints the version information from the java.version and other properties.
- */
-static void
-PrintJavaVersion(JNIEnv *env)
-{
-    jclass ver;
-    jmethodID print;
-
-    NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version"));
-    NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V"));
-
-    (*env)->CallStaticVoidMethod(env, ver, print);
-}
-
-/*
- * Prints default usage message.
- */
-static void
-PrintUsage(void)
-{
-    int i;
-
-    fprintf(stdout,
-        "Usage: %s [-options] class [args...]\n"
-        "           (to execute a class)\n"
-        "   or  %s [-options] -jar jarfile [args...]\n"
-        "           (to execute a jar file)\n"
-        "\n"
-        "where options include:\n",
-        progname,
-        progname);
-
-#ifndef GAMMA
-    PrintMachineDependentOptions();
-
-    if ((knownVMs[0].flag == VM_KNOWN) ||
-        (knownVMs[0].flag == VM_IF_SERVER_CLASS)) {
-      fprintf(stdout, "    %s\t  to select the \"%s\" VM\n",
-              knownVMs[0].name, knownVMs[0].name+1);
-    }
-    for (i=1; i<knownVMsCount; i++) {
-        if (knownVMs[i].flag == VM_KNOWN)
-            fprintf(stdout, "    %s\t  to select the \"%s\" VM\n",
-                    knownVMs[i].name, knownVMs[i].name+1);
-    }
-    for (i=1; i<knownVMsCount; i++) {
-        if (knownVMs[i].flag == VM_ALIASED_TO)
-            fprintf(stdout, "    %s\t  is a synonym for "
-                    "the \"%s\" VM  [deprecated]\n",
-                    knownVMs[i].name, knownVMs[i].alias+1);
-    }
-
-    /* The first known VM is the default */
-    {
-      const char* defaultVM   = knownVMs[0].name+1;
-      const char* punctuation = ".";
-      const char* reason      = "";
-      if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) &&
-          (ServerClassMachine() == JNI_TRUE)) {
-        defaultVM = knownVMs[0].server_class+1;
-        punctuation = ", ";
-        reason = "because you are running on a server-class machine.\n";
-      }
-      fprintf(stdout, "                  The default VM is %s%s\n",
-              defaultVM, punctuation);
-      fprintf(stdout, "                  %s\n",
-              reason);
-    }
-#endif /* ifndef GAMMA */
-
-    fprintf(stdout,
-"    -cp <class search path of directories and zip/jar files>\n"
-"    -classpath <class search path of directories and zip/jar files>\n"
-"                  A %c separated list of directories, JAR archives,\n"
-"                  and ZIP archives to search for class files.\n"
-"    -D<name>=<value>\n"
-"                  set a system property\n"
-"    -verbose[:class|gc|jni]\n"
-"                  enable verbose output\n"
-"    -version      print product version and exit\n"
-"    -version:<value>\n"
-"                  require the specified version to run\n"
-"    -showversion  print product version and continue\n"
-"    -jre-restrict-search | -jre-no-restrict-search\n"
-"                  include/exclude user private JREs in the version search\n"
-"    -? -help      print this help message\n"
-"    -X            print help on non-standard options\n"
-"    -ea[:<packagename>...|:<classname>]\n"
-"    -enableassertions[:<packagename>...|:<classname>]\n"
-"                  enable assertions\n"
-"    -da[:<packagename>...|:<classname>]\n"
-"    -disableassertions[:<packagename>...|:<classname>]\n"
-"                  disable assertions\n"
-"    -esa | -enablesystemassertions\n"
-"                  enable system assertions\n"
-"    -dsa | -disablesystemassertions\n"
-"                  disable system assertions\n"
-"    -agentlib:<libname>[=<options>]\n"
-"                  load native agent library <libname>, e.g. -agentlib:hprof\n"
-"                    see also, -agentlib:jdwp=help and -agentlib:hprof=help\n"
-"    -agentpath:<pathname>[=<options>]\n"
-"                  load native agent library by full pathname\n"
-"    -javaagent:<jarpath>[=<options>]\n"
-"                  load Java programming language agent, see java.lang.instrument\n"
-
-            ,PATH_SEPARATOR);
-}
-
-/*
- * Print usage message for -X options.
- */
-static jint
-PrintXUsage(void)
-{
-    char path[MAXPATHLEN];
-    char buf[128];
-    size_t n;
-    FILE *fp;
-
-    GetXUsagePath(path, sizeof(path));
-    fp = fopen(path, "r");
-    if (fp == 0) {
-        fprintf(stderr, "Can't open %s\n", path);
-        return 1;
-    }
-    while ((n = fread(buf, 1, sizeof(buf), fp)) != 0) {
-        fwrite(buf, 1, n, stdout);
-    }
-    fclose(fp);
-    return 0;
-}
-
-#ifndef GAMMA
-
-/*
- * Read the jvm.cfg file and fill the knownJVMs[] array.
- *
- * The functionality of the jvm.cfg file is subject to change without
- * notice and the mechanism will be removed in the future.
- *
- * The lexical structure of the jvm.cfg file is as follows:
- *
- *     jvmcfg         :=  { vmLine }
- *     vmLine         :=  knownLine
- *                    |   aliasLine
- *                    |   warnLine
- *                    |   ignoreLine
- *                    |   errorLine
- *                    |   predicateLine
- *                    |   commentLine
- *     knownLine      :=  flag  "KNOWN"                  EOL
- *     warnLine       :=  flag  "WARN"                   EOL
- *     ignoreLine     :=  flag  "IGNORE"                 EOL
- *     errorLine      :=  flag  "ERROR"                  EOL
- *     aliasLine      :=  flag  "ALIASED_TO"       flag  EOL
- *     predicateLine  :=  flag  "IF_SERVER_CLASS"  flag  EOL
- *     commentLine    :=  "#" text                       EOL
- *     flag           :=  "-" identifier
- *
- * The semantics are that when someone specifies a flag on the command line:
- * - if the flag appears on a knownLine, then the identifier is used as
- *   the name of the directory holding the JVM library (the name of the JVM).
- * - if the flag appears as the first flag on an aliasLine, the identifier
- *   of the second flag is used as the name of the JVM.
- * - if the flag appears on a warnLine, the identifier is used as the
- *   name of the JVM, but a warning is generated.
- * - if the flag appears on an ignoreLine, the identifier is recognized as the
- *   name of a JVM, but the identifier is ignored and the default vm used
- * - if the flag appears on an errorLine, an error is generated.
- * - if the flag appears as the first flag on a predicateLine, and
- *   the machine on which you are running passes the predicate indicated,
- *   then the identifier of the second flag is used as the name of the JVM,
- *   otherwise the identifier of the first flag is used as the name of the JVM.
- * If no flag is given on the command line, the first vmLine of the jvm.cfg
- * file determines the name of the JVM.
- * PredicateLines are only interpreted on first vmLine of a jvm.cfg file,
- * since they only make sense if someone hasn't specified the name of the
- * JVM on the command line.
- *
- * The intent of the jvm.cfg file is to allow several JVM libraries to
- * be installed in different subdirectories of a single JRE installation,
- * for space-savings and convenience in testing.
- * The intent is explicitly not to provide a full aliasing or predicate
- * mechanism.
- */
-jint
-ReadKnownVMs(const char *jrepath, char * arch, jboolean speculative)
-{
-    FILE *jvmCfg;
-    char jvmCfgName[MAXPATHLEN+20];
-    char line[MAXPATHLEN+20];
-    int cnt = 0;
-    int lineno = 0;
-    jlong start, end;
-    int vmType;
-    char *tmpPtr;
-    char *altVMName;
-    char *serverClassVMName;
-    static char *whiteSpace = " \t";
-    if (_launcher_debug) {
-        start = CounterGet();
-    }
-
-    strcpy(jvmCfgName, jrepath);
-    strcat(jvmCfgName, FILESEP "lib" FILESEP);
-    strcat(jvmCfgName, arch);
-    strcat(jvmCfgName, FILESEP "jvm.cfg");
-
-    jvmCfg = fopen(jvmCfgName, "r");
-    if (jvmCfg == NULL) {
-      if (!speculative) {
-        ReportErrorMessage2("Error: could not open `%s'", jvmCfgName,
-                            JNI_TRUE);
-        exit(1);
-      } else {
-        return -1;
-      }
-    }
-    while (fgets(line, sizeof(line), jvmCfg) != NULL) {
-        vmType = VM_UNKNOWN;
-        lineno++;
-        if (line[0] == '#')
-            continue;
-        if (line[0] != '-') {
-            fprintf(stderr, "Warning: no leading - on line %d of `%s'\n",
-                    lineno, jvmCfgName);
-        }
-        if (cnt >= knownVMsLimit) {
-            GrowKnownVMs(cnt);
-        }
-        line[strlen(line)-1] = '\0'; /* remove trailing newline */
-        tmpPtr = line + strcspn(line, whiteSpace);
-        if (*tmpPtr == 0) {
-            fprintf(stderr, "Warning: missing VM type on line %d of `%s'\n",
-                    lineno, jvmCfgName);
-        } else {
-            /* Null-terminate this string for strdup below */
-            *tmpPtr++ = 0;
-            tmpPtr += strspn(tmpPtr, whiteSpace);
-            if (*tmpPtr == 0) {
-                fprintf(stderr, "Warning: missing VM type on line %d of `%s'\n",
-                        lineno, jvmCfgName);
-            } else {
-                if (!strncmp(tmpPtr, "KNOWN", strlen("KNOWN"))) {
-                    vmType = VM_KNOWN;
-                } else if (!strncmp(tmpPtr, "ALIASED_TO", strlen("ALIASED_TO"))) {
-                    tmpPtr += strcspn(tmpPtr, whiteSpace);
-                    if (*tmpPtr != 0) {
-                        tmpPtr += strspn(tmpPtr, whiteSpace);
-                    }
-                    if (*tmpPtr == 0) {
-                        fprintf(stderr, "Warning: missing VM alias on line %d of `%s'\n",
-                                lineno, jvmCfgName);
-                    } else {
-                        /* Null terminate altVMName */
-                        altVMName = tmpPtr;
-                        tmpPtr += strcspn(tmpPtr, whiteSpace);
-                        *tmpPtr = 0;
-                        vmType = VM_ALIASED_TO;
-                    }
-                } else if (!strncmp(tmpPtr, "WARN", strlen("WARN"))) {
-                    vmType = VM_WARN;
-                } else if (!strncmp(tmpPtr, "IGNORE", strlen("IGNORE"))) {
-                    vmType = VM_IGNORE;
-                } else if (!strncmp(tmpPtr, "ERROR", strlen("ERROR"))) {
-                    vmType = VM_ERROR;
-                } else if (!strncmp(tmpPtr,
-                                    "IF_SERVER_CLASS",
-                                    strlen("IF_SERVER_CLASS"))) {
-                    tmpPtr += strcspn(tmpPtr, whiteSpace);
-                    if (*tmpPtr != 0) {
-                        tmpPtr += strspn(tmpPtr, whiteSpace);
-                    }
-                    if (*tmpPtr == 0) {
-                        fprintf(stderr, "Warning: missing server class VM on line %d of `%s'\n",
-                                lineno, jvmCfgName);
-                    } else {
-                        /* Null terminate server class VM name */
-                        serverClassVMName = tmpPtr;
-                        tmpPtr += strcspn(tmpPtr, whiteSpace);
-                        *tmpPtr = 0;
-                        vmType = VM_IF_SERVER_CLASS;
-                    }
-                } else {
-                    fprintf(stderr, "Warning: unknown VM type on line %d of `%s'\n",
-                            lineno, &jvmCfgName[0]);
-                    vmType = VM_KNOWN;
-                }
-            }
-        }
-
-        if (_launcher_debug)
-            printf("jvm.cfg[%d] = ->%s<-\n", cnt, line);
-        if (vmType != VM_UNKNOWN) {
-            knownVMs[cnt].name = strdup(line);
-            knownVMs[cnt].flag = vmType;
-            switch (vmType) {
-            default:
-                break;
-            case VM_ALIASED_TO:
-                knownVMs[cnt].alias = strdup(altVMName);
-                if (_launcher_debug) {
-                    printf("    name: %s  vmType: %s  alias: %s\n",
-                           knownVMs[cnt].name, "VM_ALIASED_TO", knownVMs[cnt].alias);
-                }
-                break;
-            case VM_IF_SERVER_CLASS:
-                knownVMs[cnt].server_class = strdup(serverClassVMName);
-                if (_launcher_debug) {
-                    printf("    name: %s  vmType: %s  server_class: %s\n",
-                           knownVMs[cnt].name, "VM_IF_SERVER_CLASS", knownVMs[cnt].server_class);
-                }
-                break;
-            }
-            cnt++;
-        }
-    }
-    fclose(jvmCfg);
-    knownVMsCount = cnt;
-
-    if (_launcher_debug) {
-        end   = CounterGet();
-        printf("%ld micro seconds to parse jvm.cfg\n",
-               (long)(jint)Counter2Micros(end-start));
-    }
-
-    return cnt;
-}
-
-
-static void
-GrowKnownVMs(int minimum)
-{
-    struct vmdesc* newKnownVMs;
-    int newMax;
-
-    newMax = (knownVMsLimit == 0 ? INIT_MAX_KNOWN_VMS : (2 * knownVMsLimit));
-    if (newMax <= minimum) {
-        newMax = minimum;
-    }
-    newKnownVMs = (struct vmdesc*) MemAlloc(newMax * sizeof(struct vmdesc));
-    if (knownVMs != NULL) {
-        memcpy(newKnownVMs, knownVMs, knownVMsLimit * sizeof(struct vmdesc));
-    }
-    free(knownVMs);
-    knownVMs = newKnownVMs;
-    knownVMsLimit = newMax;
-}
-
-
-/* Returns index of VM or -1 if not found */
-static int
-KnownVMIndex(const char* name)
-{
-    int i;
-    if (strncmp(name, "-J", 2) == 0) name += 2;
-    for (i = 0; i < knownVMsCount; i++) {
-        if (!strcmp(name, knownVMs[i].name)) {
-            return i;
-        }
-    }
-    return -1;
-}
-
-static void
-FreeKnownVMs()
-{
-    int i;
-    for (i = 0; i < knownVMsCount; i++) {
-        free(knownVMs[i].name);
-        knownVMs[i].name = NULL;
-    }
-    free(knownVMs);
-}
-
-#endif /* ifndef GAMMA */
--- a/src/os/bsd/launcher/java.h	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 1999, 2008, 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.
- *
- */
-
-/*
- * Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
- * search "GAMMA" for gamma specific changes.
- */
-
-#ifndef _JAVA_H_
-#define _JAVA_H_
-
-/*
- * Get system specific defines.
- */
-#include "jni.h"
-#include "java_md.h"
-
-/*
- * Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
- */
-typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
-typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
-
-typedef struct {
-    CreateJavaVM_t CreateJavaVM;
-    GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
-} InvocationFunctions;
-
-/*
- * Prototypes for launcher functions in the system specific java_md.c.
- */
-
-jboolean
-LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
-
-void
-GetXUsagePath(char *buf, jint bufsize);
-
-jboolean
-GetApplicationHome(char *buf, jint bufsize);
-
-const char *
-GetArch();
-
-void CreateExecutionEnvironment(int *_argc,
-                                       char ***_argv,
-                                       char jrepath[],
-                                       jint so_jrepath,
-                                       char jvmpath[],
-                                       jint so_jvmpath,
-                                       char **original_argv);
-
-/*
- * Report an error message to stderr or a window as appropriate.  The
- * flag always is set to JNI_TRUE if message is to be reported to both
- * strerr and windows and set to JNI_FALSE if the message should only
- * be sent to a window.
- */
-void ReportErrorMessage(char * message, jboolean always);
-void ReportErrorMessage2(char * format, char * string, jboolean always);
-
-/*
- * Report an exception which terminates the vm to stderr or a window
- * as appropriate.
- */
-void ReportExceptionDescription(JNIEnv * env);
-
-jboolean RemovableMachineDependentOption(char * option);
-void PrintMachineDependentOptions();
-
-/*
- * Functions defined in java.c and used in java_md.c.
- */
-jint ReadKnownVMs(const char *jrepath, char * arch, jboolean speculative);
-char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
-void* MemAlloc(size_t size);
-
-/*
- * Make launcher spit debug output.
- */
-extern jboolean _launcher_debug;
-/*
- * This allows for finding classes from the VM's bootstrap class loader
- * directly, FindClass uses the application class loader internally, this will
- * cause unnecessary searching of the classpath for the required classes.
- */
-typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env,
-                                                const char *name,
-                                                jboolean throwError));
-
-jclass FindBootStrapClass(JNIEnv *env, const char *classname);
-
-#endif /* _JAVA_H_ */
--- a/src/os/bsd/launcher/java_md.c	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1859 +0,0 @@
-/*
- * Copyright (c) 1999, 2008, 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.
- *
- */
-
-/*
- * Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
- * search "GAMMA" for gamma specific changes.
- */
-
-#include "java.h"
-#include <dirent.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#ifndef GAMMA
-#include "manifest_info.h"
-#include "version_comp.h"
-#endif
-
-#ifdef __APPLE__
-#define JVM_DLL "libjvm.dylib"
-#define JAVA_DLL "libjava.dylib"
-#define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH"
-#else
-#define JVM_DLL "libjvm.so"
-#define JAVA_DLL "libjava.so"
-#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
-#endif
-
-#ifndef GAMMA   /* launcher.make defines ARCH */
-
-/*
- * If a processor / os combination has the ability to run binaries of
- * two data models and cohabitation of jre/jdk bits with both data
- * models is supported, then DUAL_MODE is defined.  When DUAL_MODE is
- * defined, the architecture names for the narrow and wide version of
- * the architecture are defined in BIG_ARCH and SMALL_ARCH.  Currently
- * only Solaris on sparc/sparcv9 and i586/amd64 is DUAL_MODE; bsd
- * i586/amd64 could be defined as DUAL_MODE but that is not the
- * current policy.
- */
-
-#ifdef _LP64
-
-#  ifdef ia64
-#    define ARCH "ia64"
-#  elif defined(amd64)
-#    define ARCH "amd64"
-#  elif defined(__sparc)
-#    define ARCH "sparcv9"
-#  else
-#    define ARCH "unknown" /* unknown 64-bit architecture */
-#  endif
-
-#else /* 32-bit data model */
-
-#  ifdef i586
-#    define ARCH "i386"
-#  elif defined(__sparc)
-#    define ARCH "sparc"
-#  elif defined(arm)
-#    define ARCH "arm"
-#  elif defined(PPC)
-#    define ARCH "ppc"
-#  endif
-
-#endif /* _LP64 */
-
-#ifdef __sun
-#  define DUAL_MODE
-#  ifdef __sparc
-#    define BIG_ARCH "sparcv9"
-#    define SMALL_ARCH "sparc"
-#  else
-#    define BIG_ARCH "amd64"
-#    define SMALL_ARCH "i386"
-#  endif
-#  include <sys/systeminfo.h>
-#  include <sys/elf.h>
-#  include <stdio.h>
-#else
-#  ifndef ARCH
-#    include <sys/systeminfo.h>
-#  endif
-#endif
-
-#endif /* ifndef GAMMA */
-
-/* pointer to environment */
-extern char **environ;
-
-#ifndef GAMMA
-
-/*
- *      A collection of useful strings. One should think of these as #define
- *      entries, but actual strings can be more efficient (with many compilers).
- */
-#ifdef _ALLBSD_SOURCE
-static const char *system_dir   = "/usr/java";
-static const char *user_dir     = "/java";
-#else /* Solaris */
-static const char *system_dir   = "/usr/jdk";
-static const char *user_dir     = "/jdk";
-#endif
-
-#endif  /* ifndef GAMMA */
-
-/*
- * Flowchart of launcher execs and options processing on unix
- *
- * The selection of the proper vm shared library to open depends on
- * several classes of command line options, including vm "flavor"
- * options (-client, -server) and the data model options, -d32  and
- * -d64, as well as a version specification which may have come from
- * the command line or from the manifest of an executable jar file.
- * The vm selection options are not passed to the running
- * virtual machine; they must be screened out by the launcher.
- *
- * The version specification (if any) is processed first by the
- * platform independent routine SelectVersion.  This may result in
- * the exec of the specified launcher version.
- *
- * Typically, the launcher execs at least once to ensure a suitable
- * LD_LIBRARY_PATH is in effect for the process.  The first exec
- * screens out all the data model options; leaving the choice of data
- * model implicit in the binary selected to run.  However, in case no
- * exec is done, the data model options are screened out before the vm
- * is invoked.
- *
- *  incoming argv ------------------------------
- *  |                                          |
- * \|/                                         |
- * CheckJVMType                                |
- * (removes -client, -server, etc.)            |
- *                                            \|/
- *                                            CreateExecutionEnvironment
- *                                            (removes -d32 and -d64,
- *                                             determines desired data model,
- *                                             sets up LD_LIBRARY_PATH,
- *                                             and exec's)
- *                                             |
- *  --------------------------------------------
- *  |
- * \|/
- * exec child 1 incoming argv -----------------
- *  |                                          |
- * \|/                                         |
- * CheckJVMType                                |
- * (removes -client, -server, etc.)            |
- *  |                                         \|/
- *  |                                          CreateExecutionEnvironment
- *  |                                          (verifies desired data model
- *  |                                           is running and acceptable
- *  |                                           LD_LIBRARY_PATH;
- *  |                                           no-op in child)
- *  |
- * \|/
- * TranslateDashJArgs...
- * (Prepare to pass args to vm)
- *  |
- *  |
- *  |
- * \|/
- * ParseArguments
- * (ignores -d32 and -d64,
- *  processes version options,
- *  creates argument list for vm,
- *  etc.)
- *
- */
-
-static char *SetExecname(char **argv);
-static char * GetExecname();
-static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
-                           char *jvmpath, jint jvmpathsize, char * arch);
-static jboolean GetJREPath(char *path, jint pathsize, char * arch, jboolean speculative);
-
-const char *
-GetArch()
-{
-    static char *arch = NULL;
-    static char buf[12];
-    if (arch) {
-        return arch;
-    }
-
-#ifdef ARCH
-    strcpy(buf, ARCH);
-#else
-    sysinfo(SI_ARCHITECTURE, buf, sizeof(buf));
-#endif
-    arch = buf;
-    return arch;
-}
-
-void
-CreateExecutionEnvironment(int *_argcp,
-                           char ***_argvp,
-                           char jrepath[],
-                           jint so_jrepath,
-                           char jvmpath[],
-                           jint so_jvmpath,
-                           char **original_argv) {
-  /*
-   * First, determine if we are running the desired data model.  If we
-   * are running the desired data model, all the error messages
-   * associated with calling GetJREPath, ReadKnownVMs, etc. should be
-   * output.  However, if we are not running the desired data model,
-   * some of the errors should be suppressed since it is more
-   * informative to issue an error message based on whether or not the
-   * os/processor combination has dual mode capabilities.
-   */
-
-    char *execname = NULL;
-    int original_argc = *_argcp;
-    jboolean jvmpathExists;
-
-    /* Compute the name of the executable */
-    execname = SetExecname(*_argvp);
-
-#ifndef GAMMA
-    /* Set the LD_LIBRARY_PATH environment variable, check data model
-       flags, and exec process, if needed */
-    {
-      char *arch        = (char *)GetArch(); /* like sparc or sparcv9 */
-      char * jvmtype    = NULL;
-      int argc          = *_argcp;
-      char **argv       = original_argv;
-
-      char *runpath     = NULL; /* existing effective LD_LIBRARY_PATH
-                                   setting */
-
-      int running       =       /* What data model is being ILP32 =>
-                                   32 bit vm; LP64 => 64 bit vm */
-#ifdef _LP64
-        64;
-#else
-      32;
-#endif
-
-      int wanted        = running;      /* What data mode is being
-                                           asked for? Current model is
-                                           fine unless another model
-                                           is asked for */
-
-      char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
-      char* newpath     = NULL; /* path on new LD_LIBRARY_PATH */
-      char* lastslash   = NULL;
-
-      char** newenvp    = NULL; /* current environment */
-
-      char** newargv    = NULL;
-      int    newargc    = 0;
-#ifdef __sun
-      char*  dmpath     = NULL;  /* data model specific LD_LIBRARY_PATH,
-                                    Solaris only */
-#endif
-
-      /*
-       * Starting in 1.5, all unix platforms accept the -d32 and -d64
-       * options.  On platforms where only one data-model is supported
-       * (e.g. ia-64 Bsd), using the flag for the other data model is
-       * an error and will terminate the program.
-       */
-
-      { /* open new scope to declare local variables */
-        int i;
-
-        newargv = (char **)MemAlloc((argc+1) * sizeof(*newargv));
-        newargv[newargc++] = argv[0];
-
-        /* scan for data model arguments and remove from argument list;
-           last occurrence determines desired data model */
-        for (i=1; i < argc; i++) {
-
-          if (strcmp(argv[i], "-J-d64") == 0 || strcmp(argv[i], "-d64") == 0) {
-            wanted = 64;
-            continue;
-          }
-          if (strcmp(argv[i], "-J-d32") == 0 || strcmp(argv[i], "-d32") == 0) {
-            wanted = 32;
-            continue;
-          }
-          newargv[newargc++] = argv[i];
-
-#ifdef JAVA_ARGS
-          if (argv[i][0] != '-')
-            continue;
-#else
-          if (strcmp(argv[i], "-classpath") == 0 || strcmp(argv[i], "-cp") == 0) {
-            i++;
-            if (i >= argc) break;
-            newargv[newargc++] = argv[i];
-            continue;
-          }
-          if (argv[i][0] != '-') { i++; break; }
-#endif
-        }
-
-        /* copy rest of args [i .. argc) */
-        while (i < argc) {
-          newargv[newargc++] = argv[i++];
-        }
-        newargv[newargc] = NULL;
-
-        /*
-         * newargv has all proper arguments here
-         */
-
-        argc = newargc;
-        argv = newargv;
-      }
-
-      /* If the data model is not changing, it is an error if the
-         jvmpath does not exist */
-      if (wanted == running) {
-        /* Find out where the JRE is that we will be using. */
-        if (!GetJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
-          fprintf(stderr, "Error: could not find Java 2 Runtime Environment.\n");
-          exit(2);
-        }
-
-        /* Find the specified JVM type */
-        if (ReadKnownVMs(jrepath, arch, JNI_FALSE) < 1) {
-          fprintf(stderr, "Error: no known VMs. (check for corrupt jvm.cfg file)\n");
-          exit(1);
-        }
-
-        jvmpath[0] = '\0';
-        jvmtype = CheckJvmType(_argcp, _argvp, JNI_FALSE);
-
-        if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, arch )) {
-          fprintf(stderr, "Error: no `%s' JVM at `%s'.\n", jvmtype, jvmpath);
-          exit(4);
-        }
-      } else {  /* do the same speculatively or exit */
-#ifdef DUAL_MODE
-        if (running != wanted) {
-          /* Find out where the JRE is that we will be using. */
-          if (!GetJREPath(jrepath, so_jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH), JNI_TRUE)) {
-            goto EndDataModelSpeculate;
-          }
-
-          /*
-           * Read in jvm.cfg for target data model and process vm
-           * selection options.
-           */
-          if (ReadKnownVMs(jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH), JNI_TRUE) < 1) {
-            goto EndDataModelSpeculate;
-          }
-          jvmpath[0] = '\0';
-          jvmtype = CheckJvmType(_argcp, _argvp, JNI_TRUE);
-          /* exec child can do error checking on the existence of the path */
-          jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath,
-                                     ((wanted==64)?BIG_ARCH:SMALL_ARCH));
-
-        }
-      EndDataModelSpeculate: /* give up and let other code report error message */
-        ;
-#else
-        fprintf(stderr, "Running a %d-bit JVM is not supported on this platform.\n", wanted);
-        exit(1);
-#endif
-      }
-
-      /*
-       * We will set the LD_LIBRARY_PATH as follows:
-       *
-       *     o          $JVMPATH (directory portion only)
-       *     o          $JRE/lib/$ARCH
-       *     o          $JRE/../lib/$ARCH
-       *
-       * followed by the user's previous effective LD_LIBRARY_PATH, if
-       * any.
-       */
-
-#ifdef __sun
-      /*
-       * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH
-       * variables:
-       *
-       * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if
-       * data-model specific variables are not set.
-       *
-       * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH
-       * for 64-bit binaries.
-       *
-       * 3. LD_LIBRARY_PATH_32 -- overrides and replaces LD_LIBRARY_PATH
-       * for 32-bit binaries.
-       *
-       * The vm uses LD_LIBRARY_PATH to set the java.library.path system
-       * property.  To shield the vm from the complication of multiple
-       * LD_LIBRARY_PATH variables, if the appropriate data model
-       * specific variable is set, we will act as if LD_LIBRARY_PATH had
-       * the value of the data model specific variant and the data model
-       * specific variant will be unset.  Note that the variable for the
-       * *wanted* data model must be used (if it is set), not simply the
-       * current running data model.
-       */
-
-      switch(wanted) {
-      case 0:
-        if(running == 32) {
-          dmpath = getenv("LD_LIBRARY_PATH_32");
-          wanted = 32;
-        }
-        else {
-          dmpath = getenv("LD_LIBRARY_PATH_64");
-          wanted = 64;
-        }
-        break;
-
-      case 32:
-        dmpath = getenv("LD_LIBRARY_PATH_32");
-        break;
-
-      case 64:
-        dmpath = getenv("LD_LIBRARY_PATH_64");
-        break;
-
-      default:
-        fprintf(stderr, "Improper value at line %d.", __LINE__);
-        exit(1); /* unknown value in wanted */
-        break;
-      }
-
-      /*
-       * If dmpath is NULL, the relevant data model specific variable is
-       * not set and normal LD_LIBRARY_PATH should be used.
-       */
-      if( dmpath == NULL) {
-        runpath = getenv("LD_LIBRARY_PATH");
-      }
-      else {
-        runpath = dmpath;
-      }
-#else
-      /*
-       * If not on Solaris, assume only a single LD_LIBRARY_PATH
-       * variable.
-       */
-      runpath = getenv(LD_LIBRARY_PATH);
-#endif /* __sun */
-
-#ifdef _ALLBSD_SOURCE
-      /*
-       * On bsd, if a binary is running as sgid or suid, glibc sets
-       * LD_LIBRARY_PATH to the empty string for security purposes.  (In
-       * contrast, on Solaris the LD_LIBRARY_PATH variable for a
-       * privileged binary does not lose its settings; but the dynamic
-       * linker does apply more scrutiny to the path.) The launcher uses
-       * the value of LD_LIBRARY_PATH to prevent an exec loop.
-       * Therefore, if we are running sgid or suid, this function's
-       * setting of LD_LIBRARY_PATH will be ineffective and we should
-       * return from the function now.  Getting the right libraries to
-       * be found must be handled through other mechanisms.
-       */
-      if(issetugid()) {
-        return;
-      }
-#endif
-
-      /* runpath contains current effective LD_LIBRARY_PATH setting */
-
-      jvmpath = strdup(jvmpath);
-      new_runpath = MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
-                              2*strlen(jrepath) + 2*strlen(arch) +
-                              strlen(jvmpath) + 52);
-      newpath = new_runpath + strlen(LD_LIBRARY_PATH "=");
-
-
-      /*
-       * Create desired LD_LIBRARY_PATH value for target data model.
-       */
-      {
-        /* remove the name of the .so from the JVM path */
-        lastslash = strrchr(jvmpath, '/');
-        if (lastslash)
-          *lastslash = '\0';
-
-
-        /* jvmpath, ((running != wanted)?((wanted==64)?"/"BIG_ARCH:"/.."):""), */
-
-        sprintf(new_runpath, LD_LIBRARY_PATH "="
-                "%s:"
-                "%s/lib/%s:"
-                "%s/../lib/%s",
-                jvmpath,
-#ifdef DUAL_MODE
-                jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH),
-                jrepath, ((wanted==64)?BIG_ARCH:SMALL_ARCH)
-#else
-                jrepath, arch,
-                jrepath, arch
-#endif
-                );
-
-
-        /*
-         * Check to make sure that the prefix of the current path is the
-         * desired environment variable setting.
-         */
-        if (runpath != NULL &&
-            strncmp(newpath, runpath, strlen(newpath))==0 &&
-            (runpath[strlen(newpath)] == 0 || runpath[strlen(newpath)] == ':') &&
-            (running == wanted) /* data model does not have to be changed */
-#ifdef __sun
-            && (dmpath == NULL)    /* data model specific variables not set  */
-#endif
-            ) {
-
-          return;
-
-        }
-      }
-
-      /*
-       * Place the desired environment setting onto the prefix of
-       * LD_LIBRARY_PATH.  Note that this prevents any possible infinite
-       * loop of execv() because we test for the prefix, above.
-       */
-      if (runpath != 0) {
-        strcat(new_runpath, ":");
-        strcat(new_runpath, runpath);
-      }
-
-      if( putenv(new_runpath) != 0) {
-        exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set
-                    properly */
-      }
-
-      /*
-       * Unix systems document that they look at LD_LIBRARY_PATH only
-       * once at startup, so we have to re-exec the current executable
-       * to get the changed environment variable to have an effect.
-       */
-
-#ifdef __sun
-      /*
-       * If dmpath is not NULL, remove the data model specific string
-       * in the environment for the exec'ed child.
-       */
-
-      if( dmpath != NULL)
-        (void)UnsetEnv((wanted==32)?"LD_LIBRARY_PATH_32":"LD_LIBRARY_PATH_64");
-#endif
-
-      newenvp = environ;
-
-      {
-        char *newexec = execname;
-#ifdef DUAL_MODE
-        /*
-         * If the data model is being changed, the path to the
-         * executable must be updated accordingly; the executable name
-         * and directory the executable resides in are separate.  In the
-         * case of 32 => 64, the new bits are assumed to reside in, e.g.
-         * "olddir/BIGARCH/execname"; in the case of 64 => 32,
-         * the bits are assumed to be in "olddir/../execname".  For example,
-         *
-         * olddir/sparcv9/execname
-         * olddir/amd64/execname
-         *
-         * for Solaris SPARC and Bsd amd64, respectively.
-         */
-
-        if (running != wanted) {
-          char *oldexec = strcpy(MemAlloc(strlen(execname) + 1), execname);
-          char *olddir = oldexec;
-          char *oldbase = strrchr(oldexec, '/');
-
-
-          newexec = MemAlloc(strlen(execname) + 20);
-          *oldbase++ = 0;
-          sprintf(newexec, "%s/%s/%s", olddir,
-                  ((wanted==64) ? BIG_ARCH : ".."), oldbase);
-          argv[0] = newexec;
-        }
-#endif
-
-        execve(newexec, argv, newenvp);
-        perror("execve()");
-
-        fprintf(stderr, "Error trying to exec %s.\n", newexec);
-        fprintf(stderr, "Check if file exists and permissions are set correctly.\n");
-
-#ifdef DUAL_MODE
-        if (running != wanted) {
-          fprintf(stderr, "Failed to start a %d-bit JVM process from a %d-bit JVM.\n",
-                  wanted, running);
-#  ifdef __sun
-
-#    ifdef __sparc
-          fprintf(stderr, "Verify all necessary J2SE components have been installed.\n" );
-          fprintf(stderr,
-                  "(Solaris SPARC 64-bit components must be installed after 32-bit components.)\n" );
-#    else
-          fprintf(stderr, "Either 64-bit processes are not supported by this platform\n");
-          fprintf(stderr, "or the 64-bit components have not been installed.\n");
-#    endif
-        }
-#  endif
-#endif
-
-      }
-
-      exit(1);
-    }
-
-#else  /* ifndef GAMMA */
-
-  /* gamma launcher is simpler in that it doesn't handle VM flavors, data  */
-  /* model, LD_LIBRARY_PATH, etc. Assuming everything is set-up correctly  */
-  /* all we need to do here is to return correct path names. See also      */
-  /* GetJVMPath() and GetApplicationHome().                                */
-
-  { char *arch = (char *)GetArch(); /* like sparc or sparcv9 */
-    char *p;
-
-    if (!GetJREPath(jrepath, so_jrepath, arch, JNI_FALSE) ) {
-      fprintf(stderr, "Error: could not find Java 2 Runtime Environment.\n");
-      exit(2);
-    }
-
-    if (!GetJVMPath(jrepath, NULL, jvmpath, so_jvmpath, arch )) {
-      fprintf(stderr, "Error: no JVM at `%s'.\n", jvmpath);
-      exit(4);
-    }
-  }
-
-#endif  /* ifndef GAMMA */
-}
-
-
-/*
- * On Solaris VM choosing is done by the launcher (java.c).
- */
-static jboolean
-GetJVMPath(const char *jrepath, const char *jvmtype,
-           char *jvmpath, jint jvmpathsize, char * arch)
-{
-    struct stat s;
-
-#ifndef GAMMA
-    if (strchr(jvmtype, '/')) {
-        sprintf(jvmpath, "%s/" JVM_DLL, jvmtype);
-    } else {
-        sprintf(jvmpath, "%s/lib/%s/%s/" JVM_DLL, jrepath, arch, jvmtype);
-    }
-#else
-    /* For gamma launcher, JVM is either built-in or in the same directory. */
-    /* Either way we return "<exe_path>/libjvm.so" where <exe_path> is the  */
-    /* directory where gamma launcher is located.                           */
-
-    char *p;
-
-    snprintf(jvmpath, jvmpathsize, "%s", GetExecname());
-    p = strrchr(jvmpath, '/');
-    if (p) {
-       /* replace executable name with libjvm.so */
-       snprintf(p + 1, jvmpathsize - (p + 1 - jvmpath), "%s", JVM_DLL);
-    } else {
-       /* this case shouldn't happen */
-       snprintf(jvmpath, jvmpathsize, "%s", JVM_DLL);
-    }
-#endif
-
-    if (_launcher_debug)
-      printf("Does `%s' exist ... ", jvmpath);
-
-    if (stat(jvmpath, &s) == 0) {
-        if (_launcher_debug)
-          printf("yes.\n");
-        return JNI_TRUE;
-    } else {
-        if (_launcher_debug)
-          printf("no.\n");
-        return JNI_FALSE;
-    }
-}
-
-/*
- * Find path to JRE based on .exe's location or registry settings.
- */
-static jboolean
-GetJREPath(char *path, jint pathsize, char * arch, jboolean speculative)
-{
-    char libjava[MAXPATHLEN];
-
-    if (GetApplicationHome(path, pathsize)) {
-        /* Is JRE co-located with the application? */
-        sprintf(libjava, "%s/lib/%s/" JAVA_DLL, path, arch);
-        if (access(libjava, F_OK) == 0) {
-            goto found;
-        }
-
-        /* Does the app ship a private JRE in <apphome>/jre directory? */
-        sprintf(libjava, "%s/jre/lib/%s/" JAVA_DLL, path, arch);
-        if (access(libjava, F_OK) == 0) {
-            strcat(path, "/jre");
-            goto found;
-        }
-    }
-
-    if (!speculative)
-      fprintf(stderr, "Error: could not find " JAVA_DLL "\n");
-    return JNI_FALSE;
-
- found:
-    if (_launcher_debug)
-      printf("JRE path is %s\n", path);
-    return JNI_TRUE;
-}
-
-jboolean
-LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
-{
-#ifdef GAMMA
-    /* JVM is directly linked with gamma launcher; no dlopen() */
-    ifn->CreateJavaVM = JNI_CreateJavaVM;
-    ifn->GetDefaultJavaVMInitArgs = JNI_GetDefaultJavaVMInitArgs;
-    return JNI_TRUE;
-#else
-    Dl_info dlinfo;
-    void *libjvm;
-
-    if (_launcher_debug) {
-        printf("JVM path is %s\n", jvmpath);
-    }
-
-    libjvm = dlopen(jvmpath, RTLD_NOW + RTLD_GLOBAL);
-    if (libjvm == NULL) {
-#if defined(__sparc) && !defined(_LP64) /* i.e. 32-bit sparc */
-      FILE * fp;
-      Elf32_Ehdr elf_head;
-      int count;
-      int location;
-
-      fp = fopen(jvmpath, "r");
-      if(fp == NULL)
-        goto error;
-
-      /* read in elf header */
-      count = fread((void*)(&elf_head), sizeof(Elf32_Ehdr), 1, fp);
-      fclose(fp);
-      if(count < 1)
-        goto error;
-
-      /*
-       * Check for running a server vm (compiled with -xarch=v8plus)
-       * on a stock v8 processor.  In this case, the machine type in
-       * the elf header would not be included the architecture list
-       * provided by the isalist command, which is turn is gotten from
-       * sysinfo.  This case cannot occur on 64-bit hardware and thus
-       * does not have to be checked for in binaries with an LP64 data
-       * model.
-       */
-      if(elf_head.e_machine == EM_SPARC32PLUS) {
-        char buf[257];  /* recommended buffer size from sysinfo man
-                           page */
-        long length;
-        char* location;
-
-        length = sysinfo(SI_ISALIST, buf, 257);
-        if(length > 0) {
-          location = strstr(buf, "sparcv8plus ");
-          if(location == NULL) {
-            fprintf(stderr, "SPARC V8 processor detected; Server compiler requires V9 or better.\n");
-            fprintf(stderr, "Use Client compiler on V8 processors.\n");
-            fprintf(stderr, "Could not create the Java virtual machine.\n");
-            return JNI_FALSE;
-          }
-        }
-      }
-#endif
-      fprintf(stderr, "dl failure on line %d", __LINE__);
-      goto error;
-    }
-
-    ifn->CreateJavaVM = (CreateJavaVM_t)
-      dlsym(libjvm, "JNI_CreateJavaVM");
-    if (ifn->CreateJavaVM == NULL)
-        goto error;
-
-    ifn->GetDefaultJavaVMInitArgs = (GetDefaultJavaVMInitArgs_t)
-        dlsym(libjvm, "JNI_GetDefaultJavaVMInitArgs");
-    if (ifn->GetDefaultJavaVMInitArgs == NULL)
-      goto error;
-
-    return JNI_TRUE;
-
-error:
-    fprintf(stderr, "Error: failed %s, because %s\n", jvmpath, dlerror());
-    return JNI_FALSE;
-#endif /* GAMMA */
-}
-
-/*
- * Get the path to the file that has the usage message for -X options.
- */
-void
-GetXUsagePath(char *buf, jint bufsize)
-{
-    static const char Xusage_txt[] = "/Xusage.txt";
-    Dl_info dlinfo;
-
-    /* we use RTLD_NOW because of problems with ld.so.1 and green threads */
-    dladdr(dlsym(dlopen(JVM_DLL, RTLD_NOW), "JNI_CreateJavaVM"), &dlinfo);
-    strncpy(buf, (char *)dlinfo.dli_fname, bufsize - sizeof(Xusage_txt));
-
-    buf[bufsize-1] = '\0';
-    strcpy(strrchr(buf, '/'), Xusage_txt);
-}
-
-/*
- * If app is "/foo/bin/javac", or "/foo/bin/sparcv9/javac" then put
- * "/foo" into buf.
- */
-jboolean
-GetApplicationHome(char *buf, jint bufsize)
-{
-#ifdef _ALLBSD_SOURCE
-    char *execname = GetExecname();
-    if (execname) {
-        strncpy(buf, execname, bufsize-1);
-        buf[bufsize-1] = '\0';
-    } else {
-        return JNI_FALSE;
-    }
-#else
-    Dl_info dlinfo;
-
-    dladdr((void *)GetApplicationHome, &dlinfo);
-    if (realpath(dlinfo.dli_fname, buf) == NULL) {
-        fprintf(stderr, "Error: realpath(`%s') failed.\n", dlinfo.dli_fname);
-        return JNI_FALSE;
-    }
-#endif
-
-#ifdef GAMMA
-    {
-      /* gamma launcher uses JAVA_HOME environment variable to find JDK/JRE */
-      char* java_home_var = getenv("JAVA_HOME");
-      if (java_home_var == NULL) {
-        printf("JAVA_HOME must point to a valid JDK/JRE to run gamma\n");
-        return JNI_FALSE;
-      }
-      snprintf(buf, bufsize, "%s", java_home_var);
-    }
-#else
-    if (strrchr(buf, '/') == 0) {
-        buf[0] = '\0';
-        return JNI_FALSE;
-    }
-    *(strrchr(buf, '/')) = '\0';        /* executable file      */
-    if (strlen(buf) < 4 || strrchr(buf, '/') == 0) {
-        buf[0] = '\0';
-        return JNI_FALSE;
-    }
-    if (strcmp("/bin", buf + strlen(buf) - 4) != 0)
-        *(strrchr(buf, '/')) = '\0';    /* sparcv9 or amd64     */
-    if (strlen(buf) < 4 || strcmp("/bin", buf + strlen(buf) - 4) != 0) {
-        buf[0] = '\0';
-        return JNI_FALSE;
-    }
-    *(strrchr(buf, '/')) = '\0';        /* bin                  */
-#endif /* GAMMA */
-
-    return JNI_TRUE;
-}
-
-
-/*
- * Return true if the named program exists
- */
-static int
-ProgramExists(char *name)
-{
-    struct stat sb;
-    if (stat(name, &sb) != 0) return 0;
-    if (S_ISDIR(sb.st_mode)) return 0;
-    return (sb.st_mode & S_IEXEC) != 0;
-}
-
-
-/*
- * Find a command in a directory, returning the path.
- */
-static char *
-Resolve(char *indir, char *cmd)
-{
-    char name[PATH_MAX + 2], *real;
-
-    if ((strlen(indir) + strlen(cmd) + 1)  > PATH_MAX) return 0;
-    sprintf(name, "%s%c%s", indir, FILE_SEPARATOR, cmd);
-    if (!ProgramExists(name)) return 0;
-    real = MemAlloc(PATH_MAX + 2);
-    if (!realpath(name, real))
-        strcpy(real, name);
-    return real;
-}
-
-
-/*
- * Find a path for the executable
- */
-static char *
-FindExecName(char *program)
-{
-    char cwdbuf[PATH_MAX+2];
-    char *path;
-    char *tmp_path;
-    char *f;
-    char *result = NULL;
-
-    /* absolute path? */
-    if (*program == FILE_SEPARATOR ||
-        (FILE_SEPARATOR=='\\' && strrchr(program, ':')))
-        return Resolve("", program+1);
-
-    /* relative path? */
-    if (strrchr(program, FILE_SEPARATOR) != 0) {
-        char buf[PATH_MAX+2];
-        return Resolve(getcwd(cwdbuf, sizeof(cwdbuf)), program);
-    }
-
-    /* from search path? */
-    path = getenv("PATH");
-    if (!path || !*path) path = ".";
-    tmp_path = MemAlloc(strlen(path) + 2);
-    strcpy(tmp_path, path);
-
-    for (f=tmp_path; *f && result==0; ) {
-        char *s = f;
-        while (*f && (*f != PATH_SEPARATOR)) ++f;
-        if (*f) *f++ = 0;
-        if (*s == FILE_SEPARATOR)
-            result = Resolve(s, program);
-        else {
-            /* relative path element */
-            char dir[2*PATH_MAX];
-            sprintf(dir, "%s%c%s", getcwd(cwdbuf, sizeof(cwdbuf)),
-                    FILE_SEPARATOR, s);
-            result = Resolve(dir, program);
-        }
-        if (result != 0) break;
-    }
-
-    free(tmp_path);
-    return result;
-}
-
-
-/* Store the name of the executable once computed */
-static char *execname = NULL;
-
-/*
- * Compute the name of the executable
- *
- * In order to re-exec securely we need the absolute path of the
- * executable. On Solaris getexecname(3c) may not return an absolute
- * path so we use dladdr to get the filename of the executable and
- * then use realpath to derive an absolute path. From Solaris 9
- * onwards the filename returned in DL_info structure from dladdr is
- * an absolute pathname so technically realpath isn't required.
- * On Bsd we read the executable name from /proc/self/exe.
- * As a fallback, and for platforms other than Solaris and Bsd,
- * we use FindExecName to compute the executable name.
- */
-static char *
-SetExecname(char **argv)
-{
-    char* exec_path = NULL;
-
-    if (execname != NULL)       /* Already determined */
-        return (execname);
-
-#if defined(__sun)
-    {
-        Dl_info dlinfo;
-        if (dladdr((void*)&SetExecname, &dlinfo)) {
-            char *resolved = (char*)MemAlloc(PATH_MAX+1);
-            if (resolved != NULL) {
-                exec_path = realpath(dlinfo.dli_fname, resolved);
-                if (exec_path == NULL) {
-                    free(resolved);
-                }
-            }
-        }
-    }
-#elif defined(__linux__)
-    {
-        const char* self = "/proc/self/exe";
-        char buf[PATH_MAX+1];
-        int len = readlink(self, buf, PATH_MAX);
-        if (len >= 0) {
-            buf[len] = '\0';            /* readlink doesn't nul terminate */
-            exec_path = strdup(buf);
-        }
-    }
-#else /* !__sun && !__linux */
-    {
-        /* Not implemented */
-    }
-#endif
-
-    if (exec_path == NULL) {
-        exec_path = FindExecName(argv[0]);
-    }
-    execname = exec_path;
-    return exec_path;
-}
-
-/*
- * Return the name of the executable.  Used in java_md.c to find the JRE area.
- */
-static char *
-GetExecname() {
-  return execname;
-}
-
-void ReportErrorMessage(char * message, jboolean always) {
-  if (always) {
-    fprintf(stderr, "%s\n", message);
-  }
-}
-
-void ReportErrorMessage2(char * format, char * string, jboolean always) {
-  if (always) {
-    fprintf(stderr, format, string);
-    fprintf(stderr, "\n");
-  }
-}
-
-void  ReportExceptionDescription(JNIEnv * env) {
-  (*env)->ExceptionDescribe(env);
-}
-
-/*
- * Return JNI_TRUE for an option string that has no effect but should
- * _not_ be passed on to the vm; return JNI_FALSE otherwise.  On
- * Solaris SPARC, this screening needs to be done if:
- * 1) LD_LIBRARY_PATH does _not_ need to be reset and
- * 2) -d32 or -d64 is passed to a binary with a matching data model
- *    (the exec in SetLibraryPath removes -d<n> options and points the
- *    exec to the proper binary).  When this exec is not done, these options
- *    would end up getting passed onto the vm.
- */
-jboolean RemovableMachineDependentOption(char * option) {
-  /*
-   * Unconditionally remove both -d32 and -d64 options since only
-   * the last such options has an effect; e.g.
-   * java -d32 -d64 -d32 -version
-   * is equivalent to
-   * java -d32 -version
-   */
-
-  if( (strcmp(option, "-d32")  == 0 ) ||
-      (strcmp(option, "-d64")  == 0 ))
-    return JNI_TRUE;
-  else
-    return JNI_FALSE;
-}
-
-void PrintMachineDependentOptions() {
-      fprintf(stdout,
-        "    -d32          use a 32-bit data model if available\n"
-        "\n"
-        "    -d64          use a 64-bit data model if available\n");
-      return;
-}
-
-#ifndef GAMMA  /* gamma launcher does not have ergonomics */
-
-/*
- * The following methods (down to ServerClassMachine()) answer
- * the question about whether a machine is a "server-class"
- * machine.  A server-class machine is loosely defined as one
- * with 2 or more processors and 2 gigabytes or more physical
- * memory.  The definition of a processor is a physical package,
- * not a hyperthreaded chip masquerading as a multi-processor.
- * The definition of memory is also somewhat fuzzy, since x86
- * machines seem not to report all the memory in their DIMMs, we
- * think because of memory mapping of graphics cards, etc.
- *
- * This code is somewhat more confused with #ifdef's than we'd
- * like because this file is used by both Solaris and Bsd
- * platforms, and so needs to be parameterized for SPARC and
- * i586 hardware.  The other Bsd platforms (amd64 and ia64)
- * don't even ask this question, because they only come with
- * server JVMs.  */
-
-# define KB (1024UL)
-# define MB (1024UL * KB)
-# define GB (1024UL * MB)
-
-/* Compute physical memory by asking the OS */
-uint64_t
-physical_memory(void) {
-  const uint64_t pages     = (uint64_t) sysconf(_SC_PHYS_PAGES);
-  const uint64_t page_size = (uint64_t) sysconf(_SC_PAGESIZE);
-  const uint64_t result    = pages * page_size;
-# define UINT64_FORMAT "%" PRIu64
-
-  if (_launcher_debug) {
-    printf("pages: " UINT64_FORMAT
-           "  page_size: " UINT64_FORMAT
-           "  physical memory: " UINT64_FORMAT " (%.3fGB)\n",
-           pages, page_size, result, result / (double) GB);
-  }
-  return result;
-}
-
-#if defined(__sun) && defined(__sparc)
-
-/* Methods for solaris-sparc: these are easy. */
-
-/* Ask the OS how many processors there are. */
-unsigned long
-physical_processors(void) {
-  const unsigned long sys_processors = sysconf(_SC_NPROCESSORS_CONF);
-
-  if (_launcher_debug) {
-    printf("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors);
-  }
-  return sys_processors;
-}
-
-/* The solaris-sparc version of the "server-class" predicate. */
-jboolean
-solaris_sparc_ServerClassMachine(void) {
-  jboolean            result            = JNI_FALSE;
-  /* How big is a server class machine? */
-  const unsigned long server_processors = 2UL;
-  const uint64_t      server_memory     = 2UL * GB;
-  const uint64_t      actual_memory     = physical_memory();
-
-  /* Is this a server class machine? */
-  if (actual_memory >= server_memory) {
-    const unsigned long actual_processors = physical_processors();
-    if (actual_processors >= server_processors) {
-      result = JNI_TRUE;
-    }
-  }
-  if (_launcher_debug) {
-    printf("solaris_" ARCH "_ServerClassMachine: %s\n",
-           (result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE"));
-  }
-  return result;
-}
-
-#endif /* __sun && __sparc */
-
-#if defined(__sun) && defined(i586)
-
-/*
- * A utility method for asking the CPU about itself.
- * There's a corresponding version of bsd-i586
- * because the compilers are different.
- */
-void
-get_cpuid(uint32_t arg,
-          uint32_t* eaxp,
-          uint32_t* ebxp,
-          uint32_t* ecxp,
-          uint32_t* edxp) {
-#ifdef _LP64
-  asm(
-  /* rbx is a callee-saved register */
-      " movq    %rbx, %r11  \n"
-  /* rdx and rcx are 3rd and 4th argument registers */
-      " movq    %rdx, %r10  \n"
-      " movq    %rcx, %r9   \n"
-      " movl    %edi, %eax  \n"
-      " cpuid               \n"
-      " movl    %eax, (%rsi)\n"
-      " movl    %ebx, (%r10)\n"
-      " movl    %ecx, (%r9) \n"
-      " movl    %edx, (%r8) \n"
-  /* Restore rbx */
-      " movq    %r11, %rbx");
-#else
-  /* EBX is a callee-saved register */
-  asm(" pushl   %ebx");
-  /* Need ESI for storing through arguments */
-  asm(" pushl   %esi");
-  asm(" movl    8(%ebp), %eax   \n"
-      " cpuid                   \n"
-      " movl    12(%ebp), %esi  \n"
-      " movl    %eax, (%esi)    \n"
-      " movl    16(%ebp), %esi  \n"
-      " movl    %ebx, (%esi)    \n"
-      " movl    20(%ebp), %esi  \n"
-      " movl    %ecx, (%esi)    \n"
-      " movl    24(%ebp), %esi  \n"
-      " movl    %edx, (%esi)      ");
-  /* Restore ESI and EBX */
-  asm(" popl    %esi");
-  /* Restore EBX */
-  asm(" popl    %ebx");
-#endif
-}
-
-#endif /* __sun && i586 */
-
-#if defined(_ALLBSD_SOURCE) && defined(i586)
-
-/*
- * A utility method for asking the CPU about itself.
- * There's a corresponding version of solaris-i586
- * because the compilers are different.
- */
-void
-get_cpuid(uint32_t arg,
-          uint32_t* eaxp,
-          uint32_t* ebxp,
-          uint32_t* ecxp,
-          uint32_t* edxp) {
-#ifdef _LP64
-  __asm__ volatile (/* Instructions */
-                    "   movl    %4, %%eax  \n"
-                    "   cpuid              \n"
-                    "   movl    %%eax, (%0)\n"
-                    "   movl    %%ebx, (%1)\n"
-                    "   movl    %%ecx, (%2)\n"
-                    "   movl    %%edx, (%3)\n"
-                    : /* Outputs */
-                    : /* Inputs */
-                    "r" (eaxp),
-                    "r" (ebxp),
-                    "r" (ecxp),
-                    "r" (edxp),
-                    "r" (arg)
-                    : /* Clobbers */
-                    "%rax", "%rbx", "%rcx", "%rdx", "memory"
-                    );
-#else
-  uint32_t value_of_eax = 0;
-  uint32_t value_of_ebx = 0;
-  uint32_t value_of_ecx = 0;
-  uint32_t value_of_edx = 0;
-  __asm__ volatile (/* Instructions */
-                        /* ebx is callee-save, so push it */
-                        /* even though it's in the clobbers section */
-                    "   pushl   %%ebx      \n"
-                    "   movl    %4, %%eax  \n"
-                    "   cpuid              \n"
-                    "   movl    %%eax, %0  \n"
-                    "   movl    %%ebx, %1  \n"
-                    "   movl    %%ecx, %2  \n"
-                    "   movl    %%edx, %3  \n"
-                        /* restore ebx */
-                    "   popl    %%ebx      \n"
-
-                    : /* Outputs */
-                    "=m" (value_of_eax),
-                    "=m" (value_of_ebx),
-                    "=m" (value_of_ecx),
-                    "=m" (value_of_edx)
-                    : /* Inputs */
-                    "m" (arg)
-                    : /* Clobbers */
-                    "%eax", "%ebx", "%ecx", "%edx"
-                    );
-  *eaxp = value_of_eax;
-  *ebxp = value_of_ebx;
-  *ecxp = value_of_ecx;
-  *edxp = value_of_edx;
-#endif
-}
-
-#endif /* _ALLBSD_SOURCE && i586 */
-
-#ifdef i586
-/*
- * Routines shared by solaris-i586 and bsd-i586.
- */
-
-enum HyperThreadingSupport_enum {
-  hts_supported        =  1,
-  hts_too_soon_to_tell =  0,
-  hts_not_supported    = -1,
-  hts_not_pentium4     = -2,
-  hts_not_intel        = -3
-};
-typedef enum HyperThreadingSupport_enum HyperThreadingSupport;
-
-/* Determine if hyperthreading is supported */
-HyperThreadingSupport
-hyperthreading_support(void) {
-  HyperThreadingSupport result = hts_too_soon_to_tell;
-  /* Bits 11 through 8 is family processor id */
-# define FAMILY_ID_SHIFT 8
-# define FAMILY_ID_MASK 0xf
-  /* Bits 23 through 20 is extended family processor id */
-# define EXT_FAMILY_ID_SHIFT 20
-# define EXT_FAMILY_ID_MASK 0xf
-  /* Pentium 4 family processor id */
-# define PENTIUM4_FAMILY_ID 0xf
-  /* Bit 28 indicates Hyper-Threading Technology support */
-# define HT_BIT_SHIFT 28
-# define HT_BIT_MASK 1
-  uint32_t vendor_id[3] = { 0U, 0U, 0U };
-  uint32_t value_of_eax = 0U;
-  uint32_t value_of_edx = 0U;
-  uint32_t dummy        = 0U;
-
-  /* Yes, this is supposed to be [0], [2], [1] */
-  get_cpuid(0, &dummy, &vendor_id[0], &vendor_id[2], &vendor_id[1]);
-  if (_launcher_debug) {
-    printf("vendor: %c %c %c %c %c %c %c %c %c %c %c %c \n",
-           ((vendor_id[0] >>  0) & 0xff),
-           ((vendor_id[0] >>  8) & 0xff),
-           ((vendor_id[0] >> 16) & 0xff),
-           ((vendor_id[0] >> 24) & 0xff),
-           ((vendor_id[1] >>  0) & 0xff),
-           ((vendor_id[1] >>  8) & 0xff),
-           ((vendor_id[1] >> 16) & 0xff),
-           ((vendor_id[1] >> 24) & 0xff),
-           ((vendor_id[2] >>  0) & 0xff),
-           ((vendor_id[2] >>  8) & 0xff),
-           ((vendor_id[2] >> 16) & 0xff),
-           ((vendor_id[2] >> 24) & 0xff));
-  }
-  get_cpuid(1, &value_of_eax, &dummy, &dummy, &value_of_edx);
-  if (_launcher_debug) {
-    printf("value_of_eax: 0x%x  value_of_edx: 0x%x\n",
-           value_of_eax, value_of_edx);
-  }
-  if ((((value_of_eax >> FAMILY_ID_SHIFT) & FAMILY_ID_MASK) == PENTIUM4_FAMILY_ID) ||
-      (((value_of_eax >> EXT_FAMILY_ID_SHIFT) & EXT_FAMILY_ID_MASK) != 0)) {
-    if ((((vendor_id[0] >>  0) & 0xff) == 'G') &&
-        (((vendor_id[0] >>  8) & 0xff) == 'e') &&
-        (((vendor_id[0] >> 16) & 0xff) == 'n') &&
-        (((vendor_id[0] >> 24) & 0xff) == 'u') &&
-        (((vendor_id[1] >>  0) & 0xff) == 'i') &&
-        (((vendor_id[1] >>  8) & 0xff) == 'n') &&
-        (((vendor_id[1] >> 16) & 0xff) == 'e') &&
-        (((vendor_id[1] >> 24) & 0xff) == 'I') &&
-        (((vendor_id[2] >>  0) & 0xff) == 'n') &&
-        (((vendor_id[2] >>  8) & 0xff) == 't') &&
-        (((vendor_id[2] >> 16) & 0xff) == 'e') &&
-        (((vendor_id[2] >> 24) & 0xff) == 'l')) {
-      if (((value_of_edx >> HT_BIT_SHIFT) & HT_BIT_MASK) == HT_BIT_MASK) {
-        if (_launcher_debug) {
-          printf("Hyperthreading supported\n");
-        }
-        result = hts_supported;
-      } else {
-        if (_launcher_debug) {
-          printf("Hyperthreading not supported\n");
-        }
-        result = hts_not_supported;
-      }
-    } else {
-      if (_launcher_debug) {
-        printf("Not GenuineIntel\n");
-      }
-      result = hts_not_intel;
-    }
-  } else {
-    if (_launcher_debug) {
-      printf("not Pentium 4 or extended\n");
-    }
-    result = hts_not_pentium4;
-  }
-  return result;
-}
-
-/* Determine how many logical processors there are per CPU */
-unsigned int
-logical_processors_per_package(void) {
-  /*
-   * After CPUID with EAX==1, register EBX bits 23 through 16
-   * indicate the number of logical processors per package
-   */
-# define NUM_LOGICAL_SHIFT 16
-# define NUM_LOGICAL_MASK 0xff
-  unsigned int result                        = 1U;
-  const HyperThreadingSupport hyperthreading = hyperthreading_support();
-
-  if (hyperthreading == hts_supported) {
-    uint32_t value_of_ebx = 0U;
-    uint32_t dummy        = 0U;
-
-    get_cpuid(1, &dummy, &value_of_ebx, &dummy, &dummy);
-    result = (value_of_ebx >> NUM_LOGICAL_SHIFT) & NUM_LOGICAL_MASK;
-    if (_launcher_debug) {
-      printf("logical processors per package: %u\n", result);
-    }
-  }
-  return result;
-}
-
-/* Compute the number of physical processors, not logical processors */
-unsigned long
-physical_processors(void) {
-  const long sys_processors = sysconf(_SC_NPROCESSORS_CONF);
-  unsigned long result      = sys_processors;
-
-  if (_launcher_debug) {
-    printf("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors);
-  }
-  if (sys_processors > 1) {
-    unsigned int logical_processors = logical_processors_per_package();
-    if (logical_processors > 1) {
-      result = (unsigned long) sys_processors / logical_processors;
-    }
-  }
-  if (_launcher_debug) {
-    printf("physical processors: %lu\n", result);
-  }
-  return result;
-}
-
-#endif /* i586 */
-
-#if defined(__sun) && defined(i586)
-
-/* The definition of a server-class machine for solaris-i586/amd64 */
-jboolean
-solaris_i586_ServerClassMachine(void) {
-  jboolean            result            = JNI_FALSE;
-  /* How big is a server class machine? */
-  const unsigned long server_processors = 2UL;
-  const uint64_t      server_memory     = 2UL * GB;
-  /*
-   * We seem not to get our full complement of memory.
-   *     We allow some part (1/8?) of the memory to be "missing",
-   *     based on the sizes of DIMMs, and maybe graphics cards.
-   */
-  const uint64_t      missing_memory    = 256UL * MB;
-  const uint64_t      actual_memory     = physical_memory();
-
-  /* Is this a server class machine? */
-  if (actual_memory >= (server_memory - missing_memory)) {
-    const unsigned long actual_processors = physical_processors();
-    if (actual_processors >= server_processors) {
-      result = JNI_TRUE;
-    }
-  }
-  if (_launcher_debug) {
-    printf("solaris_" ARCH "_ServerClassMachine: %s\n",
-           (result == JNI_TRUE ? "true" : "false"));
-  }
-  return result;
-}
-
-#endif /* __sun && i586 */
-
-#if defined(_ALLBSD_SOURCE) && defined(i586)
-
-/* The definition of a server-class machine for bsd-i586 */
-jboolean
-bsd_i586_ServerClassMachine(void) {
-  jboolean            result            = JNI_FALSE;
-  /* How big is a server class machine? */
-  const unsigned long server_processors = 2UL;
-  const uint64_t      server_memory     = 2UL * GB;
-  /*
-   * We seem not to get our full complement of memory.
-   *     We allow some part (1/8?) of the memory to be "missing",
-   *     based on the sizes of DIMMs, and maybe graphics cards.
-   */
-  const uint64_t      missing_memory    = 256UL * MB;
-  const uint64_t      actual_memory     = physical_memory();
-
-  /* Is this a server class machine? */
-  if (actual_memory >= (server_memory - missing_memory)) {
-    const unsigned long actual_processors = physical_processors();
-    if (actual_processors >= server_processors) {
-      result = JNI_TRUE;
-    }
-  }
-  if (_launcher_debug) {
-    printf("bsd_" ARCH "_ServerClassMachine: %s\n",
-           (result == JNI_TRUE ? "true" : "false"));
-  }
-  return result;
-}
-
-#endif /* _ALLBSD_SOURCE && i586 */
-
-/* Dispatch to the platform-specific definition of "server-class" */
-jboolean
-ServerClassMachine(void) {
-  jboolean result = JNI_FALSE;
-#if   defined(__sun) && defined(__sparc)
-  result = solaris_sparc_ServerClassMachine();
-#elif defined(__sun) && defined(i586)
-  result = solaris_i586_ServerClassMachine();
-#elif defined(_ALLBSD_SOURCE) && defined(i586)
-  result = bsd_i586_ServerClassMachine();
-#else
-  if (_launcher_debug) {
-    printf("ServerClassMachine: returns default value of %s\n",
-           (result == JNI_TRUE ? "true" : "false"));
-  }
-#endif
-  return result;
-}
-
-#endif /* ifndef GAMMA */
-
-#ifndef GAMMA /* gamma launcher does not choose JDK/JRE/JVM */
-
-/*
- *      Since using the file system as a registry is a bit risky, perform
- *      additional sanity checks on the identified directory to validate
- *      it as a valid jre/sdk.
- *
- *      Return 0 if the tests fail; otherwise return non-zero (true).
- *
- *      Note that checking for anything more than the existence of an
- *      executable object at bin/java relative to the path being checked
- *      will break the regression tests.
- */
-static int
-CheckSanity(char *path, char *dir)
-{
-    char    buffer[PATH_MAX];
-
-    if (strlen(path) + strlen(dir) + 11 > PATH_MAX)
-        return (0);     /* Silently reject "impossibly" long paths */
-
-    (void)strcat(strcat(strcat(strcpy(buffer, path), "/"), dir), "/bin/java");
-    return ((access(buffer, X_OK) == 0) ? 1 : 0);
-}
-
-/*
- *      Determine if there is an acceptable JRE in the directory dirname.
- *      Upon locating the "best" one, return a fully qualified path to
- *      it. "Best" is defined as the most advanced JRE meeting the
- *      constraints contained in the manifest_info. If no JRE in this
- *      directory meets the constraints, return NULL.
- *
- *      Note that we don't check for errors in reading the directory
- *      (which would be done by checking errno).  This is because it
- *      doesn't matter if we get an error reading the directory, or
- *      we just don't find anything interesting in the directory.  We
- *      just return NULL in either case.
- *
- *      The historical names of j2sdk and j2re were changed to jdk and
- *      jre respecively as part of the 1.5 rebranding effort.  Since the
- *      former names are legacy on Bsd, they must be recognized for
- *      all time.  Fortunately, this is a minor cost.
- */
-static char
-*ProcessDir(manifest_info *info, char *dirname)
-{
-    DIR     *dirp;
-    struct dirent *dp;
-    char    *best = NULL;
-    int     offset;
-    int     best_offset = 0;
-    char    *ret_str = NULL;
-    char    buffer[PATH_MAX];
-
-    if ((dirp = opendir(dirname)) == NULL)
-        return (NULL);
-
-    do {
-        if ((dp = readdir(dirp)) != NULL) {
-            offset = 0;
-            if ((strncmp(dp->d_name, "jre", 3) == 0) ||
-                (strncmp(dp->d_name, "jdk", 3) == 0))
-                offset = 3;
-            else if (strncmp(dp->d_name, "j2re", 4) == 0)
-                offset = 4;
-            else if (strncmp(dp->d_name, "j2sdk", 5) == 0)
-                offset = 5;
-            if (offset > 0) {
-                if ((acceptable_release(dp->d_name + offset,
-                    info->jre_version)) && CheckSanity(dirname, dp->d_name))
-                    if ((best == NULL) || (exact_version_id(
-                      dp->d_name + offset, best + best_offset) > 0)) {
-                        if (best != NULL)
-                            free(best);
-                        best = strdup(dp->d_name);
-                        best_offset = offset;
-                    }
-            }
-        }
-    } while (dp != NULL);
-    (void) closedir(dirp);
-    if (best == NULL)
-        return (NULL);
-    else {
-        ret_str = MemAlloc(strlen(dirname) + strlen(best) + 2);
-        ret_str = strcat(strcat(strcpy(ret_str, dirname), "/"), best);
-        free(best);
-        return (ret_str);
-    }
-}
-
-/*
- *      This is the global entry point. It examines the host for the optimal
- *      JRE to be used by scanning a set of directories.  The set of directories
- *      is platform dependent and can be overridden by the environment
- *      variable JAVA_VERSION_PATH.
- *
- *      This routine itself simply determines the set of appropriate
- *      directories before passing control onto ProcessDir().
- */
-char*
-LocateJRE(manifest_info* info)
-{
-    char        *path;
-    char        *home;
-    char        *target = NULL;
-    char        *dp;
-    char        *cp;
-
-    /*
-     * Start by getting JAVA_VERSION_PATH
-     */
-    if (info->jre_restrict_search)
-        path = strdup(system_dir);
-    else if ((path = getenv("JAVA_VERSION_PATH")) != NULL)
-        path = strdup(path);
-    else
-        if ((home = getenv("HOME")) != NULL) {
-            path = (char *)MemAlloc(strlen(home) + 13);
-            path = strcat(strcat(strcat(strcpy(path, home),
-                user_dir), ":"), system_dir);
-        } else
-            path = strdup(system_dir);
-
-    /*
-     * Step through each directory on the path. Terminate the scan with
-     * the first directory with an acceptable JRE.
-     */
-    cp = dp = path;
-    while (dp != NULL) {
-        cp = strchr(dp, (int)':');
-        if (cp != NULL)
-            *cp = (char)NULL;
-        if ((target = ProcessDir(info, dp)) != NULL)
-            break;
-        dp = cp;
-        if (dp != NULL)
-            dp++;
-    }
-    free(path);
-    return (target);
-}
-
-/*
- * Given a path to a jre to execute, this routine checks if this process
- * is indeed that jre.  If not, it exec's that jre.
- *
- * We want to actually check the paths rather than just the version string
- * built into the executable, so that given version specification (and
- * JAVA_VERSION_PATH) will yield the exact same Java environment, regardless
- * of the version of the arbitrary launcher we start with.
- */
-void
-ExecJRE(char *jre, char **argv)
-{
-    char    wanted[PATH_MAX];
-    char    *execname;
-    char    *progname;
-
-    /*
-     * Resolve the real path to the directory containing the selected JRE.
-     */
-    if (realpath(jre, wanted) == NULL) {
-        fprintf(stderr, "Unable to resolve %s\n", jre);
-        exit(1);
-    }
-
-    /*
-     * Resolve the real path to the currently running launcher.
-     */
-    execname = SetExecname(argv);
-    if (execname == NULL) {
-        fprintf(stderr, "Unable to resolve current executable\n");
-        exit(1);
-    }
-
-    /*
-     * If the path to the selected JRE directory is a match to the initial
-     * portion of the path to the currently executing JRE, we have a winner!
-     * If so, just return.
-     */
-    if (strncmp(wanted, execname, strlen(wanted)) == 0)
-        return;                 /* I am the droid you were looking for */
-
-    /*
-     * If this isn't the selected version, exec the selected version.
-     */
-#ifdef JAVA_ARGS  /* javac, jar and friends. */
-    progname = "java";
-#else             /* java, oldjava, javaw and friends */
-#ifdef PROGNAME
-    progname = PROGNAME;
-#else
-    progname = *argv;
-    if ((s = strrchr(progname, FILE_SEPARATOR)) != 0) {
-        progname = s + 1;
-    }
-#endif /* PROGNAME */
-#endif /* JAVA_ARGS */
-
-    /*
-     * This should never happen (because of the selection code in SelectJRE),
-     * but check for "impossibly" long path names just because buffer overruns
-     * can be so deadly.
-     */
-    if (strlen(wanted) + strlen(progname) + 6 > PATH_MAX) {
-        fprintf(stderr, "Path length exceeds maximum length (PATH_MAX)\n");
-        exit(1);
-    }
-
-    /*
-     * Construct the path and exec it.
-     */
-    (void)strcat(strcat(wanted, "/bin/"), progname);
-    argv[0] = progname;
-    if (_launcher_debug) {
-        int i;
-        printf("execv(\"%s\"", wanted);
-        for (i = 0; argv[i] != NULL; i++)
-            printf(", \"%s\"", argv[i]);
-        printf(")\n");
-    }
-    execv(wanted, argv);
-    fprintf(stderr, "Exec of %s failed\n", wanted);
-    exit(1);
-}
-
-#endif /* ifndef GAMMA */
-
-/*
- * "Borrowed" from Solaris 10 where the unsetenv() function is being added
- * to libc thanks to SUSv3 (Standard Unix Specification, version 3). As
- * such, in the fullness of time this will appear in libc on all relevant
- * Solaris/Bsd platforms and maybe even the Windows platform.  At that
- * time, this stub can be removed.
- *
- * This implementation removes the environment locking for multithreaded
- * applications.  (We don't have access to these mutexes within libc and
- * the launcher isn't multithreaded.)  Note that what remains is platform
- * independent, because it only relies on attributes that a POSIX environment
- * defines.
- *
- * Returns 0 on success, -1 on failure.
- *
- * Also removed was the setting of errno.  The only value of errno set
- * was EINVAL ("Invalid Argument").
- */
-
-/*
- * s1(environ) is name=value
- * s2(name) is name(not the form of name=value).
- * if names match, return value of 1, else return 0
- */
-static int
-match_noeq(const char *s1, const char *s2)
-{
-        while (*s1 == *s2++) {
-                if (*s1++ == '=')
-                        return (1);
-        }
-        if (*s1 == '=' && s2[-1] == '\0')
-                return (1);
-        return (0);
-}
-
-/*
- * added for SUSv3 standard
- *
- * Delete entry from environ.
- * Do not free() memory!  Other threads may be using it.
- * Keep it around forever.
- */
-static int
-borrowed_unsetenv(const char *name)
-{
-        long    idx;            /* index into environ */
-
-        if (name == NULL || *name == '\0' ||
-            strchr(name, '=') != NULL) {
-                return (-1);
-        }
-
-        for (idx = 0; environ[idx] != NULL; idx++) {
-                if (match_noeq(environ[idx], name))
-                        break;
-        }
-        if (environ[idx] == NULL) {
-                /* name not found but still a success */
-                return (0);
-        }
-        /* squeeze up one entry */
-        do {
-                environ[idx] = environ[idx+1];
-        } while (environ[++idx] != NULL);
-
-        return (0);
-}
-/* --- End of "borrowed" code --- */
-
-/*
- * Wrapper for unsetenv() function.
- */
-int
-UnsetEnv(char *name)
-{
-    return(borrowed_unsetenv(name));
-}
-/*
- * The implementation for finding classes from the bootstrap
- * class loader, refer to java.h
- */
-static FindClassFromBootLoader_t *findBootClass = NULL;
-
-jclass
-FindBootStrapClass(JNIEnv *env, const char* classname)
-{
-   if (findBootClass == NULL) {
-       findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT,
-          "JVM_FindClassFromBootLoader");
-       if (findBootClass == NULL) {
-           fprintf(stderr, "Error: could load method JVM_FindClassFromBootLoader");
-           return NULL;
-       }
-   }
-   return findBootClass(env, classname, JNI_FALSE);
-}
-
--- a/src/os/bsd/launcher/java_md.h	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, 2005, 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.
- *
- */
-
-/*
- * Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
- * search "GAMMA" for gamma specific changes.
- */
-
-#ifndef JAVA_MD_H
-#define JAVA_MD_H
-
-#include <limits.h>
-#include <unistd.h>
-#include <sys/param.h>
-#ifndef GAMMA
-#include "manifest_info.h"
-#endif
-
-#define PATH_SEPARATOR          ':'
-#define FILESEP                 "/"
-#define FILE_SEPARATOR          '/'
-#ifndef MAXNAMELEN
-#define MAXNAMELEN              PATH_MAX
-#endif
-
-#ifdef JAVA_ARGS
-/*
- * ApplicationHome is prepended to each of these entries; the resulting
- * strings are concatenated (separated by PATH_SEPARATOR) and used as the
- * value of -cp option to the launcher.
- */
-#ifndef APP_CLASSPATH
-#define APP_CLASSPATH        { "/lib/tools.jar", "/classes" }
-#endif
-#endif
-
-#ifdef HAVE_GETHRTIME
-/*
- * Support for doing cheap, accurate interval timing.
- */
-#include <sys/time.h>
-#define CounterGet()              (gethrtime()/1000)
-#define Counter2Micros(counts)    (counts)
-#else
-#define CounterGet()              (0)
-#define Counter2Micros(counts)    (1)
-#endif /* HAVE_GETHRTIME */
-
-/*
- * Function prototypes.
- */
-#ifndef GAMMA
-char *LocateJRE(manifest_info* info);
-void ExecJRE(char *jre, char **argv);
-#endif
-int UnsetEnv(char *name);
-
-#endif
--- a/src/os/bsd/vm/attachListener_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/attachListener_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, 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
@@ -22,8 +22,11 @@
  *
  */
 
-# include "incls/_precompiled.incl"
-# include "incls/_attachListener_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/os.hpp"
+#include "services/attachListener.hpp"
+#include "services/dtraceAttacher.hpp"
 
 #include <unistd.h>
 #include <signal.h>
--- a/src/os/bsd/vm/c1_globals_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/c1_globals_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, 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
@@ -22,7 +22,15 @@
  *
  */
 
+#ifndef OS_BSD_VM_C1_GLOBALS_BSD_HPP
+#define OS_BSD_VM_C1_GLOBALS_BSD_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
 //
 // Sets the default values for operating system dependent flags used by the
 // client compiler. (see c1_globals.hpp)
 //
+
+#endif // OS_BSD_VM_C1_GLOBALS_BSD_HPP
--- a/src/os/bsd/vm/c2_globals_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/c2_globals_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, 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
@@ -22,7 +22,15 @@
  *
  */
 
+#ifndef OS_BSD_VM_C2_GLOBALS_BSD_HPP
+#define OS_BSD_VM_C2_GLOBALS_BSD_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
 //
 // Sets the default values for operating system dependent flags used by the
 // server compiler. (see c2_globals.hpp)
 //
+
+#endif // OS_BSD_VM_C2_GLOBALS_BSD_HPP
--- a/src/os/bsd/vm/chaitin_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/chaitin_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,8 +22,9 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_chaitin_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "opto/chaitin.hpp"
+#include "opto/machnode.hpp"
 
 void PhaseRegAlloc::pd_preallocate_hook() {
   // no action
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/os/bsd/vm/decoder_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1997, 2010, 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.
+ *
+ */
+
+#include "prims/jvm.h"
+#include "utilities/decoder.hpp"
+
+#include <cxxabi.h>
+
+bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
+  int   status;
+  char* result;
+  size_t size = (size_t)buflen;
+
+  // Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
+  // __cxa_demangle will call system "realloc" for additional memory, which
+  // may use different malloc/realloc mechanism that allocates 'buf'.
+  if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
+    jio_snprintf(buf, buflen, "%s", result);
+      // call c library's free
+      ::free(result);
+      return true;
+  }
+  return false;
+}
--- a/src/os/bsd/vm/dtraceJSDT_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/dtraceJSDT_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, 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
@@ -22,8 +22,16 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_dtraceJSDT_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "classfile/javaClasses.hpp"
+#include "code/codeBlob.hpp"
+#include "memory/allocation.hpp"
+#include "prims/jvm.h"
+#include "runtime/dtraceJSDT.hpp"
+#include "runtime/jniHandles.hpp"
+#include "runtime/os.hpp"
+#include "runtime/signature.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 int DTraceJSDT::pd_activate(
     void* baseAddress, jstring module,
--- a/src/os/bsd/vm/globals_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/globals_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_BSD_VM_GLOBALS_BSD_HPP
+#define OS_BSD_VM_GLOBALS_BSD_HPP
+
 //
 // Defines Bsd specific flags. They are not available on other platforms.
 //
@@ -42,3 +45,5 @@
 define_pd_global(bool, UseLargePagesIndividualAllocation, false);
 define_pd_global(bool, UseOSErrorReporting, false);
 define_pd_global(bool, UseThreadPriorities, true) ;
+
+#endif // OS_BSD_VM_GLOBALS_BSD_HPP
--- a/src/os/bsd/vm/hpi_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1999, 2006, 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.
- *
- */
-
-# include "incls/_precompiled.incl"
-# include "incls/_hpi_bsd.cpp.incl"
-
-# include <sys/param.h>
-# include <dlfcn.h>
-
-#ifdef __APPLE__
-#define HPI_LIB "libhpi.dylib"
-#define HPI_G_LIB "libhpi.dylib"
-#else
-#define HPI_LIB "libhpi.so"
-#define HPI_G_LIB "libhpi.so"
-#endif
-
-typedef jint (JNICALL *init_t)(GetInterfaceFunc *, void *);
-
-void hpi::initialize_get_interface(vm_calls_t *callbacks) {
-    char buf[JVM_MAXPATHLEN];
-    void *hpi_handle;
-    GetInterfaceFunc& getintf = _get_interface;
-    jint (JNICALL * DLL_Initialize)(GetInterfaceFunc *, void *);
-
-    if (HPILibPath && HPILibPath[0]) {
-      strncpy(buf, HPILibPath, JVM_MAXPATHLEN - 1);
-      buf[JVM_MAXPATHLEN - 1] = '\0';
-    } else {
-      const char *thread_type = "native_threads";
-
-      os::jvm_path(buf, JVM_MAXPATHLEN);
-
-#ifdef PRODUCT
-      const char * hpi_lib = "/" HPI_LIB;
-#else
-      char * ptr = strrchr(buf, '/');
-      assert(strstr(ptr, "/libjvm") == ptr, "invalid library name");
-      const char * hpi_lib = strstr(ptr, "_g") ? "/" HPI_G_LIB : "/" HPI_LIB;
-#endif
-
-      *(strrchr(buf, '/')) = '\0';  /* get rid of /libjvm.so */
-      char* p = strrchr(buf, '/');
-      if (p != NULL) p[1] = '\0';   /* get rid of hotspot    */
-      strcat(buf, thread_type);
-      strcat(buf, hpi_lib);
-    }
-
-    if (TraceHPI) tty->print_cr("Loading HPI %s ", buf);
-#ifdef SPARC
-    // On 64-bit Ubuntu Sparc RTLD_NOW leads to unresolved deps in libpthread.so
-#   define OPEN_MODE RTLD_LAZY
-#else
-    // We use RTLD_NOW because of bug 4032715
-#   define OPEN_MODE RTLD_NOW
-#endif
-    hpi_handle = dlopen(buf, OPEN_MODE);
-#undef OPEN_MODE
-
-    if (hpi_handle == NULL) {
-        if (TraceHPI) tty->print_cr("HPI dlopen failed: %s", dlerror());
-        return;
-    }
-    DLL_Initialize = CAST_TO_FN_PTR(jint (JNICALL *)(GetInterfaceFunc *, void *),
-                                    dlsym(hpi_handle, "DLL_Initialize"));
-    if (TraceHPI && DLL_Initialize == NULL) tty->print_cr("HPI dlsym of DLL_Initialize failed: %s", dlerror());
-    if (DLL_Initialize == NULL ||
-        (*DLL_Initialize)(&getintf, callbacks) < 0) {
-        if (TraceHPI) tty->print_cr("HPI DLL_Initialize failed");
-        return;
-    }
-    if (TraceHPI)  tty->print_cr("HPI loaded successfully");
-}
--- a/src/os/bsd/vm/hpi_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 1999, 2005, 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.
- *
- */
-
-//
-// Because the interruptible IO has been dropped for HotSpot/Bsd,
-// the following HPI interface is very different from HotSparc.
-//
-
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <sys/ioctl.h>
-#include <netdb.h>
-
-// HPI_FileInterface
-
-inline int hpi::close(int fd) {
-  RESTARTABLE_RETURN_INT(::close(fd)); 
-}
-
-inline size_t hpi::read(int fd, void *buf, unsigned int nBytes) {
-  size_t res;
-  RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res);
-  return res;
-}
-
-inline size_t hpi::write(int fd, const void *buf, unsigned int nBytes) {
-  size_t res;
-  RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
-  return res;
-}
-
-
-// HPI_SocketInterface
-
-inline int hpi::socket_close(int fd) {
-  RESTARTABLE_RETURN_INT(::close(fd));
-}
-
-inline int hpi::socket(int domain, int type, int protocol) {
-  return ::socket(domain, type, protocol);
-}
-
-inline int hpi::recv(int fd, char *buf, int nBytes, int flags) {
-  RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags));
-}
-
-inline int hpi::send(int fd, char *buf, int nBytes, int flags) {
-  RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
-}
-
-inline int hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
-  return send(fd, buf, nBytes, flags);
-}
-
-inline int hpi::timeout(int fd, long timeout) {
-  julong prevtime,newtime;
-  struct timeval t;
-
-  gettimeofday(&t, NULL);
-  prevtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
-
-  for(;;) {
-    struct pollfd pfd;
-
-    pfd.fd = fd;
-    pfd.events = POLLIN | POLLERR;
-
-    int res = ::poll(&pfd, 1, timeout);
-
-    if (res == OS_ERR && errno == EINTR) {
-
-      // On Bsd any value < 0 means "forever"
-
-      if(timeout >= 0) {
-        gettimeofday(&t, NULL);
-        newtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
-        timeout -= newtime - prevtime;
-        if(timeout <= 0)
-          return OS_OK;
-        prevtime = newtime;
-      }
-    } else
-      return res;
-  }
-}
-
-inline int hpi::listen(int fd, int count) {
-  return ::listen(fd, count);
-}
-
-inline int hpi::connect(int fd, struct sockaddr *him, int len) {
-  RESTARTABLE_RETURN_INT(::connect(fd, him, len));
-}
-
-inline int hpi::accept(int fd, struct sockaddr *him, int *len) {
-  // This cast is from int to unsigned int on bsd.  Since we
-  // only pass the parameter "len" around the vm and don't try to
-  // fetch it's value, this cast is safe for now. The java.net group
-  // may need and want to change this interface someday if socklen_t goes
-  // to 64 bits on some platform that we support.
-  // At least OpenBSD and FreeBSD can return EINTR from accept.
-
-  RESTARTABLE_RETURN_INT(::accept(fd, him, (socklen_t *)len));
-}
-
-inline int hpi::recvfrom(int fd, char *buf, int nBytes, int flags,
-                         sockaddr *from, int *fromlen) {
-  RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen));
-}
-
-inline int hpi::sendto(int fd, char *buf, int len, int flags,
-                        struct sockaddr *to, int tolen) {
-  RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen));
-}
-
-inline int hpi::socket_available(int fd, jint *pbytes) {
-  int ret;
-
-  if (fd < 0)
-    return OS_OK;
-
-  RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
-
-  //%% note ioctl can return 0 when successful, JVM_SocketAvailable
-  // is expected to return 0 on failure and 1 on success to the jdk.
-  return (ret == OS_ERR) ? 0 : 1;
-}
-
-
-// following methods have been updated to avoid problems in
-// hpi's sockets calls based on sys_api_td.c (JDK1.3)
-
-/*
-HPIDECL(socket_shutdown, "socket_shutdown", _socket, SocketShutdown,
-        int, "%d",
-        (int fd, int howto),
-        ("fd = %d, howto = %d", fd, howto),
-        (fd, howto));
-        */
-inline int hpi::socket_shutdown(int fd, int howto){
-  return ::shutdown(fd, howto);
-}
-
-/*
-HPIDECL(bind, "bind", _socket, Bind,
-        int, "%d",
-        (int fd, struct sockaddr *him, int len),
-        ("fd = %d, him = %p, len = %d",
-         fd, him, len),
-        (fd, him, len));
-*/
-inline int hpi::bind(int fd, struct sockaddr *him, int len){
-  return ::bind(fd, him, len);
-}
-
-/*
-HPIDECL(get_sock_name, "get_sock_name", _socket, GetSocketName,
-        int, "%d",
-        (int fd, struct sockaddr *him, int *len),
-        ("fd = %d, him = %p, len = %p",
-         fd, him, len),
-        (fd, him, len));
-        */
-inline int hpi::get_sock_name(int fd, struct sockaddr *him, int *len){
-  return ::getsockname(fd, him, (socklen_t *)len);
-}
-
-/*
-HPIDECL(get_host_name, "get_host_name", _socket, GetHostName, int, "%d",
-        (char *hostname, int namelen),
-        ("hostname = %p, namelen = %d",
-         hostname, namelen),
-        (hostname, namelen));
-        */
-inline int hpi::get_host_name(char* name, int namelen){
-  return ::gethostname(name, namelen);
-}
-
-/*
-HPIDECL(get_sock_opt, "get_sock_opt", _socket, SocketGetOption, int, "%d",
-        (int fd, int level, int optname, char *optval, int* optlen),
-        ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %p",
-         fd, level, optname, optval, optlen),
-        (fd, level, optname, optval, optlen));
-        */
-inline int hpi::get_sock_opt(int fd, int level, int optname,
-                             char *optval, int* optlen){
-  return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen);
-}
-
-/*
-HPIDECL(set_sock_opt, "set_sock_opt", _socket, SocketSetOption, int, "%d",
-        (int fd, int level, int optname, const char *optval, int optlen),
-        ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %d",
-         fd, level, optname, optval, optlen),
-        (fd, level, optname, optval, optlen));
-        */
-inline int hpi::set_sock_opt(int fd, int level, int optname,
-                             const char *optval, int optlen){
-  return ::setsockopt(fd, level, optname, optval, optlen);
-}
-
-
-// Reconciliation History
-// hpi_solaris.hpp      1.9 99/08/30 16:31:23
-// End
--- a/src/os/bsd/vm/interfaceSupport_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/interfaceSupport_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, 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
@@ -22,8 +22,13 @@
  *
  */
 
+#ifndef OS_BSD_VM_INTERFACESUPPORT_BSD_HPP
+#define OS_BSD_VM_INTERFACESUPPORT_BSD_HPP
+
 // Contains inlined functions for class InterfaceSupport
 
 static inline void serialize_memory(JavaThread *thread) {
   os::write_memory_serialize_page(thread);
 }
+
+#endif // OS_BSD_VM_INTERFACESUPPORT_BSD_HPP
--- a/src/os/bsd/vm/jsig.c	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/jsig.c	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
--- a/src/os/bsd/vm/jvm_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/jvm_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,8 +22,10 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_jvm_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "prims/jvm.h"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/osThread.hpp"
 
 #include <signal.h>
 
--- a/src/os/bsd/vm/jvm_bsd.h	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/jvm_bsd.h	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_BSD_VM_JVM_BSD_H
+#define OS_BSD_VM_JVM_BSD_H
+
 /*
 // HotSpot integration note:
 //
@@ -113,3 +116,5 @@
 // Reconciliation History
 // jvm_solaris.h        1.6 99/06/22 16:38:47
 // End
+
+#endif // OS_BSD_VM_JVM_BSD_H
--- a/src/os/bsd/vm/mutex_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/mutex_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, 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
@@ -22,8 +22,12 @@
  *
  */
 
-# include "incls/_precompiled.incl"
-# include "incls/_mutex_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "mutex_bsd.inline.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/mutex.hpp"
+#include "thread_bsd.inline.hpp"
+#include "utilities/events.hpp"
 
 // put OS-includes here
 # include <signal.h>
--- a/src/os/bsd/vm/mutex_bsd.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/mutex_bsd.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,7 +22,16 @@
  *
  */
 
+#ifndef OS_BSD_VM_MUTEX_BSD_INLINE_HPP
+#define OS_BSD_VM_MUTEX_BSD_INLINE_HPP
+
+#include "os_bsd.inline.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "thread_bsd.inline.hpp"
+
 
 // Reconciliation History
 // mutex_solaris.inline.hpp     1.5 99/06/22 16:38:49
 // End
+
+#endif // OS_BSD_VM_MUTEX_BSD_INLINE_HPP
--- a/src/os/bsd/vm/objectMonitor_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-
-/*
- * Copyright (c) 1999, 2005, 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.
- *
- */
--- a/src/os/bsd/vm/objectMonitor_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1999, 2005, 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.
- *
- */
-
- private:
--- a/src/os/bsd/vm/objectMonitor_bsd.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 1999, 2005, 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.
- *
- */
--- a/src/os/bsd/vm/osThread_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/osThread_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,8 +22,23 @@
  *
  */
 
-// do not include  precompiled  header file
-# include "incls/_osThread_bsd.cpp.incl"
+// no precompiled headers
+#include "runtime/atomic.hpp"
+#include "runtime/handles.inline.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/os.hpp"
+#include "runtime/osThread.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/vmThread.hpp"
+#ifdef TARGET_ARCH_x86
+# include "assembler_x86.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "assembler_sparc.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "assembler_zero.inline.hpp"
+#endif
 
 
 void OSThread::pd_initialize() {
--- a/src/os/bsd/vm/osThread_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/osThread_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_BSD_VM_OSTHREAD_BSD_HPP
+#define OS_BSD_VM_OSTHREAD_BSD_HPP
+
  private:
   int _thread_type;
 
@@ -158,3 +161,5 @@
 // Reconciliation History
 // osThread_solaris.hpp 1.24 99/08/27 13:11:54
 // End
+
+#endif // OS_BSD_VM_OSTHREAD_BSD_HPP
--- a/src/os/bsd/vm/os_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/os_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -24,8 +24,64 @@
 
 # define __STDC_FORMAT_MACROS
 
-// do not include  precompiled  header file
-# include "incls/_os_bsd.cpp.incl"
+// no precompiled headers
+#include "classfile/classLoader.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "code/icBuffer.hpp"
+#include "code/vtableStubs.hpp"
+#include "compiler/compileBroker.hpp"
+#include "interpreter/interpreter.hpp"
+#include "jvm_bsd.h"
+#include "memory/allocation.inline.hpp"
+#include "memory/filemap.hpp"
+#include "mutex_bsd.inline.hpp"
+#include "oops/oop.inline.hpp"
+#include "os_share_bsd.hpp"
+#include "prims/jniFastGetField.hpp"
+#include "prims/jvm.h"
+#include "prims/jvm_misc.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/extendedPC.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/java.hpp"
+#include "runtime/javaCalls.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/objectMonitor.hpp"
+#include "runtime/osThread.hpp"
+#include "runtime/perfMemory.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/statSampler.hpp"
+#include "runtime/stubRoutines.hpp"
+#include "runtime/threadCritical.hpp"
+#include "runtime/timer.hpp"
+#include "services/attachListener.hpp"
+#include "services/runtimeService.hpp"
+#include "thread_bsd.inline.hpp"
+#include "utilities/decoder.hpp"
+#include "utilities/defaultStream.hpp"
+#include "utilities/events.hpp"
+#include "utilities/growableArray.hpp"
+#include "utilities/vmError.hpp"
+#ifdef TARGET_ARCH_x86
+# include "assembler_x86.inline.hpp"
+# include "nativeInst_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "assembler_sparc.inline.hpp"
+# include "nativeInst_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "assembler_zero.inline.hpp"
+# include "nativeInst_zero.hpp"
+#endif
+#ifdef COMPILER1
+#include "c1/c1_Runtime1.hpp"
+#endif
+#ifdef COMPILER2
+#include "opto/runtime.hpp"
+#endif
 
 // put OS-includes here
 # include <sys/types.h>
@@ -64,6 +120,7 @@
 # include <sys/shm.h>
 # include <stdint.h>
 # include <inttypes.h>
+# include <sys/ioctl.h>
 
 #ifndef __APPLE__
 # include <link.h>
@@ -1631,6 +1688,24 @@
 // unused on bsd for now.
 void os::set_error_file(const char *logfile) {}
 
+
+// This method is a copy of JDK's sysGetLastErrorString
+// from src/solaris/hpi/src/system_md.c
+
+size_t os::lasterror(char *buf, size_t len) {
+
+  if (errno == 0)  return 0;
+
+  const char *s = ::strerror(errno);
+  size_t n = ::strlen(s);
+  if (n >= len) {
+    n = len - 1;
+  }
+  ::strncpy(buf, s, n);
+  buf[n] = '\0';
+  return n;
+}
+
 intx os::current_thread_id() { return (intx)pthread_self(); }
 int os::current_process_id() {
 
@@ -1745,14 +1820,23 @@
   Dl_info dlinfo;
 
   if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) {
-    if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
-    if (offset) *offset = addr - (address)dlinfo.dli_saddr;
+    if (buf != NULL) {
+      if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
+        jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
+      }
+    }
+    if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
     return true;
-  } else {
-    if (buf) buf[0] = '\0';
-    if (offset) *offset = -1;
-    return false;
-  }
+  } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
+    if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
+       dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
+       return true;
+    }
+  }
+
+  if (buf != NULL) buf[0] = '\0';
+  if (offset != NULL) *offset = -1;
+  return false;
 }
 
 #ifdef _ALLBSD_SOURCE
@@ -2050,19 +2134,19 @@
 }
 
 
-bool _print_ascii_file(const char* filename, outputStream* st) {
-  int fd = open(filename, O_RDONLY);
+static bool _print_ascii_file(const char* filename, outputStream* st) {
+  int fd = ::open(filename, O_RDONLY);
   if (fd == -1) {
      return false;
   }
 
   char buf[32];
   int bytes;
-  while ((bytes = read(fd, buf, sizeof(buf))) > 0) {
+  while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
     st->print_raw(buf, bytes);
   }
 
-  close(fd);
+  ::close(fd);
 
   return true;
 }
@@ -2393,8 +2477,6 @@
           // Use current module name "libjvm[_g].so" instead of
           // "libjvm"debug_only("_g")".so" since for fastdebug version
           // we should have "libjvm.so" but debug_only("_g") adds "_g"!
-          // It is used when we are choosing the HPI library's name
-          // "libhpi[_g].so" in hpi::initialize_get_interface().
           len = strlen(buf);
           snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
         } else {
@@ -2588,18 +2670,18 @@
            os::get_temp_directory(), os::current_process_id(), num);
   unlink(buf);
 
-  int fd = open(buf, O_CREAT | O_RDWR, S_IRWXU);
+  int fd = ::open(buf, O_CREAT | O_RDWR, S_IRWXU);
 
   if (fd != -1) {
-    off_t rv = lseek(fd, size-2, SEEK_SET);
+    off_t rv = ::lseek(fd, size-2, SEEK_SET);
     if (rv != (off_t)-1) {
-      if (write(fd, "", 1) == 1) {
+      if (::write(fd, "", 1) == 1) {
         mmap(base, size,
              PROT_READ|PROT_WRITE|PROT_EXEC,
              MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE, fd, 0);
       }
     }
-    close(fd);
+    ::close(fd);
     unlink(buf);
   }
 }
@@ -4270,13 +4352,6 @@
   Bsd::set_createThread_lock(new Mutex(Mutex::leaf, "createThread_lock", false));
 #endif
 
-  // Initialize HPI.
-  jint hpi_result = hpi::initialize();
-  if (hpi_result != JNI_OK) {
-    tty->print_cr("There was an error trying to initialize the HPI library.");
-    return hpi_result;
-  }
-
   // at-exit methods are called in the reverse order of their registration.
   // atexit functions are called on return from main or as a result of a
   // call to exit(3C). There can be only 32 of these functions registered
@@ -4482,7 +4557,7 @@
     errno = ENAMETOOLONG;
     return -1;
   }
-  hpi::native_path(strcpy(pathbuf, path));
+  os::native_path(strcpy(pathbuf, path));
   return ::stat(pathbuf, sbuf);
 }
 
@@ -4514,6 +4589,85 @@
   return result;
 }
 
+// This code originates from JDK's sysOpen and open64_w
+// from src/solaris/hpi/src/system_md.c
+
+#ifndef O_DELETE
+#define O_DELETE 0x10000
+#endif
+
+// Open a file. Unlink the file immediately after open returns
+// if the specified oflag has the O_DELETE flag set.
+// O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c
+
+int os::open(const char *path, int oflag, int mode) {
+
+  if (strlen(path) > MAX_PATH - 1) {
+    errno = ENAMETOOLONG;
+    return -1;
+  }
+  int fd;
+  int o_delete = (oflag & O_DELETE);
+  oflag = oflag & ~O_DELETE;
+
+  fd = ::open(path, oflag, mode);
+  if (fd == -1) return -1;
+
+  //If the open succeeded, the file might still be a directory
+  {
+    struct stat buf;
+    int ret = ::fstat(fd, &buf);
+    int st_mode = buf.st_mode;
+
+    if (ret != -1) {
+      if ((st_mode & S_IFMT) == S_IFDIR) {
+        errno = EISDIR;
+        ::close(fd);
+        return -1;
+      }
+    } else {
+      ::close(fd);
+      return -1;
+    }
+  }
+
+    /*
+     * All file descriptors that are opened in the JVM and not
+     * specifically destined for a subprocess should have the
+     * close-on-exec flag set.  If we don't set it, then careless 3rd
+     * party native code might fork and exec without closing all
+     * appropriate file descriptors (e.g. as we do in closeDescriptors in
+     * UNIXProcess.c), and this in turn might:
+     *
+     * - cause end-of-file to fail to be detected on some file
+     *   descriptors, resulting in mysterious hangs, or
+     *
+     * - might cause an fopen in the subprocess to fail on a system
+     *   suffering from bug 1085341.
+     *
+     * (Yes, the default setting of the close-on-exec flag is a Unix
+     * design flaw)
+     *
+     * See:
+     * 1085341: 32-bit stdio routines should support file descriptors >255
+     * 4843136: (process) pipe file descriptor from Runtime.exec not being closed
+     * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
+     */
+#ifdef FD_CLOEXEC
+    {
+        int flags = ::fcntl(fd, F_GETFD);
+        if (flags != -1)
+            ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+    }
+#endif
+
+  if (o_delete != 0) {
+    ::unlink(path);
+  }
+  return fd;
+}
+
+
 // create binary file, rewriting existing file if required
 int os::create_binary_file(const char* path, bool rewrite_existing) {
   int oflags = O_WRONLY | O_CREAT;
@@ -4533,6 +4687,49 @@
   return (jlong)::lseek(fd, (off_t)offset, SEEK_SET);
 }
 
+// This code originates from JDK's sysAvailable
+// from src/solaris/hpi/src/native_threads/src/sys_api_td.c
+
+int os::available(int fd, jlong *bytes) {
+  jlong cur, end;
+  int mode;
+  struct stat buf;
+
+  if (::fstat(fd, &buf) >= 0) {
+    mode = buf.st_mode;
+    if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
+      /*
+      * XXX: is the following call interruptible? If so, this might
+      * need to go through the INTERRUPT_IO() wrapper as for other
+      * blocking, interruptible calls in this file.
+      */
+      int n;
+      if (::ioctl(fd, FIONREAD, &n) >= 0) {
+        *bytes = n;
+        return 1;
+      }
+    }
+  }
+  if ((cur = ::lseek(fd, 0L, SEEK_CUR)) == -1) {
+    return 0;
+  } else if ((end = ::lseek(fd, 0L, SEEK_END)) == -1) {
+    return 0;
+  } else if (::lseek(fd, cur, SEEK_SET) == -1) {
+    return 0;
+  }
+  *bytes = end - cur;
+  return 1;
+}
+
+int os::socket_available(int fd, jint *pbytes) {
+  // Bsd doc says EINTR not returned, unlike Solaris
+  int ret = ::ioctl(fd, FIONREAD, pbytes);
+
+  //%% note ioctl can return 0 when successful, JVM_SocketAvailable
+  // is expected to return 0 on failure and 1 on success to the jdk.
+  return (ret < 0) ? 0 : 1;
+}
+
 // Map a block of memory.
 char* os::map_memory(int fd, const char* file_name, size_t file_offset,
                      char *addr, size_t bytes, bool read_only,
@@ -4800,7 +4997,7 @@
   int fd = ::open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
   if (fd != -1) {
     struct stat buf;
-    close(fd);
+    ::close(fd);
     while (::stat(filename, &buf) == 0) {
       (void)::poll(NULL, 0, 100);
     }
--- a/src/os/bsd/vm/os_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/os_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_BSD_VM_OS_BSD_HPP
+#define OS_BSD_VM_OS_BSD_HPP
+
 // Bsd_OS defines the interface to Bsd operating systems
 
 /* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */
@@ -358,3 +361,5 @@
       assert_status(status == 0, status, "mutex_init");
     }
 } ;
+
+#endif // OS_BSD_VM_OS_BSD_HPP
--- a/src/os/bsd/vm/os_bsd.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/os_bsd.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,31 @@
  *
  */
 
+#ifndef OS_BSD_VM_OS_BSD_INLINE_HPP
+#define OS_BSD_VM_OS_BSD_INLINE_HPP
+
+#include "runtime/atomic.hpp"
+#include "runtime/os.hpp"
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "atomic_bsd_x86.inline.hpp"
+# include "orderAccess_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_sparc
+# include "atomic_bsd_sparc.inline.hpp"
+# include "orderAccess_bsd_sparc.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "atomic_bsd_zero.inline.hpp"
+# include "orderAccess_bsd_zero.inline.hpp"
+#endif
+
+// System includes
+
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <netdb.h>
+
 inline void* os::thread_local_storage_at(int index) {
   return pthread_getspecific((pthread_key_t)index);
 }
@@ -83,6 +108,12 @@
 inline void os::bang_stack_shadow_pages() {
 }
 
+inline void os::dll_unload(void *lib) {
+  ::dlclose(lib);
+}
+
+inline const int os::default_file_open_flags() { return 0;}
+
 inline DIR* os::opendir(const char* dirname)
 {
   assert(dirname != NULL, "just checking");
@@ -94,6 +125,22 @@
   return NAME_MAX + sizeof(dirent) + 1;
 }
 
+inline jlong os::lseek(int fd, jlong offset, int whence) {
+  return (jlong) ::lseek(fd, offset, whence);
+}
+
+inline int os::fsync(int fd) {
+  return ::fsync(fd);
+}
+
+inline char* os::native_path(char *path) {
+  return path;
+}
+
+inline int os::ftruncate(int fd, jlong length) {
+  return ::ftruncate(fd, length);
+}
+
 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
 {
   dirent* p;
@@ -111,9 +158,8 @@
     return p;
 }
 
-inline int os::closedir(DIR *dirp)
-{
-  assert(dirp != NULL, "just checking");
+inline int os::closedir(DIR *dirp) {
+  assert(dirp != NULL, "argument is NULL");
   return ::closedir(dirp);
 }
 
@@ -131,3 +177,130 @@
 
 inline bool os::numa_has_static_binding()   { return true; }
 inline bool os::numa_has_group_homing()     { return false;  }
+
+inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
+  size_t res;
+  RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res);
+  return res;
+}
+
+inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
+  size_t res;
+  RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
+  return res;
+}
+
+inline int os::close(int fd) {
+  return ::close(fd);
+}
+
+inline int os::socket_close(int fd) {
+  return ::close(fd);
+}
+
+inline int os::socket(int domain, int type, int protocol) {
+  return ::socket(domain, type, protocol);
+}
+
+inline int os::recv(int fd, char *buf, int nBytes, int flags) {
+  RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags));
+}
+
+inline int os::send(int fd, char *buf, int nBytes, int flags) {
+  RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
+}
+
+inline int os::raw_send(int fd, char *buf, int nBytes, int flags) {
+  return os::send(fd, buf, nBytes, flags);
+}
+
+inline int os::timeout(int fd, long timeout) {
+  julong prevtime,newtime;
+  struct timeval t;
+
+  gettimeofday(&t, NULL);
+  prevtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
+
+  for(;;) {
+    struct pollfd pfd;
+
+    pfd.fd = fd;
+    pfd.events = POLLIN | POLLERR;
+
+    int res = ::poll(&pfd, 1, timeout);
+
+    if (res == OS_ERR && errno == EINTR) {
+
+      // On Bsd any value < 0 means "forever"
+
+      if(timeout >= 0) {
+        gettimeofday(&t, NULL);
+        newtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
+        timeout -= newtime - prevtime;
+        if(timeout <= 0)
+          return OS_OK;
+        prevtime = newtime;
+      }
+    } else
+      return res;
+  }
+}
+
+inline int os::listen(int fd, int count) {
+  return ::listen(fd, count);
+}
+
+inline int os::connect(int fd, struct sockaddr *him, int len) {
+  RESTARTABLE_RETURN_INT(::connect(fd, him, len));
+}
+
+inline int os::accept(int fd, struct sockaddr *him, int *len) {
+  // This cast is from int to unsigned int on bsd.  Since we
+  // only pass the parameter "len" around the vm and don't try to
+  // fetch it's value, this cast is safe for now. The java.net group
+  // may need and want to change this interface someday if socklen_t goes
+  // to 64 bits on some platform that we support.
+  // Bsd doc says this can't return EINTR, unlike accept() on Solaris
+
+  return ::accept(fd, him, (socklen_t *)len);
+}
+
+inline int os::recvfrom(int fd, char *buf, int nBytes, int flags,
+                         sockaddr *from, int *fromlen) {
+  RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen));
+}
+
+inline int os::sendto(int fd, char *buf, int len, int flags,
+                        struct sockaddr *to, int tolen) {
+  RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen));
+}
+
+inline int os::socket_shutdown(int fd, int howto){
+  return ::shutdown(fd, howto);
+}
+
+inline int os::bind(int fd, struct sockaddr *him, int len){
+  return ::bind(fd, him, len);
+}
+
+inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
+  return ::getsockname(fd, him, (socklen_t *)len);
+}
+
+inline int os::get_host_name(char* name, int namelen){
+  return ::gethostname(name, namelen);
+}
+
+inline struct hostent*  os::get_host_by_name(char* name) {
+  return ::gethostbyname(name);
+}
+inline int os::get_sock_opt(int fd, int level, int optname,
+                             char *optval, int* optlen){
+  return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen);
+}
+
+inline int os::set_sock_opt(int fd, int level, int optname,
+                             const char *optval, int optlen){
+  return ::setsockopt(fd, level, optname, optval, optlen);
+}
+#endif // OS_BSD_VM_OS_BSD_INLINE_HPP
--- a/src/os/bsd/vm/os_share_bsd.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/os_share_bsd.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_BSD_VM_OS_SHARE_BSD_HPP
+#define OS_BSD_VM_OS_SHARE_BSD_HPP
+
 // misc
 void signalHandler(int, siginfo_t*, ucontext_t*);
 void handle_unexpected_exception(Thread* thread, int sig, siginfo_t* info, address pc, address adjusted_pc);
@@ -30,3 +33,5 @@
 #endif
 
 #define PROCFILE_LENGTH 128
+
+#endif // OS_BSD_VM_OS_SHARE_BSD_HPP
--- a/src/os/bsd/vm/perfMemory_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/perfMemory_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
@@ -22,8 +22,15 @@
  *
  */
 
-# include "incls/_precompiled.incl"
-# include "incls/_perfMemory_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/oop.inline.hpp"
+#include "os_bsd.inline.hpp"
+#include "runtime/handles.inline.hpp"
+#include "runtime/perfMemory.hpp"
+#include "utilities/exceptions.hpp"
 
 // put OS-includes here
 # include <sys/types.h>
@@ -628,7 +635,29 @@
     return -1;
   }
 
-  return fd;
+  // Verify that we have enough disk space for this file.
+  // We'll get random SIGBUS crashes on memory accesses if
+  // we don't.
+
+  for (size_t seekpos = 0; seekpos < size; seekpos += os::vm_page_size()) {
+    int zero_int = 0;
+    result = (int)os::seek_to_file_offset(fd, (jlong)(seekpos));
+    if (result == -1 ) break;
+    RESTARTABLE(::write(fd, &zero_int, 1), result);
+    if (result != 1) {
+      if (errno == ENOSPC) {
+        warning("Insufficient space for shared memory file:\n   %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename);
+      }
+      break;
+    }
+  }
+
+  if (result != -1) {
+    return fd;
+  } else {
+    RESTARTABLE(::close(fd), result);
+    return -1;
+  }
 }
 
 // open the shared memory file for the given user and vmid. returns
--- a/src/os/bsd/vm/stubRoutines_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/stubRoutines_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
@@ -22,5 +22,7 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_stubRoutines_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/os.hpp"
+#include "runtime/stubRoutines.hpp"
+
--- a/src/os/bsd/vm/threadCritical_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/threadCritical_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
@@ -22,8 +22,9 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_threadCritical_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/threadCritical.hpp"
+#include "thread_bsd.inline.hpp"
 
 // put OS-includes here
 # include <pthread.h>
--- a/src/os/bsd/vm/thread_bsd.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/thread_bsd.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, 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
@@ -22,6 +22,31 @@
  *
  */
 
+#ifndef OS_BSD_VM_THREAD_BSD_INLINE_HPP
+#define OS_BSD_VM_THREAD_BSD_INLINE_HPP
+
+#include "runtime/atomic.hpp"
+#include "runtime/prefetch.hpp"
+#include "runtime/thread.hpp"
+#include "runtime/threadLocalStorage.hpp"
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "atomic_bsd_x86.inline.hpp"
+# include "orderAccess_bsd_x86.inline.hpp"
+# include "prefetch_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_sparc
+# include "atomic_bsd_sparc.inline.hpp"
+# include "orderAccess_bsd_sparc.inline.hpp"
+# include "prefetch_bsd_sparc.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "atomic_bsd_zero.inline.hpp"
+# include "orderAccess_bsd_zero.inline.hpp"
+# include "prefetch_bsd_zero.inline.hpp"
+#endif
+
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
 inline void ThreadLocalStorage::pd_invalidate_all() {} // nothing to do
+
+#endif // OS_BSD_VM_THREAD_BSD_INLINE_HPP
--- a/src/os/bsd/vm/vmError_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/bsd/vm/vmError_bsd.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -22,8 +22,11 @@
  *
  */
 
-# include "incls/_precompiled.incl"
-# include "incls/_vmError_bsd.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/os.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/vmError.hpp"
 
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -41,11 +44,11 @@
     jio_snprintf(p, buflen - len,
                "\n\n"
                "Do you want to debug the problem?\n\n"
-               "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT "\n"
+               "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
                "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
                "Otherwise, press RETURN to abort...",
                os::current_process_id(), os::current_process_id(),
-               os::current_thread_id());
+               os::current_thread_id(), os::current_thread_id());
 
     yes = os::message_box("Unexpected Error", buf);
 
--- a/src/os/bsd/vm/vtune_bsd.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, 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.
- *
- */
-
-#include "incls/_precompiled.incl"
-#include "incls/_vtune_bsd.cpp.incl"
-
-// empty implementation
-
-void VTune::start_GC() {}
-void VTune::end_GC() {}
-void VTune::start_class_load() {}
-void VTune::end_class_load() {}
-void VTune::exit() {}
-void VTune::register_stub(const char* name, address start, address end) {}
-
-void VTune::create_nmethod(nmethod* nm) {}
-void VTune::delete_nmethod(nmethod* nm) {}
-
-void vtune_init() {}
-
-
-// Reconciliation History
-// vtune_solaris.cpp    1.8 99/07/12 23:54:21
-// End
--- a/src/os/posix/launcher/java_md.c	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/posix/launcher/java_md.c	Sat Jan 22 22:41:33 2011 -0800
@@ -41,14 +41,21 @@
 #include "version_comp.h"
 #endif
 
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
 #include <pthread.h>
 #else
 #include <thread.h>
 #endif
 
+#ifdef __APPLE__
+#define JVM_DLL "libjvm.dylib"
+#define JAVA_DLL "libjava.dylib"
+#define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH"
+#else
 #define JVM_DLL "libjvm.so"
 #define JAVA_DLL "libjava.so"
+#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
+#endif
 
 #ifndef GAMMA   /* launcher.make defines ARCH */
 /*
@@ -423,10 +430,10 @@
        * If not on Solaris, assume only a single LD_LIBRARY_PATH
        * variable.
        */
-      runpath = getenv("LD_LIBRARY_PATH");
+      runpath = getenv(LD_LIBRARY_PATH);
 #endif /* __sun */
 
-#ifdef __linux
+#if defined(__linux)
       /*
        * On linux, if a binary is running as sgid or suid, glibc sets
        * LD_LIBRARY_PATH to the empty string for security purposes.  (In
@@ -442,6 +449,22 @@
       if((getgid() != getegid()) || (getuid() != geteuid()) ) {
         return;
       }
+#elif _ALLBSD_SOURCE
+      /*
+       * On BSD, if a binary is running as sgid or suid, libc sets
+       * LD_LIBRARY_PATH to the empty string for security purposes.  (In
+       * contrast, on Solaris the LD_LIBRARY_PATH variable for a
+       * privileged binary does not lose its settings; but the dynamic
+       * linker does apply more scrutiny to the path.) The launcher uses
+       * the value of LD_LIBRARY_PATH to prevent an exec loop.
+       * Therefore, if we are running sgid or suid, this function's
+       * setting of LD_LIBRARY_PATH will be ineffective and we should
+       * return from the function now.  Getting the right libraries to
+       * be found must be handled through other mechanisms.
+       */
+      if(issetugid()) {
+        return;
+      }
 #endif
 
       /* runpath contains current effective LD_LIBRARY_PATH setting */
@@ -450,7 +473,7 @@
       new_runpath = JLI_MemAlloc( ((runpath!=NULL)?strlen(runpath):0) +
                               2*strlen(jrepath) + 2*strlen(arch) +
                               strlen(jvmpath) + 52);
-      newpath = new_runpath + strlen("LD_LIBRARY_PATH=");
+      newpath = new_runpath + strlen(LD_LIBRARY_PATH "=");
 
 
       /*
@@ -465,7 +488,7 @@
 
         /* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */
 
-        sprintf(new_runpath, "LD_LIBRARY_PATH="
+        sprintf(new_runpath, LD_LIBRARY_PATH "="
                 "%s:"
                 "%s/lib/%s:"
                 "%s/../lib/%s",
@@ -792,7 +815,7 @@
 jboolean
 GetApplicationHome(char *buf, jint bufsize)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
     char *execname = GetExecname();
     if (execname) {
         strncpy(buf, execname, bufsize-1);
@@ -1175,7 +1198,7 @@
 
 #endif /* __sun && i586 */
 
-#if defined(__linux__) && defined(i586)
+#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) && defined(i586)
 
 /*
  * A utility method for asking the CPU about itself.
@@ -1452,6 +1475,39 @@
 
 #endif /* __linux__ && i586 */
 
+#if defined(_ALLBSD_SOURCE) && defined(i586)
+
+/* The definition of a server-class machine for bsd-i586 */
+jboolean
+bsd_i586_ServerClassMachine(void) {
+  jboolean            result            = JNI_FALSE;
+  /* How big is a server class machine? */
+  const unsigned long server_processors = 2UL;
+  const uint64_t      server_memory     = 2UL * GB;
+  /*
+   * We seem not to get our full complement of memory.
+   *     We allow some part (1/8?) of the memory to be "missing",
+   *     based on the sizes of DIMMs, and maybe graphics cards.
+   */
+  const uint64_t      missing_memory    = 256UL * MB;
+  const uint64_t      actual_memory     = physical_memory();
+
+  /* Is this a server class machine? */
+  if (actual_memory >= (server_memory - missing_memory)) {
+    const unsigned long actual_processors = physical_processors();
+    if (actual_processors >= server_processors) {
+      result = JNI_TRUE;
+    }
+  }
+  if (_launcher_debug) {
+    printf("linux_" LIBARCHNAME "_ServerClassMachine: %s\n",
+           (result == JNI_TRUE ? "true" : "false"));
+  }
+  return result;
+}
+
+#endif /* _ALLBSD_SOURCE && i586 */
+
 /* Dispatch to the platform-specific definition of "server-class" */
 jboolean
 ServerClassMachine(void) {
@@ -1466,6 +1522,8 @@
   result = solaris_i586_ServerClassMachine();
 #elif defined(__linux__) && defined(i586)
   result = linux_i586_ServerClassMachine();
+#elif defined(_ALLBSD_SOURCE) && defined(i586)
+  result = bsd_i586_ServerClassMachine();
 #else
   if (_launcher_debug) {
     printf("ServerClassMachine: returns default value of %s\n",
@@ -1821,7 +1879,7 @@
 int
 ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
     int rslt;
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
     pthread_t tid;
     pthread_attr_t attr;
     pthread_attr_init(&attr);
--- a/src/os/posix/launcher/launcher.script	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os/posix/launcher/launcher.script	Sat Jan 22 22:41:33 2011 -0800
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- a/src/os_cpu/bsd_x86/vm/assembler_bsd_x86.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/assembler_bsd_x86.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,8 +22,11 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_assembler_bsd_x86.cpp.incl"
+#include "precompiled.hpp"
+#include "asm/assembler.hpp"
+#include "assembler_x86.inline.hpp"
+#include "runtime/os.hpp"
+#include "runtime/threadLocalStorage.hpp"
 
 #ifndef _LP64
 void MacroAssembler::int3() {
--- a/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,14 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
+#define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
+
+#include "orderAccess_bsd_x86.inline.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/os.hpp"
+#include "vm_version_x86.hpp"
+
 // Implementation of class atomic
 
 inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
@@ -193,3 +201,5 @@
   return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
 }
 #endif // AMD64
+
+#endif // OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP
--- a/src/os_cpu/bsd_x86/vm/bsd_x86_32.s	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/bsd_x86_32.s	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2010, 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
--- a/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/bytes_bsd_x86.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
+#define OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
+
 #ifndef _ALLBSD_SOURCE
 #include <byteswap.h>
 #endif
@@ -109,3 +112,5 @@
   return swap_u8_base(*(u4*)&x, *(((u4*)&x)+1));
 }
 #endif // !AMD64
+
+#endif // OS_CPU_BSD_X86_VM_BYTES_BSD_X86_INLINE_HPP
--- a/src/os_cpu/bsd_x86/vm/copy_bsd_x86.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/copy_bsd_x86.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_COPY_BSD_X86_INLINE_HPP
+#define OS_CPU_BSD_X86_VM_COPY_BSD_X86_INLINE_HPP
+
 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
 #ifdef AMD64
   (void)memmove(to, from, count * HeapWordSize);
@@ -302,3 +305,5 @@
   pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
 #endif // AMD64
 }
+
+#endif // OS_CPU_BSD_X86_VM_COPY_BSD_X86_INLINE_HPP
--- a/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP
+
 //
 // Sets the default values for platform dependent flags used by the runtime system.
 // (see globals.hpp)
@@ -47,3 +50,5 @@
 define_pd_global(uintx, HeapBaseMinAddress,      2*G);
 // Only used on 64 bit Windows platforms
 define_pd_global(bool, UseVectoredExceptions,    false);
+
+#endif // OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP
--- a/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -22,6 +22,12 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
+#define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
+
+#include "runtime/orderAccess.hpp"
+#include "vm_version_x86.hpp"
+
 // Implementation of class OrderAccess.
 
 inline void OrderAccess::loadload()   { acquire(); }
@@ -204,3 +210,5 @@
   release_store_fence((volatile jint*)p, (jint)v);
 #endif // AMD64
 }
+
+#endif // OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -22,8 +22,42 @@
  *
  */
 
-// do not include  precompiled  header file
-# include "incls/_os_bsd_x86.cpp.incl"
+// no precompiled headers
+#include "assembler_x86.inline.hpp"
+#include "classfile/classLoader.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "code/icBuffer.hpp"
+#include "code/vtableStubs.hpp"
+#include "interpreter/interpreter.hpp"
+#include "jvm_bsd.h"
+#include "memory/allocation.inline.hpp"
+#include "mutex_bsd.inline.hpp"
+#include "nativeInst_x86.hpp"
+#include "os_share_bsd.hpp"
+#include "prims/jniFastGetField.hpp"
+#include "prims/jvm.h"
+#include "prims/jvm_misc.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/extendedPC.hpp"
+#include "runtime/frame.inline.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/java.hpp"
+#include "runtime/javaCalls.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/osThread.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/stubRoutines.hpp"
+#include "runtime/timer.hpp"
+#include "thread_bsd.inline.hpp"
+#include "utilities/events.hpp"
+#include "utilities/vmError.hpp"
+#ifdef COMPILER1
+#include "c1/c1_Runtime1.hpp"
+#endif
+#ifdef COMPILER2
+#include "opto/runtime.hpp"
+#endif
 
 // put OS-includes here
 # include <sys/types.h>
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_OS_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_OS_BSD_X86_HPP
+
   static void setup_fpu();
   static bool supports_sse();
 
@@ -30,3 +33,5 @@
   // Used to register dynamic code cache area with the OS
   // Note: Currently only used in 64 bit Windows implementations
   static bool register_code_area(char *low, char *high) { return true; }
+
+#endif // OS_CPU_BSD_X86_VM_OS_BSD_X86_HPP
--- a/src/os_cpu/bsd_x86/vm/prefetch_bsd_x86.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/prefetch_bsd_x86.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -22,6 +22,11 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_PREFETCH_BSD_X86_INLINE_HPP
+#define OS_CPU_BSD_X86_VM_PREFETCH_BSD_X86_INLINE_HPP
+
+#include "runtime/prefetch.hpp"
+
 
 inline void Prefetch::read (void *loc, intx interval) {
 #ifdef AMD64
@@ -38,3 +43,5 @@
 
 #endif // AMD64
 }
+
+#endif // OS_CPU_BSD_X86_VM_PREFETCH_BSD_X86_INLINE_HPP
--- a/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,8 +22,9 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_threadLS_bsd_x86.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/threadLocalStorage.hpp"
+#include "thread_bsd.inline.hpp"
 
 // Map stack pointer (%esp) to thread pointer for faster TLS access
 //
--- a/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_THREADLS_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_THREADLS_BSD_X86_HPP
+
   // Processor dependent parts of ThreadLocalStorage
 
 #ifndef AMD64
@@ -49,3 +52,5 @@
     return _sp_map[sp >> PAGE_SHIFT];
 #endif // AMD64
   }
+
+#endif // OS_CPU_BSD_X86_VM_THREADLS_BSD_X86_HPP
--- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -22,8 +22,9 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_thread_bsd_x86.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/frame.inline.hpp"
+#include "thread_bsd.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_THREAD_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_THREAD_BSD_X86_HPP
+
  private:
   void pd_initialize() {
     _anchor.clear();
@@ -63,3 +66,5 @@
   static bool register_stack_overflow() { return false; }
   static void enable_register_stack_guard() {}
   static void disable_register_stack_guard() {}
+
+#endif // OS_CPU_BSD_X86_VM_THREAD_BSD_X86_HPP
--- a/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_X86_VM_VMSTRUCTS_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_VMSTRUCTS_BSD_X86_HPP
+
 // These are the OS and CPU-specific fields, types and integer
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
@@ -58,3 +61,5 @@
                                                                         \
   /* This must be the last entry, and must be present */                \
   last_entry()
+
+#endif // OS_CPU_BSD_X86_VM_VMSTRUCTS_BSD_X86_HPP
--- a/src/os_cpu/bsd_x86/vm/vm_version_bsd_x86.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_x86/vm/vm_version_bsd_x86.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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
@@ -22,5 +22,7 @@
  *
  */
 
-# include "incls/_precompiled.incl"
-# include "incls/_vm_version_bsd_x86.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/os.hpp"
+#include "vm_version_x86.hpp"
+
--- a/src/os_cpu/bsd_zero/vm/assembler_bsd_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/assembler_bsd_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2009 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,4 +23,10 @@
  *
  */
 
+#include "precompiled.hpp"
+#include "asm/assembler.hpp"
+#include "assembler_zero.inline.hpp"
+#include "runtime/os.hpp"
+#include "runtime/threadLocalStorage.hpp"
+
 // This file is intentionally empty
--- a/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,6 +23,14 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
+#define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
+
+#include "orderAccess_bsd_zero.inline.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/os.hpp"
+#include "vm_version_zero.hpp"
+
 #include <sys/types.h>
 #ifdef __NetBSD__
 #include <sys/atomic.h>
@@ -291,6 +299,8 @@
 }									\
 static __inline void							\
 atomic_store_rel_ ## name(volatile ptype p, vtype v)			\
+
+#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
 {									\
 	atomic_store_rel(p, v, sz);					\
 }
@@ -542,3 +552,5 @@
                                  void* compare_value) {
   return atomic_cas_ptr((volatile void *)dest, compare_value, exchange_value);
 }
+
+#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP
--- a/src/os_cpu/bsd_zero/vm/bytes_bsd_zero.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/bytes_bsd_zero.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_BYTES_BSD_ZERO_INLINE_HPP
+#define OS_CPU_BSD_ZERO_VM_BYTES_BSD_ZERO_INLINE_HPP
+
 // Efficient swapping of data bytes from Java byte
 // ordering to native byte ordering and vice versa.
 
@@ -38,6 +41,8 @@
   return bswap16(x);
 }
 
+
+#endif // OS_CPU_BSD_ZERO_VM_BYTES_BSD_ZERO_INLINE_HPP
 inline u4 Bytes::swap_u4(u4 x) {
   return bswap32(x);
 }
--- a/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,6 +23,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_GLOBALS_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_GLOBALS_BSD_ZERO_HPP
+
 //
 // Set the default values for platform dependent flags used by the
 // runtime system.  See globals.hpp for details of what they do.
@@ -42,3 +45,5 @@
 define_pd_global(bool,  UseVectoredExceptions,   false);
 // Only used on 64 bit platforms
 define_pd_global(uintx, HeapBaseMinAddress,      2*G);
+
+#endif // OS_CPU_BSD_ZERO_VM_GLOBALS_BSD_ZERO_HPP
--- a/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/orderAccess_bsd_zero.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,6 +23,12 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
+#define OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
+
+#include "runtime/orderAccess.hpp"
+#include "vm_version_zero.hpp"
+
 #ifdef ARM
 
 /*
@@ -170,3 +176,5 @@
 
 inline void     OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { release_store_ptr(p, v); fence(); }
 inline void     OrderAccess::release_store_ptr_fence(volatile void*     p, void*    v) { release_store_ptr(p, v); fence(); }
+
+#endif // OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -27,8 +27,42 @@
 # include <pthread_np.h> /* For pthread_attr_get_np */
 #endif
 
-// do not include precompiled header file
-#include "incls/_os_bsd_zero.cpp.incl"
+// no precompiled headers
+#include "assembler_zero.inline.hpp"
+#include "classfile/classLoader.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "code/icBuffer.hpp"
+#include "code/vtableStubs.hpp"
+#include "interpreter/interpreter.hpp"
+#include "jvm_bsd.h"
+#include "memory/allocation.inline.hpp"
+#include "mutex_bsd.inline.hpp"
+#include "nativeInst_zero.hpp"
+#include "os_share_bsd.hpp"
+#include "prims/jniFastGetField.hpp"
+#include "prims/jvm.h"
+#include "prims/jvm_misc.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/extendedPC.hpp"
+#include "runtime/frame.inline.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/java.hpp"
+#include "runtime/javaCalls.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/osThread.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/stubRoutines.hpp"
+#include "runtime/timer.hpp"
+#include "thread_bsd.inline.hpp"
+#include "utilities/events.hpp"
+#include "utilities/vmError.hpp"
+#ifdef COMPILER1
+#include "c1/c1_Runtime1.hpp"
+#endif
+#ifdef COMPILER2
+#include "opto/runtime.hpp"
+#endif
 
 address os::current_stack_pointer() {
   address dummy = (address) &dummy;
@@ -423,6 +457,10 @@
   ShouldNotCallThis();
 }
 
+void os::print_register_info(outputStream *st, void *context) {
+  ShouldNotCallThis();
+}
+
 /////////////////////////////////////////////////////////////////////////////
 // Stubs for things that would be in bsd_zero.s if it existed.
 // You probably want to disassemble these monkeys to check they're ok.
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,6 +23,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_OS_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_OS_BSD_ZERO_HPP
+
   static void setup_fpu() {}
 
   static bool is_allocatable(size_t bytes);
@@ -49,3 +52,5 @@
     *(jlong *) dst = *(jlong *) src;
 #endif
   }
+
+#endif // OS_CPU_BSD_ZERO_VM_OS_BSD_ZERO_HPP
--- a/src/os_cpu/bsd_zero/vm/prefetch_bsd_zero.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/prefetch_bsd_zero.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,8 +23,15 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_PREFETCH_BSD_ZERO_INLINE_HPP
+#define OS_CPU_BSD_ZERO_VM_PREFETCH_BSD_ZERO_INLINE_HPP
+
+#include "runtime/prefetch.hpp"
+
 inline void Prefetch::read(void* loc, intx interval) {
 }
 
 inline void Prefetch::write(void* loc, intx interval) {
 }
+
+#endif // OS_CPU_BSD_ZERO_VM_PREFETCH_BSD_ZERO_INLINE_HPP
--- a/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,8 +23,9 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_threadLS_bsd_zero.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/threadLocalStorage.hpp"
+#include "thread_bsd.inline.hpp"
 
 void ThreadLocalStorage::generate_code_for_get_thread() {
   // nothing to do
--- a/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -22,9 +22,14 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_THREADLS_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_THREADLS_BSD_ZERO_HPP
+
 // Processor dependent parts of ThreadLocalStorage
 
  public:
   static Thread* thread() {
     return (Thread*) os::thread_local_storage_at(thread_index());
   }
+
+#endif // OS_CPU_BSD_ZERO_VM_THREADLS_BSD_ZERO_HPP
--- a/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,8 +23,9 @@
  *
  */
 
-#include "incls/_precompiled.incl"
-#include "incls/_thread_bsd_zero.cpp.incl"
+#include "precompiled.hpp"
+#include "runtime/frame.inline.hpp"
+#include "thread_bsd.inline.hpp"
 
 void JavaThread::cache_global_variables() {
   // nothing to do
--- a/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,6 +23,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_THREAD_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_THREAD_BSD_ZERO_HPP
+
  private:
   ZeroStack  _zero_stack;
   ZeroFrame* _top_zero_frame;
@@ -114,3 +117,5 @@
   static bool register_stack_overflow() { return false; }
   static void enable_register_stack_guard() {}
   static void disable_register_stack_guard() {}
+
+#endif // OS_CPU_BSD_ZERO_VM_THREAD_BSD_ZERO_HPP
--- a/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,6 +23,9 @@
  *
  */
 
+#ifndef OS_CPU_BSD_ZERO_VM_VMSTRUCTS_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_VMSTRUCTS_BSD_ZERO_HPP
+
 // These are the OS and CPU-specific fields, types and integer
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
@@ -43,3 +46,5 @@
 #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
   /* This must be the last entry, and must be present */                \
   last_entry()
+
+#endif // OS_CPU_BSD_ZERO_VM_VMSTRUCTS_BSD_ZERO_HPP
--- a/src/os_cpu/bsd_zero/vm/vm_version_bsd_zero.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/os_cpu/bsd_zero/vm/vm_version_bsd_zero.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2009 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -23,4 +23,8 @@
  *
  */
 
+#include "precompiled.hpp"
+#include "runtime/os.hpp"
+#include "vm_version_zero.hpp"
+
 // This file is intentionally empty
--- a/src/share/vm/c1/c1_globals.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/c1/c1_globals.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -41,6 +41,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "c1_globals_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "c1_globals_bsd.hpp"
+#endif
 
 //
 // Defines all global flags used by the client compiler.
--- a/src/share/vm/classfile/classLoader.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/classfile/classLoader.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -68,6 +68,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 // Entry points in zip.dll for loading zip/jar file entries
--- a/src/share/vm/classfile/javaClasses.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/classfile/javaClasses.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -55,6 +55,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 static bool find_field(instanceKlass* ik,
                        symbolOop name_symbol, symbolOop signature_symbol,
--- a/src/share/vm/code/stubs.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/code/stubs.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 // The classes in this file provide a simple framework for the
 // management of little pieces of machine code - or stubs -
--- a/src/share/vm/compiler/disassembler.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/compiler/disassembler.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 class decode_env;
 
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 elapsedTimer CMSAdaptiveSizePolicy::_concurrent_timer;
 elapsedTimer CMSAdaptiveSizePolicy::_STW_timer;
 
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -50,6 +50,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 //
 // ConcurrentMarkSweepPolicy methods
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 class ConcurrentMarkSweepGeneration;
 class CMSCollector;
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/freeBlockDictionary.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -33,6 +33,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifndef PRODUCT
 Mutex* FreeBlockDictionary::par_lock() const {
--- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -39,6 +39,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl,
                                    bool consume,
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap,
                                                  int max_covered_regions) :
--- a/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 PtrQueue::PtrQueue(PtrQueueSet* qset_, bool perm, bool active) :
   _qset(qset_), _buf(NULL), _index(0), _active(active),
--- a/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -38,6 +38,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 bool
 ParMarkBitMap::initialize(MemRegion covered_region)
--- a/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 // PSVirtualSpace
 
--- a/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
--- a/src/share/vm/gc_interface/collectedHeap.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_interface/collectedHeap.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -39,6 +39,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 #ifdef ASSERT
--- a/src/share/vm/gc_interface/collectedHeap.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/gc_interface/collectedHeap.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -43,6 +43,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Inline allocation implementations.
 
--- a/src/share/vm/interpreter/abstractInterpreter.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/interpreter/abstractInterpreter.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -50,6 +50,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // This file contains the platform-independent parts
 // of the abstract interpreter and the abstract interpreter generator.
--- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -59,6 +59,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "orderAccess_windows_x86.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "orderAccess_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "orderAccess_bsd_zero.inline.hpp"
+#endif
 
 
 // no precompiled headers
--- a/src/share/vm/interpreter/interpreterRuntime.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/interpreter/interpreterRuntime.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -41,6 +41,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // The InterpreterRuntime is called by the interpreter for everything
 // that cannot/should not be dealt with in assembly and needs C support.
--- a/src/share/vm/interpreter/linkResolver.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/interpreter/linkResolver.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -52,6 +52,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 //------------------------------------------------------------------------------------------------------------------------
 // Implementation of FieldAccessInfo
--- a/src/share/vm/memory/allocation.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/allocation.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -39,6 +39,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 void* CHeapObj::operator new(size_t size){
   return (void *) AllocateHeap(size, "CHeapObj-new");
--- a/src/share/vm/memory/collectorPolicy.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/collectorPolicy.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -47,6 +47,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp"
--- a/src/share/vm/memory/defNewGeneration.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/defNewGeneration.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -48,6 +48,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 //
 // DefNewGeneration functions.
--- a/src/share/vm/memory/gcLocker.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/gcLocker.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -41,6 +41,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 // The direct lock/unlock calls do not force a collection if an unlock
 // decrements the count to zero. Avoid calling these if at all possible.
--- a/src/share/vm/memory/genMarkSweep.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/genMarkSweep.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -55,6 +55,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
   bool clear_all_softrefs) {
--- a/src/share/vm/memory/resourceArea.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/resourceArea.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 //------------------------------ResourceMark-----------------------------------
 debug_only(int ResourceArea::_warned;)      // to suppress multiple warnings
--- a/src/share/vm/memory/resourceArea.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/resourceArea.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // The resource area holds temporary data structures in the VM.
 // The actual allocation areas are thread local. Typical usage:
--- a/src/share/vm/memory/space.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/space.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -44,6 +44,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 // A space is an abstraction for the "storage units" backing
 // up the generation abstraction. It includes specific
--- a/src/share/vm/memory/threadLocalAllocBuffer.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -38,6 +38,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Thread-Local Edens support
 
--- a/src/share/vm/memory/universe.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/memory/universe.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -89,6 +89,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
--- a/src/share/vm/oops/constantPoolKlass.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/oops/constantPoolKlass.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -44,6 +44,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
--- a/src/share/vm/oops/instanceKlass.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/oops/instanceKlass.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -59,6 +59,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
--- a/src/share/vm/oops/markOop.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/oops/markOop.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -33,6 +33,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 void markOopDesc::print_on(outputStream* st) const {
--- a/src/share/vm/oops/oop.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/oops/oop.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 bool always_do_update_barrier = false;
 
--- a/src/share/vm/oops/oopsHierarchy.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/oops/oopsHierarchy.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifdef CHECK_UNHANDLED_OOPS
 
--- a/src/share/vm/opto/c2_globals.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/opto/c2_globals.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -41,6 +41,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "c2_globals_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "c2_globals_bsd.hpp"
+#endif
 
 //
 // Defines all globals flags used by the server compiler.
--- a/src/share/vm/prims/jni.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/prims/jni.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -88,6 +88,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 static jint CurrentVersion = JNI_VERSION_1_6;
 
--- a/src/share/vm/prims/jvm.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/prims/jvm.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -72,6 +72,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "jvm_windows.h"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "jvm_bsd.h"
+#endif
 
 #include <errno.h>
 
--- a/src/share/vm/prims/jvm.h	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/prims/jvm.h	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "jvm_windows.h"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "jvm_bsd.h"
+#endif
 
 #ifndef _JAVASOFT_JVM_H_
 #define _JAVASOFT_JVM_H_
--- a/src/share/vm/prims/jvmtiEnv.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/prims/jvmtiEnv.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -68,6 +68,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 
--- a/src/share/vm/prims/jvmtiImpl.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/prims/jvmtiImpl.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -51,6 +51,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 //
 // class JvmtiAgentThread
--- a/src/share/vm/prims/nativeLookup.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/prims/nativeLookup.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -49,6 +49,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 static void mangle_name_on(outputStream* st, symbolOop name, int begin, int end) {
--- a/src/share/vm/runtime/arguments.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/arguments.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -55,6 +55,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
 #endif
--- a/src/share/vm/runtime/atomic.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/atomic.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -33,6 +33,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 #ifdef TARGET_OS_ARCH_linux_x86
 # include "atomic_linux_x86.inline.hpp"
 #endif
@@ -51,6 +54,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "atomic_windows_x86.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "atomic_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "atomic_bsd_zero.inline.hpp"
+#endif
 
 jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
   assert(sizeof(jbyte) == 1, "assumption.");
--- a/src/share/vm/runtime/fprofiler.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/fprofiler.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // a simple flat profiler for Java
 
--- a/src/share/vm/runtime/globals.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/globals.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -44,6 +44,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "globals_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "globals_bsd.hpp"
+#endif
 #ifdef TARGET_OS_ARCH_linux_x86
 # include "globals_linux_x86.hpp"
 #endif
@@ -62,6 +65,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "globals_windows_x86.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "globals_bsd_x86.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "globals_bsd_zero.hpp"
+#endif
 #ifdef COMPILER1
 #ifdef TARGET_ARCH_x86
 # include "c1_globals_x86.hpp"
@@ -78,6 +87,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "c1_globals_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "c1_globals_bsd.hpp"
+#endif
 #endif
 #ifdef COMPILER2
 #ifdef TARGET_ARCH_x86
@@ -95,6 +107,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "c2_globals_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "c2_globals_bsd.hpp"
+#endif
 #endif
 #ifdef SHARK
 #ifdef TARGET_ARCH_zero
--- a/src/share/vm/runtime/handles.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/handles.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -38,6 +38,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifdef ASSERT
 oop* HandleArea::allocate_handle(oop obj) {
--- a/src/share/vm/runtime/handles.inline.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/handles.inline.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // these inline functions are in a separate file to break an include cycle
 // between Thread and Handle
--- a/src/share/vm/runtime/interfaceSupport.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/interfaceSupport.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -44,6 +44,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Wrapper for all entry points to the virtual machine.
 // The HandleMarkCleaner is a faster version of HandleMark.
@@ -114,6 +117,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "interfaceSupport_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "interfaceSupport_bsd.hpp"
+#endif
 
 };
 
--- a/src/share/vm/runtime/java.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/java.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -79,6 +79,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
--- a/src/share/vm/runtime/javaCalls.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/javaCalls.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -48,6 +48,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // -----------------------------------------------------
 // Implementation of JavaCallWrapper
--- a/src/share/vm/runtime/javaCalls.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/javaCalls.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -48,6 +48,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // A JavaCallWrapper is constructed before each JavaCall and destructed after the call.
 // Its purpose is to allocate/deallocate a new handle block and to save/restore the last
--- a/src/share/vm/runtime/javaFrameAnchor.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/javaFrameAnchor.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -44,6 +44,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "orderAccess_windows_x86.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "orderAccess_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "orderAccess_bsd_zero.inline.hpp"
+#endif
 //
 // An object for encapsulating the machine/os dependent part of a JavaThread frame state
 //
--- a/src/share/vm/runtime/jniHandles.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/jniHandles.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 JNIHandleBlock* JNIHandles::_global_handles       = NULL;
--- a/src/share/vm/runtime/memprofiler.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/memprofiler.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -46,6 +46,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifndef PRODUCT
 
--- a/src/share/vm/runtime/mutex.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/mutex.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -39,6 +39,10 @@
 # include "mutex_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "mutex_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
 //
--- a/src/share/vm/runtime/mutexLocker.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/mutexLocker.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Mutexes used in the VM (see comment in mutexLocker.hpp):
 //
--- a/src/share/vm/runtime/mutexLocker.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/mutexLocker.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 // Mutexes used in the VM.
 
--- a/src/share/vm/runtime/objectMonitor.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/objectMonitor.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -50,6 +50,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 #if defined(__GNUC__) && !defined(IA64)
   // Need to inhibit inlining for older versions of GCC to avoid build-time failures
--- a/src/share/vm/runtime/os.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/os.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -60,6 +60,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 # include <signal.h>
 
--- a/src/share/vm/runtime/os.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/os.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -30,6 +30,9 @@
 #include "runtime/extendedPC.hpp"
 #include "runtime/handles.hpp"
 #include "utilities/top.hpp"
+#ifdef TARGET_OS_FAMILY_bsd
+# include "jvm_bsd.h"
+#endif
 #ifdef TARGET_OS_FAMILY_linux
 # include "jvm_linux.h"
 #endif
@@ -39,6 +42,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "jvm_windows.h"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "jvm_bsd.h"
+#endif
 
 // os defines the interface to operating system; this includes traditional
 // OS services (time, I/O) as well as other functionality with system-
@@ -658,6 +664,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.hpp"
+#endif
 #ifdef TARGET_OS_ARCH_linux_x86
 # include "os_linux_x86.hpp"
 #endif
@@ -676,6 +685,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "os_windows_x86.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "os_bsd_x86.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "os_bsd_zero.hpp"
+#endif
 
 
   // debugging support (mostly used by debug.cpp but also fatal error handler)
--- a/src/share/vm/runtime/osThread.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/osThread.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -109,6 +109,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "osThread_windows.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "osThread_bsd.hpp"
+#endif
 
 };
 
--- a/src/share/vm/runtime/safepoint.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/safepoint.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -70,6 +70,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/shared/concurrentGCThread.hpp"
--- a/src/share/vm/runtime/synchronizer.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/synchronizer.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -51,6 +51,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 #if defined(__GNUC__) && !defined(IA64)
   // Need to inhibit inlining for older versions of GCC to avoid build-time failures
--- a/src/share/vm/runtime/task.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/task.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -39,6 +39,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 int PeriodicTask::_num_tasks = 0;
 PeriodicTask* PeriodicTask::_tasks[PeriodicTask::max_tasks];
--- a/src/share/vm/runtime/thread.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/thread.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -87,6 +87,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
--- a/src/share/vm/runtime/thread.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/thread.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -1598,6 +1598,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "thread_windows_x86.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "thread_bsd_x86.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "thread_bsd_zero.hpp"
+#endif
 
 
  public:
--- a/src/share/vm/runtime/threadLocalStorage.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/threadLocalStorage.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 // static member initialization
 int ThreadLocalStorage::_thread_index = -1;
--- a/src/share/vm/runtime/threadLocalStorage.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/threadLocalStorage.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -62,6 +62,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "threadLS_windows_x86.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "threadLS_bsd_x86.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "threadLS_bsd_zero.hpp"
+#endif
 
 
  public:
--- a/src/share/vm/runtime/timer.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/timer.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 void elapsedTimer::add(elapsedTimer t) {
--- a/src/share/vm/runtime/virtualspace.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/virtualspace.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 // ReservedSpace
--- a/src/share/vm/runtime/vmStructs.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/vmStructs.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -118,6 +118,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifdef TARGET_OS_ARCH_linux_x86
 # include "vmStructs_linux_x86.hpp"
 #endif
@@ -136,6 +139,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "vmStructs_windows_x86.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "vmStructs_bsd_x86.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "vmStructs_bsd_zero.hpp"
+#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/cmsPermGen.hpp"
 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
--- a/src/share/vm/runtime/vmThread.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/vmThread.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -46,6 +46,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 HS_DTRACE_PROBE_DECL3(hotspot, vmops__request, char *, uintptr_t, int);
 HS_DTRACE_PROBE_DECL3(hotspot, vmops__begin, char *, uintptr_t, int);
--- a/src/share/vm/runtime/vmThread.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/vmThread.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -36,6 +36,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 //
 // Prioritized queue of VM operations.
--- a/src/share/vm/runtime/vm_operations.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/runtime/vm_operations.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -43,6 +43,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 #define VM_OP_NAME_INITIALIZE(name) #name,
 
--- a/src/share/vm/utilities/accessFlags.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/accessFlags.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -34,6 +34,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 void AccessFlags::atomic_set_bits(jint bits) {
--- a/src/share/vm/utilities/array.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/array.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -34,6 +34,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 #ifdef ASSERT
--- a/src/share/vm/utilities/bitMap.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/bitMap.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 
 BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) :
--- a/src/share/vm/utilities/debug.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/debug.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -62,6 +62,10 @@
 # include "os_windows.inline.hpp"
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifndef ASSERT
 #  ifdef _DEBUG
--- a/src/share/vm/utilities/elfFile.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/elfFile.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -41,7 +41,9 @@
 typedef Elf64_Shdr      Elf_Shdr;
 typedef Elf64_Sym       Elf_Sym;
 
+#ifndef _ALLBSD_SOURCE
 #define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
 
 #else
 
@@ -55,8 +57,10 @@
 typedef Elf32_Shdr      Elf_Shdr;
 typedef Elf32_Sym       Elf_Sym;
 
+#ifndef _ALLBSD_SOURCE
 #define ELF_ST_TYPE ELF32_ST_TYPE
 #endif
+#endif
 
 #include "globalDefinitions.hpp"
 #include "memory/allocation.hpp"
--- a/src/share/vm/utilities/events.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/events.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -38,6 +38,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 #ifndef PRODUCT
--- a/src/share/vm/utilities/exceptions.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/exceptions.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -42,6 +42,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 
 // Implementation of ThreadShadow
--- a/src/share/vm/utilities/growableArray.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/growableArray.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -34,6 +34,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 #ifdef ASSERT
 void GenericGrowableArray::set_nesting() {
   if (on_stack()) {
--- a/src/share/vm/utilities/histogram.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/histogram.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 // This class provides a framework for collecting various statistics.
 // The current implementation is oriented towards counting invocations
--- a/src/share/vm/utilities/ostream.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/ostream.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -39,6 +39,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.inline.hpp"
+#endif
 
 extern "C" void jio_print(const char* s); // Declarationtion of jvm method
 
--- a/src/share/vm/utilities/preserveException.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/preserveException.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // This file provides more support for exception handling; see also exceptions.hpp
 class PreserveExceptionMark {
--- a/src/share/vm/utilities/taskqueue.cpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/taskqueue.cpp	Sat Jan 22 22:41:33 2011 -0800
@@ -37,6 +37,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 #ifdef TRACESPINNING
 uint ParallelTaskTerminator::_total_yields = 0;
--- a/src/share/vm/utilities/taskqueue.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/taskqueue.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -47,6 +47,12 @@
 #ifdef TARGET_OS_ARCH_windows_x86
 # include "orderAccess_windows_x86.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "orderAccess_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "orderAccess_bsd_zero.inline.hpp"
+#endif
 
 // Simple TaskQueue stats that are collected by default in debug builds.
 
--- a/src/share/vm/utilities/workgroup.hpp	Sat Jan 22 22:27:24 2011 -0800
+++ b/src/share/vm/utilities/workgroup.hpp	Sat Jan 22 22:41:33 2011 -0800
@@ -35,6 +35,9 @@
 #ifdef TARGET_OS_FAMILY_windows
 # include "thread_windows.inline.hpp"
 #endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
 
 // Forward declarations of classes defined here