UNPKG

walt-compiler

Version:

Alternative syntax for WebAssembly text format

451 lines (445 loc) 20 kB
# Snapshot report for `src/__tests__/function-spec.js` The actual snapshot is saved in `function-spec.js.snap`. Generated by [AVA](https://ava.li). ## functions > Snapshot 1 `00000000: 6d736100 ; \\0asm␊ 00000004: 1 ; version 1 00000008: 1 ; Types section␊ 00000009: 1e ; size␊ 0000000a: 6 ; count␊ 0000000b: 60 ; func type (0)␊ 0000000c: 0 ; parameter count␊ 0000000d: 1 ; result count␊ 0000000e: 7f ; result type i32␊ 0000000f: 60 ; func type (1)␊ 00000010: 1 ; parameter count␊ 00000011: 7f ; param␊ 00000012: 1 ; result count␊ 00000013: 7f ; result type i32␊ 00000014: 60 ; func type (2)␊ 00000015: 1 ; parameter count␊ 00000016: 7f ; param␊ 00000017: 0 ; result count␊ 00000018: 60 ; func type (3)␊ 00000019: 2 ; parameter count␊ 0000001a: 7f ; param␊ 0000001b: 7f ; param␊ 0000001c: 1 ; result count␊ 0000001d: 7f ; result type i32␊ 0000001e: 60 ; func type (4)␊ 0000001f: 0 ; parameter count␊ 00000020: 0 ; result count␊ 00000021: 60 ; func type (5)␊ 00000022: 3 ; parameter count␊ 00000023: 7f ; param␊ 00000024: 7f ; param␊ 00000025: 7f ; param␊ 00000026: 1 ; result count␊ 00000027: 7f ; result type i32␊ 00000028: 3 ; Functions section␊ 00000029: d ; size␊ 0000002a: c ; count␊ 0000002b: 1 ; type index␊ 0000002c: 0 ; type index␊ 0000002d: 2 ; type index␊ 0000002e: 3 ; type index␊ 0000002f: 0 ; type index␊ 00000030: 4 ; type index␊ 00000031: 4 ; type index␊ 00000032: 0 ; type index␊ 00000033: 0 ; type index␊ 00000034: 0 ; type index␊ 00000035: 5 ; type index␊ 00000036: 0 ; type index␊ 00000037: 4 ; Table section␊ 00000038: 5 ; size␊ 00000039: 1 ; count␊ 0000003a: 70 ; anyfunc␊ 0000003b: 1 ; has max␊ 0000003c: a ; initial table size␊ 0000003d: a ; max table size␊ 0000003e: 5 ; Memory section␊ 0000003f: 3 ; size␊ 00000040: 1 ; count␊ 00000041: 0 ; has no max␊ 00000042: 1 ; initial memory size(PAGES)␊ 00000043: 6 ; Globals section␊ 00000044: 6 ; size␊ 00000045: 1 ; count␊ 00000046: 7f ; i32␊ 00000047: 0 ; mutable␊ 00000048: 41 ; i32.const␊ 00000049: 20 ; value (32)␊ 0000004a: b ; end␊ 0000004b: 7 ; Exports section␊ 0000004c: a8,1 ; size␊ 0000004e: 8 ; count␊ 0000004f: a ; field␊ 00000050: 74 ; t␊ 00000051: 65 ; e␊ 00000052: 73 ; s␊ 00000053: 74 ; t␊ 00000054: 50 ; P␊ 00000055: 61 ; a␊ 00000056: 72 ; r␊ 00000057: 61 ; a␊ 00000058: 6d ; m␊ 00000059: 73 ; s␊ 0000005a: 0 ; Global␊ 0000005b: 3 ; index␊ 0000005c: f ; field␊ 0000005d: 74 ; t␊ 0000005e: 65 ; e␊ 0000005f: 73 ; s␊ 00000060: 74 ; t␊ 00000061: 47 ; G␊ 00000062: 6c ; l␊ 00000063: 6f ; o␊ 00000064: 62 ; b␊ 00000065: 61 ; a␊ 00000066: 6c ; l␊ 00000067: 53 ; S␊ 00000068: 63 ; c␊ 00000069: 6f ; o␊ 0000006a: 70 ; p␊ 0000006b: 65 ; e␊ 0000006c: 0 ; Global␊ 0000006d: 4 ; index␊ 0000006e: 17 ; field␊ 0000006f: 74 ; t␊ 00000070: 65 ; e␊ 00000071: 73 ; s␊ 00000072: 74 ; t␊ 00000073: 55 ; U␊ 00000074: 6e ; n␊ 00000075: 69 ; i␊ 00000076: 6e ; n␊ 00000077: 69 ; i␊ 00000078: 74 ; t␊ 00000079: 69 ; i␊ 0000007a: 61 ; a␊ 0000007b: 6c ; l␊ 0000007c: 69 ; i␊ 0000007d: 7a ; z␊ 0000007e: 65 ; e␊ 0000007f: 64 ; d␊ 00000080: 4c ; L␊ 00000081: 6f ; o␊ 00000082: 63 ; c␊ 00000083: 61 ; a␊ 00000084: 6c ; l␊ 00000085: 73 ; s␊ 00000086: 0 ; Global␊ 00000087: 5 ; index␊ 00000088: 12 ; field␊ 00000089: 74 ; t␊ 0000008a: 65 ; e␊ 0000008b: 73 ; s␊ 0000008c: 74 ; t␊ 0000008d: 56 ; V␊ 0000008e: 6f ; o␊ 0000008f: 69 ; i␊ 00000090: 64 ; d␊ 00000091: 49 ; I␊ 00000092: 73 ; s␊ 00000093: 4f ; O␊ 00000094: 70 ; p␊ 00000095: 74 ; t␊ 00000096: 69 ; i␊ 00000097: 6f ; o␊ 00000098: 6e ; n␊ 00000099: 61 ; a␊ 0000009a: 6c ; l␊ 0000009b: 0 ; Global␊ 0000009c: 6 ; index␊ 0000009d: 13 ; field␊ 0000009e: 74 ; t␊ 0000009f: 65 ; e␊ 000000a0: 73 ; s␊ 000000a1: 74 ; t␊ 000000a2: 30 ; 0 000000a3: 46 ; F␊ 000000a4: 75 ; u␊ 000000a5: 6e ; n␊ 000000a6: 63 ; c␊ 000000a7: 74 ; t␊ 000000a8: 69 ; i␊ 000000a9: 6f ; o␊ 000000aa: 6e ; n␊ 000000ab: 4e ; N␊ 000000ac: 61 ; a␊ 000000ad: 6d ; m␊ 000000ae: 65 ; e␊ 000000af: 73 ; s␊ 000000b0: 31 ; 1 000000b1: 0 ; Global␊ 000000b2: 7 ; index␊ 000000b3: 14 ; field␊ 000000b4: 74 ; t␊ 000000b5: 65 ; e␊ 000000b6: 73 ; s␊ 000000b7: 74 ; t␊ 000000b8: 50 ; P␊ 000000b9: 6f ; o␊ 000000ba: 69 ; i␊ 000000bb: 6e ; n␊ 000000bc: 74 ; t␊ 000000bd: 65 ; e␊ 000000be: 72 ; r␊ 000000bf: 41 ; A␊ 000000c0: 72 ; r␊ 000000c1: 67 ; g␊ 000000c2: 75 ; u␊ 000000c3: 6d ; m␊ 000000c4: 65 ; e␊ 000000c5: 6e ; n␊ 000000c6: 74 ; t␊ 000000c7: 73 ; s␊ 000000c8: 0 ; Global␊ 000000c9: 8 ; index␊ 000000ca: 14 ; field␊ 000000cb: 74 ; t␊ 000000cc: 65 ; e␊ 000000cd: 73 ; s␊ 000000ce: 74 ; t␊ 000000cf: 46 ; F␊ 000000d0: 75 ; u␊ 000000d1: 6e ; n␊ 000000d2: 63 ; c␊ 000000d3: 74 ; t␊ 000000d4: 69 ; i␊ 000000d5: 6f ; o␊ 000000d6: 6e ; n␊ 000000d7: 50 ; P␊ 000000d8: 6f ; o␊ 000000d9: 69 ; i␊ 000000da: 6e ; n␊ 000000db: 74 ; t␊ 000000dc: 65 ; e␊ 000000dd: 72 ; r␊ 000000de: 73 ; s␊ 000000df: 0 ; Global␊ 000000e0: 9 ; index␊ 000000e1: 12 ; field␊ 000000e2: 74 ; t␊ 000000e3: 65 ; e␊ 000000e4: 73 ; s␊ 000000e5: 74 ; t␊ 000000e6: 41 ; A␊ 000000e7: 72 ; r␊ 000000e8: 72 ; r␊ 000000e9: 61 ; a␊ 000000ea: 79 ; y␊ 000000eb: 41 ; A␊ 000000ec: 72 ; r␊ 000000ed: 67 ; g␊ 000000ee: 75 ; u␊ 000000ef: 6d ; m␊ 000000f0: 65 ; e␊ 000000f1: 6e ; n␊ 000000f2: 74 ; t␊ 000000f3: 73 ; s␊ 000000f4: 0 ; Global␊ 000000f5: b ; index␊ 000000f6: 9 ; Element section␊ 000000f7: 7 ; size␊ 000000f8: 1 ; count␊ 000000f9: 0 ; table index␊ 000000fa: 41 ; offset␊ 000000fb: 0 ; 0 000000fc: b ; end␊ 000000fd: 1 ; number of elements␊ 000000fe: 1 ; function index␊ 000000ff: a ; Code section␊ 00000100: bd,1 ; size␊ 00000102: c ; function count␊ 00000103: 8 ; Function callback␊ 00000104: 0 ; locals count␊ 00000105: 20 ; get_local pointer<Test>␊ 00000106: 0 ; i32.literal␊ 00000107: 11 ; call_indirect 00000108: 0 ; i32.literal␊ 00000109: 0 ; i32.literal␊ 0000010a: f ; return 0000010b: b ; end␊ 0000010c: 5 ; Function result␊ 0000010d: 0 ; locals count␊ 0000010e: 41 ; i32.const 0000010f: 2 ; i32.literal␊ 00000110: f ; return 00000111: b ; end␊ 00000112: 15 ; Function addOne␊ 00000113: 0 ; locals count␊ 00000114: 20 ; get_local ptr<Type>␊ 00000115: 0 ; i32.literal␊ 00000116: 41 ; i32.const 00000117: 0 ; i32.literal␊ 00000118: 6a ; i32.add 00000119: 20 ; get_local ptr<Type>␊ 0000011a: 0 ; i32.literal␊ 0000011b: 41 ; i32.const 0000011c: 0 ; i32.literal␊ 0000011d: 6a ; i32.add 0000011e: 28 ; i32.load 0000011f: 2 ; memory_immediate␊ 00000120: 0 ; memory_immediate␊ 00000121: 41 ; i32.const 00000122: 1 ; i32.literal␊ 00000123: 6a ; i32.add 00000124: 36 ; i32.store 00000125: 2 ; memory_immediate␊ 00000126: 0 ; memory_immediate␊ 00000127: b ; end␊ 00000128: 8 ; Function testParams␊ 00000129: 0 ; locals count␊ 0000012a: 20 ; get_local x<i32>␊ 0000012b: 0 ; i32.literal␊ 0000012c: 20 ; get_local y<i32>␊ 0000012d: 1 ; i32.literal␊ 0000012e: 6a ; i32.add 0000012f: f ; return 00000130: b ; end␊ 00000131: b ; Function testGlobalScope␊ 00000132: 1 ; locals count␊ 00000133: 1 ; number of locals of following type␊ 00000134: 7f ; i32␊ 00000135: 41 ; i32.const 00000136: 2a ; i32.literal␊ 00000137: 21 ; set_local x<i32>␊ 00000138: 0 ; i32.literal␊ 00000139: 20 ; get_local x<i32>␊ 0000013a: 0 ; i32.literal␊ 0000013b: f ; return 0000013c: b ; end␊ 0000013d: 4 ; Function testUninitializedLocals␊ 0000013e: 1 ; locals count␊ 0000013f: 1 ; number of locals of following type␊ 00000140: 7f ; i32␊ 00000141: b ; end␊ 00000142: 2 ; Function testVoidIsOptional␊ 00000143: 0 ; locals count␊ 00000144: b ; end␊ 00000145: 5 ; Function test0FunctionNames1␊ 00000146: 0 ; locals count␊ 00000147: 41 ; i32.const 00000148: 2 ; i32.literal␊ 00000149: f ; return 0000014a: b ; end␊ 0000014b: 1f ; Function testPointerArguments␊ 0000014c: 1 ; locals count␊ 0000014d: 1 ; number of locals of following type␊ 0000014e: 7f ; i32␊ 0000014f: 41 ; i32.const 00000150: 0 ; i32.literal␊ 00000151: 21 ; set_local original<Type>␊ 00000152: 0 ; i32.literal␊ 00000153: 20 ; get_local original<Type>␊ 00000154: 0 ; i32.literal␊ 00000155: 41 ; i32.const 00000156: 0 ; i32.literal␊ 00000157: 6a ; i32.add 00000158: 41 ; i32.const 00000159: 4 ; i32.literal␊ 0000015a: 36 ; i32.store 0000015b: 2 ; memory_immediate␊ 0000015c: 0 ; memory_immediate␊ 0000015d: 20 ; get_local original<Type>␊ 0000015e: 0 ; i32.literal␊ 0000015f: 10 ; call addOne<void>␊ 00000160: 2 ; i32.literal␊ 00000161: 20 ; get_local original<Type>␊ 00000162: 0 ; i32.literal␊ 00000163: 41 ; i32.const 00000164: 0 ; i32.literal␊ 00000165: 6a ; i32.add 00000166: 28 ; i32.load 00000167: 2 ; memory_immediate␊ 00000168: 0 ; memory_immediate␊ 00000169: f ; return 0000016a: b ; end␊ 0000016b: c ; Function testFunctionPointers␊ 0000016c: 0 ; locals count␊ 0000016d: 41 ; i32.const 0000016e: 0 ; i32.literal␊ 0000016f: 10 ; call callback<i32>␊ 00000170: 0 ; i32.literal␊ 00000171: 41 ; i32.const 00000172: 0 ; i32.literal␊ 00000173: 10 ; call callback<i32>␊ 00000174: 0 ; i32.literal␊ 00000175: 6a ; i32.add 00000176: f ; return 00000177: b ; end␊ 00000178: 1a ; Function addArray␊ 00000179: 0 ; locals count␊ 0000017a: 20 ; get_local arr<i32>␊ 0000017b: 0 ; i32.literal␊ 0000017c: 20 ; get_local x<i32>␊ 0000017d: 1 ; i32.literal␊ 0000017e: 41 ; i32.const 0000017f: 2 ; i32.literal␊ 00000180: 74 ; i32.shl 00000181: 6a ; i32.add 00000182: 28 ; i32.load 00000183: 2 ; memory_immediate␊ 00000184: 0 ; memory_immediate␊ 00000185: 20 ; get_local arr<i32>␊ 00000186: 0 ; i32.literal␊ 00000187: 20 ; get_local y<i32>␊ 00000188: 2 ; i32.literal␊ 00000189: 41 ; i32.const 0000018a: 2 ; i32.literal␊ 0000018b: 74 ; i32.shl 0000018c: 6a ; i32.add 0000018d: 28 ; i32.load 0000018e: 2 ; memory_immediate␊ 0000018f: 0 ; memory_immediate␊ 00000190: 6a ; i32.add 00000191: f ; return 00000192: b ; end␊ 00000193: 2b ; Function testArrayArguments␊ 00000194: 1 ; locals count␊ 00000195: 1 ; number of locals of following type␊ 00000196: 7f ; i32␊ 00000197: 41 ; i32.const 00000198: 18 ; i32.literal␊ 00000199: 21 ; set_local arr<i32>␊ 0000019a: 0 ; i32.literal␊ 0000019b: 20 ; get_local arr<i32>␊ 0000019c: 0 ; i32.literal␊ 0000019d: 41 ; i32.const 0000019e: 0 ; i32.literal␊ 0000019f: 41 ; i32.const 000001a0: 2 ; i32.literal␊ 000001a1: 74 ; i32.shl 000001a2: 6a ; i32.add 000001a3: 41 ; i32.const 000001a4: 2 ; i32.literal␊ 000001a5: 36 ; i32.store 000001a6: 2 ; memory_immediate␊ 000001a7: 0 ; memory_immediate␊ 000001a8: 20 ; get_local arr<i32>␊ 000001a9: 0 ; i32.literal␊ 000001aa: 41 ; i32.const 000001ab: 4 ; i32.literal␊ 000001ac: 41 ; i32.const 000001ad: 2 ; i32.literal␊ 000001ae: 74 ; i32.shl 000001af: 6a ; i32.add 000001b0: 41 ; i32.const 000001b1: 3 ; i32.literal␊ 000001b2: 36 ; i32.store 000001b3: 2 ; memory_immediate␊ 000001b4: 0 ; memory_immediate␊ 000001b5: 20 ; get_local arr<i32>␊ 000001b6: 0 ; i32.literal␊ 000001b7: 41 ; i32.const 000001b8: 0 ; i32.literal␊ 000001b9: 41 ; i32.const 000001ba: 4 ; i32.literal␊ 000001bb: 10 ; call addArray<i32>␊ 000001bc: a ; i32.literal␊ 000001bd: f ; return 000001be: b ; end␊ ============ fin =============`