File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -630,15 +630,16 @@ end = struct
630
630
output_byte ch 0x0B
631
631
| Try (typ , l , catches ) ->
632
632
Feature. require exception_handling;
633
- output_byte ch 0x06 ;
633
+ output_byte ch 0x1f ;
634
634
output_blocktype st.type_names ch typ;
635
- List. iter ~f: ( fun i' -> output_instruction st ch i') l ;
635
+ output_uint ch ( List. length catches) ;
636
636
List. iter
637
- ~f: (fun (tag , l , ty ) ->
638
- output_byte ch 0x07 ;
637
+ ~f: (fun (tag , l , _ ) ->
638
+ output_byte ch 0x00 ;
639
639
output_uint ch (Hashtbl. find st.tag_names tag);
640
- output_instruction st ch ( Br (l + 1 , Some ( Pop ty))) )
640
+ output_uint ch l )
641
641
catches;
642
+ List. iter ~f: (fun i' -> output_instruction st ch i') l;
642
643
output_byte ch 0X0B
643
644
644
645
and output_instruction st ch i =
Original file line number Diff line number Diff line change @@ -430,16 +430,13 @@ let expression_or_instructions ctx st in_function =
430
430
]
431
431
| Try (ty , body , catches ) ->
432
432
[ List
433
- (Atom " try "
433
+ (Atom " try_table "
434
434
:: (block_type st ty
435
- @ List (Atom " do" :: instructions body)
436
- :: List. map
437
- ~f: (fun (tag , i , ty ) ->
438
- List
439
- (Atom " catch"
440
- :: index st.tag_names tag
441
- :: instruction (Wa_ast. Br (i + 1 , Some (Pop ty)))))
442
- catches))
435
+ @ List. map
436
+ ~f: (fun (tag , i , _ty ) ->
437
+ List [ Atom " catch" ; index st.tag_names tag; Atom (string_of_int i) ])
438
+ catches
439
+ @ instructions body))
443
440
]
444
441
and instruction i =
445
442
match i with
You can’t perform that action at this time.
0 commit comments