Skip to content

Latest commit

 

History

History

README.md

ts2wasm runtime library

This folder contains code to be built into WAMR runtime to expose required APIs for executing wasm modules generated by ts2wasm compiler, including:

  • libdyntype API: APIs for supporting dynamic objects
  • struct-dyn API: APIs for accessing wasmGC struct fields through dynamically calculated index
  • stdlib API: APIs for providing standard library functions such as console.log

Build

# prepare dependencies
cd deps
./download.sh
cd -

# build runtime
mkdir build && cd build
cmake ..
make

This will generate an iwasm_gc executable which can be used to execute wasm modules generated by ts2wasm compiler.

Run

./iwasm_gc -f <export_func_name> <wasm file> [<args>]
# e.g.
./iwasm_gc -f consoleLog builtin_console.wasm

CMake Configurations

  • USE_SANITIZER=1

    Enable sanitizer. When enabled, all invalid memory access and memory leaks will be reported, disabled by default.

  • WAMR_BUILD_TARGET

    Build target, default is X86_64.

  • WAMR_BUILD_FAST_INTERP

    Enable fast interpreter, enabled by default.

  • WAMR_GC_IN_EVERY_ALLOCATION

    Enable GC in every allocation. When enabled, the garbage collector will reclaim the heap on every allocation request, this is for testing the GC behaviour, disabled by default.

  • WAMR_GC_HEAP_SIZE

    Set default GC Heap size (in bytes), the default value is 131072 (128KB)