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

Add value<->native_pointer intrinsics #855

Merged
merged 15 commits into from
Oct 10, 2022
Prev Previous commit
Next Next commit
reverts
TheNumbat committed Oct 4, 2022
commit ccb99fbeb7a332f54877a1d3de1ed652e194bde6
6 changes: 0 additions & 6 deletions backend/cmm_helpers.mli
Original file line number Diff line number Diff line change
@@ -557,12 +557,6 @@ val floatfield : int -> unary_primitive
(** Int_as_pointer primitive *)
val int_as_pointer : unary_primitive

(** Int to value primitive *)
val value_of_int : unary_primitive

(** Value to int primitive *)
val int_of_value : unary_primitive

(** Raise primitive *)
val raise_prim : Lambda.raise_kind -> unary_primitive

13 changes: 3 additions & 10 deletions backend/cmmgen.ml
Original file line number Diff line number Diff line change
@@ -618,8 +618,7 @@ let rec transl env e =
->
fatal_error "Cmmgen.transl:prim, wrong arity"
| ((Pfield_computed|Psequand
| Psequor | Pnot | Pintofvalue | Pvalueofint
| Pnegint | Paddint | Psubint
| Psequor | Pnot | Pnegint | Paddint | Psubint
| Pmulint | Pandint | Porint | Pxorint | Plslint
| Plsrint | Pasrint | Pintoffloat | Pfloatofint _
| Pnegfloat _ | Pabsfloat _ | Paddfloat _ | Psubfloat _
@@ -896,10 +895,6 @@ and transl_prim_1 env p arg dbg =
| Praise rkind ->
raise_prim rkind (transl env arg) dbg
(* Integer operations *)
| Pintofvalue ->
int_of_value (transl env arg) dbg
| Pvalueofint ->
value_of_int (transl env arg) dbg
| Pnegint ->
negint (transl env arg) dbg
| Poffsetint n ->
@@ -1130,8 +1125,7 @@ and transl_prim_2 env p arg1 arg2 dbg =
tag_int (Cop(Ccmpi cmp,
[transl_unbox_int dbg env bi arg1;
transl_unbox_int dbg env bi arg2], dbg)) dbg
| Pnot | Pnegint | Pintofvalue | Pvalueofint
| Pintoffloat | Pfloatofint _ | Pnegfloat _
| Pnot | Pnegint | Pintoffloat | Pfloatofint _ | Pnegfloat _
| Pabsfloat _ | Pstringlength | Pbyteslength | Pbytessetu | Pbytessets
| Pisint | Pbswap16 | Pint_as_pointer | Popaque | Pread_symbol _
| Pmakeblock (_, _, _, _) | Pfield _ | Psetfield_computed (_, _)
@@ -1184,8 +1178,7 @@ and transl_prim_3 env p arg1 arg2 arg3 dbg =
bigstring_set size unsafe (transl env arg1) (transl env arg2)
(transl_unbox_sized size dbg env arg3) dbg

| Pfield_computed | Psequand | Psequor | Pnot
| Pintofvalue | Pvalueofint | Pnegint | Paddint
| Pfield_computed | Psequand | Psequor | Pnot | Pnegint | Paddint
| Psubint | Pmulint | Pandint | Porint | Pxorint | Plslint | Plsrint | Pasrint
| Pintoffloat | Pfloatofint _ | Pnegfloat _ | Pabsfloat _ | Paddfloat _ | Psubfloat _
| Pmulfloat _ | Pdivfloat _ | Pstringlength | Pstringrefu | Pstringrefs
1 change: 0 additions & 1 deletion middle_end/clambda_primitives.ml
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@ type primitive =
(* Boolean operations *)
| Psequand | Psequor | Pnot
(* Integer operations *)
| Pintofvalue | Pvalueofint
| Pnegint | Paddint | Psubint | Pmulint
| Pdivint of is_safe | Pmodint of is_safe
| Pandint | Porint | Pxorint
1 change: 0 additions & 1 deletion middle_end/clambda_primitives.mli
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@ type primitive =
(* Boolean operations *)
| Psequand | Psequor | Pnot
(* Integer operations *)
| Pintofvalue | Pvalueofint
| Pnegint | Paddint | Psubint | Pmulint
| Pdivint of is_safe | Pmodint of is_safe
| Pandint | Porint | Pxorint
2 changes: 0 additions & 2 deletions middle_end/printclambda_primitives.ml
Original file line number Diff line number Diff line change
@@ -120,8 +120,6 @@ let primitive ppf (prim:Clambda_primitives.primitive) =
| Psequand -> fprintf ppf "&&"
| Psequor -> fprintf ppf "||"
| Pnot -> fprintf ppf "not"
| Pintofvalue -> fprintf ppf "int_of_value"
| Pvalueofint -> fprintf ppf "value_of_int"
| Pnegint -> fprintf ppf "~"
| Paddint -> fprintf ppf "+"
| Psubint -> fprintf ppf "-"
4 changes: 0 additions & 4 deletions middle_end/semantics_of_primitives.ml
Original file line number Diff line number Diff line change
@@ -57,8 +57,6 @@ let for_primitive (prim : Clambda_primitives.primitive) =
| Pprobe_is_enabled _ -> No_effects, Has_coeffects
| Praise _ -> Arbitrary_effects, No_coeffects
| Pnot
| Pintofvalue
| Pvalueofint
| Pnegint
| Paddint
| Psubint
@@ -195,8 +193,6 @@ let may_locally_allocate (prim:Clambda_primitives.primitive) : bool =
true
| Praise _ -> false
| Pnot
| Pintofvalue
| Pvalueofint
| Pnegint
| Paddint
| Psubint
6 changes: 0 additions & 6 deletions ocaml/asmcomp/cmm_helpers.ml
Original file line number Diff line number Diff line change
@@ -1381,12 +1381,6 @@ let check_bound safety access_size dbg length a2 k =
let opaque e dbg =
Cop(Copaque, [e], dbg)

let int_of_value e dbg =
Cop(Cintofvalue, [e], dbg)

let value_of_int e dbg =
Cop(Cvalueofint, [e], dbg)

let unaligned_set size ptr idx newval dbg =
match (size : Clambda_primitives.memory_access_size) with
| Sixteen -> unaligned_set_16 ptr idx newval dbg
6 changes: 0 additions & 6 deletions ocaml/asmcomp/cmm_helpers.mli
Original file line number Diff line number Diff line change
@@ -416,12 +416,6 @@ val floatfield : int -> unary_primitive
(** Int_as_pointer primitive *)
val int_as_pointer : unary_primitive

(** Int to value primitive *)
val value_of_int : unary_primitive

(** Value to int primitive *)
val int_of_value : unary_primitive

(** Raise primitive *)
val raise_prim : Lambda.raise_kind -> unary_primitive