.class public abstract Lk0/a/o0; .super Lk0/a/p0; .source "EventLoop.common.kt" # interfaces .implements Lk0/a/e0; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lk0/a/o0$b;, Lk0/a/o0$a;, Lk0/a/o0$c; } .end annotation # static fields .field public static final g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; .field public static final h:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; # instance fields .field public volatile _delayed:Ljava/lang/Object; .field public volatile _queue:Ljava/lang/Object; .field public volatile isCompleted:Z # direct methods .method public static constructor ()V .locals 3 const-class v0, Ljava/lang/Object; const-class v1, Lk0/a/o0; const-string v2, "_queue" invoke-static {v1, v0, v2}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->newUpdater(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; move-result-object v2 sput-object v2, Lk0/a/o0;->g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; const-string v2, "_delayed" invoke-static {v1, v0, v2}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->newUpdater(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; move-result-object v0 sput-object v0, Lk0/a/o0;->h:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; return-void .end method .method public constructor ()V .locals 1 invoke-direct {p0}, Lk0/a/p0;->()V const/4 v0, 0x0 iput-object v0, p0, Lk0/a/o0;->_queue:Ljava/lang/Object; iput-object v0, p0, Lk0/a/o0;->_delayed:Ljava/lang/Object; return-void .end method # virtual methods .method public final F(Ljava/lang/Runnable;)V .locals 1 invoke-virtual {p0, p1}, Lk0/a/o0;->G(Ljava/lang/Runnable;)Z move-result v0 if-eqz v0, :cond_0 invoke-virtual {p0}, Lk0/a/p0;->D()Ljava/lang/Thread; move-result-object p1 invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; move-result-object v0 if-eq v0, p1, :cond_1 invoke-static {p1}, Ljava/util/concurrent/locks/LockSupport;->unpark(Ljava/lang/Thread;)V goto :goto_0 :cond_0 sget-object v0, Lk0/a/c0;->j:Lk0/a/c0; invoke-virtual {v0, p1}, Lk0/a/o0;->F(Ljava/lang/Runnable;)V :cond_1 :goto_0 return-void .end method .method public final G(Ljava/lang/Runnable;)Z .locals 5 :cond_0 :goto_0 iget-object v0, p0, Lk0/a/o0;->_queue:Ljava/lang/Object; iget-boolean v1, p0, Lk0/a/o0;->isCompleted:Z const/4 v2, 0x0 if-eqz v1, :cond_1 return v2 :cond_1 const/4 v1, 0x1 if-nez v0, :cond_2 sget-object v0, Lk0/a/o0;->g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; const/4 v2, 0x0 invoke-virtual {v0, p0, v2, p1}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z move-result v0 if-eqz v0, :cond_0 return v1 :cond_2 instance-of v3, v0, Lk0/a/r1/o; if-eqz v3, :cond_6 move-object v3, v0 check-cast v3, Lk0/a/r1/o; invoke-virtual {v3, p1}, Lk0/a/r1/o;->b(Ljava/lang/Object;)I move-result v4 if-eqz v4, :cond_5 if-eq v4, v1, :cond_4 const/4 v0, 0x2 if-eq v4, v0, :cond_3 goto :goto_0 :cond_3 return v2 :cond_4 sget-object v1, Lk0/a/o0;->g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; invoke-virtual {v3}, Lk0/a/r1/o;->e()Lk0/a/r1/o; move-result-object v2 invoke-virtual {v1, p0, v0, v2}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z goto :goto_0 :cond_5 return v1 :cond_6 sget-object v3, Lk0/a/q0;->b:Lk0/a/r1/v; if-ne v0, v3, :cond_7 return v2 :cond_7 new-instance v2, Lk0/a/r1/o; const/16 v3, 0x8 invoke-direct {v2, v3, v1}, Lk0/a/r1/o;->(IZ)V move-object v3, v0 check-cast v3, Ljava/lang/Runnable; invoke-virtual {v2, v3}, Lk0/a/r1/o;->b(Ljava/lang/Object;)I invoke-virtual {v2, p1}, Lk0/a/r1/o;->b(Ljava/lang/Object;)I sget-object v3, Lk0/a/o0;->g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; invoke-virtual {v3, p0, v0, v2}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z move-result v0 if-eqz v0, :cond_0 return v1 .end method .method public I()J .locals 7 iget-object v0, p0, Lk0/a/n0;->f:Lk0/a/r1/a; const-wide v1, 0x7fffffffffffffffL const-wide/16 v3, 0x0 if-eqz v0, :cond_2 iget v5, v0, Lk0/a/r1/a;->b:I iget v0, v0, Lk0/a/r1/a;->c:I if-ne v5, v0, :cond_0 const/4 v0, 0x1 goto :goto_0 :cond_0 const/4 v0, 0x0 :goto_0 if-eqz v0, :cond_1 goto :goto_1 :cond_1 move-wide v5, v3 goto :goto_2 :cond_2 :goto_1 move-wide v5, v1 :goto_2 cmp-long v0, v5, v3 if-nez v0, :cond_3 return-wide v3 :cond_3 iget-object v0, p0, Lk0/a/o0;->_queue:Ljava/lang/Object; if-nez v0, :cond_4 goto :goto_3 :cond_4 instance-of v5, v0, Lk0/a/r1/o; if-eqz v5, :cond_8 check-cast v0, Lk0/a/r1/o; invoke-virtual {v0}, Lk0/a/r1/o;->d()Z move-result v0 if-nez v0, :cond_5 return-wide v3 :cond_5 :goto_3 iget-object v0, p0, Lk0/a/o0;->_delayed:Ljava/lang/Object; check-cast v0, Lk0/a/o0$c; if-eqz v0, :cond_7 monitor-enter v0 :try_start_0 invoke-virtual {v0}, Lk0/a/r1/y;->b()Lk0/a/r1/z; move-result-object v5 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 monitor-exit v0 check-cast v5, Lk0/a/o0$b; if-eqz v5, :cond_7 iget-wide v0, v5, Lk0/a/o0$b;->f:J invoke-static {}, Ljava/lang/System;->nanoTime()J move-result-wide v5 sub-long/2addr v0, v5 cmp-long v2, v0, v3 if-gez v2, :cond_6 goto :goto_4 :cond_6 move-wide v3, v0 :goto_4 return-wide v3 :catchall_0 move-exception v1 monitor-exit v0 throw v1 :cond_7 return-wide v1 :cond_8 sget-object v5, Lk0/a/q0;->b:Lk0/a/r1/v; if-ne v0, v5, :cond_9 return-wide v1 :cond_9 return-wide v3 .end method .method public K()Z .locals 4 iget-object v0, p0, Lk0/a/n0;->f:Lk0/a/r1/a; const/4 v1, 0x1 const/4 v2, 0x0 if-eqz v0, :cond_1 iget v3, v0, Lk0/a/r1/a;->b:I iget v0, v0, Lk0/a/r1/a;->c:I if-ne v3, v0, :cond_0 goto :goto_0 :cond_0 const/4 v0, 0x0 goto :goto_1 :cond_1 :goto_0 const/4 v0, 0x1 :goto_1 if-nez v0, :cond_2 return v2 :cond_2 iget-object v0, p0, Lk0/a/o0;->_delayed:Ljava/lang/Object; check-cast v0, Lk0/a/o0$c; if-eqz v0, :cond_4 iget v0, v0, Lk0/a/r1/y;->_size:I if-nez v0, :cond_3 const/4 v0, 0x1 goto :goto_2 :cond_3 const/4 v0, 0x0 :goto_2 if-nez v0, :cond_4 return v2 :cond_4 iget-object v0, p0, Lk0/a/o0;->_queue:Ljava/lang/Object; if-nez v0, :cond_5 goto :goto_3 :cond_5 instance-of v3, v0, Lk0/a/r1/o; if-eqz v3, :cond_6 check-cast v0, Lk0/a/r1/o; invoke-virtual {v0}, Lk0/a/r1/o;->d()Z move-result v1 goto :goto_3 :cond_6 sget-object v3, Lk0/a/q0;->b:Lk0/a/r1/v; if-ne v0, v3, :cond_7 goto :goto_3 :cond_7 const/4 v1, 0x0 :goto_3 return v1 .end method .method public L()J .locals 16 move-object/from16 v1, p0 invoke-virtual/range {p0 .. p0}, Lk0/a/n0;->C()Z move-result v0 if-eqz v0, :cond_0 invoke-virtual/range {p0 .. p0}, Lk0/a/o0;->I()J move-result-wide v2 return-wide v2 :cond_0 iget-object v0, v1, Lk0/a/o0;->_delayed:Ljava/lang/Object; move-object v2, v0 check-cast v2, Lk0/a/o0$c; const/4 v0, 0x0 const-wide/16 v3, 0x0 const/4 v5, 0x0 if-eqz v2, :cond_6 iget v6, v2, Lk0/a/r1/y;->_size:I const/4 v7, 0x1 if-nez v6, :cond_1 const/4 v6, 0x1 goto :goto_0 :cond_1 const/4 v6, 0x0 :goto_0 if-nez v6, :cond_6 invoke-static {}, Ljava/lang/System;->nanoTime()J move-result-wide v8 :goto_1 monitor-enter v2 :try_start_0 invoke-virtual {v2}, Lk0/a/r1/y;->b()Lk0/a/r1/z; move-result-object v6 if-eqz v6, :cond_5 check-cast v6, Lk0/a/o0$b; iget-wide v10, v6, Lk0/a/o0$b;->f:J sub-long v10, v8, v10 cmp-long v12, v10, v3 if-ltz v12, :cond_2 const/4 v10, 0x1 goto :goto_2 :cond_2 const/4 v10, 0x0 :goto_2 if-eqz v10, :cond_3 invoke-virtual {v1, v6}, Lk0/a/o0;->G(Ljava/lang/Runnable;)Z move-result v6 goto :goto_3 :cond_3 const/4 v6, 0x0 :goto_3 if-eqz v6, :cond_4 invoke-virtual {v2, v5}, Lk0/a/r1/y;->c(I)Lk0/a/r1/z; move-result-object v6 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 goto :goto_4 :cond_4 move-object v6, v0 :goto_4 monitor-exit v2 goto :goto_5 :cond_5 monitor-exit v2 move-object v6, v0 :goto_5 check-cast v6, Lk0/a/o0$b; if-eqz v6, :cond_6 goto :goto_1 :catchall_0 move-exception v0 monitor-exit v2 throw v0 :cond_6 :goto_6 iget-object v2, v1, Lk0/a/o0;->_queue:Ljava/lang/Object; if-nez v2, :cond_7 goto/16 :goto_c :cond_7 instance-of v6, v2, Lk0/a/r1/o; if-eqz v6, :cond_11 move-object v6, v2 check-cast v6, Lk0/a/r1/o; :cond_8 :goto_7 iget-wide v9, v6, Lk0/a/r1/o;->_state$internal:J const-wide/high16 v7, 0x1000000000000000L and-long/2addr v7, v9 cmp-long v11, v7, v3 if-eqz v11, :cond_9 sget-object v7, Lk0/a/r1/o;->g:Lk0/a/r1/v; goto :goto_9 :cond_9 const-wide/32 v7, 0x3fffffff and-long/2addr v7, v9 shr-long/2addr v7, v5 long-to-int v13, v7 const-wide v7, 0xfffffffc0000000L and-long/2addr v7, v9 const/16 v11, 0x1e shr-long/2addr v7, v11 long-to-int v8, v7 iget v7, v6, Lk0/a/r1/o;->a:I and-int/2addr v8, v7 and-int/2addr v7, v13 if-ne v8, v7, :cond_a goto :goto_8 :cond_a iget-object v8, v6, Lk0/a/r1/o;->b:Ljava/util/concurrent/atomic/AtomicReferenceArray; invoke-virtual {v8, v7}, Ljava/util/concurrent/atomic/AtomicReferenceArray;->get(I)Ljava/lang/Object; move-result-object v14 if-nez v14, :cond_b iget-boolean v7, v6, Lk0/a/r1/o;->d:Z if-eqz v7, :cond_8 goto :goto_8 :cond_b instance-of v7, v14, Lk0/a/r1/o$b; if-eqz v7, :cond_c :goto_8 move-object v7, v0 :goto_9 move-object v14, v7 goto :goto_b :cond_c add-int/lit8 v7, v13, 0x1 const v8, 0x3fffffff # 1.9999999f and-int v15, v7, v8 sget-object v7, Lk0/a/r1/o;->f:Ljava/util/concurrent/atomic/AtomicLongFieldUpdater; const-wide/32 v11, -0x40000000 and-long/2addr v11, v9 int-to-long v3, v15 shl-long/2addr v3, v5 or-long/2addr v11, v3 move-object v8, v6 invoke-virtual/range {v7 .. v12}, Ljava/util/concurrent/atomic/AtomicLongFieldUpdater;->compareAndSet(Ljava/lang/Object;JJ)Z move-result v3 if-eqz v3, :cond_d iget-object v3, v6, Lk0/a/r1/o;->b:Ljava/util/concurrent/atomic/AtomicReferenceArray; iget v4, v6, Lk0/a/r1/o;->a:I and-int/2addr v4, v13 invoke-virtual {v3, v4, v0}, Ljava/util/concurrent/atomic/AtomicReferenceArray;->set(ILjava/lang/Object;)V goto :goto_b :cond_d iget-boolean v3, v6, Lk0/a/r1/o;->d:Z if-nez v3, :cond_e const-wide/16 v3, 0x0 goto :goto_7 :cond_e move-object v3, v6 :goto_a invoke-static {v3, v13, v15}, Lk0/a/r1/o;->a(Lk0/a/r1/o;II)Lk0/a/r1/o; move-result-object v3 if-eqz v3, :cond_f goto :goto_a :cond_f :goto_b sget-object v3, Lk0/a/r1/o;->g:Lk0/a/r1/v; if-eq v14, v3, :cond_10 move-object v0, v14 check-cast v0, Ljava/lang/Runnable; goto :goto_c :cond_10 sget-object v3, Lk0/a/o0;->g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; invoke-virtual {v6}, Lk0/a/r1/o;->e()Lk0/a/r1/o; move-result-object v4 invoke-virtual {v3, v1, v2, v4}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z goto :goto_d :cond_11 sget-object v3, Lk0/a/q0;->b:Lk0/a/r1/v; if-ne v2, v3, :cond_12 goto :goto_c :cond_12 sget-object v3, Lk0/a/o0;->g:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; invoke-virtual {v3, v1, v2, v0}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_14 move-object v0, v2 check-cast v0, Ljava/lang/Runnable; :goto_c if-eqz v0, :cond_13 invoke-interface {v0}, Ljava/lang/Runnable;->run()V :cond_13 invoke-virtual/range {p0 .. p0}, Lk0/a/o0;->I()J move-result-wide v2 return-wide v2 :cond_14 :goto_d const-wide/16 v3, 0x0 goto/16 :goto_6 .end method .method public final M(JLk0/a/o0$b;)V .locals 12 iget-boolean v0, p0, Lk0/a/o0;->isCompleted:Z const/4 v1, 0x2 const/4 v2, 0x0 const/4 v3, 0x0 const/4 v4, 0x1 if-eqz v0, :cond_0 goto :goto_1 :cond_0 iget-object v0, p0, Lk0/a/o0;->_delayed:Ljava/lang/Object; check-cast v0, Lk0/a/o0$c; if-eqz v0, :cond_1 goto :goto_0 :cond_1 sget-object v0, Lk0/a/o0;->h:Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater; new-instance v5, Lk0/a/o0$c; invoke-direct {v5, p1, p2}, Lk0/a/o0$c;->(J)V invoke-virtual {v0, p0, v3, v5}, Ljava/util/concurrent/atomic/AtomicReferenceFieldUpdater;->compareAndSet(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z iget-object v0, p0, Lk0/a/o0;->_delayed:Ljava/lang/Object; if-eqz v0, :cond_e check-cast v0, Lk0/a/o0$c; :goto_0 monitor-enter p3 :try_start_0 iget-object v5, p3, Lk0/a/o0$b;->d:Ljava/lang/Object; sget-object v6, Lk0/a/q0;->a:Lk0/a/r1/v; :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_2 if-ne v5, v6, :cond_2 monitor-exit p3 const/4 v0, 0x2 goto :goto_3 :cond_2 :try_start_1 monitor-enter v0 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_2 :try_start_2 invoke-virtual {v0}, Lk0/a/r1/y;->b()Lk0/a/r1/z; move-result-object v5 check-cast v5, Lk0/a/o0$b; iget-boolean v6, p0, Lk0/a/o0;->isCompleted:Z :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_1 if-eqz v6, :cond_3 :try_start_3 monitor-exit v0 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_2 monitor-exit p3 :goto_1 const/4 v0, 0x1 goto :goto_3 :cond_3 const-wide/16 v6, 0x0 if-nez v5, :cond_4 :try_start_4 iput-wide p1, v0, Lk0/a/o0$c;->b:J goto :goto_2 :cond_4 iget-wide v8, v5, Lk0/a/o0$b;->f:J sub-long v10, v8, p1 cmp-long v5, v10, v6 if-ltz v5, :cond_5 move-wide v8, p1 :cond_5 iget-wide v10, v0, Lk0/a/o0$c;->b:J sub-long v10, v8, v10 cmp-long v5, v10, v6 if-lez v5, :cond_6 iput-wide v8, v0, Lk0/a/o0$c;->b:J :cond_6 :goto_2 iget-wide v8, p3, Lk0/a/o0$b;->f:J iget-wide v10, v0, Lk0/a/o0$c;->b:J sub-long/2addr v8, v10 cmp-long v5, v8, v6 if-gez v5, :cond_7 iget-wide v5, v0, Lk0/a/o0$c;->b:J iput-wide v5, p3, Lk0/a/o0$b;->f:J :cond_7 invoke-virtual {v0, p3}, Lk0/a/r1/y;->a(Lk0/a/r1/z;)V :try_end_4 .catchall {:try_start_4 .. :try_end_4} :catchall_1 :try_start_5 monitor-exit v0 :try_end_5 .catchall {:try_start_5 .. :try_end_5} :catchall_2 monitor-exit p3 const/4 v0, 0x0 :goto_3 if-eqz v0, :cond_a if-eq v0, v4, :cond_9 if-ne v0, v1, :cond_8 goto :goto_5 :cond_8 const-string p1, "unexpected result" new-instance p2, Ljava/lang/IllegalStateException; invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p2, p1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw p2 :cond_9 invoke-virtual {p0, p1, p2, p3}, Lk0/a/p0;->E(JLk0/a/o0$b;)V goto :goto_5 :cond_a iget-object p1, p0, Lk0/a/o0;->_delayed:Ljava/lang/Object; check-cast p1, Lk0/a/o0$c; if-eqz p1, :cond_b monitor-enter p1 :try_start_6 invoke-virtual {p1}, Lk0/a/r1/y;->b()Lk0/a/r1/z; move-result-object p2 :try_end_6 .catchall {:try_start_6 .. :try_end_6} :catchall_0 monitor-exit p1 move-object v3, p2 check-cast v3, Lk0/a/o0$b; goto :goto_4 :catchall_0 move-exception p2 monitor-exit p1 throw p2 :cond_b :goto_4 if-ne v3, p3, :cond_c const/4 v2, 0x1 :cond_c if-eqz v2, :cond_d invoke-virtual {p0}, Lk0/a/p0;->D()Ljava/lang/Thread; move-result-object p1 invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; move-result-object p2 if-eq p2, p1, :cond_d invoke-static {p1}, Ljava/util/concurrent/locks/LockSupport;->unpark(Ljava/lang/Thread;)V :cond_d :goto_5 return-void :catchall_1 move-exception p1 :try_start_7 monitor-exit v0 throw p1 :try_end_7 .catchall {:try_start_7 .. :try_end_7} :catchall_2 :catchall_2 move-exception p1 monitor-exit p3 throw p1 :cond_e invoke-static {}, Lj0/n/c/h;->throwNpe()V throw v3 .end method .method public b(JLk0/a/f;)V .locals 3 .annotation system Ldalvik/annotation/Signature; value = { "(J", "Lk0/a/f<", "-", "Lkotlin/Unit;", ">;)V" } .end annotation invoke-static {p1, p2}, Lk0/a/q0;->a(J)J move-result-wide p1 const-wide v0, 0x3fffffffffffffffL # 1.9999999999999998 cmp-long v2, p1, v0 if-gez v2, :cond_0 invoke-static {}, Ljava/lang/System;->nanoTime()J move-result-wide v0 new-instance v2, Lk0/a/o0$a; add-long/2addr p1, v0 invoke-direct {v2, p0, p1, p2, p3}, Lk0/a/o0$a;->(Lk0/a/o0;JLk0/a/f;)V new-instance p1, Lk0/a/l0; invoke-direct {p1, v2}, Lk0/a/l0;->(Lk0/a/k0;)V invoke-interface {p3, p1}, Lk0/a/f;->b(Lkotlin/jvm/functions/Function1;)V invoke-virtual {p0, v0, v1, v2}, Lk0/a/o0;->M(JLk0/a/o0$b;)V :cond_0 return-void .end method .method public final dispatch(Lkotlin/coroutines/CoroutineContext;Ljava/lang/Runnable;)V .locals 0 if-eqz p1, :cond_0 invoke-virtual {p0, p2}, Lk0/a/o0;->F(Ljava/lang/Runnable;)V return-void :cond_0 const-string p1, "context" invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V const/4 p1, 0x0 throw p1 .end method