Skip to content

Commit 9cfdac6

Browse files
luyahanRafaelGSS
authored andcommitted
deps: V8: cherry-pick e39af94dd18e
Original commit message: [riscv64] Fix failed: vector[] index out of GenPCRelativeJumpAndLink doesn't use BlockTrampolinePoolScope. It inserts a BlockTrampolinePool which causes this error. And also alter debug info format. Change-Id: I160f13f4261fdcf1f7978bfce9b5169d363e6a10 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4032016 Commit-Queue: Yahan Lu <[email protected]> Reviewed-by: ji qiu <[email protected]> Commit-Queue: ji qiu <[email protected]> Auto-Submit: Yahan Lu <[email protected]> Cr-Commit-Position: refs/heads/main@{#84316} Refs: v8/v8@e39af94 PR-URL: #46142 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f85a8e4 commit 9cfdac6

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

deps/v8/src/codegen/riscv/assembler-riscv.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ void Assembler::target_at_put(int pos, int target_pos, bool is_internal,
501501
*reinterpret_cast<uintptr_t*>(buffer_start_ + pos) = imm;
502502
return;
503503
}
504-
DEBUG_PRINTF("target_at_put: %p (%d) to %p (%d)\n",
504+
DEBUG_PRINTF("\ttarget_at_put: %p (%d) to %p (%d)\n",
505505
reinterpret_cast<Instr*>(buffer_start_ + pos), pos,
506506
reinterpret_cast<Instr*>(buffer_start_ + target_pos),
507507
target_pos);
@@ -597,7 +597,7 @@ void Assembler::print(const Label* L) {
597597

598598
void Assembler::bind_to(Label* L, int pos) {
599599
DCHECK(0 <= pos && pos <= pc_offset()); // Must have valid binding position.
600-
DEBUG_PRINTF("binding %d to label %p\n", pos, L);
600+
DEBUG_PRINTF("\tbinding %d to label %p\n", pos, L);
601601
int trampoline_pos = kInvalidSlotPos;
602602
bool is_internal = false;
603603
if (L->is_linked() && !trampoline_emitted_) {
@@ -666,7 +666,7 @@ void Assembler::next(Label* L, bool is_internal) {
666666
L->Unuse();
667667
} else {
668668
DCHECK_GE(link, 0);
669-
DEBUG_PRINTF("next: %p to %p (%d)\n", L,
669+
DEBUG_PRINTF("\tnext: %p to %p (%d)\n", L,
670670
reinterpret_cast<Instr*>(buffer_start_ + link), link);
671671
L->link_to(link);
672672
}
@@ -740,7 +740,7 @@ int32_t Assembler::get_trampoline_entry(int32_t pos) {
740740

741741
uintptr_t Assembler::jump_address(Label* L) {
742742
intptr_t target_pos;
743-
DEBUG_PRINTF("jump_address: %p to %p (%d)\n", L,
743+
DEBUG_PRINTF("\tjump_address: %p to %p (%d)\n", L,
744744
reinterpret_cast<Instr*>(buffer_start_ + pc_offset()),
745745
pc_offset());
746746
if (L->is_bound()) {
@@ -771,7 +771,7 @@ uintptr_t Assembler::jump_address(Label* L) {
771771
int32_t Assembler::branch_long_offset(Label* L) {
772772
intptr_t target_pos;
773773

774-
DEBUG_PRINTF("branch_long_offset: %p to %p (%d)\n", L,
774+
DEBUG_PRINTF("\tbranch_long_offset: %p to %p (%d)\n", L,
775775
reinterpret_cast<Instr*>(buffer_start_ + pc_offset()),
776776
pc_offset());
777777
if (L->is_bound()) {
@@ -803,7 +803,7 @@ int32_t Assembler::branch_long_offset(Label* L) {
803803
int32_t Assembler::branch_offset_helper(Label* L, OffsetSize bits) {
804804
int32_t target_pos;
805805

806-
DEBUG_PRINTF("branch_offset_helper: %p to %p (%d)\n", L,
806+
DEBUG_PRINTF("\tbranch_offset_helper: %p to %p (%d)\n", L,
807807
reinterpret_cast<Instr*>(buffer_start_ + pc_offset()),
808808
pc_offset());
809809
if (L->is_bound()) {
@@ -835,7 +835,7 @@ int32_t Assembler::branch_offset_helper(Label* L, OffsetSize bits) {
835835

836836
void Assembler::label_at_put(Label* L, int at_offset) {
837837
int target_pos;
838-
DEBUG_PRINTF("label_at_put: %p @ %p (%d)\n", L,
838+
DEBUG_PRINTF("\tlabel_at_put: %p @ %p (%d)\n", L,
839839
reinterpret_cast<Instr*>(buffer_start_ + at_offset), at_offset);
840840
if (L->is_bound()) {
841841
target_pos = L->pos();
@@ -1179,7 +1179,7 @@ void Assembler::li_ptr(Register rd, int64_t imm) {
11791179
}
11801180

11811181
void Assembler::li_constant(Register rd, int64_t imm) {
1182-
DEBUG_PRINTF("li_constant(%d, %lx <%ld>)\n", ToNumber(rd), imm, imm);
1182+
DEBUG_PRINTF("\tli_constant(%d, %lx <%ld>)\n", ToNumber(rd), imm, imm);
11831183
lui(rd, (imm + (1LL << 47) + (1LL << 35) + (1LL << 23) + (1LL << 11)) >>
11841184
48); // Bits 63:48
11851185
addiw(rd, rd,
@@ -1236,7 +1236,7 @@ void Assembler::li_ptr(Register rd, int32_t imm) {
12361236
}
12371237

12381238
void Assembler::li_constant(Register rd, int32_t imm) {
1239-
DEBUG_PRINTF("li_constant(%d, %x <%d>)\n", ToNumber(rd), imm, imm);
1239+
DEBUG_PRINTF("\tli_constant(%d, %x <%d>)\n", ToNumber(rd), imm, imm);
12401240
int32_t high_20 = ((imm + 0x800) >> 12); // bits31:12
12411241
int32_t low_12 = imm & 0xfff; // bits11:0
12421242
lui(rd, high_20);
@@ -1335,7 +1335,7 @@ int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, Address pc,
13351335
DCHECK(RelocInfo::IsInternalReferenceEncoded(rmode));
13361336
if (IsLui(instr)) {
13371337
uintptr_t target_address = target_address_at(pc) + pc_delta;
1338-
DEBUG_PRINTF("target_address 0x%" PRIxPTR "\n", target_address);
1338+
DEBUG_PRINTF("\ttarget_address 0x%" PRIxPTR "\n", target_address);
13391339
set_target_value_at(pc, target_address);
13401340
#if V8_TARGET_ARCH_RISCV64
13411341
return 8; // Number of instructions patched.

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

+1
Original file line numberDiff line numberDiff line change
@@ -4475,6 +4475,7 @@ MemOperand TurboAssembler::EntryFromBuiltinAsOperand(Builtin builtin) {
44754475
}
44764476

44774477
void TurboAssembler::PatchAndJump(Address target) {
4478+
BlockTrampolinePoolScope block_trampoline_pool(this);
44784479
UseScratchRegisterScope temps(this);
44794480
Register scratch = temps.Acquire();
44804481
auipc(scratch, 0); // Load PC into scratch

deps/v8/src/codegen/riscv/macro-assembler-riscv.h

+2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
212212
void LoadRootRelative(Register destination, int32_t offset) final;
213213

214214
inline void GenPCRelativeJump(Register rd, int32_t imm32) {
215+
BlockTrampolinePoolScope block_trampoline_pool(this);
215216
DCHECK(is_int32(imm32 + 0x800));
216217
int32_t Hi20 = ((imm32 + 0x800) >> 12);
217218
int32_t Lo12 = imm32 << 20 >> 20;
@@ -220,6 +221,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
220221
}
221222

222223
inline void GenPCRelativeJumpAndLink(Register rd, int32_t imm32) {
224+
BlockTrampolinePoolScope block_trampoline_pool(this);
223225
DCHECK(is_int32(imm32 + 0x800));
224226
int32_t Hi20 = ((imm32 + 0x800) >> 12);
225227
int32_t Lo12 = imm32 << 20 >> 20;

0 commit comments

Comments
 (0)