8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
authorkbarrett
Thu, 01 Mar 2018 16:51:22 -0500
changeset 49192 6734eeef4283
parent 49191 13378aa8527e
child 49193 c3ec048aad63
8198474: Move JNIHandles::resolve into jniHandles.inline.hpp Summary: Moved resolve and friends to new jniHandles.inline.hpp. Reviewed-by: tschatzl, pliden, coleenp
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
src/hotspot/cpu/ppc/frame_ppc.cpp
src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp
src/hotspot/cpu/sparc/macroAssembler_sparc.cpp
src/hotspot/cpu/zero/cppInterpreter_zero.cpp
src/hotspot/share/ci/ciEnv.cpp
src/hotspot/share/ci/ciInstanceKlass.cpp
src/hotspot/share/ci/ciObject.cpp
src/hotspot/share/ci/ciObject.hpp
src/hotspot/share/classfile/javaClasses.cpp
src/hotspot/share/classfile/modules.cpp
src/hotspot/share/classfile/verifier.cpp
src/hotspot/share/code/debugInfo.cpp
src/hotspot/share/code/dependencies.cpp
src/hotspot/share/code/nmethod.cpp
src/hotspot/share/code/oopRecorder.cpp
src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
src/hotspot/share/jvmci/jvmciCodeInstaller.hpp
src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
src/hotspot/share/jvmci/jvmciJavaClasses.hpp
src/hotspot/share/jvmci/jvmciRuntime.cpp
src/hotspot/share/jvmci/jvmciRuntime.hpp
src/hotspot/share/prims/jni.cpp
src/hotspot/share/prims/jniCheck.cpp
src/hotspot/share/prims/jvm.cpp
src/hotspot/share/prims/jvmtiEnv.cpp
src/hotspot/share/prims/jvmtiEnvBase.cpp
src/hotspot/share/prims/jvmtiEnvBase.hpp
src/hotspot/share/prims/jvmtiExport.cpp
src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
src/hotspot/share/prims/jvmtiRedefineClasses.cpp
src/hotspot/share/prims/jvmtiTagMap.cpp
src/hotspot/share/prims/methodHandles.cpp
src/hotspot/share/prims/unsafe.cpp
src/hotspot/share/prims/wbtestmethods/parserTests.cpp
src/hotspot/share/prims/whitebox.cpp
src/hotspot/share/runtime/javaCalls.cpp
src/hotspot/share/runtime/jniHandles.cpp
src/hotspot/share/runtime/jniHandles.hpp
src/hotspot/share/runtime/jniHandles.inline.hpp
src/hotspot/share/runtime/thread.cpp
src/hotspot/share/runtime/threadSMR.cpp
src/hotspot/share/services/management.cpp
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -43,6 +43,7 @@
 #include "runtime/biasedLocking.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/thread.hpp"
 
--- a/src/hotspot/cpu/ppc/frame_ppc.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/cpu/ppc/frame_ppc.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -32,6 +32,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/monitorChunk.hpp"
 #include "runtime/signature.hpp"
 #include "runtime/stubCodeGenerator.hpp"
--- a/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -35,6 +35,7 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "nativeInst_sparc.hpp"
 #include "oops/objArrayKlass.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -36,6 +36,7 @@
 #include "prims/methodHandles.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/safepoint.hpp"
--- a/src/hotspot/cpu/zero/cppInterpreter_zero.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/cpu/zero/cppInterpreter_zero.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -41,6 +41,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
--- a/src/hotspot/share/ci/ciEnv.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/ci/ciEnv.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -53,6 +53,7 @@
 #include "prims/jvmtiExport.hpp"
 #include "runtime/init.hpp"
 #include "runtime/reflection.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/thread.inline.hpp"
 #include "trace/tracing.hpp"
--- a/src/hotspot/share/ci/ciInstanceKlass.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/ci/ciInstanceKlass.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "oops/oop.inline.hpp"
 #include "oops/fieldStreams.hpp"
 #include "runtime/fieldDescriptor.hpp"
+#include "runtime/jniHandles.inline.hpp"
 
 // ciInstanceKlass
 //
--- a/src/hotspot/share/ci/ciObject.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/ci/ciObject.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -27,6 +27,7 @@
 #include "ci/ciUtilities.hpp"
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/jniHandles.inline.hpp"
 
 // ciObject
 //
@@ -98,6 +99,14 @@
 }
 
 // ------------------------------------------------------------------
