-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WASM] mem_cmp added to the Wasm runtime #7539
Conversation
ethcore/wasm/src/runtime.rs
Outdated
let cx = context.value_stack.pop_as::<i32>()? as u32; | ||
let ct = context.value_stack.pop_as::<i32>()? as u32; | ||
|
||
self.charge(|schedule| schedule.wasm.mem_copy as u64 * len as u64)?; // TODO: charge cmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo should be addressed
let cx = self.memory.get(cx, len as usize)?; | ||
let ct = self.memory.get(ct, len as usize)?; | ||
let result = unsafe { | ||
memcmp(cx.as_ptr() as *const c_void, ct.as_ptr() as *const c_void, len as usize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memcmp should fail when invoked on overlapping region, because otherwise it's undefined behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, on the second thought, it shouldn't be
ethcore/wasm/src/runtime.rs
Outdated
{ | ||
// | ||
// method signature: | ||
// fn memcmp(cx: *const c_void, ct: *const c_void, n: usize) -> i32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/paritytech/pwasm-std/blob/master/libc/src/lib.rs#L8
should match here
* mem_cmp added to the Wasm runtime * schedule.wasm.mem_copy to schedule.wasm.mem_cmp for mem_cmp
* update back-references more aggressively after answering from cache (#7578) * Add new EF ropstens nodes. (#7824) * Add new EF ropstens nodes. * Fix tests * Add a timeout for light client sync requests (#7848) * Add a timeout for light client sync requests * Adjusting timeout to number of headers * Flush keyfiles. Resolves #7632 (#7868) * Fix wallet import (#7873) * rpc: generate new account id for imported wallets * ethstore: handle duplicate wallet filenames * ethstore: simplify deduplication of wallet file names * ethstore: do not dedup wallet filenames on update * ethstore: fix minor grumbles * [WASM] mem_cmp added to the Wasm runtime (#7539) * mem_cmp added to the Wasm runtime * schedule.wasm.mem_copy to schedule.wasm.mem_cmp for mem_cmp * [Wasm] memcmp fix and test added (#7590) * [Wasm] memcmp fix and test added * [Wasm] use reqrep_test! macro for memcmp test * wasmi interpreter (#7796) * adjust storage update evm-style (#7812) * disable internal memory (#7842)
In order to support wasm-unknown-unknown target runtime has to provide
memcmp
which previously was provided by emscripten