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/object.cc b/src/object.cc
index 91c4b3d..b0a6745 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -113,7 +113,7 @@
Class* c = f->GetDeclaringClass();
// If the class is already initializing, we must be inside <clinit>, or
// we'd still be waiting for the lock.
- if (c->GetStatus() == Class::kStatusInitializing || class_linker->EnsureInitialized(c)) {
+ if (c->GetStatus() == Class::kStatusInitializing || class_linker->EnsureInitialized(c, true)) {
return f;
}
}
@@ -789,19 +789,12 @@
return false;
}
-bool Class::CanPutArrayElement(const Class* object_class, const Class* array_class) {
- if (object_class->IsArrayClass()) {
- return array_class->IsArrayAssignableFromArray(object_class);
- } else {
- return array_class->GetComponentType()->IsAssignableFrom(object_class);
- }
-}
-
void Class::CanPutArrayElementFromCode(const Object* element, const Class* array_class) {
+ DCHECK(array_class != NULL);
if (element == NULL) {
return;
}
- if (!CanPutArrayElement(element->GetClass(), array_class)) {
+ if (!array_class->GetComponentType()->IsAssignableFrom(element->GetClass())) {
LOG(ERROR) << "Can't put a " << PrettyClass(element->GetClass())
<< " into a " << PrettyClass(array_class);
UNIMPLEMENTED(FATAL) << "need to throw ArrayStoreException and unwind stack";