ADD week 5

This commit is contained in:
2025-03-31 16:33:42 +02:00
parent 86f265f22d
commit bf645048e6
4927 changed files with 544053 additions and 0 deletions

View File

@ -0,0 +1,10 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: Atomic.kt */
@Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0000\n\u0000\"\u0010\u0010\u0000\u001a\u00020\u00018\u0000X\u0081\u0004¢\u0006\u0002\n\u0000¨\u0006\u0002"}, d2 = {"NO_DECISION", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class AtomicKt {
public static final Object NO_DECISION = new Symbol("NO_DECISION");
}

View File

@ -0,0 +1,47 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.jvm.Volatile;
import kotlinx.coroutines.DebugKt;
/* compiled from: Atomic.kt */
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\t\b'\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00002\u00020\u0002B\u0005¢\u0006\u0002\u0010\u0003J\u001f\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00028\u00002\b\u0010\r\u001a\u0004\u0018\u00010\u0006H&¢\u0006\u0002\u0010\u000eJ\u0014\u0010\u000f\u001a\u0004\u0018\u00010\u00062\b\u0010\u0010\u001a\u0004\u0018\u00010\u0006H\u0002J\u0012\u0010\u0011\u001a\u0004\u0018\u00010\u00062\b\u0010\f\u001a\u0004\u0018\u00010\u0006J\u0017\u0010\u0012\u001a\u0004\u0018\u00010\u00062\u0006\u0010\f\u001a\u00028\u0000H&¢\u0006\u0002\u0010\u0013R\u0011\u0010\u0004\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0005X\u0082\u0004R\u0018\u0010\u0007\u001a\u0006\u0012\u0002\b\u00030\u00008VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\b\u0010\\u0006\u0014"}, d2 = {"Lkotlinx/coroutines/internal/AtomicOp;", "T", "Lkotlinx/coroutines/internal/OpDescriptor;", "()V", "_consensus", "Lkotlinx/atomicfu/AtomicRef;", "", "atomicOp", "getAtomicOp", "()Lkotlinx/coroutines/internal/AtomicOp;", "complete", "", "affected", "failure", "(Ljava/lang/Object;Ljava/lang/Object;)V", "decide", "decision", "perform", "prepare", "(Ljava/lang/Object;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public abstract class AtomicOp<T> extends OpDescriptor {
private static final AtomicReferenceFieldUpdater _consensus$FU = AtomicReferenceFieldUpdater.newUpdater(AtomicOp.class, Object.class, "_consensus");
@Volatile
private volatile Object _consensus = AtomicKt.NO_DECISION;
public abstract void complete(T affected, Object failure);
/* JADX WARN: Multi-variable type inference failed */
@Override // kotlinx.coroutines.internal.OpDescriptor
public AtomicOp<?> getAtomicOp() {
return this;
}
public abstract Object prepare(T affected);
private final Object decide(Object decision) {
if (DebugKt.getASSERTIONS_ENABLED() && decision == AtomicKt.NO_DECISION) {
throw new AssertionError();
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _consensus$FU;
Object obj = atomicReferenceFieldUpdater.get(this);
return obj != AtomicKt.NO_DECISION ? obj : AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, AtomicKt.NO_DECISION, decision) ? decision : atomicReferenceFieldUpdater.get(this);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // kotlinx.coroutines.internal.OpDescriptor
public final Object perform(Object affected) {
Object obj = _consensus$FU.get(this);
if (obj == AtomicKt.NO_DECISION) {
obj = decide(prepare(affected));
}
complete(affected, obj);
return obj;
}
}

View File

@ -0,0 +1,37 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: ExceptionsConstructor.kt */
@Metadata(d1 = {"\u0000'\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000*\u0001\u0004\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J*\u0010\u0006\u001a\u0014\u0012\u0004\u0012\u00020\b\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0007j\u0002`\t2\u000e\u0010\n\u001a\n\u0012\u0006\b\u0001\u0012\u00020\b0\u000bH\u0016R\u0010\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0005¨\u0006\f"}, d2 = {"Lkotlinx/coroutines/internal/ClassValueCtorCache;", "Lkotlinx/coroutines/internal/CtorCache;", "()V", "cache", "kotlinx/coroutines/internal/ClassValueCtorCache$cache$1", "Lkotlinx/coroutines/internal/ClassValueCtorCache$cache$1;", "get", "Lkotlin/Function1;", "", "Lkotlinx/coroutines/internal/Ctor;", "key", "Ljava/lang/Class;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
final class ClassValueCtorCache extends CtorCache {
public static final ClassValueCtorCache INSTANCE = new ClassValueCtorCache();
private static final ClassValueCtorCache$cache$1 cache = new ClassValue<Function1<? super Throwable, ? extends Throwable>>() { // from class: kotlinx.coroutines.internal.ClassValueCtorCache$cache$1
@Override // java.lang.ClassValue
public /* bridge */ /* synthetic */ Function1<? super Throwable, ? extends Throwable> computeValue(Class cls) {
return computeValue2((Class<?>) cls);
}
@Override // java.lang.ClassValue
/* renamed from: computeValue, reason: avoid collision after fix types in other method */
protected Function1<? super Throwable, ? extends Throwable> computeValue2(Class<?> type) {
Function1<? super Throwable, ? extends Throwable> createConstructor;
Intrinsics.checkNotNull(type, "null cannot be cast to non-null type java.lang.Class<out kotlin.Throwable>");
createConstructor = ExceptionsConstructorKt.createConstructor(type);
return createConstructor;
}
};
private ClassValueCtorCache() {
}
@Override // kotlinx.coroutines.internal.CtorCache
public Function1<Throwable, Throwable> get(Class<? extends Throwable> key) {
Object obj;
obj = cache.get(key);
return (Function1) obj;
}
}

View File

@ -0,0 +1,62 @@
package kotlinx.coroutines.internal;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.locks.ReentrantLock;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
/* compiled from: Concurrent.kt */
@Metadata(d1 = {"\u00006\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010#\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a\u001d\u0010\u0002\u001a\b\u0012\u0004\u0012\u0002H\u00040\u0003\"\u0004\b\u0000\u0010\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0080\b\u001a\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0000\u001a*\u0010\u000b\u001a\u0002H\f\"\u0004\b\u0000\u0010\f*\u00060\rj\u0002`\u000e2\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u0002H\f0\u0010H\u0080\\u0006\u0002\u0010\u0011\"\u0010\u0010\u0000\u001a\u0004\u0018\u00010\u0001X\u0082\u0004¢\u0006\u0002\n\u0000*\f\b\u0000\u0010\u0012\"\u00020\r2\u00020\\u0006\u0013"}, d2 = {"REMOVE_FUTURE_ON_CANCEL", "Ljava/lang/reflect/Method;", "identitySet", "", "E", "expectedSize", "", "removeFutureOnCancel", "", "executor", "Ljava/util/concurrent/Executor;", "withLock", "T", "Ljava/util/concurrent/locks/ReentrantLock;", "Lkotlinx/coroutines/internal/ReentrantLock;", "action", "Lkotlin/Function0;", "(Ljava/util/concurrent/locks/ReentrantLock;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;", "ReentrantLock", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ConcurrentKt {
private static final Method REMOVE_FUTURE_ON_CANCEL;
public static /* synthetic */ void ReentrantLock$annotations() {
}
public static final <T> T withLock(ReentrantLock reentrantLock, Function0<? extends T> function0) {
ReentrantLock reentrantLock2 = reentrantLock;
reentrantLock2.lock();
try {
return function0.invoke();
} finally {
InlineMarker.finallyStart(1);
reentrantLock2.unlock();
InlineMarker.finallyEnd(1);
}
}
public static final <E> Set<E> identitySet(int i) {
return Collections.newSetFromMap(new IdentityHashMap(i));
}
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, true);
return true;
} catch (Throwable unused) {
return false;
}
}
}

View File

@ -0,0 +1,185 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.channels.ChannelSegment$$ExternalSyntheticBackportWithForwarding0;
/* compiled from: ConcurrentLinkedList.kt */
@Metadata(d1 = {"\u0000N\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\u001a8\u0010\u0004\u001a\u00020\u0005*\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u00032!\u0010\b\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\n\u0012\b\b\u000b\u0012\u0004\b\b(\f\u0012\u0004\u0012\u00020\u00050\tH\u0082\b\u001a!\u0010\r\u001a\u0002H\u000e\"\u000e\b\u0000\u0010\u000e*\b\u0012\u0004\u0012\u0002H\u000e0\u000f*\u0002H\u000eH\u0000¢\u0006\u0002\u0010\u0010\u001av\u0010\u0011\u001a\b\u0012\u0004\u0012\u0002H\u00130\u0012\"\u000e\b\u0000\u0010\u0013*\b\u0012\u0004\u0012\u0002H\u00130\u0014*\b\u0012\u0004\u0012\u0002H\u00130\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u0002H\u001328\b\b\u0010\u0019\u001a2\u0012\u0013\u0012\u00110\u0017¢\u0006\f\b\n\u0012\b\b\u000b\u0012\u0004\b\b(\u0016\u0012\u0013\u0012\u0011H\u0013¢\u0006\f\b\n\u0012\b\b\u000b\u0012\u0004\b\b(\u001b\u0012\u0004\u0012\u0002H\u00130\u001aH\u0080\\u0001\u0000\u001aj\u0010\u001c\u001a\b\u0012\u0004\u0012\u0002H\u00130\u0012\"\u000e\b\u0000\u0010\u0013*\b\u0012\u0004\u0012\u0002H\u00130\u0014*\u0002H\u00132\u0006\u0010\u0016\u001a\u00020\u001726\u0010\u0019\u001a2\u0012\u0013\u0012\u00110\u0017¢\u0006\f\b\n\u0012\b\b\u000b\u0012\u0004\b\b(\u0016\u0012\u0013\u0012\u0011H\u0013¢\u0006\f\b\n\u0012\b\b\u000b\u0012\u0004\b\b(\u001b\u0012\u0004\u0012\u0002H\u00130\u001aH\u0000ø\u0001\u0000¢\u0006\u0002\u0010\u001d\u001a+\u0010\u001e\u001a\u00020\u0005\"\u000e\b\u0000\u0010\u0013*\b\u0012\u0004\u0012\u0002H\u00130\u0014*\b\u0012\u0004\u0012\u0002H\u00130\u00152\u0006\u0010\u001f\u001a\u0002H\u0013H\u0080\b\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0003X\u0082T¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006 "}, d2 = {"CLOSED", "Lkotlinx/coroutines/internal/Symbol;", "POINTERS_SHIFT", "", "addConditionally", "", "Lkotlinx/atomicfu/AtomicInt;", "delta", "condition", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "cur", "close", "N", "Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;", "(Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;)Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;", "findSegmentAndMoveForward", "Lkotlinx/coroutines/internal/SegmentOrClosed;", "S", "Lkotlinx/coroutines/internal/Segment;", "Lkotlinx/atomicfu/AtomicRef;", "id", "", "startFrom", "createNewSegment", "Lkotlin/Function2;", "prev", "findSegmentInternal", "(Lkotlinx/coroutines/internal/Segment;JLkotlin/jvm/functions/Function2;)Ljava/lang/Object;", "moveForward", TypedValues.TransitionType.S_TO, "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ConcurrentLinkedListKt {
private static final Symbol CLOSED = new Symbol("CLOSED");
private static final int POINTERS_SHIFT = 16;
public static final <S extends Segment<S>> Object findSegmentInternal(S s, long j, Function2<? super Long, ? super S, ? extends S> function2) {
while (true) {
if (s.id >= j && !s.isRemoved()) {
return SegmentOrClosed.m1910constructorimpl(s);
}
Object nextOrClosed = s.getNextOrClosed();
if (nextOrClosed == CLOSED) {
return SegmentOrClosed.m1910constructorimpl(CLOSED);
}
S s2 = (S) ((ConcurrentLinkedListNode) nextOrClosed);
if (s2 == null) {
s2 = function2.invoke(Long.valueOf(s.id + 1), s);
if (s.trySetNext(s2)) {
if (s.isRemoved()) {
s.remove();
}
}
}
s = s2;
}
}
/* JADX WARN: Incorrect types in method signature: (Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;TS;)Z */
public static final boolean moveForward$atomicfu(Object obj, AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Segment segment) {
while (true) {
Segment segment2 = (Segment) atomicReferenceFieldUpdater.get(obj);
if (segment2.id >= segment.id) {
return true;
}
if (!segment.tryIncPointers$kotlinx_coroutines_core()) {
return false;
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, obj, segment2, segment)) {
if (segment2.decPointers$kotlinx_coroutines_core()) {
segment2.remove();
}
return true;
}
if (segment.decPointers$kotlinx_coroutines_core()) {
segment.remove();
}
}
}
/* JADX WARN: Incorrect types in method signature: (Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReferenceArray;ITS;)Z */
public static final boolean moveForward$atomicfu$array(Object obj, AtomicReferenceArray atomicReferenceArray, int i, Segment segment) {
while (true) {
Segment segment2 = (Segment) atomicReferenceArray.get(i);
if (segment2.id >= segment.id) {
return true;
}
if (!segment.tryIncPointers$kotlinx_coroutines_core()) {
return false;
}
if (ChannelSegment$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceArray, i, segment2, segment)) {
if (segment2.decPointers$kotlinx_coroutines_core()) {
segment2.remove();
}
return true;
}
if (segment.decPointers$kotlinx_coroutines_core()) {
segment.remove();
}
}
}
/* JADX WARN: Incorrect types in method signature: (Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;JTS;Lkotlin/jvm/functions/Function2<-Ljava/lang/Long;-TS;+TS;>;)Ljava/lang/Object; */
public static final Object findSegmentAndMoveForward$atomicfu(Object obj, AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, long j, Segment segment, Function2 function2) {
Object findSegmentInternal;
loop0: while (true) {
findSegmentInternal = findSegmentInternal(segment, j, function2);
if (!SegmentOrClosed.m1915isClosedimpl(findSegmentInternal)) {
Segment m1913getSegmentimpl = SegmentOrClosed.m1913getSegmentimpl(findSegmentInternal);
while (true) {
Segment segment2 = (Segment) atomicReferenceFieldUpdater.get(obj);
if (segment2.id >= m1913getSegmentimpl.id) {
break loop0;
}
if (!m1913getSegmentimpl.tryIncPointers$kotlinx_coroutines_core()) {
break;
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, obj, segment2, m1913getSegmentimpl)) {
if (segment2.decPointers$kotlinx_coroutines_core()) {
segment2.remove();
}
} else if (m1913getSegmentimpl.decPointers$kotlinx_coroutines_core()) {
m1913getSegmentimpl.remove();
}
}
} else {
break;
}
}
return findSegmentInternal;
}
/* JADX WARN: Incorrect types in method signature: (Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReferenceArray;IJTS;Lkotlin/jvm/functions/Function2<-Ljava/lang/Long;-TS;+TS;>;)Ljava/lang/Object; */
public static final Object findSegmentAndMoveForward$atomicfu$array(Object obj, AtomicReferenceArray atomicReferenceArray, int i, long j, Segment segment, Function2 function2) {
Object findSegmentInternal;
loop0: while (true) {
findSegmentInternal = findSegmentInternal(segment, j, function2);
if (!SegmentOrClosed.m1915isClosedimpl(findSegmentInternal)) {
Segment m1913getSegmentimpl = SegmentOrClosed.m1913getSegmentimpl(findSegmentInternal);
while (true) {
Segment segment2 = (Segment) atomicReferenceArray.get(i);
if (segment2.id >= m1913getSegmentimpl.id) {
break loop0;
}
if (!m1913getSegmentimpl.tryIncPointers$kotlinx_coroutines_core()) {
break;
}
if (ChannelSegment$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceArray, i, segment2, m1913getSegmentimpl)) {
if (segment2.decPointers$kotlinx_coroutines_core()) {
segment2.remove();
}
} else if (m1913getSegmentimpl.decPointers$kotlinx_coroutines_core()) {
m1913getSegmentimpl.remove();
}
}
} else {
break;
}
}
return findSegmentInternal;
}
private static final boolean addConditionally$atomicfu(Object obj, AtomicIntegerFieldUpdater atomicIntegerFieldUpdater, int i, Function1<? super Integer, Boolean> function1) {
int i2;
do {
i2 = atomicIntegerFieldUpdater.get(obj);
if (!function1.invoke(Integer.valueOf(i2)).booleanValue()) {
return false;
}
} while (!atomicIntegerFieldUpdater.compareAndSet(obj, i2, i2 + i));
return true;
}
private static final boolean addConditionally$atomicfu$array(Object obj, AtomicIntegerArray atomicIntegerArray, int i, int i2, Function1<? super Integer, Boolean> function1) {
int i3;
do {
i3 = atomicIntegerArray.get(i);
if (!function1.invoke(Integer.valueOf(i3)).booleanValue()) {
return false;
}
} while (!atomicIntegerArray.compareAndSet(i, i3, i3 + i2));
return true;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v1, types: [kotlinx.coroutines.internal.ConcurrentLinkedListNode] */
public static final <N extends ConcurrentLinkedListNode<N>> N close(N n) {
while (true) {
Object nextOrClosed = n.getNextOrClosed();
if (nextOrClosed == CLOSED) {
return n;
}
?? r0 = (ConcurrentLinkedListNode) nextOrClosed;
if (r0 != 0) {
n = r0;
} else if (n.markAsClosed()) {
return n;
}
}
}
}

View File

@ -0,0 +1,130 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.KotlinNothingValueException;
import kotlin.Metadata;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.DebugKt;
import kotlinx.coroutines.internal.ConcurrentLinkedListNode;
/* compiled from: ConcurrentLinkedList.kt */
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0002\b\t\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0001\n\u0002\b\u0006\b \u0018\u0000*\u000e\b\u0000\u0010\u0001*\b\u0012\u0004\u0012\u0002H\u00010\u00002\u00020\u0002B\u000f\u0012\b\u0010\u0003\u001a\u0004\u0018\u00018\u0000¢\u0006\u0002\u0010\u0004J\u0006\u0010\u0017\u001a\u00020\u0018J\u0006\u0010\u0019\u001a\u00020\u000eJ\u001e\u0010\u001a\u001a\u0004\u0018\u00018\u00002\f\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\u001d0\u001cH\u0086\\u0006\u0002\u0010\u001eJ\u0006\u0010\u001f\u001a\u00020\u0018J\u0013\u0010 \u001a\u00020\u000e2\u0006\u0010!\u001a\u00028\u0000¢\u0006\u0002\u0010\"R\u0011\u0010\u0005\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00020\u0006X\u0082\u0004R\u0011\u0010\u0007\u001a\n\u0012\u0006\u0012\u0004\u0018\u00018\u00000\u0006X\u0082\u0004R\u0016\u0010\b\u001a\u0004\u0018\u00018\u00008BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\nR\u0014\u0010\u000b\u001a\u00028\u00008BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\f\u0010\nR\u0012\u0010\r\u001a\u00020\u000eX¦\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000fR\u0011\u0010\u0010\u001a\u00020\u000e8F¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u000fR\u0013\u0010\u0011\u001a\u0004\u0018\u00018\u00008F¢\u0006\u0006\u001a\u0004\b\u0012\u0010\nR\u0016\u0010\u0013\u001a\u0004\u0018\u00010\u00028BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0015R\u0013\u0010\u0003\u001a\u0004\u0018\u00018\u00008F¢\u0006\u0006\u001a\u0004\b\u0016\u0010\\u0006#"}, d2 = {"Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;", "N", "", "prev", "(Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;)V", "_next", "Lkotlinx/atomicfu/AtomicRef;", "_prev", "aliveSegmentLeft", "getAliveSegmentLeft", "()Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;", "aliveSegmentRight", "getAliveSegmentRight", "isRemoved", "", "()Z", "isTail", "next", "getNext", "nextOrClosed", "getNextOrClosed", "()Ljava/lang/Object;", "getPrev", "cleanPrev", "", "markAsClosed", "nextOrIfClosed", "onClosedAction", "Lkotlin/Function0;", "", "(Lkotlin/jvm/functions/Function0;)Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;", "remove", "trySetNext", "value", "(Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;)Z", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public abstract class ConcurrentLinkedListNode<N extends ConcurrentLinkedListNode<N>> {
private static final AtomicReferenceFieldUpdater _next$FU = AtomicReferenceFieldUpdater.newUpdater(ConcurrentLinkedListNode.class, Object.class, "_next");
private static final AtomicReferenceFieldUpdater _prev$FU = AtomicReferenceFieldUpdater.newUpdater(ConcurrentLinkedListNode.class, Object.class, "_prev");
@Volatile
private volatile Object _next;
@Volatile
private volatile Object _prev;
private final void update$atomicfu(AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Function1<Object, ? extends Object> function1, Object obj) {
Object obj2;
do {
obj2 = atomicReferenceFieldUpdater.get(obj);
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, obj, obj2, function1.invoke(obj2)));
}
public abstract boolean isRemoved();
public ConcurrentLinkedListNode(N n) {
this._prev = n;
}
/* JADX INFO: Access modifiers changed from: private */
public final Object getNextOrClosed() {
return _next$FU.get(this);
}
public final N nextOrIfClosed(Function0 onClosedAction) {
Object nextOrClosed = getNextOrClosed();
if (nextOrClosed == ConcurrentLinkedListKt.CLOSED) {
onClosedAction.invoke();
throw new KotlinNothingValueException();
}
return (N) nextOrClosed;
}
public final boolean trySetNext(N value) {
return AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, null, value);
}
public final boolean isTail() {
return getNext() == null;
}
public final N getPrev() {
return (N) _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 (DebugKt.getASSERTIONS_ENABLED() && !isRemoved() && !isTail()) {
throw new AssertionError();
}
if (isTail()) {
return;
}
while (true) {
N aliveSegmentLeft = getAliveSegmentLeft();
N 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;
}
}
}
}
private final N getAliveSegmentLeft() {
N prev = getPrev();
while (prev != null && prev.isRemoved()) {
prev = (N) _prev$FU.get(prev);
}
return prev;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v1, types: [kotlinx.coroutines.internal.ConcurrentLinkedListNode] */
private final N getAliveSegmentRight() {
?? next;
if (DebugKt.getASSERTIONS_ENABLED() && !(!isTail())) {
throw new AssertionError();
}
N next2 = getNext();
Intrinsics.checkNotNull(next2);
while (next2.isRemoved() && (next = next2.getNext()) != 0) {
next2 = next;
}
return next2;
}
public final N getNext() {
Object nextOrClosed = getNextOrClosed();
if (nextOrClosed == ConcurrentLinkedListKt.CLOSED) {
return null;
}
return (N) nextOrClosed;
}
}

View File

@ -0,0 +1,25 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.CoroutineScope;
/* compiled from: Scopes.kt */
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\b\u001a\u00020\tH\u0016R\u0014\u0010\u0005\u001a\u00020\u0003X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\n"}, d2 = {"Lkotlinx/coroutines/internal/ContextScope;", "Lkotlinx/coroutines/CoroutineScope;", "context", "Lkotlin/coroutines/CoroutineContext;", "(Lkotlin/coroutines/CoroutineContext;)V", "coroutineContext", "getCoroutineContext", "()Lkotlin/coroutines/CoroutineContext;", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ContextScope implements CoroutineScope {
private 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,29 @@
package kotlinx.coroutines.internal;
import java.util.Collection;
import java.util.ServiceLoader;
import kotlin.Metadata;
import kotlin.sequences.SequencesKt;
import kotlinx.coroutines.CoroutineExceptionHandler;
/* compiled from: CoroutineExceptionHandlerImpl.kt */
@Metadata(d1 = {"\u0000\u001c\n\u0000\n\u0002\u0010\u001e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u0003\n\u0000\u001a\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0002H\u0000\u001a\u0010\u0010\b\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\nH\u0000\"\u001a\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0003\u0010\u0004¨\u0006\u000b"}, d2 = {"platformExceptionHandlers", "", "Lkotlinx/coroutines/CoroutineExceptionHandler;", "getPlatformExceptionHandlers", "()Ljava/util/Collection;", "ensurePlatformExceptionHandlerLoaded", "", "callback", "propagateExceptionFinalResort", "exception", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class CoroutineExceptionHandlerImplKt {
private static final Collection<CoroutineExceptionHandler> platformExceptionHandlers = SequencesKt.toList(SequencesKt.asSequence(ServiceLoader.load(CoroutineExceptionHandler.class, CoroutineExceptionHandler.class.getClassLoader()).iterator()));
public static final Collection<CoroutineExceptionHandler> getPlatformExceptionHandlers() {
return platformExceptionHandlers;
}
public static final void ensurePlatformExceptionHandlerLoaded(CoroutineExceptionHandler coroutineExceptionHandler) {
if (!platformExceptionHandlers.contains(coroutineExceptionHandler)) {
throw new IllegalStateException("Exception handler was not found via a ServiceLoader".toString());
}
}
public static final void propagateExceptionFinalResort(Throwable th) {
Thread currentThread = Thread.currentThread();
currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, th);
}
}

View File

@ -0,0 +1,31 @@
package kotlinx.coroutines.internal;
import java.util.Iterator;
import kotlin.ExceptionsKt;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.CoroutineExceptionHandler;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
/* compiled from: CoroutineExceptionHandlerImpl.common.kt */
@Metadata(d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\u001a\u0018\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H\u0000¨\u0006\u0006"}, d2 = {"handleUncaughtCoroutineException", "", "context", "Lkotlin/coroutines/CoroutineContext;", "exception", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class CoroutineExceptionHandlerImpl_commonKt {
public static final void handleUncaughtCoroutineException(CoroutineContext coroutineContext, Throwable th) {
Iterator<CoroutineExceptionHandler> it = CoroutineExceptionHandlerImplKt.getPlatformExceptionHandlers().iterator();
while (it.hasNext()) {
try {
it.next().handleException(coroutineContext, th);
} catch (ExceptionSuccessfullyProcessed unused) {
return;
} catch (Throwable th2) {
CoroutineExceptionHandlerImplKt.propagateExceptionFinalResort(CoroutineExceptionHandlerKt.handlerException(th, th2));
}
}
try {
ExceptionsKt.addSuppressed(th, new DiagnosticCoroutineContextException(coroutineContext));
} catch (Throwable unused2) {
}
CoroutineExceptionHandlerImplKt.propagateExceptionFinalResort(th);
}
}

View File

@ -0,0 +1,11 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
/* compiled from: ExceptionsConstructor.kt */
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b \u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J*\u0010\u0003\u001a\u0014\u0012\u0004\u0012\u00020\u0005\u0012\u0006\u0012\u0004\u0018\u00010\u00050\u0004j\u0002`\u00062\u000e\u0010\u0007\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00050\bH&¨\u0006\t"}, d2 = {"Lkotlinx/coroutines/internal/CtorCache;", "", "()V", "get", "Lkotlin/Function1;", "", "Lkotlinx/coroutines/internal/Ctor;", "key", "Ljava/lang/Class;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public abstract class CtorCache {
public abstract Function1<Throwable, Throwable> get(Class<? extends Throwable> key);
}

View File

@ -0,0 +1,26 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
/* compiled from: CoroutineExceptionHandlerImpl.kt */
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0003\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0000\u0018\u00002\u00060\u0001j\u0002`\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\b\u0010\u0006\u001a\u00020\u0007H\u0016J\b\u0010\b\u001a\u00020\tH\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"Lkotlinx/coroutines/internal/DiagnosticCoroutineContextException;", "Ljava/lang/RuntimeException;", "Lkotlin/RuntimeException;", "context", "Lkotlin/coroutines/CoroutineContext;", "(Lkotlin/coroutines/CoroutineContext;)V", "fillInStackTrace", "", "getLocalizedMessage", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class DiagnosticCoroutineContextException extends RuntimeException {
private 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;
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,193 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.CancellationException;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.InlineMarker;
import kotlinx.coroutines.CompletionStateKt;
import kotlinx.coroutines.CoroutineContextKt;
import kotlinx.coroutines.DebugKt;
import kotlinx.coroutines.EventLoop;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.ThreadLocalEventLoop;
import kotlinx.coroutines.UndispatchedCoroutine;
/* compiled from: DispatchedContinuation.kt */
@Metadata(d1 = {"\u0000J\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\u001a;\u0010\u0003\u001a\u00020\u0004*\u0006\u0012\u0002\b\u00030\u00052\b\u0010\u0006\u001a\u0004\u0018\u00010\u00072\u0006\u0010\b\u001a\u00020\t2\b\b\u0002\u0010\n\u001a\u00020\u00042\f\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\r0\fH\u0082\b\u001aU\u0010\u000e\u001a\u00020\r\"\u0004\b\u0000\u0010\u000f*\b\u0012\u0004\u0012\u0002H\u000f0\u00102\f\u0010\u0011\u001a\b\u0012\u0004\u0012\u0002H\u000f0\u00122%\b\u0002\u0010\u0013\u001a\u001f\u0012\u0013\u0012\u00110\u0015¢\u0006\f\b\u0016\u0012\b\b\u0017\u0012\u0004\b\b(\u0018\u0012\u0004\u0012\u00020\r\u0018\u00010\u0014H\u0007ø\u0001\u0000¢\u0006\u0002\u0010\u0019\u001a\u0012\u0010\u001a\u001a\u00020\u0004*\b\u0012\u0004\u0012\u00020\r0\u0005H\u0000\"\u0010\u0010\u0000\u001a\u00020\u00018\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u001b"}, d2 = {"REUSABLE_CLAIMED", "Lkotlinx/coroutines/internal/Symbol;", "UNDEFINED", "executeUnconfined", "", "Lkotlinx/coroutines/internal/DispatchedContinuation;", "contState", "", "mode", "", "doYield", "block", "Lkotlin/Function0;", "", "resumeCancellableWith", "T", "Lkotlin/coroutines/Continuation;", "result", "Lkotlin/Result;", "onCancellation", "Lkotlin/Function1;", "", "Lkotlin/ParameterName;", "name", "cause", "(Lkotlin/coroutines/Continuation;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)V", "yieldUndispatched", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class DispatchedContinuationKt {
private 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 <T> void resumeCancellableWith(Continuation<? super T> continuation, Object obj, Function1<? super Throwable, Unit> function1) {
if (!(continuation instanceof DispatchedContinuation)) {
continuation.resumeWith(obj);
return;
}
DispatchedContinuation dispatchedContinuation = (DispatchedContinuation) continuation;
Object state = CompletionStateKt.toState(obj, function1);
if (dispatchedContinuation.dispatcher.isDispatchNeeded(dispatchedContinuation.get$context())) {
dispatchedContinuation._state = state;
dispatchedContinuation.resumeMode = 1;
dispatchedContinuation.dispatcher.mo1907dispatch(dispatchedContinuation.get$context(), dispatchedContinuation);
return;
}
DebugKt.getASSERTIONS_ENABLED();
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
dispatchedContinuation._state = state;
dispatchedContinuation.resumeMode = 1;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
return;
}
DispatchedContinuation dispatchedContinuation2 = dispatchedContinuation;
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
Job job = (Job) dispatchedContinuation.get$context().get(Job.INSTANCE);
if (job != null && !job.isActive()) {
CancellationException cancellationException = job.getCancellationException();
dispatchedContinuation.cancelCompletedResult$kotlinx_coroutines_core(state, cancellationException);
Result.Companion companion = Result.INSTANCE;
dispatchedContinuation.resumeWith(Result.m288constructorimpl(ResultKt.createFailure(cancellationException)));
} else {
Continuation<T> continuation2 = dispatchedContinuation.continuation;
Object obj2 = dispatchedContinuation.countOrElement;
CoroutineContext coroutineContext = continuation2.get$context();
Object updateThreadContext = ThreadContextKt.updateThreadContext(coroutineContext, obj2);
UndispatchedCoroutine<?> updateUndispatchedCompletion = updateThreadContext != ThreadContextKt.NO_THREAD_ELEMENTS ? CoroutineContextKt.updateUndispatchedCompletion(continuation2, coroutineContext, updateThreadContext) : null;
try {
dispatchedContinuation.continuation.resumeWith(obj);
Unit unit = Unit.INSTANCE;
} finally {
if (updateUndispatchedCompletion == null || updateUndispatchedCompletion.clearThreadContext()) {
ThreadContextKt.restoreThreadContext(coroutineContext, updateThreadContext);
}
}
}
while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent()) {
}
} finally {
try {
} finally {
}
}
}
public static final boolean yieldUndispatched(DispatchedContinuation<? super Unit> dispatchedContinuation) {
Unit unit = Unit.INSTANCE;
DebugKt.getASSERTIONS_ENABLED();
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()) {
dispatchedContinuation._state = unit;
dispatchedContinuation.resumeMode = 1;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
return true;
}
DispatchedContinuation<? super Unit> dispatchedContinuation2 = dispatchedContinuation;
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
dispatchedContinuation.run();
do {
} while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent());
} finally {
try {
return false;
} finally {
}
}
return false;
}
private static final boolean executeUnconfined(DispatchedContinuation<?> dispatchedContinuation, Object obj, int i, boolean z, Function0<Unit> function0) {
if (DebugKt.getASSERTIONS_ENABLED() && i == -1) {
throw new AssertionError();
}
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (z && eventLoop$kotlinx_coroutines_core.isUnconfinedQueueEmpty()) {
return false;
}
if (eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
dispatchedContinuation._state = obj;
dispatchedContinuation.resumeMode = i;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
return true;
}
DispatchedContinuation<?> dispatchedContinuation2 = dispatchedContinuation;
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
function0.invoke();
do {
} while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent());
InlineMarker.finallyStart(1);
} catch (Throwable th) {
try {
dispatchedContinuation2.handleFatalException(th, null);
InlineMarker.finallyStart(1);
} catch (Throwable th2) {
InlineMarker.finallyStart(1);
eventLoop$kotlinx_coroutines_core.decrementUseCount(true);
InlineMarker.finallyEnd(1);
throw th2;
}
}
eventLoop$kotlinx_coroutines_core.decrementUseCount(true);
InlineMarker.finallyEnd(1);
return false;
}
static /* synthetic */ boolean executeUnconfined$default(DispatchedContinuation dispatchedContinuation, Object obj, int i, boolean z, Function0 function0, int i2, Object obj2) {
if ((i2 & 4) != 0) {
z = false;
}
if (DebugKt.getASSERTIONS_ENABLED() && i == -1) {
throw new AssertionError();
}
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (z && eventLoop$kotlinx_coroutines_core.isUnconfinedQueueEmpty()) {
return false;
}
if (eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
dispatchedContinuation._state = obj;
dispatchedContinuation.resumeMode = i;
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedContinuation);
return true;
}
DispatchedContinuation dispatchedContinuation2 = dispatchedContinuation;
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
function0.invoke();
do {
} while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent());
InlineMarker.finallyStart(1);
} catch (Throwable th) {
try {
dispatchedContinuation2.handleFatalException(th, null);
InlineMarker.finallyStart(1);
} catch (Throwable th2) {
InlineMarker.finallyStart(1);
eventLoop$kotlinx_coroutines_core.decrementUseCount(true);
InlineMarker.finallyEnd(1);
throw th2;
}
}
eventLoop$kotlinx_coroutines_core.decrementUseCount(true);
InlineMarker.finallyEnd(1);
return false;
}
}

View File

@ -0,0 +1,13 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: CoroutineExceptionHandlerImpl.common.kt */
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\\u0002\u0018\u00002\u00060\u0001j\u0002`\u0002B\u0007\b\u0002¢\u0006\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lkotlinx/coroutines/internal/ExceptionSuccessfullyProcessed;", "Ljava/lang/Exception;", "Lkotlin/Exception;", "()V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ExceptionSuccessfullyProcessed extends Exception {
public static final ExceptionSuccessfullyProcessed INSTANCE = new ExceptionSuccessfullyProcessed();
private ExceptionSuccessfullyProcessed() {
}
}

View File

@ -0,0 +1,239 @@
package kotlinx.coroutines.internal;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.TuplesKt;
import kotlin.jvm.JvmClassMappingKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CopyableThrowable;
/* compiled from: ExceptionsConstructor.kt */
@Metadata(d1 = {"\u0000&\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u000b\u001a2\u0010\u0004\u001a\u0014\u0012\u0004\u0012\u00020\u0006\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0005j\u0002`\u0007\"\b\b\u0000\u0010\b*\u00020\u00062\f\u0010\t\u001a\b\u0012\u0004\u0012\u0002H\b0\nH\u0002\u001a.\u0010\u000b\u001a\u0014\u0012\u0004\u0012\u00020\u0006\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0005j\u0002`\u00072\u0012\u0010\f\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\u0005H\u0002\u001a!\u0010\r\u001a\u0004\u0018\u0001H\b\"\b\b\u0000\u0010\b*\u00020\u00062\u0006\u0010\u000e\u001a\u0002H\bH\u0000¢\u0006\u0002\u0010\u000f\u001a\u001b\u0010\u0010\u001a\u00020\u0003*\u0006\u0012\u0002\b\u00030\n2\b\b\u0002\u0010\u0011\u001a\u00020\u0003H\u0082\u0010\u001a\u0018\u0010\u0012\u001a\u00020\u0003*\u0006\u0012\u0002\b\u00030\n2\u0006\u0010\u0013\u001a\u00020\u0003H\u0002\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000*(\b\u0002\u0010\u0014\"\u0010\u0012\u0004\u0012\u00020\u0006\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u00052\u0010\u0012\u0004\u0012\u00020\u0006\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0005¨\u0006\u0015"}, d2 = {"ctorCache", "Lkotlinx/coroutines/internal/CtorCache;", "throwableFields", "", "createConstructor", "Lkotlin/Function1;", "", "Lkotlinx/coroutines/internal/Ctor;", "E", "clz", "Ljava/lang/Class;", "safeCtor", "block", "tryCopyException", "exception", "(Ljava/lang/Throwable;)Ljava/lang/Throwable;", "fieldsCount", "accumulator", "fieldsCountOrDefault", "defaultValue", "Ctor", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ExceptionsConstructorKt {
private static final CtorCache ctorCache;
private static final int throwableFields = fieldsCountOrDefault(Throwable.class, -1);
static {
WeakMapCtorCache weakMapCtorCache;
try {
weakMapCtorCache = FastServiceLoaderKt.getANDROID_DETECTED() ? WeakMapCtorCache.INSTANCE : ClassValueCtorCache.INSTANCE;
} catch (Throwable unused) {
weakMapCtorCache = WeakMapCtorCache.INSTANCE;
}
ctorCache = weakMapCtorCache;
}
/* JADX WARN: Multi-variable type inference failed */
public static final <E extends Throwable> E tryCopyException(E e) {
Object m288constructorimpl;
if (e instanceof CopyableThrowable) {
try {
Result.Companion companion = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(((CopyableThrowable) e).createCopy());
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(ResultKt.createFailure(th));
}
if (Result.m294isFailureimpl(m288constructorimpl)) {
m288constructorimpl = null;
}
return (E) m288constructorimpl;
}
return (E) ctorCache.get(e.getClass()).invoke(e);
}
/* JADX INFO: Access modifiers changed from: private */
public static final <E extends Throwable> Function1<Throwable, Throwable> createConstructor(Class<E> cls) {
Object obj;
Function1<Throwable, Throwable> function1;
Pair pair;
ExceptionsConstructorKt$createConstructor$nullResult$1 exceptionsConstructorKt$createConstructor$nullResult$1 = new Function1() { // from class: kotlinx.coroutines.internal.ExceptionsConstructorKt$createConstructor$nullResult$1
@Override // kotlin.jvm.functions.Function1
public final Void invoke(Throwable th) {
return null;
}
};
if (throwableFields != fieldsCountOrDefault(cls, 0)) {
return exceptionsConstructorKt$createConstructor$nullResult$1;
}
Constructor<?>[] constructors = cls.getConstructors();
ArrayList arrayList = new ArrayList(constructors.length);
int length = constructors.length;
int i = 0;
while (true) {
obj = null;
if (i >= length) {
break;
}
final Constructor<?> constructor = constructors[i];
Class<?>[] parameterTypes = constructor.getParameterTypes();
int length2 = parameterTypes.length;
if (length2 == 0) {
pair = TuplesKt.to(safeCtor(new Function1<Throwable, Throwable>() { // from class: kotlinx.coroutines.internal.ExceptionsConstructorKt$createConstructor$1$4
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(Throwable th) {
Object newInstance = constructor.newInstance(new Object[0]);
Intrinsics.checkNotNull(newInstance, "null cannot be cast to non-null type kotlin.Throwable");
Throwable th2 = (Throwable) newInstance;
th2.initCause(th);
return th2;
}
}), 0);
} else if (length2 == 1) {
Class<?> cls2 = parameterTypes[0];
if (Intrinsics.areEqual(cls2, String.class)) {
pair = TuplesKt.to(safeCtor(new Function1<Throwable, Throwable>() { // from class: kotlinx.coroutines.internal.ExceptionsConstructorKt$createConstructor$1$2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(Throwable th) {
Object newInstance = constructor.newInstance(th.getMessage());
Intrinsics.checkNotNull(newInstance, "null cannot be cast to non-null type kotlin.Throwable");
Throwable th2 = (Throwable) newInstance;
th2.initCause(th);
return th2;
}
}), 2);
} else if (Intrinsics.areEqual(cls2, Throwable.class)) {
pair = TuplesKt.to(safeCtor(new Function1<Throwable, Throwable>() { // from class: kotlinx.coroutines.internal.ExceptionsConstructorKt$createConstructor$1$3
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(Throwable th) {
Object newInstance = constructor.newInstance(th);
Intrinsics.checkNotNull(newInstance, "null cannot be cast to non-null type kotlin.Throwable");
return (Throwable) newInstance;
}
}), 1);
} else {
pair = TuplesKt.to(null, -1);
}
} else if (length2 == 2) {
if (Intrinsics.areEqual(parameterTypes[0], String.class) && Intrinsics.areEqual(parameterTypes[1], Throwable.class)) {
pair = TuplesKt.to(safeCtor(new Function1<Throwable, Throwable>() { // from class: kotlinx.coroutines.internal.ExceptionsConstructorKt$createConstructor$1$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(Throwable th) {
Object newInstance = constructor.newInstance(th.getMessage(), th);
Intrinsics.checkNotNull(newInstance, "null cannot be cast to non-null type kotlin.Throwable");
return (Throwable) newInstance;
}
}), 3);
} else {
pair = TuplesKt.to(null, -1);
}
} else {
pair = TuplesKt.to(null, -1);
}
arrayList.add(pair);
i++;
}
Iterator it = arrayList.iterator();
if (it.hasNext()) {
obj = it.next();
if (it.hasNext()) {
int intValue = ((Number) ((Pair) obj).getSecond()).intValue();
do {
Object next = it.next();
int intValue2 = ((Number) ((Pair) next).getSecond()).intValue();
if (intValue < intValue2) {
obj = next;
intValue = intValue2;
}
} while (it.hasNext());
}
}
Pair pair2 = (Pair) obj;
return (pair2 == null || (function1 = (Function1) pair2.getFirst()) == null) ? exceptionsConstructorKt$createConstructor$nullResult$1 : function1;
}
private static final Function1<Throwable, Throwable> safeCtor(final Function1<? super Throwable, ? extends Throwable> function1) {
return new Function1<Throwable, Throwable>() { // from class: kotlinx.coroutines.internal.ExceptionsConstructorKt$safeCtor$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public final Throwable invoke(Throwable th) {
Object m288constructorimpl;
Function1<Throwable, Throwable> function12 = function1;
try {
Result.Companion companion = Result.INSTANCE;
Throwable invoke = function12.invoke(th);
if (!Intrinsics.areEqual(th.getMessage(), invoke.getMessage()) && !Intrinsics.areEqual(invoke.getMessage(), th.toString())) {
invoke = null;
}
m288constructorimpl = Result.m288constructorimpl(invoke);
} catch (Throwable th2) {
Result.Companion companion2 = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(ResultKt.createFailure(th2));
}
return (Throwable) (Result.m294isFailureimpl(m288constructorimpl) ? null : m288constructorimpl);
}
};
}
private static final int fieldsCountOrDefault(Class<?> cls, int i) {
Object m288constructorimpl;
JvmClassMappingKt.getKotlinClass(cls);
try {
Result.Companion companion = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(Integer.valueOf(fieldsCount$default(cls, 0, 1, null)));
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(ResultKt.createFailure(th));
}
Integer valueOf = Integer.valueOf(i);
if (Result.m294isFailureimpl(m288constructorimpl)) {
m288constructorimpl = valueOf;
}
return ((Number) m288constructorimpl).intValue();
}
static /* synthetic */ int fieldsCount$default(Class cls, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = 0;
}
return fieldsCount(cls, i);
}
private static final int fieldsCount(Class<?> cls, int i) {
do {
int length = cls.getDeclaredFields().length;
int i2 = 0;
for (int i3 = 0; i3 < length; i3++) {
if (!Modifier.isStatic(r0[i3].getModifiers())) {
i2++;
}
}
i += i2;
cls = cls.getSuperclass();
} while (cls != null);
return i;
}
}

View File

@ -0,0 +1,198 @@
package kotlinx.coroutines.internal;
import androidx.core.app.NotificationCompat;
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;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.io.CloseableKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
/* compiled from: FastServiceLoader.kt */
@Metadata(d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J!\u0010\u0005\u001a\u0004\u0018\u00010\u00062\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\u00060\b2\u0006\u0010\t\u001a\u00020\u0004H\u0082\bJ1\u0010\n\u001a\u0002H\u000b\"\u0004\b\u0000\u0010\u000b2\u0006\u0010\f\u001a\u00020\u00042\u0006\u0010\r\u001a\u00020\u000e2\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u0002H\u000b0\bH\u0002¢\u0006\u0002\u0010\u0010J*\u0010\u0011\u001a\b\u0012\u0004\u0012\u0002H\u000b0\u0012\"\u0004\b\u0000\u0010\u000b2\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u0002H\u000b0\b2\u0006\u0010\r\u001a\u00020\u000eH\u0002J\u0013\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00060\u0012H\u0000¢\u0006\u0002\b\u0014J/\u0010\u0015\u001a\b\u0012\u0004\u0012\u0002H\u000b0\u0012\"\u0004\b\u0000\u0010\u000b2\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u0002H\u000b0\b2\u0006\u0010\r\u001a\u00020\u000eH\u0000¢\u0006\u0002\b\u0016J\u0016\u0010\u0017\u001a\b\u0012\u0004\u0012\u00020\u00040\u00122\u0006\u0010\u0018\u001a\u00020\u0019H\u0002J\u0016\u0010\u001a\u001a\b\u0012\u0004\u0012\u00020\u00040\u00122\u0006\u0010\u001b\u001a\u00020\u001cH\u0002J,\u0010\u001d\u001a\u0002H\u001e\"\u0004\b\u0000\u0010\u001e*\u00020\u001f2\u0012\u0010 \u001a\u000e\u0012\u0004\u0012\u00020\u001f\u0012\u0004\u0012\u0002H\u001e0!H\u0082\\u0006\u0002\u0010\"R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006#"}, d2 = {"Lkotlinx/coroutines/internal/FastServiceLoader;", "", "()V", "PREFIX", "", "createInstanceOf", "Lkotlinx/coroutines/internal/MainDispatcherFactory;", "baseClass", "Ljava/lang/Class;", "serviceClass", "getProviderInstance", "S", "name", "loader", "Ljava/lang/ClassLoader;", NotificationCompat.CATEGORY_SERVICE, "(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/Class;)Ljava/lang/Object;", "load", "", "loadMainDispatcherFactory", "loadMainDispatcherFactory$kotlinx_coroutines_core", "loadProviders", "loadProviders$kotlinx_coroutines_core", "parse", "url", "Ljava/net/URL;", "parseFile", "r", "Ljava/io/BufferedReader;", "use", "R", "Ljava/util/jar/JarFile;", "block", "Lkotlin/Function1;", "(Ljava/util/jar/JarFile;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class FastServiceLoader {
public static final FastServiceLoader INSTANCE = new FastServiceLoader();
private static final String PREFIX = "META-INF/services/";
private FastServiceLoader() {
}
public final List<MainDispatcherFactory> 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) {
arrayList.add(mainDispatcherFactory2);
}
return arrayList;
} catch (Throwable unused3) {
return load(MainDispatcherFactory.class, MainDispatcherFactory.class.getClassLoader());
}
}
private final MainDispatcherFactory createInstanceOf(Class<MainDispatcherFactory> baseClass, String serviceClass) {
try {
return baseClass.cast(Class.forName(serviceClass, true, baseClass.getClassLoader()).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
} catch (ClassNotFoundException unused) {
return null;
}
}
private final <S> List<S> load(Class<S> service, ClassLoader loader) {
try {
return loadProviders$kotlinx_coroutines_core(service, loader);
} catch (Throwable unused) {
return CollectionsKt.toList(ServiceLoader.load(service, loader));
}
}
public final <S> List<S> loadProviders$kotlinx_coroutines_core(Class<S> service, ClassLoader loader) {
ArrayList list = Collections.list(loader.getResources(PREFIX + service.getName()));
Intrinsics.checkNotNullExpressionValue(list, "list(this)");
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
CollectionsKt.addAll(arrayList, INSTANCE.parse((URL) it.next()));
}
Set set = CollectionsKt.toSet(arrayList);
if (!(!set.isEmpty())) {
throw new IllegalArgumentException("No providers were loaded with FastServiceLoader".toString());
}
Set set2 = set;
ArrayList arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(set2, 10));
Iterator it2 = set2.iterator();
while (it2.hasNext()) {
arrayList2.add(INSTANCE.getProviderInstance((String) it2.next(), loader, service));
}
return arrayList2;
}
private final <S> S getProviderInstance(String name, ClassLoader loader, Class<S> service) {
Class<?> cls = Class.forName(name, false, loader);
if (!service.isAssignableFrom(cls)) {
throw new IllegalArgumentException(("Expected service of class " + service + ", but found " + cls).toString());
}
return service.cast(cls.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
}
private final List<String> parse(URL url) {
BufferedReader bufferedReader;
String url2 = url.toString();
if (StringsKt.startsWith$default(url2, "jar", false, 2, (Object) null)) {
String substringBefore$default = StringsKt.substringBefore$default(StringsKt.substringAfter$default(url2, "jar:file:", (String) null, 2, (Object) null), '!', (String) null, 2, (Object) null);
String substringAfter$default = 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$default)), "UTF-8"));
try {
List<String> 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.addSuppressed(th, th3);
throw th;
}
}
}
} else {
bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
try {
List<String> parseFile2 = INSTANCE.parseFile(bufferedReader);
CloseableKt.closeFinally(bufferedReader, null);
return parseFile2;
} catch (Throwable th4) {
try {
throw th4;
} finally {
}
}
}
}
private final <R> R use(JarFile jarFile, Function1<? super JarFile, ? extends R> function1) {
try {
R invoke = function1.invoke(jarFile);
InlineMarker.finallyStart(1);
jarFile.close();
InlineMarker.finallyEnd(1);
return invoke;
} catch (Throwable th) {
try {
throw th;
} catch (Throwable th2) {
InlineMarker.finallyStart(1);
try {
jarFile.close();
InlineMarker.finallyEnd(1);
throw th2;
} catch (Throwable th3) {
ExceptionsKt.addSuppressed(th, th3);
throw th;
}
}
}
}
private final List<String> parseFile(BufferedReader r) {
LinkedHashSet linkedHashSet = new LinkedHashSet();
while (true) {
String readLine = r.readLine();
if (readLine != null) {
String obj = StringsKt.trim((CharSequence) StringsKt.substringBefore$default(readLine, "#", (String) null, 2, (Object) null)).toString();
String str = obj;
for (int i = 0; i < str.length(); i++) {
char charAt = str.charAt(i);
if (charAt != '.' && !Character.isJavaIdentifierPart(charAt)) {
throw new IllegalArgumentException(("Illegal service provider class name: " + obj).toString());
}
}
if (str.length() > 0) {
linkedHashSet.add(obj);
}
} else {
return CollectionsKt.toList(linkedHashSet);
}
}
}
}

View File

@ -0,0 +1,28 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.ResultKt;
/* compiled from: FastServiceLoader.kt */
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\"\u0014\u0010\u0000\u001a\u00020\u0001X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"ANDROID_DETECTED", "", "getANDROID_DETECTED", "()Z", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class FastServiceLoaderKt {
private static final boolean ANDROID_DETECTED;
public static final boolean getANDROID_DETECTED() {
return ANDROID_DETECTED;
}
static {
Object m288constructorimpl;
try {
Result.Companion companion = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(Class.forName("android.os.Build"));
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
m288constructorimpl = Result.m288constructorimpl(ResultKt.createFailure(th));
}
ANDROID_DETECTED = Result.m295isSuccessimpl(m288constructorimpl);
}
}

View File

@ -0,0 +1,122 @@
package kotlinx.coroutines.internal;
import java.util.ArrayList;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.JvmInline;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.DebugKt;
/* compiled from: InlineList.kt */
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0081@\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002B\u0016\u0012\n\b\u0002\u0010\u0003\u001a\u0004\u0018\u00010\u0002ø\u0001\u0000¢\u0006\u0004\b\u0004\u0010\u0005J\u001a\u0010\u0006\u001a\u00020\u00072\b\u0010\b\u001a\u0004\u0018\u00010\u0002HÖ\u0003¢\u0006\u0004\b\t\u0010\nJ$\u0010\u000b\u001a\u00020\f2\u0012\u0010\r\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\f0\u000eH\u0086\\u0006\u0004\b\u000f\u0010\u0010J\u0010\u0010\u0011\u001a\u00020\u0012HÖ\u0001¢\u0006\u0004\b\u0013\u0010\u0014J'\u0010\u0015\u001a\b\u0012\u0004\u0012\u00028\u00000\u00002\u0006\u0010\u0016\u001a\u00028\u0000H\u0086\u0002ø\u0001\u0001ø\u0001\u0002ø\u0001\u0000¢\u0006\u0004\b\u0017\u0010\u0018J\u0010\u0010\u0019\u001a\u00020\u001aHÖ\u0001¢\u0006\u0004\b\u001b\u0010\u001cR\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0002X\u0082\u0004¢\u0006\u0002\n\u0000\u0088\u0001\u0003\u0092\u0001\u0004\u0018\u00010\u0002ø\u0001\u0000\u0082\u0002\u000f\n\u0002\b\u0019\n\u0002\b!\n\u0005\\u001e0\u0001¨\u0006\u001d"}, d2 = {"Lkotlinx/coroutines/internal/InlineList;", "E", "", "holder", "constructor-impl", "(Ljava/lang/Object;)Ljava/lang/Object;", "equals", "", "other", "equals-impl", "(Ljava/lang/Object;Ljava/lang/Object;)Z", "forEachReversed", "", "action", "Lkotlin/Function1;", "forEachReversed-impl", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)V", "hashCode", "", "hashCode-impl", "(Ljava/lang/Object;)I", "plus", "element", "plus-FjFbRPM", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", "toString", "", "toString-impl", "(Ljava/lang/Object;)Ljava/lang/String;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
@JvmInline
/* loaded from: classes.dex */
public final class InlineList<E> {
private final Object holder;
/* renamed from: box-impl, reason: not valid java name */
public static final /* synthetic */ InlineList m1896boximpl(Object obj) {
return new InlineList(obj);
}
/* renamed from: constructor-impl, reason: not valid java name */
public static <E> Object m1897constructorimpl(Object obj) {
return obj;
}
/* renamed from: equals-impl, reason: not valid java name */
public static boolean m1899equalsimpl(Object obj, Object obj2) {
return (obj2 instanceof InlineList) && Intrinsics.areEqual(obj, ((InlineList) obj2).getHolder());
}
/* renamed from: equals-impl0, reason: not valid java name */
public static final boolean m1900equalsimpl0(Object obj, Object obj2) {
return Intrinsics.areEqual(obj, obj2);
}
/* renamed from: hashCode-impl, reason: not valid java name */
public static int m1902hashCodeimpl(Object obj) {
if (obj == null) {
return 0;
}
return obj.hashCode();
}
/* renamed from: toString-impl, reason: not valid java name */
public static String m1904toStringimpl(Object obj) {
return "InlineList(holder=" + obj + ')';
}
public boolean equals(Object obj) {
return m1899equalsimpl(this.holder, obj);
}
public int hashCode() {
return m1902hashCodeimpl(this.holder);
}
public String toString() {
return m1904toStringimpl(this.holder);
}
/* renamed from: unbox-impl, reason: not valid java name and from getter */
public final /* synthetic */ Object getHolder() {
return this.holder;
}
private /* synthetic */ InlineList(Object obj) {
this.holder = obj;
}
/* renamed from: constructor-impl$default, reason: not valid java name */
public static /* synthetic */ Object m1898constructorimpl$default(Object obj, int i, DefaultConstructorMarker defaultConstructorMarker) {
if ((i & 1) != 0) {
obj = null;
}
return m1897constructorimpl(obj);
}
/* renamed from: plus-FjFbRPM, reason: not valid java name */
public static final Object m1903plusFjFbRPM(Object obj, E e) {
if (DebugKt.getASSERTIONS_ENABLED() && !(!(e instanceof List))) {
throw new AssertionError();
}
if (obj == null) {
return m1897constructorimpl(e);
}
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(e);
return m1897constructorimpl(obj);
}
ArrayList arrayList = new ArrayList(4);
arrayList.add(obj);
arrayList.add(e);
return m1897constructorimpl(arrayList);
}
/* renamed from: forEachReversed-impl, reason: not valid java name */
public static final void m1901forEachReversedimpl(Object obj, Function1<? super E, Unit> function1) {
if (obj == null) {
return;
}
if (!(obj instanceof ArrayList)) {
function1.invoke(obj);
return;
}
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 arrayList = (ArrayList) obj;
int size = arrayList.size();
while (true) {
size--;
if (-1 >= size) {
return;
} else {
function1.invoke((Object) arrayList.get(size));
}
}
}
}

View File

@ -0,0 +1,11 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: InternalAnnotations.kt */
@Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000*\f\b\u0000\u0010\u0000\"\u00020\u00012\u00020\u0001¨\u0006\u0002"}, d2 = {"IgnoreJreRequirement", "Lorg/codehaus/mojo/animal_sniffer/IgnoreJRERequirement;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class InternalAnnotationsKt {
public static /* synthetic */ void IgnoreJreRequirement$annotations() {
}
}

View File

