aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-01-16 20:45:58 +0100
committerPierre-Marie Pédrot2020-01-16 20:49:16 +0100
commit849c5d47475164190659915304e601b436e9b9d3 (patch)
treeafb2ec2633297a89738a1892e07c99bd5145d523
parent25e50a61ca7a8f6698a1579ee262a9e57395e479 (diff)
Move the per-architecture check of marshalled Uint63s to Values.
-rw-r--r--checker/validate.ml20
-rw-r--r--checker/values.ml7
-rw-r--r--checker/values.mli2
-rw-r--r--checker/votour.ml4
4 files changed, 17 insertions, 16 deletions
diff --git a/checker/validate.ml b/checker/validate.ml
index c3e7d18e56..6ffc43394b 100644
--- a/checker/validate.ml
+++ b/checker/validate.ml
@@ -66,14 +66,12 @@ let is_int _mem o = match o with
| Int _ -> true
| Fun _ | Ptr _ | Atm _ -> false
-let is_uint63 mem o =
- if Sys.word_size == 64 then is_int mem o
- else match o with
- | Int _ | Fun _ | Atm _ -> false
- | Ptr p ->
- match LargeArray.get mem p with
- | Int64 _ -> true
- | Float64 _ | Struct _ | String _ -> false
+let is_int64 mem o = match o with
+| Int _ | Fun _ | Atm _ -> false
+| Ptr p ->
+ match LargeArray.get mem p with
+ | Int64 _ -> true
+ | Float64 _ | Struct _ | String _ -> false
let is_float64 mem o = match o with
| Int _ | Fun _ | Atm _ -> false
@@ -147,7 +145,7 @@ let rec val_gen v mem ctx o = match v with
| Annot (s,v) -> val_gen v mem (ctx/CtxAnnot s) o
| Dyn -> val_dyn mem ctx o
| Proxy { contents = v } -> val_gen v mem ctx o
- | Uint63 -> val_uint63 mem ctx o
+ | Int64 -> val_int64 mem ctx o
| Float64 -> val_float64 mem ctx o
(* Check that an object is a tuple (or a record). vs is an array of
@@ -196,8 +194,8 @@ and val_array v mem ctx o =
val_gen v mem ctx (field mem o i)
done
-and val_uint63 mem ctx o =
- if not (is_uint63 mem o) then
+and val_int64 mem ctx o =
+ if not (is_int64 mem o) then
fail mem ctx o "not a 63-bit unsigned integer"
and val_float64 mem ctx o =
diff --git a/checker/values.ml b/checker/values.ml
index 56321a27ff..8435dadf8f 100644
--- a/checker/values.ml
+++ b/checker/values.ml
@@ -34,7 +34,7 @@ type value =
| Dyn
| Proxy of value ref
- | Uint63
+ | Int64
| Float64
let fix (f : value -> value) : value =
@@ -129,6 +129,9 @@ let v_cast = v_enum "cast_kind" 4
let v_proj_repr = v_tuple "projection_repr" [|v_ind;Int;Int;v_id|]
let v_proj = v_tuple "projection" [|v_proj_repr; v_bool|]
+let v_uint63 =
+ if Sys.word_size == 64 then Int else Int64
+
let rec v_constr =
Sum ("constr",0,[|
[|Int|]; (* Rel *)
@@ -148,7 +151,7 @@ let rec v_constr =
[|v_fix|]; (* Fix *)
[|v_cofix|]; (* CoFix *)
[|v_proj;v_constr|]; (* Proj *)
- [|Uint63|]; (* Int *)
+ [|v_uint63|]; (* Int *)
[|Float64|] (* Int *)
|])
diff --git a/checker/values.mli b/checker/values.mli
index ec3b91d5dd..15d307ee29 100644
--- a/checker/values.mli
+++ b/checker/values.mli
@@ -38,7 +38,7 @@ type value =
| Proxy of value ref
(** Same as the inner value, used to define recursive types *)
- | Uint63
+ | Int64
| Float64
(** NB: List and Opt have their own constructors to make it easy to
diff --git a/checker/votour.ml b/checker/votour.ml
index 9adcc874ac..452809f7bb 100644
--- a/checker/votour.ml
+++ b/checker/votour.ml
@@ -157,7 +157,7 @@ let rec get_name ?(extra=false) = function
|Annot (s,v) -> s^"/"^get_name ~extra v
|Dyn -> "<dynamic>"
| Proxy v -> get_name ~extra !v
- | Uint63 -> "Uint63"
+ | Int64 -> "Int64"
| Float64 -> "Float64"
(** For tuples, its quite handy to display the inner 1st string (if any).
@@ -263,7 +263,7 @@ let rec get_children v o pos = match v with
end
|Fail s -> raise Forbidden
| Proxy v -> get_children !v o pos
- | Uint63 -> raise Exit
+ | Int64 -> raise Exit
| Float64 -> raise Exit
let get_children v o pos =