8299191: Unnecessarily global friend functions for relocInfo

Reviewed-by: chagedorn, kvn
This commit is contained in:
Kim Barrett 2022-12-22 17:30:09 +00:00
parent a3693ccc61
commit 62a033ecd7
3 changed files with 11 additions and 18 deletions

@ -348,8 +348,8 @@ void CodeSection::relocate(address at, RelocationHolder const& spec, int format)
// each carrying the largest possible offset, to advance the locs_point.
while (offset >= relocInfo::offset_limit()) {
assert(end < locs_limit(), "adjust previous paragraph of code");
*end++ = filler_relocInfo();
offset -= filler_relocInfo().addr_offset();
*end++ = relocInfo::filler_info();
offset -= relocInfo::filler_info().addr_offset();
}
// If it's a simple reloc with no data, we'll just write (rtype | offset).
@ -634,7 +634,7 @@ csize_t CodeBuffer::copy_relocations_to(address buf, csize_t buf_limit, bool onl
code_point_so_far < new_code_point;
code_point_so_far += jump) {
jump = new_code_point - code_point_so_far;
relocInfo filler = filler_relocInfo();
relocInfo filler = relocInfo::filler_info();
if (jump >= filler.addr_offset()) {
jump = filler.addr_offset();
} else { // else shrink the filler to fit

@ -86,7 +86,7 @@ relocInfo* relocInfo::finish_prefix(short* prefix_limit) {
return this+1;
}
// cannot compact, so just update the count and return the limit pointer
(*this) = prefix_relocInfo(plen); // write new datalen
(*this) = prefix_info(plen); // write new datalen
assert(data() + datalen() == prefix_limit, "pointers must line up");
return (relocInfo*)prefix_limit;
}

@ -368,7 +368,9 @@ class relocInfo {
// - to pad out the relocInfo array to the required oop alignment
// - to disable old relocation information which is no longer applicable
inline friend relocInfo filler_relocInfo();
static relocInfo filler_info() {
return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit);
}
// Every non-prefix relocation may be preceded by at most one prefix,
// which supplies 1 or more halfwords of associated data. Conventionally,
@ -378,7 +380,10 @@ class relocInfo {
// "immediate" in the prefix header word itself. This optimization
// is invisible outside this module.)
inline friend relocInfo prefix_relocInfo(int datalen);
static relocInfo prefix_info(int datalen = 0) {
assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");
return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);
}
private:
// an immediate relocInfo optimizes a prefix with one 10-bit unsigned value
@ -456,18 +461,6 @@ class name##_Relocation;
APPLY_TO_RELOCATIONS(FORWARD_DECLARE_EACH_CLASS)
#undef FORWARD_DECLARE_EACH_CLASS
inline relocInfo filler_relocInfo() {
return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit);
}
inline relocInfo prefix_relocInfo(int datalen = 0) {
assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");
return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);
}
// Holder for flyweight relocation objects.
// Although the flyweight subclasses are of varying sizes,
// the holder is "one size fits all".