I'm going to make the following simplifying assumptions:
-
There aren't many custom_alloc_custom_mem blocks (caml_dependent_size ~= 0)
-
There aren't many caml_alloc_custom blocks with nonzero mem/max
type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t | |
let alloc_bigstring size = Bigarray.Array1.create Char Bigarray.c_layout size | |
external bigstring_refcount : bigstring -> int = "pinbuf_bigstring_refcount" [@@noalloc] | |
module Pinbuf (Size : sig val size : int end) : sig | |
type t = private bigstring | |
val alloc : unit -> t | |
val release : t -> unit | |
val count_buffers : unit -> int |
module type T = sig | |
type t | |
end | |
module type S = sig | |
type t | |
module Map : Map.S with type key = t | |
module Set : Set.S with type elt = t | |
module Tbl : Hashtbl.S with type key = t | |
end |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig | |
module type A = sig |
linux: | |
NULL pointer: si_signo=11, si_status=0, si_code=1, si_pid=0, si_uid=0, si_addr=0x0 | |
Unmapped address: si_signo=11, si_status=0, si_code=1, si_pid=131072, si_uid=0, si_addr=0x20000 | |
Readonly address: si_signo=11, si_status=0, si_code=2, si_pid=1896829136, si_uid=21917, si_addr=0x559d710f50d0 | |
Non-canonical address: si_signo=11, si_status=0, si_code=128, si_pid=0, si_uid=0, si_addr=0x0 | |
kill(getpid(),SIGSEGV): si_signo=11, si_status=0, si_code=0, si_pid=900131, si_uid=1000, si_addr=0x3e8000dbc23 | |
subprocess kill: si_signo=11, si_status=0, si_code=0, si_pid=900132, si_uid=1000, si_addr=0x3e8000dbc24 | |
(on linux, si_pid/si_uid overlap si_addr, so you must use si_code to determine which is valid) |
skipped | count | cachelines | unique_pc | |
---|---|---|---|---|
55 | 1411000 | 18 | 32.727272 | |
76 | 3973000 | 18 | 23.684212 | |
14 | 254000 | 8 | 57.142860 | |
62 | 83000 | 31 | 50.000000 | |
892 | 3169000 | 131 | 14.686099 | |
30 | 6000 | 21 | 70.000000 | |
80 | 42000 | 32 | 40.000000 | |
43 | 1409000 | 18 | 41.860466 | |
241 | 268000 | 96 | 39.834026 |
(* An Obj.magic tutorial. *) | |
(* Start with a function that does some integer computation *) | |
let f _ _ _ _ _ = | |
42_42_42_42+42_42_4-2_42 | |
(* We're going to use OCaml's "magic increment" *) | |
let i = Obj.magic incr | |
let _ = |
(* OCaml's subtyping relation is not always transitive *) | |
type (_,_) eq = Refl : ('a, 'a) eq | |
type 'a inty = int | |
type s = < f : int -> int > | |
type t = < f : 'a . 'a inty -> 'a inty > | |
(* s and t are equal and subtype each other *) | |
let eq_s_t : (s, t) eq = Refl |
# type t = Foo;; | |
type t = Foo | |
# type r = { foo : t };; | |
type r = { foo : t; } | |
# let x : r = { foo = Foo } ;; | |
val x : r = {foo = Foo} | |
# type s = t = private Foo;; | |
type s = t = private Foo | |
# let x : r = { foo = Foo } ;; | |
Error: Cannot create values of the private type s |
type t = { | |
mutable a : int option; | |
mutable b : float; | |
mutable c : float; | |
mutable d : float; | |
mutable e : float; | |
mutable f : float; | |
} | |
let make_arr () = |