Skip to content

Commit

Permalink
Delete unused logic for GetCurContextE and ContextKindE
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehyun1ee committed Apr 8, 2024
1 parent af9a5ae commit 849f01e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
12 changes: 4 additions & 8 deletions spectec/src/backend-interpreter/ds.ml
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ module WasmContext = struct
| Some (v, _, _) -> v
| None -> failwith "Wasm context stack underflow"

let get_current_context () =
let ctx, _, _ = get_context () in
ctx
let get_top_context () =
let ctx, vs, _ = get_context () in
if List.length vs = 0 then Some ctx
else None

let get_current_frame () =
let match_frame = function
Expand All @@ -280,11 +281,6 @@ module WasmContext = struct
| _ -> false
in get_value_with_condition match_label

let get_top_context () =
let ctx, vs, _ = get_context () in
if List.length vs = 0 then Some ctx
else None

let get_module_instance () =
match get_current_frame () with
| FrameV (_, mm) -> mm
Expand Down
3 changes: 1 addition & 2 deletions spectec/src/backend-interpreter/ds.mli
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ module WasmContext : sig
val string_of_context : t -> string
val string_of_context_stack : unit -> string

val get_current_context : unit -> value
val get_top_context : unit -> value option
val get_current_frame : unit -> value
val get_current_label : unit -> value
val get_top_context : unit -> value option
val get_module_instance : unit -> value

val get_value_stack : unit -> value list
Expand Down
6 changes: 0 additions & 6 deletions spectec/src/backend-interpreter/interpreter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ and eval_expr env expr =
let v2 = eval_expr env e2 in
LabelV (v1, v2)
| GetCurLabelE -> WasmContext.get_current_label ()
| GetCurContextE -> WasmContext.get_current_context ()
| ContE e ->
(match eval_expr env e with
| LabelV (_, vs) -> vs
Expand Down Expand Up @@ -249,11 +248,6 @@ and eval_expr env expr =
| l, _ -> listV_of_list l)
| InfixE (e1, _, e2) -> TupV [ eval_expr env e1; eval_expr env e2 ]
(* condition *)
| ContextKindE ((kind, _), e) ->
(match kind, eval_expr env e with
| Il.Atom.Atom "FRAME_", FrameV _ -> boolV true
| Il.Atom.Atom "LABEL_", LabelV _ -> boolV true
| _ -> boolV false)
| TopFrameE ->
let ctx = WasmContext.get_top_context () in
(match ctx with
Expand Down

0 comments on commit 849f01e

Please sign in to comment.