Skip to content

Optimize stack ops: use 8-byte data instead of 16-byte data #72

@rdunnington

Description

@rdunnington

The Val struct is 16 bytes due to it needing to contain a v128 (f32x4) value. Additionally it contains FuncRef, which is a 12-byte value.

Supporting vector opts allows conformance with wasm 2.0 spec, but since the stack operates on slices of the Val struct for values, we're paying 2x the overhead to copy values around in most cases, since the vast majority of wasm deals with 32 or 64-bit data, not 128. We should switch to a smaller 8-byte primitive-based stack to avoid that overhead. V128 values can span 2 8-byte values. The type-generic instructions like Local_Get, etc can become strongly typed thanks to the validation step's ability to determine the type of information on top of the stack, which can then be stored in immediates to determine the appropriate type to use.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions