< prev index next >

src/hotspot/share/code/compiledMethod.cpp

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/compiledIC.hpp"
  27 #include "code/compiledMethod.inline.hpp"
  28 #include "code/exceptionHandlerTable.hpp"
  29 #include "code/scopeDesc.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "code/icBuffer.hpp"
  32 #include "gc/shared/barrierSet.hpp"
  33 #include "gc/shared/gcBehaviours.hpp"
  34 #include "interpreter/bytecode.inline.hpp"
  35 #include "logging/log.hpp"
  36 #include "logging/logTag.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "oops/methodData.hpp"
  39 #include "oops/method.inline.hpp"

  40 #include "prims/methodHandles.hpp"
  41 #include "runtime/deoptimization.hpp"

  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/mutexLocker.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 
  46 CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout,
  47                                int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps,
  48                                bool caller_must_gc_arguments)
  49   : CodeBlob(name, type, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
  50     _mark_for_deoptimization_status(not_marked),
  51     _method(method),
  52     _gc_data(NULL)

  53 {
  54   init_defaults();
  55 }
  56 
  57 CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, int size,
  58                                int header_size, CodeBuffer* cb, int frame_complete_offset, int frame_size,
  59                                OopMapSet* oop_maps, bool caller_must_gc_arguments)
  60   : CodeBlob(name, type, CodeBlobLayout((address) this, size, header_size, cb), cb,
  61              frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
  62     _mark_for_deoptimization_status(not_marked),
  63     _method(method),
  64     _gc_data(NULL)

  65 {
  66   init_defaults();
  67 }
  68 
  69 void CompiledMethod::init_defaults() {
  70   _has_unsafe_access          = 0;
  71   _has_method_handle_invokes  = 0;
  72   _lazy_critical_native       = 0;
  73   _has_wide_vectors           = 0;

  74 }
  75 
  76 bool CompiledMethod::is_method_handle_return(address return_pc) {
  77   if (!has_method_handle_invokes())  return false;
  78   PcDesc* pd = pc_desc_at(return_pc);
  79   if (pd == NULL)
  80     return false;
  81   return pd->is_method_handle_invoke();
  82 }
  83 
  84 // Returns a string version of the method state.
  85 const char* CompiledMethod::state() const {
  86   int state = get_state();
  87   switch (state) {
  88   case not_installed:
  89     return "not installed";
  90   case in_use:
  91     return "in use";
  92   case not_used:
  93     return "not_used";


 694     }
 695   }
 696   bool has_evol_dependency() const { return _has_evol_dependency; }
 697 };
 698 
 699 bool CompiledMethod::has_evol_metadata() {
 700   // Check the metadata in relocIter and CompiledIC and also deoptimize
 701   // any nmethod that has reference to old methods.
 702   HasEvolDependency check_evol;
 703   metadata_do(&check_evol);
 704   if (check_evol.has_evol_dependency() && log_is_enabled(Debug, redefine, class, nmethod)) {
 705     ResourceMark rm;
 706     log_debug(redefine, class, nmethod)
 707             ("Found evol dependency of nmethod %s.%s(%s) compile_id=%d on in nmethod metadata",
 708              _method->method_holder()->external_name(),
 709              _method->name()->as_C_string(),
 710              _method->signature()->as_C_string(),
 711              compile_id());
 712   }
 713   return check_evol.has_evol_dependency();








 714 }


  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/compiledIC.hpp"
  27 #include "code/compiledMethod.inline.hpp"
  28 #include "code/exceptionHandlerTable.hpp"
  29 #include "code/scopeDesc.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "code/icBuffer.hpp"
  32 #include "gc/shared/barrierSet.hpp"
  33 #include "gc/shared/gcBehaviours.hpp"
  34 #include "interpreter/bytecode.inline.hpp"
  35 #include "logging/log.hpp"
  36 #include "logging/logTag.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "oops/methodData.hpp"
  39 #include "oops/method.inline.hpp"
  40 #include "oops/weakHandle.inline.hpp"
  41 #include "prims/methodHandles.hpp"
  42 #include "runtime/deoptimization.hpp"
  43 #include "runtime/jniHandles.inline.hpp"
  44 #include "runtime/handles.inline.hpp"
  45 #include "runtime/mutexLocker.hpp"
  46 #include "runtime/sharedRuntime.hpp"
  47 
  48 CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout,
  49                                int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps,
  50                                bool caller_must_gc_arguments, bool compiled)
  51   : CodeBlob(name, type, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments, compiled),
  52     _mark_for_deoptimization_status(not_marked),
  53     _method(method),
  54     _gc_data(NULL),
  55     _keepalive(NULL)
  56 {
  57   init_defaults();
  58 }
  59 
  60 CompiledMethod::CompiledMethod(Method* method, const char* name, CompilerType type, int size,
  61                                int header_size, CodeBuffer* cb, int frame_complete_offset, int frame_size,
  62                                OopMapSet* oop_maps, bool caller_must_gc_arguments, bool compiled)
  63   : CodeBlob(name, type, CodeBlobLayout((address) this, size, header_size, cb), cb,
  64              frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments, compiled),
  65     _mark_for_deoptimization_status(not_marked),
  66     _method(method),
  67     _gc_data(NULL),
  68     _keepalive(NULL)
  69 {
  70   init_defaults();
  71 }
  72 
  73 void CompiledMethod::init_defaults() {
  74   _has_unsafe_access          = 0;
  75   _has_method_handle_invokes  = 0;
  76   _lazy_critical_native       = 0;
  77   _has_wide_vectors           = 0;
  78   _has_monitors               = 0;
  79 }
  80 
  81 bool CompiledMethod::is_method_handle_return(address return_pc) {
  82   if (!has_method_handle_invokes())  return false;
  83   PcDesc* pd = pc_desc_at(return_pc);
  84   if (pd == NULL)
  85     return false;
  86   return pd->is_method_handle_invoke();
  87 }
  88 
  89 // Returns a string version of the method state.
  90 const char* CompiledMethod::state() const {
  91   int state = get_state();
  92   switch (state) {
  93   case not_installed:
  94     return "not installed";
  95   case in_use:
  96     return "in use";
  97   case not_used:
  98     return "not_used";


 699     }
 700   }
 701   bool has_evol_dependency() const { return _has_evol_dependency; }
 702 };
 703 
 704 bool CompiledMethod::has_evol_metadata() {
 705   // Check the metadata in relocIter and CompiledIC and also deoptimize
 706   // any nmethod that has reference to old methods.
 707   HasEvolDependency check_evol;
 708   metadata_do(&check_evol);
 709   if (check_evol.has_evol_dependency() && log_is_enabled(Debug, redefine, class, nmethod)) {
 710     ResourceMark rm;
 711     log_debug(redefine, class, nmethod)
 712             ("Found evol dependency of nmethod %s.%s(%s) compile_id=%d on in nmethod metadata",
 713              _method->method_holder()->external_name(),
 714              _method->name()->as_C_string(),
 715              _method->signature()->as_C_string(),
 716              compile_id());
 717   }
 718   return check_evol.has_evol_dependency();
 719 }
 720 
 721 bool CompiledMethod::is_on_continuation_stack() {
 722   if (_keepalive != NULL) {
 723     WeakHandle<vm_nmethod_keepalive_data> wh = WeakHandle<vm_nmethod_keepalive_data>::from_raw(_keepalive);
 724     return wh.resolve() != NULL;
 725   }
 726   return false;
 727 }
< prev index next >