Fix compiler class initialization to properly deal with super classes
Also moving active parts of compiler_test to be oat tests including
IntMath and Invoke. Added an interface invocation test case to Invoke
test. Changed Compiler to CHECK that it is not used once the
Runtime::IsStarted, forcing some jni_compiler_test to have two phases,
one for compiling before Runtime::Start and one for JNI operations
after the Runtime::IsStarted.
Finally, fixed Class::CanPutArrayElementFromCode by removing
CanPutArrayElement and calling IsAssignableFrom directly.
Change-Id: I52ca4dbc0e02db65f274ccc3ca7468dce365a44e
diff --git a/src/java_lang_System.cc b/src/java_lang_System.cc
index 8aeefcd..42bae22 100644
--- a/src/java_lang_System.cc
+++ b/src/java_lang_System.cc
@@ -207,19 +207,19 @@
// and cause us to copy incompatible elements.
Object* const * srcObj = reinterpret_cast<Object* const *>(srcBytes + srcPos * width);
- Class* dstClass = dstArray->GetClass();
+ Class* dstClass = dstArray->GetClass()->GetComponentType();
Class* initialElementClass = NULL;
if (length > 0 && srcObj[0] != NULL) {
initialElementClass = srcObj[0]->GetClass();
- if (!Class::CanPutArrayElement(initialElementClass, dstClass)) {
+ if (!dstClass->IsAssignableFrom(initialElementClass)) {
initialElementClass = NULL;
}
}
int copyCount;
for (copyCount = 0; copyCount < length; copyCount++) {
- if (srcObj[copyCount] != NULL && srcObj[copyCount]->GetClass() != initialElementClass && !Class::CanPutArrayElement(srcObj[copyCount]->GetClass(), dstClass)) {
+ if (srcObj[copyCount] != NULL && srcObj[copyCount]->GetClass() != initialElementClass && !dstClass->IsAssignableFrom(srcObj[copyCount]->GetClass())) {
// Can't put this element into the array.
// We'll copy up to this point, then throw.
break;