+// ciObject::get_oop
+//
+// Get the oop of this ciObject.
+oop ciObject::get_oop() const {
+  return JNIHandles::resolve_non_null(_handle);
+}
+
+// ------------------------------------------------------------------
 // ciObject::klass
 //
 // Get the ciKlass of this ciObject.
--- a/src/hotspot/share/ci/ciObject.hpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/ci/ciObject.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -67,10 +67,7 @@
 
   jobject      handle()  const { return _handle; }
   // Get the VM oop that this object holds.
-  oop get_oop() const {
-    assert(_handle != NULL, "null oop");
-    return JNIHandles::resolve_non_null(_handle);
-  }
+  oop get_oop() const;
 
   void init_flags_from(oop x);
 
--- a/src/hotspot/share/classfile/javaClasses.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -53,6 +53,7 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
--- a/src/hotspot/share/classfile/modules.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/classfile/modules.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2016, 2018, 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
@@ -44,6 +44,7 @@
 #include "runtime/arguments.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/reflection.hpp"
 #include "utilities/stringUtils.hpp"
 #include "utilities/utf8.hpp"
--- a/src/hotspot/share/classfile/verifier.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/classfile/verifier.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, 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
@@ -45,6 +45,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/thread.hpp"
--- a/src/hotspot/share/code/debugInfo.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/code/debugInfo.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -29,6 +29,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/thread.hpp"
 
 // Constructors
--- a/src/hotspot/share/code/dependencies.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/code/dependencies.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 #include "oops/objArrayKlass.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 
--- a/src/hotspot/share/code/nmethod.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/code/nmethod.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -44,6 +44,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/hotspot/share/code/oopRecorder.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/code/oopRecorder.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -29,6 +29,7 @@
 #include "code/oopRecorder.hpp"
 #include "memory/allocation.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/jniHandles.inline.hpp"
 
 #ifdef ASSERT
 template <class T> int ValueRecorder<T>::_find_index_calls = 0;
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -39,6 +39,7 @@
 #include "oops/objArrayOop.inline.hpp"
 #include "oops/typeArrayOop.inline.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/safepointMechanism.inline.hpp"
 #include "utilities/align.hpp"
 
@@ -97,6 +98,32 @@
   }
 }
 
+objArrayOop CodeInstaller::sites() {
+  return (objArrayOop) JNIHandles::resolve(_sites_handle);
+}
+
+arrayOop CodeInstaller::code() {
+  return (arrayOop) JNIHandles::resolve(_code_handle);
+}
+
+arrayOop CodeInstaller::data_section() {
+  return (arrayOop) JNIHandles::resolve(_data_section_handle);
+}
+
+objArrayOop CodeInstaller::data_section_patches() {
+  return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle);
+}
+
+#ifndef PRODUCT
+objArrayOop CodeInstaller::comments() {
+  return (objArrayOop) JNIHandles::resolve(_comments_handle);
+}
+#endif
+
+oop CodeInstaller::word_kind() {
+  return JNIHandles::resolve(_word_kind_handle);
+}
+
 // creates a HotSpot oop map out of the byte arrays provided by DebugInfo
 OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
   Handle reference_map(THREAD, DebugInfo::referenceMap(debug_info));
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -188,15 +188,15 @@
   void pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle method, jint pc_offset, TRAPS);
   void pd_relocate_poll(address pc, jint mark, TRAPS);
 
-  objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
-  arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
-  arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
-  objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
+  objArrayOop sites();
+  arrayOop code();
+  arrayOop data_section();
+  objArrayOop data_section_patches();
 #ifndef PRODUCT
-  objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
+  objArrayOop comments();
 #endif
 
-  oop word_kind() { return (oop) JNIHandles::resolve(_word_kind_handle); }
+  oop word_kind();
 
 public:
 
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -36,6 +36,7 @@
 #include "oops/typeArrayOop.inline.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "jvmci/jvmciRuntime.hpp"
 #include "compiler/abstractCompiler.hpp"
 #include "compiler/compileBroker.hpp"
--- a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -28,6 +28,7 @@
 #include "oops/access.inline.hpp"
 #include "oops/instanceMirrorKlass.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/jniHandles.inline.hpp"
 
 class JVMCIJavaClasses : AllStatic {
  public:
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -40,6 +40,7 @@
 #include "oops/objArrayOop.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/threadSMR.hpp"
@@ -630,6 +631,11 @@
   return Handle(THREAD, (oop)result.get_jobject());
 }
 
