Change j.l.r.Field to use ArtField index instead of dexFileIndex
Using the dexFileIndex to determine the ArtField a
java.lang.reflect.Field object points to requires us to use a
dex-cache and to update all existing Field objects if this index
changes (for example due to class redefinition). This could be rather
slow. This replaces the dex-file index with the index into the
declaring class's SFields/IFields arrays where the specified ArtMethod
is stored.
Bug: 149236640
Test: ./test.py --host
Change-Id: I9a7d69903ece0ea94e3b3e93b4c8a872ac4073e8
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 0969b1c..1e501a7 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -719,8 +719,8 @@
struct FieldOffsets : public CheckOffsets<mirror::Field> {
FieldOffsets() : CheckOffsets<mirror::Field>(false, "Ljava/lang/reflect/Field;") {
addOffset(OFFSETOF_MEMBER(mirror::Field, access_flags_), "accessFlags");
+ addOffset(OFFSETOF_MEMBER(mirror::Field, art_field_index_), "artFieldIndex");
addOffset(OFFSETOF_MEMBER(mirror::Field, declaring_class_), "declaringClass");
- addOffset(OFFSETOF_MEMBER(mirror::Field, dex_field_index_), "dexFieldIndex");
addOffset(OFFSETOF_MEMBER(mirror::Field, offset_), "offset");
addOffset(OFFSETOF_MEMBER(mirror::Field, type_), "type");
}