-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `Runtimetags` module. * Add test.
- Loading branch information
Showing
8 changed files
with
148 additions
and
2 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
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,57 @@ | ||
(* TEST | ||
flags = "-I ${ocamlsrcdir}/utils" | ||
include ocamlcommon | ||
* expect | ||
*) | ||
|
||
let check_tag name left right = | ||
match Int.equal left right with | ||
| true -> Format.printf "values for %S agree@." name | ||
| false -> Format.printf "values for %S disagree (%d vs %d)@." name left right | ||
|
||
let check_tags l = | ||
List.iter (fun (name, left, right) -> check_tag name left right) l | ||
|
||
let () = check_tags [ | ||
"first_non_constant_constructor_tag", Obj.first_non_constant_constructor_tag, Runtimetags.first_non_constant_constructor_tag; | ||
"last_non_constant_constructor_tag", Obj.last_non_constant_constructor_tag, Runtimetags.last_non_constant_constructor_tag; | ||
"forcing_tag", Obj.forcing_tag, Runtimetags.forcing_tag; | ||
"cont_tag", Obj.cont_tag, Runtimetags.cont_tag; | ||
"lazy_tag", Obj.lazy_tag, Runtimetags.lazy_tag; | ||
"closure_tag", Obj.closure_tag, Runtimetags.closure_tag; | ||
"object_tag", Obj.object_tag, Runtimetags.object_tag; | ||
"infix_tag", Obj.infix_tag, Runtimetags.infix_tag; | ||
"forward_tag", Obj.forward_tag, Runtimetags.forward_tag; | ||
"no_scan_tag", Obj.no_scan_tag, Runtimetags.no_scan_tag; | ||
"abstract_tag", Obj.abstract_tag, Runtimetags.abstract_tag; | ||
"string_tag", Obj.string_tag, Runtimetags.string_tag; | ||
"double_tag", Obj.double_tag, Runtimetags.double_tag; | ||
"double_array_tag", Obj.double_array_tag, Runtimetags.double_array_tag; | ||
"custom_tag", Obj.custom_tag, Runtimetags.custom_tag; | ||
"int_tag", Obj.int_tag, Runtimetags.int_tag; | ||
"out_of_heap_tag", Obj.out_of_heap_tag, Runtimetags.out_of_heap_tag; | ||
"unaligned_tag", Obj.unaligned_tag, Runtimetags.unaligned_tag; | ||
] | ||
|
||
[%%expect{| | ||
val check_tag : string -> int -> int -> unit = <fun> | ||
val check_tags : (string * int * int) list -> unit = <fun> | ||
values for "first_non_constant_constructor_tag" agree | ||
values for "last_non_constant_constructor_tag" agree | ||
values for "forcing_tag" agree | ||
values for "cont_tag" agree | ||
values for "lazy_tag" agree | ||
values for "closure_tag" agree | ||
values for "object_tag" agree | ||
values for "infix_tag" agree | ||
values for "forward_tag" agree | ||
values for "no_scan_tag" agree | ||
values for "abstract_tag" agree | ||
values for "string_tag" agree | ||
values for "double_tag" agree | ||
values for "double_array_tag" agree | ||
values for "custom_tag" agree | ||
values for "int_tag" agree | ||
values for "out_of_heap_tag" agree | ||
values for "unaligned_tag" agree | ||
|}] |
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,35 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Max Slater, Jane Street *) | ||
(* *) | ||
(* Copyright 2023 Jane Street Group LLC *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of *) | ||
(* the GNU Lesser General Public License version 2.1, with the *) | ||
(* special exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
(* Defines the runtime tags used by the target runtime. | ||
Must be kept in sync with ocaml/stdlib/obj.ml and ocaml/runtime/caml/mlvalues.h *) | ||
|
||
let first_non_constant_constructor_tag = 0 | ||
let last_non_constant_constructor_tag = 243 | ||
let forcing_tag = 244 | ||
let cont_tag = 245 | ||
let lazy_tag = 246 | ||
let closure_tag = 247 | ||
let object_tag = 248 | ||
let infix_tag = 249 | ||
let forward_tag = 250 | ||
let no_scan_tag = 251 | ||
let abstract_tag = 251 | ||
let string_tag = 252 | ||
let double_tag = 253 | ||
let double_array_tag = 254 | ||
let custom_tag = 255 | ||
let int_tag = 1000 | ||
let out_of_heap_tag = 1001 | ||
let unaligned_tag = 1002 |
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,32 @@ | ||
(**************************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Max Slater, Jane Street *) | ||
(* *) | ||
(* Copyright 2023 Jane Street Group LLC *) | ||
(* *) | ||
(* All rights reserved. This file is distributed under the terms of *) | ||
(* the GNU Lesser General Public License version 2.1, with the *) | ||
(* special exception on linking described in the file LICENSE. *) | ||
(* *) | ||
(**************************************************************************) | ||
|
||
val first_non_constant_constructor_tag : int | ||
val last_non_constant_constructor_tag : int | ||
val forcing_tag : int | ||
val cont_tag : int | ||
val lazy_tag : int | ||
val closure_tag : int | ||
val object_tag : int | ||
val infix_tag : int | ||
val forward_tag : int | ||
val no_scan_tag : int | ||
val abstract_tag : int | ||
val string_tag : int | ||
val double_tag : int | ||
val double_array_tag : int | ||
val custom_tag : int | ||
val int_tag : int | ||
val out_of_heap_tag : int | ||
val unaligned_tag : int |