SegmentPool.smali
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
.class final Lokio/SegmentPool;
.super Ljava/lang/Object;
.source "SegmentPool.java"
# static fields
.field static final MAX_SIZE:J = 0x10000L
.field static byteCount:J
.field static next:Lokio/Segment;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
# direct methods
.method private constructor <init>()V
.locals 0
.line 35
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method static recycle(Lokio/Segment;)V
.locals 7
.line 52
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
.line 53
iget-boolean v0, p0, Lokio/Segment;->shared:Z
if-eqz v0, :cond_0
return-void
.line 54
:cond_0
const-class v0, Lokio/SegmentPool;
monitor-enter v0
.line 55
: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 v1, v1, v5
if-lez v1, :cond_1
monitor-exit v0
return-void
.line 56
:cond_1
sget-wide v1, Lokio/SegmentPool;->byteCount:J
add-long/2addr v1, v3
sput-wide v1, Lokio/SegmentPool;->byteCount:J
.line 57
sget-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
iput-object v1, p0, Lokio/Segment;->next:Lokio/Segment;
const/4 v1, 0x0
.line 58
iput v1, p0, Lokio/Segment;->limit:I
iput v1, p0, Lokio/Segment;->pos:I
.line 59
sput-object p0, Lokio/SegmentPool;->next:Lokio/Segment;
.line 60
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
.line 52
: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
.line 39
const-class v0, Lokio/SegmentPool;
monitor-enter v0
.line 40
:try_start_0
sget-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
if-eqz v1, :cond_0
.line 41
sget-object v1, Lokio/SegmentPool;->next:Lokio/Segment;
.line 42
iget-object v2, v1, Lokio/Segment;->next:Lokio/Segment;
sput-object v2, Lokio/SegmentPool;->next:Lokio/Segment;
const/4 v2, 0x0
.line 43
iput-object v2, v1, Lokio/Segment;->next:Lokio/Segment;
.line 44
sget-wide v2, Lokio/SegmentPool;->byteCount:J
const-wide/16 v4, 0x2000
sub-long/2addr v2, v4
sput-wide v2, Lokio/SegmentPool;->byteCount:J
.line 45
monitor-exit v0
return-object v1
.line 47
:cond_0
monitor-exit v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 48
new-instance v0, Lokio/Segment;
invoke-direct {v0}, Lokio/Segment;-><init>()V
return-object v0
:catchall_0
move-exception v1
.line 47
:try_start_1
monitor-exit v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v1
.end method