You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

signatures.js 6.8KB

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