changeset 5981:d982b0f5b59a

Merge from main OpenJDK repository
author Greg Lewis <glewis@eyesbeyond.com>
date Sun, 21 May 2017 11:12:48 -0700
parents 368df6a4b403 (diff) 12b2ef172230 (current diff)
children 72453885979f
files .hgtags make/Makefile make/bsd/Makefile make/defs.make make/linux/makefiles/defs.make src/cpu/sparc/vm/globals_sparc.hpp src/cpu/x86/vm/c1_LIRAssembler_x86.cpp src/cpu/x86/vm/globals_x86.hpp src/cpu/x86/vm/stubGenerator_x86_32.cpp src/cpu/x86/vm/stubGenerator_x86_64.cpp src/cpu/zero/vm/globals_zero.hpp src/os/bsd/vm/os_bsd.cpp src/os/bsd/vm/os_bsd.hpp src/os/linux/vm/os_linux.cpp src/os/posix/launcher/java_md.c src/os/posix/vm/os_posix.cpp src/os_cpu/bsd_zero/vm/os_bsd_zero.hpp src/share/vm/c1/c1_globals.hpp src/share/vm/classfile/classLoader.cpp src/share/vm/classfile/javaClasses.cpp src/share/vm/code/relocInfo.hpp src/share/vm/compiler/disassembler.hpp src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp src/share/vm/gc_implementation/g1/ptrQueue.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/genMarkSweep.cpp src/share/vm/memory/resourceArea.hpp src/share/vm/memory/universe.cpp src/share/vm/oops/constantPoolKlass.cpp src/share/vm/oops/constantPoolOop.cpp src/share/vm/oops/instanceKlass.cpp src/share/vm/opto/c2_globals.hpp src/share/vm/prims/forte.cpp 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/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/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/thread.cpp src/share/vm/runtime/thread.hpp src/share/vm/runtime/threadLocalStorage.hpp src/share/vm/runtime/virtualspace.cpp src/share/vm/runtime/vmStructs.cpp src/share/vm/runtime/vmThread.cpp src/share/vm/runtime/vm_operations.cpp src/share/vm/runtime/vm_version.cpp src/share/vm/utilities/debug.cpp src/share/vm/utilities/elfFile.hpp src/share/vm/utilities/exceptions.cpp src/share/vm/utilities/globalDefinitions.hpp src/share/vm/utilities/macros.hpp src/share/vm/utilities/ostream.cpp src/share/vm/utilities/taskqueue.cpp src/share/vm/utilities/taskqueue.hpp src/share/vm/utilities/vmError.cpp src/share/vm/utilities/workgroup.hpp
diffstat 34 files changed, 754 insertions(+), 321 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Feb 16 08:07:06 2017 +0100
+++ b/.hgtags	Sun May 21 11:12:48 2017 -0700
@@ -182,6 +182,7 @@
 38fa55e5e79232d48f1bb8cf27d88bc094c9375a hs21-b16
 81d815b05abb564aa1f4100ae13491c949b9a07e jdk7-b147
 81d815b05abb564aa1f4100ae13491c949b9a07e hs21-b17
+f1a18ada5853af49fce54d43dd5a5b67dc291470 7u0
 9b0ca45cd756d538c4c30afab280a91868eee1a5 jdk7u2-b01
 0cc8a70952c368e06de2adab1f2649a408f5e577 jdk8-b01
 31e253c1da429124bb87570ab095d9bc89850d0a jdk8-b02
--- a/agent/src/os/bsd/ps_proc.c	Thu Feb 16 08:07:06 2017 +0100
+++ b/agent/src/os/bsd/ps_proc.c	Sun May 21 11:12:48 2017 -0700
@@ -131,7 +131,7 @@
 
 static bool ptrace_continue(pid_t pid, int signal) {
   // pass the signal to the process so we don't swallow it
-  if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
+  if (ptrace(PT_CONTINUE, pid, NULL, signal) < 0) {
     print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
     return false;
   }
--- a/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java	Thu Feb 16 08:07:06 2017 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java	Sun May 21 11:12:48 2017 -0700
@@ -33,6 +33,7 @@
 import sun.jvm.hotspot.debugger.remote.*;
 import sun.jvm.hotspot.debugger.windbg.*;
 import sun.jvm.hotspot.debugger.linux.*;
+import sun.jvm.hotspot.debugger.bsd.*;
 import sun.jvm.hotspot.memory.*;
 import sun.jvm.hotspot.oops.*;
 import sun.jvm.hotspot.runtime.*;
--- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java	Thu Feb 16 08:07:06 2017 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java	Sun May 21 11:12:48 2017 -0700
@@ -35,6 +35,7 @@
 import sun.jvm.hotspot.debugger.windbg.*;
 import sun.jvm.hotspot.debugger.linux.*;
 import sun.jvm.hotspot.debugger.sparc.*;
+import sun.jvm.hotspot.debugger.bsd.*;
 import sun.jvm.hotspot.debugger.remote.*;
 import sun.jvm.hotspot.livejvm.*;
 import sun.jvm.hotspot.memory.*;
--- a/make/bsd/Makefile	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/Makefile	Sun May 21 11:12:48 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -211,6 +211,8 @@
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) LIBRARY_SUFFIX=$(LIBRARY_SUFFIX)
 BUILDTREE_VARS   += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 
+BUILDTREE_VARS   += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE)
+
 BUILDTREE         = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)
 
 #-------------------------------------------------------------------------------
@@ -349,9 +351,11 @@
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
+# We specify 'BUILD_FLAVOR=product' so that the proper
+# ENABLE_FULL_DEBUG_SYMBOLS value is used.
 docs: checks
 	$(QUIETLY) mkdir -p $(SUBDIR_DOCS)
-	$(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) jvmtidocs
+	$(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs
 
 # Synonyms for win32-like targets.
 compiler2:  jvmg product
--- a/make/bsd/makefiles/build_vm_def.sh	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/build_vm_def.sh	Sun May 21 11:12:48 2017 -0700
@@ -1,12 +1,28 @@
 #!/bin/sh
 
 # If we're cross compiling use that path for nm
-if [ "$CROSS_COMPILE_ARCH" != "" ]; then 
-NM=$ALT_COMPILER_PATH/nm
+if [ "$CROSS_COMPILE_ARCH" != "" ]; then
+    NM=$ALT_COMPILER_PATH/nm
 else
-NM=nm
+    NM=nm
 fi
 
-$NM -Uj $* | awk '
-   { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 }
-   '
+case "$(uname -s)" in
+Darwin )
+    $NM -Uj $@ | awk '{
+        if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3
+    }' ;;
+OpenBSD )
+    $NM $@ | awk '{
+        if ($2 == "U") next
+        if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";"
+        if ($3 ~ /^UseSharedSpaces$/) print "\t" $3 ";"
+        if ($3 ~ /^_ZN9Arguments17SharedArchivePathE$/) print "\t" $3 ";"
+    }' | sort -u ;;
+* )
+    $NM --defined-only $@ | awk '{
+        if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";"
+        if ($3 ~ /^UseSharedSpaces$/) print "\t" $3 ";"
+        if ($3 ~ /^_ZN9Arguments17SharedArchivePathE$/) print "\t" $3 ";"
+    }' | sort -u ;;
+esac
--- a/make/bsd/makefiles/buildtree.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/buildtree.make	Sun May 21 11:12:48 2017 -0700
@@ -255,6 +255,16 @@
 	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	[ -n "$(CFLAGS_BROWSE)" ] && \
 	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
