Skip to content

Commit

Permalink
PPC/s390: [wasm][liftoff] Always zero-extend 32 bit offsets
Browse files Browse the repository at this point in the history
Port 2b77ca2

Original Commit Message:

    The upper 32 bits of the 64 bit offset register are not guaranteed to be
    cleared, so a zero-extension is needed. We already do the zero-extension
    in the case of explicit bounds checking, but this should also be done if
    the trap handler is enabled.

R=thibaudm@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: Ife3ae4f93b85fe1b2c76fe4b98fa408b5b51ed71
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2929661
Reviewed-by: Junliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#74886}
  • Loading branch information
miladfarca authored and V8 LUCI CQ committed Jun 1, 2021
1 parent e2ebe3b commit 3805a69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/wasm/baseline/ppc/liftoff-assembler-ppc.h
Expand Up @@ -250,7 +250,8 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
Register offset_reg, uintptr_t offset_imm,
LoadType type, LiftoffRegList pinned,
uint32_t* protected_load_pc, bool is_load_mem) {
uint32_t* protected_load_pc, bool is_load_mem,
bool i64_offset) {
bailout(kUnsupportedArchitecture, "Load");
}

Expand Down
8 changes: 7 additions & 1 deletion src/wasm/baseline/s390/liftoff-assembler-s390.h
Expand Up @@ -280,11 +280,17 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
Register offset_reg, uintptr_t offset_imm,
LoadType type, LiftoffRegList pinned,
uint32_t* protected_load_pc, bool is_load_mem) {
uint32_t* protected_load_pc, bool is_load_mem,
bool i64_offset) {
UseScratchRegisterScope temps(this);
if (!is_int20(offset_imm)) {
mov(ip, Operand(offset_imm));
if (offset_reg != no_reg) {
if (!i64_offset) {
// Clear the upper 32 bits of the 64 bit offset register.
llgfr(r0, offset_reg);
offset_reg = r0;
}
AddS64(ip, offset_reg);
}
offset_reg = ip;
Expand Down

0 comments on commit 3805a69

Please sign in to comment.