@@ -8580,26 +8580,27 @@ wasm_loader_prepare_bytecode(WASMModule *module,
8580
8580
goto re_scan ;
8581
8581
8582
8582
func -> const_cell_num = loader_ctx -> const_cell_num ;
8583
- if (func -> const_cell_num > 0
8584
- && !(func -> consts = func_const =
8583
+ if (func -> const_cell_num > 0 ) {
8584
+ if ( !(func -> consts = func_const =
8585
8585
loader_malloc (func -> const_cell_num * 4 ,
8586
- error_buf , error_buf_size ))) {
8587
- goto fail ;
8588
- }
8589
- func_const_end = func -> consts + func -> const_cell_num * 4 ;
8590
- /* reverse the const buf */
8591
- for (int i = loader_ctx -> num_const - 1 ; i >= 0 ; i -- ) {
8592
- Const * c = (Const * )(loader_ctx -> const_buf + i * sizeof (Const ));
8593
- if (c -> value_type == VALUE_TYPE_F64
8594
- || c -> value_type == VALUE_TYPE_I64 ) {
8595
- bh_memcpy_s (func_const , (uint32 )(func_const_end - func_const ),
8596
- & (c -> value .f64 ), (uint32 )sizeof (int64 ));
8597
- func_const += sizeof (int64 );
8598
- }
8599
- else {
8600
- bh_memcpy_s (func_const , (uint32 )(func_const_end - func_const ),
8601
- & (c -> value .f32 ), (uint32 )sizeof (int32 ));
8602
- func_const += sizeof (int32 );
8586
+ error_buf , error_buf_size )))
8587
+ goto fail ;
8588
+
8589
+ func_const_end = func -> consts + func -> const_cell_num * 4 ;
8590
+ /* reverse the const buf */
8591
+ for (int i = loader_ctx -> num_const - 1 ; i >= 0 ; i -- ) {
8592
+ Const * c = (Const * )(loader_ctx -> const_buf + i * sizeof (Const ));
8593
+ if (c -> value_type == VALUE_TYPE_F64
8594
+ || c -> value_type == VALUE_TYPE_I64 ) {
8595
+ bh_memcpy_s (func_const , (uint32 )(func_const_end - func_const ),
8596
+ & (c -> value .f64 ), (uint32 )sizeof (int64 ));
8597
+ func_const += sizeof (int64 );
8598
+ }
8599
+ else {
8600
+ bh_memcpy_s (func_const , (uint32 )(func_const_end - func_const ),
8601
+ & (c -> value .f32 ), (uint32 )sizeof (int32 ));
8602
+ func_const += sizeof (int32 );
8603
+ }
8603
8604
}
8604
8605
}
8605
8606
0 commit comments