@ -0,0 +1,159 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
import kotlinx.coroutines.DefaultExecutorKt;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.DisposableHandle;
/* compiled from: LimitedDispatcher.kt */
@Metadata(d1 = {"\u0000n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0000\u0018\u00002\u00020\u00012\u00020\u0002:\u0001(B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0001\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0019\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0097Aø\u0001\u0000¢\u0006\u0002\u0010\u0014J\u001c\u0010\u0015\u001a\u00020\u00112\u0006\u0010\u0016\u001a\u00020\u00172\n\u0010\u0018\u001a\u00060\tj\u0002`\nH\u0016J-\u0010\u0019\u001a\u00020\u00112\n\u0010\u0018\u001a\u00060\tj\u0002`\n2\u0016\u0010\u001a\u001a\u0012\u0012\b\u0012\u00060\u001cR\u00020\u0000\u0012\u0004\u0012\u00020\u00110\u001bH\u0082\bJ\u001c\u0010\u001d\u001a\u00020\u00112\u0006\u0010\u0016\u001a\u00020\u00172\n\u0010\u0018\u001a\u00060\tj\u0002`\nH\u0017J%\u0010\u001e\u001a\u00020\u001f2\u0006\u0010 \u001a\u00020\u00132\n\u0010\u0018\u001a\u00060\tj\u0002`\n2\u0006\u0010\u0016\u001a\u00020\u0017H\u0096\u0001J\u0010\u0010!\u001a\u00020\u00012\u0006\u0010\u0004\u001a\u00020\u0005H\u0017J\u0010\u0010\"\u001a\n\u0018\u00010\tj\u0004\u0018\u0001`\nH\u0002J\u001f\u0010#\u001a\u00020\u00112\u0006\u0010 \u001a\u00020\u00132\f\u0010$\u001a\b\u0012\u0004\u0012\u00020\u00110%H\u0096\u0001J\b\u0010&\u001a\u00020'H\u0002R\u000e\u0010\u0003\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\u0007\u001a\f\u0012\b\u0012\u00060\tj\u0002`\n0\bX\u0082\u0004¢\u0006\u0002\n\u0000R\t\u0010\u000b\u001a\u00020\fX\u0082\u0004R\u0012\u0010\r\u001a\u00060\u000ej\u0002`\u000fX\u0082\u0004¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006)"}, d2 = {"Lkotlinx/coroutines/internal/LimitedDispatcher;", "Lkotlinx/coroutines/CoroutineDispatcher;", "Lkotlinx/coroutines/Delay;", "dispatcher", "parallelism", "", "(Lkotlinx/coroutines/CoroutineDispatcher;I)V", "queue", "Lkotlinx/coroutines/internal/LockFreeTaskQueue;", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "runningWorkers", "Lkotlinx/atomicfu/AtomicInt;", "workerAllocationLock", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "delay", "", "time", "", "(JLkotlin/coroutines/Continuation;)Ljava/lang/Object;", "dispatch", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "dispatchInternal", "startWorker", "Lkotlin/Function1;", "Lkotlinx/coroutines/internal/LimitedDispatcher$Worker;", "dispatchYield", "invokeOnTimeout", "Lkotlinx/coroutines/DisposableHandle;", "timeMillis", "limitedParallelism", "obtainTaskOrDeallocateWorker", "scheduleResumeAfterDelay", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "tryAllocateWorker", "", "Worker", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class LimitedDispatcher extends CoroutineDispatcher implements Delay {
private static final AtomicIntegerFieldUpdater runningWorkers$FU = AtomicIntegerFieldUpdater.newUpdater(LimitedDispatcher.class, "runningWorkers");
private final /* synthetic */ Delay $$delegate_0;
private final CoroutineDispatcher dispatcher;
private final int parallelism;
private final LockFreeTaskQueue<Runnable> queue;
@Volatile
private volatile int runningWorkers;
private final Object workerAllocationLock;
@Override // kotlinx.coroutines.Delay
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated without replacement as an internal method never intended for public use")
public Object delay(long j, Continuation<? super Unit> continuation) {
return this.$$delegate_0.delay(j, continuation);
}
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long timeMillis, Runnable block, CoroutineContext context) {
return this.$$delegate_0.invokeOnTimeout(timeMillis, block, context);
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo1908scheduleResumeAfterDelay(long timeMillis, CancellableContinuation<? super Unit> continuation) {
this.$$delegate_0.mo1908scheduleResumeAfterDelay(timeMillis, continuation);
}
/* 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 parallelism) {
LimitedDispatcherKt.checkParallelism(parallelism);
if (parallelism >= this.parallelism) {
return this;
}
return super.limitedParallelism(parallelism);
}
private final void dispatchInternal(Runnable block, Function1<? super Worker, Unit> startWorker) {
Runnable obtainTaskOrDeallocateWorker;
this.queue.addLast(block);
if (runningWorkers$FU.get(this) < this.parallelism && tryAllocateWorker() && (obtainTaskOrDeallocateWorker = obtainTaskOrDeallocateWorker()) != null) {
startWorker.invoke(new Worker(obtainTaskOrDeallocateWorker));
}
}
/* JADX INFO: Access modifiers changed from: private */
public final Runnable obtainTaskOrDeallocateWorker() {
while (true) {
Runnable removeFirstOrNull = this.queue.removeFirstOrNull();
if (removeFirstOrNull != null) {
return removeFirstOrNull;
}
synchronized (this.workerAllocationLock) {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = runningWorkers$FU;
atomicIntegerFieldUpdater.decrementAndGet(this);
if (this.queue.getSize() == 0) {
return null;
}
atomicIntegerFieldUpdater.incrementAndGet(this);
}
}
}
/* compiled from: LimitedDispatcher.kt */
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\b\u0082\u0004\u0018\u00002\u00060\u0001j\u0002`\u0002B\u0011\u0012\n\u0010\u0003\u001a\u00060\u0001j\u0002`\u0002¢\u0006\u0002\u0010\u0004J\b\u0010\u0005\u001a\u00020\u0006H\u0016R\u0012\u0010\u0003\u001a\u00060\u0001j\u0002`\u0002X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0007"}, d2 = {"Lkotlinx/coroutines/internal/LimitedDispatcher$Worker;", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "currentTask", "(Lkotlinx/coroutines/internal/LimitedDispatcher;Ljava/lang/Runnable;)V", "run", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
private final class Worker implements Runnable {
private 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.mo1907dispatch(LimitedDispatcher.this, this);
return;
}
}
}
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo1907dispatch(CoroutineContext context, Runnable block) {
Runnable obtainTaskOrDeallocateWorker;
this.queue.addLast(block);
if (runningWorkers$FU.get(this) >= this.parallelism || !tryAllocateWorker() || (obtainTaskOrDeallocateWorker = obtainTaskOrDeallocateWorker()) == null) {
return;
}
this.dispatcher.mo1907dispatch(this, new Worker(obtainTaskOrDeallocateWorker));
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public void dispatchYield(CoroutineContext context, Runnable block) {
Runnable obtainTaskOrDeallocateWorker;
this.queue.addLast(block);
if (runningWorkers$FU.get(this) >= this.parallelism || !tryAllocateWorker() || (obtainTaskOrDeallocateWorker = obtainTaskOrDeallocateWorker()) == null) {
return;
}
this.dispatcher.dispatchYield(this, new Worker(obtainTaskOrDeallocateWorker));
}
private final boolean tryAllocateWorker() {
synchronized (this.workerAllocationLock) {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = runningWorkers$FU;
if (atomicIntegerFieldUpdater.get(this) >= this.parallelism) {
return false;
}
atomicIntegerFieldUpdater.incrementAndGet(this);
return true;
}
}
}

View File

@ -0,0 +1,15 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: LimitedDispatcher.kt */
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0002\u0010\b\n\u0000\u001a\f\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0000¨\u0006\u0003"}, d2 = {"checkParallelism", "", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final 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,11 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: LocalAtomics.kt */
@Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000*\f\b\u0000\u0010\u0000\"\u00020\u00012\u00020\u0001¨\u0006\u0002"}, d2 = {"LocalAtomicInt", "Ljava/util/concurrent/atomic/AtomicInteger;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class LocalAtomicsKt {
public static /* synthetic */ void LocalAtomicInt$annotations() {
}
}

View File

@ -0,0 +1,17 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.atomic.AtomicInteger;
import kotlin.Metadata;
/* compiled from: LocalAtomics.common.kt */
@Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\".\u0010\u0000\u001a\u00020\u0001*\u00060\u0002j\u0002`\u00032\u0006\u0010\u0000\u001a\u00020\u00018À\u0002@À\u0002X\u0080\u000e¢\u0006\f\u001a\u0004\b\u0004\u0010\u0005\"\u0004\b\u0006\u0010\u0007¨\u0006\b"}, d2 = {"value", "", "Ljava/util/concurrent/atomic/AtomicInteger;", "Lkotlinx/coroutines/internal/LocalAtomicInt;", "getValue", "(Ljava/util/concurrent/atomic/AtomicInteger;)I", "setValue", "(Ljava/util/concurrent/atomic/AtomicInteger;I)V", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class LocalAtomics_commonKt {
public static final int getValue(AtomicInteger atomicInteger) {
return atomicInteger.get();
}
public static final void setValue(AtomicInteger atomicInteger, int i) {
atomicInteger.set(i);
}
}

View File

@ -0,0 +1,63 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: LockFreeLinkedList.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0001\n\u0002\b\u0003\b\u0016\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J-\u0010\u0007\u001a\u00020\b\"\u000e\b\u0000\u0010\t\u0018\u0001*\u00060\u0001j\u0002`\n2\u0012\u0010\u000b\u001a\u000e\u0012\u0004\u0012\u0002H\t\u0012\u0004\u0012\u00020\b0\fH\u0086\bJ\u0010\u0010\r\u001a\n\u0018\u00010\u0001j\u0004\u0018\u0001`\nH\u0014J\u0006\u0010\u000e\u001a\u00020\u000fJ\r\u0010\u0010\u001a\u00020\bH\u0000¢\u0006\u0002\b\u0011R\u0011\u0010\u0003\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u0003\u0010\u0005R\u0014\u0010\u0006\u001a\u00020\u00048VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0006\u0010\u0005¨\u0006\u0012"}, d2 = {"Lkotlinx/coroutines/internal/LockFreeLinkedListHead;", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "()V", "isEmpty", "", "()Z", "isRemoved", "forEach", "", "T", "Lkotlinx/coroutines/internal/Node;", "block", "Lkotlin/Function1;", "nextIfRemoved", "remove", "", "validate", "validate$kotlinx_coroutines_core", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public class LockFreeLinkedListHead extends LockFreeLinkedListNode {
@Override // kotlinx.coroutines.internal.LockFreeLinkedListNode
public boolean isRemoved() {
return false;
}
@Override // kotlinx.coroutines.internal.LockFreeLinkedListNode
protected LockFreeLinkedListNode nextIfRemoved() {
return null;
}
@Override // kotlinx.coroutines.internal.LockFreeLinkedListNode
/* renamed from: remove, reason: collision with other method in class */
public /* bridge */ /* synthetic */ boolean mo1906remove() {
return ((Boolean) remove()).booleanValue();
}
public final boolean isEmpty() {
return getNext() == this;
}
public final /* synthetic */ <T extends LockFreeLinkedListNode> void forEach(Function1<? super T, Unit> block) {
Object next = getNext();
Intrinsics.checkNotNull(next, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeLinkedListNode{ kotlinx.coroutines.internal.LockFreeLinkedListKt.Node }");
for (LockFreeLinkedListNode lockFreeLinkedListNode = (LockFreeLinkedListNode) next; !Intrinsics.areEqual(lockFreeLinkedListNode, this); lockFreeLinkedListNode = lockFreeLinkedListNode.getNextNode()) {
Intrinsics.reifiedOperationMarker(3, "T");
if (lockFreeLinkedListNode instanceof LockFreeLinkedListNode) {
block.invoke(lockFreeLinkedListNode);
}
}
}
public final Void remove() {
throw new IllegalStateException("head cannot be removed".toString());
}
public final void validate$kotlinx_coroutines_core() {
Object next = getNext();
Intrinsics.checkNotNull(next, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeLinkedListNode{ kotlinx.coroutines.internal.LockFreeLinkedListKt.Node }");
LockFreeLinkedListNode lockFreeLinkedListNode = (LockFreeLinkedListNode) next;
LockFreeLinkedListNode lockFreeLinkedListNode2 = this;
LockFreeLinkedListNode lockFreeLinkedListNode3 = lockFreeLinkedListNode;
while (!Intrinsics.areEqual(lockFreeLinkedListNode3, this)) {
LockFreeLinkedListNode nextNode = lockFreeLinkedListNode3.getNextNode();
lockFreeLinkedListNode3.validateNode$kotlinx_coroutines_core(lockFreeLinkedListNode2, nextNode);
lockFreeLinkedListNode2 = lockFreeLinkedListNode3;
lockFreeLinkedListNode3 = nextNode;
}
Object next2 = getNext();
Intrinsics.checkNotNull(next2, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeLinkedListNode{ kotlinx.coroutines.internal.LockFreeLinkedListKt.Node }");
validateNode$kotlinx_coroutines_core(lockFreeLinkedListNode2, (LockFreeLinkedListNode) next2);
}
}

View File

@ -0,0 +1,40 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: LockFreeLinkedList.kt */
@Metadata(d1 = {"\u0000\u001e\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0010\u0010\r\u001a\u00060\u000ej\u0002`\u000f*\u00020\u0001H\u0001\"\u001c\u0010\u0000\u001a\u00020\u00018\u0000X\u0081\u0004¢\u0006\u000e\n\u0000\u0012\u0004\b\u0002\u0010\u0003\u001a\u0004\b\u0004\u0010\u0005\"\u0016\u0010\u0006\u001a\u00020\u00078\u0000X\u0081T¢\u0006\b\n\u0000\u0012\u0004\b\b\u0010\u0003\"\u0016\u0010\t\u001a\u00020\u00078\u0000X\u0081T¢\u0006\b\n\u0000\u0012\u0004\b\n\u0010\u0003\"\u0016\u0010\u000b\u001a\u00020\u00078\u0000X\u0081T¢\u0006\b\n\u0000\u0012\u0004\b\f\u0010\u0003*\f\b\u0002\u0010\u0010\"\u00020\u000e2\u00020\u000e¨\u0006\u0011"}, d2 = {"CONDITION_FALSE", "", "getCONDITION_FALSE$annotations", "()V", "getCONDITION_FALSE", "()Ljava/lang/Object;", "FAILURE", "", "getFAILURE$annotations", "SUCCESS", "getSUCCESS$annotations", "UNDECIDED", "getUNDECIDED$annotations", "unwrap", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "Lkotlinx/coroutines/internal/Node;", "Node", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class LockFreeLinkedListKt {
private static final Object CONDITION_FALSE = new Symbol("CONDITION_FALSE");
public static final int FAILURE = 2;
public static final int SUCCESS = 1;
public static final int UNDECIDED = 0;
public static final Object getCONDITION_FALSE() {
return CONDITION_FALSE;
}
public static /* synthetic */ void getCONDITION_FALSE$annotations() {
}
public static /* synthetic */ void getFAILURE$annotations() {
}
public static /* synthetic */ void getSUCCESS$annotations() {
}
public static /* synthetic */ void getUNDECIDED$annotations() {
}
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,26 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlinx.coroutines.internal.LockFreeLinkedListNode;
/* compiled from: LockFreeLinkedList.kt */
@Metadata(d1 = {"\u0000\u001b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0016\u0010\u0002\u001a\u0004\u0018\u00010\u00032\n\u0010\u0004\u001a\u00060\u0005j\u0002`\u0006H\u0016¨\u0006\u0007"}, d2 = {"kotlinx/coroutines/internal/LockFreeLinkedListNode$makeCondAddOp$1", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode$CondAddOp;", "prepare", "", "affected", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "Lkotlinx/coroutines/internal/Node;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 176)
/* loaded from: classes.dex */
public final class LockFreeLinkedListNode$makeCondAddOp$1 extends LockFreeLinkedListNode.CondAddOp {
final /* synthetic */ Function0<Boolean> $condition;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public LockFreeLinkedListNode$makeCondAddOp$1(LockFreeLinkedListNode lockFreeLinkedListNode, Function0<Boolean> function0) {
super(lockFreeLinkedListNode);
this.$condition = function0;
}
@Override // kotlinx.coroutines.internal.AtomicOp
public Object prepare(LockFreeLinkedListNode affected) {
if (this.$condition.invoke().booleanValue()) {
return null;
}
return LockFreeLinkedListKt.getCONDITION_FALSE();
}
}

View File

@ -0,0 +1,297 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.PropertyReference0Impl;
import kotlinx.coroutines.DebugKt;
import kotlinx.coroutines.DebugStringsKt;
/* compiled from: LockFreeLinkedList.kt */
@Metadata(d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\b\u0017\u0018\u00002\u00020\u0001:\u00010B\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0014\u001a\u00020\u00152\n\u0010\u0016\u001a\u00060\u0000j\u0002`\u000fJ%\u0010\u0017\u001a\u00020\t2\n\u0010\u0016\u001a\u00060\u0000j\u0002`\u000f2\u000e\b\u0004\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\t0\u0019H\u0086\bJ \u0010\u001a\u001a\u00020\t2\n\u0010\u0016\u001a\u00060\u0000j\u0002`\u000f2\n\u0010\u000b\u001a\u00060\u0000j\u0002`\u000fH\u0001J\u0012\u0010\u001b\u001a\u00020\t2\n\u0010\u0016\u001a\u00060\u0000j\u0002`\u000fJ\u001b\u0010\u001c\u001a\n\u0018\u00010\u0000j\u0004\u0018\u0001`\u000f2\b\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0082\u0010J\u0019\u0010\u001f\u001a\u00060\u0000j\u0002`\u000f2\n\u0010 \u001a\u00060\u0000j\u0002`\u000fH\u0082\u0010J\u0014\u0010!\u001a\u00020\u00152\n\u0010\u000b\u001a\u00060\u0000j\u0002`\u000fH\u0002J%\u0010\"\u001a\u00020#2\n\u0010\u0016\u001a\u00060\u0000j\u0002`\u000f2\u000e\b\u0004\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\t0\u0019H\u0081\bJ\u0010\u0010$\u001a\n\u0018\u00010\u0000j\u0004\u0018\u0001`\u000fH\u0014J\b\u0010%\u001a\u00020\tH\u0016J\u0010\u0010&\u001a\n\u0018\u00010\u0000j\u0004\u0018\u0001`\u000fH\u0001J\b\u0010'\u001a\u00020\u0007H\u0002J\b\u0010(\u001a\u00020)H\u0016J(\u0010*\u001a\u00020+2\n\u0010\u0016\u001a\u00060\u0000j\u0002`\u000f2\n\u0010\u000b\u001a\u00060\u0000j\u0002`\u000f2\u0006\u0010,\u001a\u00020#H\u0001J%\u0010-\u001a\u00020\u00152\n\u0010.\u001a\u00060\u0000j\u0002`\u000f2\n\u0010\u000b\u001a\u00060\u0000j\u0002`\u000fH\u0000¢\u0006\u0002\b/R\u000f\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00010\u0004X\u0082\u0004R\u000f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00000\u0004X\u0082\u0004R\u0011\u0010\u0006\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00070\u0004X\u0082\u0004R\u0014\u0010\b\u001a\u00020\t8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\b\u0010\nR\u0011\u0010\u000b\u001a\u00020\u00018F¢\u0006\u0006\u001a\u0004\b\f\u0010\rR\u0015\u0010\u000e\u001a\u00060\u0000j\u0002`\u000f8F¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u0011R\u0015\u0010\u0012\u001a\u00060\u0000j\u0002`\u000f8F¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0011¨\u00061"}, d2 = {"Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "", "()V", "_next", "Lkotlinx/atomicfu/AtomicRef;", "_prev", "_removedRef", "Lkotlinx/coroutines/internal/Removed;", "isRemoved", "", "()Z", "next", "getNext", "()Ljava/lang/Object;", "nextNode", "Lkotlinx/coroutines/internal/Node;", "getNextNode", "()Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "prevNode", "getPrevNode", "addLast", "", "node", "addLastIf", "condition", "Lkotlin/Function0;", "addNext", "addOneIfEmpty", "correctPrev", "op", "Lkotlinx/coroutines/internal/OpDescriptor;", "findPrevNonRemoved", "current", "finishAdd", "makeCondAddOp", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode$CondAddOp;", "nextIfRemoved", "remove", "removeOrNext", "removed", "toString", "", "tryCondAddNext", "", "condAdd", "validateNode", "prev", "validateNode$kotlinx_coroutines_core", "CondAddOp", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public class LockFreeLinkedListNode {
private static final AtomicReferenceFieldUpdater _next$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeLinkedListNode.class, Object.class, "_next");
private static final AtomicReferenceFieldUpdater _prev$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeLinkedListNode.class, Object.class, "_prev");
private static final AtomicReferenceFieldUpdater _removedRef$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeLinkedListNode.class, Object.class, "_removedRef");
@Volatile
private volatile Object _next = this;
@Volatile
private volatile Object _prev = this;
@Volatile
private volatile Object _removedRef;
private final void loop$atomicfu(AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Function1<Object, Unit> function1, Object obj) {
while (true) {
function1.invoke(atomicReferenceFieldUpdater.get(obj));
}
}
private 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;
}
/* compiled from: LockFreeLinkedList.kt */
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0000\b!\u0018\u00002\f\u0012\b\u0012\u00060\u0002j\u0002`\u00030\u0001B\u0011\u0012\n\u0010\u0004\u001a\u00060\u0002j\u0002`\u0003¢\u0006\u0002\u0010\u0005J\u001e\u0010\u0007\u001a\u00020\b2\n\u0010\t\u001a\u00060\u0002j\u0002`\u00032\b\u0010\n\u001a\u0004\u0018\u00010\u000bH\u0016R\u0014\u0010\u0004\u001a\u00060\u0002j\u0002`\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0006\u001a\n\u0018\u00010\u0002j\u0004\u0018\u0001`\u00038\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000¨\u0006\f"}, d2 = {"Lkotlinx/coroutines/internal/LockFreeLinkedListNode$CondAddOp;", "Lkotlinx/coroutines/internal/AtomicOp;", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "Lkotlinx/coroutines/internal/Node;", "newNode", "(Lkotlinx/coroutines/internal/LockFreeLinkedListNode;)V", "oldNext", "complete", "", "affected", "failure", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static abstract class CondAddOp extends AtomicOp<LockFreeLinkedListNode> {
public final LockFreeLinkedListNode newNode;
public LockFreeLinkedListNode oldNext;
public CondAddOp(LockFreeLinkedListNode lockFreeLinkedListNode) {
this.newNode = lockFreeLinkedListNode;
}
@Override // kotlinx.coroutines.internal.AtomicOp
public void complete(LockFreeLinkedListNode affected, Object failure) {
boolean z = failure == null;
LockFreeLinkedListNode lockFreeLinkedListNode = z ? this.newNode : this.oldNext;
if (lockFreeLinkedListNode != null && AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(LockFreeLinkedListNode._next$FU, affected, this, lockFreeLinkedListNode) && z) {
LockFreeLinkedListNode lockFreeLinkedListNode2 = this.newNode;
LockFreeLinkedListNode lockFreeLinkedListNode3 = this.oldNext;
Intrinsics.checkNotNull(lockFreeLinkedListNode3);
lockFreeLinkedListNode2.finishAdd(lockFreeLinkedListNode3);
}
}
}
public final CondAddOp makeCondAddOp(LockFreeLinkedListNode node, Function0<Boolean> condition) {
return new LockFreeLinkedListNode$makeCondAddOp$1(node, condition);
}
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;
}
private final LockFreeLinkedListNode findPrevNonRemoved(LockFreeLinkedListNode current) {
while (current.isRemoved()) {
current = (LockFreeLinkedListNode) _prev$FU.get(current);
}
return current;
}
public final boolean addOneIfEmpty(LockFreeLinkedListNode node) {
_prev$FU.lazySet(node, this);
_next$FU.lazySet(node, this);
while (getNext() == this) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, this, node)) {
node.finishAdd(this);
return true;
}
}
return false;
}
public final void addLast(LockFreeLinkedListNode node) {
while (!getPrevNode().addNext(node, this)) {
}
}
public final boolean addNext(LockFreeLinkedListNode node, LockFreeLinkedListNode next) {
_prev$FU.lazySet(node, this);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _next$FU;
atomicReferenceFieldUpdater.lazySet(node, next);
if (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, next, node)) {
return false;
}
node.finishAdd(next);
return true;
}
public final int tryCondAddNext(LockFreeLinkedListNode node, LockFreeLinkedListNode next, CondAddOp condAdd) {
_prev$FU.lazySet(node, this);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _next$FU;
atomicReferenceFieldUpdater.lazySet(node, next);
condAdd.oldNext = next;
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, next, condAdd)) {
return condAdd.perform(this) == null ? 1 : 2;
}
return 0;
}
/* renamed from: remove */
public boolean mo1906remove() {
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;
}
/* JADX INFO: Access modifiers changed from: private */
public final void finishAdd(LockFreeLinkedListNode next) {
LockFreeLinkedListNode lockFreeLinkedListNode;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _prev$FU;
do {
lockFreeLinkedListNode = (LockFreeLinkedListNode) atomicReferenceFieldUpdater.get(next);
if (getNext() != next) {
return;
}
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_prev$FU, next, lockFreeLinkedListNode, this));
if (isRemoved()) {
next.correctPrev(null);
}
}
protected LockFreeLinkedListNode nextIfRemoved() {
Object next = getNext();
Removed removed = next instanceof Removed ? (Removed) next : null;
if (removed != null) {
return removed.ref;
}
return 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
*/
private 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 final void validateNode$kotlinx_coroutines_core(LockFreeLinkedListNode prev, LockFreeLinkedListNode next) {
if (DebugKt.getASSERTIONS_ENABLED() && prev != _prev$FU.get(this)) {
throw new AssertionError();
}
if (DebugKt.getASSERTIONS_ENABLED() && next != _next$FU.get(this)) {
throw new AssertionError();
}
}
public String toString() {
return new PropertyReference0Impl(this) { // from class: kotlinx.coroutines.internal.LockFreeLinkedListNode$toString$1
@Override // kotlin.jvm.internal.PropertyReference0Impl, kotlin.reflect.KProperty0
public Object get() {
return DebugStringsKt.getClassSimpleName(this.receiver);
}
} + '@' + DebugStringsKt.getHexAddress(this);
}
public final boolean addLastIf(LockFreeLinkedListNode node, Function0<Boolean> condition) {
int tryCondAddNext;
LockFreeLinkedListNode$makeCondAddOp$1 lockFreeLinkedListNode$makeCondAddOp$1 = new LockFreeLinkedListNode$makeCondAddOp$1(node, condition);
do {
tryCondAddNext = getPrevNode().tryCondAddNext(node, this, lockFreeLinkedListNode$makeCondAddOp$1);
if (tryCondAddNext == 1) {
return true;
}
} while (tryCondAddNext != 2);
return false;
}
}

View File

@ -0,0 +1,85 @@
package kotlinx.coroutines.internal;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.List;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function1;
/* compiled from: LockFreeTaskQueue.kt */
@Metadata(d1 = {"\u0000D\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0010\u0018\u0000*\b\b\u0000\u0010\u0001*\u00020\u00022\u00020\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0013\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00028\u0000¢\u0006\u0002\u0010\u0012J\u0006\u0010\u0013\u001a\u00020\u0014J\u0006\u0010\u0015\u001a\u00020\u0004J&\u0010\u0016\u001a\b\u0012\u0004\u0012\u0002H\u00180\u0017\"\u0004\b\u0001\u0010\u00182\u0012\u0010\u0019\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u0002H\u00180\u001aJ\r\u0010\u001b\u001a\u0004\u0018\u00018\u0000¢\u0006\u0002\u0010\u001cR\u001f\u0010\u0006\u001a\u0018\u0012\u0014\u0012\u0012\u0012\u0004\u0012\u00028\u00000\bj\b\u0012\u0004\u0012\u00028\u0000`\t0\u0007X\u0082\u0004R\u0011\u0010\n\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\n\u0010\u000bR\u0011\u0010\f\u001a\u00020\r8F¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u000f¨\u0006\u001d"}, d2 = {"Lkotlinx/coroutines/internal/LockFreeTaskQueue;", "E", "", "singleConsumer", "", "(Z)V", "_cur", "Lkotlinx/atomicfu/AtomicRef;", "Lkotlinx/coroutines/internal/LockFreeTaskQueueCore;", "Lkotlinx/coroutines/internal/Core;", "isEmpty", "()Z", "size", "", "getSize", "()I", "addLast", "element", "(Ljava/lang/Object;)Z", "close", "", "isClosed", "map", "", "R", "transform", "Lkotlin/Function1;", "removeFirstOrNull", "()Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public class LockFreeTaskQueue<E> {
private static final AtomicReferenceFieldUpdater _cur$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeTaskQueue.class, Object.class, "_cur");
@Volatile
private volatile Object _cur;
private final void loop$atomicfu(AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Function1<Object, Unit> function1, Object obj) {
while (true) {
function1.invoke(atomicReferenceFieldUpdater.get(obj));
}
}
public LockFreeTaskQueue(boolean z) {
this._cur = new LockFreeTaskQueueCore(8, z);
}
public final boolean isEmpty() {
return ((LockFreeTaskQueueCore) _cur$FU.get(this)).isEmpty();
}
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(E element) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _cur$FU;
while (true) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
int addLast = lockFreeTaskQueueCore.addLast(element);
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 E removeFirstOrNull() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _cur$FU;
while (true) {
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
E e = (E) lockFreeTaskQueueCore.removeFirstOrNull();
if (e != LockFreeTaskQueueCore.REMOVE_FROZEN) {
return e;
}
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_cur$FU, this, lockFreeTaskQueueCore, lockFreeTaskQueueCore.next());
}
}
public final <R> List<R> map(Function1<? super E, ? extends R> transform) {
return ((LockFreeTaskQueueCore) _cur$FU.get(this)).map(transform);
}
public final boolean isClosed() {
return ((LockFreeTaskQueueCore) _cur$FU.get(this)).isClosed();
}
}

View File

@ -0,0 +1,390 @@
package kotlinx.coroutines.internal;
import android.R;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlinx.coroutines.DebugKt;
/* compiled from: LockFreeTaskQueue.kt */
@Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0010\t\n\u0002\b\u0007\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\b\u0000\u0018\u0000 ,*\b\b\u0000\u0010\u0001*\u00020\u00022\u00020\u0002:\u0002,-B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0013\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0016\u001a\u00028\u0000¢\u0006\u0002\u0010\u0017J \u0010\u0018\u001a\u0012\u0012\u0004\u0012\u00028\u00000\u0000j\b\u0012\u0004\u0012\u00028\u0000`\n2\u0006\u0010\u0019\u001a\u00020\u001aH\u0002J \u0010\u001b\u001a\u0012\u0012\u0004\u0012\u00028\u00000\u0000j\b\u0012\u0004\u0012\u00028\u0000`\n2\u0006\u0010\u0019\u001a\u00020\u001aH\u0002J\u0006\u0010\u001c\u001a\u00020\u0006J1\u0010\u001d\u001a\u0016\u0012\u0004\u0012\u00028\u0000\u0018\u00010\u0000j\n\u0012\u0004\u0012\u00028\u0000\u0018\u0001`\n2\u0006\u0010\u001e\u001a\u00020\u00042\u0006\u0010\u0016\u001a\u00028\u0000H\u0002¢\u0006\u0002\u0010\u001fJ\u0006\u0010 \u001a\u00020\u0006J&\u0010!\u001a\b\u0012\u0004\u0012\u0002H#0\"\"\u0004\b\u0001\u0010#2\u0012\u0010$\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u0002H#0%J\b\u0010&\u001a\u00020\u001aH\u0002J\f\u0010'\u001a\b\u0012\u0004\u0012\u00028\u00000\u0000J\b\u0010(\u001a\u0004\u0018\u00010\u0002J,\u0010)\u001a\u0016\u0012\u0004\u0012\u00028\u0000\u0018\u00010\u0000j\n\u0012\u0004\u0012\u00028\u0000\u0018\u0001`\n2\u0006\u0010*\u001a\u00020\u00042\u0006\u0010+\u001a\u00020\u0004H\u0002R#\u0010\b\u001a\u001c\u0012\u0018\u0012\u0016\u0012\u0004\u0012\u00028\u0000\u0018\u00010\u0000j\n\u0012\u0004\u0012\u00028\u0000\u0018\u0001`\n0\tX\u0082\u0004R\t\u0010\u000b\u001a\u00020\fX\u0082\u0004R\u0011\u0010\r\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00020\u000eX\u0082\u0004R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u000f\u001a\u00020\u00068F¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0010R\u000e\u0010\u0011\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0012\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0014¨\u0006."}, d2 = {"Lkotlinx/coroutines/internal/LockFreeTaskQueueCore;", "E", "", "capacity", "", "singleConsumer", "", "(IZ)V", "_next", "Lkotlinx/atomicfu/AtomicRef;", "Lkotlinx/coroutines/internal/Core;", "_state", "Lkotlinx/atomicfu/AtomicLong;", "array", "Lkotlinx/atomicfu/AtomicArray;", "isEmpty", "()Z", "mask", "size", "getSize", "()I", "addLast", "element", "(Ljava/lang/Object;)I", "allocateNextCopy", "state", "", "allocateOrGetNextCopy", "close", "fillPlaceholder", "index", "(ILjava/lang/Object;)Lkotlinx/coroutines/internal/LockFreeTaskQueueCore;", "isClosed", "map", "", "R", "transform", "Lkotlin/Function1;", "markFrozen", "next", "removeFirstOrNull", "removeSlowPath", "oldHead", "newHead", "Companion", "Placeholder", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class LockFreeTaskQueueCore<E> {
public static final int ADD_CLOSED = 2;
public static final int ADD_FROZEN = 1;
public static final int ADD_SUCCESS = 0;
public static final int CAPACITY_BITS = 30;
public static final long CLOSED_MASK = 2305843009213693952L;
public static final int CLOSED_SHIFT = 61;
public static final long FROZEN_MASK = 1152921504606846976L;
public static final int FROZEN_SHIFT = 60;
public static final long HEAD_MASK = 1073741823;
public static final int HEAD_SHIFT = 0;
public static final int INITIAL_CAPACITY = 8;
public static final int MAX_CAPACITY_MASK = 1073741823;
public static final int MIN_ADD_SPIN_CAPACITY = 1024;
public static final long TAIL_MASK = 1152921503533105152L;
public static final int TAIL_SHIFT = 30;
@Volatile
private volatile Object _next;
@Volatile
private volatile long _state;
private final AtomicReferenceArray array;
private final int capacity;
private final int mask;
private final boolean singleConsumer;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final AtomicReferenceFieldUpdater _next$FU = AtomicReferenceFieldUpdater.newUpdater(LockFreeTaskQueueCore.class, Object.class, "_next");
private static final AtomicLongFieldUpdater _state$FU = AtomicLongFieldUpdater.newUpdater(LockFreeTaskQueueCore.class, "_state");
public static final Symbol REMOVE_FROZEN = new Symbol("REMOVE_FROZEN");
private final void loop$atomicfu(AtomicLongFieldUpdater atomicLongFieldUpdater, Function1<? super Long, Unit> function1, Object obj) {
while (true) {
function1.invoke(Long.valueOf(atomicLongFieldUpdater.get(obj)));
}
}
private final void loop$atomicfu(AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Function1<Object, Unit> function1, Object obj) {
while (true) {
function1.invoke(atomicReferenceFieldUpdater.get(obj));
}
}
private final void update$atomicfu(AtomicLongFieldUpdater atomicLongFieldUpdater, Function1<? super Long, Long> function1, Object obj) {
long j;
do {
j = atomicLongFieldUpdater.get(obj);
} while (!atomicLongFieldUpdater.compareAndSet(obj, j, function1.invoke(Long.valueOf(j)).longValue()));
}
private final long updateAndGet$atomicfu(AtomicLongFieldUpdater atomicLongFieldUpdater, Function1<? super Long, Long> function1, Object obj) {
long j;
Long invoke;
do {
j = atomicLongFieldUpdater.get(obj);
invoke = function1.invoke(Long.valueOf(j));
} while (!atomicLongFieldUpdater.compareAndSet(obj, j, invoke.longValue()));
return invoke.longValue();
}
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) (HEAD_MASK & j)) == ((int) ((j & TAIL_MASK) >> 30));
}
public final int getSize() {
long j = _state$FU.get(this);
return 1073741823 & (((int) ((j & TAIL_MASK) >> 30)) - ((int) (HEAD_MASK & j)));
}
public final boolean close() {
long j;
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
do {
j = atomicLongFieldUpdater.get(this);
if ((j & CLOSED_MASK) != 0) {
return true;
}
if ((FROZEN_MASK & j) != 0) {
return false;
}
} while (!atomicLongFieldUpdater.compareAndSet(this, j, j | CLOSED_MASK));
return true;
}
/* JADX WARN: Code restructure failed: missing block: B:33:0x0050, 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(E r14) {
/*
r13 = this;
java.util.concurrent.atomic.AtomicLongFieldUpdater r0 = kotlinx.coroutines.internal.LockFreeTaskQueueCore._state$FU
L2:
long r3 = r0.get(r13)
r1 = 3458764513820540928(0x3000000000000000, double:1.727233711018889E-77)
long r1 = r1 & r3
r7 = 0
int r5 = (r1 > r7 ? 1 : (r1 == r7 ? 0 : -1))
if (r5 == 0) goto L16
kotlinx.coroutines.internal.LockFreeTaskQueueCore$Companion r14 = kotlinx.coroutines.internal.LockFreeTaskQueueCore.INSTANCE
int r14 = r14.addFailReason(r3)
return r14
L16:
kotlinx.coroutines.internal.LockFreeTaskQueueCore$Companion r1 = kotlinx.coroutines.internal.LockFreeTaskQueueCore.INSTANCE
r5 = 1073741823(0x3fffffff, double:5.304989472E-315)
long r5 = r5 & r3
int r2 = (int) r5
r5 = 1152921503533105152(0xfffffffc0000000, double:1.2882296003504729E-231)
long r5 = r5 & r3
r9 = 30
long r5 = r5 >> r9
int r9 = (int) r5
int r10 = r13.mask
int r5 = r9 + 2
r5 = r5 & r10
r6 = r2 & r10
r11 = 1
if (r5 != r6) goto L32
return r11
L32:
boolean r5 = r13.singleConsumer
r6 = 1073741823(0x3fffffff, float:1.9999999)
if (r5 != 0) goto L51
java.util.concurrent.atomic.AtomicReferenceArray r5 = r13.array
r12 = r9 & r10
java.lang.Object r5 = r5.get(r12)
if (r5 == 0) goto L51
int r1 = r13.capacity
r3 = 1024(0x400, float:1.435E-42)
if (r1 < r3) goto L50
int r9 = r9 - r2
r2 = r9 & r6
int r1 = r1 >> 1
if (r2 <= r1) goto L2
L50:
return r11
L51:
int r2 = r9 + 1
r2 = r2 & r6
java.util.concurrent.atomic.AtomicLongFieldUpdater r5 = kotlinx.coroutines.internal.LockFreeTaskQueueCore._state$FU
long r11 = r1.updateTail(r3, r2)
r1 = r5
r2 = r13
r5 = r11
boolean r1 = r1.compareAndSet(r2, r3, r5)
if (r1 == 0) goto L2
java.util.concurrent.atomic.AtomicReferenceArray r0 = r13.array
r1 = r9 & r10
r0.set(r1, r14)
r0 = r13
L6b:
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 r3 = (r1 > r7 ? 1 : (r1 == r7 ? 0 : -1))
if (r3 == 0) goto L82
kotlinx.coroutines.internal.LockFreeTaskQueueCore r0 = r0.next()
kotlinx.coroutines.internal.LockFreeTaskQueueCore r0 = r0.fillPlaceholder(r9, r14)
if (r0 != 0) goto L6b
L82:
r14 = 0
return r14
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.internal.LockFreeTaskQueueCore.addLast(java.lang.Object):int");
}
private final LockFreeTaskQueueCore<E> fillPlaceholder(int index, E element) {
Object obj = this.array.get(this.mask & index);
if (!(obj instanceof Placeholder) || ((Placeholder) obj).index != index) {
return null;
}
this.array.set(index & this.mask, element);
return this;
}
public final Object removeFirstOrNull() {
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
while (true) {
long j = atomicLongFieldUpdater.get(this);
if ((FROZEN_MASK & j) != 0) {
return REMOVE_FROZEN;
}
Companion companion = INSTANCE;
int i = (int) (HEAD_MASK & j);
int i2 = (int) ((TAIL_MASK & j) >> 30);
int i3 = this.mask;
if ((i2 & i3) == (i & i3)) {
return null;
}
Object obj = this.array.get(i3 & i);
if (obj == null) {
if (this.singleConsumer) {
return null;
}
} else {
if (obj instanceof Placeholder) {
return null;
}
int i4 = (i + 1) & MAX_CAPACITY_MASK;
if (_state$FU.compareAndSet(this, j, companion.updateHead(j, i4))) {
this.array.set(this.mask & i, null);
return obj;
}
if (this.singleConsumer) {
LockFreeTaskQueueCore<E> lockFreeTaskQueueCore = this;
do {
lockFreeTaskQueueCore = lockFreeTaskQueueCore.removeSlowPath(i, i4);
} while (lockFreeTaskQueueCore != null);
return obj;
}
}
}
}
private final LockFreeTaskQueueCore<E> removeSlowPath(int oldHead, int newHead) {
long j;
Companion companion;
int i;
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
do {
j = atomicLongFieldUpdater.get(this);
companion = INSTANCE;
i = (int) (HEAD_MASK & j);
if (DebugKt.getASSERTIONS_ENABLED() && i != oldHead) {
throw new AssertionError();
}
if ((FROZEN_MASK & j) != 0) {
return next();
}
} while (!_state$FU.compareAndSet(this, j, companion.updateHead(j, newHead)));
this.array.set(this.mask & i, null);
return null;
}
public final LockFreeTaskQueueCore<E> next() {
return allocateOrGetNextCopy(markFrozen());
}
private final long markFrozen() {
long j;
long j2;
AtomicLongFieldUpdater atomicLongFieldUpdater = _state$FU;
do {
j = atomicLongFieldUpdater.get(this);
if ((j & FROZEN_MASK) != 0) {
return j;
}
j2 = j | FROZEN_MASK;
} while (!atomicLongFieldUpdater.compareAndSet(this, j, j2));
return j2;
}
private final LockFreeTaskQueueCore<E> allocateOrGetNextCopy(long state) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _next$FU;
while (true) {
LockFreeTaskQueueCore<E> lockFreeTaskQueueCore = (LockFreeTaskQueueCore) atomicReferenceFieldUpdater.get(this);
if (lockFreeTaskQueueCore != null) {
return lockFreeTaskQueueCore;
}
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_next$FU, this, null, allocateNextCopy(state));
}
}
/* JADX WARN: Multi-variable type inference failed */
private final LockFreeTaskQueueCore<E> allocateNextCopy(long state) {
LockFreeTaskQueueCore<E> lockFreeTaskQueueCore = new LockFreeTaskQueueCore<>(this.capacity * 2, this.singleConsumer);
int i = (int) (HEAD_MASK & state);
int i2 = (int) ((TAIL_MASK & state) >> 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, INSTANCE.wo(state, FROZEN_MASK));
return lockFreeTaskQueueCore;
}
}
}
public final <R> List<R> map(Function1<? super E, ? extends R> transform) {
ArrayList arrayList = new ArrayList(this.capacity);
long j = _state$FU.get(this);
int i = (int) (HEAD_MASK & j);
int i2 = (int) ((j & TAIL_MASK) >> 30);
while (true) {
int i3 = this.mask;
if ((i & i3) != (i2 & i3)) {
R.anim animVar = (Object) this.array.get(i3 & i);
if (animVar != null && !(animVar instanceof Placeholder)) {
arrayList.add(transform.invoke(animVar));
}
i++;
} else {
return arrayList;
}
}
}
public final boolean isClosed() {
return (_state$FU.get(this) & CLOSED_MASK) != 0;
}
/* compiled from: LockFreeTaskQueue.kt */
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\b\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lkotlinx/coroutines/internal/LockFreeTaskQueueCore$Placeholder;", "", "index", "", "(I)V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Placeholder {
public final int index;
public Placeholder(int i) {
this.index = i;
}
}
/* compiled from: LockFreeTaskQueue.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\t\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0080\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\n\u0010\u0016\u001a\u00020\u0004*\u00020\tJ\u0012\u0010\u0017\u001a\u00020\t*\u00020\t2\u0006\u0010\u0018\u001a\u00020\u0004J\u0012\u0010\u0019\u001a\u00020\t*\u00020\t2\u0006\u0010\u001a\u001a\u00020\u0004JP\u0010\u001b\u001a\u0002H\u001c\"\u0004\b\u0001\u0010\u001c*\u00020\t26\u0010\u001d\u001a2\u0012\u0013\u0012\u00110\u0004¢\u0006\f\b\u001f\u0012\b\b \u0012\u0004\b\b(!\u0012\u0013\u0012\u00110\u0004¢\u0006\f\b\u001f\u0012\b\b \u0012\u0004\b\b(\"\u0012\u0004\u0012\u0002H\u001c0\u001eH\u0086\\u0006\u0002\u0010#J\u0015\u0010$\u001a\u00020\t*\u00020\t2\u0006\u0010%\u001a\u00020\tH\u0086\u0004R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\tX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\tX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u0010\u0010\u0012\u001a\u00020\u00138\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\tX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006&"}, d2 = {"Lkotlinx/coroutines/internal/LockFreeTaskQueueCore$Companion;", "", "()V", "ADD_CLOSED", "", "ADD_FROZEN", "ADD_SUCCESS", "CAPACITY_BITS", "CLOSED_MASK", "", "CLOSED_SHIFT", "FROZEN_MASK", "FROZEN_SHIFT", "HEAD_MASK", "HEAD_SHIFT", "INITIAL_CAPACITY", "MAX_CAPACITY_MASK", "MIN_ADD_SPIN_CAPACITY", "REMOVE_FROZEN", "Lkotlinx/coroutines/internal/Symbol;", "TAIL_MASK", "TAIL_SHIFT", "addFailReason", "updateHead", "newHead", "updateTail", "newTail", "withState", "T", "block", "Lkotlin/Function2;", "Lkotlin/ParameterName;", "name", "head", "tail", "(JLkotlin/jvm/functions/Function2;)Ljava/lang/Object;", "wo", "other", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final int addFailReason(long j) {
return (j & LockFreeTaskQueueCore.CLOSED_MASK) != 0 ? 2 : 1;
}
public final long wo(long j, long j2) {
return j & (~j2);
}
private Companion() {
}
public final long updateHead(long j, int i) {
return wo(j, LockFreeTaskQueueCore.HEAD_MASK) | i;
}
public final long updateTail(long j, int i) {
return wo(j, LockFreeTaskQueueCore.TAIL_MASK) | (i << 30);
}
public final <T> T withState(long j, Function2<? super Integer, ? super Integer, ? extends T> function2) {
return function2.invoke(Integer.valueOf((int) (LockFreeTaskQueueCore.HEAD_MASK & j)), Integer.valueOf((int) ((j & LockFreeTaskQueueCore.TAIL_MASK) >> 30)));
}
}
}

View File

@ -0,0 +1,9 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: LockFreeTaskQueue.kt */
@Metadata(d1 = {"\u0000\n\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000*\u001e\b\u0002\u0010\u0000\u001a\u0004\b\u0000\u0010\u0001\"\b\u0012\u0004\u0012\u0002H\u00010\u00022\b\u0012\u0004\u0012\u0002H\u00010\u0002¨\u0006\u0003"}, d2 = {"Core", "E", "Lkotlinx/coroutines/internal/LockFreeTaskQueueCore;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class LockFreeTaskQueueKt {
}

View File

@ -0,0 +1,25 @@
package kotlinx.coroutines.internal;
import java.util.List;
import kotlin.Metadata;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* compiled from: MainDispatcherFactory.kt */
@Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0000\n\u0002\u0010\u000e\n\u0000\bg\u0018\u00002\u00020\u0001J\u0016\u0010\u0006\u001a\u00020\u00072\f\u0010\b\u001a\b\u0012\u0004\u0012\u00020\u00000\tH&J\n\u0010\n\u001a\u0004\u0018\u00010\u000bH\u0016R\u0012\u0010\u0002\u001a\u00020\u0003X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0004\u0010\u0005¨\u0006\f"}, d2 = {"Lkotlinx/coroutines/internal/MainDispatcherFactory;", "", "loadPriority", "", "getLoadPriority", "()I", "createDispatcher", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "allFactories", "", "hintOnError", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public interface MainDispatcherFactory {
/* compiled from: MainDispatcherFactory.kt */
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
public static final class DefaultImpls {
public static String hintOnError(MainDispatcherFactory mainDispatcherFactory) {
return null;
}
}
MainCoroutineDispatcher createDispatcher(List<? extends MainDispatcherFactory> allFactories);
int getLoadPriority();
String hintOnError();
}

