-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[interpreter] Factor data and element segments into abstract types (#…
- Loading branch information
Showing
7 changed files
with
48 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type data = string ref | ||
type t = data | ||
|
||
let alloc bs = ref bs | ||
let size seg = I64.of_int_u (String.length !seg) | ||
let load seg i = (!seg).[Int64.to_int i] | ||
let drop seg = seg := "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type data | ||
type t = data | ||
|
||
val alloc : string -> data | ||
val size : data -> Memory.address | ||
val load : data -> Memory.address -> char | ||
val drop : data -> unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type elem = Values.ref_ list ref | ||
type t = elem | ||
|
||
let alloc rs = ref rs | ||
let size seg = Lib.List32.length !seg | ||
let load seg i = Lib.List32.nth !seg i | ||
let drop seg = seg := [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
open Values | ||
|
||
type elem | ||
type t = elem | ||
|
||
val alloc : ref_ list -> elem | ||
val size : elem -> Table.size | ||
val load : elem -> Table.index -> ref_ | ||
val drop : elem -> unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters