Spec changed; Changes introduced; fixed minor bugs

This commit is contained in:
Dmitry Boulytchev 2021-02-01 10:39:12 +03:00
parent 7c7ef67e1d
commit 59f78fe38a
6 changed files with 49 additions and 23 deletions

View file

@ -229,11 +229,11 @@ let compile cmd env imports code =
| [] -> env, []
| instr :: scode' ->
let stack = "" (* env#show_stack*) in
(* Printf.printf "insn=%s, stack=%s\n%!" (GT.show(insn) instr) (env#show_stack); *)
(* Printf.printf "insn=%s, stack=%s\n%!" (GT.show(insn) instr) (env#show_stack); *)
let env', code' =
if env#is_barrier
then match instr with
| LABEL s -> if env#has_stack s then (env#drop_barrier)#retrieve_stack s, [Label s] else env, []
| LABEL s -> if env#has_stack s then (env#drop_barrier)#retrieve_stack s, [Label s] else env#drop_stack, []
| FLABEL s -> env#drop_barrier, [Label s]
| SLABEL s -> env, [Label s]
| _ -> env, []
@ -629,11 +629,14 @@ class env prg =
method is_barrier = barrier
(* set barrier *)
method set_barrier = {< stack = []; barrier = true >}
method set_barrier = {< barrier = true >}
(* drop barrier *)
method drop_barrier = {< barrier = false >}
(* drop stack *)
method drop_stack = {< stack = [] >}
(* associates a stack to a label *)
method set_stack l = (*Printf.printf "Setting stack for %s\n" l;*)
{< stackmap = M.add l stack stackmap >}