src/hotspot/share/oops/methodData.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54669 ad45b3802d4e
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "classfile/systemDictionary.hpp"
    26 #include "classfile/systemDictionary.hpp"
       
    27 #include "compiler/compilationPolicy.hpp"
    27 #include "compiler/compilerOracle.hpp"
    28 #include "compiler/compilerOracle.hpp"
    28 #include "interpreter/bytecode.hpp"
    29 #include "interpreter/bytecode.hpp"
    29 #include "interpreter/bytecodeStream.hpp"
    30 #include "interpreter/bytecodeStream.hpp"
    30 #include "interpreter/linkResolver.hpp"
    31 #include "interpreter/linkResolver.hpp"
    31 #include "memory/heapInspection.hpp"
    32 #include "memory/heapInspection.hpp"
    32 #include "memory/metaspaceClosure.hpp"
    33 #include "memory/metaspaceClosure.hpp"
    33 #include "memory/resourceArea.hpp"
    34 #include "memory/resourceArea.hpp"
    34 #include "oops/methodData.inline.hpp"
    35 #include "oops/methodData.inline.hpp"
    35 #include "prims/jvmtiRedefineClasses.hpp"
    36 #include "prims/jvmtiRedefineClasses.hpp"
    36 #include "runtime/arguments.hpp"
    37 #include "runtime/arguments.hpp"
    37 #include "runtime/compilationPolicy.hpp"
       
    38 #include "runtime/deoptimization.hpp"
    38 #include "runtime/deoptimization.hpp"
    39 #include "runtime/handles.inline.hpp"
    39 #include "runtime/handles.inline.hpp"
    40 #include "runtime/orderAccess.hpp"
    40 #include "runtime/orderAccess.hpp"
    41 #include "runtime/safepointVerifiers.hpp"
    41 #include "runtime/safepointVerifiers.hpp"
    42 #include "utilities/align.hpp"
    42 #include "utilities/align.hpp"
   214   int args_cell = 0;
   214   int args_cell = 0;
   215   if (MethodData::profile_arguments_for_invoke(m, bci)) {
   215   if (MethodData::profile_arguments_for_invoke(m, bci)) {
   216     args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit);
   216     args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), false, TypeProfileArgsLimit);
   217   }
   217   }
   218   int ret_cell = 0;
   218   int ret_cell = 0;
   219   if (MethodData::profile_return_for_invoke(m, bci) && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) {
   219   if (MethodData::profile_return_for_invoke(m, bci) && is_reference_type(inv.result_type())) {
   220     ret_cell = ReturnTypeEntry::static_cell_count();
   220     ret_cell = ReturnTypeEntry::static_cell_count();
   221   }
   221   }
   222   int header_cell = 0;
   222   int header_cell = 0;
   223   if (args_cell + ret_cell > 0) {
   223   if (args_cell + ret_cell > 0) {
   224     header_cell = header_cell_count();
   224     header_cell = header_cell_count();
   287 #endif
   287 #endif
   288     _args.post_initialize(inv.signature(), inv.has_receiver(), false);
   288     _args.post_initialize(inv.signature(), inv.has_receiver(), false);
   289   }
   289   }
   290 
   290 
   291   if (has_return()) {
   291   if (has_return()) {
   292     assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
   292     assert(is_reference_type(inv.result_type()), "room for a ret type but doesn't return obj?");
   293     _ret.post_initialize();
   293     _ret.post_initialize();
   294   }
   294   }
   295 }
   295 }
   296 
   296 
   297 void VirtualCallTypeData::post_initialize(BytecodeStream* stream, MethodData* mdo) {
   297 void VirtualCallTypeData::post_initialize(BytecodeStream* stream, MethodData* mdo) {
   308 #endif
   308 #endif
   309     _args.post_initialize(inv.signature(), inv.has_receiver(), false);
   309     _args.post_initialize(inv.signature(), inv.has_receiver(), false);
   310   }
   310   }
   311 
   311 
   312   if (has_return()) {
   312   if (has_return()) {
   313     assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
   313     assert(is_reference_type(inv.result_type()), "room for a ret type but doesn't return obj?");
   314     _ret.post_initialize();
   314     _ret.post_initialize();
   315   }
   315   }
   316 }
   316 }
   317 
   317 
   318 void TypeStackSlotEntries::clean_weak_klass_links(bool always_clean) {
   318 void TypeStackSlotEntries::clean_weak_klass_links(bool always_clean) {
  1210   }
  1210   }
  1211 }
  1211 }
  1212 
  1212 
  1213 // Initialize the MethodData* corresponding to a given method.
  1213 // Initialize the MethodData* corresponding to a given method.
  1214 MethodData::MethodData(const methodHandle& method, int size, TRAPS)
  1214 MethodData::MethodData(const methodHandle& method, int size, TRAPS)
  1215   : _extra_data_lock(Monitor::leaf, "MDO extra data lock"),
  1215   : _extra_data_lock(Mutex::leaf, "MDO extra data lock"),
  1216     _parameters_type_data_di(parameters_uninitialized) {
  1216     _parameters_type_data_di(parameters_uninitialized) {
  1217   // Set the method back-pointer.
  1217   // Set the method back-pointer.
  1218   _method = method();
  1218   _method = method();
  1219   initialize();
  1219   initialize();
  1220 }
  1220 }
  1605   return inv.is_invokedynamic() || inv.is_invokehandle();
  1605   return inv.is_invokedynamic() || inv.is_invokehandle();
  1606 }
  1606 }
  1607 
  1607 
  1608 bool MethodData::profile_unsafe(const methodHandle& m, int bci) {
  1608 bool MethodData::profile_unsafe(const methodHandle& m, int bci) {
  1609   Bytecode_invoke inv(m , bci);
  1609   Bytecode_invoke inv(m , bci);
  1610   if (inv.is_invokevirtual() && inv.klass() == vmSymbols::jdk_internal_misc_Unsafe()) {
  1610   if (inv.is_invokevirtual()) {
  1611     ResourceMark rm;
  1611     if (inv.klass() == vmSymbols::jdk_internal_misc_Unsafe() ||
  1612     char* name = inv.name()->as_C_string();
  1612         inv.klass() == vmSymbols::sun_misc_Unsafe()) {
  1613     if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) {
  1613       ResourceMark rm;
  1614       return true;
  1614       char* name = inv.name()->as_C_string();
       
  1615       if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) {
       
  1616         return true;
       
  1617       }
  1615     }
  1618     }
  1616   }
  1619   }
  1617   return false;
  1620   return false;
  1618 }
  1621 }
  1619 
  1622