1.1 --- a/src/share/vm/code/nmethod.hpp Tue Oct 01 11:06:35 2013 -0400 1.2 +++ b/src/share/vm/code/nmethod.hpp Thu Oct 03 16:38:21 2013 +0400 1.3 @@ -119,7 +119,6 @@ 1.4 // To support simple linked-list chaining of nmethods: 1.5 nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head 1.6 nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods 1.7 - nmethod* _saved_nmethod_link; // from CodeCache::speculatively_disconnect 1.8 1.9 static nmethod* volatile _oops_do_mark_nmethods; 1.10 nmethod* volatile _oops_do_mark_link; 1.11 @@ -165,7 +164,6 @@ 1.12 1.13 // protected by CodeCache_lock 1.14 bool _has_flushed_dependencies; // Used for maintenance of dependencies (CodeCache_lock) 1.15 - bool _speculatively_disconnected; // Marked for potential unload 1.16 1.17 bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper) 1.18 bool _marked_for_deoptimization; // Used for stack deoptimization 1.19 @@ -180,7 +178,7 @@ 1.20 unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints 1.21 1.22 // Protected by Patching_lock 1.23 - unsigned char _state; // {alive, not_entrant, zombie, unloaded} 1.24 + volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded} 1.25 1.26 #ifdef ASSERT 1.27 bool _oops_are_stale; // indicates that it's no longer safe to access oops section 1.28 @@ -202,11 +200,18 @@ 1.29 1.30 // not_entrant method removal. Each mark_sweep pass will update 1.31 // this mark to current sweep invocation count if it is seen on the 1.32 - // stack. An not_entrant method can be removed when there is no 1.33 + // stack. An not_entrant method can be removed when there are no 1.34 // more activations, i.e., when the _stack_traversal_mark is less than 1.35 // current sweep traversal index. 1.36 long _stack_traversal_mark; 1.37 1.38 + // The _hotness_counter indicates the hotness of a method. The higher 1.39 + // the value the hotter the method. The hotness counter of a nmethod is 1.40 + // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method 1.41 + // is active while stack scanning (mark_active_nmethods()). The hotness 1.42 + // counter is decreased (by 1) while sweeping. 1.43 + int _hotness_counter; 1.44 + 1.45 ExceptionCache *_exception_cache; 1.46 PcDescCache _pc_desc_cache; 1.47 1.48 @@ -382,6 +387,10 @@ 1.49 1.50 int total_size () const; 1.51 1.52 + void dec_hotness_counter() { _hotness_counter--; } 1.53 + void set_hotness_counter(int val) { _hotness_counter = val; } 1.54 + int hotness_counter() const { return _hotness_counter; } 1.55 + 1.56 // Containment 1.57 bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); } 1.58 bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); } 1.59 @@ -408,8 +417,8 @@ 1.60 // alive. It is used when an uncommon trap happens. Returns true 1.61 // if this thread changed the state of the nmethod or false if 1.62 // another thread performed the transition. 1.63 - bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } 1.64 - bool make_zombie() { return make_not_entrant_or_zombie(zombie); } 1.65 + bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } 1.66 + bool make_zombie() { return make_not_entrant_or_zombie(zombie); } 1.67 1.68 // used by jvmti to track if the unload event has been reported 1.69 bool unload_reported() { return _unload_reported; } 1.70 @@ -437,9 +446,6 @@ 1.71 bool has_method_handle_invokes() const { return _has_method_handle_invokes; } 1.72 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } 1.73 1.74 - bool is_speculatively_disconnected() const { return _speculatively_disconnected; } 1.75 - void set_speculatively_disconnected(bool z) { _speculatively_disconnected = z; } 1.76 - 1.77 bool is_lazy_critical_native() const { return _lazy_critical_native; } 1.78 void set_lazy_critical_native(bool z) { _lazy_critical_native = z; } 1.79 1.80 @@ -499,9 +505,6 @@ 1.81 nmethod* scavenge_root_link() const { return _scavenge_root_link; } 1.82 void set_scavenge_root_link(nmethod *n) { _scavenge_root_link = n; } 1.83 1.84 - nmethod* saved_nmethod_link() const { return _saved_nmethod_link; } 1.85 - void set_saved_nmethod_link(nmethod *n) { _saved_nmethod_link = n; } 1.86 - 1.87 public: 1.88 1.89 // Sweeper support