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
class SpscBoundedQueue<E> extends RingBuffer<E>{ | |
long head = 0; | |
long tailIsClearUntil = 0; | |
long tail = 0; | |
//... constructor and so on | |
boolean offer(E e) { // e must not be null, ignoring for brevity | |
if (tail >= tailIsClearUntil) { | |
if (null != lvElement(tail + LOOK_AHEAD)){ | |
return false; | |
} |
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
private static final long addressOffset; | |
static { | |
try { | |
addressOffset = UnsafeAccess.unsafe.objectFieldOffset(Buffer.class.getDeclaredField("address")); | |
} catch (Exception e) { | |
throw new RuntimeException(e); | |
} | |
} | |
public static long getAddress(ByteBuffer buffy) { |
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
public final class P1C1QueueOriginal1<E> { | |
private final E[] buffer; | |
private volatile long tail = 0; | |
private volatile long head = 0; | |
public P1C1QueueOriginal1(final int capacity) { | |
buffer = (E[]) new Object[capacity]; | |
} | |
public boolean offer(final E e) { |
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
public class WhenWillItExit { | |
public static void main(String[] argc) throws InterruptedException { | |
Thread t = new Thread(() -> { | |
long l = 0; | |
for (int i = 0; i < Integer.MAX_VALUE; i++) { | |
for (int j = 0; j < Integer.MAX_VALUE; j++) { | |
if ((j & 1) == 1) | |
l++; | |
} | |
} |
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
struct mpscq_node_t { | |
mpscq_node_t* volatile next; | |
void* state; | |
}; | |
struct mpscq_t { | |
mpscq_node_t* volatile head; | |
mpscq_node_t* tail; | |
}; |
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
Index: jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMap.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMap.java (revision a2191c1e0243c8cd4690990d6b250b26a3ca8bfa) | |
+++ jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMap.java (revision ) | |
@@ -650,134 +650,130 @@ | |
int reprobe_cnt=0; | |
Object K=null, V=null; |
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
0.18% 0.00% │││ │ 0x00007f485a84780d: lock addl $0x0,(%rsp) ;*invokevirtual putObjectRelease {reexecute=0 rethrow=0 return_oop=0} | |
│││ │ ; - sun.misc.Unsafe::putOrderedObject@7 (line 1042) | |
│││ │ ; - org.jctools.util.UnsafeRefArrayAccess::soElement@6 (line 77) | |
│││ │ ; - org.jctools.queues.SpscArrayQueue::offer@64 (line 187) | |
│││ │ ; - org.jctools.jmh.throughput.QueueThroughputBackoffNone::offer@8 (line 92) | |
│││ │ ; - org.jctools.jmh.throughput.generated.QueueThroughputBackoffNone_tpt_jmhTest::offer_thrpt_jmhStub@17 (line 299) | |
22.58% 31.59% │││ │ 0x00007f485a847812: inc %rbp ;*ladd {reexecute=0 rethrow=0 return_oop=0} | |
│││ │ |
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
// CPP, OpenJDK C2 compiler style... this is from: | |
// http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/b756e7a2ec33/src/share/vm/opto/graphKit.cpp#l4285 | |
void GraphKit::g1_write_barrier_post(Node* oop_store, | |
Node* obj, | |
Node* adr, | |
uint alias_idx, | |
Node* val, | |
BasicType bt, | |
bool use_precise) { | |
/// ... Loads of other crap here... |
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
# c2, level 4, org.jctools.jmh.throughput.generated.QueueThroughputBackoffNone_tpt_jmhTest::offer_thrpt_jmhStub, version 643 (89 bytes) | |
0,46%| 0xb254: mov %r11,%rcx ;*getfield buffer {reexecute=0 rethrow=0 return_oop=0} | |
| ; - org.jctools.queues.SpscArrayQueue::offer@14 (line 176) | |
| ; - org.jctools.jmh.throughput.QueueThroughputBackoffNone::offer@8 (line 92) | |
| ; - org.jctools.jmh.throughput.generated.QueueThroughputBackoffNone_tpt_jmhTest::offer_thrpt_jmhStub@17 (line 299) | |
| 0xb257: lea 0x10(%r11,%r10,4),%r13 ;*invokevirtual getObjectVolatile {reexecute=0 rethrow=0 return_oop=0} | |
| ; - sun.misc.Unsafe::getObjectVolatile@5 (line 923) | |
| ; - org.jctools.util.UnsafeRefArrayAccess::lvElement@5 (line 103) | |
| ; - org.jctools.queues.SpscArrayQueue::offerSlowPath |
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
Decoding compiled method 0x00007fe5a106bb90: | |
Code: | |
[Entry Point] | |
[Constants] | |
# {method} 'noop_avgt_jmhLoop' '(Lorg/openjdk/jmh/runner/InfraControl;Lorg/openjdk/jmh/results/RawResults;Lpsy/lob/saw/generated/BaselineBenchmarks_noop$BaselineBenchmarks_1_jmh;Lpsy/lob/saw/generate | |
d/BaselineBenchmarks_noop$Blackhole_1_jmh;)V' in 'psy/lob/saw/generated/BaselineBenchmarks_noop' | |
# this: rsi:rsi = 'psy/lob/saw/generated/BaselineBenchmarks_noop' | |
# parm0: rdx:rdx = 'org/openjdk/jmh/runner/InfraControl' | |
# parm1: rcx:rcx = 'org/openjdk/jmh/results/RawResults' | |
# parm2: r8:r8 = 'psy/lob/saw/generated/BaselineBenchmarks_noop$BaselineBenchmarks_1_jmh' |
NewerOlder