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

Linked unboxed-boxed versions of types via # paths #3526

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions flambda-backend/tests/simd/arrays_u.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ CR-someday mslater: with layout polymorphism, the tests could be functorized.
[@@@ocaml.warning "-unused-type-declaration"]
[@@@ocaml.warning "-unused-module"]

type int8x16 = int8x16#
type int16x8 = int16x8#
type int32x4 = int32x4#
type int64x2 = int64x2#
type float32x4 = float32x4#
type float64x2 = float64x2#
type nonrec int8x16 = int8x16#
type nonrec int16x8 = int16x8#
type nonrec int32x4 = int32x4#
type nonrec int64x2 = int64x2#
type nonrec float32x4 = float32x4#
type nonrec float64x2 = float64x2#

external int8x16_of_int64s : int64 -> int64 -> int8x16 = "" "vec128_of_int64s" [@@noalloc] [@@unboxed]
external int8x16_low_int64 : int8x16 -> int64 = "" "vec128_low_int64" [@@noalloc] [@@unboxed]
Expand Down
14 changes: 7 additions & 7 deletions flambda-backend/tests/simd/basic_u.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ let () =

(* Unboxed *)

type int8x16 = int8x16#
type int16x8 = int16x8#
type int32x4 = int32x4#
type int64x2 = int64x2#
type float32x4 = float32x4#
type float64x2 = float64x2#
type nonrec int8x16 = int8x16#
type nonrec int16x8 = int16x8#
type nonrec int32x4 = int32x4#
type nonrec int64x2 = int64x2#
type nonrec float32x4 = float32x4#
type nonrec float64x2 = float64x2#

external int64x2_of_int64s : int64 -> int64 -> int64x2 = "" "vec128_of_int64s" [@@noalloc] [@@unboxed]
external int64x2_low_int64 : int64x2 -> int64 = "" "vec128_low_int64" [@@noalloc] [@@unboxed]
Expand Down Expand Up @@ -188,7 +188,7 @@ let () =
check v 11L 14L
;;

