From 239a39fa24e3fc5b173a80de63a10f489539bb9e Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 31 Mar 2015 16:49:53 -0700 Subject: Remove ArtField ArtFields are now handled in native. Java portion of this change: https://android-review.googlesource.com/#/c/145032/ Bug: 19264997 Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c --- libart/src/main/java/java/lang/Class.java | 34 ++++++++------ libart/src/main/java/java/lang/DexCache.java | 13 +++--- .../src/main/java/java/lang/reflect/ArtField.java | 54 ---------------------- 3 files changed, 26 insertions(+), 75 deletions(-) delete mode 100644 libart/src/main/java/java/lang/reflect/ArtField.java (limited to 'libart/src/main') diff --git a/libart/src/main/java/java/lang/Class.java b/libart/src/main/java/java/lang/Class.java index 37b1d7d..995174b 100644 --- a/libart/src/main/java/java/lang/Class.java +++ b/libart/src/main/java/java/lang/Class.java @@ -39,7 +39,6 @@ import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.AccessibleObject; import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.ArtField; import java.lang.reflect.ArtMethod; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -146,16 +145,6 @@ public final class Class implements Serializable, AnnotatedElement, GenericDe private transient ArtMethod[] directMethods; /** - * Instance fields. These describe the layout of the contents of an Object. Note that only the - * fields directly declared by this class are listed in iFields; fields declared by a - * superclass are listed in the superclass's Class.iFields. - * - * All instance fields that refer to objects are guaranteed to be at the beginning of the field - * list. {@link Class#numReferenceInstanceFields} specifies the number of reference fields. - */ - private transient ArtField[] iFields; - - /** * The interface table (iftable_) contains pairs of a interface class and an array of the * interface methods. There is one pair per interface supported by this class. That * means one pair for each interface we support directly, indirectly via superclass, or @@ -174,9 +163,6 @@ public final class Class implements Serializable, AnnotatedElement, GenericDe /** Lazily computed name of this class; always prefer calling getName(). */ private transient String name; - /** Static fields */ - private transient ArtField[] sFields; - /** The superclass, or NULL if this is java.lang.Object, an interface or primitive type. */ private transient Class superClass; @@ -198,6 +184,20 @@ public final class Class implements Serializable, AnnotatedElement, GenericDe private transient int accessFlags; /** + * Instance fields. These describe the layout of the contents of an Object. Note that only the + * fields directly declared by this class are listed in iFields; fields declared by a + * superclass are listed in the superclass's Class.iFields. + * + * All instance fields that refer to objects are guaranteed to be at the beginning of the field + * list. {@link Class#numReferenceInstanceFields} specifies the number of reference fields. + */ + private transient long iFields; + + /** Static fields */ + private transient long sFields; + + + /** * Total size of the Class instance; used when allocating storage on GC heap. * See also {@link Class#objectSize}. */ @@ -222,12 +222,18 @@ public final class Class implements Serializable, AnnotatedElement, GenericDe */ private transient volatile int dexTypeIndex; + /** Number of instance fields. */ + private transient int numInstanceFields; + /** Number of instance fields that are object references. */ private transient int numReferenceInstanceFields; /** Number of static fields that are object references. */ private transient int numReferenceStaticFields; + /** Number of static fields. */ + private transient int numStaticFields; + /** * Total object size; used when allocating storage on GC heap. For interfaces and abstract * classes this will be zero. See also {@link Class#classSize}. diff --git a/libart/src/main/java/java/lang/DexCache.java b/libart/src/main/java/java/lang/DexCache.java index e4caffa..245af6e 100644 --- a/libart/src/main/java/java/lang/DexCache.java +++ b/libart/src/main/java/java/lang/DexCache.java @@ -33,7 +33,6 @@ package java.lang; import com.android.dex.Dex; -import java.lang.reflect.ArtField; import java.lang.reflect.ArtMethod; /** @@ -47,18 +46,18 @@ final class DexCache { String location; /** - * References to fields as they become resolved following interpreter semantics. May refer to - * fields defined in other dex files. - */ - ArtField[] resolvedFields; - - /** * References to methods as they become resolved following interpreter semantics. May refer to * methods defined in other dex files. */ ArtMethod[] resolvedMethods; /** + * References to fields as they become resolved following interpreter semantics. May refer to + * fields defined in other dex files. Either an int array or long array. + */ + private Object resolvedFields; + + /** * References to types as they become resolved following interpreter semantics. May refer to * types defined in other dex files. */ diff --git a/libart/src/main/java/java/lang/reflect/ArtField.java b/libart/src/main/java/java/lang/reflect/ArtField.java deleted file mode 100644 index 1801862..0000000 --- a/libart/src/main/java/java/lang/reflect/ArtField.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.lang.reflect; - -import com.android.dex.Dex; - -/** - * @hide - */ -public final class ArtField { - - private Class declaringClass; - /** Field access flags (modifiers) */ - private int accessFlags; - /** Index into DexFile's field ids */ - private int fieldDexIndex; - /** Offset of field in object or class */ - private int offset; - - /** - * Only created by art directly. - */ - private ArtField() {} -} -- cgit v1.1