Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public abstract class AtomicKt {
public static final Object NO_DECISION = new Symbol("NO_DECISION");
}

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
/* loaded from: classes5.dex */
public abstract class AtomicOp extends OpDescriptor {
public static final AtomicReferenceFieldUpdater _consensus$FU = AtomicReferenceFieldUpdater.newUpdater(AtomicOp.class, Object.class, "_consensus");
private volatile Object _consensus = AtomicKt.NO_DECISION;
public abstract void complete(Object obj, Object obj2);
public abstract Object prepare(Object obj);
public final Object decide(Object obj) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _consensus$FU;
Object obj2 = atomicReferenceFieldUpdater.get(this);
Object obj3 = AtomicKt.NO_DECISION;
return obj2 != obj3 ? obj2 : AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, obj3, obj) ? obj : atomicReferenceFieldUpdater.get(this);
}
@Override // kotlinx.coroutines.internal.OpDescriptor
public final Object perform(Object obj) {
Object obj2 = _consensus$FU.get(this);
if (obj2 == AtomicKt.NO_DECISION) {
obj2 = decide(prepare(obj));
}
complete(obj, obj2);
return obj2;
}
}

View File

@@ -0,0 +1,34 @@
package kotlinx.coroutines.internal;
import java.lang.reflect.Method;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledThreadPoolExecutor;
/* loaded from: classes5.dex */
public abstract class ConcurrentKt {
public static final Method REMOVE_FUTURE_ON_CANCEL;
static {
Method method;
try {
method = ScheduledThreadPoolExecutor.class.getMethod("setRemoveOnCancelPolicy", Boolean.TYPE);
} catch (Throwable unused) {
method = null;
}
REMOVE_FUTURE_ON_CANCEL = method;
}
public static final boolean removeFutureOnCancel(Executor executor) {
Method method;
try {
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = executor instanceof ScheduledThreadPoolExecutor ? (ScheduledThreadPoolExecutor) executor : null;
if (scheduledThreadPoolExecutor == null || (method = REMOVE_FUTURE_ON_CANCEL) == null) {
return false;
}
method.invoke(scheduledThreadPoolExecutor, Boolean.TRUE);
return true;
} catch (Throwable unused) {
return false;
}
}
}

View File

@@ -0,0 +1,45 @@
package kotlinx.coroutines.internal;
import kotlin.jvm.functions.Function2;
/* loaded from: classes5.dex */
public abstract class ConcurrentLinkedListKt {
public static final Symbol CLOSED = new Symbol("CLOSED");
public static final Object findSegmentInternal(Segment segment, long j, Function2 function2) {
while (true) {
if (segment.id >= j && !segment.isRemoved()) {
return SegmentOrClosed.m4150constructorimpl(segment);
}
Object nextOrClosed = segment.getNextOrClosed();
if (nextOrClosed == CLOSED) {
return SegmentOrClosed.m4150constructorimpl(CLOSED);
}
Segment segment2 = (Segment) ((ConcurrentLinkedListNode) nextOrClosed);
if (segment2 == null) {
segment2 = (Segment) function2.invoke(Long.valueOf(segment.id + 1), segment);
if (segment.trySetNext(segment2)) {
if (segment.isRemoved()) {
segment.remove();
}
}
}
segment = segment2;
}
}
public static final ConcurrentLinkedListNode close(ConcurrentLinkedListNode concurrentLinkedListNode) {
while (true) {
Object nextOrClosed = concurrentLinkedListNode.getNextOrClosed();
if (nextOrClosed == CLOSED) {
return concurrentLinkedListNode;
}
ConcurrentLinkedListNode concurrentLinkedListNode2 = (ConcurrentLinkedListNode) nextOrClosed;
if (concurrentLinkedListNode2 != null) {
concurrentLinkedListNode = concurrentLinkedListNode2;
} else if (concurrentLinkedListNode.markAsClosed()) {
return concurrentLinkedListNode;
}
}
}
}

View File

@@ -0,0 +1,92 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class ConcurrentLinkedListNode {
public static final AtomicReferenceFieldUpdater _next$FU = AtomicReferenceFieldUpdater.newUpdater(ConcurrentLinkedListNode.class, Object.class, "_next");
public static final AtomicReferenceFieldUpdater _prev$FU = AtomicReferenceFieldUpdater.newUpdater(ConcurrentLinkedListNode.class, Object.class, "_prev");
private volatile Object _next;
private volatile Object _prev;
public abstract boolean isRemoved();
public ConcurrentLinkedListNode(ConcurrentLinkedListNode concurrentLinkedListNode) {
this._prev = concurrentLinkedListNode;
}
public final Object getNextOrClosed() {
return _next$FU.get(this);
}
public final ConcurrentLinkedListNode getNext() {
Object nextOrClosed = getNextOrClosed();
if (nextOrClosed == ConcurrentLinkedListKt.CLOSED) {
return null;
}
return (ConcurrentLinkedListNode) nextOrClosed;
}
public final boolean trySetNext(ConcurrentLinkedListNode concurrentLinkedListNode) {
return AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, null, concurrentLinkedListNode);
}
public final boolean isTail() {
return getNext() == null;
}
public final ConcurrentLinkedListNode getPrev() {
return (ConcurrentLinkedListNode) _prev$FU.get(this);
}
public final void cleanPrev() {
_prev$FU.lazySet(this, null);
}
public final boolean markAsClosed() {
return AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, null, ConcurrentLinkedListKt.CLOSED);
}
public final void remove() {
Object obj;
if (isTail()) {
return;
}
while (true) {
ConcurrentLinkedListNode aliveSegmentLeft = getAliveSegmentLeft();
ConcurrentLinkedListNode aliveSegmentRight = getAliveSegmentRight();
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _prev$FU;
do {
obj = atomicReferenceFieldUpdater.get(aliveSegmentRight);
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, aliveSegmentRight, obj, ((ConcurrentLinkedListNode) obj) == null ? null : aliveSegmentLeft));
if (aliveSegmentLeft != null) {
_next$FU.set(aliveSegmentLeft, aliveSegmentRight);
}
if (!aliveSegmentRight.isRemoved() || aliveSegmentRight.isTail()) {
if (aliveSegmentLeft == null || !aliveSegmentLeft.isRemoved()) {
return;
}
}
}
}
public final ConcurrentLinkedListNode getAliveSegmentLeft() {
ConcurrentLinkedListNode prev = getPrev();
while (prev != null && prev.isRemoved()) {
prev = (ConcurrentLinkedListNode) _prev$FU.get(prev);
}
return prev;
}
public final ConcurrentLinkedListNode getAliveSegmentRight() {
ConcurrentLinkedListNode next;
ConcurrentLinkedListNode next2 = getNext();
Intrinsics.checkNotNull(next2);
while (next2.isRemoved() && (next = next2.getNext()) != null) {
next2 = next;
}
return next2;
}
}

View File

@@ -0,0 +1,22 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.CoroutineScope;
/* loaded from: classes5.dex */
public final class ContextScope implements CoroutineScope {
public final CoroutineContext coroutineContext;
@Override // kotlinx.coroutines.CoroutineScope
public CoroutineContext getCoroutineContext() {
return this.coroutineContext;
}
public ContextScope(CoroutineContext coroutineContext) {
this.coroutineContext = coroutineContext;
}
public String toString() {
return "CoroutineScope(coroutineContext=" + getCoroutineContext() + ')';
}
}

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines.internal;
import java.util.Collection;
import java.util.List;
import java.util.ServiceLoader;
import kotlin.sequences.Sequence;
import kotlin.sequences.SequencesKt__SequencesKt;
import kotlin.sequences.SequencesKt___SequencesKt;
import kotlinx.coroutines.CoroutineExceptionHandler;
/* loaded from: classes5.dex */
public abstract class CoroutineExceptionHandlerImplKt {
public static final Collection platformExceptionHandlers;
public static final Collection getPlatformExceptionHandlers() {
return platformExceptionHandlers;
}
static {
Sequence asSequence;
List list;
asSequence = SequencesKt__SequencesKt.asSequence(ServiceLoader.load(CoroutineExceptionHandler.class, CoroutineExceptionHandler.class.getClassLoader()).iterator());
list = SequencesKt___SequencesKt.toList(asSequence);
platformExceptionHandlers = list;
}
public static final void propagateExceptionFinalResort(Throwable th) {
Thread currentThread = Thread.currentThread();
currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, th);
}
}

View File

@@ -0,0 +1,26 @@
package kotlinx.coroutines.internal;
import java.util.Iterator;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
/* loaded from: classes5.dex */
public abstract class CoroutineExceptionHandlerImpl_commonKt {
public static final void handleUncaughtCoroutineException(CoroutineContext coroutineContext, Throwable th) {
Iterator it = CoroutineExceptionHandlerImplKt.getPlatformExceptionHandlers().iterator();
while (it.hasNext()) {
try {
((CoroutineExceptionHandler) it.next()).handleException(coroutineContext, th);
} catch (Throwable th2) {
CoroutineExceptionHandlerImplKt.propagateExceptionFinalResort(CoroutineExceptionHandlerKt.handlerException(th, th2));
}
}
try {
ExceptionsKt__ExceptionsKt.addSuppressed(th, new DiagnosticCoroutineContextException(coroutineContext));
} catch (Throwable unused) {
}
CoroutineExceptionHandlerImplKt.propagateExceptionFinalResort(th);
}
}

View File

@@ -0,0 +1,23 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.CoroutineContext;
/* loaded from: classes5.dex */
public final class DiagnosticCoroutineContextException extends RuntimeException {
public final transient CoroutineContext context;
public DiagnosticCoroutineContextException(CoroutineContext coroutineContext) {
this.context = coroutineContext;
}
@Override // java.lang.Throwable
public String getLocalizedMessage() {
return this.context.toString();
}
@Override // java.lang.Throwable
public Throwable fillInStackTrace() {
setStackTrace(new StackTraceElement[0]);
return this;
}
}

View File

@@ -0,0 +1,202 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CancellableContinuationImpl;
import kotlinx.coroutines.CompletedWithCancellation;
import kotlinx.coroutines.CompletionStateKt;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.DebugStringsKt;
import kotlinx.coroutines.DispatchedTask;
import kotlinx.coroutines.EventLoop;
import kotlinx.coroutines.ThreadLocalEventLoop;
/* loaded from: classes5.dex */
public final class DispatchedContinuation extends DispatchedTask implements CoroutineStackFrame, Continuation {
public static final AtomicReferenceFieldUpdater _reusableCancellableContinuation$FU = AtomicReferenceFieldUpdater.newUpdater(DispatchedContinuation.class, Object.class, "_reusableCancellableContinuation");
private volatile Object _reusableCancellableContinuation;
public Object _state;
public final Continuation continuation;
public final Object countOrElement;
public final CoroutineDispatcher dispatcher;
@Override // kotlin.coroutines.Continuation
public CoroutineContext getContext() {
return this.continuation.getContext();
}
@Override // kotlinx.coroutines.DispatchedTask
public Continuation getDelegate$kotlinx_coroutines_core() {
return this;
}
public DispatchedContinuation(CoroutineDispatcher coroutineDispatcher, Continuation continuation) {
super(-1);
Symbol symbol;
this.dispatcher = coroutineDispatcher;
this.continuation = continuation;
symbol = DispatchedContinuationKt.UNDEFINED;
this._state = symbol;
this.countOrElement = ThreadContextKt.threadContextElements(getContext());
}
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
public CoroutineStackFrame getCallerFrame() {
Continuation continuation = this.continuation;
if (continuation instanceof CoroutineStackFrame) {
return (CoroutineStackFrame) continuation;
}
return null;
}
public final CancellableContinuationImpl getReusableCancellableContinuation() {
Object obj = _reusableCancellableContinuation$FU.get(this);
if (obj instanceof CancellableContinuationImpl) {
return (CancellableContinuationImpl) obj;
}
return null;
}
public final boolean isReusable$kotlinx_coroutines_core() {
return _reusableCancellableContinuation$FU.get(this) != null;
}
public final void awaitReusability$kotlinx_coroutines_core() {
while (_reusableCancellableContinuation$FU.get(this) == DispatchedContinuationKt.REUSABLE_CLAIMED) {
}
}
public final void release$kotlinx_coroutines_core() {
awaitReusability$kotlinx_coroutines_core();
CancellableContinuationImpl reusableCancellableContinuation = getReusableCancellableContinuation();
if (reusableCancellableContinuation != null) {
reusableCancellableContinuation.detachChild$kotlinx_coroutines_core();
}
}
public final CancellableContinuationImpl claimReusableCancellableContinuation$kotlinx_coroutines_core() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _reusableCancellableContinuation$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (obj == null) {
_reusableCancellableContinuation$FU.set(this, DispatchedContinuationKt.REUSABLE_CLAIMED);
return null;
}
if (obj instanceof CancellableContinuationImpl) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_reusableCancellableContinuation$FU, this, obj, DispatchedContinuationKt.REUSABLE_CLAIMED)) {
return (CancellableContinuationImpl) obj;
}
} else if (obj != DispatchedContinuationKt.REUSABLE_CLAIMED && !(obj instanceof Throwable)) {
throw new IllegalStateException(("Inconsistent state " + obj).toString());
}
}
}
public final Throwable tryReleaseClaimedContinuation$kotlinx_coroutines_core(CancellableContinuation cancellableContinuation) {
Symbol symbol;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _reusableCancellableContinuation$FU;
do {
Object obj = atomicReferenceFieldUpdater.get(this);
symbol = DispatchedContinuationKt.REUSABLE_CLAIMED;
if (obj != symbol) {
if (obj instanceof Throwable) {
if (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_reusableCancellableContinuation$FU, this, obj, null)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
return (Throwable) obj;
}
throw new IllegalStateException(("Inconsistent state " + obj).toString());
}
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_reusableCancellableContinuation$FU, this, symbol, cancellableContinuation));
return null;
}
public final boolean postponeCancellation$kotlinx_coroutines_core(Throwable th) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _reusableCancellableContinuation$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
Symbol symbol = DispatchedContinuationKt.REUSABLE_CLAIMED;
if (Intrinsics.areEqual(obj, symbol)) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_reusableCancellableContinuation$FU, this, symbol, th)) {
return true;
}
} else {
if (obj instanceof Throwable) {
return true;
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_reusableCancellableContinuation$FU, this, obj, null)) {
return false;
}
}
}
}
@Override // kotlinx.coroutines.DispatchedTask
public Object takeState$kotlinx_coroutines_core() {
Symbol symbol;
Object obj = this._state;
symbol = DispatchedContinuationKt.UNDEFINED;
this._state = symbol;
return obj;
}
@Override // kotlin.coroutines.Continuation
public void resumeWith(Object obj) {
CoroutineContext context = this.continuation.getContext();
Object state$default = CompletionStateKt.toState$default(obj, null, 1, null);
if (this.dispatcher.isDispatchNeeded(context)) {
this._state = state$default;
this.resumeMode = 0;
this.dispatcher.mo4148dispatch(context, this);
return;
}
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (!eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
CoroutineContext context2 = getContext();
Object updateThreadContext = ThreadContextKt.updateThreadContext(context2, this.countOrElement);
try {
this.continuation.resumeWith(obj);
Unit unit = Unit.INSTANCE;
while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent()) {
}
} finally {
ThreadContextKt.restoreThreadContext(context2, updateThreadContext);
}
} finally {
try {
return;
} finally {
}
}
return;
}
this._state = state$default;
this.resumeMode = 0;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(this);
}
@Override // kotlinx.coroutines.DispatchedTask
public void cancelCompletedResult$kotlinx_coroutines_core(Object obj, Throwable th) {
if (obj instanceof CompletedWithCancellation) {
((CompletedWithCancellation) obj).onCancellation.invoke(th);
}
}
public final void dispatchYield$kotlinx_coroutines_core(CoroutineContext coroutineContext, Object obj) {
this._state = obj;
this.resumeMode = 1;
this.dispatcher.dispatchYield(coroutineContext, this);
}
public String toString() {
return "DispatchedContinuation[" + this.dispatcher + ", " + DebugStringsKt.toDebugString(this.continuation) + ']';
}
}

View File

@@ -0,0 +1,107 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.CancellationException;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.CompletionStateKt;
import kotlinx.coroutines.CoroutineContextKt;
import kotlinx.coroutines.EventLoop;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.ThreadLocalEventLoop;
import kotlinx.coroutines.UndispatchedCoroutine;
/* loaded from: classes5.dex */
public abstract class DispatchedContinuationKt {
public static final Symbol UNDEFINED = new Symbol("UNDEFINED");
public static final Symbol REUSABLE_CLAIMED = new Symbol("REUSABLE_CLAIMED");
public static /* synthetic */ void resumeCancellableWith$default(Continuation continuation, Object obj, Function1 function1, int i, Object obj2) {
if ((i & 2) != 0) {
function1 = null;
}
resumeCancellableWith(continuation, obj, function1);
}
public static final void resumeCancellableWith(Continuation continuation, Object obj, Function1 function1) {
if (continuation instanceof DispatchedContinuation) {
DispatchedContinuation dispatchedContinuation = (DispatchedContinuation) continuation;
Object state = CompletionStateKt.toState(obj, function1);
if (dispatchedContinuation.dispatcher.isDispatchNeeded(dispatchedContinuation.getContext())) {
dispatchedContinuation._state = state;
dispatchedContinuation.resumeMode = 1;
dispatchedContinuation.dispatcher.mo4148dispatch(dispatchedContinuation.getContext(), dispatchedContinuation);
return;
}
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (!eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
Job job = (Job) dispatchedContinuation.getContext().get(Job.Key);
if (job != null && !job.isActive()) {
CancellationException cancellationException = job.getCancellationException();
dispatchedContinuation.cancelCompletedResult$kotlinx_coroutines_core(state, cancellationException);
Result.Companion companion = Result.Companion;
dispatchedContinuation.resumeWith(Result.m4060constructorimpl(ResultKt.createFailure(cancellationException)));
} else {
Continuation continuation2 = dispatchedContinuation.continuation;
Object obj2 = dispatchedContinuation.countOrElement;
CoroutineContext context = continuation2.getContext();
Object updateThreadContext = ThreadContextKt.updateThreadContext(context, obj2);
UndispatchedCoroutine updateUndispatchedCompletion = updateThreadContext != ThreadContextKt.NO_THREAD_ELEMENTS ? CoroutineContextKt.updateUndispatchedCompletion(continuation2, context, updateThreadContext) : null;
try {
dispatchedContinuation.continuation.resumeWith(obj);
Unit unit = Unit.INSTANCE;
} finally {
if (updateUndispatchedCompletion == null || updateUndispatchedCompletion.clearThreadContext()) {
ThreadContextKt.restoreThreadContext(context, updateThreadContext);
}
}
}
while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent()) {
}
} finally {
try {
return;
} finally {
}
}
return;
}
dispatchedContinuation._state = state;
dispatchedContinuation.resumeMode = 1;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
return;
}
continuation.resumeWith(obj);
}
public static final boolean yieldUndispatched(DispatchedContinuation dispatchedContinuation) {
Unit unit = Unit.INSTANCE;
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (eventLoop$kotlinx_coroutines_core.isUnconfinedQueueEmpty()) {
return false;
}
if (!eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
dispatchedContinuation.run();
do {
} while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent());
} finally {
try {
return false;
} finally {
}
}
return false;
}
dispatchedContinuation._state = unit;
dispatchedContinuation.resumeMode = 1;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
return true;
}
}

View File

