From 849f01e88ea1f6e5a40ac2724391d3968b2966a3 Mon Sep 17 00:00:00 2001 From: jaehyun1ee <99jaehyunlee@kaist.ac.kr> Date: Mon, 8 Apr 2024 17:10:03 +0900 Subject: [PATCH] Delete unused logic for GetCurContextE and ContextKindE --- spectec/src/backend-interpreter/ds.ml | 12 ++++-------- spectec/src/backend-interpreter/ds.mli | 3 +-- spectec/src/backend-interpreter/interpreter.ml | 6 ------ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/spectec/src/backend-interpreter/ds.ml b/spectec/src/backend-interpreter/ds.ml index bcea70cf12..25b9cfff91 100644 --- a/spectec/src/backend-interpreter/ds.ml +++ b/spectec/src/backend-interpreter/ds.ml @@ -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 @@ -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 diff --git a/spectec/src/backend-interpreter/ds.mli b/spectec/src/backend-interpreter/ds.mli index 07c6cb2e94..ecdba4a3ee 100644 --- a/spectec/src/backend-interpreter/ds.mli +++ b/spectec/src/backend-interpreter/ds.mli @@ -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 diff --git a/spectec/src/backend-interpreter/interpreter.ml b/spectec/src/backend-interpreter/interpreter.ml index 3c7c96af6e..25b66bc9d6 100644 --- a/spectec/src/backend-interpreter/interpreter.ml +++ b/spectec/src/backend-interpreter/interpreter.ml @@ -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 @@ -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