Commit 8b29c3ef authored by Jaideep Bajwa's avatar Jaideep Bajwa Committed by Commit Bot

PPC/s390: [wasm] Reuse reloc info size and address accessors.

Port 4b397e6c

Original Commit Message:

    The way we access wasm addresses or sizes is the same, on
    a platform. We have 2 size parameters - memory and table - and
    2 addresses - globals and memory.

    The CL also renames for generality the address setting API.

R=mtrofin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Ic6c398e0eeb6c9344aca3f92223d8b99a9e518ef
Reviewed-on: https://chromium-review.googlesource.com/615012Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Jaideep Bajwa <bjaideep@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#47360}
parent 1b759c02
...@@ -162,35 +162,22 @@ bool RelocInfo::IsInConstantPool() { ...@@ -162,35 +162,22 @@ bool RelocInfo::IsInConstantPool() {
return false; return false;
} }
Address RelocInfo::wasm_memory_reference() { Address RelocInfo::embedded_address() const {
DCHECK(IsWasmMemoryReference(rmode_));
return Assembler::target_address_at(pc_, host_); return Assembler::target_address_at(pc_, host_);
} }
uint32_t RelocInfo::wasm_memory_size_reference() { uint32_t RelocInfo::embedded_size() const {
DCHECK(IsWasmMemorySizeReference(rmode_));
return static_cast<uint32_t>( return static_cast<uint32_t>(
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_))); reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
} }
Address RelocInfo::wasm_global_reference() { void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
DCHECK(IsWasmGlobalReference(rmode_)); ICacheFlushMode flush_mode) {
return Assembler::target_address_at(pc_, host_);
}
uint32_t RelocInfo::wasm_function_table_size_reference() {
DCHECK(IsWasmFunctionTableSizeReference(rmode_));
return static_cast<uint32_t>(
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
}
void RelocInfo::unchecked_update_wasm_memory_reference(
Isolate* isolate, Address address, ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode); Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
} }
void RelocInfo::unchecked_update_wasm_size(Isolate* isolate, uint32_t size, void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
ICacheFlushMode flush_mode) { ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, Assembler::set_target_address_at(isolate, pc_, host_,
reinterpret_cast<Address>(size), flush_mode); reinterpret_cast<Address>(size), flush_mode);
} }
......
...@@ -270,35 +270,22 @@ bool RelocInfo::IsCodedSpecially() { ...@@ -270,35 +270,22 @@ bool RelocInfo::IsCodedSpecially() {
bool RelocInfo::IsInConstantPool() { return false; } bool RelocInfo::IsInConstantPool() { return false; }
Address RelocInfo::wasm_memory_reference() { Address RelocInfo::embedded_address() const {
DCHECK(IsWasmMemoryReference(rmode_));
return Assembler::target_address_at(pc_, host_); return Assembler::target_address_at(pc_, host_);
} }
uint32_t RelocInfo::wasm_memory_size_reference() { uint32_t RelocInfo::embedded_size() const {
DCHECK(IsWasmMemorySizeReference(rmode_));
return static_cast<uint32_t>( return static_cast<uint32_t>(
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_))); reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
} }
Address RelocInfo::wasm_global_reference() { void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
DCHECK(IsWasmGlobalReference(rmode_)); ICacheFlushMode flush_mode) {
return Assembler::target_address_at(pc_, host_);
}
uint32_t RelocInfo::wasm_function_table_size_reference() {
DCHECK(IsWasmFunctionTableSizeReference(rmode_));
return static_cast<uint32_t>(
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
}
void RelocInfo::unchecked_update_wasm_memory_reference(
Isolate* isolate, Address address, ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode); Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
} }
void RelocInfo::unchecked_update_wasm_size(Isolate* isolate, uint32_t size, void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
ICacheFlushMode flush_mode) { ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, Assembler::set_target_address_at(isolate, pc_, host_,
reinterpret_cast<Address>(size), flush_mode); reinterpret_cast<Address>(size), flush_mode);
} }
......
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