File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
crates/wasmi/src/engine/translator/func2 Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
- use super :: { ControlFrame , FuncTranslator , LocalIdx } ;
2
- use crate :: { core:: wasm, ir:: Instruction , Error } ;
1
+ use super :: { ControlFrame , FuncTranslator , LocalIdx , UnreachableControlFrame } ;
2
+ use crate :: { core:: wasm, engine :: BlockType , ir:: Instruction , Error } ;
3
3
use wasmparser:: VisitOperator ;
4
4
5
5
macro_rules! impl_visit_operator {
@@ -72,8 +72,16 @@ impl<'a> VisitOperator<'a> for FuncTranslator {
72
72
todo ! ( )
73
73
}
74
74
75
- fn visit_block ( & mut self , _block_ty : wasmparser:: BlockType ) -> Self :: Output {
76
- todo ! ( )
75
+ fn visit_block ( & mut self , block_ty : wasmparser:: BlockType ) -> Self :: Output {
76
+ if !self . reachable {
77
+ self . stack
78
+ . push_unreachable ( UnreachableControlFrame :: Block ) ?;
79
+ return Ok ( ( ) ) ;
80
+ }
81
+ let block_ty = BlockType :: new ( block_ty, & self . module ) ;
82
+ let end_label = self . labels . new_label ( ) ;
83
+ self . stack . push_block ( block_ty, end_label) ?;
84
+ Ok ( ( ) )
77
85
}
78
86
79
87
fn visit_loop ( & mut self , _block_ty : wasmparser:: BlockType ) -> Self :: Output {
You can’t perform that action at this time.
0 commit comments