wardite 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/scripts/gen_conv.rb CHANGED
@@ -39,11 +39,18 @@ module GenConv
39
39
  code = DEF.dup
40
40
  method = op.to_s
41
41
  symbol = "#{to.to_s}_#{method}_#{from.to_sym}"
42
+ extra_kargs = ""
42
43
 
43
44
  if method == "extend"
44
45
  method = "extend_"
46
+ elsif method =~ /^extendN_(u|s)$/
47
+ suffix = $1
48
+ from_size = from.to_s.scan(/\d+/).join
49
+ symbol = "#{to.to_s}_extend_#{from_size}_#{suffix}"
50
+ extra_kargs = ", from: :#{from.to_s}"
45
51
  elsif method.end_with?("_s") or method.end_with?("_u")
46
- core, suffix = *(method.split("_")[0..1])
52
+ core = method.sub(/_(s|u)$/, "")
53
+ suffix = method.scan(/_(s|u)$/).join
47
54
  symbol = "#{to.to_s}_#{core}_#{from.to_sym}_#{suffix}"
48
55
  end
49
56
  # NOTE to is as namespace
@@ -52,11 +59,14 @@ module GenConv
52
59
  code.gsub!(/\$\{TO\}/, to.to_s)
53
60
  code.gsub!(/\$\{TO_CLASS\}/, to_class(to.to_sym))
54
61
  code.gsub!(/\$\{FROM_CLASS\}/, to_class(from.to_sym))
62
+ code.gsub!(/\$\{EXTRA_KARGS\}/, extra_kargs)
55
63
  return code
56
64
  end
57
65
 
58
66
  def self.to_class(typ)
