8278036: Saving rscratch1 is optional in MacroAssembler::verify_heapbase

Reviewed-by: xliu, phh, coleenp
This commit is contained in:
Yi-Fan Tsai 2022-01-21 18:09:17 +00:00 committed by Paul Hohensee
parent 6287ae3707
commit 2920ce5487
2 changed files with 11 additions and 4 deletions

View File

@ -377,7 +377,7 @@ class AddressLiteral {
private:
address target() { return _target; }
bool is_lval() { return _is_lval; }
bool is_lval() const { return _is_lval; }
relocInfo::relocType reloc() const { return _rspec.type(); }
const RelocationHolder& rspec() const { return _rspec; }

View File

@ -4651,12 +4651,19 @@ void MacroAssembler::verify_heapbase(const char* msg) {
assert (Universe::heap() != NULL, "java heap should be initialized");
if (CheckCompressedOops) {
Label ok;
push(rscratch1); // cmpptr trashes rscratch1
cmpptr(r12_heapbase, ExternalAddress((address)CompressedOops::ptrs_base_addr()));
const auto src2 = ExternalAddress((address)CompressedOops::ptrs_base_addr());
assert(!src2.is_lval(), "should not be lval");
const bool is_src2_reachable = reachable(src2);
if (!is_src2_reachable) {
push(rscratch1); // cmpptr trashes rscratch1
}
cmpptr(r12_heapbase, src2);
jcc(Assembler::equal, ok);
STOP(msg);
bind(ok);
pop(rscratch1);
if (!is_src2_reachable) {
pop(rscratch1);
}
}
}
#endif