unreachable.js (1436B)
1 const INSTRUCTIONS = [ 2 "struct.new $s", 3 "struct.new_default $s", 4 "struct.get $s 0", 5 "struct.get_s $s 1", 6 "struct.get_u $s 1", 7 "struct.set $s 0", 8 "array.new $a_unpacked", 9 "array.new_fixed $a_unpacked 2", 10 "array.new_default $a_unpacked", 11 "array.new_data $a_data 0", 12 "array.new_elem $a_elem 0", 13 "array.get $a_unpacked", 14 "array.get_s $a_packed", 15 "array.get_u $a_packed", 16 "array.set $a_unpacked", 17 "array.copy $a_unpacked $a_unpacked", 18 "array.len", 19 "ref.i31", 20 "i31.get_s", 21 "i31.get_u", 22 "ref.test structref", 23 "ref.test (ref $s)", 24 "ref.test nullref", 25 "ref.test (ref $f)", 26 "ref.test nullfuncref", 27 "ref.test externref", 28 "ref.test nullexternref", 29 "ref.cast structref", 30 "ref.cast (ref $s)", 31 "ref.cast nullref", 32 "ref.cast (ref $f)", 33 "ref.cast nullfuncref", 34 "ref.cast externref", 35 "ref.cast nullexternref", 36 "br_on_cast 0 anyref (ref $s)", 37 "br_on_cast_fail 0 anyref (ref $s)", 38 "any.convert_extern", 39 "extern.convert_any", 40 ]; 41 42 for (let instruction of INSTRUCTIONS) { 43 print(instruction); 44 wasmEvalText(`(module 45 (type $f (func)) 46 (type $s (struct (field (mut i32)) (field (mut i8)))) 47 (type $a_unpacked (array (mut i32))) 48 (type $a_packed (array (mut i8))) 49 (type $a_data (array (mut i32))) 50 (type $a_elem (array (mut anyref))) 51 (data "") 52 (elem anyref) 53 (func (result anyref) 54 unreachable 55 ${instruction} 56 unreachable 57 ) 58 )`); 59 }