View File

@ -0,0 +1,56 @@
package kotlinx.coroutines.internal;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
import kotlin.Metadata;
import kotlin.sequences.SequencesKt;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* compiled from: MainDispatchers.kt */
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0007\u001a\u00020\u0006H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u00020\u00068\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\b"}, d2 = {"Lkotlinx/coroutines/internal/MainDispatcherLoader;", "", "()V", "FAST_SERVICE_LOADER_ENABLED", "", "dispatcher", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "loadMainDispatcher", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class MainDispatcherLoader {
private static final boolean FAST_SERVICE_LOADER_ENABLED;
public static final MainDispatcherLoader INSTANCE;
public static final MainCoroutineDispatcher dispatcher;
private MainDispatcherLoader() {
}
static {
MainDispatcherLoader mainDispatcherLoader = new MainDispatcherLoader();
INSTANCE = mainDispatcherLoader;
FAST_SERVICE_LOADER_ENABLED = SystemPropsKt.systemProp("kotlinx.coroutines.fast.service.loader", true);
dispatcher = mainDispatcherLoader.loadMainDispatcher();
}
private final MainCoroutineDispatcher loadMainDispatcher() {
Object next;
MainCoroutineDispatcher tryCreateDispatcher;
try {
List<MainDispatcherFactory> loadMainDispatcherFactory$kotlinx_coroutines_core = FAST_SERVICE_LOADER_ENABLED ? FastServiceLoader.INSTANCE.loadMainDispatcherFactory$kotlinx_coroutines_core() : SequencesKt.toList(SequencesKt.asSequence(ServiceLoader.load(MainDispatcherFactory.class, MainDispatcherFactory.class.getClassLoader()).iterator()));
Iterator<T> it = loadMainDispatcherFactory$kotlinx_coroutines_core.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, loadMainDispatcherFactory$kotlinx_coroutines_core)) == 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,54 @@
package kotlinx.coroutines.internal;
import java.util.List;
import kotlin.KotlinNothingValueException;
import kotlin.Metadata;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* compiled from: MainDispatchers.kt */
@Metadata(d1 = {"\u00006\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0010\u0001\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0000\u001a \u0010\u0006\u001a\u00020\u00072\n\b\u0002\u0010\b\u001a\u0004\u0018\u00010\t2\n\b\u0002\u0010\n\u001a\u0004\u0018\u00010\u0001H\u0002\u001a\b\u0010\u000b\u001a\u00020\fH\u0000\u001a\f\u0010\r\u001a\u00020\u0003*\u00020\u000eH\u0007\u001a\u001a\u0010\u000f\u001a\u00020\u000e*\u00020\u00102\f\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\u00100\u0012H\u0007\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u0014\u0010\u0002\u001a\u00020\u0003X\u0082D¢\u0006\b\n\u0000\u0012\u0004\b\u0004\u0010\u0005¨\u0006\u0013"}, d2 = {"FAST_SERVICE_LOADER_PROPERTY_NAME", "", "SUPPORT_MISSING", "", "getSUPPORT_MISSING$annotations", "()V", "createMissingDispatcher", "Lkotlinx/coroutines/internal/MissingMainCoroutineDispatcher;", "cause", "", "errorHint", "throwMissingMainDispatcherException", "", "isMissing", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "tryCreateDispatcher", "Lkotlinx/coroutines/internal/MainDispatcherFactory;", "factories", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class MainDispatchersKt {
private static final String FAST_SERVICE_LOADER_PROPERTY_NAME = "kotlinx.coroutines.fast.service.loader";
private static final boolean SUPPORT_MISSING = true;
private static /* synthetic */ void getSUPPORT_MISSING$annotations() {
}
public static final MainCoroutineDispatcher tryCreateDispatcher(MainDispatcherFactory mainDispatcherFactory, List<? extends MainDispatcherFactory> 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;
}
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);
}
private 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,135 @@
package kotlinx.coroutines.internal;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.KotlinNothingValueException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlinx.coroutines.CancellableContinuation;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.DisposableHandle;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* compiled from: MainDispatchers.kt */
@Metadata(d1 = {"\u0000^\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0010\u0001\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\u001b\u0012\b\u0010\u0003\u001a\u0004\u0018\u00010\u0004\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006¢\u0006\u0002\u0010\u0007J\u001c\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\n\u0010\u000f\u001a\u00060\u0010j\u0002`\u0011H\u0016J$\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u00152\n\u0010\u000f\u001a\u00060\u0010j\u0002`\u00112\u0006\u0010\r\u001a\u00020\u000eH\u0016J\u0010\u0010\u0016\u001a\u00020\u00172\u0006\u0010\r\u001a\u00020\u000eH\u0016J\u0010\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\u001bH\u0016J\b\u0010\u001c\u001a\u00020\fH\u0002J\u001e\u0010\u001d\u001a\u00020\f2\u0006\u0010\u0014\u001a\u00020\u00152\f\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020 0\u001fH\u0016J\b\u0010!\u001a\u00020\u0006H\u0016R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\u00020\u00018VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\\u0006\""}, d2 = {"Lkotlinx/coroutines/internal/MissingMainCoroutineDispatcher;", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "Lkotlinx/coroutines/Delay;", "cause", "", "errorHint", "", "(Ljava/lang/Throwable;Ljava/lang/String;)V", "immediate", "getImmediate", "()Lkotlinx/coroutines/MainCoroutineDispatcher;", "dispatch", "", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "invokeOnTimeout", "Lkotlinx/coroutines/DisposableHandle;", "timeMillis", "", "isDispatchNeeded", "", "limitedParallelism", "Lkotlinx/coroutines/CoroutineDispatcher;", "parallelism", "", "missing", "scheduleResumeAfterDelay", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "", "toString", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
final class MissingMainCoroutineDispatcher extends MainCoroutineDispatcher implements Delay {
private final Throwable cause;
private final String errorHint;
public /* synthetic */ MissingMainCoroutineDispatcher(Throwable th, String str, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(th, (i & 2) != 0 ? null : str);
}
@Override // kotlinx.coroutines.Delay
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated without replacement as an internal method never intended for public use")
public Object delay(long j, Continuation<? super Unit> continuation) {
return Delay.DefaultImpls.delay(this, j, continuation);
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay, reason: collision with other method in class */
public /* bridge */ /* synthetic */ void mo1908scheduleResumeAfterDelay(long j, CancellableContinuation cancellableContinuation) {
scheduleResumeAfterDelay(j, (CancellableContinuation<? super Unit>) cancellableContinuation);
}
public MissingMainCoroutineDispatcher(Throwable th, String str) {
this.cause = th;
this.errorHint = str;
}
@Override // kotlinx.coroutines.MainCoroutineDispatcher
public MainCoroutineDispatcher getImmediate() {
return this;
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public boolean isDispatchNeeded(CoroutineContext context) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.MainCoroutineDispatcher, kotlinx.coroutines.CoroutineDispatcher
public CoroutineDispatcher limitedParallelism(int parallelism) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long timeMillis, Runnable block, CoroutineContext context) {
missing();
throw new KotlinNothingValueException();
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch, reason: merged with bridge method [inline-methods] */
public Void mo1907dispatch(CoroutineContext context, Runnable block) {
missing();
throw new KotlinNothingValueException();
}
public Void scheduleResumeAfterDelay(long timeMillis, CancellableContinuation<? super Unit> continuation) {
missing();
throw new KotlinNothingValueException();
}
/* JADX WARN: Code restructure failed: missing block: B:6:0x001d, code lost:
if (r1 == null) goto L8;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final java.lang.Void missing() {
/*
r4 = this;
java.lang.Throwable r0 = r4.cause
if (r0 == 0) goto L30
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "Module with the Main dispatcher had failed to initialize"
r0.<init>(r1)
java.lang.String r1 = r4.errorHint
if (r1 == 0) goto L1f
java.lang.StringBuilder r2 = new java.lang.StringBuilder
java.lang.String r3 = ". "
r2.<init>(r3)
r2.append(r1)
java.lang.String r1 = r2.toString()
if (r1 != 0) goto L21
L1f:
java.lang.String r1 = ""
L21:
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
L30:
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.MainCoroutineDispatcher, kotlinx.coroutines.CoroutineDispatcher
public String toString() {
String str;
StringBuilder sb = new StringBuilder("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,31 @@
package kotlinx.coroutines.internal;
import java.util.List;
import kotlin.Metadata;
import kotlinx.coroutines.MainCoroutineDispatcher;
import kotlinx.coroutines.internal.MainDispatcherFactory;
/* compiled from: MainDispatchers.kt */
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0000\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0007\u001a\u00020\b2\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00010\nH\u0016R\u0014\u0010\u0003\u001a\u00020\u00048VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u000b"}, d2 = {"Lkotlinx/coroutines/internal/MissingMainCoroutineDispatcherFactory;", "Lkotlinx/coroutines/internal/MainDispatcherFactory;", "()V", "loadPriority", "", "getLoadPriority", "()I", "createDispatcher", "Lkotlinx/coroutines/MainCoroutineDispatcher;", "allFactories", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class MissingMainCoroutineDispatcherFactory implements MainDispatcherFactory {
public static final MissingMainCoroutineDispatcherFactory INSTANCE = new MissingMainCoroutineDispatcherFactory();
@Override // kotlinx.coroutines.internal.MainDispatcherFactory
public int getLoadPriority() {
return -1;
}
private MissingMainCoroutineDispatcherFactory() {
}
@Override // kotlinx.coroutines.internal.MainDispatcherFactory
public String hintOnError() {
return MainDispatcherFactory.DefaultImpls.hintOnError(this);
}
@Override // kotlinx.coroutines.internal.MainDispatcherFactory
public MainCoroutineDispatcher createDispatcher(List<? extends MainDispatcherFactory> allFactories) {
return new MissingMainCoroutineDispatcher(null, null, 2, null);
}
}

View File

@ -0,0 +1,115 @@
package kotlinx.coroutines.internal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceArray;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.IntIterator;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function1;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt;
/* compiled from: OnDemandAllocatingPool.kt */
@Metadata(d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010 \n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\b\u0000\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002B!\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0012\u0010\u0005\u001a\u000e\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00028\u00000\u0006¢\u0006\u0002\u0010\u0007J\u0006\u0010\f\u001a\u00020\rJ\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00028\u00000\u000fJ\r\u0010\u0010\u001a\u00020\u0011H\u0000¢\u0006\u0002\b\u0012J\b\u0010\u0013\u001a\u00020\u0011H\u0016J\t\u0010\u0014\u001a\u00020\u0004H\u0082\bJ\r\u0010\u0015\u001a\u00020\r*\u00020\u0004H\u0082\bR\t\u0010\b\u001a\u00020\tX\u0082\u0004R\u001a\u0010\u0005\u001a\u000e\u0012\u0004\u0012\u00020\u0004\u0012\u0004\u0012\u00028\u00000\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\n\u001a\n\u0012\u0006\u0012\u0004\u0018\u00018\u00000\u000bX\u0082\u0004R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"Lkotlinx/coroutines/internal/OnDemandAllocatingPool;", "T", "", "maxCapacity", "", "create", "Lkotlin/Function1;", "(ILkotlin/jvm/functions/Function1;)V", "controlState", "Lkotlinx/atomicfu/AtomicInt;", "elements", "Lkotlinx/atomicfu/AtomicArray;", "allocate", "", "close", "", "stateRepresentation", "", "stateRepresentation$kotlinx_coroutines_core", "toString", "tryForbidNewElements", "isClosed", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class OnDemandAllocatingPool<T> {
private static final AtomicIntegerFieldUpdater controlState$FU = AtomicIntegerFieldUpdater.newUpdater(OnDemandAllocatingPool.class, "controlState");
@Volatile
private volatile int controlState;
private final Function1<Integer, T> create;
private final AtomicReferenceArray elements;
private final int maxCapacity;
private final boolean isClosed(int i) {
return (i & Integer.MIN_VALUE) != 0;
}
private final void loop$atomicfu(AtomicIntegerFieldUpdater atomicIntegerFieldUpdater, Function1<? super Integer, Unit> function1, Object obj) {
while (true) {
function1.invoke(Integer.valueOf(atomicIntegerFieldUpdater.get(obj)));
}
}
/* JADX WARN: Multi-variable type inference failed */
public OnDemandAllocatingPool(int i, Function1<? super Integer, ? extends T> function1) {
this.maxCapacity = i;
this.create = function1;
this.elements = new AtomicReferenceArray(i);
}
private final int tryForbidNewElements() {
int i;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = controlState$FU;
do {
i = atomicIntegerFieldUpdater.get(this);
if ((i & Integer.MIN_VALUE) != 0) {
return 0;
}
} while (!controlState$FU.compareAndSet(this, i, Integer.MIN_VALUE | i));
return i;
}
public final boolean allocate() {
int i;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = controlState$FU;
do {
i = atomicIntegerFieldUpdater.get(this);
if ((Integer.MIN_VALUE & i) != 0) {
return false;
}
if (i >= this.maxCapacity) {
return true;
}
} while (!controlState$FU.compareAndSet(this, i, i + 1));
this.elements.set(i, this.create.invoke(Integer.valueOf(i)));
return true;
}
public final List<T> close() {
int i;
Object andSet;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = controlState$FU;
while (true) {
i = atomicIntegerFieldUpdater.get(this);
if ((i & Integer.MIN_VALUE) != 0) {
i = 0;
break;
}
if (controlState$FU.compareAndSet(this, i, Integer.MIN_VALUE | i)) {
break;
}
}
IntRange until = RangesKt.until(0, i);
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(until, 10));
Iterator<Integer> it = until.iterator();
while (it.hasNext()) {
int nextInt = ((IntIterator) it).nextInt();
do {
andSet = this.elements.getAndSet(nextInt, null);
} while (andSet == null);
arrayList.add(andSet);
}
return arrayList;
}
public final String stateRepresentation$kotlinx_coroutines_core() {
int i = controlState$FU.get(this);
IntRange until = RangesKt.until(0, Integer.MAX_VALUE & i);
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(until, 10));
Iterator<Integer> it = until.iterator();
while (it.hasNext()) {
arrayList.add(this.elements.get(((IntIterator) it).nextInt()));
}
return arrayList.toString() + ((i & Integer.MIN_VALUE) != 0 ? "[closed]" : "");
}
public String toString() {
return "OnDemandAllocatingPool(" + stateRepresentation$kotlinx_coroutines_core() + ')';
}
}

View File

@ -0,0 +1,18 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: OnDemandAllocatingPool.kt */
@Metadata(d1 = {"\u0000\u0018\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0001\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\u001a\u0017\u0010\u0002\u001a\u00020\u00032\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005H\u0082\b\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0007"}, d2 = {"IS_CLOSED_MASK", "", "loop", "", "block", "Lkotlin/Function0;", "", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class OnDemandAllocatingPoolKt {
private static final int IS_CLOSED_MASK = Integer.MIN_VALUE;
private static final Void loop(Function0<Unit> function0) {
while (true) {
function0.invoke();
}
}
}

View File

@ -0,0 +1,61 @@
package kotlinx.coroutines.internal;
import kotlin.ExceptionsKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.CoroutineExceptionHandlerKt;
/* compiled from: OnUndeliveredElement.kt */
@Metadata(d1 = {"\u0000(\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\u001aI\u0010\u0000\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001\"\u0004\b\u0000\u0010\u0004*\u0018\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001j\b\u0012\u0004\u0012\u0002H\u0004`\u00052\u0006\u0010\u0006\u001a\u0002H\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0000¢\u0006\u0002\u0010\t\u001a=\u0010\n\u001a\u00020\u0003\"\u0004\b\u0000\u0010\u0004*\u0018\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001j\b\u0012\u0004\u0012\u0002H\u0004`\u00052\u0006\u0010\u0006\u001a\u0002H\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0000¢\u0006\u0002\u0010\u000b\u001aC\u0010\f\u001a\u0004\u0018\u00010\r\"\u0004\b\u0000\u0010\u0004*\u0018\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001j\b\u0012\u0004\u0012\u0002H\u0004`\u00052\u0006\u0010\u0006\u001a\u0002H\u00042\n\b\u0002\u0010\u000e\u001a\u0004\u0018\u00010\rH\u0000¢\u0006\u0002\u0010\u000f**\b\u0000\u0010\u0010\u001a\u0004\b\u0000\u0010\u0004\"\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u00012\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001¨\u0006\u0011"}, d2 = {"bindCancellationFun", "Lkotlin/Function1;", "", "", "E", "Lkotlinx/coroutines/internal/OnUndeliveredElement;", "element", "context", "Lkotlin/coroutines/CoroutineContext;", "(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Lkotlin/coroutines/CoroutineContext;)Lkotlin/jvm/functions/Function1;", "callUndeliveredElement", "(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Lkotlin/coroutines/CoroutineContext;)V", "callUndeliveredElementCatchingException", "Lkotlinx/coroutines/internal/UndeliveredElementException;", "undeliveredElementException", "(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Lkotlinx/coroutines/internal/UndeliveredElementException;)Lkotlinx/coroutines/internal/UndeliveredElementException;", "OnUndeliveredElement", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final 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);
}
/* JADX WARN: Multi-variable type inference failed */
public static final <E> UndeliveredElementException callUndeliveredElementCatchingException(Function1<? super E, Unit> function1, E e, UndeliveredElementException undeliveredElementException) {
try {
function1.invoke(e);
} catch (Throwable th) {
if (undeliveredElementException == null || undeliveredElementException.getCause() == th) {
return new UndeliveredElementException("Exception in undelivered element handler for " + e, th);
}
ExceptionsKt.addSuppressed(undeliveredElementException, th);
}
return undeliveredElementException;
}
public static final <E> void callUndeliveredElement(Function1<? super E, Unit> function1, E e, CoroutineContext coroutineContext) {
UndeliveredElementException callUndeliveredElementCatchingException = callUndeliveredElementCatchingException(function1, e, null);
if (callUndeliveredElementCatchingException != null) {
CoroutineExceptionHandlerKt.handleCoroutineException(coroutineContext, callUndeliveredElementCatchingException);
}
}
public static final <E> Function1<Throwable, Unit> bindCancellationFun(final Function1<? super E, Unit> function1, final E e, final CoroutineContext coroutineContext) {
return new Function1<Throwable, Unit>() { // from class: kotlinx.coroutines.internal.OnUndeliveredElementKt$bindCancellationFun$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Throwable th) {
invoke2(th);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(Throwable th) {
OnUndeliveredElementKt.callUndeliveredElement(function1, e, coroutineContext);
}
};
}
}

View File

@ -0,0 +1,17 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlinx.coroutines.DebugStringsKt;
/* compiled from: Atomic.kt */
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\b&\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0014\u0010\u0007\u001a\u0004\u0018\u00010\u00012\b\u0010\b\u001a\u0004\u0018\u00010\u0001H&J\b\u0010\t\u001a\u00020\nH\u0016R\u0018\u0010\u0003\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u0004X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u000b"}, d2 = {"Lkotlinx/coroutines/internal/OpDescriptor;", "", "()V", "atomicOp", "Lkotlinx/coroutines/internal/AtomicOp;", "getAtomicOp", "()Lkotlinx/coroutines/internal/AtomicOp;", "perform", "affected", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public abstract class OpDescriptor {
public abstract AtomicOp<?> getAtomicOp();
public abstract Object perform(Object affected);
public String toString() {
return DebugStringsKt.getClassSimpleName(this) + '@' + DebugStringsKt.getHexAddress(this);
}
}

View File

@ -0,0 +1,14 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
/* compiled from: ProbesSupport.kt */
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a#\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001H\u0080\\u0006\u0004"}, d2 = {"probeCoroutineCreated", "Lkotlin/coroutines/Continuation;", "T", "completion", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ProbesSupportKt {
public static final <T> Continuation<T> probeCoroutineCreated(Continuation<? super T> continuation) {
return DebugProbesKt.probeCoroutineCreated(continuation);
}
}

View File

@ -0,0 +1,18 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: LockFreeLinkedList.kt */
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0011\u0012\n\u0010\u0002\u001a\u00060\u0003j\u0002`\u0004¢\u0006\u0002\u0010\u0005J\b\u0010\u0006\u001a\u00020\u0007H\u0016R\u0014\u0010\u0002\u001a\u00060\u0003j\u0002`\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\b"}, d2 = {"Lkotlinx/coroutines/internal/Removed;", "", "ref", "Lkotlinx/coroutines/internal/LockFreeLinkedListNode;", "Lkotlinx/coroutines/internal/Node;", "(Lkotlinx/coroutines/internal/LockFreeLinkedListNode;)V", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
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,43 @@
package kotlinx.coroutines.internal;
import java.util.concurrent.atomic.AtomicReferenceArray;
import kotlin.Metadata;
import kotlin.ranges.RangesKt;
/* compiled from: ResizableAtomicArray.kt */
@Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0003\b\u0000\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0006\u0010\b\u001a\u00020\u0004J\u0018\u0010\t\u001a\u0004\u0018\u00018\u00002\u0006\u0010\n\u001a\u00020\u0004H\u0086\u0002¢\u0006\u0002\u0010\u000bJ\u001d\u0010\f\u001a\u00020\r2\u0006\u0010\n\u001a\u00020\u00042\b\u0010\u000e\u001a\u0004\u0018\u00018\u0000¢\u0006\u0002\u0010\u000fR\u0014\u0010\u0006\u001a\b\u0012\u0004\u0012\u00028\u00000\u0007X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Lkotlinx/coroutines/internal/ResizableAtomicArray;", "T", "", "initialLength", "", "(I)V", "array", "Ljava/util/concurrent/atomic/AtomicReferenceArray;", "currentLength", "get", "index", "(I)Ljava/lang/Object;", "setSynchronized", "", "value", "(ILjava/lang/Object;)V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ResizableAtomicArray<T> {
private volatile AtomicReferenceArray<T> array;
public ResizableAtomicArray(int i) {
this.array = new AtomicReferenceArray<>(i);
}
public final int currentLength() {
return this.array.length();
}
public final T get(int index) {
AtomicReferenceArray<T> atomicReferenceArray = this.array;
if (index < atomicReferenceArray.length()) {
return atomicReferenceArray.get(index);
}
return null;
}
public final void setSynchronized(int index, T value) {
AtomicReferenceArray<T> atomicReferenceArray = this.array;
int length = atomicReferenceArray.length();
if (index < length) {
atomicReferenceArray.set(index, value);
return;
}
AtomicReferenceArray<T> atomicReferenceArray2 = new AtomicReferenceArray<>(RangesKt.coerceAtLeast(index + 1, length * 2));
for (int i = 0; i < length; i++) {
atomicReferenceArray2.set(i, atomicReferenceArray.get(i));
}
atomicReferenceArray2.set(index, value);
this.array = atomicReferenceArray2;
}
}

View File

@ -0,0 +1,52 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlinx.coroutines.AbstractCoroutine;
import kotlinx.coroutines.CompletionStateKt;
/* compiled from: Scopes.kt */
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0010\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00002\b\u0012\u0004\u0012\u0002H\u00010\u00022\u00060\u0003j\u0002`\u0004B\u001b\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u00028\u00000\\u0006\u0002\u0010\tJ\u0012\u0010\u0010\u001a\u00020\u00112\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0014J\u0012\u0010\u0014\u001a\u00020\u00112\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0014J\u000e\u0010\u0015\u001a\n\u0018\u00010\u0016j\u0004\u0018\u0001`\u0017R\u0019\u0010\n\u001a\n\u0018\u00010\u0003j\u0004\u0018\u0001`\u00048F¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u0014\u0010\r\u001a\u00020\u000e8DX\u0084\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000fR\u0016\u0010\u0007\u001a\b\u0012\u0004\u0012\u00028\u00000\b8\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Lkotlinx/coroutines/internal/ScopeCoroutine;", "T", "Lkotlinx/coroutines/AbstractCoroutine;", "Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "Lkotlinx/coroutines/internal/CoroutineStackFrame;", "context", "Lkotlin/coroutines/CoroutineContext;", "uCont", "Lkotlin/coroutines/Continuation;", "(Lkotlin/coroutines/CoroutineContext;Lkotlin/coroutines/Continuation;)V", "callerFrame", "getCallerFrame", "()Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "isScopedCoroutine", "", "()Z", "afterCompletion", "", "state", "", "afterResume", "getStackTraceElement", "Ljava/lang/StackTraceElement;", "Lkotlinx/coroutines/internal/StackTraceElement;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public class ScopeCoroutine<T> extends AbstractCoroutine<T> implements CoroutineStackFrame {
public final Continuation<T> uCont;
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
public final StackTraceElement getStackTraceElement() {
return null;
}
@Override // kotlinx.coroutines.JobSupport
protected final boolean isScopedCoroutine() {
return true;
}
/* JADX WARN: Multi-variable type inference failed */
public ScopeCoroutine(CoroutineContext coroutineContext, Continuation<? super T> continuation) {
super(coroutineContext, true, true);
this.uCont = continuation;
}
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
public final CoroutineStackFrame getCallerFrame() {
Continuation<T> continuation = this.uCont;
if (continuation instanceof CoroutineStackFrame) {
return (CoroutineStackFrame) continuation;
}
return null;
}
@Override // kotlinx.coroutines.JobSupport
protected void afterCompletion(Object state) {
DispatchedContinuationKt.resumeCancellableWith$default(IntrinsicsKt.intercepted(this.uCont), CompletionStateKt.recoverResult(state, this.uCont), null, 2, null);
}
@Override // kotlinx.coroutines.AbstractCoroutine
protected void afterResume(Object state) {
Continuation<T> continuation = this.uCont;
continuation.resumeWith(CompletionStateKt.recoverResult(state, continuation));
}
}

View File

@ -0,0 +1,57 @@
package kotlinx.coroutines.internal;
import androidx.core.internal.view.SupportMenu;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.Volatile;
import kotlinx.coroutines.NotCompleted;
import kotlinx.coroutines.internal.Segment;
/* compiled from: ConcurrentLinkedList.kt */
@Metadata(d1 = {"\u0000D\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u0003\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b \u0018\u0000*\u000e\b\u0000\u0010\u0001*\b\u0012\u0004\u0012\u0002H\u00010\u00002\b\u0012\u0004\u0012\u0002H\u00010\u00022\u00020\u0003B\u001f\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\b\u0010\u0006\u001a\u0004\u0018\u00018\u0000\u0012\u0006\u0010\u0007\u001a\u00020\\u0006\u0002\u0010\tJ\r\u0010\u0012\u001a\u00020\rH\u0000¢\u0006\u0002\b\u0013J\"\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\b2\b\u0010\u0017\u001a\u0004\u0018\u00010\u00182\u0006\u0010\u0019\u001a\u00020\u001aH&J\u0006\u0010\u001b\u001a\u00020\u0015J\r\u0010\u001c\u001a\u00020\rH\u0000¢\u0006\u0002\b\u001dR\t\u0010\n\u001a\u00020\u000bX\u0082\u0004R\u0010\u0010\u0004\u001a\u00020\u00058\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\f\u001a\u00020\r8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\f\u0010\u000eR\u0012\u0010\u000f\u001a\u00020\bX¦\u0004¢\u0006\u0006\u001a\u0004\b\u0010\u0010\u0011¨\u0006\u001e"}, d2 = {"Lkotlinx/coroutines/internal/Segment;", "S", "Lkotlinx/coroutines/internal/ConcurrentLinkedListNode;", "Lkotlinx/coroutines/NotCompleted;", "id", "", "prev", "pointers", "", "(JLkotlinx/coroutines/internal/Segment;I)V", "cleanedAndPointers", "Lkotlinx/atomicfu/AtomicInt;", "isRemoved", "", "()Z", "numberOfSlots", "getNumberOfSlots", "()I", "decPointers", "decPointers$kotlinx_coroutines_core", "onCancellation", "", "index", "cause", "", "context", "Lkotlin/coroutines/CoroutineContext;", "onSlotCleaned", "tryIncPointers", "tryIncPointers$kotlinx_coroutines_core", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public abstract class Segment<S extends Segment<S>> extends ConcurrentLinkedListNode<S> implements NotCompleted {
private static final AtomicIntegerFieldUpdater cleanedAndPointers$FU = AtomicIntegerFieldUpdater.newUpdater(Segment.class, "cleanedAndPointers");
@Volatile
private volatile int cleanedAndPointers;
public final long id;
public abstract int getNumberOfSlots();
public abstract void onCancellation(int index, Throwable cause, CoroutineContext context);
public Segment(long j, S s, int i) {
super(s);
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,85 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.JvmInline;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.internal.Segment;
/* compiled from: ConcurrentLinkedList.kt */
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0081@\u0018\u0000*\u000e\b\u0000\u0010\u0001*\b\u0012\u0004\u0012\u0002H\u00010\u00022\u00020\u0003B\u0014\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0003ø\u0001\u0000¢\u0006\u0004\b\u0005\u0010\u0006J\u001a\u0010\u0010\u001a\u00020\b2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0003HÖ\u0003¢\u0006\u0004\b\u0012\u0010\u0013J\u0010\u0010\u0014\u001a\u00020\u0015HÖ\u0001¢\u0006\u0004\b\u0016\u0010\u0017J\u0010\u0010\u0018\u001a\u00020\u0019HÖ\u0001¢\u0006\u0004\b\u001a\u0010\u001bR\u0011\u0010\u0007\u001a\u00020\b8F¢\u0006\u0006\u001a\u0004\b\t\u0010\nR\u0017\u0010\u000b\u001a\u00028\u00008F¢\u0006\f\u0012\u0004\b\f\u0010\r\u001a\u0004\b\u000e\u0010\u000fR\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0003X\u0082\u0004¢\u0006\u0002\n\u0000\u0088\u0001\u0004\u0092\u0001\u0004\u0018\u00010\u0003ø\u0001\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u001c"}, d2 = {"Lkotlinx/coroutines/internal/SegmentOrClosed;", "S", "Lkotlinx/coroutines/internal/Segment;", "", "value", "constructor-impl", "(Ljava/lang/Object;)Ljava/lang/Object;", "isClosed", "", "isClosed-impl", "(Ljava/lang/Object;)Z", "segment", "getSegment$annotations", "()V", "getSegment-impl", "(Ljava/lang/Object;)Lkotlinx/coroutines/internal/Segment;", "equals", "other", "equals-impl", "(Ljava/lang/Object;Ljava/lang/Object;)Z", "hashCode", "", "hashCode-impl", "(Ljava/lang/Object;)I", "toString", "", "toString-impl", "(Ljava/lang/Object;)Ljava/lang/String;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
@JvmInline
/* loaded from: classes.dex */
public final class SegmentOrClosed<S extends Segment<S>> {
private final Object value;
/* renamed from: box-impl, reason: not valid java name */
public static final /* synthetic */ SegmentOrClosed m1909boximpl(Object obj) {
return new SegmentOrClosed(obj);
}
/* renamed from: constructor-impl, reason: not valid java name */
public static <S extends Segment<S>> Object m1910constructorimpl(Object obj) {
return obj;
}
/* renamed from: equals-impl, reason: not valid java name */
public static boolean m1911equalsimpl(Object obj, Object obj2) {
return (obj2 instanceof SegmentOrClosed) && Intrinsics.areEqual(obj, ((SegmentOrClosed) obj2).getValue());
}
/* renamed from: equals-impl0, reason: not valid java name */
public static final boolean m1912equalsimpl0(Object obj, Object obj2) {
return Intrinsics.areEqual(obj, obj2);
}
public static /* synthetic */ void getSegment$annotations() {
}
/* renamed from: hashCode-impl, reason: not valid java name */
public static int m1914hashCodeimpl(Object obj) {
if (obj == null) {
return 0;
}
return obj.hashCode();
}
/* renamed from: toString-impl, reason: not valid java name */
public static String m1916toStringimpl(Object obj) {
return "SegmentOrClosed(value=" + obj + ')';
}
public boolean equals(Object obj) {
return m1911equalsimpl(this.value, obj);
}
public int hashCode() {
return m1914hashCodeimpl(this.value);
}
public String toString() {
return m1916toStringimpl(this.value);
}
/* renamed from: unbox-impl, reason: not valid java name and from getter */
public final /* synthetic */ Object getValue() {
return this.value;
}
private /* synthetic */ SegmentOrClosed(Object obj) {
this.value = obj;
}
/* renamed from: isClosed-impl, reason: not valid java name */
public static final boolean m1915isClosedimpl(Object obj) {
return obj == ConcurrentLinkedListKt.CLOSED;
}
/* renamed from: getSegment-impl, reason: not valid java name */
public static final S m1913getSegmentimpl(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 (S) obj;
}
}

View File

@ -0,0 +1,270 @@
package kotlinx.coroutines.internal;
import _COROUTINE.ArtificialStackFrames;
import _COROUTINE.CoroutineDebuggingKt;
import java.util.ArrayDeque;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.TuplesKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlinx.coroutines.DebugKt;
/* compiled from: StackTraceRecovery.kt */
@Metadata(d1 = {"\u0000d\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0010\u0003\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0010\u0001\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\b\u001a9\u0010\b\u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n2\u0006\u0010\u000b\u001a\u0002H\t2\u0006\u0010\f\u001a\u0002H\t2\u0010\u0010\r\u001a\f\u0012\b\u0012\u00060\u0001j\u0002`\u000f0\u000eH\u0002¢\u0006\u0002\u0010\u0010\u001a\u001e\u0010\u0011\u001a\f\u0012\b\u0012\u00060\u0001j\u0002`\u000f0\u000e2\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u0014H\u0002\u001a1\u0010\u0015\u001a\u00020\u00162\u0010\u0010\u0017\u001a\f\u0012\b\u0012\u00060\u0001j\u0002`\u000f0\u00182\u0010\u0010\f\u001a\f\u0012\b\u0012\u00060\u0001j\u0002`\u000f0\u000eH\u0002¢\u0006\u0002\u0010\u0019\u001a\u0019\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\nH\u0080Hø\u0001\u0000¢\u0006\u0002\u0010\u001d\u001a+\u0010\u001e\u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n2\u0006\u0010\u001c\u001a\u0002H\t2\n\u0010\u0012\u001a\u00060\u0013j\u0002`\u0014H\u0002¢\u0006\u0002\u0010\u001f\u001a\u001f\u0010 \u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n2\u0006\u0010\u001c\u001a\u0002H\tH\u0000¢\u0006\u0002\u0010!\u001a,\u0010 \u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n2\u0006\u0010\u001c\u001a\u0002H\t2\n\u0010\u0012\u001a\u0006\u0012\u0002\b\u00030\"H\u0080\\u0006\u0002\u0010#\u001a \u0010$\u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n2\u0006\u0010\u001c\u001a\u0002H\tH\u0080\\u0006\u0002\u0010!\u001a\u001f\u0010%\u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n2\u0006\u0010\u001c\u001a\u0002H\tH\u0000¢\u0006\u0002\u0010!\u001a1\u0010&\u001a\u0018\u0012\u0004\u0012\u0002H\t\u0012\u000e\u0012\f\u0012\b\u0012\u00060\u0001j\u0002`\u000f0\u00180'\"\b\b\u0000\u0010\t*\u00020\n*\u0002H\tH\u0002¢\u0006\u0002\u0010(\u001a\u001c\u0010)\u001a\u00020**\u00060\u0001j\u0002`\u000f2\n\u0010+\u001a\u00060\u0001j\u0002`\u000fH\u0002\u001a#\u0010,\u001a\u00020-*\f\u0012\b\u0012\u00060\u0001j\u0002`\u000f0\u00182\u0006\u0010.\u001a\u00020\u0003H\u0002¢\u0006\u0002\u0010/\u001a\u0014\u00100\u001a\u00020\u0016*\u00020\n2\u0006\u0010\u000b\u001a\u00020\nH\u0000\u001a\u0010\u00101\u001a\u00020**\u00060\u0001j\u0002`\u000fH\u0000\u001a\u001b\u00102\u001a\u0002H\t\"\b\b\u0000\u0010\t*\u00020\n*\u0002H\tH\u0002¢\u0006\u0002\u0010!\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0003X\u0082T¢\u0006\u0002\n\u0000\"\u0016\u0010\u0004\u001a\n \u0005*\u0004\u0018\u00010\u00030\u0003X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0006\u001a\u00020\u0003X\u0082T¢\u0006\u0002\n\u0000\"\u0016\u0010\u0007\u001a\n \u0005*\u0004\u0018\u00010\u00030\u0003X\u0082\u0004¢\u0006\u0002\n\u0000*\f\b\u0000\u00103\"\u00020\u00132\u00020\u0013*\f\b\u0000\u00104\"\u00020\u00012\u00020\u0001\u0082\u0002\u0004\n\u0002\b\u0019¨\u00065"}, d2 = {"ARTIFICIAL_FRAME", "Ljava/lang/StackTraceElement;", "baseContinuationImplClass", "", "baseContinuationImplClassName", "kotlin.jvm.PlatformType", "stackTraceRecoveryClass", "stackTraceRecoveryClassName", "createFinalException", "E", "", "cause", "result", "resultStackTrace", "Ljava/util/ArrayDeque;", "Lkotlinx/coroutines/internal/StackTraceElement;", "(Ljava/lang/Throwable;Ljava/lang/Throwable;Ljava/util/ArrayDeque;)Ljava/lang/Throwable;", "createStackTrace", "continuation", "Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;", "Lkotlinx/coroutines/internal/CoroutineStackFrame;", "mergeRecoveredTraces", "", "recoveredStacktrace", "", "([Ljava/lang/StackTraceElement;Ljava/util/ArrayDeque;)V", "recoverAndThrow", "", "exception", "(Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "recoverFromStackFrame", "(Ljava/lang/Throwable;Lkotlin/coroutines/jvm/internal/CoroutineStackFrame;)Ljava/lang/Throwable;", "recoverStackTrace", "(Ljava/lang/Throwable;)Ljava/lang/Throwable;", "Lkotlin/coroutines/Continuation;", "(Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Throwable;", "unwrap", "unwrapImpl", "causeAndStacktrace", "Lkotlin/Pair;", "(Ljava/lang/Throwable;)Lkotlin/Pair;", "elementWiseEquals", "", "e", "firstFrameIndex", "", "methodName", "([Ljava/lang/StackTraceElement;Ljava/lang/String;)I", "initCause", "isArtificial", "sanitizeStackTrace", "CoroutineStackFrame", "StackTraceElement", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class StackTraceRecoveryKt {
private static final StackTraceElement ARTIFICIAL_FRAME;
private static final String baseContinuationImplClass = "kotlin.coroutines.jvm.internal.BaseContinuationImpl";
private static final String baseContinuationImplClassName;
private static final String stackTraceRecoveryClass = "kotlinx.coroutines.internal.StackTraceRecoveryKt";
private static final String stackTraceRecoveryClassName;
public static /* synthetic */ void CoroutineStackFrame$annotations() {
}
public static /* synthetic */ void StackTraceElement$annotations() {
}
static {
Object obj;
Object obj2;
Object obj3 = stackTraceRecoveryClass;
Object obj4 = baseContinuationImplClass;
ARTIFICIAL_FRAME = new ArtificialStackFrames().coroutineBoundary();
try {
Result.Companion companion = Result.INSTANCE;
obj = Result.m288constructorimpl(Class.forName(baseContinuationImplClass).getCanonicalName());
} catch (Throwable th) {
Result.Companion companion2 = Result.INSTANCE;
obj = Result.m288constructorimpl(ResultKt.createFailure(th));
}
if (Result.m291exceptionOrNullimpl(obj) == null) {
obj4 = obj;
}
baseContinuationImplClassName = (String) obj4;
try {
Result.Companion companion3 = Result.INSTANCE;
obj2 = Result.m288constructorimpl(Class.forName(stackTraceRecoveryClass).getCanonicalName());
} catch (Throwable th2) {
Result.Companion companion4 = Result.INSTANCE;
obj2 = Result.m288constructorimpl(ResultKt.createFailure(th2));
}
if (Result.m291exceptionOrNullimpl(obj2) == null) {
obj3 = obj2;
}
stackTraceRecoveryClassName = (String) obj3;
}
public static final <E extends Throwable> E recoverStackTrace(E e) {
Throwable tryCopyException;
return (DebugKt.getRECOVER_STACK_TRACES() && (tryCopyException = ExceptionsConstructorKt.tryCopyException(e)) != null) ? (E) sanitizeStackTrace(tryCopyException) : e;
}
private static final <E extends Throwable> E sanitizeStackTrace(E e) {
StackTraceElement[] stackTrace = e.getStackTrace();
int length = stackTrace.length;
int length2 = stackTrace.length - 1;
if (length2 >= 0) {
while (true) {
int i = length2 - 1;
if (Intrinsics.areEqual(stackTraceRecoveryClassName, stackTrace[length2].getClassName())) {
break;
}
if (i < 0) {
break;
}
length2 = i;
}
}
length2 = -1;
int i2 = length2 + 1;
int firstFrameIndex = firstFrameIndex(stackTrace, baseContinuationImplClassName);
int i3 = 0;
int i4 = (length - length2) - (firstFrameIndex == -1 ? 0 : length - firstFrameIndex);
StackTraceElement[] stackTraceElementArr = new StackTraceElement[i4];
while (i3 < i4) {
stackTraceElementArr[i3] = i3 == 0 ? ARTIFICIAL_FRAME : stackTrace[(i2 + i3) - 1];
i3++;
}
e.setStackTrace(stackTraceElementArr);
return e;
}
public static final <E extends Throwable> E recoverStackTrace(E e, Continuation<?> continuation) {
return (DebugKt.getRECOVER_STACK_TRACES() && (continuation instanceof CoroutineStackFrame)) ? (E) recoverFromStackFrame(e, (CoroutineStackFrame) continuation) : e;
}
/* JADX INFO: Access modifiers changed from: private */
public static final <E extends Throwable> E recoverFromStackFrame(E e, CoroutineStackFrame coroutineStackFrame) {
Pair causeAndStacktrace = causeAndStacktrace(e);
Throwable th = (Throwable) causeAndStacktrace.component1();
StackTraceElement[] stackTraceElementArr = (StackTraceElement[]) causeAndStacktrace.component2();
Throwable tryCopyException = ExceptionsConstructorKt.tryCopyException(th);
if (tryCopyException == null) {
return e;
}
ArrayDeque<StackTraceElement> createStackTrace = createStackTrace(coroutineStackFrame);
if (createStackTrace.isEmpty()) {
return e;
}
if (th != e) {
mergeRecoveredTraces(stackTraceElementArr, createStackTrace);
}
return (E) createFinalException(th, tryCopyException, createStackTrace);
}
private static final <E extends Throwable> E createFinalException(E e, E e2, ArrayDeque<StackTraceElement> arrayDeque) {
arrayDeque.addFirst(ARTIFICIAL_FRAME);
StackTraceElement[] stackTrace = e.getStackTrace();
int firstFrameIndex = firstFrameIndex(stackTrace, baseContinuationImplClassName);
int i = 0;
if (firstFrameIndex == -1) {
e2.setStackTrace((StackTraceElement[]) arrayDeque.toArray(new StackTraceElement[0]));
return e2;
}
StackTraceElement[] stackTraceElementArr = new StackTraceElement[arrayDeque.size() + firstFrameIndex];
for (int i2 = 0; i2 < firstFrameIndex; i2++) {
stackTraceElementArr[i2] = stackTrace[i2];
}
Iterator<StackTraceElement> it = arrayDeque.iterator();
while (it.hasNext()) {
int i3 = i + 1;
stackTraceElementArr[i + firstFrameIndex] = it.next();
i = i3;
}
e2.setStackTrace(stackTraceElementArr);
return e2;
}
private static final <E extends Throwable> Pair<E, StackTraceElement[]> causeAndStacktrace(E e) {
Throwable cause = e.getCause();
if (cause != null && Intrinsics.areEqual(cause.getClass(), e.getClass())) {
StackTraceElement[] stackTrace = e.getStackTrace();
for (StackTraceElement stackTraceElement : stackTrace) {
if (isArtificial(stackTraceElement)) {
return TuplesKt.to(cause, stackTrace);
}
}
return TuplesKt.to(e, new StackTraceElement[0]);
}
return TuplesKt.to(e, new StackTraceElement[0]);
}
public static final Object recoverAndThrow(Throwable th, Continuation<?> continuation) {
if (!DebugKt.getRECOVER_STACK_TRACES()) {
throw th;
}
if (continuation instanceof CoroutineStackFrame) {
throw recoverFromStackFrame(th, (CoroutineStackFrame) continuation);
}
throw th;
}
private static final Object recoverAndThrow$$forInline(Throwable th, Continuation<?> continuation) {
if (!DebugKt.getRECOVER_STACK_TRACES()) {
throw th;
}
InlineMarker.mark(0);
if (continuation instanceof CoroutineStackFrame) {
throw recoverFromStackFrame(th, (CoroutineStackFrame) continuation);
}
throw th;
}
public static final <E extends Throwable> E unwrap(E e) {
return !DebugKt.getRECOVER_STACK_TRACES() ? e : (E) unwrapImpl(e);
}
public static final <E extends Throwable> E unwrapImpl(E e) {
E e2 = (E) e.getCause();
if (e2 != null && Intrinsics.areEqual(e2.getClass(), e.getClass())) {
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
if (isArtificial(stackTraceElement)) {
return e2;
}
}
}
return e;
}
private static final ArrayDeque<StackTraceElement> createStackTrace(CoroutineStackFrame coroutineStackFrame) {
ArrayDeque<StackTraceElement> arrayDeque = new ArrayDeque<>();
StackTraceElement stackTraceElement = coroutineStackFrame.getStackTraceElement();
if (stackTraceElement != null) {
arrayDeque.add(stackTraceElement);
}
while (true) {
if (!(coroutineStackFrame instanceof CoroutineStackFrame)) {
coroutineStackFrame = null;
}
if (coroutineStackFrame == null || (coroutineStackFrame = coroutineStackFrame.getCallerFrame()) == null) {
break;
}
StackTraceElement stackTraceElement2 = coroutineStackFrame.getStackTraceElement();
if (stackTraceElement2 != null) {
arrayDeque.add(stackTraceElement2);
}
}
return arrayDeque;
}
public static final boolean isArtificial(StackTraceElement stackTraceElement) {
return StringsKt.startsWith$default(stackTraceElement.getClassName(), CoroutineDebuggingKt.getARTIFICIAL_FRAME_PACKAGE_NAME(), false, 2, (Object) null);
}
private static final boolean elementWiseEquals(StackTraceElement stackTraceElement, StackTraceElement stackTraceElement2) {
return stackTraceElement.getLineNumber() == stackTraceElement2.getLineNumber() && Intrinsics.areEqual(stackTraceElement.getMethodName(), stackTraceElement2.getMethodName()) && Intrinsics.areEqual(stackTraceElement.getFileName(), stackTraceElement2.getFileName()) && Intrinsics.areEqual(stackTraceElement.getClassName(), stackTraceElement2.getClassName());
}
public static final void initCause(Throwable th, Throwable th2) {
th.initCause(th2);
}
private static final void mergeRecoveredTraces(StackTraceElement[] stackTraceElementArr, ArrayDeque<StackTraceElement> arrayDeque) {
int length = stackTraceElementArr.length;
int i = 0;
while (true) {
if (i >= length) {
i = -1;
break;
} else if (isArtificial(stackTraceElementArr[i])) {
break;
} else {
i++;
}
}
int i2 = i + 1;
int length2 = stackTraceElementArr.length - 1;
if (i2 > length2) {
return;
}
while (true) {
if (elementWiseEquals(stackTraceElementArr[length2], arrayDeque.getLast())) {
arrayDeque.removeLast();
}
arrayDeque.addFirst(stackTraceElementArr[length2]);
if (length2 == i2) {
return;
} else {
length2--;
}
}
}
private static final int firstFrameIndex(StackTraceElement[] stackTraceElementArr, String str) {
int length = stackTraceElementArr.length;
for (int i = 0; i < length; i++) {
if (Intrinsics.areEqual(str, stackTraceElementArr[i].getClassName())) {
return i;
}
}
return -1;
}
}

View File

@ -0,0 +1,27 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.text.Typography;
/* compiled from: Symbol.kt */
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0007\b\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0005\u001a\u00020\u0003H\u0016J\u001e\u0010\u0006\u001a\u0002H\u0007\"\u0004\b\u0000\u0010\u00072\b\u0010\b\u001a\u0004\u0018\u00010\u0001H\u0086\\u0006\u0002\u0010\tR\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"Lkotlinx/coroutines/internal/Symbol;", "", "symbol", "", "(Ljava/lang/String;)V", "toString", "unbox", "T", "value", "(Ljava/lang/Object;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class Symbol {
public final String symbol;
/* JADX WARN: Multi-variable type inference failed */
public final <T> T unbox(Object value) {
if (value == this) {
return null;
}
return value;
}
public Symbol(String str) {
this.symbol = str;
}
public String toString() {
return "<" + this.symbol + Typography.greater;
}
}

View File

@ -0,0 +1,29 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
/* compiled from: Synchronized.kt */
@Metadata(d1 = {"\u0000\u001c\n\u0002\b\u0003\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u001a.\u0010\u0000\u001a\u0002H\u0001\"\u0004\b\u0000\u0010\u00012\n\u0010\u0002\u001a\u00060\u0003j\u0002`\u00042\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u0002H\u00010\u0006H\u0087\\u0006\u0002\u0010\u0007*\u0010\b\u0007\u0010\b\"\u00020\u00032\u00020\u0003B\u0002\b\\u0006\n"}, d2 = {"synchronizedImpl", "T", "lock", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "block", "Lkotlin/Function0;", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;", "SynchronizedObject", "Lkotlinx/coroutines/InternalCoroutinesApi;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class SynchronizedKt {
public static /* synthetic */ void SynchronizedObject$annotations() {
}
public static final <T> T synchronizedImpl(Object obj, Function0<? extends T> function0) {
T invoke;
synchronized (obj) {
try {
invoke = function0.invoke();
InlineMarker.finallyStart(1);
} catch (Throwable th) {
InlineMarker.finallyStart(1);
InlineMarker.finallyEnd(1);
throw th;
}
}
InlineMarker.finallyEnd(1);
return invoke;
}
}

View File

@ -0,0 +1,27 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
/* compiled from: Synchronized.common.kt */
@Metadata(d1 = {"\u0000\u0016\n\u0002\b\u0003\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a;\u0010\u0000\u001a\u0002H\u0001\"\u0004\b\u0000\u0010\u00012\n\u0010\u0002\u001a\u00060\u0003j\u0002`\u00042\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u0002H\u00010\u0006H\u0087\b\u0082\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0002 \u0001¢\u0006\u0002\u0010\u0007¨\u0006\b"}, d2 = {"synchronized", "T", "lock", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "block", "Lkotlin/Function0;", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class Synchronized_commonKt {
/* renamed from: synchronized, reason: not valid java name */
public static final <T> T m1918synchronized(Object obj, Function0<? extends T> function0) {
T invoke;
synchronized (obj) {
try {
invoke = function0.invoke();
InlineMarker.finallyStart(1);
} catch (Throwable th) {
InlineMarker.finallyStart(1);
InlineMarker.finallyEnd(1);
throw th;
}
}
InlineMarker.finallyEnd(1);
return invoke;
}
}

View File

@ -0,0 +1,31 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
@Metadata(d1 = {"kotlinx/coroutines/internal/SystemPropsKt__SystemPropsKt", "kotlinx/coroutines/internal/SystemPropsKt__SystemProps_commonKt"}, k = 4, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final 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,22 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: SystemProps.kt */
@Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\u001a\u0012\u0010\u0004\u001a\u0004\u0018\u00010\u00052\u0006\u0010\u0006\u001a\u00020\u0005H\u0000\"\u0014\u0010\u0000\u001a\u00020\u0001X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0003¨\u0006\u0007"}, d2 = {"AVAILABLE_PROCESSORS", "", "getAVAILABLE_PROCESSORS", "()I", "systemProp", "", "propertyName", "kotlinx-coroutines-core"}, k = 5, mv = {1, 8, 0}, xi = 48, xs = "kotlinx/coroutines/internal/SystemPropsKt")
/* loaded from: classes.dex */
final /* synthetic */ class SystemPropsKt__SystemPropsKt {
private 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,61 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.text.StringsKt;
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: SystemProps.common.kt */
@Metadata(d1 = {"\u0000\u001c\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\u001a\u0018\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0001H\u0000\u001a,\u0010\u0000\u001a\u00020\u00052\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\b\b\u0002\u0010\u0006\u001a\u00020\u00052\b\b\u0002\u0010\u0007\u001a\u00020\u0005H\u0000\u001a,\u0010\u0000\u001a\u00020\b2\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\b2\b\b\u0002\u0010\u0006\u001a\u00020\b2\b\b\u0002\u0010\u0007\u001a\u00020\bH\u0000\u001a\u0018\u0010\u0000\u001a\u00020\u00032\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0003H\u0000¨\u0006\t"}, d2 = {"systemProp", "", "propertyName", "", "defaultValue", "", "minValue", "maxValue", "", "kotlinx-coroutines-core"}, k = 5, mv = {1, 8, 0}, xi = 48, xs = "kotlinx/coroutines/internal/SystemPropsKt")
/* loaded from: classes.dex */
public final /* 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) {
String systemProp = SystemPropsKt.systemProp(str);
if (systemProp == null) {
return j;
}
Long longOrNull = StringsKt.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,80 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* compiled from: ThreadContext.kt */
@Metadata(d1 = {"\u00000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\u001a\u001a\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u0004H\u0000\u001a\u0010\u0010\u000f\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\rH\u0000\u001a\u001c\u0010\u0010\u001a\u0004\u0018\u00010\u00042\u0006\u0010\f\u001a\u00020\r2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0004H\u0000\"\u0010\u0010\u0000\u001a\u00020\u00018\u0000X\u0081\u0004¢\u0006\u0002\n\u0000\"$\u0010\u0002\u001a\u0018\u0012\u0006\u0012\u0004\u0018\u00010\u0004\u0012\u0004\u0012\u00020\u0005\u0012\u0006\u0012\u0004\u0018\u00010\u00040\u0003X\u0082\u0004¢\u0006\u0002\n\u0000\",\u0010\u0006\u001a \u0012\n\u0012\b\u0012\u0002\b\u0003\u0018\u00010\u0007\u0012\u0004\u0012\u00020\u0005\u0012\n\u0012\b\u0012\u0002\b\u0003\u0018\u00010\u00070\u0003X\u0082\u0004¢\u0006\u0002\n\u0000\" \u0010\b\u001a\u0014\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\t0\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0012"}, d2 = {"NO_THREAD_ELEMENTS", "Lkotlinx/coroutines/internal/Symbol;", "countAll", "Lkotlin/Function2;", "", "Lkotlin/coroutines/CoroutineContext$Element;", "findOne", "Lkotlinx/coroutines/ThreadContextElement;", "updateState", "Lkotlinx/coroutines/internal/ThreadState;", "restoreThreadContext", "", "context", "Lkotlin/coroutines/CoroutineContext;", "oldState", "threadContextElements", "updateThreadContext", "countOrElement", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ThreadContextKt {
public static final Symbol NO_THREAD_ELEMENTS = new Symbol("NO_THREAD_ELEMENTS");
private static final Function2<Object, CoroutineContext.Element, Object> countAll = new Function2<Object, CoroutineContext.Element, Object>() { // 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);
}
};
private static final Function2<ThreadContextElement<?>, CoroutineContext.Element, ThreadContextElement<?>> findOne = new Function2<ThreadContextElement<?>, CoroutineContext.Element, ThreadContextElement<?>>() { // 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;
}
};
private static final Function2<ThreadState, CoroutineContext.Element, ThreadState> updateState = new Function2<ThreadState, CoroutineContext.Element, ThreadState>() { // 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,68 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* compiled from: ThreadContext.kt */
@Metadata(d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0000\u0018\u0000*\u0004\b\u0000\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u0002B\u001b\u0012\u0006\u0010\u0003\u001a\u00028\u0000\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0005¢\u0006\u0002\u0010\u0006J(\u0010\f\u001a\u0004\u0018\u0001H\r\"\b\b\u0001\u0010\r*\u00020\u000e2\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u0002H\r0\bH\u0096\u0002¢\u0006\u0002\u0010\u000fJ\u0014\u0010\u0010\u001a\u00020\u00112\n\u0010\u0007\u001a\u0006\u0012\u0002\b\u00030\bH\u0016J\u001d\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u00112\u0006\u0010\u0015\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0016J\b\u0010\u0017\u001a\u00020\u0018H\u0016J\u0015\u0010\u0019\u001a\u00028\u00002\u0006\u0010\u0014\u001a\u00020\u0011H\u0016¢\u0006\u0002\u0010\u001aR\u0018\u0010\u0007\u001a\u0006\u0012\u0002\b\u00030\bX\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0003\u001a\u00028\u0000X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u000b¨\u0006\u001b"}, d2 = {"Lkotlinx/coroutines/internal/ThreadLocalElement;", "T", "Lkotlinx/coroutines/ThreadContextElement;", "value", "threadLocal", "Ljava/lang/ThreadLocal;", "(Ljava/lang/Object;Ljava/lang/ThreadLocal;)V", "key", "Lkotlin/coroutines/CoroutineContext$Key;", "getKey", "()Lkotlin/coroutines/CoroutineContext$Key;", "Ljava/lang/Object;", "get", "E", "Lkotlin/coroutines/CoroutineContext$Element;", "(Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element;", "minusKey", "Lkotlin/coroutines/CoroutineContext;", "restoreThreadContext", "", "context", "oldState", "(Lkotlin/coroutines/CoroutineContext;Ljava/lang/Object;)V", "toString", "", "updateThreadContext", "(Lkotlin/coroutines/CoroutineContext;)Ljava/lang/Object;", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ThreadLocalElement<T> implements ThreadContextElement<T> {
private final CoroutineContext.Key<?> key;
private final ThreadLocal<T> threadLocal;
private final T value;
@Override // kotlin.coroutines.CoroutineContext.Element
public CoroutineContext.Key<?> getKey() {
return this.key;
}
public ThreadLocalElement(T t, ThreadLocal<T> threadLocal) {
this.value = t;
this.threadLocal = threadLocal;
this.key = new ThreadLocalKey(threadLocal);
}
@Override // kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <R> R fold(R r, Function2<? super R, ? super CoroutineContext.Element, ? extends R> function2) {
return (R) ThreadContextElement.DefaultImpls.fold(this, r, function2);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext coroutineContext) {
return ThreadContextElement.DefaultImpls.plus(this, coroutineContext);
}
@Override // kotlinx.coroutines.ThreadContextElement
public T updateThreadContext(CoroutineContext context) {
T t = this.threadLocal.get();
this.threadLocal.set(this.value);
return t;
}
@Override // kotlinx.coroutines.ThreadContextElement
public void restoreThreadContext(CoroutineContext context, T oldState) {
this.threadLocal.set(oldState);
}
@Override // kotlin.coroutines.CoroutineContext.Element, 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 <E extends CoroutineContext.Element> E get(CoroutineContext.Key<E> 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,47 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: ThreadContext.kt */
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0081\b\u0018\u00002\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u00020\u0001B\u0011\u0012\n\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u0004¢\u0006\u0002\u0010\u0005J\r\u0010\u0006\u001a\u0006\u0012\u0002\b\u00030\u0004HÂ\u0003J\u0017\u0010\u0007\u001a\u00020\u00002\f\b\u0002\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u0004HÆ\u0001J\u0013\u0010\b\u001a\u00020\t2\b\u0010\n\u001a\u0004\u0018\u00010\u000bHÖ\u0003J\t\u0010\f\u001a\u00020\rHÖ\u0001J\t\u0010\u000e\u001a\u00020\u000fHÖ\u0001R\u0012\u0010\u0003\u001a\u0006\u0012\u0002\b\u00030\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Lkotlinx/coroutines/internal/ThreadLocalKey;", "Lkotlin/coroutines/CoroutineContext$Key;", "Lkotlinx/coroutines/internal/ThreadLocalElement;", "threadLocal", "Ljava/lang/ThreadLocal;", "(Ljava/lang/ThreadLocal;)V", "component1", "copy", "equals", "", "other", "", "hashCode", "", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final /* data */ class ThreadLocalKey implements CoroutineContext.Key<ThreadLocalElement<?>> {
private final ThreadLocal<?> threadLocal;
private final ThreadLocal<?> component1() {
return this.threadLocal;
}
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ ThreadLocalKey copy$default(ThreadLocalKey threadLocalKey, ThreadLocal threadLocal, int i, Object obj) {
if ((i & 1) != 0) {
threadLocal = threadLocalKey.threadLocal;
}
return threadLocalKey.copy(threadLocal);
}
public final ThreadLocalKey copy(ThreadLocal<?> threadLocal) {
return new ThreadLocalKey(threadLocal);
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
return (other instanceof ThreadLocalKey) && Intrinsics.areEqual(this.threadLocal, ((ThreadLocalKey) other).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,15 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: ThreadLocal.kt */
@Metadata(d1 = {"\u0000\u0016\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a&\u0010\u0000\u001a\u0012\u0012\u0004\u0012\u0002H\u00020\u0001j\b\u0012\u0004\u0012\u0002H\u0002`\u0003\"\u0004\b\u0000\u0010\u00022\u0006\u0010\u0004\u001a\u00020\u0005H\u0000*\u001e\b\u0000\u0010\u0006\u001a\u0004\b\u0000\u0010\u0002\"\b\u0012\u0004\u0012\u0002H\u00020\u00012\b\u0012\u0004\u0012\u0002H\u00020\u0001¨\u0006\u0007"}, d2 = {"commonThreadLocal", "Ljava/lang/ThreadLocal;", "T", "Lkotlinx/coroutines/internal/CommonThreadLocal;", "name", "Lkotlinx/coroutines/internal/Symbol;", "CommonThreadLocal", "kotlinx-coroutines-core"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class ThreadLocalKt {
public static /* synthetic */ void CommonThreadLocal$annotations() {
}
public static final <T> ThreadLocal<T> commonThreadLocal(Symbol symbol) {
return new ThreadLocal<>();
}
}

View File

@ -0,0 +1,305 @@
package kotlinx.coroutines.internal;
import java.lang.Comparable;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.ArraysKt;
import kotlin.jvm.Volatile;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.DebugKt;
import kotlinx.coroutines.internal.ThreadSafeHeapNode;
/* compiled from: ThreadSafeHeap.kt */
@Metadata(d1 = {"\u0000P\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000f\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0014\b\u0017\u0018\u0000*\u0012\b\u0000\u0010\u0001*\u00020\u0002*\b\u0012\u0004\u0012\u0002H\u00010\u00032\u00060\u0004j\u0002`\u0005B\u0005¢\u0006\u0002\u0010\u0006J\u0015\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00028\u0000H\u0001¢\u0006\u0002\u0010\u0019J\u0013\u0010\u001a\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00028\u0000¢\u0006\u0002\u0010\u0019J,\u0010\u001b\u001a\u00020\r2\u0006\u0010\u0018\u001a\u00028\u00002\u0014\u0010\u001c\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00018\u0000\u0012\u0004\u0012\u00020\r0\u001dH\u0086\\u0006\u0002\u0010\u001eJ\u0006\u0010\u001f\u001a\u00020\u0017J0\u0010 \u001a\u0004\u0018\u00018\u00002!\u0010!\u001a\u001d\u0012\u0013\u0012\u00118\u0000¢\u0006\f\b\"\u0012\b\b#\u0012\u0004\b\b(\u000f\u0012\u0004\u0012\u00020\r0\u001d¢\u0006\u0002\u0010$J\u000f\u0010%\u001a\u0004\u0018\u00018\u0000H\u0001¢\u0006\u0002\u0010&J\r\u0010'\u001a\u0004\u0018\u00018\u0000¢\u0006\u0002\u0010&J\u0015\u0010(\u001a\n\u0012\u0006\u0012\u0004\u0018\u00018\u00000\nH\u0002¢\u0006\u0002\u0010)J\u0013\u0010*\u001a\u00020\r2\u0006\u0010\u0018\u001a\u00028\u0000¢\u0006\u0002\u0010+J\u0015\u0010,\u001a\u00028\u00002\u0006\u0010-\u001a\u00020\u0010H\u0001¢\u0006\u0002\u0010.J$\u0010/\u001a\u0004\u0018\u00018\u00002\u0012\u0010!\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\r0\u001dH\u0086\\u0006\u0002\u0010$J\r\u00100\u001a\u0004\u0018\u00018\u0000¢\u0006\u0002\u0010&J\u0011\u00101\u001a\u00020\u00172\u0006\u00102\u001a\u00020\u0010H\u0082\u0010J\u0011\u00103\u001a\u00020\u00172\u0006\u00102\u001a\u00020\u0010H\u0082\u0010J\u0018\u00104\u001a\u00020\u00172\u0006\u00102\u001a\u00020\u00102\u0006\u00105\u001a\u00020\u0010H\u0002R\t\u0010\u0007\u001a\u00020\bX\u0082\u0004R\u001a\u0010\t\u001a\f\u0012\u0006\u0012\u0004\u0018\u00018\u0000\u0018\u00010\nX\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u000bR\u0011\u0010\f\u001a\u00020\r8F¢\u0006\u0006\u001a\u0004\b\f\u0010\u000eR$\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u000f\u001a\u00020\u00108F@BX\u0086\u000e¢\u0006\f\u001a\u0004\b\u0012\u0010\u0013\"\u0004\b\u0014\u0010\u0015¨\u00066"}, d2 = {"Lkotlinx/coroutines/internal/ThreadSafeHeap;", "T", "Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "()V", "_size", "Lkotlinx/atomicfu/AtomicInt;", "a", "", "[Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "isEmpty", "", "()Z", "value", "", "size", "getSize", "()I", "setSize", "(I)V", "addImpl", "", "node", "(Lkotlinx/coroutines/internal/ThreadSafeHeapNode;)V", "addLast", "addLastIf", "cond", "Lkotlin/Function1;", "(Lkotlinx/coroutines/internal/ThreadSafeHeapNode;Lkotlin/jvm/functions/Function1;)Z", "clear", "find", "predicate", "Lkotlin/ParameterName;", "name", "(Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "firstImpl", "()Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "peek", "realloc", "()[Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "remove", "(Lkotlinx/coroutines/internal/ThreadSafeHeapNode;)Z", "removeAtImpl", "index", "(I)Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "removeFirstIf", "removeFirstOrNull", "siftDownFrom", "i", "siftUpFrom", "swap", "j", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public class ThreadSafeHeap<T extends ThreadSafeHeapNode & Comparable<? super T>> {
private static final AtomicIntegerFieldUpdater _size$FU = AtomicIntegerFieldUpdater.newUpdater(ThreadSafeHeap.class, "_size");
@Volatile
private volatile int _size;
private T[] a;
public final int getSize() {
return _size$FU.get(this);
}
private final void setSize(int i) {
_size$FU.set(this, i);
}
public final boolean isEmpty() {
return getSize() == 0;
}
public final T firstImpl() {
T[] tArr = this.a;
if (tArr != null) {
return tArr[0];
}
return null;
}
public final T removeAtImpl(int index) {
if (DebugKt.getASSERTIONS_ENABLED() && getSize() <= 0) {
throw new AssertionError();
}
T[] tArr = this.a;
Intrinsics.checkNotNull(tArr);
setSize(getSize() - 1);
if (index < getSize()) {
swap(index, getSize());
int i = (index - 1) / 2;
if (index > 0) {
T t = tArr[index];
Intrinsics.checkNotNull(t);
T t2 = tArr[i];
Intrinsics.checkNotNull(t2);
if (((Comparable) t).compareTo(t2) < 0) {
swap(index, i);
siftUpFrom(i);
}
}
siftDownFrom(index);
}
T t3 = tArr[getSize()];
Intrinsics.checkNotNull(t3);
if (DebugKt.getASSERTIONS_ENABLED() && t3.getHeap() != this) {
throw new AssertionError();
}
t3.setHeap(null);
t3.setIndex(-1);
tArr[getSize()] = null;
return t3;
}
public final void addImpl(T node) {
if (DebugKt.getASSERTIONS_ENABLED() && node.getHeap() != null) {
throw new AssertionError();
}
node.setHeap(this);
T[] realloc = realloc();
int size = getSize();
setSize(size + 1);
realloc[size] = node;
node.setIndex(size);
siftUpFrom(size);
}
private final void siftUpFrom(int i) {
while (i > 0) {
T[] tArr = this.a;
Intrinsics.checkNotNull(tArr);
int i2 = (i - 1) / 2;
T t = tArr[i2];
Intrinsics.checkNotNull(t);
T t2 = tArr[i];
Intrinsics.checkNotNull(t2);
if (((Comparable) t).compareTo(t2) <= 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
*/
private 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:
T extends kotlinx.coroutines.internal.ThreadSafeHeapNode & java.lang.Comparable<? super T>[] 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");
}
private final T[] realloc() {
T[] tArr = this.a;
if (tArr == null) {
T[] tArr2 = (T[]) new ThreadSafeHeapNode[4];
this.a = tArr2;
return tArr2;
}
if (getSize() < tArr.length) {
return tArr;
}
Object[] copyOf = Arrays.copyOf(tArr, getSize() * 2);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
T[] tArr3 = (T[]) ((ThreadSafeHeapNode[]) copyOf);
this.a = tArr3;
return tArr3;
}
private final void swap(int i, int j) {
T[] tArr = this.a;
Intrinsics.checkNotNull(tArr);
T t = tArr[j];
Intrinsics.checkNotNull(t);
T t2 = tArr[i];
Intrinsics.checkNotNull(t2);
tArr[i] = t;
tArr[j] = t2;
t.setIndex(i);
t2.setIndex(j);
}
public final void clear() {
synchronized (this) {
T[] tArr = this.a;
if (tArr != null) {
ArraysKt.fill$default(tArr, (Object) null, 0, 0, 6, (Object) null);
}
_size$FU.set(this, 0);
Unit unit = Unit.INSTANCE;
}
}
public final T find(Function1<? super T, Boolean> predicate) {
T t;
synchronized (this) {
int size = getSize();
int i = 0;
while (true) {
t = null;
if (i >= size) {
break;
}
T[] tArr = this.a;
if (tArr != null) {
t = (Object) tArr[i];
}
Intrinsics.checkNotNull(t);
if (predicate.invoke(t).booleanValue()) {
break;
}
i++;
}
}
return t;
}
public final T peek() {
T firstImpl;
synchronized (this) {
firstImpl = firstImpl();
}
return firstImpl;
}
public final T removeFirstOrNull() {
T removeAtImpl;
synchronized (this) {
removeAtImpl = getSize() > 0 ? removeAtImpl(0) : null;
}
return removeAtImpl;
}
public final T removeFirstIf(Function1<? super T, Boolean> predicate) {
synchronized (this) {
try {
T firstImpl = firstImpl();
if (firstImpl == null) {
InlineMarker.finallyStart(2);
InlineMarker.finallyEnd(2);
return null;
}
T removeAtImpl = predicate.invoke(firstImpl).booleanValue() ? removeAtImpl(0) : null;
InlineMarker.finallyStart(1);
InlineMarker.finallyEnd(1);
return removeAtImpl;
} catch (Throwable th) {
InlineMarker.finallyStart(1);
InlineMarker.finallyEnd(1);
throw th;
}
}
}
public final void addLast(T node) {
synchronized (this) {
addImpl(node);
Unit unit = Unit.INSTANCE;
}
}
public final boolean addLastIf(T node, Function1<? super T, Boolean> cond) {
boolean z;
synchronized (this) {
try {
if (cond.invoke(firstImpl()).booleanValue()) {
addImpl(node);
z = true;
} else {
z = false;
}
InlineMarker.finallyStart(1);
} catch (Throwable th) {
InlineMarker.finallyStart(1);
InlineMarker.finallyEnd(1);
throw th;
}
}
InlineMarker.finallyEnd(1);
return z;
}
public final boolean remove(T node) {
boolean z;
synchronized (this) {
if (node.getHeap() == null) {
z = false;
} else {
int index = node.getIndex();
if (DebugKt.getASSERTIONS_ENABLED() && index < 0) {
throw new AssertionError();
}
removeAtImpl(index);
z = true;
}
}
return z;
}
}

View File

@ -0,0 +1,16 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: ThreadSafeHeap.kt */
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0005\bg\u0018\u00002\u00020\u0001R\u001e\u0010\u0002\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u0003X¦\u000e¢\u0006\f\u001a\u0004\b\u0004\u0010\u0005\"\u0004\b\u0006\u0010\u0007R\u0018\u0010\b\u001a\u00020\tX¦\u000e¢\u0006\f\u001a\u0004\b\n\u0010\u000b\"\u0004\b\f\u0010\\u0006\u000e"}, d2 = {"Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "", "heap", "Lkotlinx/coroutines/internal/ThreadSafeHeap;", "getHeap", "()Lkotlinx/coroutines/internal/ThreadSafeHeap;", "setHeap", "(Lkotlinx/coroutines/internal/ThreadSafeHeap;)V", "index", "", "getIndex", "()I", "setIndex", "(I)V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public interface ThreadSafeHeapNode {
ThreadSafeHeap<?> getHeap();
int getIndex();
void setHeap(ThreadSafeHeap<?> threadSafeHeap);
void setIndex(int i);
}

View File

@ -0,0 +1,50 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.ThreadContextElement;
/* compiled from: ThreadContext.kt */
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0004\b\u0002\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u001c\u0010\u000e\u001a\u00020\u000f2\n\u0010\u0010\u001a\u0006\u0012\u0002\b\u00030\t2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0001J\u000e\u0010\u0012\u001a\u00020\u000f2\u0006\u0010\u0002\u001a\u00020\u0003R\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R \u0010\u0007\u001a\u0012\u0012\u000e\u0012\f\u0012\u0006\u0012\u0004\u0018\u00010\u0001\u0018\u00010\t0\bX\u0082\u0004¢\u0006\u0004\n\u0002\u0010\nR\u000e\u0010\u000b\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0018\u0010\f\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00010\bX\u0082\u0004¢\u0006\u0004\n\u0002\u0010\\u0006\u0013"}, d2 = {"Lkotlinx/coroutines/internal/ThreadState;", "", "context", "Lkotlin/coroutines/CoroutineContext;", "n", "", "(Lkotlin/coroutines/CoroutineContext;I)V", "elements", "", "Lkotlinx/coroutines/ThreadContextElement;", "[Lkotlinx/coroutines/ThreadContextElement;", "i", "values", "[Ljava/lang/Object;", "append", "", "element", "value", "restore", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
final class ThreadState {
public final CoroutineContext context;
private final ThreadContextElement<Object>[] elements;
private int i;
private 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<?> element, Object value) {
Object[] objArr = this.values;
int i = this.i;
objArr[i] = value;
ThreadContextElement<Object>[] threadContextElementArr = this.elements;
this.i = i + 1;
Intrinsics.checkNotNull(element, "null cannot be cast to non-null type kotlinx.coroutines.ThreadContextElement<kotlin.Any?>");
threadContextElementArr[i] = element;
}
public final void restore(CoroutineContext context) {
int length = this.elements.length - 1;
if (length < 0) {
return;
}
while (true) {
int i = length - 1;
ThreadContextElement<Object> threadContextElement = this.elements[length];
Intrinsics.checkNotNull(threadContextElement);
threadContextElement.restoreThreadContext(context, this.values[length]);
if (i < 0) {
return;
} else {
length = i;
}
}
}
}

View File

@ -0,0 +1,12 @@
package kotlinx.coroutines.internal;
import kotlin.Metadata;
/* compiled from: OnUndeliveredElement.kt */
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\b\u0000\u0018\u00002\u00060\u0001j\u0002`\u0002B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007¨\u0006\b"}, d2 = {"Lkotlinx/coroutines/internal/UndeliveredElementException;", "Ljava/lang/RuntimeException;", "Lkotlin/RuntimeException;", "message", "", "cause", "", "(Ljava/lang/String;Ljava/lang/Throwable;)V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class UndeliveredElementException extends RuntimeException {
public UndeliveredElementException(String str, Throwable th) {
super(str, th);
}
}

View File

@ -0,0 +1,63 @@
package kotlinx.coroutines.internal;
import java.util.WeakHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
/* compiled from: ExceptionsConstructor.kt */
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J*\u0010\u000b\u001a\u0014\u0012\u0004\u0012\u00020\b\u0012\u0006\u0012\u0004\u0018\u00010\b0\tj\u0002`\n2\u000e\u0010\f\u001a\n\u0012\u0006\b\u0001\u0012\u00020\b0\u0007H\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R4\u0010\u0005\u001a(\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020\b0\u0007\u0012\u0016\u0012\u0014\u0012\u0004\u0012\u00020\b\u0012\u0006\u0012\u0004\u0018\u00010\b0\tj\u0002`\n0\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lkotlinx/coroutines/internal/WeakMapCtorCache;", "Lkotlinx/coroutines/internal/CtorCache;", "()V", "cacheLock", "Ljava/util/concurrent/locks/ReentrantReadWriteLock;", "exceptionCtors", "Ljava/util/WeakHashMap;", "Ljava/lang/Class;", "", "Lkotlin/Function1;", "Lkotlinx/coroutines/internal/Ctor;", "get", "key", "kotlinx-coroutines-core"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
final class WeakMapCtorCache extends CtorCache {
public static final WeakMapCtorCache INSTANCE = new WeakMapCtorCache();
private static final ReentrantReadWriteLock cacheLock = new ReentrantReadWriteLock();
private static final WeakHashMap<Class<? extends Throwable>, Function1<Throwable, Throwable>> exceptionCtors = new WeakHashMap<>();
private WeakMapCtorCache() {
}
@Override // kotlinx.coroutines.internal.CtorCache
public Function1<Throwable, Throwable> get(Class<? extends Throwable> key) {
Function1<Throwable, Throwable> createConstructor;
ReentrantReadWriteLock reentrantReadWriteLock = cacheLock;
ReentrantReadWriteLock.ReadLock readLock = reentrantReadWriteLock.readLock();
readLock.lock();
try {
Function1<Throwable, Throwable> function1 = exceptionCtors.get(key);
if (function1 != null) {
return function1;
}
ReentrantReadWriteLock.ReadLock readLock2 = reentrantReadWriteLock.readLock();
int i = 0;
int readHoldCount = reentrantReadWriteLock.getWriteHoldCount() == 0 ? reentrantReadWriteLock.getReadHoldCount() : 0;
for (int i2 = 0; i2 < readHoldCount; i2++) {
readLock2.unlock();
}
ReentrantReadWriteLock.WriteLock writeLock = reentrantReadWriteLock.writeLock();
writeLock.lock();
try {
WeakHashMap<Class<? extends Throwable>, Function1<Throwable, Throwable>> weakHashMap = exceptionCtors;
Function1<Throwable, Throwable> function12 = weakHashMap.get(key);
if (function12 != null) {
return function12;
}
createConstructor = ExceptionsConstructorKt.createConstructor(key);
weakHashMap.put(key, createConstructor);
while (i < readHoldCount) {
readLock2.lock();
i++;
}
writeLock.unlock();
return createConstructor;
} finally {
while (i < readHoldCount) {
readLock2.lock();
i++;
}
writeLock.unlock();
}
} finally {
readLock.unlock();
}
}
}