< prev index next >

src/hotspot/share/code/relocInfo.hpp

Print this page

 630     if (_limit != nullptr && _addr >= _limit) {
 631       set_has_current(false);
 632       return false;
 633     }
 634 
 635     return true;
 636   }
 637 
 638   // accessors
 639   address      limit()        const { return _limit; }
 640   relocType    type()         const { return current()->type(); }
 641   int          format()       const { return (relocInfo::have_format) ? current()->format() : 0; }
 642   address      addr()         const { return _addr; }
 643   CompiledMethod*     code()  const { return _code; }
 644   short*       data()         const { return _data; }
 645   int          datalen()      const { return _datalen; }
 646   bool     has_current()      const { return _datalen >= 0; }
 647   bool   addr_in_const()      const;
 648 
 649   address section_start(int n) const {
 650     assert(_section_start[n], "must be initialized");
 651     return _section_start[n];
 652   }
 653   address section_end(int n) const {
 654     assert(_section_end[n], "must be initialized");
 655     return _section_end[n];
 656   }
 657 
 658   // The address points to the affected displacement part of the instruction.
 659   // For RISC, this is just the whole instruction.
 660   // For Intel, this is an unaligned 32-bit word.
 661 
 662   // type-specific relocation accessors:  oop_Relocation* oop_reloc(), etc.
 663   #define EACH_TYPE(name)                               \
 664   inline name##_Relocation* name##_reloc();
 665   APPLY_TO_RELOCATIONS(EACH_TYPE)
 666   #undef EACH_TYPE
 667   // generic relocation accessor; switches on type to call the above
 668   Relocation* reloc();
 669 
 670 #ifndef PRODUCT
 671  public:
 672   void print();
 673   void print_current();
 674 #endif

1295 
1296   void copy_into(RelocationHolder& holder) const override;
1297 
1298  private:
1299   address _owner;    // Address of the NativeCall that owns the trampoline.
1300 
1301   trampoline_stub_Relocation(address owner)
1302     : Relocation(relocInfo::trampoline_stub_type),
1303       _owner(owner) { }
1304 
1305   friend class RelocationHolder;
1306   trampoline_stub_Relocation() : Relocation(relocInfo::trampoline_stub_type) { }
1307 
1308  public:
1309 
1310   // Return the address of the NativeCall that owns the trampoline.
1311   address owner() { return _owner; }
1312 
1313   void pack_data_to(CodeSection * dest) override;
1314   void unpack_data() override;



















1315 
1316   // Find the trampoline stub for a call.
1317   static address get_trampoline_for(address call, nmethod* code);
1318 };
1319 
1320 class external_word_Relocation : public DataRelocation {
1321  public:
1322   static RelocationHolder spec(address target) {
1323     assert(target != nullptr, "must not be null");
1324     return RelocationHolder::construct<external_word_Relocation>(target);
1325   }
1326 
1327   // Use this one where all 32/64 bits of the target live in the code stream.
1328   // The target must be an intptr_t, and must be absolute (not relative).
1329   static RelocationHolder spec_for_immediate() {
1330     return RelocationHolder::construct<external_word_Relocation>(nullptr);
1331   }
1332 
1333   void copy_into(RelocationHolder& holder) const override;
1334 

1339     return target != nullptr;
1340   }
1341 
1342  private:
1343   address _target;                  // address in runtime
1344 
1345   external_word_Relocation(address target)
1346     : DataRelocation(relocInfo::external_word_type), _target(target) { }
1347 
1348   friend class RelocationHolder;
1349   external_word_Relocation() : DataRelocation(relocInfo::external_word_type) { }
1350 
1351  public:
1352   // data is packed as a well-known address in "1_int" format:  [a] or [Aa]
1353   // The function runtime_address_to_index is used to turn full addresses
1354   // to short indexes, if they are pre-registered by the stub mechanism.
1355   // If the "a" value is 0 (i.e., _target is nullptr), the address is stored
1356   // in the code stream.  See external_word_Relocation::target().
1357   void pack_data_to(CodeSection* dest) override;
1358   void unpack_data() override;