type record2 = { imm0 : int; str1 : string; a : int64x2# }
type record2 = { imm0 : int; str1 : string; a : int64x2 }

let copy_via_weak x =
let weak = Weak.create 1 in
Expand Down
12 changes: 6 additions & 6 deletions flambda-backend/tests/simd/consts_u.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ CR-someday mslater: with layout polymorphism, the tests could be functorized.

[@@@ocaml.warning "-unused-module"]

type int8x16 = int8x16#
type int16x8 = int16x8#
type int32x4 = int32x4#
type int64x2 = int64x2#
type float32x4 = float32x4#
type float64x2 = float64x2#
type nonrec int8x16 = int8x16#
type nonrec int16x8 = int16x8#
type nonrec int32x4 = int32x4#
type nonrec int64x2 = int64x2#
type nonrec float32x4 = float32x4#
type nonrec float64x2 = float64x2#

let eq lv hv l h =
if l <> lv then Printf.printf "%016Lx <> %016Lx\n" lv l;
Expand Down
12 changes: 6 additions & 6 deletions flambda-backend/tests/simd/ops_u.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ CR-someday mslater: with layout polymorphism, the tests could be functorized.
[@@@ocaml.warning "-unused-value-declaration"]
[@@@ocaml.warning "-unused-module"]

type int8x16 = int8x16#
type int16x8 = int16x8#
type int32x4 = int32x4#
type int64x2 = int64x2#
type float32x4 = float32x4#
type float64x2 = float64x2#
type nonrec int8x16 = int8x16#
type nonrec int16x8 = int16x8#
type nonrec int32x4 = int32x4#
type nonrec int64x2 = int64x2#
type nonrec float32x4 = float32x4#
type nonrec float64x2 = float64x2#

let failmsg = ref (fun () -> ())

Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/mixed-blocks/typing_recursive_mixed_blocks.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Line 1, characters 34-36:
Error: This expression has type "('a : value_or_null)"
but an expression was expected of type "float#"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value
because it's the type of the recursive variable x2.
|}];;
Expand Down Expand Up @@ -65,7 +65,7 @@ Line 1, characters 40-48:
Error: This expression has type "('a : value_or_null)"
but an expression was expected of type "float#"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value
because it's the type of the recursive variable bad_flat.
|}];;
Expand Down Expand Up @@ -100,7 +100,7 @@ Line 1, characters 54-62:
Error: This expression has type "('a : value_or_null)"
but an expression was expected of type "float#"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value
because it's the type of the recursive variable bad_flat.
|}];;
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/parsetree/source_jane_street.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ Line 1, characters 68-69:
Error: This expression has type "float#" but an expression was expected of type
"('a : value)"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value
because of the annotation on the wildcard _ at line 1, characters 22-33.
need a value
Expand Down
16 changes: 8 additions & 8 deletions testsuite/tests/ppx-empty-cases/test.compilers.reference
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
(empty_cases_returning_string/273 =
(function {nlocal = 0} param/275
(raise
(makeblock 0 (getpredef Match_failure/41!!) [0: "test.ml" 28 50])))
(makeblock 0 (getpredef Match_failure/30!!) [0: "test.ml" 28 50])))
empty_cases_returning_float64/276 =
(function {nlocal = 0} param/278 : unboxed_float
(raise
(makeblock 0 (getpredef Match_failure/41!!) [0: "test.ml" 29 50])))
(makeblock 0 (getpredef Match_failure/30!!) [0: "test.ml" 29 50])))
empty_cases_accepting_string/279 =
(function {nlocal = 0} param/281
(raise
(makeblock 0 (getpredef Match_failure/41!!) [0: "test.ml" 30 50])))
(makeblock 0 (getpredef Match_failure/30!!) [0: "test.ml" 30 50])))
empty_cases_accepting_float64/282 =
(function {nlocal = 0} param/284[unboxed_float]
(raise
(makeblock 0 (getpredef Match_failure/41!!) [0: "test.ml" 31 50])))
(makeblock 0 (getpredef Match_failure/30!!) [0: "test.ml" 31 50])))
non_empty_cases_returning_string/285 =
(function {nlocal = 0} param/287
(raise
(makeblock 0 (getpredef Assert_failure/51!!) [0: "test.ml" 32 68])))
(makeblock 0 (getpredef Assert_failure/40!!) [0: "test.ml" 32 68])))
non_empty_cases_returning_float64/288 =
(function {nlocal = 0} param/290 : unboxed_float
(raise
(makeblock 0 (getpredef Assert_failure/51!!) [0: "test.ml" 33 68])))
(makeblock 0 (getpredef Assert_failure/40!!) [0: "test.ml" 33 68])))
non_empty_cases_accepting_string/291 =
(function {nlocal = 0} param/293
(raise
(makeblock 0 (getpredef Assert_failure/51!!) [0: "test.ml" 34 68])))
(makeblock 0 (getpredef Assert_failure/40!!) [0: "test.ml" 34 68])))
non_empty_cases_accepting_float64/294 =
(function {nlocal = 0} param/296[unboxed_float]
(raise
(makeblock 0 (getpredef Assert_failure/51!!) [0: "test.ml" 35 68]))))
(makeblock 0 (getpredef Assert_failure/40!!) [0: "test.ml" 35 68]))))
(makeblock 0 empty_cases_returning_string/273
empty_cases_returning_float64/276 empty_cases_accepting_string/279
empty_cases_accepting_float64/282 non_empty_cases_returning_string/285
Expand Down
18 changes: 9 additions & 9 deletions testsuite/tests/typing-layouts-arrays/basics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Line 1, characters 27-28:
Error: This expression has type "float# array"
but an expression was expected of type "'a array"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value.
|}];;

Expand All @@ -101,7 +101,7 @@ Line 1, characters 40-41:
Error: This expression has type "float# array"
but an expression was expected of type "'a array"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value.
|}];;

Expand Down Expand Up @@ -247,7 +247,7 @@ Line 11, characters 79-82:
Error: This expression has type "int64#" but an expression was expected of type
"('a : bits32)"
The layout of int64# is bits64
because it is the primitive type int64#.
because it is the unboxed version of the primitive type int64.
But the layout of int64# must be a sublayout of bits32
because of the definition of get_third at lines 4-7, characters 16-23.
|}]
Expand All @@ -272,7 +272,7 @@ Line 9, characters 24-35:
Error: This expression has type "('a : float64)"
but an expression was expected of type "int32#"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of float64
because of the definition of arr at line 6, characters 12-16.
|}]
Expand All @@ -292,7 +292,7 @@ Line 2, characters 39-44:
Error: This expression has type "float#" but an expression was expected of type
"('a : value)"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -309,7 +309,7 @@ Line 2, characters 39-43:
Error: This expression has type "int32#" but an expression was expected of type
"('a : value)"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -326,7 +326,7 @@ Line 2, characters 39-43:
Error: This expression has type "int64#" but an expression was expected of type
"('a : value)"
The layout of int64# is bits64
because it is the primitive type int64#.
because it is the unboxed version of the primitive type int64.
But the layout of int64# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -343,7 +343,7 @@ Line 2, characters 39-43:
Error: This expression has type "nativeint#"
but an expression was expected of type "('a : value)"
The layout of nativeint# is word
because it is the primitive type nativeint#.
because it is the unboxed version of the primitive type nativeint.
But the layout of nativeint# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -360,7 +360,7 @@ Line 2, characters 39-45:
Error: This expression has type "float32#"
but an expression was expected of type "('a : value)"
The layout of float32# is float32
because it is the primitive type float32#.
because it is the unboxed version of the primitive type float32.
But the layout of float32# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand Down
18 changes: 9 additions & 9 deletions testsuite/tests/typing-layouts-arrays/basics_alpha.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Line 1, characters 27-28:
Error: This expression has type "float# array"
but an expression was expected of type "'a array"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value.
|}];;

