small improvements

This commit is contained in:
nora 2023-07-29 22:12:05 +02:00
parent 3270e6b501
commit f0227af982
4 changed files with 36 additions and 32 deletions

View file

@ -114,7 +114,9 @@ export function lower(ast: Ast): wasm.Module {
const HEAP_ALIGN = 0x08;
cx.reservedHeapMemoryStart =
(mod.datas[0].init.length + (HEAP_ALIGN - 1)) & ~(HEAP_ALIGN - 1);
mod.datas.length > 0
? (mod.datas[0].init.length + (HEAP_ALIGN - 1)) & ~(HEAP_ALIGN - 1)
: 0;
addRt(cx, ast);