Skip to content

v0.1.46

Choose a tag to compare

@gmpassos gmpassos released this 27 Jun 23:52
· 271 commits to master since this release
adfcce1

Wasm backend: broaden language/example coverage

Audited the playground examples against the Wasm backend (compiling each source and comparing its output to the AST interpreter) and fixed the failing categories — raising correctness from 53/77 to 73/77.

  • num (TypeScript/JavaScript number) is represented as i64 (integer-valued numbers are int): string coercion, switch, arithmetic and boxing.
  • switch on a boxed dynamic/Object scrutinee (e.g. a List<Object> element) is unboxed to i64 before the branch table.
  • Scalar Object/dynamic entry-point parameters are marshalled as host-allocated boxes — untyped JavaScript/Python/Lua main(a, b) (and an explicit Dart dynamic parameter) no longer see every argument as 0.
  • Generic Box<T> (Dart/Java/Kotlin/C#/TypeScript): a T field is a boxed Object; concrete values are boxed in and read back, and a boxed value used numerically is unboxed.
  • Anonymous functions with an untyped parameter (n => n * 2 from C#/Lua/Python) infer the parameter type from the body; a nested closure's return no longer makes the enclosing void function non-void.
  • Named nested function declarations (let f = (n) => …, which JavaScript/TypeScript parse as function declarations) are hoisted and lowered to a direct call.
  • More boxed-operand operations: a var s = a + b with boxed operands is refined to the result type, and the == 0 fast path (i64.eqz) unboxes a boxed operand.

Validated on the native wasm_run runtime and on Chrome (WasmGC).

Known remaining gaps (documented): integer division-by-zero exception semantics (Dart/Java/Kotlin), and async/Future<T> compilation.

Full changes: https://github.com/ApolloVM/apollovm_dart/blob/master/CHANGELOG.md