summaryrefslogtreecommitdiffstats
path: root/libart
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-05-03 00:28:56 -0700
committerMathieu Chartier <mathieuc@google.com>2015-06-01 21:47:16 -0700
commite9fbfba8affa05b7ed129da51f789985a1d379d0 (patch)
tree73523ef93276c5d106a49f2d756afa874a50d382 /libart
parenta263772ef19e374a504680c910b957daa96b5ace (diff)
downloadlibcore-e9fbfba8affa05b7ed129da51f789985a1d379d0.zip
libcore-e9fbfba8affa05b7ed129da51f789985a1d379d0.tar.gz
libcore-e9fbfba8affa05b7ed129da51f789985a1d379d0.tar.bz2
Move mirror::ArtMethod to native
Bug: 19264997 (cherry picked from commit c8595cdc1bd25e5ae6c889ed9b3ab14eca68e72b) Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
Diffstat (limited to 'libart')
-rw-r--r--libart/src/main/java/java/lang/Class.java20
-rw-r--r--libart/src/main/java/java/lang/DexCache.java3
-rw-r--r--libart/src/main/java/java/lang/reflect/AbstractMethod.java3
-rw-r--r--libart/src/main/java/java/lang/reflect/ArtMethod.java78
4 files changed, 15 insertions, 89 deletions
diff --git a/libart/src/main/java/java/lang/Class.java b/libart/src/main/java/java/lang/Class.java
index 99c562f..388f34c 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.ArtMethod;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.GenericDeclaration;
@@ -141,9 +140,6 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
/** Short-cut to dexCache.strings */
private transient String[] dexCacheStrings;
- /** static, private, and &lt;init&gt; methods. */
- private transient ArtMethod[] directMethods;
-
/**
* 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
@@ -169,20 +165,20 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
/** If class verify fails, we must return same error on subsequent tries. */
private transient Class<?> verifyErrorClass;
- /** Virtual methods defined in this class; invoked through vtable. */
- private transient ArtMethod[] virtualMethods;
-
/**
* Virtual method table (vtable), for use by "invoke-virtual". The vtable from the superclass
* is copied in, and virtual methods from our class either replace those from the super or are
* appended. For abstract classes, methods may be created in the vtable that aren't in
* virtual_ methods_ for miranda methods.
*/
- private transient ArtMethod[] vtable;
+ private transient Object vtable;
/** access flags; low 16 bits are defined by VM spec */
private transient int accessFlags;
+ /** static, private, and &lt;init&gt; methods. */
+ private transient long 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
@@ -196,6 +192,8 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
/** Static fields */
private transient long sFields;
+ /** Virtual methods defined in this class; invoked through vtable. */
+ private transient long virtualMethods;
/**
* Total size of the Class instance; used when allocating storage on GC heap.
@@ -222,6 +220,9 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
*/
private transient volatile int dexTypeIndex;
+ /** Number of direct methods. */
+ private transient int numDirectMethods;
+
/** Number of instance fields. */
private transient int numInstanceFields;
@@ -234,6 +235,9 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
/** Number of static fields. */
private transient int numStaticFields;
+ /** Number of virtual methods. */
+ private transient int numVirtualMethods;
+
/**
* 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 c047018..73e35cd 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.ArtMethod;
/**
* A dex cache holds resolved copies of strings, fields, methods, and classes from the dexfile.
@@ -49,7 +48,7 @@ final class DexCache {
* References to methods as they become resolved following interpreter semantics. May refer to
* methods defined in other dex files.
*/
- ArtMethod[] resolvedMethods;
+ Object resolvedMethods;
/**
* References to fields as they become resolved following interpreter semantics. May refer to
diff --git a/libart/src/main/java/java/lang/reflect/AbstractMethod.java b/libart/src/main/java/java/lang/reflect/AbstractMethod.java
index 0ac15f9..95d90cc 100644
--- a/libart/src/main/java/java/lang/reflect/AbstractMethod.java
+++ b/libart/src/main/java/java/lang/reflect/AbstractMethod.java
@@ -51,10 +51,11 @@ public abstract class AbstractMethod extends AccessibleObject {
/**
* The ArtMethod associated with this Method, requried for dispatching due to entrypoints
+ * Classloader is held live by the declaring class.
* Hidden to workaround b/16828157.
* @hide
*/
- protected ArtMethod artMethod;
+ protected long artMethod;
/** Method's declaring class */
protected Class<?> declaringClass;
diff --git a/libart/src/main/java/java/lang/reflect/ArtMethod.java b/libart/src/main/java/java/lang/reflect/ArtMethod.java
deleted file mode 100644
index 84e6b48..0000000
--- a/libart/src/main/java/java/lang/reflect/ArtMethod.java
+++ /dev/null
@@ -1,78 +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) 2012 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;
-import java.lang.annotation.Annotation;
-import libcore.reflect.AnnotationAccess;
-import libcore.util.EmptyArray;
-
-/**
- * This class represents methods and constructors.
- * @hide
- */
-public final class ArtMethod {
- /* A note on the field order here, it reflects the same field order as laid out by ART. */
-
- /** Method's declaring class */
- private Class<?> declaringClass;
-
- /** Short-cut to declaringClass.dexCache.resolvedMethods */
- private ArtMethod[] dexCacheResolvedMethods;
-
- /** Short-cut to declaringClass.dexCache.resolvedTypes */
- /* package */ Class<?>[] dexCacheResolvedTypes;
-
- /** Bits encoding access (e.g. public, private) as well as other runtime specific flags */
- private int accessFlags;
-
- /* Dex file fields. The defining dex file is available via declaringClass.dexCache */
-
- /** The offset of the code item associated with this method within its defining dex file */
- private int dexCodeItemOffset;
-
- /** The method index of this method within its defining dex file */
- private int dexMethodIndex;
-
- /* End of dex file fields. */
-
- /**
- * Entry within a dispatch table for this method. For static/direct methods the index is
- * into the declaringClass.directMethods, for virtual methods the vtable and for
- * interface methods the ifTable.
- */
- private int methodIndex;
-
- /** Only created by ART directly. */
- private ArtMethod() {}
-}