Skip to content

v0.1.45

Latest

Choose a tag to compare

@gmpassos gmpassos released this 27 Jun 20:16
b9098e5

Wasm backend: collection-to-String + dynamic arithmetic on boxed values

  • Map/ListString coercion in print(...) / string interpolation (e.g. print('Map: $m'), '$list'), rendering Dart's {k: v, …} / [e, …] form.
  • Arithmetic and comparison on boxed Object/dynamic operands (e.g. values read from a List<Object>: args[1] + 5, args[2] ~/ 2, c > 120) — unboxed to a concrete number (runtime box-tag dispatch: int→i64, double→f64) before the operation.
  • A boxed Object value flowing into a typed numeric Map/List slot is unboxed to match the i64/f64 slot width.

Wasm backend: anonymous functions assigned to a var and called directly

  • Lambdas stored in a var and invoked by name now compile (var twice = (int n) => n * 2; … twice(x)). The return type is inferred from the body when no typed call context provides it, and the variable adopts the closure's concrete signature.
  • Fixed anonymous functions being exported with an empty name (two closures collided on the same "" export name → invalid module). They are internal/table-dispatched and no longer exported.
  • Optimization: a capture-free closure assigned to a var that is only ever called (never used as a value, reassigned, or captured) is lowered to a direct call — no environment heap allocation, no call_indirect, and the function-table / element sections are omitted. Closures used as first-class values or that capture variables keep the environment + table path.

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

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