752 lines
24 KiB
Java
752 lines
24 KiB
Java
|
package o;
|
||
|
|
||
|
import java.io.Closeable;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.concurrent.Executor;
|
||
|
import java.util.concurrent.RejectedExecutionException;
|
||
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||
|
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
|
||
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||
|
import java.util.concurrent.locks.LockSupport;
|
||
|
import o.AbstractC14971gdc;
|
||
|
|
||
|
/* renamed from: o.ghs, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class ExecutorC15130ghs implements Executor, Closeable {
|
||
|
static final AtomicLongFieldUpdater c;
|
||
|
static final AtomicLongFieldUpdater d;
|
||
|
public static final C15119ghh e;
|
||
|
private static final AtomicIntegerFieldUpdater i;
|
||
|
volatile int _isTerminated;
|
||
|
public final C15137ghz a;
|
||
|
public final int b;
|
||
|
volatile long controlState;
|
||
|
public final long f;
|
||
|
public final C15137ghz g;
|
||
|
public final String h;
|
||
|
public final C15117ghf<Sts> j;
|
||
|
private int n;
|
||
|
volatile long parkedWorkersStack;
|
||
|
|
||
|
/* renamed from: o.ghs$IeS */
|
||
|
/* loaded from: classes.dex */
|
||
|
public enum IeS {
|
||
|
CPU_ACQUIRED,
|
||
|
BLOCKING,
|
||
|
PARKING,
|
||
|
DORMANT,
|
||
|
TERMINATED
|
||
|
}
|
||
|
|
||
|
public ExecutorC15130ghs(int i2, int i3, long j, String str) {
|
||
|
this.b = i2;
|
||
|
this.n = i3;
|
||
|
this.f = j;
|
||
|
this.h = str;
|
||
|
if (i2 <= 0) {
|
||
|
StringBuilder sb = new StringBuilder("Core pool size ");
|
||
|
sb.append(i2);
|
||
|
sb.append(" should be at least 1");
|
||
|
throw new IllegalArgumentException(sb.toString().toString());
|
||
|
}
|
||
|
if (i3 < i2) {
|
||
|
StringBuilder sb2 = new StringBuilder("Max pool size ");
|
||
|
sb2.append(i3);
|
||
|
sb2.append(" should be greater than or equals to core pool size ");
|
||
|
sb2.append(i2);
|
||
|
throw new IllegalArgumentException(sb2.toString().toString());
|
||
|
}
|
||
|
if (i3 > 2097150) {
|
||
|
StringBuilder sb3 = new StringBuilder("Max pool size ");
|
||
|
sb3.append(i3);
|
||
|
sb3.append(" should not exceed maximal supported number of threads 2097150");
|
||
|
throw new IllegalArgumentException(sb3.toString().toString());
|
||
|
}
|
||
|
if (j <= 0) {
|
||
|
StringBuilder sb4 = new StringBuilder("Idle worker keep alive time ");
|
||
|
sb4.append(j);
|
||
|
sb4.append(" must be positive");
|
||
|
throw new IllegalArgumentException(sb4.toString().toString());
|
||
|
}
|
||
|
this.g = new C15137ghz();
|
||
|
this.a = new C15137ghz();
|
||
|
this.parkedWorkersStack = 0L;
|
||
|
this.j = new C15117ghf<>(i2 + 1);
|
||
|
this.controlState = i2 << 42;
|
||
|
this._isTerminated = 0;
|
||
|
}
|
||
|
|
||
|
public final void b(Sts sts, int i2, int i3) {
|
||
|
while (true) {
|
||
|
long j = this.parkedWorkersStack;
|
||
|
int i4 = (int) (2097151 & j);
|
||
|
if (i4 == i2) {
|
||
|
i4 = i3 == 0 ? b(sts) : i3;
|
||
|
}
|
||
|
if (i4 >= 0 && d.compareAndSet(this, j, i4 | ((2097152 + j) & (-2097152)))) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
final Sts b() {
|
||
|
while (true) {
|
||
|
long j = this.parkedWorkersStack;
|
||
|
int i2 = (int) (2097151 & j);
|
||
|
AtomicReferenceArray<Sts> atomicReferenceArray = this.j.array;
|
||
|
Sts sts = i2 < atomicReferenceArray.length() ? atomicReferenceArray.get(i2) : null;
|
||
|
if (sts == null) {
|
||
|
return null;
|
||
|
}
|
||
|
int b = b(sts);
|
||
|
if (b >= 0 && d.compareAndSet(this, j, b | ((2097152 + j) & (-2097152)))) {
|
||
|
sts.nextParkedWorker = e;
|
||
|
return sts;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.ghs$HBt */
|
||
|
/* 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("NOT_IN_STACK");
|
||
|
d = AtomicLongFieldUpdater.newUpdater(ExecutorC15130ghs.class, "parkedWorkersStack");
|
||
|
c = AtomicLongFieldUpdater.newUpdater(ExecutorC15130ghs.class, "controlState");
|
||
|
i = AtomicIntegerFieldUpdater.newUpdater(ExecutorC15130ghs.class, "_isTerminated");
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:35:0x007c, code lost:
|
||
|
|
||
|
if (r1 == null) goto L33;
|
||
|
*/
|
||
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public final void close() {
|
||
|
/*
|
||
|
r9 = this;
|
||
|
java.util.concurrent.atomic.AtomicIntegerFieldUpdater r0 = o.ExecutorC15130ghs.i
|
||
|
r1 = 0
|
||
|
r2 = 1
|
||
|
boolean r0 = r0.compareAndSet(r9, r1, r2)
|
||
|
if (r0 == 0) goto Lb7
|
||
|
o.ghs$Sts r0 = r9.a()
|
||
|
o.ghf<o.ghs$Sts> r1 = r9.j
|
||
|
monitor-enter(r1)
|
||
|
long r3 = r9.controlState // Catch: java.lang.Throwable -> Lb4
|
||
|
r5 = 2097151(0x1fffff, double:1.0361303E-317)
|
||
|
long r3 = r3 & r5
|
||
|
int r3 = (int) r3
|
||
|
monitor-exit(r1)
|
||
|
if (r3 <= 0) goto L6c
|
||
|
r1 = r2
|
||
|
L1c:
|
||
|
o.ghf<o.ghs$Sts> r4 = r9.j
|
||
|
java.util.concurrent.atomic.AtomicReferenceArray<T> r4 = r4.array
|
||
|
int r5 = r4.length()
|
||
|
r6 = 0
|
||
|
if (r1 >= r5) goto L2c
|
||
|
java.lang.Object r4 = r4.get(r1)
|
||
|
goto L2d
|
||
|
L2c:
|
||
|
r4 = r6
|
||
|
L2d:
|
||
|
o.C14957gcv.e(r4)
|
||
|
o.ghs$Sts r4 = (o.ExecutorC15130ghs.Sts) r4
|
||
|
if (r4 == r0) goto L67
|
||
|
L34:
|
||
|
boolean r5 = r4.isAlive()
|
||
|
if (r5 == 0) goto L46
|
||
|
r5 = r4
|
||
|
java.lang.Thread r5 = (java.lang.Thread) r5
|
||
|
java.util.concurrent.locks.LockSupport.unpark(r5)
|
||
|
r7 = 10000(0x2710, double:4.9407E-320)
|
||
|
r4.join(r7)
|
||
|
goto L34
|
||
|
L46:
|
||
|
o.ghs$IeS r5 = r4.b
|
||
|
o.C15045gfe.b()
|
||
|
o.ghL r4 = r4.c
|
||
|
o.ghz r5 = r9.a
|
||
|
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r7 = o.C15105ghL.e
|
||
|
java.lang.Object r6 = r7.getAndSet(r4, r6)
|
||
|
o.ghE r6 = (o.ghE) r6
|
||
|
if (r6 == 0) goto L5c
|
||
|
r5.e(r6)
|
||
|
L5c:
|
||
|
o.ghE r6 = r4.b()
|
||
|
if (r6 != 0) goto L63
|
||
|
goto L67
|
||
|
L63:
|
||
|
r5.e(r6)
|
||
|
goto L5c
|
||
|
L67:
|
||
|
if (r1 == r3) goto L6c
|
||
|
int r1 = r1 + 1
|
||
|
goto L1c
|
||
|
L6c:
|
||
|
o.ghz r1 = r9.a
|
||
|
r1.a()
|
||
|
o.ghz r1 = r9.g
|
||
|
r1.a()
|
||
|
L76:
|
||
|
if (r0 == 0) goto L7e
|
||
|
o.ghE r1 = r0.b(r2)
|
||
|
if (r1 != 0) goto La3
|
||
|
L7e:
|
||
|
o.ghz r1 = r9.g
|
||
|
java.lang.Object r1 = r1.c()
|
||
|
o.ghE r1 = (o.ghE) r1
|
||
|
if (r1 != 0) goto La3
|
||
|
o.ghz r1 = r9.a
|
||
|
java.lang.Object r1 = r1.c()
|
||
|
o.ghE r1 = (o.ghE) r1
|
||
|
if (r1 != 0) goto La3
|
||
|
if (r0 == 0) goto L99
|
||
|
o.ghs$IeS r1 = o.ExecutorC15130ghs.IeS.TERMINATED
|
||
|
r0.c(r1)
|
||
|
L99:
|
||
|
o.C15045gfe.b()
|
||
|
r0 = 0
|
||
|
r9.parkedWorkersStack = r0
|
||
|
r9.controlState = r0
|
||
|
return
|
||
|
La3:
|
||
|
r1.run() // Catch: java.lang.Throwable -> La7
|
||
|
goto L76
|
||
|
La7:
|
||
|
r1 = move-exception
|
||
|
java.lang.Thread r3 = java.lang.Thread.currentThread()
|
||
|
java.lang.Thread$UncaughtExceptionHandler r4 = r3.getUncaughtExceptionHandler()
|
||
|
r4.uncaughtException(r3, r1)
|
||
|
goto L76
|
||
|
Lb4:
|
||
|
r0 = move-exception
|
||
|
monitor-exit(r1)
|
||
|
throw r0
|
||
|
Lb7:
|
||
|
return
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: o.ExecutorC15130ghs.close():void");
|
||
|
}
|
||
|
|
||
|
public final void d(Runnable runnable, ghF ghf) {
|
||
|
Sts b;
|
||
|
Sts b2;
|
||
|
ghE a = a(runnable, ghf);
|
||
|
ghE c2 = c(a(), a, false);
|
||
|
if (c2 != null && !e(c2)) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(this.h);
|
||
|
sb.append(" was terminated");
|
||
|
throw new RejectedExecutionException(sb.toString());
|
||
|
}
|
||
|
if (a.j.c() != 0) {
|
||
|
a(false);
|
||
|
return;
|
||
|
}
|
||
|
do {
|
||
|
b = b();
|
||
|
if (b == null) {
|
||
|
if (e(this.controlState)) {
|
||
|
return;
|
||
|
}
|
||
|
do {
|
||
|
b2 = b();
|
||
|
if (b2 == null) {
|
||
|
return;
|
||
|
}
|
||
|
} while (!Sts.a.compareAndSet(b2, -1, 0));
|
||
|
LockSupport.unpark(b2);
|
||
|
return;
|
||
|
}
|
||
|
} while (!Sts.a.compareAndSet(b, -1, 0));
|
||
|
LockSupport.unpark(b);
|
||
|
}
|
||
|
|
||
|
private static ghE a(Runnable runnable, ghF ghf) {
|
||
|
long d2 = ghB.i.d();
|
||
|
if (runnable instanceof ghE) {
|
||
|
ghE ghe = (ghE) runnable;
|
||
|
ghe.g = d2;
|
||
|
ghe.j = ghf;
|
||
|
return ghe;
|
||
|
}
|
||
|
return new C15101ghD(runnable, d2, ghf);
|
||
|
}
|
||
|
|
||
|
final boolean e(long j) {
|
||
|
int i2 = ((int) (2097151 & j)) - ((int) ((j & 4398044413952L) >> 21));
|
||
|
if (i2 < 0) {
|
||
|
i2 = 0;
|
||
|
}
|
||
|
if (i2 < this.b) {
|
||
|
int c2 = c();
|
||
|
if (c2 == 1 && this.b > 1) {
|
||
|
c();
|
||
|
}
|
||
|
if (c2 > 0) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
private static ghE c(Sts sts, ghE ghe, boolean z) {
|
||
|
if (sts == null || sts.b == IeS.TERMINATED) {
|
||
|
return ghe;
|
||
|
}
|
||
|
if (ghe.j.c() == 0 && sts.b == IeS.BLOCKING) {
|
||
|
return ghe;
|
||
|
}
|
||
|
sts.d = true;
|
||
|
return sts.c.d(ghe, false);
|
||
|
}
|
||
|
|
||
|
private final Sts a() {
|
||
|
Thread currentThread = Thread.currentThread();
|
||
|
Sts sts = currentThread instanceof Sts ? (Sts) currentThread : null;
|
||
|
if (sts == null || !C14957gcv.b(sts.j, this)) {
|
||
|
return null;
|
||
|
}
|
||
|
return sts;
|
||
|
}
|
||
|
|
||
|
public final String toString() {
|
||
|
int i2;
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
int length = this.j.array.length();
|
||
|
int i3 = 0;
|
||
|
int i4 = 0;
|
||
|
int i5 = 0;
|
||
|
int i6 = 0;
|
||
|
int i7 = 0;
|
||
|
int i8 = 1;
|
||
|
while (i8 < length) {
|
||
|
AtomicReferenceArray<Sts> atomicReferenceArray = this.j.array;
|
||
|
Sts sts = i8 < atomicReferenceArray.length() ? atomicReferenceArray.get(i8) : null;
|
||
|
if (sts != null) {
|
||
|
C15105ghL c15105ghL = sts.c;
|
||
|
if (c15105ghL.lastScheduledTask != null) {
|
||
|
i2 = (c15105ghL.producerIndex - c15105ghL.consumerIndex) + 1;
|
||
|
} else {
|
||
|
i2 = c15105ghL.producerIndex - c15105ghL.consumerIndex;
|
||
|
}
|
||
|
int i9 = LWm.c[sts.b.ordinal()];
|
||
|
if (i9 == 1) {
|
||
|
i5++;
|
||
|
} else if (i9 == 2) {
|
||
|
i4++;
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(i2);
|
||
|
sb.append('b');
|
||
|
arrayList.add(sb.toString());
|
||
|
} else if (i9 == 3) {
|
||
|
i3++;
|
||
|
StringBuilder sb2 = new StringBuilder();
|
||
|
sb2.append(i2);
|
||
|
sb2.append('c');
|
||
|
arrayList.add(sb2.toString());
|
||
|
} else if (i9 == 4) {
|
||
|
i6++;
|
||
|
if (i2 > 0) {
|
||
|
StringBuilder sb3 = new StringBuilder();
|
||
|
sb3.append(i2);
|
||
|
sb3.append('d');
|
||
|
arrayList.add(sb3.toString());
|
||
|
}
|
||
|
} else if (i9 == 5) {
|
||
|
i7++;
|
||
|
}
|
||
|
}
|
||
|
i8++;
|
||
|
}
|
||
|
long j = this.controlState;
|
||
|
StringBuilder sb4 = new StringBuilder();
|
||
|
sb4.append(this.h);
|
||
|
sb4.append('@');
|
||
|
sb4.append(C15041gfa.b(this));
|
||
|
sb4.append("[Pool Size {core = ");
|
||
|
sb4.append(this.b);
|
||
|
sb4.append(", max = ");
|
||
|
sb4.append(this.n);
|
||
|
sb4.append("}, Worker States {CPU = ");
|
||
|
sb4.append(i3);
|
||
|
sb4.append(", blocking = ");
|
||
|
sb4.append(i4);
|
||
|
sb4.append(", parked = ");
|
||
|
sb4.append(i5);
|
||
|
sb4.append(", dormant = ");
|
||
|
sb4.append(i6);
|
||
|
sb4.append(", terminated = ");
|
||
|
sb4.append(i7);
|
||
|
sb4.append("}, running workers queues = ");
|
||
|
sb4.append(arrayList);
|
||
|
sb4.append(", global CPU queue size = ");
|
||
|
sb4.append(this.g.b());
|
||
|
sb4.append(", global blocking queue size = ");
|
||
|
sb4.append(this.a.b());
|
||
|
sb4.append(", Control State {created workers= ");
|
||
|
sb4.append((int) (2097151 & j));
|
||
|
sb4.append(", blocking tasks = ");
|
||
|
sb4.append((int) ((4398044413952L & j) >> 21));
|
||
|
sb4.append(", CPUs acquired = ");
|
||
|
sb4.append(this.b - ((int) ((9223367638808264704L & j) >> 42)));
|
||
|
sb4.append("}]");
|
||
|
return sb4.toString();
|
||
|
}
|
||
|
|
||
|
public static void d(ghE ghe) {
|
||
|
try {
|
||
|
ghe.run();
|
||
|
} catch (Throwable th) {
|
||
|
Thread currentThread = Thread.currentThread();
|
||
|
currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, th);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.ghs$Sts */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class Sts extends Thread {
|
||
|
static final AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.newUpdater(Sts.class, "workerCtl");
|
||
|
public IeS b;
|
||
|
public final C15105ghL c;
|
||
|
public boolean d;
|
||
|
private long e;
|
||
|
private int g;
|
||
|
private long h;
|
||
|
volatile int indexInArray;
|
||
|
private ExecutorC15130ghs j;
|
||
|
volatile Object nextParkedWorker;
|
||
|
volatile int workerCtl;
|
||
|
|
||
|
private Sts(ExecutorC15130ghs executorC15130ghs) {
|
||
|
this.j = executorC15130ghs;
|
||
|
setDaemon(true);
|
||
|
this.c = new C15105ghL();
|
||
|
this.b = IeS.DORMANT;
|
||
|
this.workerCtl = 0;
|
||
|
this.nextParkedWorker = ExecutorC15130ghs.e;
|
||
|
AbstractC14971gdc.RVV rvv = AbstractC14971gdc.e;
|
||
|
this.g = AbstractC14971gdc.a.b();
|
||
|
}
|
||
|
|
||
|
private void c(int i) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(this.j.h);
|
||
|
sb.append("-worker-");
|
||
|
sb.append(i == 0 ? "TERMINATED" : String.valueOf(i));
|
||
|
setName(sb.toString());
|
||
|
this.indexInArray = i;
|
||
|
}
|
||
|
|
||
|
public Sts(ExecutorC15130ghs executorC15130ghs, int i) {
|
||
|
this(executorC15130ghs);
|
||
|
c(i);
|
||
|
}
|
||
|
|
||
|
private final boolean c() {
|
||
|
long j;
|
||
|
if (this.b != IeS.CPU_ACQUIRED) {
|
||
|
ExecutorC15130ghs executorC15130ghs = this.j;
|
||
|
do {
|
||
|
j = executorC15130ghs.controlState;
|
||
|
if (((int) ((9223367638808264704L & j) >> 42)) == 0) {
|
||
|
return false;
|
||
|
}
|
||
|
} while (!ExecutorC15130ghs.c.compareAndSet(executorC15130ghs, j, j - 4398046511104L));
|
||
|
this.b = IeS.CPU_ACQUIRED;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public final boolean c(IeS ieS) {
|
||
|
IeS ieS2 = this.b;
|
||
|
boolean z = ieS2 == IeS.CPU_ACQUIRED;
|
||
|
if (z) {
|
||
|
ExecutorC15130ghs.c.addAndGet(this.j, 4398046511104L);
|
||
|
}
|
||
|
if (ieS2 != ieS) {
|
||
|
this.b = ieS;
|
||
|
}
|
||
|
return z;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:111:0x004d, code lost:
|
||
|
|
||
|
if (r7.e(r7.controlState) == false) goto L21;
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:112:0x004f, code lost:
|
||
|
|
||
|
r8 = r7.b();
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:113:0x0053, code lost:
|
||
|
|
||
|
if (r8 == null) goto L136;
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:115:0x005b, code lost:
|
||
|
|
||
|
if (o.ExecutorC15130ghs.Sts.a.compareAndSet(r8, -1, 0) == false) goto L138;
|
||
|
*/
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:117:0x005d, code lost:
|
||
|
|
||
|
java.util.concurrent.locks.LockSupport.unpark(r8);
|
||
|
*/
|
||
|
@Override // java.lang.Thread, java.lang.Runnable
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public final void run() {
|
||
|
/*
|
||
|
Method dump skipped, instructions count: 415
|
||
|
To view this dump add '--comments-level debug' option
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: o.ExecutorC15130ghs.Sts.run():void");
|
||
|
}
|
||
|
|
||
|
private int b(int i) {
|
||
|
int i2 = this.g;
|
||
|
int i3 = i2 ^ (i2 << 13);
|
||
|
int i4 = i3 ^ (i3 >> 17);
|
||
|
int i5 = i4 ^ (i4 << 5);
|
||
|
this.g = i5;
|
||
|
int i6 = i - 1;
|
||
|
return (i6 & i) == 0 ? i5 & i6 : (i5 & Integer.MAX_VALUE) % i;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:10:0x001e, code lost:
|
||
|
|
||
|
if (r0 == null) goto L11;
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public final o.ghE b(boolean r3) {
|
||
|
/*
|
||
|
r2 = this;
|
||
|
boolean r0 = r2.c()
|
||
|
if (r0 == 0) goto Lb
|
||
|
o.ghE r3 = r2.c(r3)
|
||
|
return r3
|
||
|
Lb:
|
||
|
if (r3 == 0) goto L20
|
||
|
o.ghL r3 = r2.c
|
||
|
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r0 = o.C15105ghL.e
|
||
|
r1 = 0
|
||
|
java.lang.Object r0 = r0.getAndSet(r3, r1)
|
||
|
o.ghE r0 = (o.ghE) r0
|
||
|
if (r0 != 0) goto L1e
|
||
|
o.ghE r0 = r3.b()
|
||
|
L1e:
|
||
|
if (r0 != 0) goto L2b
|
||
|
L20:
|
||
|
o.ghs r3 = r2.j
|
||
|
o.ghz r3 = r3.a
|
||
|
java.lang.Object r3 = r3.c()
|
||
|
r0 = r3
|
||
|
o.ghE r0 = (o.ghE) r0
|
||
|
L2b:
|
||
|
if (r0 != 0) goto L32
|
||
|
r3 = 1
|
||
|
o.ghE r0 = r2.a(r3)
|
||
|
L32:
|
||
|
return r0
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: o.ExecutorC15130ghs.Sts.b(boolean):o.ghE");
|
||
|
}
|
||
|
|
||
|
private final ghE c(boolean z) {
|
||
|
ghE e;
|
||
|
ghE e2;
|
||
|
if (z) {
|
||
|
boolean z2 = b(this.j.b << 1) == 0;
|
||
|
if (z2 && (e2 = e()) != null) {
|
||
|
return e2;
|
||
|
}
|
||
|
C15105ghL c15105ghL = this.c;
|
||
|
ghE ghe = (ghE) C15105ghL.e.getAndSet(c15105ghL, null);
|
||
|
if (ghe == null) {
|
||
|
ghe = c15105ghL.b();
|
||
|
}
|
||
|
if (ghe != null) {
|
||
|
return ghe;
|
||
|
}
|
||
|
if (!z2 && (e = e()) != null) {
|
||
|
return e;
|
||
|
}
|
||
|
} else {
|
||
|
ghE e3 = e();
|
||
|
if (e3 != null) {
|
||
|
return e3;
|
||
|
}
|
||
|
}
|
||
|
return a(false);
|
||
|
}
|
||
|
|
||
|
private final ghE e() {
|
||
|
if (b(2) == 0) {
|
||
|
ghE c = this.j.g.c();
|
||
|
return c != null ? c : this.j.a.c();
|
||
|
}
|
||
|
ghE c2 = this.j.a.c();
|
||
|
return c2 != null ? c2 : this.j.g.c();
|
||
|
}
|
||
|
|
||
|
private final ghE a(boolean z) {
|
||
|
long c;
|
||
|
C15045gfe.b();
|
||
|
int i = (int) (this.j.controlState & 2097151);
|
||
|
if (i < 2) {
|
||
|
return null;
|
||
|
}
|
||
|
int b = b(i);
|
||
|
ExecutorC15130ghs executorC15130ghs = this.j;
|
||
|
long j = Long.MAX_VALUE;
|
||
|
for (int i2 = 0; i2 < i; i2++) {
|
||
|
b++;
|
||
|
if (b > i) {
|
||
|
b = 1;
|
||
|
}
|
||
|
AtomicReferenceArray<Sts> atomicReferenceArray = executorC15130ghs.j.array;
|
||
|
Sts sts = b < atomicReferenceArray.length() ? atomicReferenceArray.get(b) : null;
|
||
|
if (sts != null && sts != this) {
|
||
|
C15045gfe.b();
|
||
|
if (z) {
|
||
|
c = this.c.e(sts.c);
|
||
|
} else {
|
||
|
c = this.c.c(sts.c);
|
||
|
}
|
||
|
if (c == -1) {
|
||
|
C15105ghL c15105ghL = this.c;
|
||
|
ghE ghe = (ghE) C15105ghL.e.getAndSet(c15105ghL, null);
|
||
|
return ghe == null ? c15105ghL.b() : ghe;
|
||
|
}
|
||
|
if (c > 0) {
|
||
|
j = Math.min(j, c);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (j == Long.MAX_VALUE) {
|
||
|
j = 0;
|
||
|
}
|
||
|
this.e = j;
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private final boolean e(ghE ghe) {
|
||
|
if (ghe.j.c() == 1) {
|
||
|
return this.a.e(ghe);
|
||
|
}
|
||
|
return this.g.e(ghe);
|
||
|
}
|
||
|
|
||
|
private final void a(boolean z) {
|
||
|
Sts b;
|
||
|
Sts b2;
|
||
|
long addAndGet = c.addAndGet(this, 2097152L);
|
||
|
do {
|
||
|
b = b();
|
||
|
if (b == null) {
|
||
|
if (e(addAndGet)) {
|
||
|
return;
|
||
|
}
|
||
|
do {
|
||
|
b2 = b();
|
||
|
if (b2 == null) {
|
||
|
return;
|
||
|
}
|
||
|
} while (!Sts.a.compareAndSet(b2, -1, 0));
|
||
|
LockSupport.unpark(b2);
|
||
|
return;
|
||
|
}
|
||
|
} while (!Sts.a.compareAndSet(b, -1, 0));
|
||
|
LockSupport.unpark(b);
|
||
|
}
|
||
|
|
||
|
private final int c() {
|
||
|
synchronized (this.j) {
|
||
|
if (this._isTerminated != 0) {
|
||
|
return -1;
|
||
|
}
|
||
|
long j = this.controlState;
|
||
|
int i2 = (int) (j & 2097151);
|
||
|
int i3 = i2 - ((int) ((j & 4398044413952L) >> 21));
|
||
|
if (i3 < 0) {
|
||
|
i3 = 0;
|
||
|
}
|
||
|
if (i3 >= this.b) {
|
||
|
return 0;
|
||
|
}
|
||
|
if (i2 >= this.n) {
|
||
|
return 0;
|
||
|
}
|
||
|
int i4 = ((int) (this.controlState & 2097151)) + 1;
|
||
|
if (i4 > 0) {
|
||
|
AtomicReferenceArray<Sts> atomicReferenceArray = this.j.array;
|
||
|
if ((i4 < atomicReferenceArray.length() ? atomicReferenceArray.get(i4) : null) == null) {
|
||
|
Sts sts = new Sts(this, i4);
|
||
|
this.j.d(i4, sts);
|
||
|
if (i4 != ((int) (2097151 & c.incrementAndGet(this)))) {
|
||
|
throw new IllegalArgumentException("Failed requirement.".toString());
|
||
|
}
|
||
|
sts.start();
|
||
|
return i3 + 1;
|
||
|
}
|
||
|
}
|
||
|
throw new IllegalArgumentException("Failed requirement.".toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static int b(Sts sts) {
|
||
|
Object obj = sts.nextParkedWorker;
|
||
|
while (obj != e) {
|
||
|
if (obj == null) {
|
||
|
return 0;
|
||
|
}
|
||
|
Sts sts2 = (Sts) obj;
|
||
|
int i2 = sts2.indexInArray;
|
||
|
if (i2 != 0) {
|
||
|
return i2;
|
||
|
}
|
||
|
obj = sts2.nextParkedWorker;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.concurrent.Executor
|
||
|
public final void execute(Runnable runnable) {
|
||
|
d(runnable, ghB.b);
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.ghs$LWm */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final /* synthetic */ class LWm {
|
||
|
public static final int[] c;
|
||
|
|
||
|
static {
|
||
|
int[] iArr = new int[IeS.values().length];
|
||
|
iArr[IeS.PARKING.ordinal()] = 1;
|
||
|
iArr[IeS.BLOCKING.ordinal()] = 2;
|
||
|
iArr[IeS.CPU_ACQUIRED.ordinal()] = 3;
|
||
|
iArr[IeS.DORMANT.ordinal()] = 4;
|
||
|
iArr[IeS.TERMINATED.ordinal()] = 5;
|
||
|
c = iArr;
|
||
|
}
|
||
|
}
|
||
|
}
|