Assignability checks for SetFieldObject.
Adds check to SetFieldObject that is enabled with VERIFY_OBJECT_ENABLED.
The check verifies that the object being set to the field is assignable
to that field.
Fix bug that iftable was typed to be Object[][] but being assigned a
Object[].
Change-Id: I3d3744347f2dd142ca90db321ed876eaebfe7f7f
diff --git a/src/class_linker.h b/src/class_linker.h
index 67c2fbe..d75e1b2 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -334,6 +334,11 @@
GetClassRoot(kJavaLangReflectAbstractMethodArrayClass), length);
}
+ ObjectArray<InterfaceEntry>* AllocIfTable(size_t length)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ return ObjectArray<InterfaceEntry>::Alloc(GetClassRoot(kObjectArrayArrayClass), length);
+ }
+
ObjectArray<Field>* AllocFieldArray(size_t length)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return ObjectArray<Field>::Alloc(GetClassRoot(kJavaLangReflectFieldArrayClass), length);
@@ -437,14 +442,12 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void LoadField(const DexFile& dex_file, const ClassDataItemIterator& it, SirtRef<Class>& klass,
- SirtRef<Field>& dst);
+ SirtRef<Field>& dst) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
AbstractMethod* LoadMethod(const DexFile& dex_file, const ClassDataItemIterator& dex_method,
- SirtRef<Class>& klass)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ SirtRef<Class>& klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void FixupStaticTrampolines(Class* klass)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void FixupStaticTrampolines(Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Finds the associated oat class for a dex_file and descriptor
const OatFile::OatClass* GetOatClass(const DexFile& dex_file, const char* descriptor);
@@ -566,6 +569,7 @@
kJavaLangObject,
kClassArrayClass,
kObjectArrayClass,
+ kObjectArrayArrayClass,
kJavaLangString,
kJavaLangDexCache,
kJavaLangRefReference,