@@ -0,0 +1,168 @@
package kotlinx.coroutines.internal;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.collections.CollectionsKt__IterablesKt;
import kotlin.collections.CollectionsKt__MutableCollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlin.text.StringsKt__StringsKt;
/* loaded from: classes5.dex */
public final class FastServiceLoader {
public static final FastServiceLoader INSTANCE = new FastServiceLoader();
public final List loadMainDispatcherFactory$kotlinx_coroutines_core() {
MainDispatcherFactory mainDispatcherFactory;
if (!FastServiceLoaderKt.getANDROID_DETECTED()) {
return load(MainDispatcherFactory.class, MainDispatcherFactory.class.getClassLoader());
}
try {
ArrayList arrayList = new ArrayList(2);
MainDispatcherFactory mainDispatcherFactory2 = null;
try {
mainDispatcherFactory = (MainDispatcherFactory) MainDispatcherFactory.class.cast(Class.forName("kotlinx.coroutines.android.AndroidDispatcherFactory", true, MainDispatcherFactory.class.getClassLoader()).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
} catch (ClassNotFoundException unused) {
mainDispatcherFactory = null;
}
if (mainDispatcherFactory != null) {
arrayList.add(mainDispatcherFactory);
}
try {
mainDispatcherFactory2 = (MainDispatcherFactory) MainDispatcherFactory.class.cast(Class.forName("kotlinx.coroutines.test.internal.TestMainDispatcherFactory", true, MainDispatcherFactory.class.getClassLoader()).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
} catch (ClassNotFoundException unused2) {
}
if (mainDispatcherFactory2 == null) {
return arrayList;
}
arrayList.add(mainDispatcherFactory2);
return arrayList;
} catch (Throwable unused3) {
return load(MainDispatcherFactory.class, MainDispatcherFactory.class.getClassLoader());
}
}
public final List load(Class cls, ClassLoader classLoader) {
try {
return loadProviders$kotlinx_coroutines_core(cls, classLoader);
} catch (Throwable unused) {
return CollectionsKt___CollectionsKt.toList(ServiceLoader.load(cls, classLoader));
}
}
public final List loadProviders$kotlinx_coroutines_core(Class cls, ClassLoader classLoader) {
Set set;
ArrayList list = Collections.list(classLoader.getResources("META-INF/services/" + cls.getName()));
Intrinsics.checkNotNullExpressionValue(list, "list(this)");
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
CollectionsKt__MutableCollectionsKt.addAll(arrayList, INSTANCE.parse((URL) it.next()));
}
set = CollectionsKt___CollectionsKt.toSet(arrayList);
if (!(!set.isEmpty())) {
throw new IllegalArgumentException("No providers were loaded with FastServiceLoader".toString());
}
ArrayList arrayList2 = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(set, 10));
Iterator it2 = set.iterator();
while (it2.hasNext()) {
arrayList2.add(INSTANCE.getProviderInstance((String) it2.next(), classLoader, cls));
}
return arrayList2;
}
public final Object getProviderInstance(String str, ClassLoader classLoader, Class cls) {
Class<?> cls2 = Class.forName(str, false, classLoader);
if (!cls.isAssignableFrom(cls2)) {
throw new IllegalArgumentException(("Expected service of class " + cls + ", but found " + cls2).toString());
}
return cls.cast(cls2.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
}
public final List parse(URL url) {
BufferedReader bufferedReader;
String substringAfter$default;
String substringBefore$default;
String substringAfter$default2;
String url2 = url.toString();
if (StringsKt__StringsJVMKt.startsWith$default(url2, "jar", false, 2, null)) {
substringAfter$default = StringsKt__StringsKt.substringAfter$default(url2, "jar:file:", (String) null, 2, (Object) null);
substringBefore$default = StringsKt__StringsKt.substringBefore$default(substringAfter$default, '!', (String) null, 2, (Object) null);
substringAfter$default2 = StringsKt__StringsKt.substringAfter$default(url2, "!/", (String) null, 2, (Object) null);
JarFile jarFile = new JarFile(substringBefore$default, false);
try {
bufferedReader = new BufferedReader(new InputStreamReader(jarFile.getInputStream(new ZipEntry(substringAfter$default2)), "UTF-8"));
try {
List parseFile = INSTANCE.parseFile(bufferedReader);
CloseableKt.closeFinally(bufferedReader, null);
jarFile.close();
return parseFile;
} finally {
}
} catch (Throwable th) {
try {
throw th;
} catch (Throwable th2) {
try {
jarFile.close();
throw th2;
} catch (Throwable th3) {
ExceptionsKt__ExceptionsKt.addSuppressed(th, th3);
throw th;
}
}
}
} else {
bufferedReader = new BufferedReader(new InputStreamReader(FirebasePerfUrlConnection.openStream(url)));
try {
List parseFile2 = INSTANCE.parseFile(bufferedReader);
CloseableKt.closeFinally(bufferedReader, null);
return parseFile2;
} catch (Throwable th4) {
try {
throw th4;
} finally {
}
}
}
}
public final List parseFile(BufferedReader bufferedReader) {
String substringBefore$default;
CharSequence trim;
LinkedHashSet linkedHashSet = new LinkedHashSet();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
substringBefore$default = StringsKt__StringsKt.substringBefore$default(readLine, "#", (String) null, 2, (Object) null);
trim = StringsKt__StringsKt.trim(substringBefore$default);
String obj = trim.toString();
for (int i = 0; i < obj.length(); i++) {
char charAt = obj.charAt(i);
if (charAt != '.' && !Character.isJavaIdentifierPart(charAt)) {
throw new IllegalArgumentException(("Illegal service provider class name: " + obj).toString());
}
}
if (obj.length() > 0) {
linkedHashSet.add(obj);
}
} else {
return CollectionsKt___CollectionsKt.toList(linkedHashSet);
}
}
}
}

View File

@@ -0,0 +1,25 @@
package kotlinx.coroutines.internal;
import kotlin.Result;
import kotlin.ResultKt;
/* loaded from: classes5.dex */
public abstract class FastServiceLoaderKt {
public static final boolean ANDROID_DETECTED = false;
public static final boolean getANDROID_DETECTED() {
return ANDROID_DETECTED;
}
static {
Object m4060constructorimpl;
try {
Result.Companion companion = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(Class.forName("android.os.Build"));
} catch (Throwable th) {
Result.Companion companion2 = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(ResultKt.createFailure(th));
}
Result.m4065isSuccessimpl(m4060constructorimpl);
}
}

View File

@@ -0,0 +1,37 @@
package kotlinx.coroutines.internal;
import java.util.ArrayList;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class InlineList {
/* renamed from: constructor-impl, reason: not valid java name */
public static Object m4145constructorimpl(Object obj) {
return obj;
}
/* renamed from: constructor-impl$default, reason: not valid java name */
public static /* synthetic */ Object m4146constructorimpl$default(Object obj, int i, DefaultConstructorMarker defaultConstructorMarker) {
if ((i & 1) != 0) {
obj = null;
}
return m4145constructorimpl(obj);
}
/* renamed from: plus-FjFbRPM, reason: not valid java name */
public static final Object m4147plusFjFbRPM(Object obj, Object obj2) {
if (obj == null) {
return m4145constructorimpl(obj2);
}
if (obj instanceof ArrayList) {
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type java.util.ArrayList<E of kotlinx.coroutines.internal.InlineList>{ kotlin.collections.TypeAliasesKt.ArrayList<E of kotlinx.coroutines.internal.InlineList> }");
((ArrayList) obj).add(obj2);
return m4145constructorimpl(obj);
}
ArrayList arrayList = new ArrayList(4);
arrayList.add(obj);
arrayList.add(obj2);
return m4145constructorimpl(arrayList);
}
}

View File

@@ -0,0 +1,128 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
import kotlinx.coroutines.DefaultExecutorKt;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.DisposableHandle;
/* loaded from: classes5.dex */
public final class LimitedDispatcher extends CoroutineDispatcher implements Delay {
public static final AtomicIntegerFieldUpdater runningWorkers$FU = AtomicIntegerFieldUpdater.newUpdater(LimitedDispatcher.class, "runningWorkers");
public final /* synthetic */ Delay $$delegate_0;
public final CoroutineDispatcher dispatcher;
public final int parallelism;
public final LockFreeTaskQueue queue;
private volatile int runningWorkers;
public final Object workerAllocationLock;
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long j, Runnable runnable, CoroutineContext coroutineContext) {
return this.$$delegate_0.invokeOnTimeout(j, runnable, coroutineContext);
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo4149scheduleResumeAfterDelay(long j, CancellableContinuation cancellableContinuation) {
this.$$delegate_0.mo4149scheduleResumeAfterDelay(j, cancellableContinuation);
}
public final boolean tryAllocateWorker() {
synchronized (this.workerAllocationLock) {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = runningWorkers$FU;
if (atomicIntegerFieldUpdater.get(this) >= this.parallelism) {
return false;
}
atomicIntegerFieldUpdater.incrementAndGet(this);
return true;
}
}
/* JADX WARN: Multi-variable type inference failed */
public LimitedDispatcher(CoroutineDispatcher coroutineDispatcher, int i) {
this.dispatcher = coroutineDispatcher;
this.parallelism = i;
Delay delay = coroutineDispatcher instanceof Delay ? (Delay) coroutineDispatcher : null;
this.$$delegate_0 = delay == null ? DefaultExecutorKt.getDefaultDelay() : delay;
this.queue = new LockFreeTaskQueue(false);
this.workerAllocationLock = new Object();
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public CoroutineDispatcher limitedParallelism(int i) {
LimitedDispatcherKt.checkParallelism(i);
return i >= this.parallelism ? this : super.limitedParallelism(i);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo4148dispatch(CoroutineContext coroutineContext, Runnable runnable) {
Runnable obtainTaskOrDeallocateWorker;
this.queue.addLast(runnable);
if (runningWorkers$FU.get(this) >= this.parallelism || !tryAllocateWorker() || (obtainTaskOrDeallocateWorker = obtainTaskOrDeallocateWorker()) == null) {
return;
}
this.dispatcher.mo4148dispatch(this, new Worker(obtainTaskOrDeallocateWorker));
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public void dispatchYield(CoroutineContext coroutineContext, Runnable runnable) {
Runnable obtainTaskOrDeallocateWorker;
this.queue.addLast(runnable);
if (runningWorkers$FU.get(this) >= this.parallelism || !tryAllocateWorker() || (obtainTaskOrDeallocateWorker = obtainTaskOrDeallocateWorker()) == null) {
return;
}
this.dispatcher.dispatchYield(this, new Worker(obtainTaskOrDeallocateWorker));
}
public final Runnable obtainTaskOrDeallocateWorker() {
while (true) {
Runnable runnable = (Runnable) this.queue.removeFirstOrNull();
if (runnable != null) {
return runnable;
}
synchronized (this.workerAllocationLock) {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = runningWorkers$FU;
atomicIntegerFieldUpdater.decrementAndGet(this);
if (this.queue.getSize() == 0) {
return null;
}
atomicIntegerFieldUpdater.incrementAndGet(this);
}
}
}
public final class Worker implements Runnable {
public Runnable currentTask;
public Worker(Runnable runnable) {
this.currentTask = runnable;
}
@Override // java.lang.Runnable
public void run() {
int i = 0;
while (true) {
try {
this.currentTask.run();
} catch (Throwable th) {
CoroutineExceptionHandlerKt.handleCoroutineException(EmptyCoroutineContext.INSTANCE, th);
}
Runnable obtainTaskOrDeallocateWorker = LimitedDispatcher.this.obtainTaskOrDeallocateWorker();
if (obtainTaskOrDeallocateWorker == null) {
return;
}
this.currentTask = obtainTaskOrDeallocateWorker;
i++;
if (i >= 16 && LimitedDispatcher.this.dispatcher.isDispatchNeeded(LimitedDispatcher.this)) {
LimitedDispatcher.this.dispatcher.mo4148dispatch(LimitedDispatcher.this, this);
return;
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public abstract class LimitedDispatcherKt {
public static final void checkParallelism(int i) {
if (i >= 1) {
return;
}
throw new IllegalArgumentException(("Expected positive parallelism level, but got " + i).toString());
}
}

View File

@@ -0,0 +1,9 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public abstract class LockFreeLinkedListHead extends LockFreeLinkedListNode {
@Override // kotlinx.coroutines.internal.LockFreeLinkedListNode
public boolean isRemoved() {
return false;
}
}

View File

@@ -0,0 +1,22 @@
package kotlinx.coroutines.internal;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class LockFreeLinkedListKt {
public static final Object CONDITION_FALSE = new Symbol("CONDITION_FALSE");
public static final Object getCONDITION_FALSE() {
return CONDITION_FALSE;
}
public static final LockFreeLinkedListNode unwrap(Object obj) {
LockFreeLinkedListNode lockFreeLinkedListNode;
Removed removed = obj instanceof Removed ? (Removed) obj : null;
if (removed != null && (lockFreeLinkedListNode = removed.ref) != null) {
return lockFreeLinkedListNode;
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeLinkedListNode{ kotlinx.coroutines.internal.LockFreeLinkedListKt.Node }");
return (LockFreeLinkedListNode) obj;
}
}

View File

@@ -0,0 +1,223 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.PropertyReference0Impl;
import kotlinx.coroutines.DebugStringsKt;
/* loaded from: classes5.dex */
public class LockFreeLinkedListNode {
public static final AtomicReferenceFieldUpdater _next$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeLinkedListNode.class, Object.class, "_next");
public static final AtomicReferenceFieldUpdater _prev$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeLinkedListNode.class, Object.class, "_prev");
public static final AtomicReferenceFieldUpdater _removedRef$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeLinkedListNode.class, Object.class, "_removedRef");
private volatile Object _next = this;
private volatile Object _prev = this;
private volatile Object _removedRef;
public final Removed removed() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _removedRef$FU;
Removed removed = (Removed) atomicReferenceFieldUpdater.get(this);
if (removed != null) {
return removed;
}
Removed removed2 = new Removed(this);
atomicReferenceFieldUpdater.lazySet(this, removed2);
return removed2;
}
public static abstract class CondAddOp extends AtomicOp {
public final LockFreeLinkedListNode newNode;
public LockFreeLinkedListNode oldNext;
public CondAddOp(LockFreeLinkedListNode lockFreeLinkedListNode) {
this.newNode = lockFreeLinkedListNode;
}
@Override // kotlinx.coroutines.internal.AtomicOp
public void complete(LockFreeLinkedListNode lockFreeLinkedListNode, Object obj) {
boolean z = obj == null;
LockFreeLinkedListNode lockFreeLinkedListNode2 = z ? this.newNode : this.oldNext;
if (lockFreeLinkedListNode2 != null && AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(LockFreeLinkedListNode._next$FU, lockFreeLinkedListNode, this, lockFreeLinkedListNode2) && z) {
LockFreeLinkedListNode lockFreeLinkedListNode3 = this.newNode;
LockFreeLinkedListNode lockFreeLinkedListNode4 = this.oldNext;
Intrinsics.checkNotNull(lockFreeLinkedListNode4);
lockFreeLinkedListNode3.finishAdd(lockFreeLinkedListNode4);
}
}
}
public boolean isRemoved() {
return getNext() instanceof Removed;
}
public final Object getNext() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _next$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (!(obj instanceof OpDescriptor)) {
return obj;
}
((OpDescriptor) obj).perform(this);
}
}
public final LockFreeLinkedListNode getNextNode() {
return LockFreeLinkedListKt.unwrap(getNext());
}
public final LockFreeLinkedListNode getPrevNode() {
LockFreeLinkedListNode correctPrev = correctPrev(null);
return correctPrev == null ? findPrevNonRemoved((LockFreeLinkedListNode) _prev$FU.get(this)) : correctPrev;
}
public final LockFreeLinkedListNode findPrevNonRemoved(LockFreeLinkedListNode lockFreeLinkedListNode) {
while (lockFreeLinkedListNode.isRemoved()) {
lockFreeLinkedListNode = (LockFreeLinkedListNode) _prev$FU.get(lockFreeLinkedListNode);
}
return lockFreeLinkedListNode;
}
public final boolean addOneIfEmpty(LockFreeLinkedListNode lockFreeLinkedListNode) {
_prev$FU.lazySet(lockFreeLinkedListNode, this);
_next$FU.lazySet(lockFreeLinkedListNode, this);
while (getNext() == this) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, this, lockFreeLinkedListNode)) {
lockFreeLinkedListNode.finishAdd(this);
return true;
}
}
return false;
}
public final int tryCondAddNext(LockFreeLinkedListNode lockFreeLinkedListNode, LockFreeLinkedListNode lockFreeLinkedListNode2, CondAddOp condAddOp) {
_prev$FU.lazySet(lockFreeLinkedListNode, this);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _next$FU;
atomicReferenceFieldUpdater.lazySet(lockFreeLinkedListNode, lockFreeLinkedListNode2);
condAddOp.oldNext = lockFreeLinkedListNode2;
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, lockFreeLinkedListNode2, condAddOp)) {
return condAddOp.perform(this) == null ? 1 : 2;
}
return 0;
}
public boolean remove() {
return removeOrNext() == null;
}
public final LockFreeLinkedListNode removeOrNext() {
Object next;
LockFreeLinkedListNode lockFreeLinkedListNode;
do {
next = getNext();
if (next instanceof Removed) {
return ((Removed) next).ref;
}
if (next == this) {
return (LockFreeLinkedListNode) next;
}
Intrinsics.checkNotNull(next, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeLinkedListNode{ kotlinx.coroutines.internal.LockFreeLinkedListKt.Node }");
lockFreeLinkedListNode = (LockFreeLinkedListNode) next;
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, next, lockFreeLinkedListNode.removed()));
lockFreeLinkedListNode.correctPrev(null);
return null;
}
public final void finishAdd(LockFreeLinkedListNode lockFreeLinkedListNode) {
LockFreeLinkedListNode lockFreeLinkedListNode2;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _prev$FU;
do {
lockFreeLinkedListNode2 = (LockFreeLinkedListNode) atomicReferenceFieldUpdater.get(lockFreeLinkedListNode);
if (getNext() != lockFreeLinkedListNode) {
return;
}
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_prev$FU, lockFreeLinkedListNode, lockFreeLinkedListNode2, this));
if (isRemoved()) {
lockFreeLinkedListNode.correctPrev(null);
}
}
/* JADX WARN: Code restructure failed: missing block: B:22:0x0042, code lost:
if (androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(r4, r3, r2, ((kotlinx.coroutines.internal.Removed) r5).ref) != false) goto L26;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final kotlinx.coroutines.internal.LockFreeLinkedListNode correctPrev(kotlinx.coroutines.internal.OpDescriptor r9) {
/*
r8 = this;
L0:
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r0 = kotlinx.coroutines.internal.LockFreeLinkedListNode._prev$FU
java.lang.Object r0 = r0.get(r8)
kotlinx.coroutines.internal.LockFreeLinkedListNode r0 = (kotlinx.coroutines.internal.LockFreeLinkedListNode) r0
r1 = 0
r2 = r0
La:
r3 = r1
Lb:
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r4 = kotlinx.coroutines.internal.LockFreeLinkedListNode._next$FU
java.lang.Object r5 = r4.get(r2)
if (r5 != r8) goto L20
if (r0 != r2) goto L16
return r2
L16:
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r1 = kotlinx.coroutines.internal.LockFreeLinkedListNode._prev$FU
boolean r0 = androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(r1, r8, r0, r2)
if (r0 != 0) goto L1f
goto L0
L1f:
return r2
L20:
boolean r6 = r8.isRemoved()
if (r6 == 0) goto L27
return r1
L27:
if (r5 != r9) goto L2a
return r2
L2a:
boolean r6 = r5 instanceof kotlinx.coroutines.internal.OpDescriptor
if (r6 == 0) goto L34
kotlinx.coroutines.internal.OpDescriptor r5 = (kotlinx.coroutines.internal.OpDescriptor) r5
r5.perform(r2)
goto L0
L34:
boolean r6 = r5 instanceof kotlinx.coroutines.internal.Removed
if (r6 == 0) goto L50
if (r3 == 0) goto L47
kotlinx.coroutines.internal.Removed r5 = (kotlinx.coroutines.internal.Removed) r5
kotlinx.coroutines.internal.LockFreeLinkedListNode r5 = r5.ref
boolean r2 = androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(r4, r3, r2, r5)
if (r2 != 0) goto L45
goto L0
L45:
r2 = r3
goto La
L47:
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r4 = kotlinx.coroutines.internal.LockFreeLinkedListNode._prev$FU
java.lang.Object r2 = r4.get(r2)
kotlinx.coroutines.internal.LockFreeLinkedListNode r2 = (kotlinx.coroutines.internal.LockFreeLinkedListNode) r2
goto Lb
L50:
java.lang.String r3 = "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeLinkedListNode{ kotlinx.coroutines.internal.LockFreeLinkedListKt.Node }"
kotlin.jvm.internal.Intrinsics.checkNotNull(r5, r3)
r3 = r5
kotlinx.coroutines.internal.LockFreeLinkedListNode r3 = (kotlinx.coroutines.internal.LockFreeLinkedListNode) r3
r7 = r3
r3 = r2
r2 = r7
goto Lb
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.internal.LockFreeLinkedListNode.correctPrev(kotlinx.coroutines.internal.OpDescriptor):kotlinx.coroutines.internal.LockFreeLinkedListNode");
}
public String toString() {
return new PropertyReference0Impl(this) { // from class: kotlinx.coroutines.internal.LockFreeLinkedListNode$toString$1
@Override // kotlin.jvm.internal.PropertyReference0Impl, kotlin.jvm.internal.PropertyReference0
public Object get() {
return DebugStringsKt.getClassSimpleName(this.receiver);
}
} + '@' + DebugStringsKt.getHexAddress(this);
}
}

View File

@@ -0,0 +1,58 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
/* loaded from: classes5.dex */
public class LockFreeTaskQueue {
public static final AtomicReferenceFieldUpdater _cur$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeTaskQueue.class, Object.class, "_cur");
private volatile Object _cur;
public LockFreeTaskQueue(boolean z) {
this._cur = new LockFreeTaskQueueCore(8, z);
}
public final int getSize() {
return ((LockFreeTaskQueueCore) _cur$FU.get(this)).getSize();
}
public final void close() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _cur$FU;
while (true) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
if (lockFreeTaskQueueCore.close()) {
return;
} else {
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_cur$FU, this, lockFreeTaskQueueCore, lockFreeTaskQueueCore.next());
}
}
}
public final boolean addLast(Object obj) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _cur$FU;
while (true) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
int addLast = lockFreeTaskQueueCore.addLast(obj);
if (addLast == 0) {
return true;
}
if (addLast == 1) {
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_cur$FU, this, lockFreeTaskQueueCore, lockFreeTaskQueueCore.next());
} else if (addLast == 2) {
return false;
}
}
}
public final Object removeFirstOrNull() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _cur$FU;
while (true) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
Object removeFirstOrNull = lockFreeTaskQueueCore.removeFirstOrNull();
if (removeFirstOrNull != LockFreeTaskQueueCore.REMOVE_FROZEN) {
return removeFirstOrNull;
}
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_cur$FU, this, lockFreeTaskQueueCore, lockFreeTaskQueueCore.next());
}
}
}

View File

@@ -0,0 +1,289 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* loaded from: classes5.dex */
public final class LockFreeTaskQueueCore {
private volatile Object _next;
private volatile long _state;
public final AtomicReferenceArray array;
public final int capacity;
public final int mask;
public final boolean singleConsumer;
public static final Companion Companion = new Companion(null);
public static final AtomicReferenceFieldUpdater _next$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeTaskQueueCore.class, Object.class, "_next");
public static final AtomicLongFieldUpdater _state$FU = AtomicLongFieldUpdater.newUpdater(LockFreeTaskQueueCore.class, "_state");
public static final Symbol REMOVE_FROZEN = new Symbol("REMOVE_FROZEN");
public LockFreeTaskQueueCore(int i, boolean z) {
this.capacity = i;
this.singleConsumer = z;
int i2 = i - 1;
this.mask = i2;
this.array = new AtomicReferenceArray(i);
if (i2 > 1073741823) {
throw new IllegalStateException("Check failed.".toString());
}
if ((i & i2) != 0) {
throw new IllegalStateException("Check failed.".toString());
}
}
public final boolean isEmpty() {
long j = _state$FU.get(this);
return ((int) (1073741823 & j)) == ((int) ((j & 1152921503533105152L) >> 30));
}
public final int getSize() {
long j = _state$FU.get(this);
return (((int) ((j & 1152921503533105152L) >> 30)) - ((int) (1073741823 & j))) & 1073741823;
}
public final boolean close() {
long j;
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
do {
j = atomicLongFieldUpdater.get(this);
if ((j & 2305843009213693952L) != 0) {
return true;
}
if ((1152921504606846976L & j) != 0) {
return false;
}
} while (!atomicLongFieldUpdater.compareAndSet(this, j, j | 2305843009213693952L));
return true;
}
/* JADX WARN: Code restructure failed: missing block: B:33:0x004e, code lost:
return 1;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final int addLast(java.lang.Object r13) {
/*
r12 = this;
java.util.concurrent.atomic.AtomicLongFieldUpdater r0 = kotlinx.coroutines.internal.LockFreeTaskQueueCore._state$FU
L2:
long r3 = r0.get(r12)
r1 = 3458764513820540928(0x3000000000000000, double:1.727233711018889E-77)
long r1 = r1 & r3
r7 = 0
int r1 = (r1 > r7 ? 1 : (r1 == r7 ? 0 : -1))
if (r1 == 0) goto L16
kotlinx.coroutines.internal.LockFreeTaskQueueCore$Companion r13 = kotlinx.coroutines.internal.LockFreeTaskQueueCore.Companion
int r13 = r13.addFailReason(r3)
return r13
L16:
r1 = 1073741823(0x3fffffff, double:5.304989472E-315)
long r1 = r1 & r3
int r1 = (int) r1
r5 = 1152921503533105152(0xfffffffc0000000, double:1.2882296003504729E-231)
long r5 = r5 & r3
r2 = 30
long r5 = r5 >> r2
int r9 = (int) r5
int r10 = r12.mask
int r2 = r9 + 2
r2 = r2 & r10
r5 = r1 & r10
r6 = 1
if (r2 != r5) goto L30
return r6
L30:
boolean r2 = r12.singleConsumer
r5 = 1073741823(0x3fffffff, float:1.9999999)
if (r2 != 0) goto L4f
java.util.concurrent.atomic.AtomicReferenceArray r2 = r12.array
r11 = r9 & r10
java.lang.Object r2 = r2.get(r11)
if (r2 == 0) goto L4f
int r2 = r12.capacity
r3 = 1024(0x400, float:1.435E-42)
if (r2 < r3) goto L4e
int r9 = r9 - r1
r1 = r9 & r5
int r2 = r2 >> 1
if (r1 <= r2) goto L2
L4e:
return r6
L4f:
int r1 = r9 + 1
r1 = r1 & r5
java.util.concurrent.atomic.AtomicLongFieldUpdater r2 = kotlinx.coroutines.internal.LockFreeTaskQueueCore._state$FU
kotlinx.coroutines.internal.LockFreeTaskQueueCore$Companion r5 = kotlinx.coroutines.internal.LockFreeTaskQueueCore.Companion
long r5 = r5.updateTail(r3, r1)
r1 = r2
r2 = r12
boolean r1 = r1.compareAndSet(r2, r3, r5)
if (r1 == 0) goto L2
java.util.concurrent.atomic.AtomicReferenceArray r0 = r12.array
r1 = r9 & r10
r0.set(r1, r13)
r0 = r12
L6a:
java.util.concurrent.atomic.AtomicLongFieldUpdater r1 = kotlinx.coroutines.internal.LockFreeTaskQueueCore._state$FU
long r1 = r1.get(r0)
r3 = 1152921504606846976(0x1000000000000000, double:1.2882297539194267E-231)
long r1 = r1 & r3
int r1 = (r1 > r7 ? 1 : (r1 == r7 ? 0 : -1))
if (r1 == 0) goto L81
kotlinx.coroutines.internal.LockFreeTaskQueueCore r0 = r0.next()
kotlinx.coroutines.internal.LockFreeTaskQueueCore r0 = r0.fillPlaceholder(r9, r13)
if (r0 != 0) goto L6a
L81:
r13 = 0
return r13
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.internal.LockFreeTaskQueueCore.addLast(java.lang.Object):int");
}
public final LockFreeTaskQueueCore fillPlaceholder(int i, Object obj) {
Object obj2 = this.array.get(this.mask & i);
if (!(obj2 instanceof Placeholder) || ((Placeholder) obj2).index != i) {
return null;
}
this.array.set(i & this.mask, obj);
return this;
}
public final Object removeFirstOrNull() {
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
while (true) {
long j = atomicLongFieldUpdater.get(this);
if ((1152921504606846976L & j) != 0) {
return REMOVE_FROZEN;
}
int i = (int) (1073741823 & j);
int i2 = this.mask;
if ((((int) ((1152921503533105152L & j) >> 30)) & i2) == (i & i2)) {
return null;
}
Object obj = this.array.get(i2 & i);
if (obj == null) {
if (this.singleConsumer) {
return null;
}
} else {
if (obj instanceof Placeholder) {
return null;
}
int i3 = (i + 1) & 1073741823;
if (_state$FU.compareAndSet(this, j, Companion.updateHead(j, i3))) {
this.array.set(this.mask & i, null);
return obj;
}
if (this.singleConsumer) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = this;
do {
lockFreeTaskQueueCore = lockFreeTaskQueueCore.removeSlowPath(i, i3);
} while (lockFreeTaskQueueCore != null);
return obj;
}
}
}
}
public final LockFreeTaskQueueCore removeSlowPath(int i, int i2) {
long j;
int i3;
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
do {
j = atomicLongFieldUpdater.get(this);
i3 = (int) (1073741823 & j);
if ((1152921504606846976L & j) != 0) {
return next();
}
} while (!_state$FU.compareAndSet(this, j, Companion.updateHead(j, i2)));
this.array.set(this.mask & i3, null);
return null;
}
public final LockFreeTaskQueueCore next() {
return allocateOrGetNextCopy(markFrozen());
}
public final long markFrozen() {
long j;
long j2;
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
do {
j = atomicLongFieldUpdater.get(this);
if ((j & 1152921504606846976L) != 0) {
return j;
}
j2 = j | 1152921504606846976L;
} while (!atomicLongFieldUpdater.compareAndSet(this, j, j2));
return j2;
}
public final LockFreeTaskQueueCore allocateOrGetNextCopy(long j) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _next$FU;
while (true) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
if (lockFreeTaskQueueCore != null) {
return lockFreeTaskQueueCore;
}
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, null, allocateNextCopy(j));
}
}
public final LockFreeTaskQueueCore allocateNextCopy(long j) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = new LockFreeTaskQueueCore(this.capacity * 2, this.singleConsumer);
int i = (int) (1073741823 & j);
int i2 = (int) ((1152921503533105152L & j) >> 30);
while (true) {
int i3 = this.mask;
if ((i & i3) != (i2 & i3)) {
Object obj = this.array.get(i3 & i);
if (obj == null) {
obj = new Placeholder(i);
}
lockFreeTaskQueueCore.array.set(lockFreeTaskQueueCore.mask & i, obj);
i++;
} else {
_state$FU.set(lockFreeTaskQueueCore, Companion.wo(j, 1152921504606846976L));
return lockFreeTaskQueueCore;
}
}
}
public static final class Placeholder {
public final int index;
public Placeholder(int i) {
this.index = i;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final int addFailReason(long j) {
return (j & 2305843009213693952L) != 0 ? 2 : 1;
}
public final long wo(long j, long j2) {
return j & (~j2);
}
public Companion() {
}
public final long updateHead(long j, int i) {
return wo(j, 1073741823L) | i;
}
public final long updateTail(long j, int i) {
return wo(j, 1152921503533105152L) | (i << 30);
}
}
}

View File

@@ -0,0 +1,13 @@
package kotlinx.coroutines.internal;
import java.util.List;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* loaded from: classes5.dex */
public interface MainDispatcherFactory {
MainCoroutineDispatcher createDispatcher(List list);
int getLoadPriority();
String hintOnError();
}

View File

@@ -0,0 +1,59 @@
package kotlinx.coroutines.internal;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
import kotlin.sequences.Sequence;
import kotlin.sequences.SequencesKt__SequencesKt;
import kotlin.sequences.SequencesKt___SequencesKt;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* loaded from: classes5.dex */
public final class MainDispatcherLoader {
public static final boolean FAST_SERVICE_LOADER_ENABLED = false;
public static final MainDispatcherLoader INSTANCE;
public static final MainCoroutineDispatcher dispatcher;
static {
MainDispatcherLoader mainDispatcherLoader = new MainDispatcherLoader();
INSTANCE = mainDispatcherLoader;
SystemPropsKt.systemProp("kotlinx.coroutines.fast.service.loader", true);
dispatcher = mainDispatcherLoader.loadMainDispatcher();
}
public final MainCoroutineDispatcher loadMainDispatcher() {
Sequence asSequence;
List list;
Object next;
MainCoroutineDispatcher tryCreateDispatcher;
try {
if (FAST_SERVICE_LOADER_ENABLED) {
list = FastServiceLoader.INSTANCE.loadMainDispatcherFactory$kotlinx_coroutines_core();
} else {
asSequence = SequencesKt__SequencesKt.asSequence(ServiceLoader.load(MainDispatcherFactory.class, MainDispatcherFactory.class.getClassLoader()).iterator());
list = SequencesKt___SequencesKt.toList(asSequence);
}
Iterator it = list.iterator();
if (it.hasNext()) {
next = it.next();
if (it.hasNext()) {
int loadPriority = ((MainDispatcherFactory) next).getLoadPriority();
do {
Object next2 = it.next();
int loadPriority2 = ((MainDispatcherFactory) next2).getLoadPriority();
if (loadPriority < loadPriority2) {
next = next2;
loadPriority = loadPriority2;
}
} while (it.hasNext());
}
} else {
next = null;
}
MainDispatcherFactory mainDispatcherFactory = (MainDispatcherFactory) next;
return (mainDispatcherFactory == null || (tryCreateDispatcher = MainDispatchersKt.tryCreateDispatcher(mainDispatcherFactory, list)) == null) ? MainDispatchersKt.createMissingDispatcher$default(null, null, 3, null) : tryCreateDispatcher;
} catch (Throwable th) {
return MainDispatchersKt.createMissingDispatcher$default(th, null, 2, null);
}
}
}

