Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/code/relocInfo.hpp
          +++ new/src/share/vm/code/relocInfo.hpp
↓ open down ↓ 504 lines elided ↑ open up ↑
 505  505    enum { SECT_CONSTS = 2,
 506  506           SECT_LIMIT = 3 };  // must be equal to CodeBuffer::SECT_LIMIT
 507  507    friend class Relocation;
 508  508    friend class relocInfo;       // for change_reloc_info_for_address only
 509  509    typedef relocInfo::relocType relocType;
 510  510  
 511  511   private:
 512  512    address    _limit;   // stop producing relocations after this _addr
 513  513    relocInfo* _current; // the current relocation information
 514  514    relocInfo* _end;     // end marker; we're done iterating when _current == _end
 515      -  CodeBlob*  _code;    // compiled method containing _addr
      515 +  nmethod*   _code;    // compiled method containing _addr
 516  516    address    _addr;    // instruction to which the relocation applies
 517  517    short      _databuf; // spare buffer for compressed data
 518  518    short*     _data;    // pointer to the relocation's data
 519  519    short      _datalen; // number of halfwords in _data
 520  520    char       _format;  // position within the instruction
 521  521  
 522  522    // Base addresses needed to compute targets of section_word_type relocs.
 523  523    address    _section_start[SECT_LIMIT];
 524  524  
 525  525    void set_has_current(bool b) {
↓ open down ↓ 16 lines elided ↑ open up ↑
 542  542  
 543  543    void initialize_misc() {
 544  544      set_has_current(false);
 545  545      for (int i = 0; i < SECT_LIMIT; i++) {
 546  546        _section_start[i] = NULL;  // these will be lazily computed, if needed
 547  547      }
 548  548    }
 549  549  
 550  550    address compute_section_start(int n) const;  // out-of-line helper
 551  551  
 552      -  void initialize(CodeBlob* nm, address begin, address limit);
      552 +  void initialize(nmethod* nm, address begin, address limit);
 553  553  
 554  554    friend class PatchingRelocIterator;
 555  555    // make an uninitialized one, for PatchingRelocIterator:
 556  556    RelocIterator() { initialize_misc(); }
 557  557  
 558  558   public:
 559  559    // constructor
 560      -  RelocIterator(CodeBlob* cb,    address begin = NULL, address limit = NULL);
      560 +  RelocIterator(nmethod* nm,     address begin = NULL, address limit = NULL);
 561  561    RelocIterator(CodeSection* cb, address begin = NULL, address limit = NULL);
 562  562  
 563  563    // get next reloc info, return !eos
 564  564    bool next() {
 565  565      _current++;
 566  566      assert(_current <= _end, "must not overrun relocInfo");
 567  567      if (_current == _end) {
 568  568        set_has_current(false);
 569  569        return false;
 570  570      }
↓ open down ↓ 14 lines elided ↑ open up ↑
 585  585      if (relocInfo::have_format)  _format = current()->format();
 586  586      return true;
 587  587    }
 588  588  
 589  589    // accessors
 590  590    address      limit()        const { return _limit; }
 591  591    void     set_limit(address x);
 592  592    relocType    type()         const { return current()->type(); }
 593  593    int          format()       const { return (relocInfo::have_format) ? current()->format() : 0; }
 594  594    address      addr()         const { return _addr; }
 595      -  CodeBlob*    code()         const { return _code; }
      595 +  nmethod*     code()         const { return _code; }
 596  596    short*       data()         const { return _data; }
 597  597    int          datalen()      const { return _datalen; }
 598  598    bool     has_current()      const { return _datalen >= 0; }
 599  599  
 600  600    void       set_addr(address addr) { _addr = addr; }
 601  601    bool   addr_in_const()      const { return addr() >= section_start(SECT_CONSTS); }
 602  602  
 603  603    address section_start(int n) const {
 604  604      address res = _section_start[n];
 605  605      return (res != NULL) ? res : compute_section_start(n);
↓ open down ↓ 177 lines elided ↑ open up ↑
 783  783    static int32_t runtime_address_to_index(address runtime_address);
 784  784    static address index_to_runtime_address(int32_t index);
 785  785  
 786  786    // helpers for mapping between old and new addresses after a move or resize
 787  787    address old_addr_for(address newa, const CodeBuffer* src, CodeBuffer* dest);
 788  788    address new_addr_for(address olda, const CodeBuffer* src, CodeBuffer* dest);
 789  789    void normalize_address(address& addr, const CodeSection* dest, bool allow_other_sections = false);
 790  790  
 791  791   public:
 792  792    // accessors which only make sense for a bound Relocation
 793      -  address   addr()         const { return binding()->addr(); }
 794      -  CodeBlob* code()         const { return binding()->code(); }
 795      -  bool      addr_in_const() const { return binding()->addr_in_const(); }
      793 +  address  addr()         const { return binding()->addr(); }
      794 +  nmethod* code()         const { return binding()->code(); }
      795 +  bool     addr_in_const() const { return binding()->addr_in_const(); }
 796  796   protected:
 797  797    short*   data()         const { return binding()->data(); }
 798  798    int      datalen()      const { return binding()->datalen(); }
 799  799    int      format()       const { return binding()->format(); }
 800  800  
 801  801   public:
 802  802    virtual relocInfo::relocType type()            { return relocInfo::none; }
 803  803  
 804  804    // is it a call instruction?
 805  805    virtual bool is_call()                         { return false; }
↓ open down ↓ 169 lines elided ↑ open up ↑
 975  975    // oop_limit is set to 0 if the limit falls somewhere within the call.
 976  976    // When unpacking, a zero oop_limit is taken to refer to the end of the call.
 977  977    // (This has the effect of bringing in the call's delay slot on SPARC.)
 978  978    void pack_data_to(CodeSection* dest);
 979  979    void unpack_data();
 980  980  
 981  981    void clear_inline_cache();
 982  982  
 983  983    // Figure out where an ic_call is hiding, given a set-oop or call.
 984  984    // Either ic_call or first_oop must be non-null; the other is deduced.
 985      -  // Code if non-NULL must be the CodeBlob, else it is deduced.
      985 +  // Code if non-NULL must be the nmethod, else it is deduced.
 986  986    // The address of the patchable oop is also deduced.
 987  987    // The returned iterator will enumerate over the oops and the ic_call,
 988  988    // as well as any other relocations that happen to be in that span of code.
 989  989    // Recognize relevant set_oops with:  oop_reloc()->oop_addr() == oop_addr.
 990      -  static RelocIterator parse_ic(CodeBlob* &code, address &ic_call, address &first_oop, oop* &oop_addr, bool *is_optimized);
      990 +  static RelocIterator parse_ic(nmethod* &nm, address &ic_call, address &first_oop, oop* &oop_addr, bool *is_optimized);
 991  991  };
 992  992  
 993  993  
 994  994  class opt_virtual_call_Relocation : public CallRelocation {
 995  995    relocInfo::relocType type() { return relocInfo::opt_virtual_call_type; }
 996  996  
 997  997   public:
 998  998    static RelocationHolder spec() {
 999  999      RelocationHolder rh = newHolder();
1000 1000      new(rh) opt_virtual_call_Relocation();
↓ open down ↓ 296 lines elided ↑ open up ↑
1297 1297    /* The purpose of the placed "new" is to re-use the same */   \
1298 1298    /* stack storage for each new iteration. */                   \
1299 1299    name##_Relocation* r = new(_rh) name##_Relocation();          \
1300 1300    r->set_binding(this);                                         \
1301 1301    r->name##_Relocation::unpack_data();                          \
1302 1302    return r;                                                     \
1303 1303  }
1304 1304  APPLY_TO_RELOCATIONS(EACH_CASE);
1305 1305  #undef EACH_CASE
1306 1306  
1307      -inline RelocIterator::RelocIterator(CodeBlob* cb, address begin, address limit) {
1308      -  initialize(cb, begin, limit);
     1307 +inline RelocIterator::RelocIterator(nmethod* nm, address begin, address limit) {
     1308 +  initialize(nm, begin, limit);
1309 1309  }
1310 1310  
1311 1311  // if you are going to patch code, you should use this subclass of
1312 1312  // RelocIterator
1313 1313  class PatchingRelocIterator : public RelocIterator {
1314 1314   private:
1315 1315    RelocIterator _init_state;
1316 1316  
1317 1317    void prepass();               // deactivates all breakpoints
1318 1318    void postpass();              // reactivates all enabled breakpoints
1319 1319  
1320 1320    // do not copy these puppies; it would have unpredictable side effects
1321 1321    // these are private and have no bodies defined because they should not be called
1322 1322    PatchingRelocIterator(const RelocIterator&);
1323 1323    void        operator=(const RelocIterator&);
1324 1324  
1325 1325   public:
1326      -  PatchingRelocIterator(CodeBlob* cb, address begin =NULL, address limit =NULL)
1327      -    : RelocIterator(cb, begin, limit)                { prepass();  }
     1326 +  PatchingRelocIterator(nmethod* nm, address begin = NULL, address limit = NULL)
     1327 +    : RelocIterator(nm, begin, limit)                { prepass();  }
1328 1328  
1329 1329    ~PatchingRelocIterator()                           { postpass(); }
1330 1330  };
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX