bug1858982.js (1039B)
1 // Tests if instance registers were restored properly when call_ref is used 2 // with tail calls. 3 var t = wasmEvalText(`(module 4 (type $t1 (func)) 5 (func $f0 (param funcref i32 i32 i32 i32 i32 i32 i32 i32 i32) 6 local.get 0 7 ref.cast (ref $t1) 8 return_call_ref $t1 9 ) 10 (func $f1 (param i32)) 11 (elem declare func $f) 12 (func $f (param funcref) 13 (local i32 i32 i32 i32) 14 local.get 0 15 i32.const 1 16 i32.const 1 17 i32.const 1 18 i32.const 1 19 i32.const 1 20 i32.const 1 21 i32.const 1 22 i32.const 1 23 i32.const 1 24 return_call $f0 25 ) 26 (func (export "f") (result funcref) 27 ref.func $f 28 ) 29 )`); 30 31 var t2 = wasmEvalText(`(module 32 (import "" "f" (func $fi (result funcref))) 33 (type $t1 (func (param funcref))) 34 (elem declare func $f2) 35 (func $f2) 36 (func (export "test") 37 ref.func $f2 38 call $fi 39 ref.cast (ref $t1) 40 call_ref $t1 41 ) 42 )`, {"": {f:t.exports.f},}); 43 44 t2.exports.test();