269 lines
8.1 KiB
Java
269 lines
8.1 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
|
||
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||
|
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class ggX<E> {
|
||
|
private static final AtomicLongFieldUpdater a;
|
||
|
private static final AtomicReferenceFieldUpdater d;
|
||
|
public static final C15119ghh e;
|
||
|
private volatile Object _next = null;
|
||
|
public volatile long _state = 0;
|
||
|
private AtomicReferenceArray b;
|
||
|
private final int c;
|
||
|
private final int f;
|
||
|
private final boolean h;
|
||
|
|
||
|
public ggX(int i, boolean z) {
|
||
|
this.c = i;
|
||
|
this.h = z;
|
||
|
int i2 = i - 1;
|
||
|
this.f = i2;
|
||
|
this.b = new AtomicReferenceArray(i);
|
||
|
if (i2 > 1073741823) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
if ((i & i2) != 0) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:32:0x004c, code lost:
|
||
|
|
||
|
return 1;
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public final int d(E r14) {
|
||
|
/*
|
||
|
r13 = this;
|
||
|
L0:
|
||
|
long r2 = r13._state
|
||
|
r0 = 3458764513820540928(0x3000000000000000, double:1.727233711018889E-77)
|
||
|
long r0 = r0 & r2
|
||
|
r6 = 0
|
||
|
int r0 = (r0 > r6 ? 1 : (r0 == r6 ? 0 : -1))
|
||
|
r1 = 1
|
||
|
if (r0 == 0) goto L15
|
||
|
r4 = 2305843009213693952(0x2000000000000000, double:1.4916681462400413E-154)
|
||
|
long r2 = r2 & r4
|
||
|
int r14 = (r2 > r6 ? 1 : (r2 == r6 ? 0 : -1))
|
||
|
if (r14 == 0) goto L14
|
||
|
r1 = 2
|
||
|
L14:
|
||
|
return r1
|
||
|
L15:
|
||
|
r4 = 1073741823(0x3fffffff, double:5.304989472E-315)
|
||
|
long r4 = r4 & r2
|
||
|
int r0 = (int) r4
|
||
|
r4 = 1152921503533105152(0xfffffffc0000000, double:1.2882296003504729E-231)
|
||
|
long r4 = r4 & r2
|
||
|
r8 = 30
|
||
|
long r4 = r4 >> r8
|
||
|
int r9 = (int) r4
|
||
|
int r10 = r13.f
|
||
|
int r4 = r9 + 2
|
||
|
r4 = r4 & r10
|
||
|
r5 = r0 & r10
|
||
|
if (r4 != r5) goto L2e
|
||
|
return r1
|
||
|
L2e:
|
||
|
boolean r4 = r13.h
|
||
|
r5 = 1073741823(0x3fffffff, float:1.9999999)
|
||
|
if (r4 != 0) goto L4d
|
||
|
java.util.concurrent.atomic.AtomicReferenceArray r4 = r13.b
|
||
|
r11 = r9 & r10
|
||
|
java.lang.Object r4 = r4.get(r11)
|
||
|
if (r4 == 0) goto L4d
|
||
|
int r2 = r13.c
|
||
|
r3 = 1024(0x400, float:1.435E-42)
|
||
|
if (r2 < r3) goto L4c
|
||
|
int r9 = r9 - r0
|
||
|
r0 = r9 & r5
|
||
|
int r2 = r2 >> 1
|
||
|
if (r0 <= r2) goto L0
|
||
|
L4c:
|
||
|
return r1
|
||
|
L4d:
|
||
|
java.util.concurrent.atomic.AtomicLongFieldUpdater r0 = o.ggX.a
|
||
|
int r1 = r9 + 1
|
||
|
r1 = r1 & r5
|
||
|
r4 = -1152921503533105153(0xf00000003fffffff, double:-3.1050369248997324E231)
|
||
|
long r4 = r4 & r2
|
||
|
long r11 = (long) r1
|
||
|
long r11 = r11 << r8
|
||
|
long r4 = r4 | r11
|
||
|
r1 = r13
|
||
|
boolean r0 = r0.compareAndSet(r1, r2, r4)
|
||
|
if (r0 == 0) goto L0
|
||
|
java.util.concurrent.atomic.AtomicReferenceArray r0 = r13.b
|
||
|
r1 = r9 & r10
|
||
|
r0.set(r1, r14)
|
||
|
r0 = r13
|
||
|
L6a:
|
||
|
long r1 = r0._state
|
||
|
r3 = 1152921504606846976(0x1000000000000000, double:1.2882297539194267E-231)
|
||
|
long r1 = r1 & r3
|
||
|
int r1 = (r1 > r6 ? 1 : (r1 == r6 ? 0 : -1))
|
||
|
if (r1 == 0) goto L81
|
||
|
long r1 = r0.b()
|
||
|
o.ggX r0 = r0.c(r1)
|
||
|
o.ggX r0 = r0.a(r9, r14)
|
||
|
if (r0 != 0) goto L6a
|
||
|
L81:
|
||
|
r14 = 0
|
||
|
return r14
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: o.ggX.d(java.lang.Object):int");
|
||
|
}
|
||
|
|
||
|
private final ggX<E> a(int i, E e2) {
|
||
|
Object obj = this.b.get(this.f & i);
|
||
|
if (!(obj instanceof RVV) || ((RVV) obj).d != i) {
|
||
|
return null;
|
||
|
}
|
||
|
this.b.set(i & this.f, e2);
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public final Object a() {
|
||
|
while (true) {
|
||
|
long j = this._state;
|
||
|
if ((1152921504606846976L & j) != 0) {
|
||
|
return e;
|
||
|
}
|
||
|
int i = (int) (1073741823 & j);
|
||
|
int i2 = this.f;
|
||
|
int i3 = ((int) ((1152921503533105152L & j) >> 30)) & i2;
|
||
|
int i4 = i2 & i;
|
||
|
if (i3 == i4) {
|
||
|
return null;
|
||
|
}
|
||
|
Object obj = this.b.get(i4);
|
||
|
if (obj == null) {
|
||
|
if (this.h) {
|
||
|
return null;
|
||
|
}
|
||
|
} else {
|
||
|
if (obj instanceof RVV) {
|
||
|
return null;
|
||
|
}
|
||
|
int i5 = (i + 1) & 1073741823;
|
||
|
if (a.compareAndSet(this, j, ((-1073741824) & j) | i5)) {
|
||
|
this.b.set(this.f & i, null);
|
||
|
return obj;
|
||
|
}
|
||
|
if (this.h) {
|
||
|
ggX<E> ggx = this;
|
||
|
do {
|
||
|
ggx = ggx.c(i5);
|
||
|
} while (ggx != null);
|
||
|
return obj;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final ggX<E> c(int i) {
|
||
|
long j;
|
||
|
int i2;
|
||
|
do {
|
||
|
j = this._state;
|
||
|
i2 = (int) (1073741823 & j);
|
||
|
C15045gfe.b();
|
||
|
if ((1152921504606846976L & j) != 0) {
|
||
|
return c(b());
|
||
|
}
|
||
|
} while (!a.compareAndSet(this, j, ((-1073741824) & j) | i));
|
||
|
this.b.set(this.f & i2, null);
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class RVV {
|
||
|
public final int d;
|
||
|
|
||
|
public RVV(int i) {
|
||
|
this.d = i;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class HBt {
|
||
|
private HBt() {
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ HBt(byte b) {
|
||
|
this();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
new HBt((byte) 0);
|
||
|
e = new C15119ghh("REMOVE_FROZEN");
|
||
|
d = AtomicReferenceFieldUpdater.newUpdater(ggX.class, Object.class, "_next");
|
||
|
a = AtomicLongFieldUpdater.newUpdater(ggX.class, "_state");
|
||
|
}
|
||
|
|
||
|
public final boolean e() {
|
||
|
long j;
|
||
|
do {
|
||
|
j = this._state;
|
||
|
if ((j & 2305843009213693952L) != 0) {
|
||
|
return true;
|
||
|
}
|
||
|
if ((1152921504606846976L & j) != 0) {
|
||
|
return false;
|
||
|
}
|
||
|
} while (!a.compareAndSet(this, j, j | 2305843009213693952L));
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public final long b() {
|
||
|
long j;
|
||
|
long j2;
|
||
|
do {
|
||
|
j = this._state;
|
||
|
if ((j & 1152921504606846976L) != 0) {
|
||
|
return j;
|
||
|
}
|
||
|
j2 = j | 1152921504606846976L;
|
||
|
} while (!a.compareAndSet(this, j, j2));
|
||
|
return j2;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public final ggX<E> c(long j) {
|
||
|
while (true) {
|
||
|
ggX<E> ggx = (ggX) this._next;
|
||
|
if (ggx != null) {
|
||
|
return ggx;
|
||
|
}
|
||
|
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = d;
|
||
|
ggX ggx2 = new ggX(this.c << 1, this.h);
|
||
|
int i = (int) (1073741823 & j);
|
||
|
int i2 = (int) ((1152921503533105152L & j) >> 30);
|
||
|
while (true) {
|
||
|
int i3 = this.f;
|
||
|
int i4 = i & i3;
|
||
|
if (i4 == (i3 & i2)) {
|
||
|
break;
|
||
|
}
|
||
|
Object obj = this.b.get(i4);
|
||
|
if (obj == null) {
|
||
|
obj = new RVV(i);
|
||
|
}
|
||
|
ggx2.b.set(ggx2.f & i, obj);
|
||
|
i++;
|
||
|
}
|
||
|
ggx2._state = (-1152921504606846977L) & j;
|
||
|
while (!atomicReferenceFieldUpdater.compareAndSet(this, null, ggx2) && atomicReferenceFieldUpdater.get(this) == null) {
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|