From 9831b36d339b1cea61d5313f7dfa256fc1ee9bcc Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 7 Jul 2022 12:46:43 -0700 Subject: Group reference types in binary format. (#4774) Grouping all references together makes it easier for baseline compilers to zero out memory (as the zeroing out may be different for MVP types vs. references). This puts all references together, either at the start or the end. As a heuristic for that we see if the first local is a reference. As the optimizer will sort locals by frequency, this ensures that the most-frequent local stays in index 0. Fixes #4773. See more details there --- ...function-references.wast.fromBinary.noDebugInfo | 43 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'test/typed-function-references.wast.fromBinary.noDebugInfo') diff --git a/test/typed-function-references.wast.fromBinary.noDebugInfo b/test/typed-function-references.wast.fromBinary.noDebugInfo index cf462ffba..9e68efcc1 100644 --- a/test/typed-function-references.wast.fromBinary.noDebugInfo +++ b/test/typed-function-references.wast.fromBinary.noDebugInfo @@ -1,7 +1,7 @@ (module + (type $none_=>_anyref_f32_anyref_f32 (func (result anyref f32 anyref f32))) (type $none_=>_none (func)) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $none_=>_anyref_f32_anyref_f32 (func (result anyref f32 anyref f32))) (type $none_=>_eqref (func (result eqref))) (type $ref|i32_->_i32|_=>_i32 (func (param (ref $i32_=>_i32)) (result i32))) (type $ref?|i32_->_i32|_=>_i32 (func (param (ref null $i32_=>_i32)) (result i32))) @@ -9,6 +9,7 @@ (type $f64_=>_ref?|none_->_eqref| (func (param f64) (result (ref null $none_=>_eqref)))) (type $none_=>_anyref (func (result anyref))) (type $none_=>_i32_ref?|none_->_anyref_f32_anyref_f32|_f64 (func (result i32 (ref null $none_=>_anyref_f32_anyref_f32) f64))) + (type $ref?|none_->_anyref_f32_anyref_f32|_=>_none (func (param (ref null $none_=>_anyref_f32_anyref_f32)))) (elem declare func $0 $2) (func $0 (call_ref @@ -53,8 +54,8 @@ ) (func $7 (local $0 i32) - (local $1 (ref null $none_=>_anyref)) - (local $2 f64) + (local $1 f64) + (local $2 (ref null $none_=>_anyref)) (nop) ) (func $8 @@ -92,5 +93,41 @@ ) ) ) + (func $9 + (local $0 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $1 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $2 anyref) + (local $3 anyref) + (local $4 anyref) + (local $5 funcref) + (local $6 i32) + (local $7 i64) + (local $8 i64) + (nop) + ) + (func $10 + (local $0 i32) + (local $1 i64) + (local $2 i64) + (local $3 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $4 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $5 anyref) + (local $6 anyref) + (local $7 anyref) + (local $8 funcref) + (nop) + ) + (func $11 (param $0 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $1 i32) + (local $2 i64) + (local $3 i64) + (local $4 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $5 (ref null $none_=>_anyref_f32_anyref_f32)) + (local $6 anyref) + (local $7 anyref) + (local $8 anyref) + (local $9 funcref) + (nop) + ) ) -- cgit v1.2.3