+	[ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \
+	    echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \
+	[ -n "$(OBJCOPY)" ] && \
+	    echo && echo "OBJCOPY = $(OBJCOPY)"; \
+	[ -n "$(STRIP_POLICY)" ] && \
+	    echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \
+	[ -n "$(ZIP_DEBUGINFO_FILES)" ] && \
+	    echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \
+	[ -n "$(ZIPEXE)" ] && \
+	    echo && echo "ZIPEXE = $(ZIPEXE)"; \
 	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
 	    echo && \
 	    echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \
@@ -384,7 +394,7 @@
 	$(QUIETLY) ( \
 	$(BUILDTREE_COMMENT); \
 	echo "JDK=${JAVA_HOME}"; \
-	) > $@	   
+	) > $@
 
 .dbxrc:  $(BUILDTREE_MAKE)
 	@echo Creating $@ ...
--- a/make/bsd/makefiles/gcc.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/gcc.make	Sun May 21 11:12:48 2017 -0700
@@ -117,7 +117,10 @@
 CFLAGS += -fno-rtti
 CFLAGS += -fno-exceptions
 CFLAGS += -pthread
-CFLAGS += -fcheck-new
+# Clang does not support -fcheck-new
+ifeq (,$(findstring clang,$(shell $(CC) -v 2>&1)))
+  CFLAGS += -fcheck-new
+endif
 # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
 # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
@@ -215,7 +218,11 @@
 
 # Flags for generating make dependency flags.
 ifneq ("${CC_VER_MAJOR}", "2")
-DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
+DEPFLAGS =
+ifeq (,$(findstring clang,$(shell $(CC) -v 2>&1)))
+DEPFLAGS += -fpch-deps
+endif
+DEPFLAGS += -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
 endif
 
 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
--- a/make/bsd/makefiles/jsig.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/jsig.make	Sun May 21 11:12:48 2017 -0700
@@ -36,9 +36,16 @@
   LIBJSIG_G = lib$(JSIG_G).so
 endif
 
+LIBJSIG_DEBUGINFO   = lib$(JSIG).debuginfo
+LIBJSIG_DIZ         = lib$(JSIG).diz
+LIBJSIG_G_DEBUGINFO = lib$(JSIG_G).debuginfo
+LIBJSIG_G_DIZ       = lib$(JSIG_G).diz
+
 JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
 
 DEST_JSIG  = $(JDK_LIBDIR)/$(LIBJSIG)
+DEST_JSIG_DEBUGINFO = $(JDK_LIBDIR)/$(LIBJSIG_DEBUGINFO)
+DEST_JSIG_DIZ       = $(JDK_LIBDIR)/$(LIBJSIG_DIZ)
 
 LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig
 
@@ -57,11 +64,33 @@
 $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
-                         $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
+			$(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
 	$(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
+  ifeq ($(STRIP_POLICY),all_strip)
+	$(QUIETLY) $(STRIP) $@
+  else
+    ifeq ($(STRIP_POLICY),min_strip)
+	$(QUIETLY) $(STRIP) -S $@
+    # implied else here is no stripping at all
+    endif
+  endif
+	[ -f $(LIBJSIG_G_DEBUGINFO) ] || { ln -s $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO); }
+  ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	$(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO)
+	$(RM) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO)
+	[ -f $(LIBJSIG_G_DIZ) ] || { ln -s $(LIBJSIG_DIZ) $(LIBJSIG_G_DIZ); }
+  endif
+endif
 
 install_jsig: $(LIBJSIG)
 	@echo "Copying $(LIBJSIG) to $(DEST_JSIG)"
+	$(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \
+	    cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO)
+	$(QUIETLY) test -f $(LIBJSIG_DIZ) && \
+	    cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ)
 	$(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done"
 
 .PHONY: install_jsig
--- a/make/bsd/makefiles/launcher.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/launcher.make	Sun May 21 11:12:48 2017 -0700
@@ -50,7 +50,7 @@
   LIBS_LAUNCHER             += $(STATIC_STDCXX) $(LIBS)
 else
   LAUNCHER.o                 = launcher.o
-  LFLAGS_LAUNCHER           += -L`pwd` 
+  LFLAGS_LAUNCHER           += -L`pwd`
 
   # The gamma launcher runs the JDK from $JAVA_HOME, overriding the JVM with a
   # freshly built JVM at ./libjvm.{so|dylib}.  This is accomplished by setting 
--- a/make/bsd/makefiles/mapfile-vers-product	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/mapfile-vers-product	Sun May 21 11:12:48 2017 -0700
@@ -19,237 +19,248 @@
 # 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.
-#
+#  
 #
-# Only used for OSX/Darwin builds
 
 # Define public interface.
-                # _JNI
-                _JNI_CreateJavaVM
-                _JNI_GetCreatedJavaVMs
-                _JNI_GetDefaultJavaVMInitArgs
+
+SUNWprivate_1.1 {
+        global:
+                # JNI
+                JNI_CreateJavaVM;
+                JNI_GetCreatedJavaVMs;
+                JNI_GetDefaultJavaVMInitArgs;
 
-                # _JVM
-                _JVM_Accept
-                _JVM_ActiveProcessorCount
-                _JVM_AllocateNewArray
-                _JVM_AllocateNewObject
-                _JVM_ArrayCopy
-                _JVM_AssertionStatusDirectives
-                _JVM_Available
-                _JVM_Bind
-                _JVM_ClassDepth
-                _JVM_ClassLoaderDepth
-                _JVM_Clone
-                _JVM_Close
-                _JVM_CX8Field
-                _JVM_CompileClass
-                _JVM_CompileClasses
-                _JVM_CompilerCommand
-                _JVM_Connect
-                _JVM_ConstantPoolGetClassAt
-                _JVM_ConstantPoolGetClassAtIfLoaded
-                _JVM_ConstantPoolGetDoubleAt
-                _JVM_ConstantPoolGetFieldAt
-                _JVM_ConstantPoolGetFieldAtIfLoaded
-                _JVM_ConstantPoolGetFloatAt
-                _JVM_ConstantPoolGetIntAt
-                _JVM_ConstantPoolGetLongAt
-                _JVM_ConstantPoolGetMethodAt
-                _JVM_ConstantPoolGetMethodAtIfLoaded
-                _JVM_ConstantPoolGetMemberRefInfoAt
-                _JVM_ConstantPoolGetSize
-                _JVM_ConstantPoolGetStringAt
-                _JVM_ConstantPoolGetUTF8At
-                _JVM_CountStackFrames
-                _JVM_CurrentClassLoader
-                _JVM_CurrentLoadedClass
-                _JVM_CurrentThread
-                _JVM_CurrentTimeMillis
-                _JVM_DefineClass
-                _JVM_DefineClassWithSource
-                _JVM_DefineClassWithSourceCond
-                _JVM_DesiredAssertionStatus
-                _JVM_DisableCompiler
-                _JVM_DoPrivileged
-                _JVM_DTraceGetVersion
-                _JVM_DTraceActivate
-                _JVM_DTraceIsProbeEnabled
-                _JVM_DTraceIsSupported
-                _JVM_DTraceDispose
-                _JVM_DumpAllStacks
-                _JVM_DumpThreads
-                _JVM_EnableCompiler
-                _JVM_Exit
-                _JVM_FillInStackTrace
-                _JVM_FindClassFromCaller
-                _JVM_FindClassFromClass
-                _JVM_FindClassFromClassLoader
-                _JVM_FindClassFromBootLoader
-                _JVM_FindLibraryEntry
-                _JVM_FindLoadedClass
-                _JVM_FindPrimitiveClass
-                _JVM_FindSignal
-                _JVM_FreeMemory
-                _JVM_GC
-                _JVM_GetAllThreads
-                _JVM_GetArrayElement
-                _JVM_GetArrayLength
-                _JVM_GetCPClassNameUTF
-                _JVM_GetCPFieldClassNameUTF
-                _JVM_GetCPFieldModifiers
-                _JVM_GetCPFieldNameUTF
-                _JVM_GetCPFieldSignatureUTF
-                _JVM_GetCPMethodClassNameUTF
-                _JVM_GetCPMethodModifiers
-                _JVM_GetCPMethodNameUTF
-                _JVM_GetCPMethodSignatureUTF
-                _JVM_GetCallerClass
-                _JVM_GetClassAccessFlags
-                _JVM_GetClassAnnotations
-                _JVM_GetClassCPEntriesCount
-                _JVM_GetClassCPTypes
-                _JVM_GetClassConstantPool
-                _JVM_GetClassContext
-                _JVM_GetClassDeclaredConstructors
-                _JVM_GetClassDeclaredFields
-                _JVM_GetClassDeclaredMethods
-                _JVM_GetClassFieldsCount
-                _JVM_GetClassInterfaces
-                _JVM_GetClassLoader
-                _JVM_GetClassMethodsCount
-                _JVM_GetClassModifiers
-                _JVM_GetClassName
-                _JVM_GetClassNameUTF
-                _JVM_GetClassSignature
-                _JVM_GetClassSigners
-                _JVM_GetComponentType
-                _JVM_GetDeclaredClasses
-                _JVM_GetDeclaringClass
-                _JVM_GetEnclosingMethodInfo
-                _JVM_GetFieldAnnotations
-                _JVM_GetFieldIxModifiers
-                _JVM_GetHostName
-                _JVM_GetInheritedAccessControlContext
-                _JVM_GetInterfaceVersion
-                _JVM_GetLastErrorString
-                _JVM_GetManagement
-                _JVM_GetMethodAnnotations
-                _JVM_GetMethodDefaultAnnotationValue
-                _JVM_GetMethodIxArgsSize
-                _JVM_GetMethodIxByteCode
-                _JVM_GetMethodIxByteCodeLength
-                _JVM_GetMethodIxExceptionIndexes
-                _JVM_GetMethodIxExceptionTableEntry
-                _JVM_GetMethodIxExceptionTableLength
-                _JVM_GetMethodIxExceptionsCount
-                _JVM_GetMethodIxLocalsCount
-                _JVM_GetMethodIxMaxStack
-                _JVM_GetMethodIxModifiers
-                _JVM_GetMethodIxNameUTF
-                _JVM_GetMethodIxSignatureUTF
-                _JVM_GetMethodParameterAnnotations
-                _JVM_GetPrimitiveArrayElement
-                _JVM_GetProtectionDomain
-                _JVM_GetSockName
-                _JVM_GetSockOpt
-                _JVM_GetStackAccessControlContext
-                _JVM_GetStackTraceDepth
-                _JVM_GetStackTraceElement
-                _JVM_GetSystemPackage
-                _JVM_GetSystemPackages
-                _JVM_GetTemporaryDirectory
-                _JVM_GetThreadStateNames
-                _JVM_GetThreadStateValues
-                _JVM_GetVersionInfo
-                _JVM_Halt
-                _JVM_HoldsLock
-                _JVM_IHashCode
-                _JVM_InitAgentProperties
-                _JVM_InitProperties
-                _JVM_InitializeCompiler
-                _JVM_InitializeSocketLibrary
-                _JVM_InternString
-                _JVM_Interrupt
-                _JVM_InvokeMethod
-                _JVM_IsArrayClass
-                _JVM_IsConstructorIx
-                _JVM_IsInterface
-                _JVM_IsInterrupted
-                _JVM_IsNaN
-                _JVM_IsPrimitiveClass
-                _JVM_IsSameClassPackage
-                _JVM_IsSilentCompiler
-                _JVM_IsSupportedJNIVersion
-                _JVM_IsThreadAlive
-                _JVM_LatestUserDefinedLoader
-                _JVM_Listen
-                _JVM_LoadClass0
-                _JVM_LoadLibrary
-                _JVM_Lseek
-                _JVM_MaxObjectInspectionAge
-                _JVM_MaxMemory
-                _JVM_MonitorNotify
-                _JVM_MonitorNotifyAll
-                _JVM_MonitorWait
-                _JVM_NanoTime
-                _JVM_NativePath
-                _JVM_NewArray
-                _JVM_NewInstanceFromConstructor
-                _JVM_NewMultiArray
-                _JVM_OnExit
-                _JVM_Open
-                _JVM_PrintStackTrace
-                _JVM_RaiseSignal
-                _JVM_RawMonitorCreate
-                _JVM_RawMonitorDestroy
-                _JVM_RawMonitorEnter
-                _JVM_RawMonitorExit
-                _JVM_Read
-                _JVM_Recv
-                _JVM_RecvFrom
-                _JVM_RegisterSignal
-                _JVM_ReleaseUTF
-                _JVM_ResolveClass
-                _JVM_ResumeThread
-                _JVM_Send
-                _JVM_SendTo
-                _JVM_SetArrayElement
-                _JVM_SetClassSigners
-                _JVM_SetLength
-                _JVM_SetNativeThreadName
-                _JVM_SetPrimitiveArrayElement
-                _JVM_SetProtectionDomain
-                _JVM_SetSockOpt
-                _JVM_SetThreadPriority
-                _JVM_Sleep
-                _JVM_Socket
-                _JVM_SocketAvailable
-                _JVM_SocketClose
-                _JVM_SocketShutdown
-                _JVM_StartThread
-                _JVM_StopThread
-                _JVM_SuspendThread
-                _JVM_SupportsCX8
-                _JVM_Sync
-                _JVM_Timeout
-                _JVM_TotalMemory
-                _JVM_TraceInstructions
-                _JVM_TraceMethodCalls
-                _JVM_UnloadLibrary
-                _JVM_Write
-                _JVM_Yield
-                _JVM_handle_bsd_signal
+                # JVM
+                JVM_Accept;
+                JVM_ActiveProcessorCount;
+                JVM_AllocateNewArray;
+                JVM_AllocateNewObject;
+                JVM_ArrayCopy;
+                JVM_AssertionStatusDirectives;
+                JVM_Available;
+                JVM_Bind;
+                JVM_ClassDepth;
+                JVM_ClassLoaderDepth;
+                JVM_Clone;
+                JVM_Close;
+                JVM_CX8Field;
+                JVM_CompileClass;
+                JVM_CompileClasses;
+                JVM_CompilerCommand;
+                JVM_Connect;
+                JVM_ConstantPoolGetClassAt;
+                JVM_ConstantPoolGetClassAtIfLoaded;
+                JVM_ConstantPoolGetDoubleAt;
+                JVM_ConstantPoolGetFieldAt;
+                JVM_ConstantPoolGetFieldAtIfLoaded;
+                JVM_ConstantPoolGetFloatAt;
+                JVM_ConstantPoolGetIntAt;
+                JVM_ConstantPoolGetLongAt;
+                JVM_ConstantPoolGetMethodAt;
+                JVM_ConstantPoolGetMethodAtIfLoaded;
+                JVM_ConstantPoolGetMemberRefInfoAt;
+                JVM_ConstantPoolGetSize;
+                JVM_ConstantPoolGetStringAt;
+                JVM_ConstantPoolGetUTF8At;
+                JVM_CountStackFrames;
+                JVM_CurrentClassLoader;
+                JVM_CurrentLoadedClass;
+                JVM_CurrentThread;
+                JVM_CurrentTimeMillis;
+                JVM_DefineClass;
+                JVM_DefineClassWithSource;
+                JVM_DefineClassWithSourceCond;
+                JVM_DesiredAssertionStatus;
+                JVM_DisableCompiler;
+                JVM_DoPrivileged;
+                JVM_DTraceGetVersion;
+                JVM_DTraceActivate;
+                JVM_DTraceIsProbeEnabled;
+                JVM_DTraceIsSupported;
+                JVM_DTraceDispose;
+                JVM_DumpAllStacks;
+                JVM_DumpThreads;
+                JVM_EnableCompiler;
+                JVM_Exit;
+                JVM_FillInStackTrace;
+                JVM_FindClassFromCaller;
+                JVM_FindClassFromClass;
+                JVM_FindClassFromClassLoader;
+                JVM_FindClassFromBootLoader;
+                JVM_FindLibraryEntry;
+                JVM_FindLoadedClass;
+                JVM_FindPrimitiveClass;
+                JVM_FindSignal;
+                JVM_FreeMemory;
+                JVM_GC;
+                JVM_GetAllThreads;
+                JVM_GetArrayElement;
+                JVM_GetArrayLength;
+                JVM_GetCPClassNameUTF;
+                JVM_GetCPFieldClassNameUTF;
+                JVM_GetCPFieldModifiers;
+                JVM_GetCPFieldNameUTF;
+                JVM_GetCPFieldSignatureUTF;
+                JVM_GetCPMethodClassNameUTF;
+                JVM_GetCPMethodModifiers;
+                JVM_GetCPMethodNameUTF;
+                JVM_GetCPMethodSignatureUTF;
+                JVM_GetCallerClass;
+                JVM_GetClassAccessFlags;
+                JVM_GetClassAnnotations;
+                JVM_GetClassCPEntriesCount;
+                JVM_GetClassCPTypes;
+                JVM_GetClassConstantPool;
+                JVM_GetClassContext;
+                JVM_GetClassDeclaredConstructors;
+                JVM_GetClassDeclaredFields;
+                JVM_GetClassDeclaredMethods;
+                JVM_GetClassFieldsCount;
+                JVM_GetClassInterfaces;
+                JVM_GetClassLoader;
+                JVM_GetClassMethodsCount;
+                JVM_GetClassModifiers;
+                JVM_GetClassName;
+                JVM_GetClassNameUTF;
+                JVM_GetClassSignature;
+                JVM_GetClassSigners;
+                JVM_GetComponentType;
+                JVM_GetDeclaredClasses;
+                JVM_GetDeclaringClass;
+                JVM_GetEnclosingMethodInfo;
+                JVM_GetFieldAnnotations;
+                JVM_GetFieldIxModifiers;
+                JVM_GetHostName;
+                JVM_GetInheritedAccessControlContext;
+                JVM_GetInterfaceVersion;
+                JVM_GetLastErrorString;
+                JVM_GetManagement;
+                JVM_GetMethodAnnotations;
+                JVM_GetMethodDefaultAnnotationValue;
+                JVM_GetMethodIxArgsSize;
+                JVM_GetMethodIxByteCode;
+                JVM_GetMethodIxByteCodeLength;
+                JVM_GetMethodIxExceptionIndexes;
+                JVM_GetMethodIxExceptionTableEntry;
+                JVM_GetMethodIxExceptionTableLength;
+                JVM_GetMethodIxExceptionsCount;
+                JVM_GetMethodIxLocalsCount;
+                JVM_GetMethodIxMaxStack;
+                JVM_GetMethodIxModifiers;
+                JVM_GetMethodIxNameUTF;
+                JVM_GetMethodIxSignatureUTF;
+                JVM_GetMethodParameterAnnotations;
+                JVM_GetPrimitiveArrayElement;
+                JVM_GetProtectionDomain;
+                JVM_GetSockName;
+                JVM_GetSockOpt;
+                JVM_GetStackAccessControlContext;
+                JVM_GetStackTraceDepth;
+                JVM_GetStackTraceElement;
+                JVM_GetSystemPackage;
+                JVM_GetSystemPackages;
+                JVM_GetTemporaryDirectory;
+                JVM_GetThreadStateNames;
+                JVM_GetThreadStateValues;
+                JVM_GetVersionInfo;
+                JVM_Halt;
+                JVM_HoldsLock;
+                JVM_IHashCode;
+                JVM_InitAgentProperties;
+                JVM_InitProperties;
+                JVM_InitializeCompiler;
+                JVM_InitializeSocketLibrary;
+                JVM_InternString;
+                JVM_Interrupt;
+                JVM_InvokeMethod;
+                JVM_IsArrayClass;
+                JVM_IsConstructorIx;
+                JVM_IsInterface;
+                JVM_IsInterrupted;
+                JVM_IsNaN;
+                JVM_IsPrimitiveClass;
+                JVM_IsSameClassPackage;
+                JVM_IsSilentCompiler;
+                JVM_IsSupportedJNIVersion;
+                JVM_IsThreadAlive;
+                JVM_LatestUserDefinedLoader;
+                JVM_Listen;
+                JVM_LoadClass0;
+                JVM_LoadLibrary;
+                JVM_Lseek;
+                JVM_MaxObjectInspectionAge;
+                JVM_MaxMemory;
+                JVM_MonitorNotify;
+                JVM_MonitorNotifyAll;
+                JVM_MonitorWait;
+                JVM_NanoTime;
+                JVM_NativePath;
+                JVM_NewArray;
+                JVM_NewInstanceFromConstructor;
+                JVM_NewMultiArray;
+                JVM_OnExit;
+                JVM_Open;
+                JVM_PrintStackTrace;
+                JVM_RaiseSignal;
+                JVM_RawMonitorCreate;
+                JVM_RawMonitorDestroy;
+                JVM_RawMonitorEnter;
+                JVM_RawMonitorExit;
+                JVM_Read;
+                JVM_Recv;
+                JVM_RecvFrom;
+                JVM_RegisterSignal;
+                JVM_ReleaseUTF;
+                JVM_ResolveClass;
+                JVM_ResumeThread;
+                JVM_Send;
+                JVM_SendTo;
+                JVM_SetArrayElement;
+                JVM_SetClassSigners;
+                JVM_SetLength;
+                JVM_SetNativeThreadName;
+                JVM_SetPrimitiveArrayElement;
+                JVM_SetProtectionDomain;
+                JVM_SetSockOpt;
+                JVM_SetThreadPriority;
+                JVM_Sleep;
+                JVM_Socket;
+                JVM_SocketAvailable;
+                JVM_SocketClose;
+                JVM_SocketShutdown;
+                JVM_StartThread;
+                JVM_StopThread;
+                JVM_SuspendThread;
+                JVM_SupportsCX8;
+                JVM_Sync;
+                JVM_Timeout;
+                JVM_TotalMemory;
+                JVM_TraceInstructions;
+                JVM_TraceMethodCalls;
+                JVM_UnloadLibrary;
+                JVM_Write;
+                JVM_Yield;
+                JVM_handle_bsd_signal;
 
                 # miscellaneous functions
-                _jio_fprintf
-                _jio_printf
-                _jio_snprintf
-                _jio_vfprintf
-                _jio_vsnprintf
+                jio_fprintf;
+                jio_printf;
+                jio_snprintf;
+                jio_vfprintf;
+                jio_vsnprintf;
+                fork1;
+                numa_warn;
+                numa_error;
+
+                # Needed because there is no JVM interface for this.
+                sysThreadAvailableStackWithSlack;
 
                 # This is for Forte Analyzer profiling support.
-                _AsyncGetCallTrace
+                AsyncGetCallTrace;
+
+		# INSERT VTABLE SYMBOLS HERE
 
-                # INSERT VTABLE SYMBOLS HERE
-
+        local:
+                *;
+};
--- a/make/bsd/makefiles/ppc.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/ppc.make	Sun May 21 11:12:48 2017 -0700
@@ -28,3 +28,6 @@
 # Must also specify if CPU is big endian
 CFLAGS += -DVM_BIG_ENDIAN
 
+ifdef E500V2
+ASFLAGS += -Wa,-mspe -Wa,--defsym -Wa,E500V2=1 
+endif
--- a/make/bsd/makefiles/saproc.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/bsd/makefiles/saproc.make	Sun May 21 11:12:48 2017 -0700
@@ -36,6 +36,11 @@
   LIBSAPROC_G = lib$(SAPROC_G).so
 endif
 
+LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
+LIBSAPROC_DIZ         = lib$(SAPROC).diz
+LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo
+LIBSAPROC_G_DIZ       = lib$(SAPROC_G).diz
+
 AGENT_DIR = $(GAMMADIR)/agent
 
 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
@@ -66,7 +71,9 @@
 
 SAMAPFILE = $(SASRCDIR)/mapfile
 
-DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
+DEST_SAPROC           = $(JDK_LIBDIR)/$(LIBSAPROC)
+DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
+DEST_SAPROC_DIZ       = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
 
 # DEBUG_BINARIES overrides everything, use full -g debug information
 ifeq ($(DEBUG_BINARIES), true)
@@ -114,10 +121,32 @@
 	           -o $@                                                \
 	           $(SALIBS)
 	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
+  ifeq ($(STRIP_POLICY),all_strip)
+	$(QUIETLY) $(STRIP) $@
+  else
+    ifeq ($(STRIP_POLICY),min_strip)
+	$(QUIETLY) $(STRIP) -S $@
+    # implied else here is no stripping at all
+    endif
+  endif
+	[ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }
+  ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
+	$(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
+	[ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); }
+  endif
+endif
 
 install_saproc: $(BUILDLIBSAPROC)
 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
 	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
+	  test -f $(LIBSAPROC_DEBUGINFO) &&                  \
+	    cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
+	  test -f $(LIBSAPROC_DIZ) &&                  \
+	    cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \
 	  cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
 	fi
 
--- a/make/solaris/makefiles/defs.make	Thu Feb 16 08:07:06 2017 +0100
+++ b/make/solaris/makefiles/defs.make	Sun May 21 11:12:48 2017 -0700
@@ -221,8 +221,8 @@
 endif
 ifeq ($(JVM_VARIANT_CLIENT),true)
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
-  EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) 
-  EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX) 
+  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)
   ifeq ($(ARCH_DATA_MODEL),32)
     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