+Handle JVMCIRuntime::get_HotSpotJVMCIRuntime(TRAPS) {
+  initialize_JVMCI(CHECK_(Handle()));
+  return Handle(THREAD, JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
+}
+
 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
   guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
   JVMCIRuntime::initialize_well_known_classes(CHECK);
--- a/src/hotspot/share/jvmci/jvmciRuntime.hpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -73,10 +73,7 @@
   /**
    * Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
    */
-  static Handle get_HotSpotJVMCIRuntime(TRAPS) {
-    initialize_JVMCI(CHECK_(Handle()));
-    return Handle(THREAD, JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
-  }
+  static Handle get_HotSpotJVMCIRuntime(TRAPS);
 
   static jobject get_HotSpotJVMCIRuntime_jobject(TRAPS) {
     initialize_JVMCI(CHECK_NULL);
--- a/src/hotspot/share/prims/jni.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jni.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -69,6 +69,7 @@
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/hotspot/share/prims/jniCheck.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jniCheck.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -38,6 +38,7 @@
 #include "runtime/handles.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
 // Complain every extra number of unplanned local refs
--- a/src/hotspot/share/prims/jvm.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvm.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -61,6 +61,7 @@
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/perfData.hpp"
--- a/src/hotspot/share/prims/jvmtiEnv.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -58,6 +58,7 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/reflectionUtils.hpp"
 #include "runtime/signature.hpp"
--- a/src/hotspot/share/prims/jvmtiEnvBase.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -40,6 +40,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/objectMonitor.inline.hpp"
 #include "runtime/signature.hpp"
@@ -501,6 +502,24 @@
 }
 
 
+// Handle management
+
+jobject JvmtiEnvBase::jni_reference(Handle hndl) {
+  return JNIHandles::make_local(hndl());
+}
+
+jobject JvmtiEnvBase::jni_reference(JavaThread *thread, Handle hndl) {
+  return JNIHandles::make_local(thread, hndl());
+}
+
+void JvmtiEnvBase::destroy_jni_reference(jobject jobj) {
+  JNIHandles::destroy_local(jobj);
+}
+
+void JvmtiEnvBase::destroy_jni_reference(JavaThread *thread, jobject jobj) {
+  JNIHandles::destroy_local(jobj); // thread is unused.
+}
+
 //
 // Threads
 //
--- a/src/hotspot/share/prims/jvmtiEnvBase.hpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiEnvBase.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -214,29 +214,20 @@
   unsigned char* jvmtiMalloc(jlong size);  // don't use this - call allocate
 
   // method to create a local handle
-  jobject jni_reference(Handle hndl) {
-    return JNIHandles::make_local(hndl());
-  }
+  jobject jni_reference(Handle hndl);
 
   // method to create a local handle.
   // This function allows caller to specify which
   // threads local handle table to use.
-  jobject jni_reference(JavaThread *thread, Handle hndl) {
-    return JNIHandles::make_local(thread, hndl());
-  }
+  jobject jni_reference(JavaThread *thread, Handle hndl);
 
   // method to destroy a local handle
-  void destroy_jni_reference(jobject jobj) {
-    JNIHandles::destroy_local(jobj);
-  }
+  void destroy_jni_reference(jobject jobj);
 
   // method to destroy a local handle.
   // This function allows caller to specify which
-  // threads local handle table to use although currently it is
-  // not used.
-  void destroy_jni_reference(JavaThread *thread, jobject jobj) {
-    destroy_jni_reference(jobj);
-  }
+  // threads local handle table to use.
+  void destroy_jni_reference(JavaThread *thread, jobject jobj);
 
   jvmtiEnv* jvmti_external() { return &_jvmti_external; };
 
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -49,6 +49,7 @@
 #include "runtime/handles.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/objectMonitor.inline.hpp"
 #include "runtime/os.inline.hpp"
--- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -27,6 +27,7 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "memory/universe.inline.hpp"
 #include "prims/jvmtiGetLoadedClasses.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/thread.hpp"
 #include "utilities/stack.inline.hpp"
 #if INCLUDE_ALL_GCS
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -47,6 +47,7 @@
 #include "prims/resolvedMethodTable.hpp"
 #include "prims/methodComparator.hpp"
 #include "runtime/deoptimization.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/relocator.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "utilities/events.hpp"
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -44,7 +44,7 @@
 #include "prims/jvmtiTagMap.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/javaCalls.hpp"
-#include "runtime/jniHandles.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/reflectionUtils.hpp"
--- a/src/hotspot/share/prims/methodHandles.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/methodHandles.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -40,6 +40,7 @@
 #include "prims/methodHandles.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/timerTrace.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/signature.hpp"
--- a/src/hotspot/share/prims/unsafe.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/unsafe.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -38,6 +38,7 @@
 #include "runtime/atomic.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/thread.hpp"
--- a/src/hotspot/share/prims/wbtestmethods/parserTests.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/wbtestmethods/parserTests.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, 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
@@ -32,6 +32,7 @@
 #include "prims/whitebox.hpp"
 #include "prims/wbtestmethods/parserTests.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "services/diagnosticArgument.hpp"
 #include "services/diagnosticFramework.hpp"
 
--- a/src/hotspot/share/prims/whitebox.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/prims/whitebox.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -53,6 +53,7 @@
 #include "runtime/handshake.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/sweeper.hpp"
 #include "runtime/thread.hpp"
--- a/src/hotspot/share/runtime/javaCalls.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/runtime/javaCalls.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/signature.hpp"
--- a/src/hotspot/share/runtime/jniHandles.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/runtime/jniHandles.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -27,7 +27,7 @@
 #include "logging/log.hpp"
 #include "memory/iterator.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/jniHandles.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
 #include "trace/traceMacros.hpp"
@@ -135,6 +135,18 @@
   return res;
 }
 
+// Resolve some erroneous cases to NULL, rather than treating them as
+// possibly unchecked errors.  In particular, deleted handles are
+// treated as NULL (though a deleted and later reallocated handle
+// isn't detected).
+oop JNIHandles::resolve_external_guard(jobject handle) {
+  oop result = NULL;
+  if (handle != NULL) {
+    result = resolve_impl<true /* external_guard */ >(handle);
+  }
+  return result;
+}
+
 oop JNIHandles::resolve_jweak(jweak handle) {
   assert(handle != NULL, "precondition");
   assert(is_jweak(handle), "precondition");
--- a/src/hotspot/share/runtime/jniHandles.hpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/runtime/jniHandles.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -67,10 +67,10 @@
 
   // Resolve handle into oop
   inline static oop resolve(jobject handle);
-  // Resolve externally provided handle into oop with some guards
-  inline static oop resolve_external_guard(jobject handle);
   // Resolve handle into oop, result guaranteed not to be null
   inline static oop resolve_non_null(jobject handle);
+  // Resolve externally provided handle into oop with some guards
+  static oop resolve_external_guard(jobject handle);
 
   // Local handles
   static jobject make_local(oop obj);
@@ -198,72 +198,4 @@
   #endif
 };
 
-inline bool JNIHandles::is_jweak(jobject handle) {
-  STATIC_ASSERT(weak_tag_size == 1);
-  STATIC_ASSERT(weak_tag_value == 1);
-  return (reinterpret_cast<uintptr_t>(handle) & weak_tag_mask) != 0;
-}
-
-inline oop& JNIHandles::jobject_ref(jobject handle) {
-  assert(!is_jweak(handle), "precondition");
-  return *reinterpret_cast<oop*>(handle);
-}
-
-inline oop& JNIHandles::jweak_ref(jobject handle) {
-  assert(is_jweak(handle), "precondition");
-  char* ptr = reinterpret_cast<char*>(handle) - weak_tag_value;
-  return *reinterpret_cast<oop*>(ptr);
-}
-
-// external_guard is true if called from resolve_external_guard.
-template<bool external_guard>
-inline oop JNIHandles::resolve_impl(jobject handle) {
-  assert(handle != NULL, "precondition");
-  assert(!current_thread_in_native(), "must not be in native");
-  oop result;
-  if (is_jweak(handle)) {       // Unlikely
-    result = resolve_jweak(handle);
-  } else {
-    result = jobject_ref(handle);
-    // Construction of jobjects canonicalize a null value into a null
-    // jobject, so for non-jweak the pointee should never be null.
-    assert(external_guard || result != NULL, "Invalid JNI handle");
-  }
-  return result;
-}
-
-inline oop JNIHandles::resolve(jobject handle) {
-  oop result = NULL;
-  if (handle != NULL) {
-    result = resolve_impl<false /* external_guard */ >(handle);
-  }
-  return result;
-}
-
-// Resolve some erroneous cases to NULL, rather than treating them as
-// possibly unchecked errors.  In particular, deleted handles are
-// treated as NULL (though a deleted and later reallocated handle
-// isn't detected).
-inline oop JNIHandles::resolve_external_guard(jobject handle) {
-  oop result = NULL;
-  if (handle != NULL) {
-    result = resolve_impl<true /* external_guard */ >(handle);
-  }
-  return result;
-}
-
-inline oop JNIHandles::resolve_non_null(jobject handle) {
-  assert(handle != NULL, "JNI handle should not be null");
-  oop result = resolve_impl<false /* external_guard */ >(handle);
-  assert(result != NULL, "NULL read from jni handle");
-  return result;
-}
-
-inline void JNIHandles::destroy_local(jobject handle) {
-  if (handle != NULL) {
-    assert(!is_jweak(handle), "Invalid JNI local handle");
-    jobject_ref(handle) = NULL;
-  }
-}
-
 #endif // SHARE_VM_RUNTIME_JNIHANDLES_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/runtime/jniHandles.inline.hpp	Thu Mar 01 16:51:22 2018 -0500
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ */
+
+#ifndef SHARE_RUNTIME_JNIHANDLES_INLINE_HPP
+#define SHARE_RUNTIME_JNIHANDLES_INLINE_HPP
+
+#include "oops/oop.hpp"
+#include "runtime/jniHandles.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+inline bool JNIHandles::is_jweak(jobject handle) {
+  STATIC_ASSERT(weak_tag_size == 1);
+  STATIC_ASSERT(weak_tag_value == 1);
+  return (reinterpret_cast<uintptr_t>(handle) & weak_tag_mask) != 0;
+}
+
+inline oop& JNIHandles::jobject_ref(jobject handle) {
+  assert(!is_jweak(handle), "precondition");
+  return *reinterpret_cast<oop*>(handle);
+}
+
+inline oop& JNIHandles::jweak_ref(jobject handle) {
+  assert(is_jweak(handle), "precondition");
+  char* ptr = reinterpret_cast<char*>(handle) - weak_tag_value;
+  return *reinterpret_cast<oop*>(ptr);
+}
+
+// external_guard is true if called from resolve_external_guard.
+template<bool external_guard>
+inline oop JNIHandles::resolve_impl(jobject handle) {
+  assert(handle != NULL, "precondition");
+  assert(!current_thread_in_native(), "must not be in native");
+  oop result;
+  if (is_jweak(handle)) {       // Unlikely
+    result = resolve_jweak(handle);
+  } else {
+    result = jobject_ref(handle);
+    // Construction of jobjects canonicalize a null value into a null
+    // jobject, so for non-jweak the pointee should never be null.
+    assert(external_guard || result != NULL, "Invalid JNI handle");
+  }
+  return result;
+}
+
+inline oop JNIHandles::resolve(jobject handle) {
+  oop result = NULL;
+  if (handle != NULL) {
+    result = resolve_impl<false /* external_guard */ >(handle);
+  }
+  return result;
+}
+
+inline oop JNIHandles::resolve_non_null(jobject handle) {
+  assert(handle != NULL, "JNI handle should not be null");
+  oop result = resolve_impl<false /* external_guard */ >(handle);
+  assert(result != NULL, "NULL read from jni handle");
+  return result;
+}
+
+inline void JNIHandles::destroy_local(jobject handle) {
+  if (handle != NULL) {
+    assert(!is_jweak(handle), "Invalid JNI local handle");
+    jobject_ref(handle) = NULL;
+  }
+}
+
+#endif // SHARE_RUNTIME_JNIHANDLES_INLINE_HPP
+
--- a/src/hotspot/share/runtime/thread.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -71,6 +71,7 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/jniPeriodicChecker.hpp"
 #include "runtime/memprofiler.hpp"
 #include "runtime/mutexLocker.hpp"
--- a/src/hotspot/share/runtime/threadSMR.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/runtime/threadSMR.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/threadSMR.inline.hpp"
 #include "services/threadService.hpp"
--- a/src/hotspot/share/services/management.cpp	Thu Mar 01 09:03:30 2018 -0800
+++ b/src/hotspot/share/services/management.cpp	Thu Mar 01 16:51:22 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -39,7 +39,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
-#include "runtime/jniHandles.hpp"
+#include "runtime/jniHandles.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/serviceThread.hpp"
 #include "runtime/thread.inline.hpp"