titzer / virgil

A fast and lightweight native programming language
1.24k stars 50 forks source link

Aeneas.wasm hello-v3.v3 - no output #18

Closed diakopter closed 5 years ago

diakopter commented 5 years ago
user@host009:~/src/virgil/bin/dev$ wave ../current/wasm/Aeneas.wasm run \
../../rt/wave/wave.v3 ../../rt/wave/System.v3 ../../test/wave/hello-v3.v3
user@host009:~/src/virgil/bin/dev$ echo $?
0
titzer commented 5 years ago

I think you want "-run" instead of "run". You'll get compile errors because the wave module and the system module both use pointers, which are not in the interpreter target used by "run". Aeneas should give an error here, but I am not sure why it does not. (note that the behavior is the same for Aeneas running on any target).

titzer commented 5 years ago

Btw, you probably want to use -heap-size=500m when compiling Aeneas to wasm, as there is no default heap size set for this target, and you'll run out of memory very quickly, which will just look like a memory access out of bounds.

diakopter commented 5 years ago
user@host009:~/src/virgil/bin/dev$ wave ../current/wasm/Aeneas.wasm -compile -heap-size=1000m -target=wasm ../../test/wave/hello-v3.v3 ../../rt/wave/*.v3
Trap: Uncaught RuntimeError: memory access out of bounds
42 user@host009:~/src/virgil/bin/dev$

it gets a little farther...

diakopter commented 5 years ago

worked when I compiled Aeneas.wasm with the bigger heap size. 👍

diakopter commented 5 years ago

well, it produced a .wasm, but then when I ran it:

user@host009:~/src/virgil/bin/dev$ wave hello-v3.wasm
<unknown>:-1: Uncaught CompileError: WebAssembly.Module(): unknown section code #0x1f @+546
ERROR: could not compile hello-v3.wasm
255 
diakopter commented 5 years ago

well, now it's working but it has exit code 32, but I don't know that I did anything differently..

user@host009:~/src/virgil/bin/dev$ wave ../current/wasm/Aeneas.wasm -compile -heap-size=500m -target=wasm ../../test/wave/hello-v3.v3 ../../rt/wave/*.v3
user@host009:~/src/virgil/bin/dev$ wave hello-v3.wasm
Hello world!
32 user@host009:~/src/virgil/bin/dev$  

@titzer 😄