Skip to content

Commit

Permalink
Put locs in Parse_bytecode
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Oct 9, 2024
1 parent a8c4b4d commit a0fcac8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
10 changes: 1 addition & 9 deletions compiler/lib/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1102,15 +1102,7 @@ let rec translate_expr ctx queue loc x e level : _ * J.statement_list =
let clo = compile_closure ctx cont in
let clo =
match clo with
| (st, x) :: rem ->
let loc =
match x, source_location_ctx ctx (Before pc) with
| (J.U | J.N), (J.U | J.N) -> J.U
| x, (J.U | J.N) -> x
| (J.U | J.N), x -> x
| _, x -> x
in
(st, loc) :: rem
| (st, J.N) :: rem -> (st, J.U) :: rem
| _ -> clo
in
let clo =
Expand Down
15 changes: 13 additions & 2 deletions compiler/lib/parse_bytecode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1303,8 +1303,19 @@ and compile infos pc state instrs =
compile_block infos.blocks infos.debug code addr state';
if debug_parser () then Format.printf "}@.";
let args = State.stack_vars state' in
let state'', _, _ = Addr.Map.find addr !compiled_blocks in
Debug.propagate (State.stack_vars state'') args;
(let state'', instrs, last = Addr.Map.find addr !compiled_blocks in
Debug.propagate (State.stack_vars state'') args;
if Debug.mem infos.debug pc
then
let loc = Code.Before pc in
match instrs, last with
| (i, No) :: rem, _ ->
compiled_blocks :=
Addr.Map.add addr (state'', (i, loc) :: rem, last) !compiled_blocks
| [], (last, No) ->
compiled_blocks :=
Addr.Map.add addr (state'', instrs, (last, loc)) !compiled_blocks
| (_, (Before _ | After _)) :: _, _ | [], (_, (Before _ | After _)) -> ());
compile
infos
(pc + 3)
Expand Down

0 comments on commit a0fcac8

Please sign in to comment.