Skip to content

Instantly share code, notes, and snippets.

555555554000-5555555a7000 r--p 00000000 103:02 45376973 -
5555555a7000-55555561f000 r-xp 00053000 103:02 45376973 -
55555561f000-555555645000 r--p 000cb000 103:02 45376973 -
555555645000-555555646000 r--p 000f0000 103:02 45376973 -
555555646000-55555567c000 rw-p 000f1000 103:02 45376973 -
55555567c000-555556d3a000 rw-p 00000000 00:00 0 [heap]
7ffa4cca0000-7ffdc94d8000 rw-p 00000000 00:00 0
7ffdc94e0000-7ffdc94e8000 rw-p 00000000 00:00 0
7ffdc94f0000-7ffdc94f8000 rw-p 00000000 00:00 0
7ffdc9500000-7ffdc9508000 rw-p 00000000 00:00 0
let random_sized n = (Random.int (1 lsl n))
let random_list () =
let n = 1 lsl 29 in
let size = ref 0 in
let l = ref [] in
while !size < n do
let s = random_sized 10 in
size := !size + s;
l := s :: !l
external phys_equal : 'a -> 'a -> bool = "%eq"
(* A [Ring.t] is represented as a cyclic doubly-linked list. The same representation is
used for the ring itself, and for it elements; the ring being represented as a sentinel
element containing a dummy value which is never used.
The implementation supports calls to [detach] which preempt a running [iter] or [add],
by maintaining the invariant that by following [next] pointers from any element, even
an element which has been detached, we will reach the [sentinel] element of the [ring]
in which the element was originally added.
package com.opsian;
import org.openjdk.jmh.Main;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jol.info.ClassLayout;
import com.opsian.*;
import java.util.Random;