Skip to content

Commit

Permalink
inheritance based field padding for MPMCConcurrentQueue.Cell
Browse files Browse the repository at this point in the history
- 128 bytes padding
  • Loading branch information
lokok8 committed Sep 17, 2024
1 parent bf3a11b commit 302a959
Showing 1 changed file with 50 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,64 @@ public final boolean contains(Object o) {

}

protected static final class Cell<R> {
final ContendedAtomicLong seq = new ContendedAtomicLong(0L);

public long p1, p2, p3, p4, p5, p6, p7;

protected static class CellLhsPadding {
byte p11, p12, p13, p14, p15, p16, p17, p18; // long p1
byte p21, p22, p23, p24, p25, p26, p27, p28; // long p2
byte p31, p32, p33, p34, p35, p36, p37, p38; // long p3
byte p41, p42, p43, p44, p45, p46, p47, p48; // long p4
byte p51, p52, p53, p54, p55, p56, p57, p58; // long p5
byte p61, p62, p63, p64, p65, p66, p67, p68; // long p6
byte p71, p72, p73, p74, p75, p76, p77, p78; // long p7
byte p81, p82, p83, p84, p85, p86, p87, p88; // long p8
byte p91, p92, p93, p94, p95, p96, p97, p98; // long p9
byte p101, p102, p103, p104, p105, p106, p107, p108; // long p10
byte p111, p112, p113, p114, p115, p116, p117, p118; // long p11
byte p121, p122, p123, p124, p125, p126, p127, p128; // long p12
byte p131, p132, p133, p134, p135, p136, p137, p138; // long p13
byte p141, p142, p143, p144, p145, p146, p147, p148; // long p14
byte p151, p152, p153, p154, p155, p156, p157, p158; // long p15
}
protected static class CellEntry<R> extends CellLhsPadding{
R entry;
}
protected static class CellRhsPadding<R> extends CellEntry<R>{
byte a11, a12, a13, a14, a15, a16, a17, a18; // long a1
byte a21, a22, a23, a24, a25, a26, a27, a28; // long a2
byte a31, a32, a33, a34, a35, a36, a37, a38; // long a3
byte a41, a42, a43, a44, a45, a46, a47, a48; // long a4
byte a51, a52, a53, a54, a55, a56, a57, a58; // long a5
byte a61, a62, a63, a64, a65, a66, a67, a68; // long a6
byte a71, a72, a73, a74, a75, a76, a77, a78; // long a7
byte a81, a82, a83, a84, a85, a86, a87, a88; // long a8
byte a91, a92, a93, a94, a95, a96, a97, a98; // long a9
byte a101, a102, a103, a104, a105, a106, a107, a108; // long a10
byte a111, a112, a113, a114, a115, a116, a117, a118; // long a11
byte a121, a122, a123, a124, a125, a126, a127, a128; // long a12
byte a131, a132, a133, a134, a135, a136, a137, a138; // long a13
byte a141, a142, a143, a144, a145, a146, a147, a148; // long a14
byte a151, a152, a153, a154, a155, a156, a157, a158; // long a15
byte a161, a162, a163, a164, a165, a166, a167, a168; // long a16
}

public long a1, a2, a3, a4, a5, a6, a7, a8;

protected static final class Cell<R> extends CellRhsPadding<R> {
final ContendedAtomicLong seq = new ContendedAtomicLong(0L);

Cell(final long s) {
seq.set(s);
entry = null;
}

public long sumToAvoidOptimization() {
return p1+p2+p3+p4+p5+p6+p7+a1+a2+a3+a4+a5+a6+a7+a8;
return // LhsPadding p1-p15
p11+p12+p13+p14+p15+p16+p17+p18 +p21+p22+p23+p24+p25+p26+p27+p28 +p31+p32+p33+p34+p35+p36+p37+p38 +p41+p42+p43+p44+p45+p46+p47+p48
+p51+p52+p53+p54+p55+p56+p57+p58 +p61+p62+p63+p64+p65+p66+p67+p68 +p71+p72+p73+p74+p75+p76+p77+p78 +p81+p82+p83+p84+p85+p86+p87+p88
+p91+p92+p93+p94+p95+p96+p97+p98 +p101+p102+p103+p104+p105+p106+p107+p108 +p111+p112+p113+p114+p115+p116+p117+p118 +p121+p122+p123+p124+p125+p126+p127+p128
+p131+p132+p133+p134+p135+p136+p137+p138 +p141+p142+p143+p144+p145+p146+p147+p148 +p151+p152+p153+p154+p155+p156+p157+p158
// phsPadding a1-a16
+a11+a12+a13+a14+a15+a16+a17+a18 +a21+a22+a23+a24+a25+a26+a27+a28 +a31+a32+a33+a34+a35+a36+a37+a38 +a41+a42+a43+a44+a45+a46+a47+a48
+a51+a52+a53+a54+a55+a56+a57+a58 +a61+a62+a63+a64+a65+a66+a67+a68 +a71+a72+a73+a74+a75+a76+a77+a78 +a81+a82+a83+a84+a85+a86+a87+a88
+a91+a92+a93+a94+a95+a96+a97+a98 +a101+a102+a103+a104+a105+a106+a107+a108 +a111+a112+a113+a114+a115+a116+a117+a118 +a121+a122+a123+a124+a125+a126+a127+a128
+a131+a132+a133+a134+a135+a136+a137+a138 +a141+a142+a143+a144+a145+a146+a147+a148 +a151+a152+a153+a154+a155+a156+a157+a158 +a161+a162+a163+a164+a165+a166+a167+a168;
}

}
Expand Down

0 comments on commit 302a959

Please sign in to comment.