@@ -861,20 +861,20 @@ provide let print = (value, suffix="\n") => {
861861 // First convert the value to string, if it isn't one already.
862862 let valuePtr = WasmI32.fromGrain(value)
863863 let s = toString(value)
864- let ptr = WasmI32.fromGrain(s )
865- let suffixPtr = WasmI32.fromGrain(suffix )
866- // iov: [<ptr to string> <nbytes of string> <ptr to end sequence> <nbytes of end sequence>] (32 bytes)
864+ let combined = concat(s, suffix )
865+ let ptr = WasmI32.fromGrain(combined )
866+ // iov: [<ptr to string> <nbytes of string>]
867867 // buf: <iov> <written>
868868 // fd_write(STDOUT (1), iov, len(iov), written)
869- let buf = Memory.malloc(36n )
869+ let buf = Memory.malloc(20n )
870870 let iov = buf
871- let written = buf + 32n
871+ let written = buf + 16n
872872 WasmI32.store(iov, ptr + 8n, 0n)
873873 WasmI32.store(iov, WasmI32.load(ptr, 4n), 4n)
874- WasmI32.store(iov, suffixPtr + 8n, 8n)
875- WasmI32.store(iov, WasmI32.load(suffixPtr, 4n), 12n)
876- fd_write(1n, iov, 2n, written)
874+ fd_write(1n, iov, 1n, written)
877875 Memory.free(buf)
876+ ignore(value)
877+ ignore(suffix)
878878 void
879879}
880880
0 commit comments