8384999: Rename CodeBuffer::last_insn() to something more descriptive

Reviewed-by: kvn, dlong
This commit is contained in:
Joel Sikström 2026-05-21 12:08:34 +00:00
parent 8549d18960
commit cbdf5f6f89
6 changed files with 21 additions and 21 deletions

View File

@ -2667,7 +2667,7 @@ int MacroAssembler::corrected_idivq(Register result, Register ra, Register rb,
void MacroAssembler::membar(Membar_mask_bits order_constraint) {
address prev = pc() - NativeMembar::instruction_size;
address last = code()->last_insn();
address last = code()->last_merge_candidate();
if (last != nullptr && nativeInstruction_at(last)->is_Membar() && prev == last) {
NativeMembar *bar = NativeMembar_at(prev);
if (AlwaysMergeDMB) {
@ -2699,21 +2699,21 @@ void MacroAssembler::membar(Membar_mask_bits order_constraint) {
}
}
}
code()->set_last_insn(pc());
code()->set_last_merge_candidate(pc());
dmb(Assembler::barrier(order_constraint));
}
bool MacroAssembler::try_merge_ldst(Register rt, const Address &adr, size_t size_in_bytes, bool is_store) {
if (ldst_can_merge(rt, adr, size_in_bytes, is_store)) {
merge_ldst(rt, adr, size_in_bytes, is_store);
code()->clear_last_insn();
code()->clear_last_merge_candidate();
return true;
} else {
assert(size_in_bytes == 8 || size_in_bytes == 4, "only 8 bytes or 4 bytes load/store is supported.");
const uint64_t mask = size_in_bytes - 1;
if (adr.getMode() == Address::base_plus_offset &&
(adr.offset() & mask) == 0) { // only supports base_plus_offset.
code()->set_last_insn(pc());
code()->set_last_merge_candidate(pc());
}
return false;
}
@ -3876,7 +3876,7 @@ bool MacroAssembler::ldst_can_merge(Register rt,
size_t cur_size_in_bytes,
bool is_store) const {
address prev = pc() - NativeInstruction::instruction_size;
address last = code()->last_insn();
address last = code()->last_merge_candidate();
if (last == nullptr || !nativeInstruction_at(last)->is_Imm_LdSt()) {
return false;

View File

@ -168,7 +168,7 @@ class MacroAssembler: public Assembler {
void bind(Label& L) {
Assembler::bind(L);
code()->clear_last_insn();
code()->clear_last_merge_candidate();
code()->set_last_label(pc());
}

View File

@ -4117,7 +4117,7 @@ void MacroAssembler::membar(uint32_t order_constraint) {
}
address prev = pc() - MacroAssembler::instruction_size;
address last = code()->last_insn();
address last = code()->last_merge_candidate();
if (last != nullptr && is_membar(last) && prev == last) {
// We are merging two memory barrier instructions. On RISCV we
@ -4127,7 +4127,7 @@ void MacroAssembler::membar(uint32_t order_constraint) {
return;
}
code()->set_last_insn(pc());
code()->set_last_merge_candidate(pc());
uint32_t predecessor = 0;
uint32_t successor = 0;
membar_mask_to_pred_succ(order_constraint, predecessor, successor);

View File

@ -876,7 +876,7 @@ public:
void bind(Label& L) {
Assembler::bind(L);
// fences across basic blocks should not be merged
code()->clear_last_insn();
code()->clear_last_merge_candidate();
}
typedef void (MacroAssembler::* compare_and_branch_insn)(Register Rs1, Register Rs2, const address dest);

View File

@ -937,8 +937,8 @@ void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
// Move all the code and relocations to the new blob:
relocate_code_to(&cb);
// some internal addresses, _last_insn _last_label, are used during code emission,
// adjust them in expansion
// some internal addresses, _last_merge_candidate and _last_label, are used during
// code emission, adjust them in expansion
adjust_internal_address(insts_begin(), cb.insts_begin());
// Copy the temporary code buffer into the current code buffer.
@ -966,8 +966,8 @@ void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
}
void CodeBuffer::adjust_internal_address(address from, address to) {
if (_last_insn != nullptr) {
_last_insn += to - from;
if (_last_merge_candidate != nullptr) {
_last_merge_candidate += to - from;
}
if (_last_label != nullptr) {
_last_label += to - from;

View File

@ -561,11 +561,11 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
OopRecorder* _oop_recorder;
OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
Arena* _overflow_arena;
address _last_insn; // used to merge consecutive memory barriers, loads or stores.
address _last_label; // record last bind label address, it's also the start of current bb.
address _last_label; // record last bind label address, it's also the start of current bb.
address _last_merge_candidate; // used to merge consecutive memory barriers, loads or stores.
SharedStubToInterpRequests* _shared_stub_to_interp_requests; // used to collect requests for shared iterpreter stubs
SharedTrampolineRequests* _shared_trampoline_requests; // used to collect requests for shared trampolines
@ -591,11 +591,11 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
_total_size = 0;
_oop_recorder = nullptr;
_overflow_arena = nullptr;
_last_insn = nullptr;
_last_label = nullptr;
_finalize_stubs = false;
_last_merge_candidate = nullptr;
_shared_stub_to_interp_requests = nullptr;
_shared_trampoline_requests = nullptr;
_finalize_stubs = false;
_consts.initialize_outer(this, SECT_CONSTS);
_insts.initialize_outer(this, SECT_INSTS);
@ -812,9 +812,9 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
OopRecorder* oop_recorder() const { return _oop_recorder; }
address last_insn() const { return _last_insn; }
void set_last_insn(address a) { _last_insn = a; }
void clear_last_insn() { set_last_insn(nullptr); }
address last_merge_candidate() const { return _last_merge_candidate; }
void set_last_merge_candidate(address a) { _last_merge_candidate = a; }
void clear_last_merge_candidate() { set_last_merge_candidate(nullptr); }
address last_label() const { return _last_label; }
void set_last_label(address a) { _last_label = a; }