59
67
  {
68
+ i8: "I32",
69
+ i16: "I32",
60
70
  i32: "I32",
61
71
  i64: "I64",
62
72
  f32: "F32",
@@ -69,7 +79,7 @@ module GenConv
69
79
  when :${SYMBOL}
70
80
  from = runtime.stack.pop
71
81
  raise EvalError, "maybe empty or invalid stack" if !from.is_a?(${FROM_CLASS})
72
- to = from.${METHOD}(to: :${TO})
82
+ to = from.${METHOD}(to: :${TO}${EXTRA_KARGS})
73
83
  raise EvalError, "failed to convert type" if !to.is_a?(${TO_CLASS})
74
84
  runtime.stack.push(to)
75
85
  RUBY
@@ -28,6 +28,8 @@ module Wardite
28
28
  SectionCode: Integer
29
29
 
30
30
  SectionData: Integer
31
+
32
+ SectionDataCount: Integer
31
33
  end
32
34
 
33
35
  include Const
@@ -1,34 +1,46 @@
1
1
  # Generated from lib/wardite/instruction.rb with RBS::Inline
2
2
 
3
3
  module Wardite
4
+ type operandItem = Integer | Array[Integer] | Float | Block
5
+
4
6
  class Op
5
7
  # @see https://pengowray.github.io/wasm-ops/
6
8
  SYMS: Array[Symbol]
7
9
 
10
+ FC_SYMS: Array[Symbol]
11
+
8
12
  # @rbs return: Hash[Integer, Symbol]
9
13
  def self.table: () -> Hash[Integer, Symbol]
10
14
 
15
+ # @rbs return: Hash[Integer, Symbol]
16
+ def self.fc_table: () -> Hash[Integer, Symbol]
17
+
11
18
  attr_accessor namespace: Symbol
12
19
 
13
20
  attr_accessor code: Symbol
14
21
 
15
22
  # TODO: add types of potential operands
16
- attr_accessor operand: Array[Integer | Float | Block]
23
+ attr_accessor operand: Array[operandItem]
17
24
 
18
25
  # @rbs namespace: Symbol
19
26
  # @rbs code: Symbol
20
- # @rbs operand: Array[Integer|Float|Block]
21
- def initialize: (Symbol namespace, Symbol code, Array[Integer | Float | Block] operand) -> untyped
27
+ # @rbs operand: Array[operandItem]
28
+ def initialize: (Symbol namespace, Symbol code, Array[operandItem] operand) -> untyped
22
29
 
23
30
  # @rbs chr: String
24
31
  # @rbs return: [Symbol, Symbol]
25
32
  def self.to_sym: (String chr) -> [ Symbol, Symbol ]
26
33
 
34
+ # @rbs lower: Integer
35
+ # @rbs return: [Symbol, Symbol]
36
+ def self.resolve_fc_sym: (Integer lower) -> [ Symbol, Symbol ]
37
+
27
38
  # @rbs code: Symbol
28
39
  # @rbs return: Array[Symbol]
29
40
  def self.operand_of: (Symbol code) -> Array[Symbol]
30
41
 
31
42
  # @see https://www.w3.org/TR/wasm-core-1/#value-types%E2%91%A2
43
+ # We use this for reftype conversion. https://webassembly.github.io/spec/core/binary/types.html#binary-reftype
32
44
  # @rbs code: Integer
33
45
  # @rbs return: Symbol
34
46
  def self.i2type: (Integer code) -> Symbol
@@ -26,8 +26,17 @@ module Wardite
26
26
  def initialize: () -> void
27
27
  end
28
28
 
29
+ class TableSection < Section
30
+ attr_accessor table_types: Array[Symbol]
31
+
32
+ attr_accessor table_limits: Array[[ Integer, Integer? ]]
33
+
34
+ # @rbs return: void
35
+ def initialize: () -> void
36
+ end
37
+
29
38
  class MemorySection < Section
30
- attr_accessor limits: Array[[ Integer, Integer | nil ]]
39
+ attr_accessor limits: Array[[ Integer, Integer? ]]
31
40
 
32
41
  # @rbs return: void
33
42
  def initialize: () -> void
@@ -42,7 +51,7 @@ module Wardite
42
51
  # TODO: unused in wasm 1.0 spec?
43
52
  attr_accessor shared: bool
44
53
 
45
- attr_accessor value: I32 | I64 | F32 | F64
54
+ attr_accessor value: wasmValue
46
55
 
47
56
  # @rbs &blk: (Global) -> void
48
57
  # @rbs return: void
@@ -55,6 +64,24 @@ module Wardite
55
64
  def initialize: () -> void
56
65
  end
57
66
 
67
+ class StartSection < Section
68
+ attr_accessor func_index: Integer
69
+
70
+ # @rbs return: void
71
+ def initialize: () -> void
72
+ end
73
+
74
+ class ElemSection < Section
75
+ attr_accessor table_indices: Array[Integer]
76
+
77
+ attr_accessor table_offsets: Array[Integer]
78
+
79
+ attr_accessor element_indices: Array[Array[Integer]]
80
+
81
+ # @rbs return: void
82
+ def initialize: () -> void
83
+ end
84
+
58
85
  class CodeSection < Section
59
86
  class CodeBody
60
87
  attr_accessor locals_count: Array[Integer]
@@ -76,7 +103,9 @@ module Wardite
76
103
 
77
104
  class DataSection < Section
78
105
  class Segment
79
- attr_accessor flags: Integer
106
+ attr_accessor mode: :active | :passive
107
+
108
+ attr_accessor mem_index: Integer
80
109
 
81
110
  attr_accessor offset: Integer
82
111
 
@@ -93,6 +122,14 @@ module Wardite
93
122
  def initialize: () -> void
94
123
  end
95
124
 
125
+ class DataCountSection < Section
126
+ attr_accessor count: Integer
127
+
128
+ # @rbs count: Integer
129
+ # @rbs return: void
130
+ def initialize: (Integer count) -> void
131
+ end
132
+
96
133
  class ExportSection < Section
97
134
  class ExportDesc
98
135
  attr_accessor name: String
@@ -134,11 +171,13 @@ module Wardite
134
171
 
135
172
  extend Wardite::ValueHelper
136
173
 
174
+ self.@buf: File | StringIO
175
+
137
176
  # @rbs buf: File|StringIO
138
- # @rbs import_object: Hash[Symbol, Hash[Symbol, Proc]]
177
+ # @rbs import_object: Hash[Symbol, Hash[Symbol, wasmCallable]]
139
178
  # @rbs enable_wasi: boolish
140
179
  # @rbs return: Instance
141
- def self.load_from_buffer: (File | StringIO buf, ?import_object: Hash[Symbol, Hash[Symbol, Proc]], ?enable_wasi: boolish) -> Instance
180
+ def self.load_from_buffer: (File | StringIO buf, ?import_object: Hash[Symbol, Hash[Symbol, wasmCallable]], ?enable_wasi: boolish) -> Instance
142
181
 
143
182
  # @rbs return: Integer
144
183
  def self.preamble: () -> Integer
@@ -155,12 +194,21 @@ module Wardite
155
194
  # @rbs return: MemorySection
156
195
  def self.memory_section: () -> MemorySection
157
196
 
197
+ # @rbs return: StartSection
198
+ def self.start_section: () -> StartSection
199
+
200
+ # @rbs return: ElemSection
201
+ def self.elem_section: () -> ElemSection
202
+
158
203
  # @rbs return: GlobalSection
159
204
  def self.global_section: () -> GlobalSection
160
205
 
161
206
  # @rbs return: FunctionSection
162
207
  def self.function_section: () -> FunctionSection
163
208
 
209
+ # @rbs return: TableSection
210
+ def self.table_section: () -> TableSection
211
+
164
212
  # @rbs return: CodeSection
165
213
  def self.code_section: () -> CodeSection
166
214
 
@@ -168,9 +216,17 @@ module Wardite
168
216
  # @rbs return: Array[::Wardite::Op]
169
217
  def self.code_body: (StringIO buf) -> Array[::Wardite::Op]
170
218
 
219
+ # @rbs c: String
220
+ # @rbs buf: StringIO
221
+ # @rbs return: [Symbol, Symbol]
222
+ def self.resolve_code: (String c, StringIO buf) -> [ Symbol, Symbol ]
223
+
171
224
  # @rbs return: DataSection
172
225
  def self.data_section: () -> DataSection
173
226
 
227
+ # @rbs return: DataCountSection
228
+ def self.data_count_section: () -> DataCountSection
229
+
174
230
  # @rbs sbuf: StringIO
175
231
  # @rbs return: String
176
232
  def self.fetch_insn_while_end: (StringIO sbuf) -> String
@@ -180,8 +236,8 @@ module Wardite
180
236
  def self.decode_expr: (Array[Op] ops) -> Integer
181
237
 
182
238
  # @rbs ops: Array[Op]
183
- # @rbs return: I32|I64|F32|F64
184
- def self.decode_global_expr: (Array[Op] ops) -> (I32 | I64 | F32 | F64)
239
+ # @rbs return: wasmValue
240
+ def self.decode_global_expr: (Array[Op] ops) -> wasmValue
185
241
 
186
242
  # @rbs return: ExportSection
187
243
  def self.export_section: () -> ExportSection
@@ -1,6 +1,8 @@
1
1
  # Generated from lib/wardite/value.rb with RBS::Inline
2
2
 
3
3
  module Wardite
4
+ type wasmValue = I32 | I64 | F32 | F64
5
+
4
6
  module ValueHelper
5
7
  # @rbs value: Integer
6
8
  # @rbs return: I32
@@ -34,7 +36,7 @@ module Wardite
34
36
  class I32
35
37
  include ValueHelper
36
38
 
37
- I32_MAX: untyped
39
+ I32_MAX: Integer
38
40
 
39
41
  # value should be stored as unsigned Integer, even in I32/I64
40
42
  # when we want to access signed value, it'd be done via #value_s
@@ -59,44 +61,57 @@ module Wardite
59
61
  def packed: (?size: Integer | nil) -> String
60
62
 
61
63
  # @rbs to: Symbol
62
- # @rbs return: I32|I64|F32|F64
63
- def wrap: (to: Symbol) -> (I32 | I64 | F32 | F64)
64
+ # @rbs return: wasmValue
65
+ def wrap: (to: Symbol) -> wasmValue
66
+
67
+ # @rbs to: Symbol
68
+ # @rbs return: wasmValue
69
+ def extend_s: (to: Symbol) -> wasmValue
70
+
71
+ # @rbs to: Symbol
72
+ # @rbs return: wasmValue
73
+ def extend_u: (to: Symbol) -> wasmValue
74
+
75
+ # @rbs to: Symbol
76
+ # @rbs return: wasmValue
77
+ def trunc_s: (to: Symbol) -> wasmValue
64
78
 
65
79
  # @rbs to: Symbol
66
- # @rbs return: I32|I64|F32|F64
67
- def extend_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
80
+ # @rbs return: wasmValue
81
+ def trunc_u: (to: Symbol) -> wasmValue
68
82
 
69
83
  # @rbs to: Symbol
70
- # @rbs return: I32|I64|F32|F64
71
- def extend_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
84
+ # @rbs return: wasmValue
85
+ def convert_s: (to: Symbol) -> wasmValue
72
86
 
73
87
  # @rbs to: Symbol
74
- # @rbs return: I32|I64|F32|F64
75
- def trunc_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
88
+ # @rbs return: wasmValue
89
+ def convert_u: (to: Symbol) -> wasmValue
76
90
 
77
91
  # @rbs to: Symbol
78
- # @rbs return: I32|I64|F32|F64
79
- def trunc_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
92
+ # @rbs return: wasmValue
93
+ def demote: (to: Symbol) -> wasmValue
80
94
 
81
95
  # @rbs to: Symbol
82
- # @rbs return: I32|I64|F32|F64
83
- def convert_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
96
+ # @rbs return: wasmValue
97
+ def promote: (to: Symbol) -> wasmValue
84
98
 
85
99
  # @rbs to: Symbol
86
- # @rbs return: I32|I64|F32|F64
87
- def convert_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
100
+ # @rbs return: wasmValue
101
+ def reinterpret: (to: Symbol) -> wasmValue
88
102
 
103
+ # @rbs from: Symbol
89
104
  # @rbs to: Symbol
90
- # @rbs return: I32|I64|F32|F64
91
- def demote: (to: Symbol) -> (I32 | I64 | F32 | F64)
105
+ # @rbs return: wasmValue
106
+ def extendN_s: (from: Symbol, to: Symbol) -> wasmValue
92
107
 
93
108
  # @rbs to: Symbol
94
- # @rbs return: I32|I64|F32|F64
95
- def promote: (to: Symbol) -> (I32 | I64 | F32 | F64)
109
+ # @rbs return: wasmValue
110
+ def trunc_sat_u: (to: Symbol) -> wasmValue
96
111
 
97
112
  # @rbs to: Symbol
98
- # @rbs return: I32|I64|F32|F64
99
- def reinterpret: (to: Symbol) -> (I32 | I64 | F32 | F64)
113
+ # @rbs return: wasmValue
114
+ def trunc_sat_s: (to: Symbol) -> wasmValue
100
115
 
101
116
  # I32#inspect shows signed value for convinience
102
117
  def inspect: () -> untyped
@@ -105,7 +120,7 @@ module Wardite
105
120
  class I64
106
121
  include ValueHelper
107
122
 
108
- I64_MAX: untyped
123
+ I64_MAX: Integer
109
124
 
110
125
  attr_accessor value: Integer
111
126
 
@@ -127,44 +142,57 @@ module Wardite
127
142
  def packed: (?size: Integer | nil) -> String
128
143
 
129
144
  # @rbs to: Symbol
130
- # @rbs return: I32|I64|F32|F64
131
- def wrap: (to: Symbol) -> (I32 | I64 | F32 | F64)
145
+ # @rbs return: wasmValue
146
+ def wrap: (to: Symbol) -> wasmValue
147
+
148
+ # @rbs to: Symbol
149
+ # @rbs return: wasmValue
150
+ def extend_s: (to: Symbol) -> wasmValue
151
+
152
+ # @rbs to: Symbol
153
+ # @rbs return: wasmValue
154
+ def extend_u: (to: Symbol) -> wasmValue
155
+
156
+ # @rbs to: Symbol
157
+ # @rbs return: wasmValue
158
+ def trunc_s: (to: Symbol) -> wasmValue
132
159
 
133
160
  # @rbs to: Symbol
134
- # @rbs return: I32|I64|F32|F64
135
- def extend_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
161
+ # @rbs return: wasmValue
162
+ def trunc_u: (to: Symbol) -> wasmValue
136
163
 
137
164
  # @rbs to: Symbol
138
- # @rbs return: I32|I64|F32|F64
139
- def extend_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
165
+ # @rbs return: wasmValue
166
+ def convert_s: (to: Symbol) -> wasmValue
140
167
 
141
168
  # @rbs to: Symbol
142
- # @rbs return: I32|I64|F32|F64
143
- def trunc_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
169
+ # @rbs return: wasmValue
170
+ def convert_u: (to: Symbol) -> wasmValue
144
171
 
145
172
  # @rbs to: Symbol
146
- # @rbs return: I32|I64|F32|F64
147
- def trunc_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
173
+ # @rbs return: wasmValue
174
+ def demote: (to: Symbol) -> wasmValue
148
175
 
149
176
  # @rbs to: Symbol
150
- # @rbs return: I32|I64|F32|F64
151
- def convert_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
177
+ # @rbs return: wasmValue
178
+ def promote: (to: Symbol) -> wasmValue
152
179
 
153
180
  # @rbs to: Symbol
154
- # @rbs return: I32|I64|F32|F64
155
- def convert_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
181
+ # @rbs return: wasmValue
182
+ def reinterpret: (to: Symbol) -> wasmValue
156
183
 
184
+ # @rbs from: Symbol
157
185
  # @rbs to: Symbol
158
- # @rbs return: I32|I64|F32|F64
159
- def demote: (to: Symbol) -> (I32 | I64 | F32 | F64)
186
+ # @rbs return: wasmValue
187
+ def extendN_s: (from: Symbol, to: Symbol) -> wasmValue
160
188
 
161
189
  # @rbs to: Symbol
162
- # @rbs return: I32|I64|F32|F64
163
- def promote: (to: Symbol) -> (I32 | I64 | F32 | F64)
190
+ # @rbs return: wasmValue
191
+ def trunc_sat_u: (to: Symbol) -> wasmValue
164
192
 
165
193
  # @rbs to: Symbol
166
- # @rbs return: I32|I64|F32|F64
167
- def reinterpret: (to: Symbol) -> (I32 | I64 | F32 | F64)
194
+ # @rbs return: wasmValue
195
+ def trunc_sat_s: (to: Symbol) -> wasmValue
168
196
 
169
197
  # I64#inspect shows signed value
170
198
  def inspect: () -> untyped
@@ -190,47 +218,64 @@ module Wardite
190
218
  def packed: (?size: Integer | nil) -> String
191
219
 
192
220
  # @rbs to: Symbol
193
- # @rbs return: I32|I64|F32|F64
194
- def wrap: (to: Symbol) -> (I32 | I64 | F32 | F64)
221
+ # @rbs return: wasmValue
222
+ def wrap: (to: Symbol) -> wasmValue
195
223
 
196
224
  # @rbs to: Symbol
197
- # @rbs return: I32|I64|F32|F64
198
- def extend_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
225
+ # @rbs return: wasmValue
226
+ def extend_s: (to: Symbol) -> wasmValue
199
227
 
200
228
  # @rbs to: Symbol
201
- # @rbs return: I32|I64|F32|F64
202
- def extend_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
229
+ # @rbs return: wasmValue
230
+ def extend_u: (to: Symbol) -> wasmValue
203
231
 
204
232
  # @todo need more testcase...
205
233
  # @see https://webassembly.github.io/spec/core/exec/numerics.html#xref-exec-numerics-op-trunc-s-mathrm-trunc-mathsf-s-m-n-z
234
+ # @see copy this impl to F64 when changed
206
235
  # @rbs to: Symbol
207
- # @rbs return: I32|I64|F32|F64
208
- def trunc_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
236
+ # @rbs saturating: bool
237
+ # @rbs return: wasmValue
238
+ def trunc_s: (to: Symbol, ?saturating: bool) -> wasmValue
209
239
 
210
240
  # @see https://webassembly.github.io/spec/core/exec/numerics.html#xref-exec-numerics-op-trunc-u-mathrm-trunc-mathsf-u-m-n-z
241
+ # @see copy this impl to F64 when changed
211
242
  # @rbs to: Symbol
212
- # @rbs return: I32|I64|F32|F64
213
- def trunc_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
243
+ # @rbs sturating: bool
244
+ # @rbs return: wasmValue
245
+ def trunc_u: (to: Symbol, ?saturating: untyped) -> wasmValue
214
246
 
215
247
  # @rbs to: Symbol
216
- # @rbs return: I32|I64|F32|F64
217
- def convert_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
248
+ # @rbs return: wasmValue
249
+ def convert_s: (to: Symbol) -> wasmValue
218
250
 
219
251
  # @rbs to: Symbol
220
- # @rbs return: I32|I64|F32|F64
221
- def convert_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
252
+ # @rbs return: wasmValue
253
+ def convert_u: (to: Symbol) -> wasmValue
222
254
 
223
255
  # @rbs to: Symbol
224
- # @rbs return: I32|I64|F32|F64
225
- def demote: (to: Symbol) -> (I32 | I64 | F32 | F64)
256
+ # @rbs return: wasmValue
257
+ def demote: (to: Symbol) -> wasmValue
226
258
 
227
259
  # @rbs to: Symbol
228
- # @rbs return: I32|I64|F32|F64
229
- def promote: (to: Symbol) -> (I32 | I64 | F32 | F64)
260
+ # @rbs return: wasmValue
261
+ def promote: (to: Symbol) -> wasmValue
230
262
 
231
263
  # @rbs to: Symbol
232
- # @rbs return: I32|I64|F32|F64
233
- def reinterpret: (to: Symbol) -> (I32 | I64 | F32 | F64)
264
+ # @rbs return: wasmValue
265
+ def reinterpret: (to: Symbol) -> wasmValue
266
+
267
+ # @rbs from: Symbol
268
+ # @rbs to: Symbol
269
+ # @rbs return: wasmValue
270
+ def extendN_s: (from: Symbol, to: Symbol) -> wasmValue
271
+
272
+ # @rbs to: Symbol
273
+ # @rbs return: wasmValue
274
+ def trunc_sat_u: (to: Symbol) -> wasmValue
275
+
276
+ # @rbs to: Symbol
277
+ # @rbs return: wasmValue
278
+ def trunc_sat_s: (to: Symbol) -> wasmValue
234
279
 
235
280
  def inspect: () -> untyped
236
281
  end
@@ -255,47 +300,62 @@ module Wardite
255
300
  def packed: (?size: Integer | nil) -> String
256
301
 
257
302
  # @rbs to: Symbol
258
- # @rbs return: I32|I64|F32|F64
259
- def wrap: (to: Symbol) -> (I32 | I64 | F32 | F64)
303
+ # @rbs return: wasmValue
304
+ def wrap: (to: Symbol) -> wasmValue
260
305
 
261
306
  # @rbs to: Symbol
262
- # @rbs return: I32|I64|F32|F64
263
- def extend_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
307
+ # @rbs return: wasmValue
308
+ def extend_s: (to: Symbol) -> wasmValue
264
309
 
265
310
  # @rbs to: Symbol
266
- # @rbs return: I32|I64|F32|F64
267
- def extend_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
311
+ # @rbs return: wasmValue
312
+ def extend_u: (to: Symbol) -> wasmValue
268
313
 
269
314
  # @see the same as F32
270
315
  # @rbs to: Symbol
271
- # @rbs return: I32|I64|F32|F64
272
- def trunc_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
316
+ # @rbs saturating: bool
317
+ # @rbs return: wasmValue
318
+ def trunc_s: (to: Symbol, ?saturating: bool) -> wasmValue
273
319
 
274
320
  # @see the same as F32
275
321
  # @rbs to: Symbol
276
- # @rbs return: I32|I64|F32|F64
277
- def trunc_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
322
+ # @rbs saturating: bool
323
+ # @rbs return: wasmValue
324
+ def trunc_u: (to: Symbol, ?saturating: bool) -> wasmValue
278
325
 
279
326
  # @rbs to: Symbol
280
- # @rbs return: I32|I64|F32|F64
281
- def convert_s: (to: Symbol) -> (I32 | I64 | F32 | F64)
327
+ # @rbs return: wasmValue
328
+ def convert_s: (to: Symbol) -> wasmValue
282
329
 
283
330
  # @rbs to: Symbol
284
- # @rbs return: I32|I64|F32|F64
285
- def convert_u: (to: Symbol) -> (I32 | I64 | F32 | F64)
331
+ # @rbs return: wasmValue
332
+ def convert_u: (to: Symbol) -> wasmValue
286
333
 
287
334
  # @todo no loss of digits...
288
335
  # @rbs to: Symbol
289
- # @rbs return: I32|I64|F32|F64
290
- def demote: (to: Symbol) -> (I32 | I64 | F32 | F64)
336
+ # @rbs return: wasmValue
337
+ def demote: (to: Symbol) -> wasmValue
338
+
339
+ # @rbs to: Symbol
340
+ # @rbs return: wasmValue
341
+ def promote: (to: Symbol) -> wasmValue
342
+
343
+ # @rbs to: Symbol
344
+ # @rbs return: wasmValue
345
+ def reinterpret: (to: Symbol) -> wasmValue
346
+
347
+ # @rbs from: Symbol
348
+ # @rbs to: Symbol
349
+ # @rbs return: wasmValue
350
+ def extendN_s: (from: Symbol, to: Symbol) -> wasmValue
291
351
 
292
352
  # @rbs to: Symbol
293
- # @rbs return: I32|I64|F32|F64
294
- def promote: (to: Symbol) -> (I32 | I64 | F32 | F64)
353
+ # @rbs return: wasmValue
354
+ def trunc_sat_u: (to: Symbol) -> wasmValue
295
355
 
296
356
  # @rbs to: Symbol
297
- # @rbs return: I32|I64|F32|F64
298
- def reinterpret: (to: Symbol) -> (I32 | I64 | F32 | F64)
357
+ # @rbs return: wasmValue
358
+ def trunc_sat_s: (to: Symbol) -> wasmValue
299
359
 
300
360
  def inspect: () -> untyped
301
361
  end
@@ -10,12 +10,12 @@ module Wardite
10
10
  def initialize: () -> untyped
11
11
 
12
12
  # @rbs store: Store
13
- # @rbs args: Array[I32|I64|F32|F64]
13
+ # @rbs args: Array[wasmValue]
14
14
  # @rbs return: Object
15
- def fd_write: (Store store, Array[I32 | I64 | F32 | F64] args) -> Object
15
+ def fd_write: (Store store, Array[wasmValue] args) -> Object
16
16
 
17
- # @rbs return: Hash[Symbol, Proc]
18
- def to_module: () -> Hash[Symbol, Proc]
17
+ # @rbs return: Hash[Symbol, wasmCallable]
18
+ def to_module: () -> Hash[Symbol, wasmCallable]
19
19
 
20
20
  private
21
21