summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2019-09-05 11:20:16 -0700
committerAlex Light <allight@google.com>2019-09-13 11:06:26 -0700
commit24ae00573b926fbfc0a2676a0248f554771a9b05 (patch)
treed68e4ddefec1e0382de0b6974fc228d0bb352010
parent36dff1dbced59e976431cb414aedd5295b02aeae (diff)
Add obsoleteClass field to ClassExt
This field is used to keep track of Class objects that have been made obsolete by structural class redefinition. They must be kept live and accessible to preserve JIT invariants around code liveness and to ensure we can continue to access their dex-caches for obsolete methods. Test: ./test.py --host --all-compiler Bug: 140891089 Change-Id: I0ce309f479c42b56b543339654e2cc49c917bce5
-rw-r--r--libart/src/main/java/dalvik/system/ClassExt.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/libart/src/main/java/dalvik/system/ClassExt.java b/libart/src/main/java/dalvik/system/ClassExt.java
index 2c7dc6b400..e52303536d 100644
--- a/libart/src/main/java/dalvik/system/ClassExt.java
+++ b/libart/src/main/java/dalvik/system/ClassExt.java
@@ -40,6 +40,15 @@ public final class ClassExt {
private Object jmethodIDs;
/**
+ * If the class has undergone structural redefinition, the now obsolete class object.
+ *
+ * Needed to ensure that the class isn't unloaded before its jit code is. Normally this is
+ * handled by the classloader but since the class is now obsolete it's no longer held live
+ * there and instead we must do so manually. This class should not be used for anything.
+ */
+ private Class<?> obsoleteClass;
+
+ /**
* An array of all obsolete DexCache objects that are needed for obsolete methods.
*
* These entries are associated with the obsolete ArtMethod pointers at the same indexes in the
@@ -90,16 +99,6 @@ public final class ClassExt {
private Object verifyError;
/**
- * ClassDef index of the related class in the pre-redefine dex file. Set together with
- * {@code preRedefineDexFilePtr}.
- *
- * Needed in order to preserve access to dex-level hiddenapi flags after JVMTI redefine.
- *
- * This field is a logical part of the 'Class' type.
- */
- private int preRedefineClassDefIndex;
-
- /**
* If set, native pointer to the initial, pre-redefine, dex file associated with the related
* class. This is different from the {@code originalDexFile} which is the pre-retransform dex
* file, i.e. could contain the bytes of the dex file provided during redefine.
@@ -115,6 +114,17 @@ public final class ClassExt {
private long preRedefineDexFilePtr;
/**
+ * ClassDef index of the related class in the pre-redefine dex file. Set together with
+ * {@code preRedefineDexFilePtr}.
+ *
+ * Needed in order to preserve access to dex-level hiddenapi flags after JVMTI redefine.
+ *
+ * This field is a logical part of the 'Class' type.
+ */
+ private int preRedefineClassDefIndex;
+
+
+ /**
* Private constructor.
*
* Only created by the runtime.