From f34dd377690a97d5906ac512916b57578e10180c Mon Sep 17 00:00:00 2001 From: David Konsumer Date: Sat, 19 Oct 2024 02:25:03 -0700 Subject: [PATCH] unifying interface --- cart/as/build.js | 8 +++++++- cart/as/null0.ts | 2 ++ cart/c/null0.h | 5 ----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cart/as/build.js b/cart/as/build.js index c336600..94868d4 100644 --- a/cart/as/build.js +++ b/cart/as/build.js @@ -18,8 +18,14 @@ await writeFile('build/tmp.ts', (await readFile('null0.ts')) + '\n// user-code:\ const { error, stdout, stderr, stats } = await asc.main([ 'build/tmp.ts', - '--debug', + + // only minimal seems to work in WAMR '--runtime', 'minimal', + // '--runtime', 'incremental', + // '--runtime', 'stub', + + // '--debug', + // '--exportRuntime', '--config', './node_modules/@assemblyscript/wasi-shim/asconfig.json', '--optimizeLevel', '3', '--shrinkLevel', '2', diff --git a/cart/as/null0.ts b/cart/as/null0.ts index 42b0e8b..24f49db 100644 --- a/cart/as/null0.ts +++ b/cart/as/null0.ts @@ -825,8 +825,10 @@ declare function _null0_file_read(filename: ArrayBuffer, byteSize:UsizePointer, function file_read(filename: string): ArrayBuffer { const i = file_info(filename) const ret = new ArrayBuffer(i.filesize) + console.log(`in AS: ${i.filesize.toString()} ${ret.byteLength.toString()}`) const b = new UsizePointer() _null0_file_read(String.UTF8.encode(filename, true), b, ret) + console.log(`in AS, from read: ${b.value.toString()}`) return ret } diff --git a/cart/c/null0.h b/cart/c/null0.h index 62e5cd2..c547b80 100755 --- a/cart/c/null0.h +++ b/cart/c/null0.h @@ -27,11 +27,6 @@ void* _null0_malloc(size_t size) { return malloc(size); } -NULL0_EXPORT("alloca") -void* _null0_alloca(size_t size) { - return __builtin_alloca(size); -} - NULL0_EXPORT("free") void _null0_free(void* ptr) { free(ptr);