src/share/vm/code/nmethod.hpp

Print this page
rev 5099 : dummy


 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 


 364   address dependencies_begin    () const          { return           header_begin() + _dependencies_offset  ; }
 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; }




 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 are 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   // The _hotness_counter indicates the hotness of a method. The higher
 211   // the value the hotter the method. The hotness counter of a nmethod is
 212   // set to 100 each time the method is active while stack scanning. The
 213   // hotness counter is decreased (by 1) while sweeping.
 214   int _hotness_counter;
 215 
 216   ExceptionCache *_exception_cache;
 217   PcDescCache     _pc_desc_cache;
 218 
 219   // These are used for compiled synchronized native methods to
 220   // locate the owner and stack slot for the BasicLock so that we can
 221   // properly revoke the bias of the owner if necessary. They are
 222   // needed because there is no debug information for compiled native
 223   // wrappers and the oop maps are insufficient to allow
 224   // frame::retrieve_receiver() to work. Currently they are expected
 225   // to be byte offsets from the Java stack pointer for maximum code
 226   // sharing between platforms. Note that currently biased locking
 227   // will never cause Class instances to be biased but this code
 228   // handles the static synchronized case as well.
 229   // JVMTI's GetLocalInstance() also uses these offsets to find the receiver
 230   // for non-static native wrapper frames.
 231   ByteSize _native_receiver_sp_offset;
 232   ByteSize _native_basic_lock_sp_offset;
 233 
 234   friend class nmethodLocker;
 235 


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