From 63c3b9bda3fe7eb8750f084ff070f40b967f9532 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Fri, 1 Nov 2024 05:04:25 +0100 Subject: Build wasm without Emscripten --- index.htm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'index.htm') diff --git a/index.htm b/index.htm index 35fd8ca..0ffcf89 100644 --- a/index.htm +++ b/index.htm @@ -24,13 +24,13 @@ fetch("index.wasm"), { "wasi_snapshot_preview1" : { - args_sizes_get : (...args) => { console.log(`args_sizes_get: ${args}`); }, - args_get : (...args) => { console.log(`args_get: ${args}`); }, - proc_exit : (...args) => { console.log(`proc_exit: ${args}`); }, clock_time_get : () => { return Date.now(); }, - fd_close : (...args) => { console.log(`fd_close: ${args}`); }, - fd_write : (...args) => { console.log(`fd_write: ${args}`); }, - fd_seek : (...args) => { console.log(`fd_seek: ${args}`); }, + args_sizes_get : () => { throw new Error("Unexpected args_sizes_get call"); }, + args_get : () => { throw new Error("Unexpected args_get call"); }, + proc_exit : () => { throw new Error("Unexpected proc_exit call"); }, + fd_close : () => { throw new Error("Unexpected fd_close call"); }, + fd_write : () => { throw new Error("Unexpected fd_write call"); }, + fd_seek : () => { throw new Error("Unexpected fd_seek call"); }, }, "env" : { p_init : () => { @@ -60,6 +60,16 @@ p_wait_events : () => {}, p_sleep_for : (time) => {}, p_time : Date.now, + memset : (dst, val, num) => { + // FIXME PERF + for (let i = 0; i < num; ++i) + dst[i] = val; + }, + memcpy : (dst, src, num) => { + // FIXME PERF + for (let i = 0; i < num; ++i) + dst[i] = src[i]; + }, }, } ); -- cgit v1.2.3