Expand All @@ -98,7 +98,7 @@ Line 1, characters 40-41:
Error: This expression has type "float# array"
but an expression was expected of type "'a array"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value.
|}];;

Expand Down Expand Up @@ -244,7 +244,7 @@ Line 11, characters 79-82:
Error: This expression has type "int64#" but an expression was expected of type
"('a : bits32)"
The layout of int64# is bits64
because it is the primitive type int64#.
because it is the unboxed version of the primitive type int64.
But the layout of int64# must be a sublayout of bits32
because of the definition of get_third at lines 4-7, characters 16-23.
|}]
Expand All @@ -269,7 +269,7 @@ Line 9, characters 24-35:
Error: This expression has type "('a : float64)"
but an expression was expected of type "int32#"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of float64
because of the definition of arr at line 6, characters 12-16.
|}]
Expand All @@ -289,7 +289,7 @@ Line 2, characters 39-44:
Error: This expression has type "float#" but an expression was expected of type
"('a : value)"
The layout of float# is float64
because it is the primitive type float#.
because it is the unboxed version of the primitive type float.
But the layout of float# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -306,7 +306,7 @@ Line 2, characters 39-43:
Error: This expression has type "int32#" but an expression was expected of type
"('a : value)"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -323,7 +323,7 @@ Line 2, characters 39-43:
Error: This expression has type "int64#" but an expression was expected of type
"('a : value)"
The layout of int64# is bits64
because it is the primitive type int64#.
because it is the unboxed version of the primitive type int64.
But the layout of int64# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -340,7 +340,7 @@ Line 2, characters 39-43:
Error: This expression has type "nativeint#"
but an expression was expected of type "('a : value)"
The layout of nativeint# is word
because it is the primitive type nativeint#.
because it is the unboxed version of the primitive type nativeint.
But the layout of nativeint# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand All @@ -357,7 +357,7 @@ Line 2, characters 39-45:
Error: This expression has type "float32#"
but an expression was expected of type "('a : value)"
The layout of float32# is float32
because it is the primitive type float32#.
because it is the unboxed version of the primitive type float32.
But the layout of float32# must be a sublayout of value
because it's the type of an array element,
chosen to have layout value.
Expand Down
14 changes: 7 additions & 7 deletions testsuite/tests/typing-layouts-bits32/basics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Line 1, characters 24-25:
Error: This expression has type "int32#" but an expression was expected of type
"('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of value
because it's the type of a tuple element.
|}];;
Expand All @@ -166,7 +166,7 @@ Line 1, characters 18-24:
^^^^^^
Error: Tuple element types must have layout value.
The layout of "int32#" is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of "int32#" must be a sublayout of value
because it's the type of a tuple element.
|}];;
Expand Down Expand Up @@ -306,7 +306,7 @@ Line 1, characters 31-37:
^^^^^^
Error: This type signature for "x" is not a value type.
The layout of type int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of type int32# must be a sublayout of value
because it's the type of something stored in a module structure.
|}];;
Expand Down Expand Up @@ -348,7 +348,7 @@ Line 1, characters 27-28:
Error: This expression has type "int32#" but an expression was expected of type
"('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of value
because it's the type of the field of a polymorphic variant.
|}];;
Expand Down Expand Up @@ -426,7 +426,7 @@ Line 1, characters 20-36:
Error: This expression has type "int32#" but an expression was expected of type
"('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of value
because of the definition of id_value at line 5, characters 13-18.
|}];;
Expand Down Expand Up @@ -633,7 +633,7 @@ Line 1, characters 26-43:
^^^^^^^^^^^^^^^^^
Error: The method "x" has type "int32#" but is expected to have type "('a : value)"
The layout of int32# is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of int32# must be a sublayout of value
because it's the type of an object field.
|}];;
Expand All @@ -645,7 +645,7 @@ Line 1, characters 26-40:
^^^^^^^^^^^^^^
Error: Variables bound in a class must have layout value.
The layout of x is bits32
because it is the primitive type int32#.
because it is the unboxed version of the primitive type int32.
But the layout of x must be a sublayout of value
because it's the type of an instance variable.
|}];;
Expand Down
Loading
Loading