Skip to content

Commit fdb5de2

Browse files
luyahanV8 LUCI CQ
authored andcommitted
[riscv] Fix Check failed in bind_to
The trampoline should be emitted before the constant pool. Bug: 420232092 Change-Id: I3a909b122607e37aca9d8765f28810ec74d5dc0b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6578135 Auto-Submit: Yahan Lu (LuYahan) <[email protected]> Reviewed-by: Ji Qiu <[email protected]> Commit-Queue: Ji Qiu <[email protected]> Cr-Commit-Position: refs/heads/main@{#100480}
1 parent 32f0ca9 commit fdb5de2

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/codegen/riscv/assembler-riscv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,8 @@ void Assembler::bind_to(Label* L, int pos) {
720720
trampoline_pos = get_trampoline_entry(fixup_pos);
721721
CHECK_NE(trampoline_pos, kInvalidSlotPos);
722722
}
723-
CHECK((trampoline_pos - fixup_pos) <= kMaxBranchOffset);
724723
DEBUG_PRINTF("\t\ttrampolining: %d\n", trampoline_pos);
724+
CHECK((trampoline_pos - fixup_pos) <= kMaxBranchOffset);
725725
target_at_put(fixup_pos, trampoline_pos, false);
726726
fixup_pos = trampoline_pos;
727727
}

src/codegen/riscv/assembler-riscv.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,16 +731,19 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase,
731731

732732
// Block the emission of the trampoline pool before pc_offset.
733733
void BlockTrampolinePoolBefore(int pc_offset) {
734-
if (no_trampoline_pool_before_ < pc_offset)
734+
if (no_trampoline_pool_before_ < pc_offset) {
735+
DEBUG_PRINTF("\tBlockTrampolinePoolBefore %d\n", pc_offset);
735736
no_trampoline_pool_before_ = pc_offset;
737+
}
736738
}
737739

738740
void StartBlockTrampolinePool() {
739-
DEBUG_PRINTF("\tStartBlockTrampolinePool\n");
741+
DEBUG_PRINTF("\tStartBlockTrampolinePool %d\n", pc_offset());
740742
trampoline_pool_blocked_nesting_++;
741743
}
742744

743745
void EndBlockTrampolinePool() {
746+
DEBUG_PRINTF("\tEndBlockTrampolinePool\n");
744747
trampoline_pool_blocked_nesting_--;
745748
DEBUG_PRINTF("\ttrampoline_pool_blocked_nesting:%d\n",
746749
trampoline_pool_blocked_nesting_);

src/codegen/riscv/macro-assembler-riscv.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4940,7 +4940,6 @@ void MacroAssembler::Jump(Register target, Condition cond, Register rs,
49404940
BlockTrampolinePoolScope block_trampoline_pool(this);
49414941
if (cond == cc_always) {
49424942
jr(target);
4943-
ForceConstantPoolEmissionWithoutJump();
49444943
} else {
49454944
BRANCH_ARGS_CHECK(cond, rs, rt);
49464945
Branch(kInstrSize * 2, NegateCondition(cond), rs, rt);
@@ -5353,9 +5352,6 @@ void MacroAssembler::StoreReturnAddressAndCall(Register target) {
53535352

53545353
void MacroAssembler::Ret(Condition cond, Register rs, const Operand& rt) {
53555354
Jump(ra, cond, rs, rt);
5356-
if (cond == al) {
5357-
ForceConstantPoolEmissionWithoutJump();
5358-
}
53595355
}
53605356

53615357
void MacroAssembler::BranchLong(Label* L) {

0 commit comments

Comments
 (0)