Improve quick codegen for aput-object.
1) don't type check known null.
2) if we know types in verify don't check at runtime.
3) if we're runtime checking then move all the code out-of-line.
Also, don't set up a callee-save frame for check-cast, do an instance-of test
then throw an exception if that fails.
Tidy quick entry point of Ldivmod to Lmod which it is on x86 and mips.
Fix monitor-enter/exit NPE for MIPS.
Fix benign bug in mirror::Class::CannotBeAssignedFromOtherTypes, a byte[]
cannot be assigned to from other types.
Change-Id: I9cb3859ec70cca71ed79331ec8df5bec969d6745
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 586151d..dbc6f57 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -247,7 +247,7 @@
} else {
Class* component = GetComponentType();
if (component->IsPrimitive()) {
- return false;
+ return true;
} else {
return component->CannotBeAssignedFromOtherTypes();
}
@@ -346,14 +346,18 @@
bool IsArtMethodClass() const;
+ static MemberOffset ComponentTypeOffset() {
+ return OFFSET_OF_OBJECT_MEMBER(Class, component_type_);
+ }
+
Class* GetComponentType() const {
- return GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), false);
+ return GetFieldObject<Class*>(ComponentTypeOffset(), false);
}
void SetComponentType(Class* new_component_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(GetComponentType() == NULL);
DCHECK(new_component_type != NULL);
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), new_component_type, false);
+ SetFieldObject(ComponentTypeOffset(), new_component_type, false);
}
size_t GetComponentSize() const {
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index b8765af..1e610f2 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -71,12 +71,20 @@
// Keep the assembly code in sync
TEST_F(ObjectTest, AsmConstants) {
- ASSERT_EQ(STRING_VALUE_OFFSET, String::ValueOffset().Int32Value());
- ASSERT_EQ(STRING_COUNT_OFFSET, String::CountOffset().Int32Value());
- ASSERT_EQ(STRING_OFFSET_OFFSET, String::OffsetOffset().Int32Value());
- ASSERT_EQ(STRING_DATA_OFFSET, Array::DataOffset(sizeof(uint16_t)).Int32Value());
+ EXPECT_EQ(CLASS_OFFSET, Object::ClassOffset().Int32Value());
+ EXPECT_EQ(LOCK_WORD_OFFSET, Object::MonitorOffset().Int32Value());
- ASSERT_EQ(METHOD_CODE_OFFSET, ArtMethod::EntryPointFromCompiledCodeOffset().Int32Value());
+ EXPECT_EQ(CLASS_COMPONENT_TYPE_OFFSET, Class::ComponentTypeOffset().Int32Value());
+
+ EXPECT_EQ(ARRAY_LENGTH_OFFSET, Array::LengthOffset().Int32Value());
+ EXPECT_EQ(OBJECT_ARRAY_DATA_OFFSET, Array::DataOffset(sizeof(Object*)).Int32Value());
+
+ EXPECT_EQ(STRING_VALUE_OFFSET, String::ValueOffset().Int32Value());
+ EXPECT_EQ(STRING_COUNT_OFFSET, String::CountOffset().Int32Value());
+ EXPECT_EQ(STRING_OFFSET_OFFSET, String::OffsetOffset().Int32Value());
+ EXPECT_EQ(STRING_DATA_OFFSET, Array::DataOffset(sizeof(uint16_t)).Int32Value());
+
+ EXPECT_EQ(METHOD_CODE_OFFSET, ArtMethod::EntryPointFromCompiledCodeOffset().Int32Value());
}
TEST_F(ObjectTest, IsInSamePackage) {