S390: Add new relocation type WASM_MEMORY_SIZE_REFERENCE, use relocatable pointers to update wasm memory size references in generated code.
port 117a56b7c2
Original commit message:
- Add new RelocInfo mode WASM_MEMORY_SIZE_REFERENCE in the assembler and add relocation information to immediates in compare instructions.
- Use relocatable constants for MemSize/BoundsCheck in the wasm compiler
R=gdeepti@chromium.org, joransiu@ca.ibm.com, mbrandy@us.ibm.com, bjaideep@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
Review-Url: https://codereview.chromium.org/1955593003
Cr-Commit-Position: refs/heads/master@{#36056}
This commit is contained in:
parent
c6405c4a60
commit
79c350b3c5
@ -1937,21 +1937,23 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
destination->IsRegister() ? g.ToRegister(destination) : kScratchReg;
|
||||
switch (src.type()) {
|
||||
case Constant::kInt32:
|
||||
#if !V8_TARGET_ARCH_S390X
|
||||
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) {
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
if (src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) {
|
||||
#else
|
||||
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE ||
|
||||
src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) {
|
||||
#endif
|
||||
__ mov(dst, Operand(src.ToInt32(), src.rmode()));
|
||||
} else {
|
||||
__ mov(dst, Operand(src.ToInt32()));
|
||||
}
|
||||
#else
|
||||
__ mov(dst, Operand(src.ToInt32()));
|
||||
#endif // V8_TARGET_ARCH_S390X
|
||||
break;
|
||||
case Constant::kInt64:
|
||||
#if V8_TARGET_ARCH_S390X
|
||||
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) {
|
||||
__ mov(dst, Operand(src.ToInt64(), src.rmode()));
|
||||
} else {
|
||||
DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
|
||||
__ mov(dst, Operand(src.ToInt64()));
|
||||
}
|
||||
#else
|
||||
|
@ -93,11 +93,6 @@ Address RelocInfo::target_address() {
|
||||
return Assembler::target_address_at(pc_, host_);
|
||||
}
|
||||
|
||||
Address RelocInfo::wasm_memory_reference() {
|
||||
DCHECK(IsWasmMemoryReference(rmode_));
|
||||
return Assembler::target_address_at(pc_, host_);
|
||||
}
|
||||
|
||||
Address RelocInfo::target_address_address() {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) ||
|
||||
rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE);
|
||||
@ -156,19 +151,6 @@ Handle<Object> Assembler::code_target_object_handle_at(Address pc) {
|
||||
return code_targets_[index];
|
||||
}
|
||||
|
||||
void RelocInfo::update_wasm_memory_reference(
|
||||
Address old_base, Address new_base, size_t old_size, size_t new_size,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsWasmMemoryReference(rmode_));
|
||||
DCHECK(old_base <= wasm_memory_reference() &&
|
||||
wasm_memory_reference() < old_base + old_size);
|
||||
Address updated_reference = new_base + (wasm_memory_reference() - old_base);
|
||||
DCHECK(new_base <= updated_reference &&
|
||||
updated_reference < new_base + new_size);
|
||||
Assembler::set_target_address_at(isolate_, pc_, host_, updated_reference,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
Object* RelocInfo::target_object() {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
|
||||
|
@ -217,6 +217,44 @@ bool RelocInfo::IsCodedSpecially() {
|
||||
|
||||
bool RelocInfo::IsInConstantPool() { return false; }
|
||||
|
||||
Address RelocInfo::wasm_memory_reference() {
|
||||
DCHECK(IsWasmMemoryReference(rmode_));
|
||||
return Assembler::target_address_at(pc_, host_);
|
||||
}
|
||||
|
||||
uint32_t RelocInfo::wasm_memory_size_reference() {
|
||||
DCHECK(IsWasmMemorySizeReference(rmode_));
|
||||
return static_cast<uint32_t>(
|
||||
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
|
||||
}
|
||||
|
||||
void RelocInfo::update_wasm_memory_reference(
|
||||
Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
|
||||
if (IsWasmMemoryReference(rmode_)) {
|
||||
Address updated_memory_reference;
|
||||
DCHECK(old_base <= wasm_memory_reference() &&
|
||||
wasm_memory_reference() < old_base + old_size);
|
||||
updated_memory_reference = new_base + (wasm_memory_reference() - old_base);
|
||||
DCHECK(new_base <= updated_memory_reference &&
|
||||
updated_memory_reference < new_base + new_size);
|
||||
Assembler::set_target_address_at(
|
||||
isolate_, pc_, host_, updated_memory_reference, icache_flush_mode);
|
||||
} else if (IsWasmMemorySizeReference(rmode_)) {
|
||||
uint32_t updated_size_reference;
|
||||
DCHECK(wasm_memory_size_reference() <= old_size);
|
||||
updated_size_reference =
|
||||
new_size + (wasm_memory_size_reference() - old_size);
|
||||
DCHECK(updated_size_reference <= new_size);
|
||||
Assembler::set_target_address_at(
|
||||
isolate_, pc_, host_, reinterpret_cast<Address>(updated_size_reference),
|
||||
icache_flush_mode);
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation of Operand and MemOperand
|
||||
// See assembler-s390-inl.h for inlined constructors
|
||||
|
Loading…
Reference in New Issue
Block a user