View File

@@ -0,0 +1,47 @@
package kotlinx.coroutines.internal;
import java.util.List;
import kotlin.KotlinNothingValueException;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* loaded from: classes5.dex */
public abstract class MainDispatchersKt {
public static final boolean SUPPORT_MISSING = false;
public static final MainCoroutineDispatcher tryCreateDispatcher(MainDispatcherFactory mainDispatcherFactory, List list) {
try {
return mainDispatcherFactory.createDispatcher(list);
} catch (Throwable th) {
return createMissingDispatcher(th, mainDispatcherFactory.hintOnError());
}
}
public static final boolean isMissing(MainCoroutineDispatcher mainCoroutineDispatcher) {
return mainCoroutineDispatcher.getImmediate() instanceof MissingMainCoroutineDispatcher;
}
public static /* synthetic */ MissingMainCoroutineDispatcher createMissingDispatcher$default(Throwable th, String str, int i, Object obj) {
if ((i & 1) != 0) {
th = null;
}
if ((i & 2) != 0) {
str = null;
}
return createMissingDispatcher(th, str);
}
public static final MissingMainCoroutineDispatcher createMissingDispatcher(Throwable th, String str) {
if (SUPPORT_MISSING) {
return new MissingMainCoroutineDispatcher(th, str);
}
if (th != null) {
throw th;
}
throwMissingMainDispatcherException();
throw new KotlinNothingValueException();
}
public static final Void throwMissingMainDispatcherException() {
throw new IllegalStateException("Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'");
}
}

View File

@@ -0,0 +1,116 @@
package kotlinx.coroutines.internal;
import kotlin.KotlinNothingValueException;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* loaded from: classes5.dex */
public final class MissingMainCoroutineDispatcher extends MainCoroutineDispatcher implements Delay {
public final Throwable cause;
public final String errorHint;
@Override // kotlinx.coroutines.MainCoroutineDispatcher
public MainCoroutineDispatcher getImmediate() {
return this;
}
public MissingMainCoroutineDispatcher(Throwable th, String str) {
this.cause = th;
this.errorHint = str;
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public boolean isDispatchNeeded(CoroutineContext coroutineContext) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.MainCoroutineDispatcher, kotlinx.coroutines.CoroutineDispatcher
public CoroutineDispatcher limitedParallelism(int i) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long j, Runnable runnable, CoroutineContext coroutineContext) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch, reason: merged with bridge method [inline-methods] */
public Void mo4148dispatch(CoroutineContext coroutineContext, Runnable runnable) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay, reason: merged with bridge method [inline-methods] */
public Void mo4149scheduleResumeAfterDelay(long j, CancellableContinuation cancellableContinuation) {
missing();
throw new KotlinNothingValueException();
}
/* JADX WARN: Code restructure failed: missing block: B:6:0x0023, code lost:
if (r1 == null) goto L8;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Void missing() {
/*
r4 = this;
java.lang.Throwable r0 = r4.cause
if (r0 == 0) goto L36
java.lang.StringBuilder r0 = new java.lang.StringBuilder
r0.<init>()
java.lang.String r1 = "Module with the Main dispatcher had failed to initialize"
r0.append(r1)
java.lang.String r1 = r4.errorHint
if (r1 == 0) goto L25
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>()
java.lang.String r3 = ". "
r2.append(r3)
r2.append(r1)
java.lang.String r1 = r2.toString()
if (r1 != 0) goto L27
L25:
java.lang.String r1 = ""
L27:
r0.append(r1)
java.lang.String r0 = r0.toString()
java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
java.lang.Throwable r2 = r4.cause
r1.<init>(r0, r2)
throw r1
L36:
kotlinx.coroutines.internal.MainDispatchersKt.throwMissingMainDispatcherException()
kotlin.KotlinNothingValueException r0 = new kotlin.KotlinNothingValueException
r0.<init>()
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.missing():java.lang.Void");
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public String toString() {
String str;
StringBuilder sb = new StringBuilder();
sb.append("Dispatchers.Main[missing");
if (this.cause != null) {
str = ", cause=" + this.cause;
} else {
str = "";
}
sb.append(str);
sb.append(']');
return sb.toString();
}
}

View File

@@ -0,0 +1,55 @@
package kotlinx.coroutines.internal;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
/* loaded from: classes5.dex */
public abstract class OnUndeliveredElementKt {
public static /* synthetic */ UndeliveredElementException callUndeliveredElementCatchingException$default(Function1 function1, Object obj, UndeliveredElementException undeliveredElementException, int i, Object obj2) {
if ((i & 2) != 0) {
undeliveredElementException = null;
}
return callUndeliveredElementCatchingException(function1, obj, undeliveredElementException);
}
public static final UndeliveredElementException callUndeliveredElementCatchingException(Function1 function1, Object obj, UndeliveredElementException undeliveredElementException) {
try {
function1.invoke(obj);
} catch (Throwable th) {
if (undeliveredElementException == null || undeliveredElementException.getCause() == th) {
return new UndeliveredElementException("Exception in undelivered element handler for " + obj, th);
}
ExceptionsKt__ExceptionsKt.addSuppressed(undeliveredElementException, th);
}
return undeliveredElementException;
}
public static final void callUndeliveredElement(Function1 function1, Object obj, CoroutineContext coroutineContext) {
UndeliveredElementException callUndeliveredElementCatchingException = callUndeliveredElementCatchingException(function1, obj, null);
if (callUndeliveredElementCatchingException != null) {
CoroutineExceptionHandlerKt.handleCoroutineException(coroutineContext, callUndeliveredElementCatchingException);
}
}
public static final Function1 bindCancellationFun(final Function1 function1, final Object obj, final CoroutineContext coroutineContext) {
return new Function1() { // from class: kotlinx.coroutines.internal.OnUndeliveredElementKt$bindCancellationFun$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
invoke((Throwable) obj2);
return Unit.INSTANCE;
}
public final void invoke(Throwable th) {
OnUndeliveredElementKt.callUndeliveredElement(Function1.this, obj, coroutineContext);
}
};
}
}

View File

@@ -0,0 +1,12 @@
package kotlinx.coroutines.internal;
import kotlinx.coroutines.DebugStringsKt;
/* loaded from: classes5.dex */
public abstract class OpDescriptor {
public abstract Object perform(Object obj);
public String toString() {
return DebugStringsKt.getClassSimpleName(this) + '@' + DebugStringsKt.getHexAddress(this);
}
}

View File

@@ -0,0 +1,14 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public final class Removed {
public final LockFreeLinkedListNode ref;
public Removed(LockFreeLinkedListNode lockFreeLinkedListNode) {
this.ref = lockFreeLinkedListNode;
}
public String toString() {
return "Removed[" + this.ref + ']';
}
}

View File

@@ -0,0 +1,42 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.atomic.AtomicReferenceArray;
import kotlin.ranges.RangesKt___RangesKt;
/* loaded from: classes5.dex */
public final class ResizableAtomicArray {
private volatile AtomicReferenceArray<Object> array;
public ResizableAtomicArray(int i) {
this.array = new AtomicReferenceArray<>(i);
}
public final int currentLength() {
return this.array.length();
}
public final Object get(int i) {
AtomicReferenceArray<Object> atomicReferenceArray = this.array;
if (i < atomicReferenceArray.length()) {
return atomicReferenceArray.get(i);
}
return null;
}
public final void setSynchronized(int i, Object obj) {
int coerceAtLeast;
AtomicReferenceArray<Object> atomicReferenceArray = this.array;
int length = atomicReferenceArray.length();
if (i < length) {
atomicReferenceArray.set(i, obj);
return;
}
coerceAtLeast = RangesKt___RangesKt.coerceAtLeast(i + 1, length * 2);
AtomicReferenceArray<Object> atomicReferenceArray2 = new AtomicReferenceArray<>(coerceAtLeast);
for (int i2 = 0; i2 < length; i2++) {
atomicReferenceArray2.set(i2, atomicReferenceArray.get(i2));
}
atomicReferenceArray2.set(i, obj);
this.array = atomicReferenceArray2;
}
}

View File

@@ -0,0 +1,45 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlinx.coroutines.AbstractCoroutine;
import kotlinx.coroutines.CompletionStateKt;
/* loaded from: classes5.dex */
public class ScopeCoroutine extends AbstractCoroutine implements CoroutineStackFrame {
public final Continuation uCont;
@Override // kotlinx.coroutines.JobSupport
public final boolean isScopedCoroutine() {
return true;
}
public ScopeCoroutine(CoroutineContext coroutineContext, Continuation continuation) {
super(coroutineContext, true, true);
this.uCont = continuation;
}
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
public final CoroutineStackFrame getCallerFrame() {
Continuation continuation = this.uCont;
if (continuation instanceof CoroutineStackFrame) {
return (CoroutineStackFrame) continuation;
}
return null;
}
@Override // kotlinx.coroutines.JobSupport
public void afterCompletion(Object obj) {
Continuation intercepted;
intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(this.uCont);
DispatchedContinuationKt.resumeCancellableWith$default(intercepted, CompletionStateKt.recoverResult(obj, this.uCont), null, 2, null);
}
@Override // kotlinx.coroutines.AbstractCoroutine
public void afterResume(Object obj) {
Continuation continuation = this.uCont;
continuation.resumeWith(CompletionStateKt.recoverResult(obj, continuation));
}
}

View File

