Skip to content

Commit

Permalink
Remove unnecessary inc_address function (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Jun 3, 2024
1 parent 6f101d6 commit 884edf3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions interpreter/exec/eval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ let elem_oob frame x i n =
I64.gt_u (I64.add (Table.index_of_num i) (Table.index_of_num n))
(Elem.size (elem frame.inst x))

let inc_address i at =
match i with
| I32 x -> (I32 (I32.add x 1l) @@ at)
| I64 x -> (I64 (I64.add x 1L) @@ at)
| _ -> Crash.error at ("bad address type")

let rec step (c : config) : config =
let {frame; code = vs, es; _} = c in
let e = List.hd es in
Expand Down Expand Up @@ -440,12 +434,13 @@ let rec step (c : config) : config =
else if n_64 = 0L then
vs', []
else
let i_64 = Memory.address_of_num i in
vs', List.map (at e.at) [
Plain (Const (i @@ e.at));
Plain (Const (k @@ e.at));
Plain (Store
{ty = I32Type; align = 0; offset = 0L; pack = Some Pack8});
Plain (Const (inc_address i e.at));
Plain (Const (I64 (I64.add i_64 1L) @@ e.at));
Plain (Const (k @@ e.at));
Plain (Const (I64 (I64.sub n_64 1L) @@ e.at));
Plain (MemoryFill);
Expand Down

0 comments on commit 884edf3

Please sign in to comment.