Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep the Vmlibrary.t type opaque. #393

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 6 additions & 46 deletions serlib/ser_vmlibrary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,23 @@
(* Status: Experimental *)
(************************************************************************)

open Sexplib.Std
open Ppx_compare_lib.Builtin
open Ppx_hash_lib.Std.Hash.Builtin

module Stdlib = Ser_stdlib
module Names = Ser_names
module Vmemitcodes = Ser_vmemitcodes

module Map = Ser_cMap.Make(Int.Map)(Ser_int)

module Delayed =
struct

type delayed = {
del_file : string;
del_off : int64;
del_digest : string;
} [@@deriving sexp,yojson,hash,compare]

type 'a node = ToFetch of delayed | Fetched of 'a [@@deriving sexp,yojson,hash,compare]

type 'a t = 'a node Stdlib.ref [@@deriving sexp,yojson,hash,compare]

end

module VmTable =
struct

type t = {
table_len : int;
table_dir : Names.DirPath.t;
table_val : Vmemitcodes.to_patch Map.t;
} [@@deriving sexp,yojson,hash,compare]

type index = Names.DirPath.t * int [@@deriving sexp,yojson,hash,compare]

end

module OP = struct
type t = [%import: Vmlibrary.t]
type _t = {
local : VmTable.t;
foreign : VmTable.t Delayed.t Names.DPmap.t;
}
[@@deriving sexp,yojson,hash,compare]
type t = Vmlibrary.t
let name = "Vmlibrary.t"
end

module B = SerType.Pierce(OP)
module B = SerType.Opaque(OP)
type t = B.t
[@@deriving sexp,yojson,hash,compare]

module OQ = struct
type t = [%import: Vmlibrary.index]
type _t = VmTable.index [@@deriving sexp,yojson,hash,compare]
type t = Vmlibrary.index
let name = "Vmlibrary.index"
end

module C = SerType.Pierce(OQ)
module C = SerType.Opaque(OQ)
type index = C.t
[@@deriving sexp,yojson,hash,compare]

Expand Down
Loading