Commit d8cd323d authored by jyan's avatar jyan Committed by Commit bot

S390: Assembler changes for enabling GrowHeap in Wasm

Port e1a7c1e7

Original commit message:
    - New RelocInfo mode WASM_MEMORY_REFERENCE as a marker for wasm code objects that need to be relocated on a heap change
    - RelocInfo mode recorded for immediates that use the memory buffer as base
    - Tests to verify address patching works

R=joransiu@ca.ibm.com, mbrandy@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1848353002

Cr-Commit-Position: refs/heads/master@{#35215}
parent 2799cd15
...@@ -93,6 +93,11 @@ Address RelocInfo::target_address() { ...@@ -93,6 +93,11 @@ Address RelocInfo::target_address() {
return Assembler::target_address_at(pc_, host_); 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() { Address RelocInfo::target_address_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) ||
rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE); rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE);
...@@ -151,6 +156,19 @@ Handle<Object> Assembler::code_target_object_handle_at(Address pc) { ...@@ -151,6 +156,19 @@ Handle<Object> Assembler::code_target_object_handle_at(Address pc) {
return code_targets_[index]; 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() { Object* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment