bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.98k stars 627 forks source link

Wasm shared heap #3544

Open WenLY1 opened 5 months ago

WenLY1 commented 5 months ago

Implementation tasks:

WenLY1 commented 5 months ago

If wasm shared heap is enable, should the boundary check keep enabled ? In the following code, if bounds checks is disabled, should we return the offset directly or judge whether the addr is in shared heap? In function wasm_runtime_addr_native_to_app

    if (bounds_checks) {
        if (memory_inst->memory_data <= addr && addr < memory_inst->memory_data_end) {
            ret = (uint64)(addr - memory_inst->memory_data);
            SHARED_MEMORY_UNLOCK(memory_inst);
            return ret;
        }
    }
    /* If bounds checks is disabled, return the offset directly */
    else if (addr != NULL) {
        ret = (uint64)(addr - memory_inst->memory_data);
        SHARED_MEMORY_UNLOCK(memory_inst);
        return ret;
    }
lum1n0us commented 5 months ago

Would u mind giving us, the community, a quick introduction about:

wenyongh commented 5 months ago

@WenLY1 Many people may not know the background and the design details of the shared heap, I submitted issue #3546 to try to illustrate that, suggest you to post tasks in that issue to track and discuss instead.