@@ -0,0 +1,50 @@
package kotlinx.coroutines.internal;
import androidx.core.internal.view.SupportMenu;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.NotCompleted;
/* loaded from: classes5.dex */
public abstract class Segment extends ConcurrentLinkedListNode implements NotCompleted {
public static final AtomicIntegerFieldUpdater cleanedAndPointers$FU = AtomicIntegerFieldUpdater.newUpdater(Segment.class, "cleanedAndPointers");
private volatile int cleanedAndPointers;
public final long id;
public abstract int getNumberOfSlots();
public abstract void onCancellation(int i, Throwable th, CoroutineContext coroutineContext);
public Segment(long j, Segment segment, int i) {
super(segment);
this.id = j;
this.cleanedAndPointers = i << 16;
}
@Override // kotlinx.coroutines.internal.ConcurrentLinkedListNode
public boolean isRemoved() {
return cleanedAndPointers$FU.get(this) == getNumberOfSlots() && !isTail();
}
public final boolean decPointers$kotlinx_coroutines_core() {
return cleanedAndPointers$FU.addAndGet(this, SupportMenu.CATEGORY_MASK) == getNumberOfSlots() && !isTail();
}
public final void onSlotCleaned() {
if (cleanedAndPointers$FU.incrementAndGet(this) == getNumberOfSlots()) {
remove();
}
}
public final boolean tryIncPointers$kotlinx_coroutines_core() {
int i;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = cleanedAndPointers$FU;
do {
i = atomicIntegerFieldUpdater.get(this);
if (i == getNumberOfSlots() && !isTail()) {
return false;
}
} while (!atomicIntegerFieldUpdater.compareAndSet(this, i, 65536 + i));
return true;
}
}

View File