--- a/src/cpu/sparc/vm/globals_sparc.hpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/cpu/sparc/vm/globals_sparc.hpp	Sun May 21 11:12:48 2017 -0700
@@ -71,7 +71,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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/os/bsd/vm/decoder_bsd.cpp	Sun May 21 11:12:48 2017 -0700
@@ -0,0 +1,46 @@
+/*
+ * 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_elf.hpp"
+
+#include <cxxabi.h>
+
+bool ElfDecoder::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/os_bsd.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os/bsd/vm/os_bsd.cpp	Sun May 21 11:12:48 2017 -0700
@@ -163,6 +163,7 @@
 #endif
 pthread_t os::Bsd::_main_thread;
 int os::Bsd::_page_size = -1;
+pthread_condattr_t os::Bsd::_condattr[1];
 #ifndef _ALLBSD_SOURCE
 bool os::Bsd::_is_floating_stack = false;
 bool os::Bsd::_is_NPTL = false;
@@ -187,6 +188,8 @@
 static int SR_signum = SIGUSR2;
 sigset_t SR_sigset;
 
+// Declarations
+static void unpackTime(timespec* absTime, bool isAbsolute, jlong time);
 
 ////////////////////////////////////////////////////////////////////////////////
 // utility functions
@@ -355,7 +358,13 @@
    * since it returns a 64 bit value)
    */
   mib[0] = CTL_HW;
