src/hotspot/share/oops/methodData.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54669 ad45b3802d4e
child 58679 9c3209ff7550
--- a/src/hotspot/share/oops/methodData.cpp	Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/oops/methodData.cpp	Thu Oct 17 20:53:35 2019 +0100
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "compiler/compilationPolicy.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "interpreter/bytecode.hpp"
 #include "interpreter/bytecodeStream.hpp"
@@ -34,7 +35,6 @@
 #include "oops/methodData.inline.hpp"
 #include "prims/jvmtiRedefineClasses.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/orderAccess.hpp"
@@ -216,7 +216,7 @@
     args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit);
   }
   int ret_cell = 0;
-  if (MethodData::profile_return_for_invoke(m, bci) && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) {
+  if (MethodData::profile_return_for_invoke(m, bci) && is_reference_type(inv.result_type())) {
     ret_cell = ReturnTypeEntry::static_cell_count();
   }
   int header_cell = 0;
@@ -289,7 +289,7 @@
   }
 
   if (has_return()) {
-    assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
+    assert(is_reference_type(inv.result_type()), "room for a ret type but doesn't return obj?");
     _ret.post_initialize();
   }
 }
@@ -310,7 +310,7 @@
   }
 
   if (has_return()) {
-    assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
+    assert(is_reference_type(inv.result_type()), "room for a ret type but doesn't return obj?");
     _ret.post_initialize();
   }
 }
@@ -1212,7 +1212,7 @@
 
 // Initialize the MethodData* corresponding to a given method.
 MethodData::MethodData(const methodHandle& method, int size, TRAPS)
-  : _extra_data_lock(Monitor::leaf, "MDO extra data lock"),
+  : _extra_data_lock(Mutex::leaf, "MDO extra data lock"),
     _parameters_type_data_di(parameters_uninitialized) {
   // Set the method back-pointer.
   _method = method();
@@ -1607,11 +1607,14 @@
 
 bool MethodData::profile_unsafe(const methodHandle& m, int bci) {
   Bytecode_invoke inv(m , bci);
-  if (inv.is_invokevirtual() && inv.klass() == vmSymbols::jdk_internal_misc_Unsafe()) {
-    ResourceMark rm;
-    char* name = inv.name()->as_C_string();
-    if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) {
-      return true;
+  if (inv.is_invokevirtual()) {
+    if (inv.klass() == vmSymbols::jdk_internal_misc_Unsafe() ||
+        inv.klass() == vmSymbols::sun_misc_Unsafe()) {
+      ResourceMark rm;
+      char* name = inv.name()->as_C_string();
+      if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) {
+        return true;
+      }
     }
   }
   return false;