--- old/agent/make/Makefile Tue Sep 13 12:20:37 2011 +++ new/agent/make/Makefile Tue Sep 13 12:20:37 2011 @@ -53,6 +53,9 @@ sun.jvm.hotspot.compiler \ sun.jvm.hotspot.debugger \ sun.jvm.hotspot.debugger.amd64 \ +sun.jvm.hotspot.debugger.bsd \ +sun.jvm.hotspot.debugger.bsd.amd64 \ +sun.jvm.hotspot.debugger.bsd.x86 \ sun.jvm.hotspot.debugger.cdbg \ sun.jvm.hotspot.debugger.cdbg.basic \ sun.jvm.hotspot.debugger.cdbg.basic.amd64 \ @@ -93,6 +96,9 @@ sun.jvm.hotspot.prims \ sun.jvm.hotspot.runtime \ sun.jvm.hotspot.runtime.amd64 \ +sun.jvm.hotspot.runtime.bsd \ +sun.jvm.hotspot.runtime.bsd_amd64 \ +sun.jvm.hotspot.runtime.bsd_x86 \ sun.jvm.hotspot.runtime.ia64 \ sun.jvm.hotspot.runtime.linux \ sun.jvm.hotspot.runtime.linux_amd64 \ @@ -143,6 +149,9 @@ sun/jvm/hotspot/compiler/*.java \ sun/jvm/hotspot/debugger/*.java \ sun/jvm/hotspot/debugger/amd64/*.java \ +sun/jvm/hotspot/debugger/bsd/*.java \ +sun/jvm/hotspot/debugger/bsd/amd64/*.java \ +sun/jvm/hotspot/debugger/bsd/x86/*.java \ sun/jvm/hotspot/debugger/cdbg/*.java \ sun/jvm/hotspot/debugger/cdbg/basic/*.java \ sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \ @@ -176,6 +185,9 @@ sun/jvm/hotspot/prims/*.java \ sun/jvm/hotspot/runtime/*.java \ sun/jvm/hotspot/runtime/amd64/*.java \ +sun/jvm/hotspot/runtime/bsd/*.java \ +sun/jvm/hotspot/runtime/bsd_amd64/*.java \ +sun/jvm/hotspot/runtime/bsd_x86/*.java \ sun/jvm/hotspot/runtime/ia64/*.java \ sun/jvm/hotspot/runtime/linux/*.java \ sun/jvm/hotspot/runtime/linux_amd64/*.java \ --- old/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue Sep 13 12:20:38 2011 +++ new/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue Sep 13 12:20:38 2011 @@ -28,6 +28,7 @@ import java.net.*; import java.rmi.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.proc.*; import sun.jvm.hotspot.debugger.remote.*; import sun.jvm.hotspot.debugger.windbg.*; @@ -335,6 +336,8 @@ setupDebuggerWin32(); } else if (os.equals("linux")) { setupDebuggerLinux(); + } else if (os.equals("bsd")) { + setupDebuggerBsd(); } else { // Add support for more operating systems here throw new DebuggerException("Operating system " + os + " not yet supported"); @@ -390,6 +393,10 @@ db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames), debugger, jvmLibNames); + } else if (os.equals("bsd")) { + db = new HotSpotTypeDataBase(machDesc, + new BsdVtblAccess(debugger, jvmLibNames), + debugger, jvmLibNames); } else { throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)"); } @@ -477,6 +484,8 @@ setupJVMLibNamesWin32(); } else if (os.equals("linux")) { setupJVMLibNamesLinux(); + } else if (os.equals("bsd")) { + setupJVMLibNamesBsd(); } else { throw new RuntimeException("Unknown OS type"); } @@ -553,6 +562,31 @@ private void setupJVMLibNamesLinux() { jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; } + + // + // BSD + // + + private void setupDebuggerBsd() { + setupJVMLibNamesBsd(); + + if (cpu.equals("x86")) { + machDesc = new MachineDescriptionIntelX86(); + } else if (cpu.equals("amd64")) { + machDesc = new MachineDescriptionAMD64(); + } else { + throw new DebuggerException("BSD only supported on x86/amd64"); + } + + BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer); + debugger = dbg; + + attachDebugger(); + } + + private void setupJVMLibNamesBsd() { + jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; + } /** Convenience routine which should be called by per-platform debugger setup. Should not be called when startupMode is --- old/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Tue Sep 13 12:20:39 2011 +++ new/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Tue Sep 13 12:20:39 2011 @@ -29,6 +29,7 @@ import java.rmi.*; import sun.jvm.hotspot.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.proc.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.windbg.*; @@ -514,6 +515,8 @@ setupDebuggerWin32(); } else if (os.equals("linux")) { setupDebuggerLinux(); + } else if (os.equals("bsd")) { + setupDebuggerBsd(); } else { // Add support for more operating systems here throw new DebuggerException("Operating system " + os + " not yet supported"); @@ -565,6 +568,9 @@ } else if (os.equals("linux")) { db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames), debugger, jvmLibNames); + } else if (os.equals("bsd")) { + db = new HotSpotTypeDataBase(machDesc, new BsdVtblAccess(debugger, jvmLibNames), + debugger, jvmLibNames); } else { throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess implemented yet)"); } @@ -666,6 +672,8 @@ setupJVMLibNamesWin32(); } else if (os.equals("linux")) { setupJVMLibNamesLinux(); + } else if (os.equals("bsd")) { + setupJVMLibNamesBsd(); } else { throw new RuntimeException("Unknown OS type"); } @@ -743,6 +751,34 @@ private void setupJVMLibNamesLinux() { // same as solaris setupJVMLibNamesSolaris(); + } + + // + // BSD + // + + private void setupDebuggerBsd() { + setupJVMLibNamesBsd(); + + if (cpu.equals("x86")) { + machDesc = new MachineDescriptionIntelX86(); + } else if (cpu.equals("amd64")) { + machDesc = new MachineDescriptionAMD64(); + } else { + throw new DebuggerException("Bsd only supported on x86/amd64"); + } + + // Note we do not use a cache for the local debugger in server + // mode; it will be taken care of on the client side (once remote + // debugging is implemented). + + debugger = new BsdDebuggerLocal(machDesc, !isServer); + attachDebugger(); + } + + private void setupJVMLibNamesBsd() { + // same as solaris + setupJVMLibNamesSolaris(); } /** Convenience routine which should be called by per-platform --- old/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Tue Sep 13 12:20:40 2011 +++ new/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Tue Sep 13 12:20:40 2011 @@ -37,6 +37,8 @@ import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess; +import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; +import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess; import sun.jvm.hotspot.utilities.*; public class Threads { @@ -90,7 +92,12 @@ } else if (cpu.equals("sparc")) { access = new LinuxSPARCJavaThreadPDAccess(); } - + } else if (os.equals("bsd")) { + if (cpu.equals("x86")) { + access = new BsdX86JavaThreadPDAccess(); + } else if (cpu.equals("amd64")) { + access = new BsdAMD64JavaThreadPDAccess(); + } } if (access == null) { --- old/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Tue Sep 13 12:20:41 2011 +++ new/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Tue Sep 13 12:20:41 2011 @@ -37,6 +37,14 @@ return "solaris"; } else if (os.equals("Linux")) { return "linux"; + } else if (os.equals("FreeBSD")) { + return "bsd"; + } else if (os.equals("NetBSD")) { + return "bsd"; + } else if (os.equals("OpenBSD")) { + return "bsd"; + } else if (os.equals("Darwin")) { + return "bsd"; } else if (os.startsWith("Windows")) { return "win32"; } else { --- old/make/Makefile Tue Sep 13 12:20:43 2011 +++ new/make/Makefile Tue Sep 13 12:20:42 2011 @@ -323,28 +323,28 @@ ifneq ($(OSNAME),windows) ifeq ($(ZERO_BUILD), true) ifeq ($(SHARK_BUILD), true) -$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(SHARK_DIR)/%.so +$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_SERVER_DIR)/%.so: $(SHARK_DIR)/%.so +$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) else -$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(ZERO_DIR)/%.so +$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_SERVER_DIR)/%.so: $(ZERO_DIR)/%.so +$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) endif else -$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C1_DIR)/%.so +$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so +$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so +$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_CLIENT_DIR)/64/%.so: $(C1_DIR)/%.so +$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_SERVER_DIR)/%.so: $(C2_DIR)/%.so +$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so +$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) endif endif --- old/make/cscope.make Tue Sep 13 12:20:44 2011 +++ new/make/cscope.make Tue Sep 13 12:20:43 2011 @@ -63,7 +63,7 @@ # space-separated list of identifiers to include only those systems. ifdef CS_OS CS_PRUNE_OS = $(patsubst %,-o -name '*%*',\ - $(filter-out ${CS_OS},linux macos solaris windows)) + $(filter-out ${CS_OS},bsd linux macos solaris windows)) endif # CPU-specific files for all processors are included by default. Set CS_CPU --- old/make/defs.make Tue Sep 13 12:20:45 2011 +++ new/make/defs.make Tue Sep 13 12:20:45 2011 @@ -118,13 +118,23 @@ # Windows should have OS predefined ifeq ($(OS),) OS := $(shell uname -s) + ifneq ($(findstring BSD,$(OS)),) + OS=bsd + endif + ifeq ($(OS), Darwin) + OS=bsd + endif HOST := $(shell uname -n) endif -# If not SunOS and not Linux, assume Windows +# If not SunOS, not Linux and not BSD, assume Windows ifneq ($(OS), Linux) ifneq ($(OS), SunOS) - OSNAME=windows + ifneq ($(OS), bsd) + OSNAME=windows + else + OSNAME=bsd + endif else OSNAME=solaris endif --- old/make/linux/makefiles/defs.make Tue Sep 13 12:20:46 2011 +++ new/make/linux/makefiles/defs.make Tue Sep 13 12:20:46 2011 @@ -116,6 +116,9 @@ JDK_INCLUDE_SUBDIR=linux +# Library suffix +LIBRARY_SUFFIX=so + # FIXUP: The subdirectory for a debug build is NOT the same on all platforms VM_DEBUG=jvmg @@ -122,27 +125,27 @@ EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html # client and server subdirectories have symbolic links to ../libjsig.so -EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so +EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client ifndef BUILD_CLIENT_ONLY EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt -EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so +EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) endif ifneq ($(ZERO_BUILD), true) ifeq ($(ARCH_DATA_MODEL), 32) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) endif endif # Serviceability Binaries # No SA Support for PPC, IA64, ARM or zero -ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \ +ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ $(EXPORT_LIB_DIR)/sa-jdi.jar -ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \ +ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ $(EXPORT_LIB_DIR)/sa-jdi.jar ADD_SA_BINARIES/ppc = ADD_SA_BINARIES/ia64 = --- old/make/sa.files Tue Sep 13 12:20:47 2011 +++ new/make/sa.files Tue Sep 13 12:20:47 2011 @@ -51,6 +51,9 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/compiler/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/amd64/*.java \ +$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/*.java \ +$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/amd64/*.java \ +$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \ @@ -94,6 +97,9 @@ AGENT_FILES2 = \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/amd64/*.java \ +$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd/*.java \ +$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_amd64/*.java \ +$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/bsd_x86/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ia64/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux/*.java \ $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/linux_amd64/*.java \ --- old/make/solaris/makefiles/defs.make Tue Sep 13 12:20:48 2011 +++ new/make/solaris/makefiles/defs.make Tue Sep 13 12:20:48 2011 @@ -61,13 +61,16 @@ JDK_INCLUDE_SUBDIR=solaris +# Library suffix +LIBRARY_SUFFIX=so + # FIXUP: The subdirectory for a debug build is NOT the same on all platforms VM_DEBUG=jvmg EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html -# client and server subdirectories have symbolic links to ../libjsig.so -EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.so +# client and server subdirectories have symbolic links to ../libjsig.$(LIBRARY_SUFFIX) +EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client @@ -74,22 +77,22 @@ ifneq ($(BUILD_CLIENT_ONLY),true) EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt -EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so -EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.so -EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.so +EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) +EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.$(LIBRARY_SUFFIX) +EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX) endif ifeq ($(ARCH_DATA_MODEL), 32) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.so - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.so - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.so - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.so + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX) ifneq ($(BUILD_CLIENT_ONLY), true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.so - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.so + EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX) endif endif -EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so +EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar --- old/make/windows/makefiles/defs.make Tue Sep 13 12:20:49 2011 +++ new/make/windows/makefiles/defs.make Tue Sep 13 12:20:49 2011 @@ -109,6 +109,9 @@ JDK_INCLUDE_SUBDIR=win32 +# Library suffix +LIBRARY_SUFFIX=dll + # HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined # and added to MAKE_ARGS list in $(GAMMADIR)/make/defs.make. @@ -175,24 +178,24 @@ EXPORT_KERNEL_DIR = $(EXPORT_JRE_BIN_DIR)/kernel EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt -EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.dll +EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.$(LIBRARY_SUFFIX) EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.pdb EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.map EXPORT_LIST += $(EXPORT_LIB_DIR)/jvm.lib ifeq ($(ARCH_DATA_MODEL), 32) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.dll + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.$(LIBRARY_SUFFIX) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.pdb EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.map # kernel vm EXPORT_LIST += $(EXPORT_KERNEL_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.dll + EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.$(LIBRARY_SUFFIX) EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.pdb EXPORT_LIST += $(EXPORT_KERNEL_DIR)/jvm.map endif ifeq ($(BUILD_WIN_SA), 1) - EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.dll + EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.$(LIBRARY_SUFFIX) EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.pdb EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.map EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar --- old/src/cpu/sparc/vm/globals_sparc.hpp Tue Sep 13 12:20:50 2011 +++ new/src/cpu/sparc/vm/globals_sparc.hpp Tue Sep 13 12:20:50 2011 @@ -70,7 +70,11 @@ define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); +#ifdef _ALLBSD_SOURCE +define_pd_global(bool, UseMembar, true); +#else define_pd_global(bool, UseMembar, false); +#endif // GC Ergo Flags define_pd_global(intx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread --- old/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Tue Sep 13 12:20:51 2011 +++ new/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Tue Sep 13 12:20:51 2011 @@ -427,8 +427,8 @@ // Fetch the exception from TLS and clear out exception related thread state __ get_thread(rsi); __ movptr(rax, Address(rsi, JavaThread::exception_oop_offset())); - __ movptr(Address(rsi, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); - __ movptr(Address(rsi, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); + __ movptr(Address(rsi, JavaThread::exception_oop_offset()), (intptr_t)NULL_WORD); + __ movptr(Address(rsi, JavaThread::exception_pc_offset()), (intptr_t)NULL_WORD); __ bind(_unwind_handler_entry); __ verify_not_null_oop(rax); --- old/src/cpu/x86/vm/globals_x86.hpp Tue Sep 13 12:20:52 2011 +++ new/src/cpu/x86/vm/globals_x86.hpp Tue Sep 13 12:20:52 2011 @@ -70,7 +70,11 @@ define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); +#ifdef _ALLBSD_SOURCE +define_pd_global(bool, UseMembar, true); +#else define_pd_global(bool, UseMembar, false); +#endif // GC Ergo Flags define_pd_global(intx, CMSYoungGenPerWorker, 64*M); // default max size of CMS young gen, per GC worker thread --- old/src/cpu/x86/vm/interp_masm_x86_32.cpp Tue Sep 13 12:20:54 2011 +++ new/src/cpu/x86/vm/interp_masm_x86_32.cpp Tue Sep 13 12:20:53 2011 @@ -1161,7 +1161,7 @@ int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row)); set_mdp_data_at(mdp, recvr_offset, receiver); int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); - movptr(reg2, (int32_t)DataLayout::counter_increment); + movptr(reg2, (intptr_t)DataLayout::counter_increment); set_mdp_data_at(mdp, count_offset, reg2); if (start_row > 0) { jmp(done); @@ -1304,7 +1304,7 @@ test_method_data_pointer(mdp, profile_continue); // Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes() - movptr(reg2, (int32_t)in_bytes(MultiBranchData::per_case_size())); + movptr(reg2, (intptr_t)in_bytes(MultiBranchData::per_case_size())); // index is positive and so should have correct value if this code were // used on 64bits imulptr(index, reg2); --- old/src/cpu/x86/vm/jni_x86.h Tue Sep 13 12:20:55 2011 +++ new/src/cpu/x86/vm/jni_x86.h Tue Sep 13 12:20:55 2011 @@ -26,7 +26,7 @@ #ifndef _JAVASOFT_JNI_MD_H_ #define _JAVASOFT_JNI_MD_H_ -#if defined(SOLARIS) || defined(LINUX) +#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) #if defined(__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2) #define JNIEXPORT __attribute__((visibility("default"))) --- old/src/cpu/zero/vm/globals_zero.hpp Tue Sep 13 12:20:56 2011 +++ new/src/cpu/zero/vm/globals_zero.hpp Tue Sep 13 12:20:56 2011 @@ -52,7 +52,11 @@ define_pd_global(bool, RewriteBytecodes, true); define_pd_global(bool, RewriteFrequentPairs, true); +#ifdef _ALLBSD_SOURCE +define_pd_global(bool, UseMembar, true); +#else define_pd_global(bool, UseMembar, false); +#endif // GC Ergo Flags define_pd_global(intx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread --- old/src/os/linux/vm/os_linux.cpp Tue Sep 13 12:20:57 2011 +++ new/src/os/linux/vm/os_linux.cpp Tue Sep 13 12:20:57 2011 @@ -22,8 +22,6 @@ * */ -# define __STDC_FORMAT_MACROS - // no precompiled headers #include "classfile/classLoader.hpp" #include "classfile/systemDictionary.hpp" --- old/src/os/posix/launcher/java_md.c Tue Sep 13 12:20:58 2011 +++ new/src/os/posix/launcher/java_md.c Tue Sep 13 12:20:58 2011 @@ -41,14 +41,21 @@ #include "version_comp.h" #endif -#ifdef __linux__ +#if defined(__linux__) || defined(_ALLBSD_SOURCE) #include #else #include #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 defined(_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); --- old/src/os/posix/launcher/launcher.script Tue Sep 13 12:20:59 2011 +++ new/src/os/posix/launcher/launcher.script Tue Sep 13 12:20:59 2011 @@ -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. --- old/src/share/vm/adlc/adlc.hpp Tue Sep 13 12:21:01 2011 +++ new/src/share/vm/adlc/adlc.hpp Tue Sep 13 12:21:00 2011 @@ -67,9 +67,9 @@ #endif #endif // _WIN32 -#ifdef LINUX +#if defined(LINUX) || defined(_ALLBSD_SOURCE) #include -#endif // LINUX +#endif // LINUX || _ALLBSD_SOURCE // Macros #define uint32 unsigned int --- old/src/share/vm/classfile/javaClasses.cpp Tue Sep 13 12:21:02 2011 +++ new/src/share/vm/classfile/javaClasses.cpp Tue Sep 13 12:21:02 2011 @@ -1148,7 +1148,7 @@ } nmethod* nm = method->code(); if (WizardMode && nm != NULL) { - sprintf(buf + (int)strlen(buf), "(nmethod " PTR_FORMAT ")", (intptr_t)nm); + sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm); } } @@ -2697,7 +2697,7 @@ instanceKlass* ik = instanceKlass::cast(k); methodOop m_normal = ik->lookup_method(vmSymbols::setTargetNormal_name(), vmSymbols::setTarget_signature()); methodOop m_volatile = ik->lookup_method(vmSymbols::setTargetVolatile_name(), vmSymbols::setTarget_signature()); - guarantee(m_normal && m_volatile, "must exist"); + guarantee(m_normal != NULL && m_volatile != NULL, "must exist"); m_normal->set_not_compilable_quietly(); m_volatile->set_not_compilable_quietly(); } --- old/src/share/vm/interpreter/bytecodeTracer.cpp Tue Sep 13 12:21:03 2011 +++ new/src/share/vm/interpreter/bytecodeTracer.cpp Tue Sep 13 12:21:03 2011 @@ -92,7 +92,7 @@ // the incoming method. We could lose a line of trace output. // This is acceptable in a debug-only feature. st->cr(); - st->print("[%d] ", (int) Thread::current()->osthread()->thread_id()); + st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id()); method->print_name(st); st->cr(); _current_method = method(); @@ -106,7 +106,7 @@ } _code = code; int bci = bcp - method->code_base(); - st->print("[%d] ", (int) Thread::current()->osthread()->thread_id()); + st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id()); if (Verbose) { st->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s", BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code)); --- old/src/share/vm/oops/constantPoolOop.cpp Tue Sep 13 12:21:04 2011 +++ new/src/share/vm/oops/constantPoolOop.cpp Tue Sep 13 12:21:04 2011 @@ -1355,7 +1355,7 @@ } case JVM_CONSTANT_Long: { u8 val = Bytes::get_Java_u8(bytes); - printf("long "INT64_FORMAT, *(jlong *) &val); + printf("long "INT64_FORMAT, (int64_t) *(jlong *) &val); ent_size = 8; idx++; // Long takes two cpool slots break; --- old/src/share/vm/prims/forte.cpp Tue Sep 13 12:21:05 2011 +++ new/src/share/vm/prims/forte.cpp Tue Sep 13 12:21:05 2011 @@ -621,6 +621,11 @@ // Method to let libcollector know about a dynamically loaded function. // Because it is weakly bound, the calls become NOP's when the library // isn't present. +#ifdef __APPLE__ +// XXXDARWIN: Link errors occur even when __attribute__((weak_import)) +// is added +#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0) +#else void collector_func_load(char* name, void* null_argument_1, void* null_argument_2, @@ -631,6 +636,7 @@ #pragma weak collector_func_load #define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \ ( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),0 : 0 ) +#endif // __APPLE__ #endif // !_WINDOWS } // end extern "C" --- old/src/share/vm/runtime/os.cpp Tue Sep 13 12:21:07 2011 +++ new/src/share/vm/runtime/os.cpp Tue Sep 13 12:21:06 2011 @@ -120,7 +120,11 @@ assert(false, "Failed localtime_pd"); return NULL; } +#if defined(_ALLBSD_SOURCE) + const time_t zone = (time_t) time_struct.tm_gmtoff; +#else const time_t zone = timezone; +#endif // If daylight savings time is in effect, // we are 1 hour East of our time zone @@ -388,6 +392,13 @@ if (_native_java_library == NULL) { vm_exit_during_initialization("Unable to load native library", ebuf); } + +#if defined(__OpenBSD__) + // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so + // ignore errors + dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "net"); + dll_load(buffer, ebuf, sizeof(ebuf)); +#endif } static jboolean onLoaded = JNI_FALSE; if (onLoaded) { --- old/src/share/vm/runtime/vm_version.cpp Tue Sep 13 12:21:08 2011 +++ new/src/share/vm/runtime/vm_version.cpp Tue Sep 13 12:21:08 2011 @@ -167,7 +167,8 @@ #define OS LINUX_ONLY("linux") \ WINDOWS_ONLY("windows") \ - SOLARIS_ONLY("solaris") + SOLARIS_ONLY("solaris") \ + BSD_ONLY("bsd") #ifdef ZERO #define CPU ZERO_LIBARCH --- old/src/share/vm/utilities/decoder.cpp Tue Sep 13 12:21:09 2011 +++ new/src/share/vm/utilities/decoder.cpp Tue Sep 13 12:21:09 2011 @@ -29,7 +29,7 @@ Decoder::decoder_status Decoder::_decoder_status = Decoder::no_error; bool Decoder::_initialized = false; -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) // Implementation of common functionalities among Solaris and Linux #include "utilities/elfFile.hpp" @@ -101,4 +101,3 @@ } #endif - --- old/src/share/vm/utilities/decoder.hpp Tue Sep 13 12:21:10 2011 +++ new/src/share/vm/utilities/decoder.hpp Tue Sep 13 12:21:10 2011 @@ -38,6 +38,8 @@ typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64); typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD); +#elif defined(__APPLE__) + #else class ElfFile; @@ -79,7 +81,7 @@ static decoder_status get_status() { return _decoder_status; }; -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) private: static ElfFile* get_elf_file(const char* filepath); #endif // _WINDOWS @@ -94,6 +96,7 @@ static bool _can_decode_in_vm; static pfn_SymGetSymFromAddr64 _pfnSymGetSymFromAddr64; static pfn_UndecorateSymbolName _pfnUndecorateSymbolName; +#elif __APPLE__ #else static ElfFile* _opened_elf_files; #endif // _WINDOWS --- old/src/share/vm/utilities/elfFile.cpp Tue Sep 13 12:21:11 2011 +++ new/src/share/vm/utilities/elfFile.cpp Tue Sep 13 12:21:11 2011 @@ -24,7 +24,7 @@ #include "precompiled.hpp" -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) #include #include --- old/src/share/vm/utilities/elfFile.hpp Tue Sep 13 12:21:12 2011 +++ new/src/share/vm/utilities/elfFile.hpp Tue Sep 13 12:21:12 2011 @@ -25,9 +25,13 @@ #ifndef __ELF_FILE_HPP #define __ELF_FILE_HPP -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) +#if defined(__OpenBSD__) +#include +#else #include +#endif #include #ifdef _LP64 @@ -41,7 +45,9 @@ typedef Elf64_Shdr Elf_Shdr; typedef Elf64_Sym Elf_Sym; +#if !defined(_ALLBSD_SOURCE) || defined(__APPLE__) #define ELF_ST_TYPE ELF64_ST_TYPE +#endif #else @@ -55,8 +61,10 @@ typedef Elf32_Shdr Elf_Shdr; typedef Elf32_Sym Elf_Sym; +#if !defined(_ALLBSD_SOURCE) || defined(__APPLE__) #define ELF_ST_TYPE ELF32_ST_TYPE #endif +#endif #include "globalDefinitions.hpp" #include "memory/allocation.hpp" @@ -137,4 +145,3 @@ #endif // _WINDOWS #endif // __ELF_FILE_HPP - --- old/src/share/vm/utilities/elfStringTable.cpp Tue Sep 13 12:21:13 2011 +++ new/src/share/vm/utilities/elfStringTable.cpp Tue Sep 13 12:21:13 2011 @@ -24,7 +24,7 @@ #include "precompiled.hpp" -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) #include "memory/allocation.inline.hpp" #include "runtime/os.hpp" @@ -87,4 +87,3 @@ } #endif // _WINDOWS - --- old/src/share/vm/utilities/elfStringTable.hpp Tue Sep 13 12:21:14 2011 +++ new/src/share/vm/utilities/elfStringTable.hpp Tue Sep 13 12:21:14 2011 @@ -25,7 +25,7 @@ #ifndef __ELF_STRING_TABLE_HPP #define __ELF_STRING_TABLE_HPP -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) #include "memory/allocation.hpp" #include "utilities/decoder.hpp" @@ -79,4 +79,3 @@ #endif // _WINDOWS #endif // __ELF_STRING_TABLE_HPP - --- old/src/share/vm/utilities/elfSymbolTable.cpp Tue Sep 13 12:21:15 2011 +++ new/src/share/vm/utilities/elfSymbolTable.cpp Tue Sep 13 12:21:15 2011 @@ -24,7 +24,7 @@ #include "precompiled.hpp" -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) #include "memory/allocation.inline.hpp" #include "utilities/elfSymbolTable.hpp" --- old/src/share/vm/utilities/elfSymbolTable.hpp Tue Sep 13 12:21:16 2011 +++ new/src/share/vm/utilities/elfSymbolTable.hpp Tue Sep 13 12:21:16 2011 @@ -25,7 +25,7 @@ #ifndef __ELF_SYMBOL_TABLE_HPP #define __ELF_SYMBOL_TABLE_HPP -#ifndef _WINDOWS +#if !defined(_WINDOWS) && !defined(__APPLE__) #include "memory/allocation.hpp" @@ -68,6 +68,3 @@ #endif // _WINDOWS #endif // __ELF_SYMBOL_TABLE_HPP - - - --- old/src/share/vm/utilities/globalDefinitions.hpp Tue Sep 13 12:21:17 2011 +++ new/src/share/vm/utilities/globalDefinitions.hpp Tue Sep 13 12:21:17 2011 @@ -25,6 +25,8 @@ #ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP +#define __STDC_FORMAT_MACROS + #ifdef TARGET_COMPILER_gcc # include "utilities/globalDefinitions_gcc.hpp" #endif @@ -1178,43 +1180,31 @@ } // Printf-style formatters for fixed- and variable-width types as pointers and -// integers. -// -// Each compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) -// must define the macro FORMAT64_MODIFIER, which is the modifier for '%x' or -// '%d' formats to indicate a 64-bit quantity; commonly "l" (in LP64) or "ll" -// (in ILP32). +// integers. These are derived from the definitions in inttypes.h. If the platform +// doesn't provide appropriate definitions, they should be provided in +// the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) #define BOOL_TO_STR(_b_) ((_b_) ? "true" : "false") // Format 32-bit quantities. -#define INT32_FORMAT "%d" -#define UINT32_FORMAT "%u" -#define INT32_FORMAT_W(width) "%" #width "d" -#define UINT32_FORMAT_W(width) "%" #width "u" +#define INT32_FORMAT "%" PRId32 +#define UINT32_FORMAT "%" PRIu32 +#define INT32_FORMAT_W(width) "%" #width PRId32 +#define UINT32_FORMAT_W(width) "%" #width PRIu32 -#define PTR32_FORMAT "0x%08x" +#define PTR32_FORMAT "0x%08" PRIx32 // Format 64-bit quantities. -#define INT64_FORMAT "%" FORMAT64_MODIFIER "d" -#define UINT64_FORMAT "%" FORMAT64_MODIFIER "u" -#define PTR64_FORMAT "0x%016" FORMAT64_MODIFIER "x" +#define INT64_FORMAT "%" PRId64 +#define UINT64_FORMAT "%" PRIu64 +#define PTR64_FORMAT "0x%016" PRIx64 -#define INT64_FORMAT_W(width) "%" #width FORMAT64_MODIFIER "d" -#define UINT64_FORMAT_W(width) "%" #width FORMAT64_MODIFIER "u" +#define INT64_FORMAT_W(width) "%" #width PRId64 +#define UINT64_FORMAT_W(width) "%" #width PRIu64 +#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR +#define SIZE_FORMAT_W(width) "%" #width PRIuPTR +#define UINTX_FORMAT_W(width) "%" #width PRIuPTR -// Format macros that allow the field width to be specified. The width must be -// a string literal (e.g., "8") or a macro that evaluates to one. -#ifdef _LP64 -#define UINTX_FORMAT_W(width) UINT64_FORMAT_W(width) -#define SSIZE_FORMAT_W(width) INT64_FORMAT_W(width) -#define SIZE_FORMAT_W(width) UINT64_FORMAT_W(width) -#else -#define UINTX_FORMAT_W(width) UINT32_FORMAT_W(width) -#define SSIZE_FORMAT_W(width) INT32_FORMAT_W(width) -#define SIZE_FORMAT_W(width) UINT32_FORMAT_W(width) -#endif // _LP64 - // Format pointers and size_t (or size_t-like integer types) which change size // between 32- and 64-bit. The pointer format theoretically should be "%p", // however, it has different output on different platforms. On Windows, the data @@ -1225,21 +1215,20 @@ // GCC 4.3.2, however requires the data to be converted to "intptr_t" when // using "%x". #ifdef _LP64 -#define PTR_FORMAT PTR64_FORMAT -#define UINTX_FORMAT UINT64_FORMAT -#define INTX_FORMAT INT64_FORMAT -#define SIZE_FORMAT UINT64_FORMAT -#define SSIZE_FORMAT INT64_FORMAT +#define INTPTR_FORMAT "0x%016" PRIxPTR +#define PTR_FORMAT "0x%016" PRIxPTR #else // !_LP64 -#define PTR_FORMAT PTR32_FORMAT -#define UINTX_FORMAT UINT32_FORMAT -#define INTX_FORMAT INT32_FORMAT -#define SIZE_FORMAT UINT32_FORMAT -#define SSIZE_FORMAT INT32_FORMAT +#define INTPTR_FORMAT "0x%08" PRIxPTR +#define PTR_FORMAT "0x%08" PRIxPTR #endif // _LP64 -#define INTPTR_FORMAT PTR_FORMAT +#define SSIZE_FORMAT "%" PRIdPTR +#define SIZE_FORMAT "%" PRIuPTR +#define UINTX_FORMAT "%" PRIuPTR +#define INTX_FORMAT "%" PRIdPTR + + // Enable zap-a-lot if in debug version. # ifdef ASSERT --- old/src/share/vm/utilities/globalDefinitions_gcc.hpp Tue Sep 13 12:21:19 2011 +++ new/src/share/vm/utilities/globalDefinitions_gcc.hpp Tue Sep 13 12:21:18 2011 @@ -76,15 +76,28 @@ # include # endif -#ifdef LINUX +#if defined(LINUX) || defined(_ALLBSD_SOURCE) #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif // __STDC_LIMIT_MACROS #include #include +#ifndef __OpenBSD__ #include +#endif +#ifdef __APPLE__ + #include + #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4) + // Mac OS X 10.4 defines EFL_AC and EFL_ID, + // which conflict with hotspot variable names. + // + // This has been fixed in Mac OS X 10.5. + #undef EFL_AC + #undef EFL_ID + #endif +#endif #include -#endif // LINUX +#endif // LINUX || _ALLBSD_SOURCE // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in @@ -120,7 +133,7 @@ // pointer is stored as integer value. On some platforms, sizeof(intptr_t) > // sizeof(void*), so here we want something which is integer type, but has the // same size as a pointer. -#ifdef LINUX +#ifdef __GNUC__ #ifdef _LP64 #define NULL_WORD 0L #else @@ -132,7 +145,7 @@ #define NULL_WORD NULL #endif -#ifndef LINUX +#if !defined(LINUX) && !defined(_ALLBSD_SOURCE) // Compiler-specific primitive types typedef unsigned short uint16_t; #ifndef _UINT32_T @@ -152,7 +165,7 @@ // prior definition of intptr_t, and add "&& !defined(XXX)" above. #endif // _SYS_INT_TYPES_H -#endif // !LINUX +#endif // !LINUX && !_ALLBSD_SOURCE // Additional Java basic types @@ -244,7 +257,9 @@ inline int g_isnan(float f) { return isnand(f); } #endif inline int g_isnan(double f) { return isnand(f); } -#elif LINUX +#elif defined(__APPLE__) +inline int g_isnan(double f) { return isnan(f); } +#elif defined(LINUX) || defined(_ALLBSD_SOURCE) inline int g_isnan(float f) { return isnanf(f); } inline int g_isnan(double f) { return isnan(f); } #else --- old/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp Tue Sep 13 12:21:20 2011 +++ new/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp Tue Sep 13 12:21:19 2011 @@ -74,8 +74,25 @@ # ifdef SOLARIS_MUTATOR_LIBTHREAD # include # endif + +#include + +// Solaris 8 doesn't provide definitions of these +#ifdef SOLARIS +#ifndef PRIdPTR +#if defined(_LP64) +#define PRIdPTR "ld" +#define PRIuPTR "lu" +#define PRIxPTR "lx" +#else +#define PRIdPTR "d" +#define PRIuPTR "u" +#define PRIxPTR "x" +#endif +#endif +#endif + #ifdef LINUX -# include # include # include # include --- old/src/share/vm/utilities/globalDefinitions_visCPP.hpp Tue Sep 13 12:21:21 2011 +++ new/src/share/vm/utilities/globalDefinitions_visCPP.hpp Tue Sep 13 12:21:21 2011 @@ -207,6 +207,20 @@ // Formatting. #define FORMAT64_MODIFIER "I64" +// Visual Studio doesn't provide inttypes.h so provide appropriate definitions here. +// The 32 bits ones might need I32 but seem to work ok without it. +#define PRId32 "d" +#define PRIu32 "u" +#define PRIx32 "x" + +#define PRId64 "I64d" +#define PRIu64 "I64u" +#define PRIx64 "I64x" + +#define PRIdPTR "d" +#define PRIuPTR "u" +#define PRIxPTR "x" + #define offset_of(klass,field) offsetof(klass,field) #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP --- old/src/share/vm/utilities/macros.hpp Tue Sep 13 12:21:22 2011 +++ new/src/share/vm/utilities/macros.hpp Tue Sep 13 12:21:22 2011 @@ -161,6 +161,14 @@ #define NOT_WINDOWS(code) code #endif +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) +#define BSD_ONLY(code) code +#define NOT_BSD(code) +#else +#define BSD_ONLY(code) +#define NOT_BSD(code) code +#endif + #ifdef _WIN64 #define WIN64_ONLY(code) code #define NOT_WIN64(code) --- old/src/share/vm/utilities/ostream.cpp Tue Sep 13 12:21:23 2011 +++ new/src/share/vm/utilities/ostream.cpp Tue Sep 13 12:21:23 2011 @@ -995,7 +995,7 @@ #ifndef PRODUCT -#if defined(SOLARIS) || defined(LINUX) +#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) #include #include #include --- old/src/share/vm/utilities/vmError.cpp Tue Sep 13 12:21:24 2011 +++ new/src/share/vm/utilities/vmError.cpp Tue Sep 13 12:21:24 2011 @@ -45,7 +45,7 @@ "JAVA_HOME", "JRE_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH", "JAVA_COMPILER", "PATH", "USERNAME", - // Env variables that are defined on Solaris/Linux + // Env variables that are defined on Solaris/Linux/BSD "LD_LIBRARY_PATH", "LD_PRELOAD", "SHELL", "DISPLAY", "HOSTTYPE", "OSTYPE", "ARCH", "MACHTYPE", @@ -52,6 +52,11 @@ // defined on Linux "LD_ASSUME_KERNEL", "_JAVA_SR_SIGNUM", + // defined on Darwin + "DYLD_LIBRARY_PATH", "DYLD_FALLBACK_LIBRARY_PATH", + "DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_FRAMEWORK_PATH", + "DYLD_INSERT_LIBRARIES", + // defined on Windows "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", @@ -958,7 +963,7 @@ const char* ptr = OnError; while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ out.print_raw ("# Executing "); -#if defined(LINUX) +#if defined(LINUX) || defined(_ALLBSD_SOURCE) out.print_raw ("/bin/sh -c "); #elif defined(SOLARIS) out.print_raw ("/usr/bin/sh -c "); --- old/test/Makefile Tue Sep 13 12:21:25 2011 +++ new/test/Makefile Tue Sep 13 12:21:25 2011 @@ -44,6 +44,22 @@ ARCH = i586 endif endif +ifeq ($(OSNAME), Darwin) + PLATFORM = bsd + SLASH_JAVA = /java + ARCH = $(shell uname -m) + ifeq ($(ARCH), i386) + ARCH = i586 + endif +endif +ifeq ($(findstring BSD,$(OSNAME)), BSD) + PLATFORM = bsd + SLASH_JAVA = /java + ARCH = $(shell uname -m) + ifeq ($(ARCH), i386) + ARCH = i586 + endif +endif ifeq ($(OSNAME), Windows_NT) PLATFORM = windows SLASH_JAVA = J: --- old/test/jprt.config Tue Sep 13 12:21:26 2011 +++ new/test/jprt.config Tue Sep 13 12:21:26 2011 @@ -75,8 +75,8 @@ # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. osname=`uname -s` -if [ "${osname}" = SunOS ] ; then - +case "${osname}" in + SunOS ) # SOLARIS: Sparc or X86 osarch=`uname -p` if [ "${osarch}" = sparc ] ; then @@ -100,9 +100,9 @@ # File creation mask umask 002 + ;; -elif [ "${osname}" = Linux ] ; then - + Linux | Darwin ) # Add basic paths path4sdk=/usr/bin:/bin:/usr/sbin:/sbin @@ -111,9 +111,31 @@ fileMustExist "${make}" make umask 002 + ;; -else + FreeBSD | OpenBSD ) + # Add basic paths + path4sdk=/usr/bin:/bin:/usr/sbin:/sbin + # Find GNU make + make=/usr/local/bin/gmake + fileMustExist "${make}" make + + umask 002 + ;; + + NetBSD ) + # Add basic paths + path4sdk=/usr/bin:/bin:/usr/sbin:/sbin + + # Find GNU make + make=/usr/pkg/bin/gmake + fileMustExist "${make}" make + + umask 002 + ;; + + * ) # Windows: Differs on CYGWIN vs. MKS. # We need to determine if we are running a CYGWIN shell or an MKS shell @@ -154,9 +176,9 @@ if [ "${unix_toolset}" = CYGWIN ] ; then path4sdk="`/usr/bin/cygpath -p ${path4sdk}`" fi + ;; +esac -fi - # Export PATH setting PATH="${path4sdk}" export PATH --- old/test/runtime/6929067/Test6929067.sh Tue Sep 13 12:21:27 2011 +++ new/test/runtime/6929067/Test6929067.sh Tue Sep 13 12:21:27 2011 @@ -29,7 +29,7 @@ PS=":" FS="/" ;; - SunOS | Windows_* ) + SunOS | Windows_* | *BSD) NULL=NUL PS=";" FS="\\"