548 lines
14 KiB
Smali
548 lines
14 KiB
Smali
.class public final Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;
|
|
.super Ljava/lang/Object;
|
|
.source "FieldSerializerUnsafeUtilImpl.java"
|
|
|
|
# interfaces
|
|
.implements Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtil;
|
|
|
|
|
|
# instance fields
|
|
.field public serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lcom/esotericsoftware/kryo/serializers/FieldSerializer;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private fieldSizeOf(Ljava/lang/Class;)I
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/Class<",
|
|
"*>;)I"
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
|
|
|
|
if-eq p1, v0, :cond_7
|
|
|
|
sget-object v0, Ljava/lang/Float;->TYPE:Ljava/lang/Class;
|
|
|
|
if-ne p1, v0, :cond_0
|
|
|
|
goto :goto_3
|
|
|
|
:cond_0
|
|
sget-object v0, Ljava/lang/Long;->TYPE:Ljava/lang/Class;
|
|
|
|
if-eq p1, v0, :cond_6
|
|
|
|
sget-object v0, Ljava/lang/Double;->TYPE:Ljava/lang/Class;
|
|
|
|
if-ne p1, v0, :cond_1
|
|
|
|
goto :goto_2
|
|
|
|
:cond_1
|
|
sget-object v0, Ljava/lang/Byte;->TYPE:Ljava/lang/Class;
|
|
|
|
if-eq p1, v0, :cond_5
|
|
|
|
sget-object v0, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;
|
|
|
|
if-ne p1, v0, :cond_2
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
sget-object v0, Ljava/lang/Short;->TYPE:Ljava/lang/Class;
|
|
|
|
if-eq p1, v0, :cond_4
|
|
|
|
sget-object v0, Ljava/lang/Character;->TYPE:Ljava/lang/Class;
|
|
|
|
if-ne p1, v0, :cond_3
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
invoke-static {}, Lcom/esotericsoftware/kryo/util/UnsafeUtil;->unsafe()Lsun/misc/Unsafe;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Lsun/misc/Unsafe;->addressSize()I
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_4
|
|
:goto_0
|
|
const/4 p1, 0x2
|
|
|
|
return p1
|
|
|
|
:cond_5
|
|
:goto_1
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_6
|
|
:goto_2
|
|
const/16 p1, 0x8
|
|
|
|
return p1
|
|
|
|
:cond_7
|
|
:goto_3
|
|
const/4 p1, 0x4
|
|
|
|
return p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public createUnsafeCacheFieldsAndRegions(Ljava/util/List;Ljava/util/List;ILcom/esotericsoftware/kryo/util/IntArray;)V
|
|
.locals 26
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/reflect/Field;",
|
|
">;",
|
|
"Ljava/util/List<",
|
|
"Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;",
|
|
">;I",
|
|
"Lcom/esotericsoftware/kryo/util/IntArray;",
|
|
")V"
|
|
}
|
|
.end annotation
|
|
|
|
move-object/from16 v0, p0
|
|
|
|
move-object/from16 v1, p2
|
|
|
|
invoke-interface/range {p1 .. p1}, Ljava/util/List;->size()I
|
|
|
|
move-result v2
|
|
|
|
const-wide/16 v3, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const-wide/16 v6, -0x1
|
|
|
|
const/4 v8, 0x0
|
|
|
|
const/4 v9, 0x0
|
|
|
|
const/4 v10, 0x0
|
|
|
|
const/4 v11, -0x1
|
|
|
|
:goto_0
|
|
const-string v12, " endOffset="
|
|
|
|
const-string v13, " Start offset = "
|
|
|
|
const-string v14, ". Byte length = "
|
|
|
|
const-string v15, ". Found a set of consecutive primitive fields. Number of fields = "
|
|
|
|
const-string v16, "Class "
|
|
|
|
move/from16 v17, v11
|
|
|
|
const-string v11, "kryo"
|
|
|
|
if-ge v8, v2, :cond_8
|
|
|
|
move/from16 v18, v2
|
|
|
|
move-object/from16 v2, p1
|
|
|
|
invoke-interface {v2, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v19
|
|
|
|
move-object/from16 v2, v19
|
|
|
|
check-cast v2, Ljava/lang/reflect/Field;
|
|
|
|
iget-object v1, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
iget-object v1, v1, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->access:Ljava/lang/Object;
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
add-int v1, p3, v8
|
|
|
|
move/from16 v19, v8
|
|
|
|
move-object/from16 v8, p4
|
|
|
|
invoke-virtual {v8, v1}, Lcom/esotericsoftware/kryo/util/IntArray;->get(I)I
|
|
|
|
move-result v1
|
|
|
|
const/4 v8, 0x1
|
|
|
|
if-ne v1, v8, :cond_1
|
|
|
|
iget-object v1, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
iget-object v1, v1, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->access:Ljava/lang/Object;
|
|
|
|
check-cast v1, Lf/f/b/c;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/reflect/Field;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v1, v8}, Lf/f/b/c;->h(Ljava/lang/String;)I
|
|
|
|
move-result v1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
move/from16 v19, v8
|
|
|
|
:cond_1
|
|
const/4 v1, -0x1
|
|
|
|
:goto_1
|
|
invoke-static {}, Lcom/esotericsoftware/kryo/util/UnsafeUtil;->unsafe()Lsun/misc/Unsafe;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8, v2}, Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J
|
|
|
|
move-result-wide v20
|
|
|
|
invoke-virtual {v2}, Ljava/lang/reflect/Field;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-direct {v0, v8}, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->fieldSizeOf(Ljava/lang/Class;)I
|
|
|
|
move-result v8
|
|
|
|
move-object/from16 v23, v11
|
|
|
|
move-object/from16 v22, v12
|
|
|
|
int-to-long v11, v8
|
|
|
|
add-long v11, v20, v11
|
|
|
|
invoke-virtual {v2}, Ljava/lang/reflect/Field;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Ljava/lang/Class;->isPrimitive()Z
|
|
|
|
move-result v8
|
|
|
|
if-nez v8, :cond_5
|
|
|
|
if-eqz v9, :cond_5
|
|
|
|
const/4 v8, 0x1
|
|
|
|
if-le v10, v8, :cond_3
|
|
|
|
sget-boolean v8, Lf/f/a/a;->d:Z
|
|
|
|
if-eqz v8, :cond_2
|
|
|
|
invoke-static/range {v16 .. v16}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v8
|
|
|
|
iget-object v9, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-virtual {v9}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-virtual {v9}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v10}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
sub-long v14, v6, v3
|
|
|
|
invoke-virtual {v8, v14, v15}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
move-object/from16 v9, v22
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
move-object/from16 v9, v23
|
|
|
|
invoke-static {v9, v8}, Lf/f/a/a;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_2
|
|
new-instance v8, Lcom/esotericsoftware/kryo/serializers/UnsafeCacheFields$UnsafeRegionField;
|
|
|
|
sub-long/2addr v6, v3
|
|
|
|
invoke-direct {v8, v3, v4, v6, v7}, Lcom/esotericsoftware/kryo/serializers/UnsafeCacheFields$UnsafeRegionField;-><init>(JJ)V
|
|
|
|
iput-object v5, v8, Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;->field:Ljava/lang/reflect/Field;
|
|
|
|
move-object/from16 v6, p2
|
|
|
|
invoke-interface {v6, v8}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_2
|
|
|
|
:cond_3
|
|
move-object/from16 v6, p2
|
|
|
|
if-eqz v5, :cond_4
|
|
|
|
iget-object v7, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I
|
|
|
|
move-result v8
|
|
|
|
move/from16 v9, v17
|
|
|
|
invoke-virtual {v7, v5, v8, v9}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->newCachedField(Ljava/lang/reflect/Field;II)Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-interface {v6, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_4
|
|
:goto_2
|
|
iget-object v5, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I
|
|
|
|
move-result v7
|
|
|
|
invoke-virtual {v5, v2, v7, v1}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->newCachedField(Ljava/lang/reflect/Field;II)Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-interface {v6, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v9, 0x0
|
|
|
|
goto :goto_3
|
|
|
|
:cond_5
|
|
move-object/from16 v6, p2
|
|
|
|
invoke-virtual {v2}, Ljava/lang/reflect/Field;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-virtual {v5}, Ljava/lang/Class;->isPrimitive()Z
|
|
|
|
move-result v5
|
|
|
|
if-nez v5, :cond_6
|
|
|
|
iget-object v5, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I
|
|
|
|
move-result v7
|
|
|
|
invoke-virtual {v5, v2, v7, v1}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->newCachedField(Ljava/lang/reflect/Field;II)Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-interface {v6, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_3
|
|
|
|
:cond_6
|
|
if-nez v9, :cond_7
|
|
|
|
const/4 v3, 0x1
|
|
|
|
const/4 v4, 0x1
|
|
|
|
move-wide/from16 v3, v20
|
|
|
|
const/4 v9, 0x1
|
|
|
|
const/4 v10, 0x1
|
|
|
|
goto :goto_3
|
|
|
|
:cond_7
|
|
add-int/lit8 v10, v10, 0x1
|
|
|
|
:goto_3
|
|
add-int/lit8 v8, v19, 0x1
|
|
|
|
move-object v5, v2
|
|
|
|
move/from16 v2, v18
|
|
|
|
move-wide/from16 v24, v11
|
|
|
|
move v11, v1
|
|
|
|
move-object v1, v6
|
|
|
|
move-wide/from16 v6, v24
|
|
|
|
goto/16 :goto_0
|
|
|
|
:cond_8
|
|
move-object v8, v11
|
|
|
|
move-object v2, v12
|
|
|
|
move/from16 v11, v17
|
|
|
|
iget-object v12, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-virtual {v12}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getUseAsmEnabled()Z
|
|
|
|
move-result v12
|
|
|
|
if-nez v12, :cond_b
|
|
|
|
iget-object v12, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-virtual {v12}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getUseMemRegions()Z
|
|
|
|
move-result v12
|
|
|
|
if-eqz v12, :cond_b
|
|
|
|
if-eqz v9, :cond_b
|
|
|
|
const/4 v9, 0x1
|
|
|
|
if-le v10, v9, :cond_a
|
|
|
|
sget-boolean v9, Lf/f/a/a;->d:Z
|
|
|
|
if-eqz v9, :cond_9
|
|
|
|
invoke-static/range {v16 .. v16}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v9
|
|
|
|
iget-object v11, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-virtual {v11}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->getType()Ljava/lang/Class;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v9, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
sub-long v10, v6, v3
|
|
|
|
invoke-virtual {v9, v10, v11}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v8, v2}, Lf/f/a/a;->c(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_9
|
|
new-instance v2, Lcom/esotericsoftware/kryo/serializers/UnsafeCacheFields$UnsafeRegionField;
|
|
|
|
sub-long/2addr v6, v3
|
|
|
|
invoke-direct {v2, v3, v4, v6, v7}, Lcom/esotericsoftware/kryo/serializers/UnsafeCacheFields$UnsafeRegionField;-><init>(JJ)V
|
|
|
|
iput-object v5, v2, Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;->field:Ljava/lang/reflect/Field;
|
|
|
|
invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_4
|
|
|
|
:cond_a
|
|
if-eqz v5, :cond_b
|
|
|
|
iget-object v2, v0, Lcom/esotericsoftware/kryo/serializers/FieldSerializerUnsafeUtilImpl;->serializer:Lcom/esotericsoftware/kryo/serializers/FieldSerializer;
|
|
|
|
invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {v2, v5, v3, v11}, Lcom/esotericsoftware/kryo/serializers/FieldSerializer;->newCachedField(Ljava/lang/reflect/Field;II)Lcom/esotericsoftware/kryo/serializers/FieldSerializer$CachedField;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_b
|
|
:goto_4
|
|
return-void
|
|
.end method
|
|
|
|
.method public getObjectFieldOffset(Ljava/lang/reflect/Field;)J
|
|
.locals 2
|
|
|
|
invoke-static {}, Lcom/esotericsoftware/kryo/util/UnsafeUtil;->unsafe()Lsun/misc/Unsafe;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0, p1}, Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J
|
|
|
|
move-result-wide v0
|
|
|
|
return-wide v0
|
|
.end method
|