[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.signatures = void 0;
|
---|
| 7 |
|
---|
| 8 | function sign(input, output) {
|
---|
| 9 | return [input, output];
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | var u32 = "u32";
|
---|
| 13 | var i32 = "i32";
|
---|
| 14 | var i64 = "i64";
|
---|
| 15 | var f32 = "f32";
|
---|
| 16 | var f64 = "f64";
|
---|
| 17 |
|
---|
| 18 | var vector = function vector(t) {
|
---|
| 19 | var vecType = [t]; // $FlowIgnore
|
---|
| 20 |
|
---|
| 21 | vecType.vector = true;
|
---|
| 22 | return vecType;
|
---|
| 23 | };
|
---|
| 24 |
|
---|
| 25 | var controlInstructions = {
|
---|
| 26 | unreachable: sign([], []),
|
---|
| 27 | nop: sign([], []),
|
---|
| 28 | // block ?
|
---|
| 29 | // loop ?
|
---|
| 30 | // if ?
|
---|
| 31 | // if else ?
|
---|
| 32 | br: sign([u32], []),
|
---|
| 33 | br_if: sign([u32], []),
|
---|
| 34 | br_table: sign(vector(u32), []),
|
---|
| 35 | return: sign([], []),
|
---|
| 36 | call: sign([u32], []),
|
---|
| 37 | call_indirect: sign([u32], [])
|
---|
| 38 | };
|
---|
| 39 | var parametricInstructions = {
|
---|
| 40 | drop: sign([], []),
|
---|
| 41 | select: sign([], [])
|
---|
| 42 | };
|
---|
| 43 | var variableInstructions = {
|
---|
| 44 | get_local: sign([u32], []),
|
---|
| 45 | set_local: sign([u32], []),
|
---|
| 46 | tee_local: sign([u32], []),
|
---|
| 47 | get_global: sign([u32], []),
|
---|
| 48 | set_global: sign([u32], [])
|
---|
| 49 | };
|
---|
| 50 | var memoryInstructions = {
|
---|
| 51 | "i32.load": sign([u32, u32], [i32]),
|
---|
| 52 | "i64.load": sign([u32, u32], []),
|
---|
| 53 | "f32.load": sign([u32, u32], []),
|
---|
| 54 | "f64.load": sign([u32, u32], []),
|
---|
| 55 | "i32.load8_s": sign([u32, u32], [i32]),
|
---|
| 56 | "i32.load8_u": sign([u32, u32], [i32]),
|
---|
| 57 | "i32.load16_s": sign([u32, u32], [i32]),
|
---|
| 58 | "i32.load16_u": sign([u32, u32], [i32]),
|
---|
| 59 | "i64.load8_s": sign([u32, u32], [i64]),
|
---|
| 60 | "i64.load8_u": sign([u32, u32], [i64]),
|
---|
| 61 | "i64.load16_s": sign([u32, u32], [i64]),
|
---|
| 62 | "i64.load16_u": sign([u32, u32], [i64]),
|
---|
| 63 | "i64.load32_s": sign([u32, u32], [i64]),
|
---|
| 64 | "i64.load32_u": sign([u32, u32], [i64]),
|
---|
| 65 | "i32.store": sign([u32, u32], []),
|
---|
| 66 | "i64.store": sign([u32, u32], []),
|
---|
| 67 | "f32.store": sign([u32, u32], []),
|
---|
| 68 | "f64.store": sign([u32, u32], []),
|
---|
| 69 | "i32.store8": sign([u32, u32], []),
|
---|
| 70 | "i32.store16": sign([u32, u32], []),
|
---|
| 71 | "i64.store8": sign([u32, u32], []),
|
---|
| 72 | "i64.store16": sign([u32, u32], []),
|
---|
| 73 | "i64.store32": sign([u32, u32], []),
|
---|
| 74 | current_memory: sign([], []),
|
---|
| 75 | grow_memory: sign([], [])
|
---|
| 76 | };
|
---|
| 77 | var numericInstructions = {
|
---|
| 78 | "i32.const": sign([i32], [i32]),
|
---|
| 79 | "i64.const": sign([i64], [i64]),
|
---|
| 80 | "f32.const": sign([f32], [f32]),
|
---|
| 81 | "f64.const": sign([f64], [f64]),
|
---|
| 82 | "i32.eqz": sign([i32], [i32]),
|
---|
| 83 | "i32.eq": sign([i32, i32], [i32]),
|
---|
| 84 | "i32.ne": sign([i32, i32], [i32]),
|
---|
| 85 | "i32.lt_s": sign([i32, i32], [i32]),
|
---|
| 86 | "i32.lt_u": sign([i32, i32], [i32]),
|
---|
| 87 | "i32.gt_s": sign([i32, i32], [i32]),
|
---|
| 88 | "i32.gt_u": sign([i32, i32], [i32]),
|
---|
| 89 | "i32.le_s": sign([i32, i32], [i32]),
|
---|
| 90 | "i32.le_u": sign([i32, i32], [i32]),
|
---|
| 91 | "i32.ge_s": sign([i32, i32], [i32]),
|
---|
| 92 | "i32.ge_u": sign([i32, i32], [i32]),
|
---|
| 93 | "i64.eqz": sign([i64], [i64]),
|
---|
| 94 | "i64.eq": sign([i64, i64], [i32]),
|
---|
| 95 | "i64.ne": sign([i64, i64], [i32]),
|
---|
| 96 | "i64.lt_s": sign([i64, i64], [i32]),
|
---|
| 97 | "i64.lt_u": sign([i64, i64], [i32]),
|
---|
| 98 | "i64.gt_s": sign([i64, i64], [i32]),
|
---|
| 99 | "i64.gt_u": sign([i64, i64], [i32]),
|
---|
| 100 | "i64.le_s": sign([i64, i64], [i32]),
|
---|
| 101 | "i64.le_u": sign([i64, i64], [i32]),
|
---|
| 102 | "i64.ge_s": sign([i64, i64], [i32]),
|
---|
| 103 | "i64.ge_u": sign([i64, i64], [i32]),
|
---|
| 104 | "f32.eq": sign([f32, f32], [i32]),
|
---|
| 105 | "f32.ne": sign([f32, f32], [i32]),
|
---|
| 106 | "f32.lt": sign([f32, f32], [i32]),
|
---|
| 107 | "f32.gt": sign([f32, f32], [i32]),
|
---|
| 108 | "f32.le": sign([f32, f32], [i32]),
|
---|
| 109 | "f32.ge": sign([f32, f32], [i32]),
|
---|
| 110 | "f64.eq": sign([f64, f64], [i32]),
|
---|
| 111 | "f64.ne": sign([f64, f64], [i32]),
|
---|
| 112 | "f64.lt": sign([f64, f64], [i32]),
|
---|
| 113 | "f64.gt": sign([f64, f64], [i32]),
|
---|
| 114 | "f64.le": sign([f64, f64], [i32]),
|
---|
| 115 | "f64.ge": sign([f64, f64], [i32]),
|
---|
| 116 | "i32.clz": sign([i32], [i32]),
|
---|
| 117 | "i32.ctz": sign([i32], [i32]),
|
---|
| 118 | "i32.popcnt": sign([i32], [i32]),
|
---|
| 119 | "i32.add": sign([i32, i32], [i32]),
|
---|
| 120 | "i32.sub": sign([i32, i32], [i32]),
|
---|
| 121 | "i32.mul": sign([i32, i32], [i32]),
|
---|
| 122 | "i32.div_s": sign([i32, i32], [i32]),
|
---|
| 123 | "i32.div_u": sign([i32, i32], [i32]),
|
---|
| 124 | "i32.rem_s": sign([i32, i32], [i32]),
|
---|
| 125 | "i32.rem_u": sign([i32, i32], [i32]),
|
---|
| 126 | "i32.and": sign([i32, i32], [i32]),
|
---|
| 127 | "i32.or": sign([i32, i32], [i32]),
|
---|
| 128 | "i32.xor": sign([i32, i32], [i32]),
|
---|
| 129 | "i32.shl": sign([i32, i32], [i32]),
|
---|
| 130 | "i32.shr_s": sign([i32, i32], [i32]),
|
---|
| 131 | "i32.shr_u": sign([i32, i32], [i32]),
|
---|
| 132 | "i32.rotl": sign([i32, i32], [i32]),
|
---|
| 133 | "i32.rotr": sign([i32, i32], [i32]),
|
---|
| 134 | "i64.clz": sign([i64], [i64]),
|
---|
| 135 | "i64.ctz": sign([i64], [i64]),
|
---|
| 136 | "i64.popcnt": sign([i64], [i64]),
|
---|
| 137 | "i64.add": sign([i64, i64], [i64]),
|
---|
| 138 | "i64.sub": sign([i64, i64], [i64]),
|
---|
| 139 | "i64.mul": sign([i64, i64], [i64]),
|
---|
| 140 | "i64.div_s": sign([i64, i64], [i64]),
|
---|
| 141 | "i64.div_u": sign([i64, i64], [i64]),
|
---|
| 142 | "i64.rem_s": sign([i64, i64], [i64]),
|
---|
| 143 | "i64.rem_u": sign([i64, i64], [i64]),
|
---|
| 144 | "i64.and": sign([i64, i64], [i64]),
|
---|
| 145 | "i64.or": sign([i64, i64], [i64]),
|
---|
| 146 | "i64.xor": sign([i64, i64], [i64]),
|
---|
| 147 | "i64.shl": sign([i64, i64], [i64]),
|
---|
| 148 | "i64.shr_s": sign([i64, i64], [i64]),
|
---|
| 149 | "i64.shr_u": sign([i64, i64], [i64]),
|
---|
| 150 | "i64.rotl": sign([i64, i64], [i64]),
|
---|
| 151 | "i64.rotr": sign([i64, i64], [i64]),
|
---|
| 152 | "f32.abs": sign([f32], [f32]),
|
---|
| 153 | "f32.neg": sign([f32], [f32]),
|
---|
| 154 | "f32.ceil": sign([f32], [f32]),
|
---|
| 155 | "f32.floor": sign([f32], [f32]),
|
---|
| 156 | "f32.trunc": sign([f32], [f32]),
|
---|
| 157 | "f32.nearest": sign([f32], [f32]),
|
---|
| 158 | "f32.sqrt": sign([f32], [f32]),
|
---|
| 159 | "f32.add": sign([f32, f32], [f32]),
|
---|
| 160 | "f32.sub": sign([f32, f32], [f32]),
|
---|
| 161 | "f32.mul": sign([f32, f32], [f32]),
|
---|
| 162 | "f32.div": sign([f32, f32], [f32]),
|
---|
| 163 | "f32.min": sign([f32, f32], [f32]),
|
---|
| 164 | "f32.max": sign([f32, f32], [f32]),
|
---|
| 165 | "f32.copysign": sign([f32, f32], [f32]),
|
---|
| 166 | "f64.abs": sign([f64], [f64]),
|
---|
| 167 | "f64.neg": sign([f64], [f64]),
|
---|
| 168 | "f64.ceil": sign([f64], [f64]),
|
---|
| 169 | "f64.floor": sign([f64], [f64]),
|
---|
| 170 | "f64.trunc": sign([f64], [f64]),
|
---|
| 171 | "f64.nearest": sign([f64], [f64]),
|
---|
| 172 | "f64.sqrt": sign([f64], [f64]),
|
---|
| 173 | "f64.add": sign([f64, f64], [f64]),
|
---|
| 174 | "f64.sub": sign([f64, f64], [f64]),
|
---|
| 175 | "f64.mul": sign([f64, f64], [f64]),
|
---|
| 176 | "f64.div": sign([f64, f64], [f64]),
|
---|
| 177 | "f64.min": sign([f64, f64], [f64]),
|
---|
| 178 | "f64.max": sign([f64, f64], [f64]),
|
---|
| 179 | "f64.copysign": sign([f64, f64], [f64]),
|
---|
| 180 | "i32.wrap/i64": sign([i64], [i32]),
|
---|
| 181 | "i32.trunc_s/f32": sign([f32], [i32]),
|
---|
| 182 | "i32.trunc_u/f32": sign([f32], [i32]),
|
---|
| 183 | "i32.trunc_s/f64": sign([f32], [i32]),
|
---|
| 184 | "i32.trunc_u/f64": sign([f64], [i32]),
|
---|
| 185 | "i64.extend_s/i32": sign([i32], [i64]),
|
---|
| 186 | "i64.extend_u/i32": sign([i32], [i64]),
|
---|
| 187 | "i64.trunc_s/f32": sign([f32], [i64]),
|
---|
| 188 | "i64.trunc_u/f32": sign([f32], [i64]),
|
---|
| 189 | "i64.trunc_s/f64": sign([f64], [i64]),
|
---|
| 190 | "i64.trunc_u/f64": sign([f64], [i64]),
|
---|
| 191 | "f32.convert_s/i32": sign([i32], [f32]),
|
---|
| 192 | "f32.convert_u/i32": sign([i32], [f32]),
|
---|
| 193 | "f32.convert_s/i64": sign([i64], [f32]),
|
---|
| 194 | "f32.convert_u/i64": sign([i64], [f32]),
|
---|
| 195 | "f32.demote/f64": sign([f64], [f32]),
|
---|
| 196 | "f64.convert_s/i32": sign([i32], [f64]),
|
---|
| 197 | "f64.convert_u/i32": sign([i32], [f64]),
|
---|
| 198 | "f64.convert_s/i64": sign([i64], [f64]),
|
---|
| 199 | "f64.convert_u/i64": sign([i64], [f64]),
|
---|
| 200 | "f64.promote/f32": sign([f32], [f64]),
|
---|
| 201 | "i32.reinterpret/f32": sign([f32], [i32]),
|
---|
| 202 | "i64.reinterpret/f64": sign([f64], [i64]),
|
---|
| 203 | "f32.reinterpret/i32": sign([i32], [f32]),
|
---|
| 204 | "f64.reinterpret/i64": sign([i64], [f64])
|
---|
| 205 | };
|
---|
| 206 | var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
|
---|
| 207 | exports.signatures = signatures; |
---|