+#ifdef HW_MEMSIZE
   mib[1] = HW_MEMSIZE;
+#elif defined (HW_USERMEM64)
+  mib[1] = HW_USERMEM64;
+#else
+  mib[1] = HW_USERMEM;
+#endif
   len = sizeof(mem_val);
   if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1) {
        assert(len == sizeof(mem_val), "unexpected data size");
@@ -1625,7 +1634,10 @@
       ::clock_gettime(CLOCK_MONOTONIC, &tp)  == 0) {
     // yes, monotonic clock is supported
     _clock_gettime = ::clock_gettime;
-  }
+    return;
+  }
+  warning("No monotonic clock was available - timed services may " \
+          "be adversely affected if the time-of-day clock changes");
 }
 #else
 void os::Bsd::clock_init() {
@@ -1711,7 +1723,7 @@
 jlong os::javaTimeNanos() {
   if (Bsd::supports_monotonic_clock()) {
     struct timespec tp;
-    int status = Bsd::clock_gettime(CLOCK_MONOTONIC, &tp);
+    int status = ::clock_gettime(CLOCK_MONOTONIC, &tp);
     assert(status == 0, "gettime error");
     jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec);
     return result;
@@ -1848,9 +1860,15 @@
   return n;
 }
 
+#ifdef __NetBSD__
+#include <lwp.h>
+#endif
+
 intx os::current_thread_id() {
 #ifdef __APPLE__
   return (intx)::pthread_mach_thread_np(::pthread_self());
+#elif defined(__NetBSD__)
+  return (intx)_lwp_self();
 #else
   return (intx)::pthread_self();
 #endif
@@ -2401,14 +2419,14 @@
 }
 
 void os::print_os_info_brief(outputStream* st) {
-  st->print("Bsd");
+  st->print("BSD");
 
   os::Posix::print_uname_info(st);
 }
 
 void os::print_os_info(outputStream* st) {
   st->print("OS:");
-  st->print("Bsd");
+  st->print("BSD");
 
   os::Posix::print_uname_info(st);
 
@@ -2417,10 +2435,6 @@
   os::Posix::print_load_average(st);
 }
 
-void os::pd_print_cpu_info(outputStream* st) {
-  // Nothing to do for now.
-}
-
 void os::print_memory_info(outputStream* st) {
 
   st->print("Memory:");
@@ -2437,6 +2451,7 @@
   st->print("(" UINT64_FORMAT "k free)",
             os::available_memory() >> 10);
 #ifndef _ALLBSD_SOURCE
+  // FIXME: Make this work for *BSD
   st->print(", swap " UINT64_FORMAT "k",
             ((jlong)si.totalswap * si.mem_unit) >> 10);
   st->print("(" UINT64_FORMAT "k free)",
@@ -2444,12 +2459,22 @@
 #endif
   st->cr();
 
+  // FIXME: Make this work for *BSD
   // meminfo
   st->print("\n/proc/meminfo:\n");
   _print_ascii_file("/proc/meminfo", st);
   st->cr();
 }
 
+void os::pd_print_cpu_info(outputStream* st) {
+  // FIXME: Make this work for *BSD
+  st->print("\n/proc/cpuinfo:\n");
+  if (!_print_ascii_file("/proc/cpuinfo", st)) {
+    st->print("  <Not Available>");
+  }
+  st->cr();
+}
+
 // Taken from /usr/include/bits/siginfo.h  Supposed to be architecture specific
 // but they're the same for all the bsd arch that we support
 // and they're the same for solaris but there's no common place to put this.
@@ -2596,6 +2621,25 @@
         assert(len < buflen, "Ran out of buffer space");
         jrelib_p = buf + len;
 
+#ifndef __APPLE__
+        snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
+        if (0 != access(buf, F_OK)) {
+          snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
+        }
+
+        if (0 == access(buf, F_OK)) {
+          // 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"!
+          len = strlen(buf);
+          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
+        } else {
+          // Go back to path of .so
+          rp = realpath(dli_fname, buf);
+          if (rp == NULL)
+            return;
+        }
+#else
         // Add the appropriate library subdir
         snprintf(jrelib_p, buflen-len, "/jre/lib");
         if (0 != access(buf, F_OK)) {
@@ -2625,6 +2669,7 @@
           if (rp == NULL)
             return;
         }
+#endif
       }
     }
   }
