apkfuckery/com.discord/smali/androidx/collection/LruCache.smali

969 lines
21 KiB
Smali
Raw Normal View History

2020-05-17 12:40:10 +00:00
.class public Landroidx/collection/LruCache;
.super Ljava/lang/Object;
.source "LruCache.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
"V:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;"
}
.end annotation
# instance fields
.field public createCount:I
.field public evictionCount:I
.field public hitCount:I
.field public final map:Ljava/util/LinkedHashMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/LinkedHashMap<",
"TK;TV;>;"
}
.end annotation
.end field
.field public maxSize:I
.field public missCount:I
.field public putCount:I
.field public size:I
# direct methods
.method public constructor <init>(I)V
.locals 3
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
if-lez p1, :cond_0
iput p1, p0, Landroidx/collection/LruCache;->maxSize:I
new-instance p1, Ljava/util/LinkedHashMap;
const/4 v0, 0x0
const/high16 v1, 0x3f400000 # 0.75f
const/4 v2, 0x1
invoke-direct {p1, v0, v1, v2}, Ljava/util/LinkedHashMap;-><init>(IFZ)V
iput-object p1, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
return-void
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string v0, "maxSize <= 0"
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method private safeSizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;TV;)I"
}
.end annotation
invoke-virtual {p0, p1, p2}, Landroidx/collection/LruCache;->sizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
move-result v0
if-ltz v0, :cond_0
return v0
:cond_0
new-instance v0, Ljava/lang/IllegalStateException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "Negative size: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
const-string p1, "="
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {v0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
# virtual methods
.method public create(Ljava/lang/Object;)Ljava/lang/Object;
.locals 0
.param p1 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)TV;"
}
.end annotation
const/4 p1, 0x0
return-object p1
.end method
.method public final declared-synchronized createCount()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->createCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public entryRemoved(ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
.locals 0
.param p2 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p3 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p4 # Ljava/lang/Object;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(ZTK;TV;TV;)V"
}
.end annotation
return-void
.end method
.method public final evictAll()V
.locals 1
const/4 v0, -0x1
invoke-virtual {p0, v0}, Landroidx/collection/LruCache;->trimToSize(I)V
return-void
.end method
.method public final declared-synchronized evictionCount()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->evictionCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final get(Ljava/lang/Object;)Ljava/lang/Object;
.locals 4
.param p1 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)TV;"
}
.end annotation
if-eqz p1, :cond_4
monitor-enter p0
:try_start_0
iget-object v0, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v0, p1}, Ljava/util/LinkedHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
if-eqz v0, :cond_0
iget p1, p0, Landroidx/collection/LruCache;->hitCount:I
add-int/lit8 p1, p1, 0x1
iput p1, p0, Landroidx/collection/LruCache;->hitCount:I
monitor-exit p0
return-object v0
:cond_0
iget v0, p0, Landroidx/collection/LruCache;->missCount:I
add-int/lit8 v0, v0, 0x1
iput v0, p0, Landroidx/collection/LruCache;->missCount:I
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
invoke-virtual {p0, p1}, Landroidx/collection/LruCache;->create(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
if-nez v0, :cond_1
const/4 p1, 0x0
return-object p1
:cond_1
monitor-enter p0
:try_start_1
iget v1, p0, Landroidx/collection/LruCache;->createCount:I
add-int/lit8 v1, v1, 0x1
iput v1, p0, Landroidx/collection/LruCache;->createCount:I
iget-object v1, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v1, p1, v0}, Ljava/util/LinkedHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
if-eqz v1, :cond_2
iget-object v2, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v2, p1, v1}, Ljava/util/LinkedHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
:cond_2
iget v2, p0, Landroidx/collection/LruCache;->size:I
invoke-direct {p0, p1, v0}, Landroidx/collection/LruCache;->safeSizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
move-result v3
add-int/2addr v2, v3
iput v2, p0, Landroidx/collection/LruCache;->size:I
:goto_0
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
if-eqz v1, :cond_3
const/4 v2, 0x0
invoke-virtual {p0, v2, p1, v0, v1}, Landroidx/collection/LruCache;->entryRemoved(ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
return-object v1
:cond_3
iget p1, p0, Landroidx/collection/LruCache;->maxSize:I
invoke-virtual {p0, p1}, Landroidx/collection/LruCache;->trimToSize(I)V
return-object v0
:catchall_0
move-exception p1
:try_start_2
monitor-exit p0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
throw p1
:catchall_1
move-exception p1
:try_start_3
monitor-exit p0
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_1
throw p1
:cond_4
new-instance p1, Ljava/lang/NullPointerException;
const-string v0, "key == null"
invoke-direct {p1, v0}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public final declared-synchronized hitCount()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->hitCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized maxSize()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->maxSize:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized missCount()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->missCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.locals 3
.param p1 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;TV;)TV;"
}
.end annotation
if-eqz p1, :cond_2
if-eqz p2, :cond_2
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->putCount:I
add-int/lit8 v0, v0, 0x1
iput v0, p0, Landroidx/collection/LruCache;->putCount:I
iget v0, p0, Landroidx/collection/LruCache;->size:I
invoke-direct {p0, p1, p2}, Landroidx/collection/LruCache;->safeSizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
move-result v1
add-int/2addr v0, v1
iput v0, p0, Landroidx/collection/LruCache;->size:I
iget-object v0, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v0, p1, p2}, Ljava/util/LinkedHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
if-eqz v0, :cond_0
iget v1, p0, Landroidx/collection/LruCache;->size:I
invoke-direct {p0, p1, v0}, Landroidx/collection/LruCache;->safeSizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
move-result v2
sub-int/2addr v1, v2
iput v1, p0, Landroidx/collection/LruCache;->size:I
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v0, :cond_1
const/4 v1, 0x0
invoke-virtual {p0, v1, p1, v0, p2}, Landroidx/collection/LruCache;->entryRemoved(ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
:cond_1
iget p1, p0, Landroidx/collection/LruCache;->maxSize:I
invoke-virtual {p0, p1}, Landroidx/collection/LruCache;->trimToSize(I)V
return-object v0
:catchall_0
move-exception p1
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
:cond_2
new-instance p1, Ljava/lang/NullPointerException;
const-string p2, "key == null || value == null"
invoke-direct {p1, p2}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public final declared-synchronized putCount()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->putCount:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final remove(Ljava/lang/Object;)Ljava/lang/Object;
.locals 3
.param p1 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;)TV;"
}
.end annotation
if-eqz p1, :cond_2
monitor-enter p0
:try_start_0
iget-object v0, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v0, p1}, Ljava/util/LinkedHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
if-eqz v0, :cond_0
iget v1, p0, Landroidx/collection/LruCache;->size:I
invoke-direct {p0, p1, v0}, Landroidx/collection/LruCache;->safeSizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
move-result v2
sub-int/2addr v1, v2
iput v1, p0, Landroidx/collection/LruCache;->size:I
:cond_0
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v0, :cond_1
const/4 v1, 0x0
const/4 v2, 0x0
invoke-virtual {p0, v1, p1, v0, v2}, Landroidx/collection/LruCache;->entryRemoved(ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
:cond_1
return-object v0
:catchall_0
move-exception p1
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
:cond_2
new-instance p1, Ljava/lang/NullPointerException;
const-string v0, "key == null"
invoke-direct {p1, v0}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public resize(I)V
.locals 1
if-lez p1, :cond_0
monitor-enter p0
:try_start_0
iput p1, p0, Landroidx/collection/LruCache;->maxSize:I
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {p0, p1}, Landroidx/collection/LruCache;->trimToSize(I)V
return-void
:catchall_0
move-exception p1
:try_start_1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
:cond_0
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string v0, "maxSize <= 0"
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public final declared-synchronized size()I
.locals 1
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->size:I
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public sizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
.locals 0
.param p1 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Ljava/lang/Object;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(TK;TV;)I"
}
.end annotation
const/4 p1, 0x1
return p1
.end method
.method public final declared-synchronized snapshot()Ljava/util/Map;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/Map<",
"TK;TV;>;"
}
.end annotation
monitor-enter p0
:try_start_0
new-instance v0, Ljava/util/LinkedHashMap;
iget-object v1, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-direct {v0, v1}, Ljava/util/LinkedHashMap;-><init>(Ljava/util/Map;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-object v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public final declared-synchronized toString()Ljava/lang/String;
.locals 6
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->hitCount:I
iget v1, p0, Landroidx/collection/LruCache;->missCount:I
add-int/2addr v0, v1
const/4 v1, 0x0
if-eqz v0, :cond_0
iget v2, p0, Landroidx/collection/LruCache;->hitCount:I
mul-int/lit8 v2, v2, 0x64
2020-07-08 16:44:49 +00:00
div-int/2addr v2, v0
2020-05-17 12:40:10 +00:00
goto :goto_0
:cond_0
2020-07-08 16:44:49 +00:00
const/4 v2, 0x0
2020-05-17 12:40:10 +00:00
:goto_0
2020-07-08 16:44:49 +00:00
sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;
2020-05-17 12:40:10 +00:00
const-string v3, "LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]"
const/4 v4, 0x4
new-array v4, v4, [Ljava/lang/Object;
iget v5, p0, Landroidx/collection/LruCache;->maxSize:I
invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
aput-object v5, v4, v1
const/4 v1, 0x1
iget v5, p0, Landroidx/collection/LruCache;->hitCount:I
invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
aput-object v5, v4, v1
const/4 v1, 0x2
iget v5, p0, Landroidx/collection/LruCache;->missCount:I
invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v5
aput-object v5, v4, v1
const/4 v1, 0x3
2020-07-08 16:44:49 +00:00
invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
2020-05-17 12:40:10 +00:00
2020-07-08 16:44:49 +00:00
move-result-object v2
2020-05-17 12:40:10 +00:00
2020-07-08 16:44:49 +00:00
aput-object v2, v4, v1
2020-05-17 12:40:10 +00:00
2020-07-08 16:44:49 +00:00
invoke-static {v0, v3, v4}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
2020-05-17 12:40:10 +00:00
move-result-object v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-object v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public trimToSize(I)V
.locals 4
:goto_0
monitor-enter p0
:try_start_0
iget v0, p0, Landroidx/collection/LruCache;->size:I
if-ltz v0, :cond_3
iget-object v0, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v0}, Ljava/util/LinkedHashMap;->isEmpty()Z
move-result v0
if-eqz v0, :cond_0
iget v0, p0, Landroidx/collection/LruCache;->size:I
if-nez v0, :cond_3
:cond_0
iget v0, p0, Landroidx/collection/LruCache;->size:I
if-le v0, p1, :cond_2
iget-object v0, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v0}, Ljava/util/LinkedHashMap;->isEmpty()Z
move-result v0
if-eqz v0, :cond_1
goto :goto_1
:cond_1
iget-object v0, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v0}, Ljava/util/LinkedHashMap;->entrySet()Ljava/util/Set;
move-result-object v0
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v0
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/Map$Entry;
invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v1
invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v0
iget-object v2, p0, Landroidx/collection/LruCache;->map:Ljava/util/LinkedHashMap;
invoke-virtual {v2, v1}, Ljava/util/LinkedHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
iget v2, p0, Landroidx/collection/LruCache;->size:I
invoke-direct {p0, v1, v0}, Landroidx/collection/LruCache;->safeSizeOf(Ljava/lang/Object;Ljava/lang/Object;)I
move-result v3
sub-int/2addr v2, v3
iput v2, p0, Landroidx/collection/LruCache;->size:I
iget v2, p0, Landroidx/collection/LruCache;->evictionCount:I
const/4 v3, 0x1
add-int/2addr v2, v3
iput v2, p0, Landroidx/collection/LruCache;->evictionCount:I
monitor-exit p0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const/4 v2, 0x0
invoke-virtual {p0, v3, v1, v0, v2}, Landroidx/collection/LruCache;->entryRemoved(ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
goto :goto_0
:cond_2
:goto_1
:try_start_1
monitor-exit p0
return-void
:cond_3
new-instance p1, Ljava/lang/IllegalStateException;
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v1, ".sizeOf() is reporting inconsistent results!"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:catchall_0
move-exception p1
monitor-exit p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.end method