123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- .class final Lokio/SegmentPool;
- .super Ljava/lang/Object;
- .source ""
- # static fields
- .field static final MAX_SIZE:J = 0x10000L
- .field static byteCount:J
- .field static next:Lokio/Segment;
- # direct methods
- .method private constructor <init>()V
- .locals 0
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
- .end method
- .method static recycle(Lokio/Segment;)V
- .locals 8
- iget-object v0, p0, Lokio/Segment;->next:Lokio/Segment;
- if-nez v0, :cond_2
- iget-object v0, p0, Lokio/Segment;->prev:Lokio/Segment;
- if-nez v0, :cond_2
- iget-boolean v0, p0, Lokio/Segment;->shared:Z
- if-eqz v0, :cond_0
- return-void
- :cond_0
- const-class v0, Lokio/SegmentPool;
- monitor-enter v0
- :try_start_0
- sget-wide v1, Lokio/SegmentPool;->byteCount:J
- const-wide/16 v3, 0x2000
- add-long/2addr v1, v3
- const-wide/32 v5, 0x10000
- cmp-long v7, v1, v5
- if-lez v7, :cond_1
- monitor-exit v0
- return-void
- :cond_1
- sget-wide v1, Lokio/SegmentPool;->byteCount:J
- add-long/2addr v1, v3
- sput-wide v1, Lokio/SegmentPool;->byteCount:J
- sget-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
- iput-object v1, p0, Lokio/Segment;->next:Lokio/Segment;
- const/4 v1, 0x0
- iput v1, p0, Lokio/Segment;->limit:I
- iput v1, p0, Lokio/Segment;->pos:I
- sput-object p0, Lokio/SegmentPool;->next:Lokio/Segment;
- monitor-exit v0
- return-void
- :catchall_0
- move-exception p0
- monitor-exit v0
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- throw p0
- :cond_2
- new-instance p0, Ljava/lang/IllegalArgumentException;
- invoke-direct {p0}, Ljava/lang/IllegalArgumentException;-><init>()V
- throw p0
- .end method
- .method static take()Lokio/Segment;
- .locals 6
- const-class v0, Lokio/SegmentPool;
- monitor-enter v0
- :try_start_0
- sget-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
- if-eqz v1, :cond_0
- sget-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
- iget-object v2, v1, Lokio/Segment;->next:Lokio/Segment;
- sput-object v2, Lokio/SegmentPool;->next:Lokio/Segment;
- const/4 v2, 0x0
- iput-object v2, v1, Lokio/Segment;->next:Lokio/Segment;
- sget-wide v2, Lokio/SegmentPool;->byteCount:J
- const-wide/16 v4, 0x2000
- sub-long/2addr v2, v4
- sput-wide v2, Lokio/SegmentPool;->byteCount:J
- monitor-exit v0
- return-object v1
- :cond_0
- monitor-exit v0
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- new-instance v0, Lokio/Segment;
- invoke-direct {v0}, Lokio/Segment;-><init>()V
- return-object v0
- :catchall_0
- move-exception v1
- :try_start_1
- monitor-exit v0
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- throw v1
- .end method
|