This file contains hidden or 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
type alloc_count = { mutable total: float } | |
let allocs = { total = 0. } | |
let[@inline never] count txt = | |
let now = int_of_float (Gc.minor_words () -. allocs.total) in | |
Printf.printf "%20s: %d\n" txt now; | |
allocs.total <- Gc.minor_words () | |
let v = Sys.opaque_identity (ref 42) |
This file contains hidden or 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
module F () = | |
struct | |
let v01 = ref 42 | |
let v02 = ref 42 | |
let v03 = ref 42 | |
let v04 = ref 42 | |
let v05 = ref 42 | |
let v06 = ref 42 | |
let v07 = ref 42 | |
let v08 = ref 42 |
This file contains hidden or 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
(**************************************************************************) | |
(* *) | |
(* OCaml *) | |
(* *) | |
(* Pierre Chambart, OCamlPro *) | |
(* Mark Shinwell and Leo White, Jane Street Europe *) | |
(* *) | |
(* Copyright 2013--2016 OCamlPro SAS *) | |
(* Copyright 2014--2016 Jane Street Group LLC *) | |
(* *) |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
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) |
This file contains hidden or 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
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 |
This file contains hidden or 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
(* 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 _ = |
This file contains hidden or 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
(* 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 |