iden3/circom

Add way to read more than one value at a time from WASM memory

Opened this issue · 0 comments

pub fn read_shared_rw_memory_generator(producer: &WASMProducer) -> Vec<WasmInstruction> {
let mut instructions = vec![];
let header = "(func $readSharedRWMemory (type $_t_i32ri32)".to_string();
instructions.push(header);
instructions.push(" (param $p i32)".to_string());
instructions.push("(result i32)".to_string());
instructions.push(set_constant(&producer.get_shared_rw_memory_start().to_string()));
instructions.push(get_local("$p"));
instructions.push(set_constant("4"));
instructions.push(mul32());
instructions.push(add32());
instructions.push(load32(None));
instructions.push(")".to_string());
instructions
}

Only defines a way to read one value from memory at a time. This is a huge bottleneck in performance-reliant applications. Would it be possible to add another wasm function to read multiple values at a time?
e.g. accept an array of addresses and produce an array of results?