@@ -236,14 +236,14 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
236
236
* possible `Block`'s arguments values.
237
237
***********************************************************************************/
238
238
Operator :: Block { blockty } => {
239
- let ( params, results) = module_translation_state. blocktype_params_results ( * blockty) ?;
240
- let next = block_with_params ( builder, results, environ) ?;
239
+ let ( params, results) = module_translation_state. blocktype_params_results ( blockty) ?;
240
+ let next = block_with_params ( builder, results. iter ( ) , environ) ?;
241
241
state. push_block ( next, params. len ( ) , results. len ( ) ) ;
242
242
}
243
243
Operator :: Loop { blockty } => {
244
- let ( params, results) = module_translation_state. blocktype_params_results ( * blockty) ?;
245
- let loop_body = block_with_params ( builder, params, environ) ?;
246
- let next = block_with_params ( builder, results, environ) ?;
244
+ let ( params, results) = module_translation_state. blocktype_params_results ( blockty) ?;
245
+ let loop_body = block_with_params ( builder, params. iter ( ) , environ) ?;
246
+ let next = block_with_params ( builder, results. iter ( ) , environ) ?;
247
247
canonicalise_then_jump ( builder, loop_body, state. peekn ( params. len ( ) ) ) ;
248
248
state. push_loop ( loop_body, next, params. len ( ) , results. len ( ) ) ;
249
249
@@ -260,23 +260,23 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
260
260
Operator :: If { blockty } => {
261
261
let val = state. pop1 ( ) ;
262
262
263
- let ( params, results) = module_translation_state. blocktype_params_results ( * blockty) ?;
263
+ let ( params, results) = module_translation_state. blocktype_params_results ( blockty) ?;
264
264
let ( destination, else_data) = if params == results {
265
265
// It is possible there is no `else` block, so we will only
266
266
// allocate a block for it if/when we find the `else`. For now,
267
267
// we if the condition isn't true, then we jump directly to the
268
268
// destination block following the whole `if...end`. If we do end
269
269
// up discovering an `else`, then we will allocate a block for it
270
270
// and go back and patch the jump.
271
- let destination = block_with_params ( builder, results, environ) ?;
271
+ let destination = block_with_params ( builder, results. iter ( ) , environ) ?;
272
272
let branch_inst =
273
273
canonicalise_then_brz ( builder, val, destination, state. peekn ( params. len ( ) ) ) ;
274
274
( destination, ElseData :: NoElse { branch_inst } )
275
275
} else {
276
276
// The `if` type signature is not valid without an `else` block,
277
277
// so we eagerly allocate the `else` block here.
278
- let destination = block_with_params ( builder, results, environ) ?;
279
- let else_block = block_with_params ( builder, params, environ) ?;
278
+ let destination = block_with_params ( builder, results. iter ( ) , environ) ?;
279
+ let else_block = block_with_params ( builder, params. iter ( ) , environ) ?;
280
280
canonicalise_then_brz ( builder, val, else_block, state. peekn ( params. len ( ) ) ) ;
281
281
builder. seal_block ( else_block) ;
282
282
( destination, ElseData :: WithElse { else_block } )
@@ -326,10 +326,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
326
326
// already been pre-allocated, see `ElseData` for details).
327
327
let else_block = match * else_data {
328
328
ElseData :: NoElse { branch_inst } => {
329
- let ( params, _results) =
330
- module_translation_state . blocktype_params_results ( blocktype) ?;
329
+ let ( params, _results) = module_translation_state
330
+ . blocktype_params_results ( & blocktype) ?;
331
331
debug_assert_eq ! ( params. len( ) , num_return_values) ;
332
- let else_block = block_with_params ( builder, params, environ) ?;
332
+ let else_block =
333
+ block_with_params ( builder, params. iter ( ) , environ) ?;
333
334
canonicalise_then_jump (
334
335
builder,
335
336
destination,
@@ -1039,7 +1040,9 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
1039
1040
Operator :: F32Le | Operator :: F64Le => {
1040
1041
translate_fcmp ( FloatCC :: LessThanOrEqual , builder, state)
1041
1042
}
1042
- Operator :: RefNull { ty } => state. push1 ( environ. translate_ref_null ( builder. cursor ( ) , * ty) ?) ,
1043
+ Operator :: RefNull { hty } => {
1044
+ state. push1 ( environ. translate_ref_null ( builder. cursor ( ) , hty) ?)
1045
+ }
1043
1046
Operator :: RefIsNull => {
1044
1047
let value = state. pop1 ( ) ;
1045
1048
state. push1 ( environ. translate_ref_is_null ( builder. cursor ( ) , value) ?) ;
@@ -2032,14 +2035,14 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
2032
2035
return Err ( wasm_unsupported ! ( "proposed tail-call operator {:?}" , op) ) ;
2033
2036
}
2034
2037
Operator :: I8x16RelaxedSwizzle
2035
- | Operator :: I32x4RelaxedTruncSatF32x4S
2036
- | Operator :: I32x4RelaxedTruncSatF32x4U
2037
- | Operator :: I32x4RelaxedTruncSatF64x2SZero
2038
- | Operator :: I32x4RelaxedTruncSatF64x2UZero
2039
- | Operator :: F32x4RelaxedFma
2040
- | Operator :: F32x4RelaxedFnma
2041
- | Operator :: F64x2RelaxedFma
2042
- | Operator :: F64x2RelaxedFnma
2038
+ | Operator :: I32x4RelaxedTruncF32x4S
2039
+ | Operator :: I32x4RelaxedTruncF32x4U
2040
+ | Operator :: I32x4RelaxedTruncF64x2SZero
2041
+ | Operator :: I32x4RelaxedTruncF64x2UZero
2042
+ | Operator :: F32x4RelaxedMadd
2043
+ | Operator :: F32x4RelaxedNmadd
2044
+ | Operator :: F64x2RelaxedMadd
2045
+ | Operator :: F64x2RelaxedNmadd
2043
2046
| Operator :: I8x16RelaxedLaneselect
2044
2047
| Operator :: I16x8RelaxedLaneselect
2045
2048
| Operator :: I32x4RelaxedLaneselect
@@ -2048,12 +2051,44 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
2048
2051
| Operator :: F32x4RelaxedMax
2049
2052
| Operator :: F64x2RelaxedMin
2050
2053
| Operator :: F64x2RelaxedMax
2051
- | Operator :: F32x4RelaxedDotBf16x8AddF32x4
2052
- | Operator :: I16x8RelaxedQ15mulrS
2053
- | Operator :: I16x8DotI8x16I7x16S
2054
- | Operator :: I32x4DotI8x16I7x16AddS => {
2054
+ | Operator :: I16x8RelaxedDotI8x16I7x16S => todo ! ( ) ,
2055
+ Operator :: I32x4RelaxedDotI8x16I7x16AddS => todo ! ( ) ,
2056
+ Operator :: I16x8RelaxedQ15mulrS => {
2055
2057
return Err ( wasm_unsupported ! ( "proposed relaxed-simd operator {:?}" , op) ) ;
2056
2058
}
2059
+ Operator :: RefI31 | Operator :: I31GetS | Operator :: I31GetU => {
2060
+ return Err ( wasm_unsupported ! ( "proposed i31 operator {:?}" , op) ) ;
2061
+ }
2062
+ Operator :: MemoryDiscard { mem : _ } => {
2063
+ return Err ( wasm_unsupported ! (
2064
+ "proposed memory-discard operator {:?}" ,
2065
+ op
2066
+ ) ) ;
2067
+ }
2068
+ Operator :: CallRef { type_index : _ } => {
2069
+ return Err ( wasm_unsupported ! ( "proposed call-ref operator {:?}" , op) ) ;
2070
+ }
2071
+ Operator :: ReturnCallRef { type_index : _ } => {
2072
+ return Err ( wasm_unsupported ! (
2073
+ "proposed return-call-ref operator {:?}" ,
2074
+ op
2075
+ ) ) ;
2076
+ }
2077
+ Operator :: RefAsNonNull => {
2078
+ return Err ( wasm_unsupported ! (
2079
+ "proposed ref-as-non-null operator {:?}" ,
2080
+ op
2081
+ ) ) ;
2082
+ }
2083
+ Operator :: BrOnNull { relative_depth : _ } => {
2084
+ return Err ( wasm_unsupported ! ( "proposed br-on-null operator {:?}" , op) ) ;
2085
+ }
2086
+ Operator :: BrOnNonNull { relative_depth : _ } => {
2087
+ return Err ( wasm_unsupported ! (
2088
+ "proposed br-on-non-null operator {:?}" ,
2089
+ op
2090
+ ) ) ;
2091
+ }
2057
2092
} ;
2058
2093
Ok ( ( ) )
2059
2094
}
@@ -2107,9 +2142,10 @@ fn translate_unreachable_operator<FE: FuncEnvironment + ?Sized>(
2107
2142
2108
2143
let else_block = match * else_data {
2109
2144
ElseData :: NoElse { branch_inst } => {
2110
- let ( params, _results) =
2111
- module_translation_state. blocktype_params_results ( blocktype) ?;
2112
- let else_block = block_with_params ( builder, params, environ) ?;
2145
+ let ( params, _results) = module_translation_state
2146
+ . blocktype_params_results ( & blocktype) ?;
2147
+ let else_block =
2148
+ block_with_params ( builder, params. iter ( ) , environ) ?;
2113
2149
let frame = state. control_stack . last ( ) . unwrap ( ) ;
2114
2150
frame. truncate_value_stack_to_else_params ( & mut state. stack ) ;
2115
2151
0 commit comments