src/share/vm/code/nmethod.hpp

changeset 1918
1a5913bf5e19
parent 1893
bfe29ec02863
child 1934
e9ff18c4ace7
     1.1 --- a/src/share/vm/code/nmethod.hpp	Thu May 20 01:34:22 2010 -0700
     1.2 +++ b/src/share/vm/code/nmethod.hpp	Thu May 20 06:34:23 2010 -0700
     1.3 @@ -105,6 +105,7 @@
     1.4  //  [Relocation]
     1.5  //  - relocation information
     1.6  //  - constant part          (doubles, longs and floats used in nmethod)
     1.7 +//  - oop table
     1.8  //  [Code]
     1.9  //  - code body
    1.10  //  - exception handler
    1.11 @@ -161,6 +162,7 @@
    1.12  #endif // def HAVE_DTRACE_H
    1.13    int _stub_offset;
    1.14    int _consts_offset;
    1.15 +  int _oops_offset;                       // offset to where embedded oop table begins (inside data)
    1.16    int _scopes_data_offset;
    1.17    int _scopes_pcs_offset;
    1.18    int _dependencies_offset;
    1.19 @@ -347,7 +349,10 @@
    1.20    address stub_begin            () const          { return           header_begin() + _stub_offset          ; }
    1.21    address stub_end              () const          { return           header_begin() + _consts_offset        ; }
    1.22    address consts_begin          () const          { return           header_begin() + _consts_offset        ; }
    1.23 -  address consts_end            () const          { return           header_begin() + _scopes_data_offset   ; }
    1.24 +  address consts_end            () const          { return           header_begin() + _oops_offset          ; }
    1.25 +  oop*    oops_begin            () const          { return (oop*)   (header_begin() + _oops_offset)         ; }
    1.26 +  oop*    oops_end              () const          { return (oop*)   (header_begin() + _scopes_data_offset)  ; }
    1.27 +
    1.28    address scopes_data_begin     () const          { return           header_begin() + _scopes_data_offset   ; }
    1.29    address scopes_data_end       () const          { return           header_begin() + _scopes_pcs_offset    ; }
    1.30    PcDesc* scopes_pcs_begin      () const          { return (PcDesc*)(header_begin() + _scopes_pcs_offset   ); }
    1.31 @@ -359,20 +364,24 @@
    1.32    address nul_chk_table_begin   () const          { return           header_begin() + _nul_chk_table_offset ; }
    1.33    address nul_chk_table_end     () const          { return           header_begin() + _nmethod_end_offset   ; }
    1.34  
    1.35 -  int code_size         () const                  { return      code_end         () -      code_begin         (); }
    1.36 -  int stub_size         () const                  { return      stub_end         () -      stub_begin         (); }
    1.37 -  int consts_size       () const                  { return      consts_end       () -      consts_begin       (); }
    1.38 -  int scopes_data_size  () const                  { return      scopes_data_end  () -      scopes_data_begin  (); }
    1.39 -  int scopes_pcs_size   () const                  { return (intptr_t)scopes_pcs_end   () - (intptr_t)scopes_pcs_begin   (); }
    1.40 -  int dependencies_size () const                  { return      dependencies_end () -      dependencies_begin (); }
    1.41 -  int handler_table_size() const                  { return      handler_table_end() -      handler_table_begin(); }
    1.42 -  int nul_chk_table_size() const                  { return      nul_chk_table_end() -      nul_chk_table_begin(); }
    1.43 +  // Sizes
    1.44 +  int code_size         () const                  { return            code_end         () -            code_begin         (); }
    1.45 +  int stub_size         () const                  { return            stub_end         () -            stub_begin         (); }
    1.46 +  int consts_size       () const                  { return            consts_end       () -            consts_begin       (); }
    1.47 +  int oops_size         () const                  { return (address)  oops_end         () - (address)  oops_begin         (); }
    1.48 +  int scopes_data_size  () const                  { return            scopes_data_end  () -            scopes_data_begin  (); }
    1.49 +  int scopes_pcs_size   () const                  { return (intptr_t) scopes_pcs_end   () - (intptr_t) scopes_pcs_begin   (); }
    1.50 +  int dependencies_size () const                  { return            dependencies_end () -            dependencies_begin (); }
    1.51 +  int handler_table_size() const                  { return            handler_table_end() -            handler_table_begin(); }
    1.52 +  int nul_chk_table_size() const                  { return            nul_chk_table_end() -            nul_chk_table_begin(); }
    1.53  
    1.54    int total_size        () const;
    1.55  
    1.56 +  // Containment
    1.57    bool code_contains         (address addr) const { return code_begin         () <= addr && addr < code_end         (); }
    1.58    bool stub_contains         (address addr) const { return stub_begin         () <= addr && addr < stub_end         (); }
    1.59    bool consts_contains       (address addr) const { return consts_begin       () <= addr && addr < consts_end       (); }
    1.60 +  bool oops_contains         (oop*    addr) const { return oops_begin         () <= addr && addr < oops_end         (); }
    1.61    bool scopes_data_contains  (address addr) const { return scopes_data_begin  () <= addr && addr < scopes_data_end  (); }
    1.62    bool scopes_pcs_contains   (PcDesc* addr) const { return scopes_pcs_begin   () <= addr && addr < scopes_pcs_end   (); }
    1.63    bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
    1.64 @@ -431,6 +440,29 @@
    1.65    int   version() const                           { return flags.version; }
    1.66    void  set_version(int v);
    1.67  
    1.68 +  // Support for oops in scopes and relocs:
    1.69 +  // Note: index 0 is reserved for null.
    1.70 +  oop   oop_at(int index) const                   { return index == 0 ? (oop) NULL: *oop_addr_at(index); }
    1.71 +  oop*  oop_addr_at(int index) const {  // for GC
    1.72 +    // relocation indexes are biased by 1 (because 0 is reserved)
    1.73 +    assert(index > 0 && index <= oops_size(), "must be a valid non-zero index");
    1.74 +    return &oops_begin()[index - 1];
    1.75 +  }
    1.76 +
    1.77 +  void copy_oops(GrowableArray<jobject>* oops);
    1.78 +
    1.79 +  // Relocation support
    1.80 +private:
    1.81 +  void fix_oop_relocations(address begin, address end, bool initialize_immediates);
    1.82 +  inline void initialize_immediate_oop(oop* dest, jobject handle);
    1.83 +
    1.84 +public:
    1.85 +  void fix_oop_relocations(address begin, address end) { fix_oop_relocations(begin, end, false); }
    1.86 +  void fix_oop_relocations()                           { fix_oop_relocations(NULL, NULL, false); }
    1.87 +
    1.88 +  bool is_at_poll_return(address pc);
    1.89 +  bool is_at_poll_or_poll_return(address pc);
    1.90 +
    1.91    // Non-perm oop support
    1.92    bool  on_scavenge_root_list() const                  { return (_scavenge_root_state & 1) != 0; }
    1.93   protected:
    1.94 @@ -511,8 +543,8 @@
    1.95  
    1.96    void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map,
    1.97                                       OopClosure* f);
    1.98 -  virtual void oops_do(OopClosure* f) { oops_do(f, false); }
    1.99 -  void         oops_do(OopClosure* f, bool do_strong_roots_only);
   1.100 +  void oops_do(OopClosure* f) { oops_do(f, false); }
   1.101 +  void oops_do(OopClosure* f, bool do_strong_roots_only);
   1.102    bool detect_scavenge_root_oops();
   1.103    void verify_scavenge_root_oops() PRODUCT_RETURN;
   1.104  

mercurial