@@ -0,0 +1,25 @@
package kotlinx.coroutines.internal;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class SegmentOrClosed {
/* renamed from: constructor-impl, reason: not valid java name */
public static Object m4150constructorimpl(Object obj) {
return obj;
}
/* renamed from: isClosed-impl, reason: not valid java name */
public static final boolean m4152isClosedimpl(Object obj) {
return obj == ConcurrentLinkedListKt.CLOSED;
}
/* renamed from: getSegment-impl, reason: not valid java name */
public static final Segment m4151getSegmentimpl(Object obj) {
if (obj == ConcurrentLinkedListKt.CLOSED) {
throw new IllegalStateException("Does not contain segment".toString());
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type S of kotlinx.coroutines.internal.SegmentOrClosed");
return (Segment) obj;
}
}

View File

@@ -0,0 +1,43 @@
package kotlinx.coroutines.internal;
import _COROUTINE.ArtificialStackFrames;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.coroutines.jvm.internal.BaseContinuationImpl;
/* loaded from: classes5.dex */
public abstract class StackTraceRecoveryKt {
public static final StackTraceElement ARTIFICIAL_FRAME = new ArtificialStackFrames().coroutineBoundary();
public static final String baseContinuationImplClassName;
public static final String stackTraceRecoveryClassName;
public static final Throwable recoverStackTrace(Throwable th) {
return th;
}
static {
Object m4060constructorimpl;
Object m4060constructorimpl2;
try {
Result.Companion companion = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(BaseContinuationImpl.class.getCanonicalName());
} catch (Throwable th) {
Result.Companion companion2 = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(ResultKt.createFailure(th));
}
if (Result.m4062exceptionOrNullimpl(m4060constructorimpl) != null) {
m4060constructorimpl = "kotlin.coroutines.jvm.internal.BaseContinuationImpl";
}
baseContinuationImplClassName = (String) m4060constructorimpl;
try {
m4060constructorimpl2 = Result.m4060constructorimpl(StackTraceRecoveryKt.class.getCanonicalName());
} catch (Throwable th2) {
Result.Companion companion3 = Result.Companion;
m4060constructorimpl2 = Result.m4060constructorimpl(ResultKt.createFailure(th2));
}
if (Result.m4062exceptionOrNullimpl(m4060constructorimpl2) != null) {
m4060constructorimpl2 = "kotlinx.coroutines.internal.StackTraceRecoveryKt";
}
stackTraceRecoveryClassName = (String) m4060constructorimpl2;
}
}

View File

@@ -0,0 +1,14 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public final class Symbol {
public final String symbol;
public Symbol(String str) {
this.symbol = str;
}
public String toString() {
return '<' + this.symbol + '>';
}
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public abstract class SystemPropsKt {
public static final int getAVAILABLE_PROCESSORS() {
return SystemPropsKt__SystemPropsKt.getAVAILABLE_PROCESSORS();
}
public static final int systemProp(String str, int i, int i2, int i3) {
return SystemPropsKt__SystemProps_commonKt.systemProp(str, i, i2, i3);
}
public static final long systemProp(String str, long j, long j2, long j3) {
return SystemPropsKt__SystemProps_commonKt.systemProp(str, j, j2, j3);
}
public static final String systemProp(String str) {
return SystemPropsKt__SystemPropsKt.systemProp(str);
}
public static final String systemProp(String str, String str2) {
return SystemPropsKt__SystemProps_commonKt.systemProp(str, str2);
}
public static final boolean systemProp(String str, boolean z) {
return SystemPropsKt__SystemProps_commonKt.systemProp(str, z);
}
}

View File

@@ -0,0 +1,18 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public abstract /* synthetic */ class SystemPropsKt__SystemPropsKt {
public static final int AVAILABLE_PROCESSORS = Runtime.getRuntime().availableProcessors();
public static final int getAVAILABLE_PROCESSORS() {
return AVAILABLE_PROCESSORS;
}
public static final String systemProp(String str) {
try {
return System.getProperty(str);
} catch (SecurityException unused) {
return null;
}
}
}

View File

@@ -0,0 +1,58 @@
package kotlinx.coroutines.internal;
import kotlin.text.StringsKt__StringNumberConversionsKt;
/* loaded from: classes5.dex */
public abstract /* synthetic */ class SystemPropsKt__SystemProps_commonKt {
public static final boolean systemProp(String str, boolean z) {
String systemProp = SystemPropsKt.systemProp(str);
return systemProp != null ? Boolean.parseBoolean(systemProp) : z;
}
public static /* synthetic */ int systemProp$default(String str, int i, int i2, int i3, int i4, Object obj) {
if ((i4 & 4) != 0) {
i2 = 1;
}
if ((i4 & 8) != 0) {
i3 = Integer.MAX_VALUE;
}
return SystemPropsKt.systemProp(str, i, i2, i3);
}
public static final int systemProp(String str, int i, int i2, int i3) {
return (int) SystemPropsKt.systemProp(str, i, i2, i3);
}
public static /* synthetic */ long systemProp$default(String str, long j, long j2, long j3, int i, Object obj) {
if ((i & 4) != 0) {
j2 = 1;
}
long j4 = j2;
if ((i & 8) != 0) {
j3 = Long.MAX_VALUE;
}
return SystemPropsKt.systemProp(str, j, j4, j3);
}
public static final long systemProp(String str, long j, long j2, long j3) {
Long longOrNull;
String systemProp = SystemPropsKt.systemProp(str);
if (systemProp == null) {
return j;
}
longOrNull = StringsKt__StringNumberConversionsKt.toLongOrNull(systemProp);
if (longOrNull == null) {
throw new IllegalStateException(("System property '" + str + "' has unrecognized value '" + systemProp + '\'').toString());
}
long longValue = longOrNull.longValue();
if (j2 <= longValue && longValue <= j3) {
return longValue;
}
throw new IllegalStateException(("System property '" + str + "' should be in range " + j2 + ".." + j3 + ", but is '" + longValue + '\'').toString());
}
public static final String systemProp(String str, String str2) {
String systemProp = SystemPropsKt.systemProp(str);
return systemProp == null ? str2 : systemProp;
}
}

View File

@@ -0,0 +1,77 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* loaded from: classes5.dex */
public abstract class ThreadContextKt {
public static final Symbol NO_THREAD_ELEMENTS = new Symbol("NO_THREAD_ELEMENTS");
public static final Function2 countAll = new Function2() { // from class: kotlinx.coroutines.internal.ThreadContextKt$countAll$1
@Override // kotlin.jvm.functions.Function2
public final Object invoke(Object obj, CoroutineContext.Element element) {
if (!(element instanceof ThreadContextElement)) {
return obj;
}
Integer num = obj instanceof Integer ? (Integer) obj : null;
int intValue = num != null ? num.intValue() : 1;
return intValue == 0 ? element : Integer.valueOf(intValue + 1);
}
};
public static final Function2 findOne = new Function2() { // from class: kotlinx.coroutines.internal.ThreadContextKt$findOne$1
@Override // kotlin.jvm.functions.Function2
public final ThreadContextElement invoke(ThreadContextElement threadContextElement, CoroutineContext.Element element) {
if (threadContextElement != null) {
return threadContextElement;
}
if (element instanceof ThreadContextElement) {
return (ThreadContextElement) element;
}
return null;
}
};
public static final Function2 updateState = new Function2() { // from class: kotlinx.coroutines.internal.ThreadContextKt$updateState$1
@Override // kotlin.jvm.functions.Function2
public final ThreadState invoke(ThreadState threadState, CoroutineContext.Element element) {
if (element instanceof ThreadContextElement) {
ThreadContextElement threadContextElement = (ThreadContextElement) element;
threadState.append(threadContextElement, threadContextElement.updateThreadContext(threadState.context));
}
return threadState;
}
};
public static final Object threadContextElements(CoroutineContext coroutineContext) {
Object fold = coroutineContext.fold(0, countAll);
Intrinsics.checkNotNull(fold);
return fold;
}
public static final Object updateThreadContext(CoroutineContext coroutineContext, Object obj) {
if (obj == null) {
obj = threadContextElements(coroutineContext);
}
if (obj == 0) {
return NO_THREAD_ELEMENTS;
}
if (obj instanceof Integer) {
return coroutineContext.fold(new ThreadState(coroutineContext, ((Number) obj).intValue()), updateState);
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.ThreadContextElement<kotlin.Any?>");
return ((ThreadContextElement) obj).updateThreadContext(coroutineContext);
}
public static final void restoreThreadContext(CoroutineContext coroutineContext, Object obj) {
if (obj == NO_THREAD_ELEMENTS) {
return;
}
if (obj instanceof ThreadState) {
((ThreadState) obj).restore(coroutineContext);
return;
}
Object fold = coroutineContext.fold(null, findOne);
Intrinsics.checkNotNull(fold, "null cannot be cast to non-null type kotlinx.coroutines.ThreadContextElement<kotlin.Any?>");
((ThreadContextElement) fold).restoreThreadContext(coroutineContext, obj);
}
}

View File

@@ -0,0 +1,65 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* loaded from: classes5.dex */
public final class ThreadLocalElement implements ThreadContextElement {
public final CoroutineContext.Key key;
public final ThreadLocal threadLocal;
public final Object value;
@Override // kotlin.coroutines.CoroutineContext.Element
public CoroutineContext.Key getKey() {
return this.key;
}
public ThreadLocalElement(Object obj, ThreadLocal threadLocal) {
this.value = obj;
this.threadLocal = threadLocal;
this.key = new ThreadLocalKey(threadLocal);
}
@Override // kotlin.coroutines.CoroutineContext
public Object fold(Object obj, Function2 function2) {
return ThreadContextElement.DefaultImpls.fold(this, obj, function2);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext coroutineContext) {
return ThreadContextElement.DefaultImpls.plus(this, coroutineContext);
}
@Override // kotlinx.coroutines.ThreadContextElement
public Object updateThreadContext(CoroutineContext coroutineContext) {
Object obj = this.threadLocal.get();
this.threadLocal.set(this.value);
return obj;
}
@Override // kotlinx.coroutines.ThreadContextElement
public void restoreThreadContext(CoroutineContext coroutineContext, Object obj) {
this.threadLocal.set(obj);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key key) {
return Intrinsics.areEqual(getKey(), key) ? EmptyCoroutineContext.INSTANCE : this;
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public CoroutineContext.Element get(CoroutineContext.Key key) {
if (!Intrinsics.areEqual(getKey(), key)) {
return null;
}
Intrinsics.checkNotNull(this, "null cannot be cast to non-null type E of kotlinx.coroutines.internal.ThreadLocalElement.get");
return this;
}
public String toString() {
return "ThreadLocal(value=" + this.value + ", threadLocal = " + this.threadLocal + ')';
}
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class ThreadLocalKey implements CoroutineContext.Key {
public final ThreadLocal threadLocal;
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return (obj instanceof ThreadLocalKey) && Intrinsics.areEqual(this.threadLocal, ((ThreadLocalKey) obj).threadLocal);
}
public int hashCode() {
return this.threadLocal.hashCode();
}
public String toString() {
return "ThreadLocalKey(threadLocal=" + this.threadLocal + ')';
}
public ThreadLocalKey(ThreadLocal threadLocal) {
this.threadLocal = threadLocal;
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public abstract class ThreadLocalKt {
public static final ThreadLocal commonThreadLocal(Symbol symbol) {
return new ThreadLocal();
}
}

View File

@@ -0,0 +1,195 @@
package kotlinx.coroutines.internal;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public class ThreadSafeHeap {
public static final AtomicIntegerFieldUpdater _size$FU = AtomicIntegerFieldUpdater.newUpdater(ThreadSafeHeap.class, "_size");
private volatile int _size;
public ThreadSafeHeapNode[] a;
public final ThreadSafeHeapNode peek() {
ThreadSafeHeapNode firstImpl;
synchronized (this) {
firstImpl = firstImpl();
}
return firstImpl;
}
public final boolean remove(ThreadSafeHeapNode threadSafeHeapNode) {
boolean z;
synchronized (this) {
if (threadSafeHeapNode.getHeap() == null) {
z = false;
} else {
removeAtImpl(threadSafeHeapNode.getIndex());
z = true;
}
}
return z;
}
public final ThreadSafeHeapNode removeFirstOrNull() {
ThreadSafeHeapNode removeAtImpl;
synchronized (this) {
removeAtImpl = getSize() > 0 ? removeAtImpl(0) : null;
}
return removeAtImpl;
}
public final int getSize() {
return _size$FU.get(this);
}
public final void setSize(int i) {
_size$FU.set(this, i);
}
public final boolean isEmpty() {
return getSize() == 0;
}
public final ThreadSafeHeapNode firstImpl() {
ThreadSafeHeapNode[] threadSafeHeapNodeArr = this.a;
if (threadSafeHeapNodeArr != null) {
return threadSafeHeapNodeArr[0];
}
return null;
}
public final ThreadSafeHeapNode removeAtImpl(int i) {
ThreadSafeHeapNode[] threadSafeHeapNodeArr = this.a;
Intrinsics.checkNotNull(threadSafeHeapNodeArr);
setSize(getSize() - 1);
if (i < getSize()) {
swap(i, getSize());
int i2 = (i - 1) / 2;
if (i > 0) {
ThreadSafeHeapNode threadSafeHeapNode = threadSafeHeapNodeArr[i];
Intrinsics.checkNotNull(threadSafeHeapNode);
ThreadSafeHeapNode threadSafeHeapNode2 = threadSafeHeapNodeArr[i2];
Intrinsics.checkNotNull(threadSafeHeapNode2);
if (((Comparable) threadSafeHeapNode).compareTo(threadSafeHeapNode2) < 0) {
swap(i, i2);
siftUpFrom(i2);
}
}
siftDownFrom(i);
}
ThreadSafeHeapNode threadSafeHeapNode3 = threadSafeHeapNodeArr[getSize()];
Intrinsics.checkNotNull(threadSafeHeapNode3);
threadSafeHeapNode3.setHeap(null);
threadSafeHeapNode3.setIndex(-1);
threadSafeHeapNodeArr[getSize()] = null;
return threadSafeHeapNode3;
}
public final void addImpl(ThreadSafeHeapNode threadSafeHeapNode) {
threadSafeHeapNode.setHeap(this);
ThreadSafeHeapNode[] realloc = realloc();
int size = getSize();
setSize(size + 1);
realloc[size] = threadSafeHeapNode;
threadSafeHeapNode.setIndex(size);
siftUpFrom(size);
}
public final void siftUpFrom(int i) {
while (i > 0) {
ThreadSafeHeapNode[] threadSafeHeapNodeArr = this.a;
Intrinsics.checkNotNull(threadSafeHeapNodeArr);
int i2 = (i - 1) / 2;
ThreadSafeHeapNode threadSafeHeapNode = threadSafeHeapNodeArr[i2];
Intrinsics.checkNotNull(threadSafeHeapNode);
ThreadSafeHeapNode threadSafeHeapNode2 = threadSafeHeapNodeArr[i];
Intrinsics.checkNotNull(threadSafeHeapNode2);
if (((Comparable) threadSafeHeapNode).compareTo(threadSafeHeapNode2) <= 0) {
return;
}
swap(i, i2);
i = i2;
}
}
/* JADX WARN: Code restructure failed: missing block: B:6:0x0028, code lost:
if (((java.lang.Comparable) r3).compareTo(r4) < 0) goto L11;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void siftDownFrom(int r6) {
/*
r5 = this;
L0:
int r0 = r6 * 2
int r1 = r0 + 1
int r2 = r5.getSize()
if (r1 < r2) goto Lb
return
Lb:
kotlinx.coroutines.internal.ThreadSafeHeapNode[] r2 = r5.a
kotlin.jvm.internal.Intrinsics.checkNotNull(r2)
int r0 = r0 + 2
int r3 = r5.getSize()
if (r0 >= r3) goto L2b
r3 = r2[r0]
kotlin.jvm.internal.Intrinsics.checkNotNull(r3)
java.lang.Comparable r3 = (java.lang.Comparable) r3
r4 = r2[r1]
kotlin.jvm.internal.Intrinsics.checkNotNull(r4)
int r3 = r3.compareTo(r4)
if (r3 >= 0) goto L2b
goto L2c
L2b:
r0 = r1
L2c:
r1 = r2[r6]
kotlin.jvm.internal.Intrinsics.checkNotNull(r1)
java.lang.Comparable r1 = (java.lang.Comparable) r1
r2 = r2[r0]
kotlin.jvm.internal.Intrinsics.checkNotNull(r2)
int r1 = r1.compareTo(r2)
if (r1 > 0) goto L3f
return
L3f:
r5.swap(r6, r0)
r6 = r0
goto L0
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.internal.ThreadSafeHeap.siftDownFrom(int):void");
}
public final ThreadSafeHeapNode[] realloc() {
ThreadSafeHeapNode[] threadSafeHeapNodeArr = this.a;
if (threadSafeHeapNodeArr == null) {
ThreadSafeHeapNode[] threadSafeHeapNodeArr2 = new ThreadSafeHeapNode[4];
this.a = threadSafeHeapNodeArr2;
return threadSafeHeapNodeArr2;
}
if (getSize() < threadSafeHeapNodeArr.length) {
return threadSafeHeapNodeArr;
}
Object[] copyOf = Arrays.copyOf(threadSafeHeapNodeArr, getSize() * 2);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
ThreadSafeHeapNode[] threadSafeHeapNodeArr3 = (ThreadSafeHeapNode[]) copyOf;
this.a = threadSafeHeapNodeArr3;
return threadSafeHeapNodeArr3;
}
public final void swap(int i, int i2) {
ThreadSafeHeapNode[] threadSafeHeapNodeArr = this.a;
Intrinsics.checkNotNull(threadSafeHeapNodeArr);
ThreadSafeHeapNode threadSafeHeapNode = threadSafeHeapNodeArr[i2];
Intrinsics.checkNotNull(threadSafeHeapNode);
ThreadSafeHeapNode threadSafeHeapNode2 = threadSafeHeapNodeArr[i];
Intrinsics.checkNotNull(threadSafeHeapNode2);
threadSafeHeapNodeArr[i] = threadSafeHeapNode;
threadSafeHeapNodeArr[i2] = threadSafeHeapNode2;
threadSafeHeapNode.setIndex(i);
threadSafeHeapNode2.setIndex(i2);
}
}

View File

@@ -0,0 +1,12 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public interface ThreadSafeHeapNode {
ThreadSafeHeap getHeap();
int getIndex();
void setHeap(ThreadSafeHeap threadSafeHeap);
void setIndex(int i);
}

View File

@@ -0,0 +1,47 @@
package kotlinx.coroutines.internal;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* loaded from: classes5.dex */
public final class ThreadState {
public final CoroutineContext context;
public final ThreadContextElement[] elements;
public int i;
public final Object[] values;
public ThreadState(CoroutineContext coroutineContext, int i) {
this.context = coroutineContext;
this.values = new Object[i];
this.elements = new ThreadContextElement[i];
}
public final void append(ThreadContextElement threadContextElement, Object obj) {
Object[] objArr = this.values;
int i = this.i;
objArr[i] = obj;
ThreadContextElement[] threadContextElementArr = this.elements;
this.i = i + 1;
Intrinsics.checkNotNull(threadContextElement, "null cannot be cast to non-null type kotlinx.coroutines.ThreadContextElement<kotlin.Any?>");
threadContextElementArr[i] = threadContextElement;
}
public final void restore(CoroutineContext coroutineContext) {
int length = this.elements.length - 1;
if (length < 0) {
return;
}
while (true) {
int i = length - 1;
ThreadContextElement threadContextElement = this.elements[length];
Intrinsics.checkNotNull(threadContextElement);
threadContextElement.restoreThreadContext(coroutineContext, this.values[length]);
if (i < 0) {
return;
} else {
length = i;
}
}
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines.internal;
/* loaded from: classes5.dex */
public final class UndeliveredElementException extends RuntimeException {
public UndeliveredElementException(String str, Throwable th) {
super(str, th);
}
}