Menu
Major change proposed for WebAssembly

Major change proposed for WebAssembly

Proposed extension to enable functions to return multiple values would reduce code size and improve compiler efficiency, among other benefits

Credit: Dreamstime

WebAssembly, the highly touted binary format intended to speed up web applications, is slated to add a multi-value capability, enabling functions to return many values and bringing code size benefits and new instruction possibilities.

The proposal would lift current restrictions on functions, which can return only a zero or one value, and instruction sequences such as blocks, ifs, and loops, which cannot consume stack values and only can produce zero or a single resulting stack value.

With these restrictions gone, functions could return an arbitrary number of values and instruction sequences could produce an arbitrary number of stack values, according to a bulletin posted by Mozilla and Bytecode Alliance. Multi-value also is a prerequisite for Wasm interface types that describe high-level values such as records, sequences, and strings. 

The motivation behind the multi-value plan is that multiple return values for functions enable unboxing of tuples or structs returned by values and efficient compilation of multiple return values. In addition, loop labels can have arguments and there can be macro definability of instructions with inputs, the formal proposal on GitHub states.

Implementing multi-values would leave the structure and text format of the language mostly unaffected. The binary format requires a change to allow function types as block types. The current ad hoc encoding must be extended to allow references to function types. Developer Nick Fitzgerald said he has added multi-value support to crates in the Rust and WebAssembly toolchain as well as to the Wasmtime WebAssembly runtime.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Brand Post

Featured

Slideshows

Reseller News Platinum Club celebrates leading partners in 2019

Reseller News Platinum Club celebrates leading partners in 2019

The leading players of the New Zealand channel came together to celebrate a year of achievement at the annual Reseller News Platinum Club lunch in Auckland. Following the Reseller News Innovation Awards, Platinum Club provides a platform to showcase the top performing partners and start-ups of the past 12 months.

Reseller News Platinum Club celebrates leading partners in 2019
Reseller News hosts alumnae breakfast for Women in ICT Awards

Reseller News hosts alumnae breakfast for Women in ICT Awards

Reseller News hosted its second annual alumnae breakfast for the Women in ICT Awards in New Zealand, designed to showcase the leading female leaders in the industry. Held at The Cordis in Auckland, attendees came together to hear inspiring keynotes and panel discussions, alongside high-level networking among peers. Photos by Gino Demeer.

Reseller News hosts alumnae breakfast for Women in ICT Awards
Reseller News Innovation Awards 2019: meet the winners

Reseller News Innovation Awards 2019: meet the winners

Reseller News honoured the standout players of the New Zealand channel in front of more than 480 technology leaders in Auckland on 23 October, recognising the achievements of top partners, emerging entrants and innovative start-ups.

Reseller News Innovation Awards 2019: meet the winners
Show Comments