Skip to content

Commit 33bbc93

Browse files
authored
flambda-backend: Fix parsecmm.mly in ocaml subdirectory (#357)
1 parent 9650034 commit 33bbc93

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

testsuite/tests/asmgen/catch-try-float.cmm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ arguments = "-DFLOAT_CATCH -DFUN=catch_try_float main.c"
77
(function "catch_try_float" (b:float)
88
(+f 10.0
99
(catch
10-
(try (exit(1) lbl 100.0)
10+
(try (exit lbl 100.0)
1111
with var 456.0)
1212
with (lbl x:float) (+f x 1000.0))))

testsuite/tests/asmgen/catch-try.cmm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ arguments = "-DINT_INT -DFUN=catch_exit main.c"
77
(function "catch_exit" (b:int)
88
(+ 33
99
(catch
10-
(try (exit(1) lbl 12)
10+
(try (exit lbl 12)
1111
with var 456)
1212
with (lbl x:val) (+ x 789))))

testsuite/tools/parsecmm.mly

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let make_switch n selector caselist =
3737
let index = Array.make n 0 in
3838
let casev = Array.of_list caselist in
3939
let dbg = Debuginfo.none in
40-
let actv = Array.make (Array.length casev) (Cexit(Cmm.Lbl 0,[],[]), dbg) in
40+
let actv = Array.make (Array.length casev) (Cexit(0,[]), dbg) in
4141
for i = 0 to Array.length casev - 1 do
4242
let (posl, e) = casev.(i) in
4343
List.iter (fun pos -> index.(pos) <- i) posl;
@@ -206,9 +206,6 @@ componentlist:
206206
component { [$1] }
207207
| componentlist STAR component { $3 :: $1 }
208208
;
209-
traps:
210-
LPAREN INTCONST RPAREN { List.init $2 (fun _ -> Pop) }
211-
| /**/ { [] }
212209
expr:
213210
INTCONST { Cconst_int ($1, debuginfo ()) }
214211
| FLOATCONST { Cconst_float (float_of_string $1, debuginfo ()) }
@@ -221,7 +218,7 @@ expr:
221218
| LPAREN APPLY location expr exprlist machtype RPAREN
222219
{ Cop(Capply $6, $4 :: List.rev $5, debuginfo ?loc:$3 ()) }
223220
| LPAREN EXTCALL STRING exprlist machtype RPAREN
224-
{Cop(Cextcall($3, $5, false, None), List.rev $4, debuginfo ())}
221+
{Cop(Cextcall($3, $5, [], false), List.rev $4, debuginfo ())}
225222
| LPAREN ALLOC exprlist RPAREN { Cop(Calloc, List.rev $3, debuginfo ()) }
226223
| LPAREN SUBF expr RPAREN { Cop(Cnegf, [$3], debuginfo ()) }
227224
| LPAREN SUBF expr expr RPAREN { Cop(Csubf, [$3; $4], debuginfo ()) }
@@ -239,22 +236,22 @@ expr:
239236
match $3 with
240237
Cconst_int (x, _) when x <> 0 -> $4
241238
| _ -> Cifthenelse($3, debuginfo (), $4, debuginfo (),
242-
(Cexit(Cmm.Lbl lbl0,[],[])),
239+
(Cexit(lbl0,[])),
243240
debuginfo ()) in
244241
Ccatch(Nonrecursive, [lbl0, [], Ctuple [], debuginfo ()],
245242
Ccatch(Recursive,
246-
[lbl1, [], Csequence(body, Cexit(Cmm.Lbl lbl1, [], [])), debuginfo ()],
247-
Cexit(Cmm.Lbl lbl1, [], []))) }
248-
| LPAREN EXIT traps IDENT exprlist RPAREN
249-
{ Cexit(Cmm.Lbl (find_label $4), List.rev $5, $3) }
243+
[lbl1, [], Csequence(body, Cexit(lbl1, [])), debuginfo ()],
244+
Cexit(lbl1, []))) }
245+
| LPAREN EXIT IDENT exprlist RPAREN
246+
{ Cexit(find_label $3, List.rev $4) }
250247
| LPAREN CATCH sequence WITH catch_handlers RPAREN
251248
{ let handlers = $5 in
252249
List.iter (fun (_, l, _, _) ->
253250
List.iter (fun (x, _) -> unbind_ident x) l) handlers;
254251
Ccatch(Recursive, handlers, $3) }
255-
| EXIT { Cexit(Cmm.Lbl 0,[],[]) }
252+
| EXIT { Cexit(0,[]) }
256253
| LPAREN TRY sequence WITH bind_ident sequence RPAREN
257-
{ unbind_ident $5; Ctrywith($3, Regular, $5, $6, debuginfo ()) }
254+
{ unbind_ident $5; Ctrywith($3, $5, $6, debuginfo ()) }
258255
| LPAREN VAL expr expr RPAREN
259256
{ let open Asttypes in
260257
Cop(Cload (Word_val, Mutable), [access_array $3 $4 Arch.size_addr],

0 commit comments

Comments
 (0)