475 return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit);
476 }
477
478 inline relocInfo prefix_relocInfo(int datalen = 0) {
479 assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");
480 return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);
481 }
482
483
484 // Holder for flyweight relocation objects.
485 // Although the flyweight subclasses are of varying sizes,
486 // the holder is "one size fits all".
487 class RelocationHolder VALUE_OBJ_CLASS_SPEC {
488 friend class Relocation;
489 friend class CodeSection;
490
491 private:
492 // this preallocated memory must accommodate all subclasses of Relocation
493 // (this number is assertion-checked in Relocation::operator new)
494 enum { _relocbuf_size = 5 };
495 void* _relocbuf[ _relocbuf_size ];
496
497 public:
498 Relocation* reloc() const { return (Relocation*) &_relocbuf[0]; }
499 inline relocInfo::relocType type() const;
500
501 // Add a constant offset to a relocation. Helper for class Address.
502 RelocationHolder plus(int offset) const;
503
504 inline RelocationHolder(); // initializes type to none
505
506 inline RelocationHolder(Relocation* r); // make a copy
507
508 static const RelocationHolder none;
509 };
510
511 // A RelocIterator iterates through the relocation information of a CodeBlob.
512 // It is a variable BoundRelocation which is able to take on successive
513 // values as it is advanced through a code stream.
514 // Usage:
515 // RelocIterator iter(nm);
|
475 return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit);
476 }
477
478 inline relocInfo prefix_relocInfo(int datalen = 0) {
479 assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");
480 return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);
481 }
482
483
484 // Holder for flyweight relocation objects.
485 // Although the flyweight subclasses are of varying sizes,
486 // the holder is "one size fits all".
487 class RelocationHolder VALUE_OBJ_CLASS_SPEC {
488 friend class Relocation;
489 friend class CodeSection;
490
491 private:
492 // this preallocated memory must accommodate all subclasses of Relocation
493 // (this number is assertion-checked in Relocation::operator new)
494 enum { _relocbuf_size = 5 };
495 void* _relocbuf[ _relocbuf_size ] = {0};
496
497 public:
498 Relocation* reloc() const { return (Relocation*) &_relocbuf[0]; }
499 inline relocInfo::relocType type() const;
500
501 // Add a constant offset to a relocation. Helper for class Address.
502 RelocationHolder plus(int offset) const;
503
504 inline RelocationHolder(); // initializes type to none
505
506 inline RelocationHolder(Relocation* r); // make a copy
507
508 static const RelocationHolder none;
509 };
510
511 // A RelocIterator iterates through the relocation information of a CodeBlob.
512 // It is a variable BoundRelocation which is able to take on successive
513 // values as it is advanced through a code stream.
514 // Usage:
515 // RelocIterator iter(nm);
|