@@ -2728,10 +2773,14 @@
     bool timedwait(unsigned int sec, int nsec);
   private:
     jlong currenttime() const;
-    semaphore_t _semaphore;
+    os_semaphore_t _semaphore;
 };
 
+#if defined(__FreeBSD__) && __FreeBSD__ > 8
+Semaphore::Semaphore() : _semaphore() {
+#else
 Semaphore::Semaphore() : _semaphore(0) {
+#endif
   SEM_INIT(_semaphore, 0);
 }
 
@@ -2796,7 +2845,7 @@
 
 bool Semaphore::timedwait(unsigned int sec, int nsec) {
   struct timespec ts;
-  jlong endtime = unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
+  unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
 
   while (1) {
     int result = sem_timedwait(&_semaphore, &ts);
@@ -3017,7 +3066,11 @@
 }
 
 void os::pd_free_memory(char *addr, size_t bytes, size_t alignment_hint) {
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
+  commit_memory(addr, bytes, alignment_hint, false);
+#else
   ::madvise(addr, bytes, MADV_DONTNEED);
+#endif
 }
 
 void os::numa_make_global(char *addr, size_t bytes) {
@@ -3864,6 +3917,7 @@
   return OS_OK;
 #elif defined(__FreeBSD__)
   int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri);
+  return (ret == 0) ? OS_OK : OS_ERR;
 #elif defined(__APPLE__) || defined(__NetBSD__)
   struct sched_param sp;
   int policy;
@@ -4718,6 +4772,25 @@
   Bsd::clock_init();
   initial_time_count = os::elapsed_counter();
 
+  // pthread_condattr initialization for monotonic clock
+  int status;
+  pthread_condattr_t* _condattr = os::Bsd::condAttr();
+  if ((status = pthread_condattr_init(_condattr)) != 0) {
+    fatal(err_msg("pthread_condattr_init: %s", strerror(status)));
+  }
+  // Only set the clock if CLOCK_MONOTONIC is available
+  if (Bsd::supports_monotonic_clock()) {
+    if ((status = pthread_condattr_setclock(_condattr, CLOCK_MONOTONIC)) != 0) {
+      if (status == EINVAL) {
+        warning("Unable to use monotonic clock with relative timed-waits" \
+                " - changes to the time-of-day clock may have adverse affects");
+      } else {
+        fatal(err_msg("pthread_condattr_setclock: %s", strerror(status)));
+      }
+    }
+  }
+  // else it defaults to CLOCK_REALTIME
+
 #ifdef __APPLE__
   // XXXDARWIN
   // Work around the unaligned VM callbacks in hotspot's
@@ -5638,21 +5711,36 @@
 
 static struct timespec* compute_abstime(struct timespec* abstime, jlong millis) {
   if (millis < 0)  millis = 0;
-  struct timeval now;
-  int status = gettimeofday(&now, NULL);
-  assert(status == 0, "gettimeofday");
+
   jlong seconds = millis / 1000;
   millis %= 1000;
   if (seconds > 50000000) { // see man cond_timedwait(3T)
     seconds = 50000000;
   }
-  abstime->tv_sec = now.tv_sec  + seconds;
-  long       usec = now.tv_usec + millis * 1000;
-  if (usec >= 1000000) {
-    abstime->tv_sec += 1;
-    usec -= 1000000;
-  }
-  abstime->tv_nsec = usec * 1000;
+
+  if (os::Bsd::supports_monotonic_clock()) {
+    struct timespec now;
+    int status = ::clock_gettime(CLOCK_MONOTONIC, &now);
+    assert_status(status == 0, status, "clock_gettime");
+    abstime->tv_sec = now.tv_sec  + seconds;
+    long nanos = now.tv_nsec + millis * NANOSECS_PER_MILLISEC;
+    if (nanos >= NANOSECS_PER_SEC) {
+      abstime->tv_sec += 1;
+      nanos -= NANOSECS_PER_SEC;
+    }
+    abstime->tv_nsec = nanos;
+  } else {
+    struct timeval now;
+    int status = gettimeofday(&now, NULL);
+    assert(status == 0, "gettimeofday");
+    abstime->tv_sec = now.tv_sec  + seconds;
+    long usec = now.tv_usec + millis * 1000;
+    if (usec >= 1000000) {
+      abstime->tv_sec += 1;
+      usec -= 1000000;
+    }
+    abstime->tv_nsec = usec * 1000;
+  }
   return abstime;
 }
 
@@ -5744,7 +5832,7 @@
     status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &abst);
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
       pthread_cond_destroy (_cond);
-      pthread_cond_init (_cond, NULL) ;
+      pthread_cond_init (_cond, os::Bsd::condAttr()) ;
     }
     assert_status(status == 0 || status == EINTR ||
                   status == ETIMEDOUT,
@@ -5845,32 +5933,50 @@
 
 static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) {
   assert (time > 0, "convertTime");
-
-  struct timeval now;
-  int status = gettimeofday(&now, NULL);
-  assert(status == 0, "gettimeofday");
-
-  time_t max_secs = now.tv_sec + MAX_SECS;
-
-  if (isAbsolute) {
-    jlong secs = time / 1000;
-    if (secs > max_secs) {
-      absTime->tv_sec = max_secs;
+  time_t max_secs = 0;
+
+  if (!os::Bsd::supports_monotonic_clock() || isAbsolute) {
+    struct timeval now;
+    int status = gettimeofday(&now, NULL);
+    assert(status == 0, "gettimeofday");
+
+    max_secs = now.tv_sec + MAX_SECS;
+
+    if (isAbsolute) {
+      jlong secs = time / 1000;
+      if (secs > max_secs) {
+        absTime->tv_sec = max_secs;
+      } else {
+        absTime->tv_sec = secs;
+      }
+      absTime->tv_nsec = (time % 1000) * NANOSECS_PER_MILLISEC;
+    } else {
+      jlong secs = time / NANOSECS_PER_SEC;
+      if (secs >= MAX_SECS) {
+        absTime->tv_sec = max_secs;
+        absTime->tv_nsec = 0;
+      } else {
+        absTime->tv_sec = now.tv_sec + secs;
+        absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_usec*1000;
+        if (absTime->tv_nsec >= NANOSECS_PER_SEC) {
+          absTime->tv_nsec -= NANOSECS_PER_SEC;
+          ++absTime->tv_sec; // note: this must be <= max_secs
+        }
+      }
     }
-    else {
-      absTime->tv_sec = secs;
-    }
-    absTime->tv_nsec = (time % 1000) * NANOSECS_PER_MILLISEC;
-  }
-  else {
+  } else {
+    // must be relative using monotonic clock
+    struct timespec now;
+    int status = ::clock_gettime(CLOCK_MONOTONIC, &now);
+    assert_status(status == 0, status, "clock_gettime");
+    max_secs = now.tv_sec + MAX_SECS;
     jlong secs = time / NANOSECS_PER_SEC;
     if (secs >= MAX_SECS) {
       absTime->tv_sec = max_secs;
       absTime->tv_nsec = 0;
-    }
-    else {
+    } else {
       absTime->tv_sec = now.tv_sec + secs;
-      absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_usec*1000;
+      absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_nsec;
       if (absTime->tv_nsec >= NANOSECS_PER_SEC) {
         absTime->tv_nsec -= NANOSECS_PER_SEC;
         ++absTime->tv_sec; // note: this must be <= max_secs
@@ -5950,15 +6056,19 @@
   jt->set_suspend_equivalent();
   // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
 
+  assert(_cur_index == -1, "invariant");
   if (time == 0) {
-    status = pthread_cond_wait (_cond, _mutex) ;
+    _cur_index = REL_INDEX; // arbitrary choice when not timed
+    status = pthread_cond_wait (&_cond[_cur_index], _mutex) ;
   } else {
-    status = os::Bsd::safe_cond_timedwait (_cond, _mutex, &absTime) ;
+    _cur_index = isAbsolute ? ABS_INDEX : REL_INDEX;
+    status = os::Bsd::safe_cond_timedwait (&_cond[_cur_index], _mutex, &absTime) ;
     if (status != 0 && WorkAroundNPTLTimedWaitHang) {
-      pthread_cond_destroy (_cond) ;
-      pthread_cond_init    (_cond, NULL);
+      pthread_cond_destroy (&_cond[_cur_index]) ;
+      pthread_cond_init    (&_cond[_cur_index], isAbsolute ? NULL : os::Bsd::condAttr());
     }
   }
+  _cur_index = -1;
   assert_status(status == 0 || status == EINTR ||
                 status == ETIMEDOUT,
                 status, "cond_timedwait");
@@ -5987,17 +6097,26 @@
   s = _counter;
   _counter = 1;
   if (s < 1) {
-     if (WorkAroundNPTLTimedWaitHang) {
-        status = pthread_cond_signal (_cond) ;
-        assert (status == 0, "invariant") ;
+    // thread might be parked
+    if (_cur_index != -1) {
+      // thread is definitely parked
+      if (WorkAroundNPTLTimedWaitHang) {
+        status = pthread_cond_signal (&_cond[_cur_index]);
+        assert (status == 0, "invariant");
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant") ;
-     } else {
+        assert (status == 0, "invariant");
+      } else {
+        // must capture correct index before unlocking
+        int index = _cur_index;
         status = pthread_mutex_unlock(_mutex);
-        assert (status == 0, "invariant") ;
-        status = pthread_cond_signal (_cond) ;
-        assert (status == 0, "invariant") ;
-     }
+        assert (status == 0, "invariant");
+        status = pthread_cond_signal (&_cond[index]);
+        assert (status == 0, "invariant");
+      }
+    } else {
+      pthread_mutex_unlock(_mutex);
+      assert (status == 0, "invariant") ;
+    }
   } else {
     pthread_mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
--- a/src/os/bsd/vm/os_bsd.hpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os/bsd/vm/os_bsd.hpp	Sun May 21 11:12:48 2017 -0700
@@ -106,6 +106,12 @@
 
   static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
 
+  static void print_full_memory_info(outputStream* st);
+#ifndef _ALLBSD_SOURCE
+  static void print_distro_info(outputStream* st);
+  static void print_libversion_info(outputStream* st);
+#endif
+
  public:
 
   static void init_thread_fpu_state();
@@ -225,6 +231,13 @@
   static jlong fast_thread_cpu_time(clockid_t clockid);
 #endif
 
+  // pthread_cond clock suppport
+  private:
+  static pthread_condattr_t _condattr[1];
+
+  public:
+  static pthread_condattr_t* condAttr() { return _condattr; }
+
   // Stack repair handling
 
   // none present
@@ -290,7 +303,7 @@
   public:
     PlatformEvent() {
       int status;
-      status = pthread_cond_init (_cond, NULL);
+      status = pthread_cond_init (_cond, os::Bsd::condAttr());
       assert_status(status == 0, status, "cond_init");
       status = pthread_mutex_init (_mutex, NULL);
       assert_status(status == 0, status, "mutex_init");
@@ -305,14 +318,19 @@
     void park () ;
     void unpark () ;
     int  TryPark () ;
-    int  park (jlong millis) ;
+    int  park (jlong millis) ; // relative timed-wait only
     void SetAssociation (Thread * a) { _Assoc = a ; }
 };
 
 class PlatformParker : public CHeapObj<mtInternal> {
   protected:
+    enum {
+        REL_INDEX = 0,
+        ABS_INDEX = 1
+    };
+    int _cur_index;  // which cond is in use: -1, 0, 1
     pthread_mutex_t _mutex [1] ;
-    pthread_cond_t  _cond  [1] ;
+    pthread_cond_t  _cond  [2] ; // one for relative times and one for abs.
 
   public:       // TODO-FIXME: make dtor private
     ~PlatformParker() { guarantee (0, "invariant") ; }
@@ -320,10 +338,13 @@
   public:
     PlatformParker() {
       int status;
-      status = pthread_cond_init (_cond, NULL);
-      assert_status(status == 0, status, "cond_init");
+      status = pthread_cond_init (&_cond[REL_INDEX], os::Bsd::condAttr());
+      assert_status(status == 0, status, "cond_init rel");
+      status = pthread_cond_init (&_cond[ABS_INDEX], NULL);
+      assert_status(status == 0, status, "cond_init abs");
       status = pthread_mutex_init (_mutex, NULL);
       assert_status(status == 0, status, "mutex_init");
+      _cur_index = -1; // mark as unused
     }
 };
 
--- a/src/os/bsd/vm/os_bsd.inline.hpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os/bsd/vm/os_bsd.inline.hpp	Sun May 21 11:12:48 2017 -0700
@@ -31,10 +31,22 @@
 # 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
+#ifdef TARGET_OS_ARCH_bsd_arm
+# include "atomic_bsd_arm.inline.hpp"
+# include "orderAccess_bsd_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_ppc
+# include "atomic_bsd_ppc.inline.hpp"
+# include "orderAccess_bsd_ppc.inline.hpp"
+#endif
 
 // System includes
 
--- a/src/os/bsd/vm/thread_bsd.inline.hpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os/bsd/vm/thread_bsd.inline.hpp	Sun May 21 11:12:48 2017 -0700
@@ -34,11 +34,26 @@
 # 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
+#ifdef TARGET_OS_ARCH_bsd_arm
+# include "atomic_bsd_arm.inline.hpp"
+# include "orderAccess_bsd_arm.inline.hpp"
+# include "prefetch_bsd_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_ppc
+# include "atomic_bsd_ppc.inline.hpp"
+# include "orderAccess_bsd_ppc.inline.hpp"
+# include "prefetch_bsd_ppc.inline.hpp"
+#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/src/os/posix/vm/os_posix.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os/posix/vm/os_posix.cpp	Sun May 21 11:12:48 2017 -0700
@@ -183,11 +183,19 @@
   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
   else st->print("%d", rlim.rlim_cur);
 
+#ifdef __OpenBSD__
+  st->print(", DATA ");
+  getrlimit(RLIMIT_DATA, &rlim);
+  if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+  else st->print("%uk", rlim.rlim_cur >> 10);
+  st->cr();
+#else
   st->print(", AS ");
   getrlimit(RLIMIT_AS, &rlim);
   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
   else st->print("%uk", rlim.rlim_cur >> 10);
   st->cr();
+#endif
 }
 
 void os::Posix::print_uname_info(outputStream* st) {
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Sun May 21 11:12:48 2017 -0700
@@ -945,7 +945,7 @@
   if (rslt != 0)
     fatal(err_msg("pthread_stackseg_np failed with err = %d", rslt));
 
-  *bottom = (address)((char *)ss.ss_sp - ss.ss_size);
+  *bottom = (address)(align_size_up((intptr_t)ss.ss_sp, os::vm_page_size()) - ss.ss_size);
   *size   = ss.ss_size;
 #elif defined(_ALLBSD_SOURCE)
   pthread_attr_t attr;
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Sun May 21 11:12:48 2017 -0700
@@ -24,7 +24,7 @@
  */
 
 #if defined(_ALLBSD_SOURCE) && !defined(__APPLE__) && !defined(__NetBSD__)
-#include <pthread.h>
+# include <pthread.h>
 # include <pthread_np.h> /* For pthread_attr_get_np */
 #endif
 
--- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Sun May 21 11:12:48 2017 -0700
@@ -111,7 +111,7 @@
   if (e.should_commit()) {
     e.set_gcId(_shared_gc_info.id());
     e.set_data(to_trace_struct(pf_info));
-    e.set_thread(pf_info.thread()->thread_id());
+    e.set_thread((uint64_t) pf_info.thread()->thread_id());
     e.commit();
   }
 }
--- a/src/share/vm/runtime/atomic.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/runtime/atomic.cpp	Sun May 21 11:12:48 2017 -0700
@@ -57,6 +57,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
 #ifdef TARGET_OS_ARCH_linux_arm
 # include "atomic_linux_arm.inline.hpp"
 #endif
--- a/src/share/vm/runtime/objectMonitor.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/runtime/objectMonitor.cpp	Sun May 21 11:12:48 2017 -0700
@@ -1740,7 +1740,7 @@
      }
      iterator->_notified = 1 ;
      Thread * Self = THREAD;
-     iterator->_notifier_tid = Self->osthread()->thread_id();
+     iterator->_notifier_tid = (jlong) Self->osthread()->thread_id();
 
      ObjectWaiter * List = _EntryList ;
      if (List != NULL) {
@@ -1866,7 +1866,7 @@
      guarantee (iterator->_notified == 0, "invariant") ;
      iterator->_notified = 1 ;
      Thread * Self = THREAD;
-     iterator->_notifier_tid = Self->osthread()->thread_id();
+     iterator->_notifier_tid = (jlong) Self->osthread()->thread_id();
      if (Policy != 4) {
         iterator->TState = ObjectWaiter::TS_ENTER ;
      }
--- a/src/share/vm/runtime/os.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/runtime/os.cpp	Sun May 21 11:12:48 2017 -0700
@@ -403,13 +403,6 @@
     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) {
--- a/src/share/vm/runtime/os.hpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/runtime/os.hpp	Sun May 21 11:12:48 2017 -0700
@@ -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"
 # include <setjmp.h>
@@ -763,8 +766,8 @@
 # include "os_posix.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
+# include "os_bsd.hpp"
 # include "os_posix.hpp"
-# include "os_bsd.hpp"
 #endif
 #ifdef TARGET_OS_ARCH_linux_x86
 # include "os_linux_x86.hpp"
--- a/src/share/vm/runtime/vmThread.cpp	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/runtime/vmThread.cpp	Sun May 21 11:12:48 2017 -0700
@@ -396,7 +396,7 @@
       // Only write caller thread information for non-concurrent vm operations.
       // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
       // This is because the caller thread could have exited already.
-      event.set_caller(is_concurrent ? 0 : op->calling_thread()->osthread()->thread_id());
+      event.set_caller(is_concurrent ? 0 : (uint64_t) op->calling_thread()->osthread()->thread_id());
       event.commit();
     }
 
--- a/src/share/vm/trace/tracetypes.xml	Thu Feb 16 08:07:06 2017 +0100
+++ b/src/share/vm/trace/tracetypes.xml	Sun May 21 11:12:48 2017 -0700
@@ -60,7 +60,7 @@
  <types>
   <content_types>
     <content_type id="Thread" hr_name="Thread"
-                  type="U4" builtin_type="OSTHREAD">
+                  type="thread_id_t" builtin_type="OSTHREAD">
       <value type="UTF8" field="name" label="Thread name"/>
     </content_type>
 
@@ -294,8 +294,8 @@
                   type="u8" sizeop="sizeof(u8)"/>
 
     <!-- OS Thread ID -->
-    <primary_type symbol="OSTHREAD" datatype="U4" contenttype="OSTHREAD"
-                  type="u4" sizeop="sizeof(u4)"/>
+    <primary_type symbol="OSTHREAD" datatype="U8" contenttype="OSTHREAD"
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- VM Thread ID Note: changed from U2 to U8 for hotspot -->
     <primary_type symbol="VMTHREAD" datatype="U8" contenttype="VMTHREAD"
--- a/test/compiler/5091921/Test7005594.sh	Thu Feb 16 08:07:06 2017 +0100
+++ b/test/compiler/5091921/Test7005594.sh	Sun May 21 11:12:48 2017 -0700
@@ -60,6 +60,9 @@
   # Windows/MKS
   MEM=`"$ROOTDIR/mksnt/sysinf" memory -v | grep "Total Physical Memory: " | sed 's/Total Physical Memory: *//g'`
   MEM="$(($machine_memory / 1024))"
+elif [ -n `sysctl -n hw.physmem64 2> /dev/null` -o -n `sysctl -n hw.physmem 2> /dev/null` ];
+  # BSD
+  MEM=`sysctl -n hw.physmem64 2> /dev/null || sysctl -n hw.physmem) | awk '{print int($$NF / 1048576); }'`
 else
   echo "Unable to determine amount of physical memory on the machine"
 fi
--- a/test/runtime/7110720/Test7110720.sh	Thu Feb 16 08:07:06 2017 +0100
+++ b/test/runtime/7110720/Test7110720.sh	Sun May 21 11:12:48 2017 -0700
@@ -28,7 +28,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux | Darwin )
+  SunOS | Linux | Darwin | *BSD )
     FS="/"
     RM=/bin/rm
     CP=/bin/cp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/7158800/Test7158800.sh	Sun May 21 11:12:48 2017 -0700
@@ -0,0 +1,91 @@
+#!/bin/sh
+# 
+#  Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+#  This code is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License version 2 only, as
+#  published by the Free Software Foundation.
+# 
+#  This code is distributed in the hope that it will be useful, but WITHOUT
+#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#  version 2 for more details (a copy is included in the LICENSE file that
+#  accompanied this code).
+# 
+#  You should have received a copy of the GNU General Public License version
+#  2 along with this work; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+#  or visit www.oracle.com if you need additional information or have any
+#  questions.
+# 
+#
+#   Run test for InternTest.java
+#
+
+if [ "${TESTSRC}" = "" ]
+then TESTSRC=.
+fi
+
+if [ "${TESTJAVA}" = "" ]
+then
+  PARENT=`dirname \`which java\``
+  TESTJAVA=`dirname ${PARENT}`
+  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+  echo "If this is incorrect, try setting the variable manually."
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux | *BSD )
+    NULL=/dev/null
+    PS=":"
+    FS="/"
+    ;;
+  Windows_* )
+    NULL=NUL
+    PS=";"
+    FS="\\"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+JEMMYPATH=${CPAPPEND}
+CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
+
+THIS_DIR=`pwd`
+
+${TESTJAVA}${FS}bin${FS}java -fullversion
+
+${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}InternTest.java
+
+cp ${TESTSRC}${FS}badstrings.txt .
+
+${TESTJAVA}${FS}bin${FS}java -XX:+PrintStringTableStatistics -XX:+TraceSafepointCleanupTime InternTest bad > test.out 2>&1 &
+C_PID=$!
+
+sleep 60
+
+ps | grep ${C_PID} | grep -v grep
+
+if [ $? = 0 ]
+then
+    kill -9 ${C_PID}
+    echo "Test Failed"
+    exit 1
+else
+    echo "Test Passed"
+    exit 0
+fi
--- a/test/runtime/XCheckJniJsig/XCheckJSig.java	Thu Feb 16 08:07:06 2017 +0100
+++ b/test/runtime/XCheckJniJsig/XCheckJSig.java	Sun May 21 11:12:48 2017 -0700
@@ -36,8 +36,8 @@
     public static void main(String args[]) throws Throwable {
 
         System.out.println("Regression test for bugs 7051189 and 8023393");
-        if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
-            System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
+        if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX() && !Platform.isBSD()) {
+            System.out.println("Test only applicable on Solaris, Linux, BSD, and Mac OSX, skipping");
             return;
         }