1359 
1360   void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) override;
1361   address  target();        // if _target==nullptr, fetch addr from code stream
1362   address  value() override { return target(); }
1363 };
1364 
1365 class internal_word_Relocation : public DataRelocation {
1366 
1367  public:
1368   static RelocationHolder spec(address target) {
1369     assert(target != nullptr, "must not be null");
1370     return RelocationHolder::construct<internal_word_Relocation>(target);
1371   }
1372 
1373   // use this one where all the bits of the target can fit in the code stream:
1374   static RelocationHolder spec_for_immediate() {
1375     return RelocationHolder::construct<internal_word_Relocation>(nullptr);
1376   }
1377 
1378   void copy_into(RelocationHolder& holder) const override;

 630     if (_limit != nullptr && _addr >= _limit) {
 631       set_has_current(false);
 632       return false;
 633     }
 634 
 635     return true;
 636   }
 637 
 638   // accessors
 639   address      limit()        const { return _limit; }
 640   relocType    type()         const { return current()->type(); }
 641   int          format()       const { return (relocInfo::have_format) ? current()->format() : 0; }
 642   address      addr()         const { return _addr; }
 643   CompiledMethod*     code()  const { return _code; }
 644   short*       data()         const { return _data; }
 645   int          datalen()      const { return _datalen; }
 646   bool     has_current()      const { return _datalen >= 0; }
 647   bool   addr_in_const()      const;
 648 
 649   address section_start(int n) const {
 650     assert(_section_start[n], "section %d must be initialized", n);
 651     return _section_start[n];
 652   }
 653   address section_end(int n) const {
 654     assert(_section_end[n], "section %d must be initialized", n);
 655     return _section_end[n];
 656   }
 657 
 658   // The address points to the affected displacement part of the instruction.
 659   // For RISC, this is just the whole instruction.
 660   // For Intel, this is an unaligned 32-bit word.
 661 
 662   // type-specific relocation accessors:  oop_Relocation* oop_reloc(), etc.
 663   #define EACH_TYPE(name)                               \
 664   inline name##_Relocation* name##_reloc();
 665   APPLY_TO_RELOCATIONS(EACH_TYPE)
 666   #undef EACH_TYPE
 667   // generic relocation accessor; switches on type to call the above
 668   Relocation* reloc();
 669 
 670 #ifndef PRODUCT
 671  public:
 672   void print();
 673   void print_current();
 674 #endif

1295 
1296   void copy_into(RelocationHolder& holder) const override;
1297 
1298  private:
1299   address _owner;    // Address of the NativeCall that owns the trampoline.
1300 
1301   trampoline_stub_Relocation(address owner)
1302     : Relocation(relocInfo::trampoline_stub_type),
1303       _owner(owner) { }
1304 
1305   friend class RelocationHolder;
1306   trampoline_stub_Relocation() : Relocation(relocInfo::trampoline_stub_type) { }
1307 
1308  public:
1309 
1310   // Return the address of the NativeCall that owns the trampoline.
1311   address owner() { return _owner; }
1312 
1313   void pack_data_to(CodeSection * dest) override;
1314   void unpack_data() override;
1315 #if defined(AARCH64)
1316   address    pd_destination     ();
1317   void       pd_set_destination (address x);
1318 #endif
1319   address  destination() {
1320 #if defined(AARCH64)
1321     return pd_destination();
1322 #else
1323     fatal("trampoline_stub_Relocation::destination() unimplemented");
1324     return (address)-1;
1325 #endif
1326   }
1327   void     set_destination(address x) {
1328 #if defined(AARCH64)
1329     pd_set_destination(x);
1330 #else
1331     fatal("trampoline_stub_Relocation::set_destination() unimplemented");
1332 #endif
1333   }
1334 
1335   // Find the trampoline stub for a call.
1336   static address get_trampoline_for(address call, nmethod* code);
1337 };
1338 
1339 class external_word_Relocation : public DataRelocation {
1340  public:
1341   static RelocationHolder spec(address target) {
1342     assert(target != nullptr, "must not be null");
1343     return RelocationHolder::construct<external_word_Relocation>(target);
1344   }
1345 
1346   // Use this one where all 32/64 bits of the target live in the code stream.
1347   // The target must be an intptr_t, and must be absolute (not relative).
1348   static RelocationHolder spec_for_immediate() {
1349     return RelocationHolder::construct<external_word_Relocation>(nullptr);
1350   }
1351 
1352   void copy_into(RelocationHolder& holder) const override;
1353 

1358     return target != nullptr;
1359   }
1360 
1361  private:
1362   address _target;                  // address in runtime
1363 
1364   external_word_Relocation(address target)
1365     : DataRelocation(relocInfo::external_word_type), _target(target) { }
1366 
1367   friend class RelocationHolder;
1368   external_word_Relocation() : DataRelocation(relocInfo::external_word_type) { }
1369 
1370  public:
1371   // data is packed as a well-known address in "1_int" format:  [a] or [Aa]
1372   // The function runtime_address_to_index is used to turn full addresses
1373   // to short indexes, if they are pre-registered by the stub mechanism.
1374   // If the "a" value is 0 (i.e., _target is nullptr), the address is stored
1375   // in the code stream.  See external_word_Relocation::target().
1376   void pack_data_to(CodeSection* dest) override;
1377   void unpack_data() override;
1378   short* pack_data_to(short* p); // Pack address into buffer
1379 
1380   void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) override;
1381   address  target();        // if _target==nullptr, fetch addr from code stream
1382   address  value() override { return target(); }
1383 };
1384 
1385 class internal_word_Relocation : public DataRelocation {
1386 
1387  public:
1388   static RelocationHolder spec(address target) {
1389     assert(target != nullptr, "must not be null");
1390     return RelocationHolder::construct<internal_word_Relocation>(target);
1391   }
1392 
1393   // use this one where all the bits of the target can fit in the code stream:
1394   static RelocationHolder spec_for_immediate() {
1395     return RelocationHolder::construct<internal_word_Relocation>(nullptr);
1396   }
1397 
1398   void copy_into(RelocationHolder& holder) const override;
< prev index next >