Skip to content

Commit

Permalink
unifying interface
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumer committed Oct 19, 2024
1 parent b26255b commit f34dd37
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 7 additions & 1 deletion cart/as/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions cart/as/null0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(<i32>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
}

Expand Down
5 changes: 0 additions & 5 deletions cart/c/null0.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f34dd37

Please sign in to comment.