< prev index next >

src/hotspot/share/code/relocInfo.hpp

Print this page

1269 
1270   void copy_into(RelocationHolder& holder) const override;
1271 
1272  private:
1273   address _owner;    // Address of the NativeCall that owns the trampoline.
1274 
1275   trampoline_stub_Relocation(address owner)
1276     : Relocation(relocInfo::trampoline_stub_type),
1277       _owner(owner) { }
1278 
1279   friend class RelocationHolder;
1280   trampoline_stub_Relocation() : Relocation(relocInfo::trampoline_stub_type) { }
1281 
1282  public:
1283 
1284   // Return the address of the NativeCall that owns the trampoline.
1285   address owner() { return _owner; }
1286 
1287   void pack_data_to(CodeSection * dest) override;
1288   void unpack_data() override;


















1289 
1290   // Find the trampoline stub for a call.
1291   static address get_trampoline_for(address call, nmethod* code);
1292 };
1293 
1294 class external_word_Relocation : public DataRelocation {
1295  public:
1296   static RelocationHolder spec(address target) {
1297     assert(target != nullptr, "must not be null");
1298     return RelocationHolder::construct<external_word_Relocation>(target);
1299   }
1300 
1301   // Use this one where all 32/64 bits of the target live in the code stream.
1302   // The target must be an intptr_t, and must be absolute (not relative).
1303   static RelocationHolder spec_for_immediate() {
1304     return RelocationHolder::construct<external_word_Relocation>(nullptr);
1305   }
1306 
1307   void copy_into(RelocationHolder& holder) const override;
1308 

1359  protected:
1360   address _target;                  // address in CodeBlob
1361   int     _section;                 // section providing base address, if any
1362 
1363   friend class RelocationHolder;
1364   internal_word_Relocation(relocInfo::relocType type = relocInfo::internal_word_type)
1365     : DataRelocation(type) { }
1366 
1367   // bit-width of LSB field in packed offset, if section >= 0
1368   enum { section_width = 2 }; // must equal CodeBuffer::sect_bits
1369 
1370  public:
1371   // data is packed as a scaled offset in "1_int" format:  [o] or [Oo]
1372   // If the "o" value is 0 (i.e., _target is nullptr), the offset is stored
1373   // in the code stream.  See internal_word_Relocation::target().
1374   // If _section is not -1, it is appended to the low bits of the offset.
1375   void pack_data_to(CodeSection* dest) override;
1376   void unpack_data() override;
1377 
1378   void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) override;
1379   void fix_relocation_after_aot_load(address orig_base_addr, address current_base_addr);
1380 
1381   address  target();        // if _target==nullptr, fetch addr from code stream
1382   int      section()        { return _section;   }
1383   address  value() override { return target();   }
1384 };
1385 
1386 class section_word_Relocation : public internal_word_Relocation {
1387  public:
1388   static RelocationHolder spec(address target, int section) {
1389     return RelocationHolder::construct<section_word_Relocation>(target, section);
1390   }
1391 
1392   void copy_into(RelocationHolder& holder) const override;
1393 
1394   section_word_Relocation(address target, int section)
1395     : internal_word_Relocation(target, section, relocInfo::section_word_type) {
1396     assert(target != nullptr, "must not be null");
1397     assert(section >= 0 && section < RelocIterator::SECT_LIMIT, "must be a valid section");
1398   }
1399 

1269 
1270   void copy_into(RelocationHolder& holder) const override;
1271 
1272  private:
1273   address _owner;    // Address of the NativeCall that owns the trampoline.
1274 
1275   trampoline_stub_Relocation(address owner)
1276     : Relocation(relocInfo::trampoline_stub_type),
1277       _owner(owner) { }
1278 
1279   friend class RelocationHolder;
1280   trampoline_stub_Relocation() : Relocation(relocInfo::trampoline_stub_type) { }
1281 
1282  public:
1283 
1284   // Return the address of the NativeCall that owns the trampoline.
1285   address owner() { return _owner; }
1286 
1287   void pack_data_to(CodeSection * dest) override;
1288   void unpack_data() override;
1289 #if defined(AARCH64) && !defined(ZERO)
1290   address pd_destination     ();
1291   void    pd_set_destination (address x);
1292 #else
1293   address pd_destination     () {
1294     fatal("trampoline_stub_Relocation::destination() unimplemented");
1295     return (address)-1;
1296   }
1297   void    pd_set_destination (address x) {
1298     fatal("trampoline_stub_Relocation::set_destination() unimplemented");
1299   }
1300 #endif
1301   address destination() {
1302     return pd_destination();
1303   }
1304   void    set_destination(address x) {
1305     pd_set_destination(x);
1306   }
1307 
1308   // Find the trampoline stub for a call.
1309   static address get_trampoline_for(address call, nmethod* code);
1310 };
1311 
1312 class external_word_Relocation : public DataRelocation {
1313  public:
1314   static RelocationHolder spec(address target) {
1315     assert(target != nullptr, "must not be null");
1316     return RelocationHolder::construct<external_word_Relocation>(target);
1317   }
1318 
1319   // Use this one where all 32/64 bits of the target live in the code stream.
1320   // The target must be an intptr_t, and must be absolute (not relative).
1321   static RelocationHolder spec_for_immediate() {
1322     return RelocationHolder::construct<external_word_Relocation>(nullptr);
1323   }
1324 
1325   void copy_into(RelocationHolder& holder) const override;
1326 

1377  protected:
1378   address _target;                  // address in CodeBlob
1379   int     _section;                 // section providing base address, if any
1380 
1381   friend class RelocationHolder;
1382   internal_word_Relocation(relocInfo::relocType type = relocInfo::internal_word_type)
1383     : DataRelocation(type) { }
1384 
1385   // bit-width of LSB field in packed offset, if section >= 0
1386   enum { section_width = 2 }; // must equal CodeBuffer::sect_bits
1387 
1388  public:
1389   // data is packed as a scaled offset in "1_int" format:  [o] or [Oo]
1390   // If the "o" value is 0 (i.e., _target is nullptr), the offset is stored
1391   // in the code stream.  See internal_word_Relocation::target().
1392   // If _section is not -1, it is appended to the low bits of the offset.
1393   void pack_data_to(CodeSection* dest) override;
1394   void unpack_data() override;
1395 
1396   void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) override;
1397   void fix_relocation_after_aot_load(address current_base_addr, int delta);
1398 
1399   address  target();        // if _target==nullptr, fetch addr from code stream
1400   int      section()        { return _section;   }
1401   address  value() override { return target();   }
1402 };
1403 
1404 class section_word_Relocation : public internal_word_Relocation {
1405  public:
1406   static RelocationHolder spec(address target, int section) {
1407     return RelocationHolder::construct<section_word_Relocation>(target, section);
1408   }
1409 
1410   void copy_into(RelocationHolder& holder) const override;
1411 
1412   section_word_Relocation(address target, int section)
1413     : internal_word_Relocation(target, section, relocInfo::section_word_type) {
1414     assert(target != nullptr, "must not be null");
1415     assert(section >= 0 && section < RelocIterator::SECT_LIMIT, "must be a valid section");
1416   }
1417 
< prev index next >