src/share/vm/code/nmethod.hpp

Print this page




 102 
 103 class Dependencies;
 104 class ExceptionHandlerTable;
 105 class ImplicitExceptionTable;
 106 class AbstractCompiler;
 107 class xmlStream;
 108 
 109 class nmethod : public CodeBlob {
 110   friend class VMStructs;
 111   friend class NMethodSweeper;
 112   friend class CodeCache;  // scavengable oops
 113  private:
 114   // Shared fields for all nmethod's
 115   Method*   _method;
 116   int       _entry_bci;        // != InvocationEntryBci if this nmethod is an on-stack replacement method
 117   jmethodID _jmethod_id;       // Cache of method()->jmethod_id()
 118 
 119   // To support simple linked-list chaining of nmethods:
 120   nmethod*  _osr_link;         // from InstanceKlass::osr_nmethods_head
 121   nmethod*  _scavenge_root_link; // from CodeCache::scavenge_root_nmethods
 122   nmethod*  _saved_nmethod_link; // from CodeCache::speculatively_disconnect
 123 
 124   static nmethod* volatile _oops_do_mark_nmethods;
 125   nmethod*        volatile _oops_do_mark_link;
 126 
 127   AbstractCompiler* _compiler; // The compiler which compiled this nmethod
 128 
 129   // offsets for entry points
 130   address _entry_point;                      // entry point with class check
 131   address _verified_entry_point;             // entry point without class check
 132   address _osr_entry_point;                  // entry point for on stack replacement
 133 
 134   // Offsets for different nmethod parts
 135   int _exception_offset;
 136   // All deoptee's will resume execution at this location described by
 137   // this offset.
 138   int _deoptimize_offset;
 139   // All deoptee's at a MethodHandle call site will resume execution
 140   // at this location described by this offset.
 141   int _deoptimize_mh_offset;
 142   // Offset of the unwind handler if it exists


 148   int _consts_offset;
 149   int _stub_offset;
 150   int _oops_offset;                       // offset to where embedded oop table begins (inside data)
 151   int _metadata_offset;                   // embedded meta data table
 152   int _scopes_data_offset;
 153   int _scopes_pcs_offset;
 154   int _dependencies_offset;
 155   int _handler_table_offset;
 156   int _nul_chk_table_offset;
 157   int _nmethod_end_offset;
 158 
 159   // location in frame (offset for sp) that deopt can store the original
 160   // pc during a deopt.
 161   int _orig_pc_offset;
 162 
 163   int _compile_id;                           // which compilation made this nmethod
 164   int _comp_level;                           // compilation level
 165 
 166   // protected by CodeCache_lock
 167   bool _has_flushed_dependencies;            // Used for maintenance of dependencies (CodeCache_lock)
 168   bool _speculatively_disconnected;          // Marked for potential unload
 169 
 170   bool _marked_for_reclamation;              // Used by NMethodSweeper (set only by sweeper)
 171   bool _marked_for_deoptimization;           // Used for stack deoptimization
 172 
 173   // used by jvmti to track if an unload event has been posted for this nmethod.
 174   bool _unload_reported;
 175 
 176   // set during construction
 177   unsigned int _has_unsafe_access:1;         // May fault due to unsafe access.
 178   unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes?
 179   unsigned int _lazy_critical_native:1;      // Lazy JNI critical native
 180   unsigned int _has_wide_vectors:1;          // Preserve wide vectors at safepoints
 181 
 182   // Protected by Patching_lock
 183   unsigned char _state;                      // {alive, not_entrant, zombie, unloaded}
 184 
 185 #ifdef ASSERT
 186   bool _oops_are_stale;  // indicates that it's no longer safe to access oops section
 187 #endif
 188 
 189   enum { alive        = 0,
 190          not_entrant  = 1, // uncommon trap has happened but activations may still exist
 191          zombie       = 2,
 192          unloaded     = 3 };
 193 
 194 
 195   jbyte _scavenge_root_state;
 196 
 197   // Nmethod Flushing lock. If non-zero, then the nmethod is not removed
 198   // and is not made into a zombie. However, once the nmethod is made into
 199   // a zombie, it will be locked one final time if CompiledMethodUnload
 200   // event processing needs to be done.
 201   jint  _lock_count;
 202 
 203   // not_entrant method removal. Each mark_sweep pass will update
 204   // this mark to current sweep invocation count if it is seen on the
 205   // stack.  An not_entrant method can be removed when there is no
 206   // more activations, i.e., when the _stack_traversal_mark is less than
 207   // current sweep traversal index.
 208   long _stack_traversal_mark;
 209 







 210   ExceptionCache *_exception_cache;
 211   PcDescCache     _pc_desc_cache;
 212 
 213   // These are used for compiled synchronized native methods to
 214   // locate the owner and stack slot for the BasicLock so that we can
 215   // properly revoke the bias of the owner if necessary. They are
 216   // needed because there is no debug information for compiled native
 217   // wrappers and the oop maps are insufficient to allow
 218   // frame::retrieve_receiver() to work. Currently they are expected
 219   // to be byte offsets from the Java stack pointer for maximum code
 220   // sharing between platforms. Note that currently biased locking
 221   // will never cause Class instances to be biased but this code
 222   // handles the static synchronized case as well.
 223   // JVMTI's GetLocalInstance() also uses these offsets to find the receiver
 224   // for non-static native wrapper frames.
 225   ByteSize _native_receiver_sp_offset;
 226   ByteSize _native_basic_lock_sp_offset;
 227 
 228   friend class nmethodLocker;
 229 


 365   address dependencies_end      () const          { return           header_begin() + _handler_table_offset ; }
 366   address handler_table_begin   () const          { return           header_begin() + _handler_table_offset ; }
 367   address handler_table_end     () const          { return           header_begin() + _nul_chk_table_offset ; }
 368   address nul_chk_table_begin   () const          { return           header_begin() + _nul_chk_table_offset ; }
 369   address nul_chk_table_end     () const          { return           header_begin() + _nmethod_end_offset   ; }
 370 
 371   // Sizes
 372   int consts_size       () const                  { return            consts_end       () -            consts_begin       (); }
 373   int insts_size        () const                  { return            insts_end        () -            insts_begin        (); }
 374   int stub_size         () const                  { return            stub_end         () -            stub_begin         (); }
 375   int oops_size         () const                  { return (address)  oops_end         () - (address)  oops_begin         (); }
 376   int metadata_size     () const                  { return (address)  metadata_end     () - (address)  metadata_begin     (); }
 377   int scopes_data_size  () const                  { return            scopes_data_end  () -            scopes_data_begin  (); }
 378   int scopes_pcs_size   () const                  { return (intptr_t) scopes_pcs_end   () - (intptr_t) scopes_pcs_begin   (); }
 379   int dependencies_size () const                  { return            dependencies_end () -            dependencies_begin (); }
 380   int handler_table_size() const                  { return            handler_table_end() -            handler_table_begin(); }
 381   int nul_chk_table_size() const                  { return            nul_chk_table_end() -            nul_chk_table_begin(); }
 382 
 383   int total_size        () const;
 384 




 385   // Containment
 386   bool consts_contains       (address addr) const { return consts_begin       () <= addr && addr < consts_end       (); }
 387   bool insts_contains        (address addr) const { return insts_begin        () <= addr && addr < insts_end        (); }
 388   bool stub_contains         (address addr) const { return stub_begin         () <= addr && addr < stub_end         (); }
 389   bool oops_contains         (oop*    addr) const { return oops_begin         () <= addr && addr < oops_end         (); }
 390   bool metadata_contains     (Metadata** addr) const   { return metadata_begin     () <= addr && addr < metadata_end     (); }
 391   bool scopes_data_contains  (address addr) const { return scopes_data_begin  () <= addr && addr < scopes_data_end  (); }
 392   bool scopes_pcs_contains   (PcDesc* addr) const { return scopes_pcs_begin   () <= addr && addr < scopes_pcs_end   (); }
 393   bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
 394   bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); }
 395 
 396   // entry points
 397   address entry_point() const                     { return _entry_point;             } // normal entry point
 398   address verified_entry_point() const            { return _verified_entry_point;    } // if klass is correct
 399 
 400   // flag accessing and manipulation
 401   bool  is_in_use() const                         { return _state == alive; }
 402   bool  is_alive() const                          { return _state == alive || _state == not_entrant; }
 403   bool  is_not_entrant() const                    { return _state == not_entrant; }
 404   bool  is_zombie() const                         { return _state == zombie; }


 420 
 421   void  make_unloaded(BoolObjectClosure* is_alive, oop cause);
 422 
 423   bool has_dependencies()                         { return dependencies_size() != 0; }
 424   void flush_dependencies(BoolObjectClosure* is_alive);
 425   bool has_flushed_dependencies()                 { return _has_flushed_dependencies; }
 426   void set_has_flushed_dependencies()             {
 427     assert(!has_flushed_dependencies(), "should only happen once");
 428     _has_flushed_dependencies = 1;
 429   }
 430 
 431   bool  is_marked_for_reclamation() const         { return _marked_for_reclamation; }
 432   void  mark_for_reclamation()                    { _marked_for_reclamation = 1; }
 433 
 434   bool  has_unsafe_access() const                 { return _has_unsafe_access; }
 435   void  set_has_unsafe_access(bool z)             { _has_unsafe_access = z; }
 436 
 437   bool  has_method_handle_invokes() const         { return _has_method_handle_invokes; }
 438   void  set_has_method_handle_invokes(bool z)     { _has_method_handle_invokes = z; }
 439 
 440   bool  is_speculatively_disconnected() const     { return _speculatively_disconnected; }
 441   void  set_speculatively_disconnected(bool z)    { _speculatively_disconnected = z; }
 442 
 443   bool  is_lazy_critical_native() const           { return _lazy_critical_native; }
 444   void  set_lazy_critical_native(bool z)          { _lazy_critical_native = z; }
 445 
 446   bool  has_wide_vectors() const                  { return _has_wide_vectors; }
 447   void  set_has_wide_vectors(bool z)              { _has_wide_vectors = z; }
 448 
 449   int   comp_level() const                        { return _comp_level; }
 450 
 451   // Support for oops in scopes and relocs:
 452   // Note: index 0 is reserved for null.
 453   oop   oop_at(int index) const                   { return index == 0 ? (oop) NULL: *oop_addr_at(index); }
 454   oop*  oop_addr_at(int index) const {  // for GC
 455     // relocation indexes are biased by 1 (because 0 is reserved)
 456     assert(index > 0 && index <= oops_size(), "must be a valid non-zero index");
 457     assert(!_oops_are_stale, "oops are stale");
 458     return &oops_begin()[index - 1];
 459   }
 460 
 461   // Support for meta data in scopes and relocs:
 462   // Note: index 0 is reserved for null.


 481   void verify_oop_relocations();
 482 
 483   bool is_at_poll_return(address pc);
 484   bool is_at_poll_or_poll_return(address pc);
 485 
 486   // Scavengable oop support
 487   bool  on_scavenge_root_list() const                  { return (_scavenge_root_state & 1) != 0; }
 488  protected:
 489   enum { sl_on_list = 0x01, sl_marked = 0x10 };
 490   void  set_on_scavenge_root_list()                    { _scavenge_root_state = sl_on_list; }
 491   void  clear_on_scavenge_root_list()                  { _scavenge_root_state = 0; }
 492   // assertion-checking and pruning logic uses the bits of _scavenge_root_state
 493 #ifndef PRODUCT
 494   void  set_scavenge_root_marked()                     { _scavenge_root_state |= sl_marked; }
 495   void  clear_scavenge_root_marked()                   { _scavenge_root_state &= ~sl_marked; }
 496   bool  scavenge_root_not_marked()                     { return (_scavenge_root_state &~ sl_on_list) == 0; }
 497   // N.B. there is no positive marked query, and we only use the not_marked query for asserts.
 498 #endif //PRODUCT
 499   nmethod* scavenge_root_link() const                  { return _scavenge_root_link; }
 500   void     set_scavenge_root_link(nmethod *n)          { _scavenge_root_link = n; }
 501 
 502   nmethod* saved_nmethod_link() const                  { return _saved_nmethod_link; }
 503   void     set_saved_nmethod_link(nmethod *n)          { _saved_nmethod_link = n; }
 504 
 505  public:
 506 
 507   // Sweeper support
 508   long  stack_traversal_mark()                    { return _stack_traversal_mark; }
 509   void  set_stack_traversal_mark(long l)          { _stack_traversal_mark = l; }
 510 
 511   // Exception cache support
 512   ExceptionCache* exception_cache() const         { return _exception_cache; }
 513   void set_exception_cache(ExceptionCache *ec)    { _exception_cache = ec; }
 514   address handler_for_exception_and_pc(Handle exception, address pc);
 515   void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
 516   void remove_from_exception_cache(ExceptionCache* ec);
 517 
 518   // implicit exceptions support
 519   address continuation_for_implicit_exception(address pc);
 520 
 521   // On-stack replacement support
 522   int   osr_entry_bci() const                     { assert(is_osr_method(), "wrong kind of nmethod"); return _entry_bci; }
 523   address  osr_entry() const                      { assert(is_osr_method(), "wrong kind of nmethod"); return _osr_entry_point; }




 102 
 103 class Dependencies;
 104 class ExceptionHandlerTable;
 105 class ImplicitExceptionTable;
 106 class AbstractCompiler;
 107 class xmlStream;
 108 
 109 class nmethod : public CodeBlob {
 110   friend class VMStructs;
 111   friend class NMethodSweeper;
 112   friend class CodeCache;  // scavengable oops
 113  private:
 114   // Shared fields for all nmethod's
 115   Method*   _method;
 116   int       _entry_bci;        // != InvocationEntryBci if this nmethod is an on-stack replacement method
 117   jmethodID _jmethod_id;       // Cache of method()->jmethod_id()
 118 
 119   // To support simple linked-list chaining of nmethods:
 120   nmethod*  _osr_link;         // from InstanceKlass::osr_nmethods_head
 121   nmethod*  _scavenge_root_link; // from CodeCache::scavenge_root_nmethods

 122 
 123   static nmethod* volatile _oops_do_mark_nmethods;
 124   nmethod*        volatile _oops_do_mark_link;
 125 
 126   AbstractCompiler* _compiler; // The compiler which compiled this nmethod
 127 
 128   // offsets for entry points
 129   address _entry_point;                      // entry point with class check
 130   address _verified_entry_point;             // entry point without class check
 131   address _osr_entry_point;                  // entry point for on stack replacement
 132 
 133   // Offsets for different nmethod parts
 134   int _exception_offset;
 135   // All deoptee's will resume execution at this location described by
 136   // this offset.
 137   int _deoptimize_offset;
 138   // All deoptee's at a MethodHandle call site will resume execution
 139   // at this location described by this offset.
 140   int _deoptimize_mh_offset;
 141   // Offset of the unwind handler if it exists


 147   int _consts_offset;
 148   int _stub_offset;
 149   int _oops_offset;                       // offset to where embedded oop table begins (inside data)
 150   int _metadata_offset;                   // embedded meta data table
 151   int _scopes_data_offset;
 152   int _scopes_pcs_offset;
 153   int _dependencies_offset;
 154   int _handler_table_offset;
 155   int _nul_chk_table_offset;
 156   int _nmethod_end_offset;
 157 
 158   // location in frame (offset for sp) that deopt can store the original
 159   // pc during a deopt.
 160   int _orig_pc_offset;
 161 
 162   int _compile_id;                           // which compilation made this nmethod
 163   int _comp_level;                           // compilation level
 164 
 165   // protected by CodeCache_lock
 166   bool _has_flushed_dependencies;            // Used for maintenance of dependencies (CodeCache_lock)

 167 
 168   bool _marked_for_reclamation;              // Used by NMethodSweeper (set only by sweeper)
 169   bool _marked_for_deoptimization;           // Used for stack deoptimization
 170 
 171   // used by jvmti to track if an unload event has been posted for this nmethod.
 172   bool _unload_reported;
 173 
 174   // set during construction
 175   unsigned int _has_unsafe_access:1;         // May fault due to unsafe access.
 176   unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes?
 177   unsigned int _lazy_critical_native:1;      // Lazy JNI critical native
 178   unsigned int _has_wide_vectors:1;          // Preserve wide vectors at safepoints
 179 
 180   // Protected by Patching_lock
 181   unsigned char _state;                      // {alive, not_entrant, zombie, unloaded}
 182 
 183 #ifdef ASSERT
 184   bool _oops_are_stale;  // indicates that it's no longer safe to access oops section
 185 #endif
 186 
 187   enum { alive        = 0,
 188          not_entrant  = 1, // uncommon trap has happened but activations may still exist
 189          zombie       = 2,
 190          unloaded     = 3 };
 191 
 192 
 193   jbyte _scavenge_root_state;
 194 
 195   // Nmethod Flushing lock. If non-zero, then the nmethod is not removed
 196   // and is not made into a zombie. However, once the nmethod is made into
 197   // a zombie, it will be locked one final time if CompiledMethodUnload
 198   // event processing needs to be done.
 199   jint  _lock_count;
 200 
 201   // not_entrant method removal. Each mark_sweep pass will update
 202   // this mark to current sweep invocation count if it is seen on the
 203   // stack.  An not_entrant method can be removed when there are no
 204   // more activations, i.e., when the _stack_traversal_mark is less than
 205   // current sweep traversal index.
 206   long _stack_traversal_mark;
 207 
 208   // The _hotness_counter indicates the hotness of a method. The higher
 209   // the value the hotter the method. The hotness counter of a nmethod is
 210   // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method
 211   // is active while stack scanning (mark_active_nmethods()). The hotness
 212   // counter is decreased (by 1) while sweeping.
 213   int _hotness_counter;
 214 
 215   ExceptionCache *_exception_cache;
 216   PcDescCache     _pc_desc_cache;
 217 
 218   // These are used for compiled synchronized native methods to
 219   // locate the owner and stack slot for the BasicLock so that we can
 220   // properly revoke the bias of the owner if necessary. They are
 221   // needed because there is no debug information for compiled native
 222   // wrappers and the oop maps are insufficient to allow
 223   // frame::retrieve_receiver() to work. Currently they are expected
 224   // to be byte offsets from the Java stack pointer for maximum code
 225   // sharing between platforms. Note that currently biased locking
 226   // will never cause Class instances to be biased but this code
 227   // handles the static synchronized case as well.
 228   // JVMTI's GetLocalInstance() also uses these offsets to find the receiver
 229   // for non-static native wrapper frames.
 230   ByteSize _native_receiver_sp_offset;
 231   ByteSize _native_basic_lock_sp_offset;
 232 
 233   friend class nmethodLocker;
 234 


 370   address dependencies_end      () const          { return           header_begin() + _handler_table_offset ; }
 371   address handler_table_begin   () const          { return           header_begin() + _handler_table_offset ; }
 372   address handler_table_end     () const          { return           header_begin() + _nul_chk_table_offset ; }
 373   address nul_chk_table_begin   () const          { return           header_begin() + _nul_chk_table_offset ; }
 374   address nul_chk_table_end     () const          { return           header_begin() + _nmethod_end_offset   ; }
 375 
 376   // Sizes
 377   int consts_size       () const                  { return            consts_end       () -            consts_begin       (); }
 378   int insts_size        () const                  { return            insts_end        () -            insts_begin        (); }
 379   int stub_size         () const                  { return            stub_end         () -            stub_begin         (); }
 380   int oops_size         () const                  { return (address)  oops_end         () - (address)  oops_begin         (); }
 381   int metadata_size     () const                  { return (address)  metadata_end     () - (address)  metadata_begin     (); }
 382   int scopes_data_size  () const                  { return            scopes_data_end  () -            scopes_data_begin  (); }
 383   int scopes_pcs_size   () const                  { return (intptr_t) scopes_pcs_end   () - (intptr_t) scopes_pcs_begin   (); }
 384   int dependencies_size () const                  { return            dependencies_end () -            dependencies_begin (); }
 385   int handler_table_size() const                  { return            handler_table_end() -            handler_table_begin(); }
 386   int nul_chk_table_size() const                  { return            nul_chk_table_end() -            nul_chk_table_begin(); }
 387 
 388   int total_size        () const;
 389 
 390   void dec_hotness_counter()        { _hotness_counter--; }
 391   void set_hotness_counter(int val) { _hotness_counter = val; }
 392   int  hotness_counter() const      { return _hotness_counter; }
 393 
 394   // Containment
 395   bool consts_contains       (address addr) const { return consts_begin       () <= addr && addr < consts_end       (); }
 396   bool insts_contains        (address addr) const { return insts_begin        () <= addr && addr < insts_end        (); }
 397   bool stub_contains         (address addr) const { return stub_begin         () <= addr && addr < stub_end         (); }
 398   bool oops_contains         (oop*    addr) const { return oops_begin         () <= addr && addr < oops_end         (); }
 399   bool metadata_contains     (Metadata** addr) const   { return metadata_begin     () <= addr && addr < metadata_end     (); }
 400   bool scopes_data_contains  (address addr) const { return scopes_data_begin  () <= addr && addr < scopes_data_end  (); }
 401   bool scopes_pcs_contains   (PcDesc* addr) const { return scopes_pcs_begin   () <= addr && addr < scopes_pcs_end   (); }
 402   bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
 403   bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); }
 404 
 405   // entry points
 406   address entry_point() const                     { return _entry_point;             } // normal entry point
 407   address verified_entry_point() const            { return _verified_entry_point;    } // if klass is correct
 408 
 409   // flag accessing and manipulation
 410   bool  is_in_use() const                         { return _state == alive; }
 411   bool  is_alive() const                          { return _state == alive || _state == not_entrant; }
 412   bool  is_not_entrant() const                    { return _state == not_entrant; }
 413   bool  is_zombie() const                         { return _state == zombie; }


 429 
 430   void  make_unloaded(BoolObjectClosure* is_alive, oop cause);
 431 
 432   bool has_dependencies()                         { return dependencies_size() != 0; }
 433   void flush_dependencies(BoolObjectClosure* is_alive);
 434   bool has_flushed_dependencies()                 { return _has_flushed_dependencies; }
 435   void set_has_flushed_dependencies()             {
 436     assert(!has_flushed_dependencies(), "should only happen once");
 437     _has_flushed_dependencies = 1;
 438   }
 439 
 440   bool  is_marked_for_reclamation() const         { return _marked_for_reclamation; }
 441   void  mark_for_reclamation()                    { _marked_for_reclamation = 1; }
 442 
 443   bool  has_unsafe_access() const                 { return _has_unsafe_access; }
 444   void  set_has_unsafe_access(bool z)             { _has_unsafe_access = z; }
 445 
 446   bool  has_method_handle_invokes() const         { return _has_method_handle_invokes; }
 447   void  set_has_method_handle_invokes(bool z)     { _has_method_handle_invokes = z; }
 448 



 449   bool  is_lazy_critical_native() const           { return _lazy_critical_native; }
 450   void  set_lazy_critical_native(bool z)          { _lazy_critical_native = z; }
 451 
 452   bool  has_wide_vectors() const                  { return _has_wide_vectors; }
 453   void  set_has_wide_vectors(bool z)              { _has_wide_vectors = z; }
 454 
 455   int   comp_level() const                        { return _comp_level; }
 456 
 457   // Support for oops in scopes and relocs:
 458   // Note: index 0 is reserved for null.
 459   oop   oop_at(int index) const                   { return index == 0 ? (oop) NULL: *oop_addr_at(index); }
 460   oop*  oop_addr_at(int index) const {  // for GC
 461     // relocation indexes are biased by 1 (because 0 is reserved)
 462     assert(index > 0 && index <= oops_size(), "must be a valid non-zero index");
 463     assert(!_oops_are_stale, "oops are stale");
 464     return &oops_begin()[index - 1];
 465   }
 466 
 467   // Support for meta data in scopes and relocs:
 468   // Note: index 0 is reserved for null.


 487   void verify_oop_relocations();
 488 
 489   bool is_at_poll_return(address pc);
 490   bool is_at_poll_or_poll_return(address pc);
 491 
 492   // Scavengable oop support
 493   bool  on_scavenge_root_list() const                  { return (_scavenge_root_state & 1) != 0; }
 494  protected:
 495   enum { sl_on_list = 0x01, sl_marked = 0x10 };
 496   void  set_on_scavenge_root_list()                    { _scavenge_root_state = sl_on_list; }
 497   void  clear_on_scavenge_root_list()                  { _scavenge_root_state = 0; }
 498   // assertion-checking and pruning logic uses the bits of _scavenge_root_state
 499 #ifndef PRODUCT
 500   void  set_scavenge_root_marked()                     { _scavenge_root_state |= sl_marked; }
 501   void  clear_scavenge_root_marked()                   { _scavenge_root_state &= ~sl_marked; }
 502   bool  scavenge_root_not_marked()                     { return (_scavenge_root_state &~ sl_on_list) == 0; }
 503   // N.B. there is no positive marked query, and we only use the not_marked query for asserts.
 504 #endif //PRODUCT
 505   nmethod* scavenge_root_link() const                  { return _scavenge_root_link; }
 506   void     set_scavenge_root_link(nmethod *n)          { _scavenge_root_link = n; }



 507 
 508  public:
 509 
 510   // Sweeper support
 511   long  stack_traversal_mark()                    { return _stack_traversal_mark; }
 512   void  set_stack_traversal_mark(long l)          { _stack_traversal_mark = l; }
 513 
 514   // Exception cache support
 515   ExceptionCache* exception_cache() const         { return _exception_cache; }
 516   void set_exception_cache(ExceptionCache *ec)    { _exception_cache = ec; }
 517   address handler_for_exception_and_pc(Handle exception, address pc);
 518   void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
 519   void remove_from_exception_cache(ExceptionCache* ec);
 520 
 521   // implicit exceptions support
 522   address continuation_for_implicit_exception(address pc);
 523 
 524   // On-stack replacement support
 525   int   osr_entry_bci() const                     { assert(is_osr_method(), "wrong kind of nmethod"); return _entry_bci; }
 526   address  osr_entry() const                      { assert(is_osr_method(), "wrong kind of nmethod"); return _osr_entry_point; }