Refactor java.lang.reflect implementation
Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.
Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.
Bug: 10014286.
Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
diff --git a/runtime/mirror/field-inl.h b/runtime/mirror/art_field-inl.h
similarity index 69%
rename from runtime/mirror/field-inl.h
rename to runtime/mirror/art_field-inl.h
index 3e3d6db..d8c278c 100644
--- a/runtime/mirror/field-inl.h
+++ b/runtime/mirror/art_field-inl.h
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_MIRROR_FIELD_INL_H_
-#define ART_RUNTIME_MIRROR_FIELD_INL_H_
+#ifndef ART_RUNTIME_MIRROR_ART_FIELD_INL_H_
+#define ART_RUNTIME_MIRROR_ART_FIELD_INL_H_
-#include "field.h"
+#include "art_field.h"
#include "base/logging.h"
#include "gc/accounting/card_table-inl.h"
@@ -29,117 +29,117 @@
namespace art {
namespace mirror {
-inline Class* Field::GetDeclaringClass() const {
- Class* result = GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Field, declaring_class_), false);
+inline Class* ArtField::GetDeclaringClass() const {
+ Class* result = GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(ArtField, declaring_class_), false);
DCHECK(result != NULL);
DCHECK(result->IsLoaded() || result->IsErroneous());
return result;
}
-inline void Field::SetDeclaringClass(Class *new_declaring_class) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Field, declaring_class_), new_declaring_class, false);
+inline void ArtField::SetDeclaringClass(Class *new_declaring_class) {
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtField, declaring_class_), new_declaring_class, false);
}
-inline uint32_t Field::GetAccessFlags() const {
+inline uint32_t ArtField::GetAccessFlags() const {
DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
- return GetField32(OFFSET_OF_OBJECT_MEMBER(Field, access_flags_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, access_flags_), false);
}
-inline MemberOffset Field::GetOffset() const {
+inline MemberOffset ArtField::GetOffset() const {
DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous());
- return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), false));
+ return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, offset_), false));
}
-inline MemberOffset Field::GetOffsetDuringLinking() const {
+inline MemberOffset ArtField::GetOffsetDuringLinking() const {
DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
- return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), false));
+ return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, offset_), false));
}
-inline uint32_t Field::Get32(const Object* object) const {
+inline uint32_t ArtField::Get32(const Object* object) const {
DCHECK(object != NULL) << PrettyField(this);
DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted());
return object->GetField32(GetOffset(), IsVolatile());
}
-inline void Field::Set32(Object* object, uint32_t new_value) const {
+inline void ArtField::Set32(Object* object, uint32_t new_value) const {
DCHECK(object != NULL) << PrettyField(this);
DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted());
object->SetField32(GetOffset(), new_value, IsVolatile());
}
-inline uint64_t Field::Get64(const Object* object) const {
+inline uint64_t ArtField::Get64(const Object* object) const {
DCHECK(object != NULL) << PrettyField(this);
DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted());
return object->GetField64(GetOffset(), IsVolatile());
}
-inline void Field::Set64(Object* object, uint64_t new_value) const {
+inline void ArtField::Set64(Object* object, uint64_t new_value) const {
DCHECK(object != NULL) << PrettyField(this);
DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted());
object->SetField64(GetOffset(), new_value, IsVolatile());
}
-inline Object* Field::GetObj(const Object* object) const {
+inline Object* ArtField::GetObj(const Object* object) const {
DCHECK(object != NULL) << PrettyField(this);
DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted());
return object->GetFieldObject<Object*>(GetOffset(), IsVolatile());
}
-inline void Field::SetObj(Object* object, const Object* new_value) const {
+inline void ArtField::SetObj(Object* object, const Object* new_value) const {
DCHECK(object != NULL) << PrettyField(this);
DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted());
object->SetFieldObject(GetOffset(), new_value, IsVolatile());
}
-inline bool Field::GetBoolean(const Object* object) const {
+inline bool ArtField::GetBoolean(const Object* object) const {
DCHECK_EQ(Primitive::kPrimBoolean, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
return Get32(object);
}
-inline void Field::SetBoolean(Object* object, bool z) const {
+inline void ArtField::SetBoolean(Object* object, bool z) const {
DCHECK_EQ(Primitive::kPrimBoolean, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
Set32(object, z);
}
-inline int8_t Field::GetByte(const Object* object) const {
+inline int8_t ArtField::GetByte(const Object* object) const {
DCHECK_EQ(Primitive::kPrimByte, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
return Get32(object);
}
-inline void Field::SetByte(Object* object, int8_t b) const {
+inline void ArtField::SetByte(Object* object, int8_t b) const {
DCHECK_EQ(Primitive::kPrimByte, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
Set32(object, b);
}
-inline uint16_t Field::GetChar(const Object* object) const {
+inline uint16_t ArtField::GetChar(const Object* object) const {
DCHECK_EQ(Primitive::kPrimChar, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
return Get32(object);
}
-inline void Field::SetChar(Object* object, uint16_t c) const {
+inline void ArtField::SetChar(Object* object, uint16_t c) const {
DCHECK_EQ(Primitive::kPrimChar, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
Set32(object, c);
}
-inline int16_t Field::GetShort(const Object* object) const {
+inline int16_t ArtField::GetShort(const Object* object) const {
DCHECK_EQ(Primitive::kPrimShort, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
return Get32(object);
}
-inline void Field::SetShort(Object* object, int16_t s) const {
+inline void ArtField::SetShort(Object* object, int16_t s) const {
DCHECK_EQ(Primitive::kPrimShort, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
Set32(object, s);
}
-inline int32_t Field::GetInt(const Object* object) const {
+inline int32_t ArtField::GetInt(const Object* object) const {
#ifndef NDEBUG
Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType();
CHECK(type == Primitive::kPrimInt || type == Primitive::kPrimFloat) << PrettyField(this);
@@ -147,7 +147,7 @@
return Get32(object);
}
-inline void Field::SetInt(Object* object, int32_t i) const {
+inline void ArtField::SetInt(Object* object, int32_t i) const {
#ifndef NDEBUG
Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType();
CHECK(type == Primitive::kPrimInt || type == Primitive::kPrimFloat) << PrettyField(this);
@@ -155,7 +155,7 @@
Set32(object, i);
}
-inline int64_t Field::GetLong(const Object* object) const {
+inline int64_t ArtField::GetLong(const Object* object) const {
#ifndef NDEBUG
Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType();
CHECK(type == Primitive::kPrimLong || type == Primitive::kPrimDouble) << PrettyField(this);
@@ -163,7 +163,7 @@
return Get64(object);
}
-inline void Field::SetLong(Object* object, int64_t j) const {
+inline void ArtField::SetLong(Object* object, int64_t j) const {
#ifndef NDEBUG
Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType();
CHECK(type == Primitive::kPrimLong || type == Primitive::kPrimDouble) << PrettyField(this);
@@ -171,7 +171,7 @@
Set64(object, j);
}
-inline float Field::GetFloat(const Object* object) const {
+inline float ArtField::GetFloat(const Object* object) const {
DCHECK_EQ(Primitive::kPrimFloat, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
JValue bits;
@@ -179,7 +179,7 @@
return bits.GetF();
}
-inline void Field::SetFloat(Object* object, float f) const {
+inline void ArtField::SetFloat(Object* object, float f) const {
DCHECK_EQ(Primitive::kPrimFloat, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
JValue bits;
@@ -187,7 +187,7 @@
Set32(object, bits.GetI());
}
-inline double Field::GetDouble(const Object* object) const {
+inline double ArtField::GetDouble(const Object* object) const {
DCHECK_EQ(Primitive::kPrimDouble, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
JValue bits;
@@ -195,7 +195,7 @@
return bits.GetD();
}
-inline void Field::SetDouble(Object* object, double d) const {
+inline void ArtField::SetDouble(Object* object, double d) const {
DCHECK_EQ(Primitive::kPrimDouble, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
JValue bits;
@@ -203,13 +203,13 @@
Set64(object, bits.GetJ());
}
-inline Object* Field::GetObject(const Object* object) const {
+inline Object* ArtField::GetObject(const Object* object) const {
DCHECK_EQ(Primitive::kPrimNot, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
return GetObj(object);
}
-inline void Field::SetObject(Object* object, const Object* l) const {
+inline void ArtField::SetObject(Object* object, const Object* l) const {
DCHECK_EQ(Primitive::kPrimNot, FieldHelper(this).GetTypeAsPrimitiveType())
<< PrettyField(this);
SetObj(object, l);
@@ -218,4 +218,4 @@
} // namespace mirror
} // namespace art
-#endif // ART_RUNTIME_MIRROR_FIELD_INL_H_
+#endif // ART_RUNTIME_MIRROR_ART_FIELD_INL_H_
diff --git a/runtime/mirror/field.cc b/runtime/mirror/art_field.cc
similarity index 68%
rename from runtime/mirror/field.cc
rename to runtime/mirror/art_field.cc
index 12f395f..a8bbe4b 100644
--- a/runtime/mirror/field.cc
+++ b/runtime/mirror/art_field.cc
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include "field.h"
+#include "art_field.h"
-#include "field-inl.h"
+#include "art_field-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "object-inl.h"
#include "object_utils.h"
@@ -27,20 +27,20 @@
namespace mirror {
// TODO: get global references for these
-Class* Field::java_lang_reflect_Field_ = NULL;
+Class* ArtField::java_lang_reflect_ArtField_ = NULL;
-void Field::SetClass(Class* java_lang_reflect_Field) {
- CHECK(java_lang_reflect_Field_ == NULL);
- CHECK(java_lang_reflect_Field != NULL);
- java_lang_reflect_Field_ = java_lang_reflect_Field;
+void ArtField::SetClass(Class* java_lang_reflect_ArtField) {
+ CHECK(java_lang_reflect_ArtField_ == NULL);
+ CHECK(java_lang_reflect_ArtField != NULL);
+ java_lang_reflect_ArtField_ = java_lang_reflect_ArtField;
}
-void Field::ResetClass() {
- CHECK(java_lang_reflect_Field_ != NULL);
- java_lang_reflect_Field_ = NULL;
+void ArtField::ResetClass() {
+ CHECK(java_lang_reflect_ArtField_ != NULL);
+ java_lang_reflect_ArtField_ = NULL;
}
-void Field::SetOffset(MemberOffset num_bytes) {
+void ArtField::SetOffset(MemberOffset num_bytes) {
DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
#if 0 // TODO enable later in boot and under !NDEBUG
FieldHelper fh(this);
@@ -49,7 +49,7 @@
DCHECK_ALIGNED(num_bytes.Uint32Value(), 8);
}
#endif
- SetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), num_bytes.Uint32Value(), false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, offset_), num_bytes.Uint32Value(), false);
}
} // namespace mirror
diff --git a/runtime/mirror/field.h b/runtime/mirror/art_field.h
similarity index 80%
rename from runtime/mirror/field.h
rename to runtime/mirror/art_field.h
index 6e508a3..ae34cb1 100644
--- a/runtime/mirror/field.h
+++ b/runtime/mirror/art_field.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_MIRROR_FIELD_H_
-#define ART_RUNTIME_MIRROR_FIELD_H_
+#ifndef ART_RUNTIME_MIRROR_ART_FIELD_H_
+#define ART_RUNTIME_MIRROR_ART_FIELD_H_
#include "class.h"
#include "modifiers.h"
@@ -23,13 +23,12 @@
namespace art {
-struct FieldClassOffsets;
-struct FieldOffsets;
+struct ArtFieldOffsets;
namespace mirror {
-// C++ mirror of java.lang.reflect.Field
-class MANAGED Field : public Object {
+// C++ mirror of java.lang.reflect.ArtField
+class MANAGED ArtField : public Object {
public:
Class* GetDeclaringClass() const;
@@ -38,7 +37,7 @@
uint32_t GetAccessFlags() const;
void SetAccessFlags(uint32_t new_access_flags) {
- SetField32(OFFSET_OF_OBJECT_MEMBER(Field, access_flags_), new_access_flags, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, access_flags_), new_access_flags, false);
}
bool IsPublic() const {
@@ -54,18 +53,18 @@
}
uint32_t GetDexFieldIndex() const {
- return GetField32(OFFSET_OF_OBJECT_MEMBER(Field, field_dex_idx_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, field_dex_idx_), false);
}
void SetDexFieldIndex(uint32_t new_idx) {
- SetField32(OFFSET_OF_OBJECT_MEMBER(Field, field_dex_idx_), new_idx, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, field_dex_idx_), new_idx, false);
}
// Offset to field within an Object
MemberOffset GetOffset() const;
static MemberOffset OffsetOffset() {
- return MemberOffset(OFFSETOF_MEMBER(Field, offset_));
+ return MemberOffset(OFFSETOF_MEMBER(ArtField, offset_));
}
MemberOffset GetOffsetDuringLinking() const;
@@ -124,12 +123,12 @@
void SetObj(Object* object, const Object* new_value) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static Class* GetJavaLangReflectField() {
- DCHECK(java_lang_reflect_Field_ != NULL);
- return java_lang_reflect_Field_;
+ static Class* GetJavaLangReflectArtField() {
+ DCHECK(java_lang_reflect_ArtField_ != NULL);
+ return java_lang_reflect_ArtField_;
}
- static void SetClass(Class* java_lang_reflect_Field);
+ static void SetClass(Class* java_lang_reflect_ArtField);
static void ResetClass();
bool IsVolatile() const {
@@ -149,20 +148,18 @@
// Offset of field within an instance or in the Class' static fields
uint32_t offset_;
- static Class* java_lang_reflect_Field_;
+ static Class* java_lang_reflect_ArtField_;
- friend struct art::FieldOffsets; // for verifying offset information
- DISALLOW_IMPLICIT_CONSTRUCTORS(Field);
+ friend struct art::ArtFieldOffsets; // for verifying offset information
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ArtField);
};
-class MANAGED FieldClass : public Class {
+class MANAGED ArtFieldClass : public Class {
private:
- Object* ORDER_BY_NAME_AND_DECLARING_CLASS_;
- friend struct art::FieldClassOffsets; // for verifying offset information
- DISALLOW_IMPLICIT_CONSTRUCTORS(FieldClass);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ArtFieldClass);
};
} // namespace mirror
} // namespace art
-#endif // ART_RUNTIME_MIRROR_FIELD_H_
+#endif // ART_RUNTIME_MIRROR_ART_FIELD_H_
diff --git a/runtime/mirror/abstract_method-inl.h b/runtime/mirror/art_method-inl.h
similarity index 63%
rename from runtime/mirror/abstract_method-inl.h
rename to runtime/mirror/art_method-inl.h
index d47b3eb..4d8aa6f 100644
--- a/runtime/mirror/abstract_method-inl.h
+++ b/runtime/mirror/art_method-inl.h
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_
-#define ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_
+#ifndef ART_RUNTIME_MIRROR_ART_METHOD_INL_H_
+#define ART_RUNTIME_MIRROR_ART_METHOD_INL_H_
-#include "abstract_method.h"
+#include "art_method.h"
#include "dex_file.h"
#include "entrypoints/entrypoint_utils.h"
@@ -27,54 +27,54 @@
namespace art {
namespace mirror {
-inline Class* AbstractMethod::GetDeclaringClass() const {
- Class* result = GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, declaring_class_), false);
+inline Class* ArtMethod::GetDeclaringClass() const {
+ Class* result = GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, declaring_class_), false);
DCHECK(result != NULL) << this;
DCHECK(result->IsIdxLoaded() || result->IsErroneous()) << this;
return result;
}
-inline void AbstractMethod::SetDeclaringClass(Class *new_declaring_class) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, declaring_class_), new_declaring_class, false);
+inline void ArtMethod::SetDeclaringClass(Class *new_declaring_class) {
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, declaring_class_), new_declaring_class, false);
}
-inline uint32_t AbstractMethod::GetAccessFlags() const {
+inline uint32_t ArtMethod::GetAccessFlags() const {
DCHECK(GetDeclaringClass()->IsIdxLoaded() || GetDeclaringClass()->IsErroneous());
- return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, access_flags_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, access_flags_), false);
}
-inline uint16_t AbstractMethod::GetMethodIndex() const {
+inline uint16_t ArtMethod::GetMethodIndex() const {
DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous());
- return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_), false);
}
-inline uint32_t AbstractMethod::GetDexMethodIndex() const {
+inline uint32_t ArtMethod::GetDexMethodIndex() const {
DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
- return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_dex_index_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_dex_index_), false);
}
-inline ObjectArray<String>* AbstractMethod::GetDexCacheStrings() const {
+inline ObjectArray<String>* ArtMethod::GetDexCacheStrings() const {
return GetFieldObject<ObjectArray<String>*>(
- OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_strings_), false);
+ OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_), false);
}
-inline ObjectArray<AbstractMethod>* AbstractMethod::GetDexCacheResolvedMethods() const {
- return GetFieldObject<ObjectArray<AbstractMethod>*>(
- OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_methods_), false);
+inline ObjectArray<ArtMethod>* ArtMethod::GetDexCacheResolvedMethods() const {
+ return GetFieldObject<ObjectArray<ArtMethod>*>(
+ OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_), false);
}
-inline ObjectArray<Class>* AbstractMethod::GetDexCacheResolvedTypes() const {
+inline ObjectArray<Class>* ArtMethod::GetDexCacheResolvedTypes() const {
return GetFieldObject<ObjectArray<Class>*>(
- OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_types_), false);
+ OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_), false);
}
-inline ObjectArray<StaticStorageBase>* AbstractMethod::GetDexCacheInitializedStaticStorage() const {
+inline ObjectArray<StaticStorageBase>* ArtMethod::GetDexCacheInitializedStaticStorage() const {
return GetFieldObject<ObjectArray<StaticStorageBase>*>(
- OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_initialized_static_storage_),
+ OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_initialized_static_storage_),
false);
}
-inline uint32_t AbstractMethod::GetCodeSize() const {
+inline uint32_t ArtMethod::GetCodeSize() const {
DCHECK(!IsRuntimeMethod() && !IsProxyMethod()) << PrettyMethod(this);
uintptr_t code = reinterpret_cast<uintptr_t>(GetEntryPointFromCompiledCode());
if (code == 0) {
@@ -85,7 +85,7 @@
return reinterpret_cast<uint32_t*>(code)[-1];
}
-inline bool AbstractMethod::CheckIncompatibleClassChange(InvokeType type) {
+inline bool ArtMethod::CheckIncompatibleClassChange(InvokeType type) {
switch (type) {
case kStatic:
return !IsStatic();
@@ -107,7 +107,7 @@
}
}
-inline void AbstractMethod::AssertPcIsWithinCode(uintptr_t pc) const {
+inline void ArtMethod::AssertPcIsWithinCode(uintptr_t pc) const {
if (!kIsDebugBuild) {
return;
}
@@ -132,51 +132,51 @@
<< " size=" << GetCodeSize();
}
-inline uint32_t AbstractMethod::GetOatCodeOffset() const {
+inline uint32_t ArtMethod::GetOatCodeOffset() const {
DCHECK(!Runtime::Current()->IsStarted());
return reinterpret_cast<uint32_t>(GetEntryPointFromCompiledCode());
}
-inline void AbstractMethod::SetOatCodeOffset(uint32_t code_offset) {
+inline void ArtMethod::SetOatCodeOffset(uint32_t code_offset) {
DCHECK(!Runtime::Current()->IsStarted());
SetEntryPointFromCompiledCode(reinterpret_cast<void*>(code_offset));
}
-inline uint32_t AbstractMethod::GetOatMappingTableOffset() const {
+inline uint32_t ArtMethod::GetOatMappingTableOffset() const {
DCHECK(!Runtime::Current()->IsStarted());
return reinterpret_cast<uint32_t>(GetMappingTable());
}
-inline void AbstractMethod::SetOatMappingTableOffset(uint32_t mapping_table_offset) {
+inline void ArtMethod::SetOatMappingTableOffset(uint32_t mapping_table_offset) {
DCHECK(!Runtime::Current()->IsStarted());
SetMappingTable(reinterpret_cast<const uint8_t*>(mapping_table_offset));
}
-inline uint32_t AbstractMethod::GetOatVmapTableOffset() const {
+inline uint32_t ArtMethod::GetOatVmapTableOffset() const {
DCHECK(!Runtime::Current()->IsStarted());
return reinterpret_cast<uint32_t>(GetVmapTable());
}
-inline void AbstractMethod::SetOatVmapTableOffset(uint32_t vmap_table_offset) {
+inline void ArtMethod::SetOatVmapTableOffset(uint32_t vmap_table_offset) {
DCHECK(!Runtime::Current()->IsStarted());
SetVmapTable(reinterpret_cast<uint8_t*>(vmap_table_offset));
}
-inline void AbstractMethod::SetOatNativeGcMapOffset(uint32_t gc_map_offset) {
+inline void ArtMethod::SetOatNativeGcMapOffset(uint32_t gc_map_offset) {
DCHECK(!Runtime::Current()->IsStarted());
SetNativeGcMap(reinterpret_cast<uint8_t*>(gc_map_offset));
}
-inline uint32_t AbstractMethod::GetOatNativeGcMapOffset() const {
+inline uint32_t ArtMethod::GetOatNativeGcMapOffset() const {
DCHECK(!Runtime::Current()->IsStarted());
return reinterpret_cast<uint32_t>(GetNativeGcMap());
}
-inline bool AbstractMethod::IsRuntimeMethod() const {
+inline bool ArtMethod::IsRuntimeMethod() const {
return GetDexMethodIndex() == DexFile::kDexNoIndex16;
}
-inline bool AbstractMethod::IsCalleeSaveMethod() const {
+inline bool ArtMethod::IsCalleeSaveMethod() const {
if (!IsRuntimeMethod()) {
return false;
}
@@ -191,7 +191,7 @@
return result;
}
-inline bool AbstractMethod::IsResolutionMethod() const {
+inline bool ArtMethod::IsResolutionMethod() const {
bool result = this == Runtime::Current()->GetResolutionMethod();
// Check that if we do think it is phony it looks like the resolution method.
DCHECK(!result || IsRuntimeMethod());
@@ -200,4 +200,4 @@
} // namespace mirror
} // namespace art
-#endif // ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_
+#endif // ART_RUNTIME_MIRROR_ART_METHOD_INL_H_
diff --git a/runtime/mirror/abstract_method.cc b/runtime/mirror/art_method.cc
similarity index 77%
rename from runtime/mirror/abstract_method.cc
rename to runtime/mirror/art_method.cc
index b3db5c2..cd05f41 100644
--- a/runtime/mirror/abstract_method.cc
+++ b/runtime/mirror/art_method.cc
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include "abstract_method.h"
+#include "art_method.h"
-#include "abstract_method-inl.h"
+#include "art_method-inl.h"
#include "base/stringpiece.h"
#include "class-inl.h"
#include "dex_file-inl.h"
@@ -34,14 +34,13 @@
namespace art {
namespace mirror {
-extern "C" void art_portable_invoke_stub(AbstractMethod*, uint32_t*, uint32_t, Thread*, JValue*, char);
-extern "C" void art_quick_invoke_stub(AbstractMethod*, uint32_t*, uint32_t, Thread*, JValue*, char);
+extern "C" void art_portable_invoke_stub(ArtMethod*, uint32_t*, uint32_t, Thread*, JValue*, char);
+extern "C" void art_quick_invoke_stub(ArtMethod*, uint32_t*, uint32_t, Thread*, JValue*, char);
// TODO: get global references for these
-Class* AbstractMethod::java_lang_reflect_Constructor_ = NULL;
-Class* AbstractMethod::java_lang_reflect_Method_ = NULL;
+Class* ArtMethod::java_lang_reflect_ArtMethod_ = NULL;
-InvokeType AbstractMethod::GetInvokeType() const {
+InvokeType ArtMethod::GetInvokeType() const {
// TODO: kSuper?
if (GetDeclaringClass()->IsInterface()) {
return kInterface;
@@ -54,45 +53,38 @@
}
}
-void AbstractMethod::SetClasses(Class* java_lang_reflect_Constructor, Class* java_lang_reflect_Method) {
- CHECK(java_lang_reflect_Constructor_ == NULL);
- CHECK(java_lang_reflect_Constructor != NULL);
- java_lang_reflect_Constructor_ = java_lang_reflect_Constructor;
-
- CHECK(java_lang_reflect_Method_ == NULL);
- CHECK(java_lang_reflect_Method != NULL);
- java_lang_reflect_Method_ = java_lang_reflect_Method;
+void ArtMethod::SetClass(Class* java_lang_reflect_ArtMethod) {
+ CHECK(java_lang_reflect_ArtMethod_ == NULL);
+ CHECK(java_lang_reflect_ArtMethod != NULL);
+ java_lang_reflect_ArtMethod_ = java_lang_reflect_ArtMethod;
}
-void AbstractMethod::ResetClasses() {
- CHECK(java_lang_reflect_Constructor_ != NULL);
- java_lang_reflect_Constructor_ = NULL;
-
- CHECK(java_lang_reflect_Method_ != NULL);
- java_lang_reflect_Method_ = NULL;
+void ArtMethod::ResetClass() {
+ CHECK(java_lang_reflect_ArtMethod_ != NULL);
+ java_lang_reflect_ArtMethod_ = NULL;
}
-void AbstractMethod::SetDexCacheStrings(ObjectArray<String>* new_dex_cache_strings) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_strings_),
+void ArtMethod::SetDexCacheStrings(ObjectArray<String>* new_dex_cache_strings) {
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_),
new_dex_cache_strings, false);
}
-void AbstractMethod::SetDexCacheResolvedMethods(ObjectArray<AbstractMethod>* new_dex_cache_methods) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_methods_),
+void ArtMethod::SetDexCacheResolvedMethods(ObjectArray<ArtMethod>* new_dex_cache_methods) {
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_),
new_dex_cache_methods, false);
}
-void AbstractMethod::SetDexCacheResolvedTypes(ObjectArray<Class>* new_dex_cache_classes) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_types_),
+void ArtMethod::SetDexCacheResolvedTypes(ObjectArray<Class>* new_dex_cache_classes) {
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_),
new_dex_cache_classes, false);
}
-void AbstractMethod::SetDexCacheInitializedStaticStorage(ObjectArray<StaticStorageBase>* new_value) {
- SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_initialized_static_storage_),
+void ArtMethod::SetDexCacheInitializedStaticStorage(ObjectArray<StaticStorageBase>* new_value) {
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_initialized_static_storage_),
new_value, false);
}
-size_t AbstractMethod::NumArgRegisters(const StringPiece& shorty) {
+size_t ArtMethod::NumArgRegisters(const StringPiece& shorty) {
CHECK_LE(1, shorty.length());
uint32_t num_registers = 0;
for (int i = 1; i < shorty.length(); ++i) {
@@ -106,19 +98,19 @@
return num_registers;
}
-bool AbstractMethod::IsProxyMethod() const {
+bool ArtMethod::IsProxyMethod() const {
return GetDeclaringClass()->IsProxyClass();
}
-AbstractMethod* AbstractMethod::FindOverriddenMethod() const {
+ArtMethod* ArtMethod::FindOverriddenMethod() const {
if (IsStatic()) {
return NULL;
}
Class* declaring_class = GetDeclaringClass();
Class* super_class = declaring_class->GetSuperClass();
uint16_t method_index = GetMethodIndex();
- ObjectArray<AbstractMethod>* super_class_vtable = super_class->GetVTable();
- AbstractMethod* result = NULL;
+ ObjectArray<ArtMethod>* super_class_vtable = super_class->GetVTable();
+ ArtMethod* result = NULL;
// Did this method override a super class method? If so load the result from the super class'
// vtable
if (super_class_vtable != NULL && method_index < super_class_vtable->GetLength()) {
@@ -136,7 +128,7 @@
for (size_t i = 0; i < iftable->Count() && result == NULL; i++) {
Class* interface = iftable->GetInterface(i);
for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) {
- AbstractMethod* interface_method = interface->GetVirtualMethod(j);
+ ArtMethod* interface_method = interface->GetVirtualMethod(j);
interface_mh.ChangeMethod(interface_method);
if (mh.HasSameNameAndSignature(&interface_mh)) {
result = interface_method;
@@ -153,12 +145,12 @@
return result;
}
-uintptr_t AbstractMethod::NativePcOffset(const uintptr_t pc) const {
+uintptr_t ArtMethod::NativePcOffset(const uintptr_t pc) const {
const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this);
return pc - reinterpret_cast<uintptr_t>(code);
}
-uint32_t AbstractMethod::ToDexPc(const uintptr_t pc) const {
+uint32_t ArtMethod::ToDexPc(const uintptr_t pc) const {
#if !defined(ART_USE_PORTABLE_COMPILER)
MappingTable table(GetMappingTable());
if (table.TotalSize() == 0) {
@@ -191,7 +183,7 @@
#endif
}
-uintptr_t AbstractMethod::ToNativePc(const uint32_t dex_pc) const {
+uintptr_t ArtMethod::ToNativePc(const uint32_t dex_pc) const {
MappingTable table(GetMappingTable());
if (table.TotalSize() == 0) {
DCHECK_EQ(dex_pc, 0U);
@@ -218,8 +210,8 @@
return 0;
}
-uint32_t AbstractMethod::FindCatchBlock(Class* exception_type, uint32_t dex_pc,
- bool* has_no_move_exception) const {
+uint32_t ArtMethod::FindCatchBlock(Class* exception_type, uint32_t dex_pc,
+ bool* has_no_move_exception) const {
MethodHelper mh(this);
const DexFile::CodeItem* code_item = mh.GetCodeItem();
// Default to handler not found.
@@ -251,8 +243,8 @@
return found_dex_pc;
}
-void AbstractMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result,
- char result_type) {
+void ArtMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result,
+ char result_type) {
if (kIsDebugBuild) {
self->AssertThreadSuspensionIsAllowable();
CHECK_EQ(kRunnable, self->GetState());
@@ -306,15 +298,15 @@
self->PopManagedStackFragment(fragment);
}
-bool AbstractMethod::IsRegistered() const {
- void* native_method = GetFieldPtr<void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, native_method_), false);
+bool ArtMethod::IsRegistered() const {
+ void* native_method = GetFieldPtr<void*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, native_method_), false);
CHECK(native_method != NULL);
void* jni_stub = GetJniDlsymLookupStub();
return native_method != jni_stub;
}
extern "C" void art_work_around_app_jni_bugs(JNIEnv*, jobject);
-void AbstractMethod::RegisterNative(Thread* self, const void* native_method) {
+void ArtMethod::RegisterNative(Thread* self, const void* native_method) {
DCHECK(Thread::Current() == self);
CHECK(IsNative()) << PrettyMethod(this);
CHECK(native_method != NULL) << PrettyMethod(this);
@@ -330,19 +322,19 @@
#else
SetNativeMethod(reinterpret_cast<void*>(art_work_around_app_jni_bugs));
#endif
- SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, gc_map_),
+ SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_),
reinterpret_cast<const uint8_t*>(native_method), false);
}
}
-void AbstractMethod::UnregisterNative(Thread* self) {
+void ArtMethod::UnregisterNative(Thread* self) {
CHECK(IsNative()) << PrettyMethod(this);
// restore stub to lookup native pointer via dlsym
RegisterNative(self, GetJniDlsymLookupStub());
}
-void AbstractMethod::SetNativeMethod(const void* native_method) {
- SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, native_method_),
+void ArtMethod::SetNativeMethod(const void* native_method) {
+ SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, native_method_),
native_method, false);
}
diff --git a/runtime/mirror/abstract_method.h b/runtime/mirror/art_method.h
similarity index 74%
rename from runtime/mirror/abstract_method.h
rename to runtime/mirror/art_method.h
index 5b8c61c..7301f23 100644
--- a/runtime/mirror/abstract_method.h
+++ b/runtime/mirror/art_method.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_
-#define ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_
+#ifndef ART_RUNTIME_MIRROR_ART_METHOD_H_
+#define ART_RUNTIME_MIRROR_ART_METHOD_H_
#include "class.h"
#include "dex_file.h"
@@ -26,12 +26,11 @@
namespace art {
-struct AbstractMethodOffsets;
+struct ArtMethodOffsets;
struct ConstructorMethodOffsets;
union JValue;
struct MethodClassOffsets;
class MethodHelper;
-struct MethodOffsets;
class StringPiece;
class ShadowFrame;
@@ -43,24 +42,24 @@
const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result);
// C++ mirror of java.lang.reflect.Method and java.lang.reflect.Constructor
-class MANAGED AbstractMethod : public Object {
+class MANAGED ArtMethod : public Object {
public:
Class* GetDeclaringClass() const;
void SetDeclaringClass(Class *new_declaring_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static MemberOffset DeclaringClassOffset() {
- return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, declaring_class_));
+ return MemberOffset(OFFSETOF_MEMBER(ArtMethod, declaring_class_));
}
static MemberOffset EntryPointFromCompiledCodeOffset() {
- return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_compiled_code_));
+ return MemberOffset(OFFSETOF_MEMBER(ArtMethod, entry_point_from_compiled_code_));
}
uint32_t GetAccessFlags() const;
void SetAccessFlags(uint32_t new_access_flags) {
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, access_flags_), new_access_flags, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, access_flags_), new_access_flags, false);
}
// Approximate what kind of method call would be used for this method.
@@ -140,19 +139,19 @@
}
void SetMethodIndex(uint16_t new_method_index) {
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_), new_method_index, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_), new_method_index, false);
}
static MemberOffset MethodIndexOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_);
}
uint32_t GetCodeItemOffset() const {
- return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_item_offset_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, code_item_offset_), false);
}
void SetCodeItemOffset(uint32_t new_code_off) {
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_item_offset_), new_code_off, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, code_item_offset_), new_code_off, false);
}
// Number of 32bit registers that would be required to hold all the arguments
@@ -161,7 +160,7 @@
uint32_t GetDexMethodIndex() const;
void SetDexMethodIndex(uint32_t new_idx) {
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_dex_index_), new_idx, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_dex_index_), new_idx, false);
}
ObjectArray<String>* GetDexCacheStrings() const;
@@ -169,24 +168,24 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static MemberOffset DexCacheStringsOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_strings_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_);
}
static MemberOffset DexCacheResolvedMethodsOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_methods_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_);
}
static MemberOffset DexCacheResolvedTypesOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_types_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_);
}
static MemberOffset DexCacheInitializedStaticStorageOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod,
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod,
dex_cache_initialized_static_storage_);
}
- ObjectArray<AbstractMethod>* GetDexCacheResolvedMethods() const;
- void SetDexCacheResolvedMethods(ObjectArray<AbstractMethod>* new_dex_cache_methods)
+ ObjectArray<ArtMethod>* GetDexCacheResolvedMethods() const;
+ void SetDexCacheResolvedMethods(ObjectArray<ArtMethod>* new_dex_cache_methods)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
ObjectArray<Class>* GetDexCacheResolvedTypes() const;
@@ -198,25 +197,25 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Find the method that this method overrides
- AbstractMethod* FindOverriddenMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ ArtMethod* FindOverriddenMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result, char result_type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
EntryPointFromInterpreter* GetEntryPointFromInterpreter() const {
- return GetFieldPtr<EntryPointFromInterpreter*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_interpreter_), false);
+ return GetFieldPtr<EntryPointFromInterpreter*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_interpreter_), false);
}
void SetEntryPointFromInterpreter(EntryPointFromInterpreter* entry_point_from_interpreter) {
- SetFieldPtr<EntryPointFromInterpreter*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_interpreter_), entry_point_from_interpreter, false);
+ SetFieldPtr<EntryPointFromInterpreter*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_interpreter_), entry_point_from_interpreter, false);
}
const void* GetEntryPointFromCompiledCode() const {
- return GetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_), false);
+ return GetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_compiled_code_), false);
}
void SetEntryPointFromCompiledCode(const void* entry_point_from_compiled_code) {
- SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_), entry_point_from_compiled_code, false);
+ SetFieldPtr<const void*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_compiled_code_), entry_point_from_compiled_code, false);
}
uint32_t GetCodeSize() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -243,16 +242,16 @@
void SetOatCodeOffset(uint32_t code_offset);
static MemberOffset GetEntryPointFromCompiledCodeOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_compiled_code_);
}
// Callers should wrap the uint8_t* in a MappingTable instance for convenient access.
const uint8_t* GetMappingTable() const {
- return GetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, mapping_table_), false);
+ return GetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, mapping_table_), false);
}
void SetMappingTable(const uint8_t* mapping_table) {
- SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, mapping_table_),
+ SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, mapping_table_),
mapping_table, false);
}
@@ -262,11 +261,11 @@
// Callers should wrap the uint8_t* in a VmapTable instance for convenient access.
const uint8_t* GetVmapTable() const {
- return GetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, vmap_table_), false);
+ return GetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, vmap_table_), false);
}
void SetVmapTable(const uint8_t* vmap_table) {
- SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, vmap_table_), vmap_table, false);
+ SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, vmap_table_), vmap_table, false);
}
uint32_t GetOatVmapTableOffset() const;
@@ -274,10 +273,10 @@
void SetOatVmapTableOffset(uint32_t vmap_table_offset);
const uint8_t* GetNativeGcMap() const {
- return GetFieldPtr<uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, gc_map_), false);
+ return GetFieldPtr<uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_), false);
}
void SetNativeGcMap(const uint8_t* data) {
- SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, gc_map_), data, false);
+ SetFieldPtr<const uint8_t*>(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_), data, false);
}
// When building the oat need a convenient place to stuff the offset of the native GC map.
@@ -286,14 +285,14 @@
size_t GetFrameSizeInBytes() const {
DCHECK_EQ(sizeof(size_t), sizeof(uint32_t));
- size_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, frame_size_in_bytes_), false);
+ size_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, frame_size_in_bytes_), false);
DCHECK_LE(static_cast<size_t>(kStackAlignment), result);
return result;
}
void SetFrameSizeInBytes(size_t new_frame_size_in_bytes) {
DCHECK_EQ(sizeof(size_t), sizeof(uint32_t));
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, frame_size_in_bytes_),
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, frame_size_in_bytes_),
new_frame_size_in_bytes, false);
}
@@ -314,7 +313,7 @@
void UnregisterNative(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static MemberOffset NativeMethodOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, native_method_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, native_method_);
}
const void* GetNativeMethod() const {
@@ -324,25 +323,25 @@
void SetNativeMethod(const void*);
static MemberOffset GetMethodIndexOffset() {
- return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_);
+ return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_);
}
uint32_t GetCoreSpillMask() const {
- return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, core_spill_mask_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, core_spill_mask_), false);
}
void SetCoreSpillMask(uint32_t core_spill_mask) {
// Computed during compilation
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, core_spill_mask_), core_spill_mask, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, core_spill_mask_), core_spill_mask, false);
}
uint32_t GetFpSpillMask() const {
- return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, fp_spill_mask_), false);
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, fp_spill_mask_), false);
}
void SetFpSpillMask(uint32_t fp_spill_mask) {
// Computed during compilation
- SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, fp_spill_mask_), fp_spill_mask, false);
+ SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, fp_spill_mask_), fp_spill_mask, false);
}
// Is this a CalleSaveMethod or ResolutionMethod and therefore doesn't adhere to normal
@@ -368,17 +367,13 @@
uint32_t FindCatchBlock(Class* exception_type, uint32_t dex_pc, bool* has_no_move_exception) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static void SetClasses(Class* java_lang_reflect_Constructor, Class* java_lang_reflect_Method);
+ static void SetClass(Class* java_lang_reflect_ArtMethod);
- static Class* GetConstructorClass() {
- return java_lang_reflect_Constructor_;
+ static Class* GetJavaLangReflectArtMethod() {
+ return java_lang_reflect_ArtMethod_;
}
- static Class* GetMethodClass() {
- return java_lang_reflect_Method_;
- }
-
- static void ResetClasses();
+ static void ResetClass();
protected:
// Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
@@ -389,7 +384,7 @@
ObjectArray<StaticStorageBase>* dex_cache_initialized_static_storage_;
// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
- ObjectArray<AbstractMethod>* dex_cache_resolved_methods_;
+ ObjectArray<ArtMethod>* dex_cache_resolved_methods_;
// short cuts to declaring_class_->dex_cache_ member for fast compiled code access
ObjectArray<Class>* dex_cache_resolved_types_;
@@ -445,27 +440,18 @@
// is vmap_table_[N]. vmap_table_[0] holds the length of the table.
const uint16_t* vmap_table_;
- static Class* java_lang_reflect_Constructor_;
- static Class* java_lang_reflect_Method_;
+ static Class* java_lang_reflect_ArtMethod_;
- friend struct art::AbstractMethodOffsets; // for verifying offset information
- friend struct art::ConstructorMethodOffsets; // for verifying offset information
- friend struct art::MethodOffsets; // for verifying offset information
- DISALLOW_IMPLICIT_CONSTRUCTORS(AbstractMethod);
+ friend struct art::ArtMethodOffsets; // for verifying offset information
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ArtMethod);
};
-class MANAGED Method : public AbstractMethod {};
-
-class MANAGED Constructor : public AbstractMethod {};
-
-class MANAGED AbstractMethodClass : public Class {
+class MANAGED ArtMethodClass : public Class {
private:
- Object* ORDER_BY_SIGNATURE_;
- friend struct art::MethodClassOffsets; // for verifying offset information
- DISALLOW_IMPLICIT_CONSTRUCTORS(AbstractMethodClass);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ArtMethodClass);
};
} // namespace mirror
} // namespace art
-#endif // ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_
+#endif // ART_RUNTIME_MIRROR_ART_METHOD_H_
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 52906a2..1e11387 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -19,10 +19,10 @@
#include "class.h"
-#include "abstract_method.h"
+#include "art_field.h"
+#include "art_method.h"
#include "class_loader.h"
#include "dex_cache.h"
-#include "field.h"
#include "iftable.h"
#include "object_array-inl.h"
#include "runtime.h"
@@ -54,30 +54,30 @@
return GetFieldObject<DexCache*>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), false);
}
-inline ObjectArray<AbstractMethod>* Class::GetDirectMethods() const {
+inline ObjectArray<ArtMethod>* Class::GetDirectMethods() const {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<AbstractMethod>*>(
+ return GetFieldObject<ObjectArray<ArtMethod>*>(
OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), false);
}
-inline void Class::SetDirectMethods(ObjectArray<AbstractMethod>* new_direct_methods)
+inline void Class::SetDirectMethods(ObjectArray<ArtMethod>* new_direct_methods)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(NULL == GetFieldObject<ObjectArray<AbstractMethod>*>(
+ DCHECK(NULL == GetFieldObject<ObjectArray<ArtMethod>*>(
OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), false));
DCHECK_NE(0, new_direct_methods->GetLength());
SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_),
new_direct_methods, false);
}
-inline AbstractMethod* Class::GetDirectMethod(int32_t i) const
+inline ArtMethod* Class::GetDirectMethod(int32_t i) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return GetDirectMethods()->Get(i);
}
-inline void Class::SetDirectMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t
+inline void Class::SetDirectMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<AbstractMethod>* direct_methods =
- GetFieldObject<ObjectArray<AbstractMethod>*>(
+ ObjectArray<ArtMethod>* direct_methods =
+ GetFieldObject<ObjectArray<ArtMethod>*>(
OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), false);
direct_methods->Set(i, f);
}
@@ -87,13 +87,13 @@
return (GetDirectMethods() != NULL) ? GetDirectMethods()->GetLength() : 0;
}
-inline ObjectArray<AbstractMethod>* Class::GetVirtualMethods() const {
+inline ObjectArray<ArtMethod>* Class::GetVirtualMethods() const {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<AbstractMethod>*>(
+ return GetFieldObject<ObjectArray<ArtMethod>*>(
OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_), false);
}
-inline void Class::SetVirtualMethods(ObjectArray<AbstractMethod>* new_virtual_methods) {
+inline void Class::SetVirtualMethods(ObjectArray<ArtMethod>* new_virtual_methods) {
// TODO: we reassign virtual methods to grow the table for miranda
// methods.. they should really just be assigned once
DCHECK_NE(0, new_virtual_methods->GetLength());
@@ -105,37 +105,37 @@
return (GetVirtualMethods() != NULL) ? GetVirtualMethods()->GetLength() : 0;
}
-inline AbstractMethod* Class::GetVirtualMethod(uint32_t i) const
+inline ArtMethod* Class::GetVirtualMethod(uint32_t i) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(IsResolved() || IsErroneous());
return GetVirtualMethods()->Get(i);
}
-inline AbstractMethod* Class::GetVirtualMethodDuringLinking(uint32_t i) const
+inline ArtMethod* Class::GetVirtualMethodDuringLinking(uint32_t i) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(IsLoaded() || IsErroneous());
return GetVirtualMethods()->Get(i);
}
-inline void Class::SetVirtualMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t
+inline void Class::SetVirtualMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<AbstractMethod>* virtual_methods =
- GetFieldObject<ObjectArray<AbstractMethod>*>(
+ ObjectArray<ArtMethod>* virtual_methods =
+ GetFieldObject<ObjectArray<ArtMethod>*>(
OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_), false);
virtual_methods->Set(i, f);
}
-inline ObjectArray<AbstractMethod>* Class::GetVTable() const {
+inline ObjectArray<ArtMethod>* Class::GetVTable() const {
DCHECK(IsResolved() || IsErroneous());
- return GetFieldObject<ObjectArray<AbstractMethod>*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false);
+ return GetFieldObject<ObjectArray<ArtMethod>*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false);
}
-inline ObjectArray<AbstractMethod>* Class::GetVTableDuringLinking() const {
+inline ObjectArray<ArtMethod>* Class::GetVTableDuringLinking() const {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<AbstractMethod>*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false);
+ return GetFieldObject<ObjectArray<ArtMethod>*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false);
}
-inline void Class::SetVTable(ObjectArray<AbstractMethod>* new_vtable)
+inline void Class::SetVTable(ObjectArray<ArtMethod>* new_vtable)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), new_vtable, false);
}
@@ -208,7 +208,7 @@
return false;
}
-inline AbstractMethod* Class::FindVirtualMethodForInterface(AbstractMethod* method) const {
+inline ArtMethod* Class::FindVirtualMethodForInterface(ArtMethod* method) const {
Class* declaring_class = method->GetDeclaringClass();
DCHECK(declaring_class != NULL) << PrettyClass(this);
DCHECK(declaring_class->IsInterface()) << PrettyMethod(method);
@@ -223,7 +223,7 @@
return NULL;
}
-inline AbstractMethod* Class::FindVirtualMethodForVirtual(AbstractMethod* method) const
+inline ArtMethod* Class::FindVirtualMethodForVirtual(ArtMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(!method->GetDeclaringClass()->IsInterface() || method->IsMiranda());
// The argument method may from a super class.
@@ -231,13 +231,13 @@
return GetVTable()->Get(method->GetMethodIndex());
}
-inline AbstractMethod* Class::FindVirtualMethodForSuper(AbstractMethod* method) const
+inline ArtMethod* Class::FindVirtualMethodForSuper(ArtMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(!method->GetDeclaringClass()->IsInterface());
return GetSuperClass()->GetVTable()->Get(method->GetMethodIndex());
}
-inline AbstractMethod* Class::FindVirtualMethodForVirtualOrInterface(AbstractMethod* method) const {
+inline ArtMethod* Class::FindVirtualMethodForVirtualOrInterface(ArtMethod* method) const {
if (method->IsDirect()) {
return method;
}
@@ -263,26 +263,26 @@
SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, iftable_), new_iftable, false);
}
-inline ObjectArray<Field>* Class::GetIFields() const {
+inline ObjectArray<ArtField>* Class::GetIFields() const {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<Field>*>(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false);
+ return GetFieldObject<ObjectArray<ArtField>*>(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false);
}
-inline void Class::SetIFields(ObjectArray<Field>* new_ifields)
+inline void Class::SetIFields(ObjectArray<ArtField>* new_ifields)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(NULL == GetFieldObject<ObjectArray<Field>*>(
+ DCHECK(NULL == GetFieldObject<ObjectArray<ArtField>*>(
OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false));
SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), new_ifields, false);
}
-inline ObjectArray<Field>* Class::GetSFields() const {
+inline ObjectArray<ArtField>* Class::GetSFields() const {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<Field>*>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false);
+ return GetFieldObject<ObjectArray<ArtField>*>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false);
}
-inline void Class::SetSFields(ObjectArray<Field>* new_sfields)
+inline void Class::SetSFields(ObjectArray<ArtField>* new_sfields)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(NULL == GetFieldObject<ObjectArray<Field>*>(
+ DCHECK(NULL == GetFieldObject<ObjectArray<ArtField>*>(
OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false));
SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), new_sfields, false);
}
@@ -291,14 +291,14 @@
return (GetSFields() != NULL) ? GetSFields()->GetLength() : 0;
}
-inline Field* Class::GetStaticField(uint32_t i) const // TODO: uint16_t
+inline ArtField* Class::GetStaticField(uint32_t i) const // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return GetSFields()->Get(i);
}
-inline void Class::SetStaticField(uint32_t i, Field* f) // TODO: uint16_t
+inline void Class::SetStaticField(uint32_t i, ArtField* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<Field>* sfields= GetFieldObject<ObjectArray<Field>*>(
+ ObjectArray<ArtField>* sfields= GetFieldObject<ObjectArray<ArtField>*>(
OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false);
sfields->Set(i, f);
}
@@ -307,15 +307,15 @@
return (GetIFields() != NULL) ? GetIFields()->GetLength() : 0;
}
-inline Field* Class::GetInstanceField(uint32_t i) const // TODO: uint16_t
+inline ArtField* Class::GetInstanceField(uint32_t i) const // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK_NE(NumInstanceFields(), 0U);
return GetIFields()->Get(i);
}
-inline void Class::SetInstanceField(uint32_t i, Field* f) // TODO: uint16_t
+inline void Class::SetInstanceField(uint32_t i, ArtField* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<Field>* ifields= GetFieldObject<ObjectArray<Field>*>(
+ ObjectArray<ArtField>* ifields= GetFieldObject<ObjectArray<ArtField>*>(
OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false);
ifields->Set(i, f);
}
@@ -330,9 +330,8 @@
// circularity issue during loading the names of its members
DCHECK(IsLoaded() || IsErroneous() ||
this == String::GetJavaLangString() ||
- this == Field::GetJavaLangReflectField() ||
- this == AbstractMethod::GetConstructorClass() ||
- this == AbstractMethod::GetMethodClass());
+ this == ArtField::GetJavaLangReflectArtField() ||
+ this == ArtMethod::GetJavaLangReflectArtMethod());
return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false);
}
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index e490d97..29025f2 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -16,13 +16,13 @@
#include "class.h"
-#include "abstract_method-inl.h"
+#include "art_field-inl.h"
+#include "art_method-inl.h"
#include "class-inl.h"
#include "class_linker.h"
#include "class_loader.h"
#include "dex_cache.h"
#include "dex_file-inl.h"
-#include "field-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "object-inl.h"
#include "object_array-inl.h"
@@ -63,7 +63,7 @@
// Stash current exception.
Thread* self = Thread::Current();
SirtRef<mirror::Object> old_throw_this_object(self, NULL);
- SirtRef<mirror::AbstractMethod> old_throw_method(self, NULL);
+ SirtRef<mirror::ArtMethod> old_throw_method(self, NULL);
SirtRef<mirror::Throwable> old_exception(self, NULL);
uint32_t old_throw_dex_pc;
{
@@ -316,24 +316,23 @@
return WellKnownClasses::ToClass(WellKnownClasses::java_lang_Throwable)->IsAssignableFrom(this);
}
-bool Class::IsFieldClass() const {
+bool Class::IsArtFieldClass() const {
Class* java_lang_Class = GetClass();
- Class* java_lang_reflect_Field = java_lang_Class->GetInstanceField(0)->GetClass();
- return this == java_lang_reflect_Field;
+ Class* java_lang_reflect_ArtField = java_lang_Class->GetInstanceField(0)->GetClass();
+ return this == java_lang_reflect_ArtField;
}
-bool Class::IsMethodClass() const {
- return (this == AbstractMethod::GetMethodClass()) ||
- (this == AbstractMethod::GetConstructorClass());
+bool Class::IsArtMethodClass() const {
+ return this == ArtMethod::GetJavaLangReflectArtMethod();
}
void Class::SetClassLoader(ClassLoader* new_class_loader) {
SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, class_loader_), new_class_loader, false);
}
-AbstractMethod* Class::FindInterfaceMethod(const StringPiece& name, const StringPiece& signature) const {
+ArtMethod* Class::FindInterfaceMethod(const StringPiece& name, const StringPiece& signature) const {
// Check the current class before checking the interfaces.
- AbstractMethod* method = FindDeclaredVirtualMethod(name, signature);
+ ArtMethod* method = FindDeclaredVirtualMethod(name, signature);
if (method != NULL) {
return method;
}
@@ -349,9 +348,9 @@
return NULL;
}
-AbstractMethod* Class::FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
+ArtMethod* Class::FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
// Check the current class before checking the interfaces.
- AbstractMethod* method = FindDeclaredVirtualMethod(dex_cache, dex_method_idx);
+ ArtMethod* method = FindDeclaredVirtualMethod(dex_cache, dex_method_idx);
if (method != NULL) {
return method;
}
@@ -368,10 +367,10 @@
}
-AbstractMethod* Class::FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const {
+ArtMethod* Class::FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const {
MethodHelper mh;
for (size_t i = 0; i < NumDirectMethods(); ++i) {
- AbstractMethod* method = GetDirectMethod(i);
+ ArtMethod* method = GetDirectMethod(i);
mh.ChangeMethod(method);
if (name == mh.GetName() && signature == mh.GetSignature()) {
return method;
@@ -380,10 +379,10 @@
return NULL;
}
-AbstractMethod* Class::FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
+ArtMethod* Class::FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
if (GetDexCache() == dex_cache) {
for (size_t i = 0; i < NumDirectMethods(); ++i) {
- AbstractMethod* method = GetDirectMethod(i);
+ ArtMethod* method = GetDirectMethod(i);
if (method->GetDexMethodIndex() == dex_method_idx) {
return method;
}
@@ -392,9 +391,9 @@
return NULL;
}
-AbstractMethod* Class::FindDirectMethod(const StringPiece& name, const StringPiece& signature) const {
+ArtMethod* Class::FindDirectMethod(const StringPiece& name, const StringPiece& signature) const {
for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) {
- AbstractMethod* method = klass->FindDeclaredDirectMethod(name, signature);
+ ArtMethod* method = klass->FindDeclaredDirectMethod(name, signature);
if (method != NULL) {
return method;
}
@@ -402,9 +401,9 @@
return NULL;
}
-AbstractMethod* Class::FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
+ArtMethod* Class::FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) {
- AbstractMethod* method = klass->FindDeclaredDirectMethod(dex_cache, dex_method_idx);
+ ArtMethod* method = klass->FindDeclaredDirectMethod(dex_cache, dex_method_idx);
if (method != NULL) {
return method;
}
@@ -412,11 +411,11 @@
return NULL;
}
-AbstractMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name,
+ArtMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name,
const StringPiece& signature) const {
MethodHelper mh;
for (size_t i = 0; i < NumVirtualMethods(); ++i) {
- AbstractMethod* method = GetVirtualMethod(i);
+ ArtMethod* method = GetVirtualMethod(i);
mh.ChangeMethod(method);
if (name == mh.GetName() && signature == mh.GetSignature()) {
return method;
@@ -425,10 +424,10 @@
return NULL;
}
-AbstractMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
+ArtMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
if (GetDexCache() == dex_cache) {
for (size_t i = 0; i < NumVirtualMethods(); ++i) {
- AbstractMethod* method = GetVirtualMethod(i);
+ ArtMethod* method = GetVirtualMethod(i);
if (method->GetDexMethodIndex() == dex_method_idx) {
return method;
}
@@ -437,9 +436,9 @@
return NULL;
}
-AbstractMethod* Class::FindVirtualMethod(const StringPiece& name, const StringPiece& signature) const {
+ArtMethod* Class::FindVirtualMethod(const StringPiece& name, const StringPiece& signature) const {
for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) {
- AbstractMethod* method = klass->FindDeclaredVirtualMethod(name, signature);
+ ArtMethod* method = klass->FindDeclaredVirtualMethod(name, signature);
if (method != NULL) {
return method;
}
@@ -447,9 +446,9 @@
return NULL;
}
-AbstractMethod* Class::FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
+ArtMethod* Class::FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const {
for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) {
- AbstractMethod* method = klass->FindDeclaredVirtualMethod(dex_cache, dex_method_idx);
+ ArtMethod* method = klass->FindDeclaredVirtualMethod(dex_cache, dex_method_idx);
if (method != NULL) {
return method;
}
@@ -457,12 +456,12 @@
return NULL;
}
-Field* Class::FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type) {
+ArtField* Class::FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type) {
// Is the field in this class?
// Interfaces are not relevant because they can't contain instance fields.
FieldHelper fh;
for (size_t i = 0; i < NumInstanceFields(); ++i) {
- Field* f = GetInstanceField(i);
+ ArtField* f = GetInstanceField(i);
fh.ChangeField(f);
if (name == fh.GetName() && type == fh.GetTypeDescriptor()) {
return f;
@@ -471,10 +470,10 @@
return NULL;
}
-Field* Class::FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) {
+ArtField* Class::FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) {
if (GetDexCache() == dex_cache) {
for (size_t i = 0; i < NumInstanceFields(); ++i) {
- Field* f = GetInstanceField(i);
+ ArtField* f = GetInstanceField(i);
if (f->GetDexFieldIndex() == dex_field_idx) {
return f;
}
@@ -483,11 +482,11 @@
return NULL;
}
-Field* Class::FindInstanceField(const StringPiece& name, const StringPiece& type) {
+ArtField* Class::FindInstanceField(const StringPiece& name, const StringPiece& type) {
// Is the field in this class, or any of its superclasses?
// Interfaces are not relevant because they can't contain instance fields.
for (Class* c = this; c != NULL; c = c->GetSuperClass()) {
- Field* f = c->FindDeclaredInstanceField(name, type);
+ ArtField* f = c->FindDeclaredInstanceField(name, type);
if (f != NULL) {
return f;
}
@@ -495,11 +494,11 @@
return NULL;
}
-Field* Class::FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) {
+ArtField* Class::FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) {
// Is the field in this class, or any of its superclasses?
// Interfaces are not relevant because they can't contain instance fields.
for (Class* c = this; c != NULL; c = c->GetSuperClass()) {
- Field* f = c->FindDeclaredInstanceField(dex_cache, dex_field_idx);
+ ArtField* f = c->FindDeclaredInstanceField(dex_cache, dex_field_idx);
if (f != NULL) {
return f;
}
@@ -507,11 +506,11 @@
return NULL;
}
-Field* Class::FindDeclaredStaticField(const StringPiece& name, const StringPiece& type) {
+ArtField* Class::FindDeclaredStaticField(const StringPiece& name, const StringPiece& type) {
DCHECK(type != NULL);
FieldHelper fh;
for (size_t i = 0; i < NumStaticFields(); ++i) {
- Field* f = GetStaticField(i);
+ ArtField* f = GetStaticField(i);
fh.ChangeField(f);
if (name == fh.GetName() && type == fh.GetTypeDescriptor()) {
return f;
@@ -520,10 +519,10 @@
return NULL;
}
-Field* Class::FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) {
+ArtField* Class::FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) {
if (dex_cache == GetDexCache()) {
for (size_t i = 0; i < NumStaticFields(); ++i) {
- Field* f = GetStaticField(i);
+ ArtField* f = GetStaticField(i);
if (f->GetDexFieldIndex() == dex_field_idx) {
return f;
}
@@ -532,13 +531,13 @@
return NULL;
}
-Field* Class::FindStaticField(const StringPiece& name, const StringPiece& type) {
+ArtField* Class::FindStaticField(const StringPiece& name, const StringPiece& type) {
// Is the field in this class (or its interfaces), or any of its
// superclasses (or their interfaces)?
ClassHelper kh;
for (Class* k = this; k != NULL; k = k->GetSuperClass()) {
// Is the field in this class?
- Field* f = k->FindDeclaredStaticField(name, type);
+ ArtField* f = k->FindDeclaredStaticField(name, type);
if (f != NULL) {
return f;
}
@@ -555,11 +554,11 @@
return NULL;
}
-Field* Class::FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) {
+ArtField* Class::FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) {
ClassHelper kh;
for (Class* k = this; k != NULL; k = k->GetSuperClass()) {
// Is the field in this class?
- Field* f = k->FindDeclaredStaticField(dex_cache, dex_field_idx);
+ ArtField* f = k->FindDeclaredStaticField(dex_cache, dex_field_idx);
if (f != NULL) {
return f;
}
@@ -576,12 +575,12 @@
return NULL;
}
-Field* Class::FindField(const StringPiece& name, const StringPiece& type) {
+ArtField* Class::FindField(const StringPiece& name, const StringPiece& type) {
// Find a field using the JLS field resolution order
ClassHelper kh;
for (Class* k = this; k != NULL; k = k->GetSuperClass()) {
// Is the field in this class?
- Field* f = k->FindDeclaredInstanceField(name, type);
+ ArtField* f = k->FindDeclaredInstanceField(name, type);
if (f != NULL) {
return f;
}
@@ -602,11 +601,11 @@
return NULL;
}
-static void SetPreverifiedFlagOnMethods(mirror::ObjectArray<mirror::AbstractMethod>* methods)
+static void SetPreverifiedFlagOnMethods(mirror::ObjectArray<mirror::ArtMethod>* methods)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
if (methods != NULL) {
for (int32_t index = 0, end = methods->GetLength(); index < end; ++index) {
- mirror::AbstractMethod* method = methods->GetWithoutChecks(index);
+ mirror::ArtMethod* method = methods->GetWithoutChecks(index);
DCHECK(method != NULL);
method->SetPreverified();
}
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 1dd02c0..638b67f 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -63,9 +63,9 @@
namespace mirror {
+class ArtField;
class ClassLoader;
class DexCache;
-class Field;
class IfTable;
// Type for the InitializedStaticStorage table. Currently the Class
@@ -341,9 +341,9 @@
bool IsThrowableClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- bool IsFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ bool IsArtFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- bool IsMethodClass() const;
+ bool IsArtMethodClass() const;
Class* GetComponentType() const {
return GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), false);
@@ -502,42 +502,42 @@
void SetDexCache(DexCache* new_dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ObjectArray<AbstractMethod>* GetDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ ObjectArray<ArtMethod>* GetDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void SetDirectMethods(ObjectArray<AbstractMethod>* new_direct_methods)
+ void SetDirectMethods(ObjectArray<ArtMethod>* new_direct_methods)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* GetDirectMethod(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ ArtMethod* GetDirectMethod(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void SetDirectMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t
+ void SetDirectMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Returns the number of static, private, and constructor methods.
size_t NumDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ObjectArray<AbstractMethod>* GetVirtualMethods() const
+ ObjectArray<ArtMethod>* GetVirtualMethods() const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void SetVirtualMethods(ObjectArray<AbstractMethod>* new_virtual_methods)
+ void SetVirtualMethods(ObjectArray<ArtMethod>* new_virtual_methods)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Returns the number of non-inherited virtual methods.
size_t NumVirtualMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* GetVirtualMethod(uint32_t i) const
+ ArtMethod* GetVirtualMethod(uint32_t i) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* GetVirtualMethodDuringLinking(uint32_t i) const
+ ArtMethod* GetVirtualMethodDuringLinking(uint32_t i) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void SetVirtualMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t
+ void SetVirtualMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ObjectArray<AbstractMethod>* GetVTable() const;
+ ObjectArray<ArtMethod>* GetVTable() const;
- ObjectArray<AbstractMethod>* GetVTableDuringLinking() const;
+ ObjectArray<ArtMethod>* GetVTableDuringLinking() const;
- void SetVTable(ObjectArray<AbstractMethod>* new_vtable)
+ void SetVTable(ObjectArray<ArtMethod>* new_vtable)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static MemberOffset VTableOffset() {
@@ -546,51 +546,51 @@
// Given a method implemented by this class but potentially from a super class, return the
// specific implementation method for this class.
- AbstractMethod* FindVirtualMethodForVirtual(AbstractMethod* method) const
+ ArtMethod* FindVirtualMethodForVirtual(ArtMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Given a method implemented by this class' super class, return the specific implementation
// method for this class.
- AbstractMethod* FindVirtualMethodForSuper(AbstractMethod* method) const
+ ArtMethod* FindVirtualMethodForSuper(ArtMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Given a method implemented by this class, but potentially from a
// super class or interface, return the specific implementation
// method for this class.
- AbstractMethod* FindVirtualMethodForInterface(AbstractMethod* method) const
+ ArtMethod* FindVirtualMethodForInterface(ArtMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE;
- AbstractMethod* FindInterfaceMethod(const StringPiece& name, const StringPiece& descriptor) const
+ ArtMethod* FindInterfaceMethod(const StringPiece& name, const StringPiece& descriptor) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
+ ArtMethod* FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindVirtualMethodForVirtualOrInterface(AbstractMethod* method) const
+ ArtMethod* FindVirtualMethodForVirtualOrInterface(ArtMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature) const
+ ArtMethod* FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
+ ArtMethod* FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindVirtualMethod(const StringPiece& name, const StringPiece& descriptor) const
+ ArtMethod* FindVirtualMethod(const StringPiece& name, const StringPiece& descriptor) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
+ ArtMethod* FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const
+ ArtMethod* FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
+ ArtMethod* FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindDirectMethod(const StringPiece& name, const StringPiece& signature) const
+ ArtMethod* FindDirectMethod(const StringPiece& name, const StringPiece& signature) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- AbstractMethod* FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
+ ArtMethod* FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
int32_t GetIfTableCount() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -600,16 +600,16 @@
void SetIfTable(IfTable* new_iftable) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Get instance fields of the class (See also GetSFields).
- ObjectArray<Field>* GetIFields() const;
+ ObjectArray<ArtField>* GetIFields() const;
- void SetIFields(ObjectArray<Field>* new_ifields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void SetIFields(ObjectArray<ArtField>* new_ifields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
size_t NumInstanceFields() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- Field* GetInstanceField(uint32_t i) const // TODO: uint16_t
+ ArtField* GetInstanceField(uint32_t i) const // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void SetInstanceField(uint32_t i, Field* f) // TODO: uint16_t
+ void SetInstanceField(uint32_t i, ArtField* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Returns the number of instance fields containing reference types.
@@ -662,15 +662,15 @@
}
// Gets the static fields of the class.
- ObjectArray<Field>* GetSFields() const;
+ ObjectArray<ArtField>* GetSFields() const;
- void SetSFields(ObjectArray<Field>* new_sfields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void SetSFields(ObjectArray<ArtField>* new_sfields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
size_t NumStaticFields() const;
- Field* GetStaticField(uint32_t i) const; // TODO: uint16_t
+ ArtField* GetStaticField(uint32_t i) const; // TODO: uint16_t
- void SetStaticField(uint32_t i, Field* f); // TODO: uint16_t
+ void SetStaticField(uint32_t i, ArtField* f); // TODO: uint16_t
uint32_t GetReferenceStaticOffsets() const {
return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, reference_static_offsets_), false);
@@ -679,37 +679,37 @@
void SetReferenceStaticOffsets(uint32_t new_reference_offsets);
// Find a static or instance field using the JLS resolution order
- Field* FindField(const StringPiece& name, const StringPiece& type)
+ ArtField* FindField(const StringPiece& name, const StringPiece& type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Finds the given instance field in this class or a superclass.
- Field* FindInstanceField(const StringPiece& name, const StringPiece& type)
+ ArtField* FindInstanceField(const StringPiece& name, const StringPiece& type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Finds the given instance field in this class or a superclass, only searches classes that
// have the same dex cache.
- Field* FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx)
+ ArtField* FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- Field* FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type)
+ ArtField* FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- Field* FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx)
+ ArtField* FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Finds the given static field in this class or a superclass.
- Field* FindStaticField(const StringPiece& name, const StringPiece& type)
+ ArtField* FindStaticField(const StringPiece& name, const StringPiece& type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Finds the given static field in this class or superclass, only searches classes that
// have the same dex cache.
- Field* FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx)
+ ArtField* FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- Field* FindDeclaredStaticField(const StringPiece& name, const StringPiece& type)
+ ArtField* FindDeclaredStaticField(const StringPiece& name, const StringPiece& type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- Field* FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx)
+ ArtField* FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
pid_t GetClinitThreadId() const {
@@ -768,7 +768,7 @@
DexCache* dex_cache_;
// static, private, and <init> methods
- ObjectArray<AbstractMethod>* direct_methods_;
+ ObjectArray<ArtMethod>* direct_methods_;
// instance fields
//
@@ -780,7 +780,7 @@
// All instance fields that refer to objects are guaranteed to be at
// the beginning of the field list. num_reference_instance_fields_
// specifies the number of reference fields.
- ObjectArray<Field>* ifields_;
+ ObjectArray<ArtField>* ifields_;
// The interface table (iftable_) contains pairs of a interface class and an array of the
// interface methods. There is one pair per interface supported by this class. That means one
@@ -799,7 +799,7 @@
String* name_;
// Static fields
- ObjectArray<Field>* sfields_;
+ ObjectArray<ArtField>* sfields_;
// The superclass, or NULL if this is java.lang.Object, an interface or primitive type.
Class* super_class_;
@@ -808,13 +808,13 @@
Class* verify_error_class_;
// virtual methods defined in this class; invoked through vtable
- ObjectArray<AbstractMethod>* virtual_methods_;
+ ObjectArray<ArtMethod>* virtual_methods_;
// Virtual method table (vtable), for use by "invoke-virtual". The vtable from the superclass is
// copied in, and virtual methods from our class either replace those from the super or are
// appended. For abstract classes, methods may be created in the vtable that aren't in
// virtual_ methods_ for miranda methods.
- ObjectArray<AbstractMethod>* vtable_;
+ ObjectArray<ArtMethod>* vtable_;
// access flags; low 16 bits are defined by VM spec
uint32_t access_flags_;
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index 369dc49..da26be5 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -22,9 +22,9 @@
namespace art {
namespace mirror {
-inline AbstractMethod* DexCache::GetResolvedMethod(uint32_t method_idx) const
+inline ArtMethod* DexCache::GetResolvedMethod(uint32_t method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- AbstractMethod* method = GetResolvedMethods()->Get(method_idx);
+ ArtMethod* method = GetResolvedMethods()->Get(method_idx);
// Hide resolution trampoline methods from the caller
if (method != NULL && method->IsRuntimeMethod()) {
DCHECK(method == Runtime::Current()->GetResolutionMethod());
diff --git a/runtime/mirror/dex_cache.cc b/runtime/mirror/dex_cache.cc
index 239dc5e..00531e3 100644
--- a/runtime/mirror/dex_cache.cc
+++ b/runtime/mirror/dex_cache.cc
@@ -16,7 +16,7 @@
#include "dex_cache.h"
-#include "abstract_method-inl.h"
+#include "art_method-inl.h"
#include "base/logging.h"
#include "class_linker.h"
#include "gc/accounting/card_table-inl.h"
@@ -35,8 +35,8 @@
String* location,
ObjectArray<String>* strings,
ObjectArray<Class>* resolved_types,
- ObjectArray<AbstractMethod>* resolved_methods,
- ObjectArray<Field>* resolved_fields,
+ ObjectArray<ArtMethod>* resolved_methods,
+ ObjectArray<ArtField>* resolved_fields,
ObjectArray<StaticStorageBase>* initialized_static_storage) {
CHECK(dex_file != NULL);
CHECK(location != NULL);
@@ -58,7 +58,7 @@
Runtime* runtime = Runtime::Current();
if (runtime->HasResolutionMethod()) {
// Initialize the resolve methods array to contain trampolines for resolution.
- AbstractMethod* trampoline = runtime->GetResolutionMethod();
+ ArtMethod* trampoline = runtime->GetResolutionMethod();
size_t length = resolved_methods->GetLength();
for (size_t i = 0; i < length; i++) {
resolved_methods->SetWithoutChecks(i, trampoline);
@@ -66,10 +66,10 @@
}
}
-void DexCache::Fixup(AbstractMethod* trampoline) {
+void DexCache::Fixup(ArtMethod* trampoline) {
// Fixup the resolve methods array to contain trampoline for resolution.
CHECK(trampoline != NULL);
- ObjectArray<AbstractMethod>* resolved_methods = GetResolvedMethods();
+ ObjectArray<ArtMethod>* resolved_methods = GetResolvedMethods();
size_t length = resolved_methods->GetLength();
for (size_t i = 0; i < length; i++) {
if (resolved_methods->GetWithoutChecks(i) == NULL) {
diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h
index 9c0f09b..6cfab9e 100644
--- a/runtime/mirror/dex_cache.h
+++ b/runtime/mirror/dex_cache.h
@@ -17,7 +17,7 @@
#ifndef ART_RUNTIME_MIRROR_DEX_CACHE_H_
#define ART_RUNTIME_MIRROR_DEX_CACHE_H_
-#include "abstract_method.h"
+#include "art_method.h"
#include "class.h"
#include "object.h"
#include "object_array.h"
@@ -32,8 +32,8 @@
namespace mirror {
+class ArtField;
class Class;
-class Field;
class MANAGED DexCacheClass : public Class {
private:
@@ -46,12 +46,12 @@
String* location,
ObjectArray<String>* strings,
ObjectArray<Class>* types,
- ObjectArray<AbstractMethod>* methods,
- ObjectArray<Field>* fields,
+ ObjectArray<ArtMethod>* methods,
+ ObjectArray<ArtField>* fields,
ObjectArray<StaticStorageBase>* initialized_static_storage)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void Fixup(AbstractMethod* trampoline) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ void Fixup(ArtMethod* trampoline) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
String* GetLocation() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return GetFieldObject<String*>(OFFSET_OF_OBJECT_MEMBER(DexCache, location_), false);
@@ -110,20 +110,20 @@
GetResolvedTypes()->Set(type_idx, resolved);
}
- AbstractMethod* GetResolvedMethod(uint32_t method_idx) const
+ ArtMethod* GetResolvedMethod(uint32_t method_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void SetResolvedMethod(uint32_t method_idx, AbstractMethod* resolved)
+ void SetResolvedMethod(uint32_t method_idx, ArtMethod* resolved)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
GetResolvedMethods()->Set(method_idx, resolved);
}
- Field* GetResolvedField(uint32_t field_idx) const
+ ArtField* GetResolvedField(uint32_t field_idx) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return GetResolvedFields()->Get(field_idx);
}
- void SetResolvedField(uint32_t field_idx, Field* resolved)
+ void SetResolvedField(uint32_t field_idx, ArtField* resolved)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
GetResolvedFields()->Set(field_idx, resolved);
}
@@ -139,14 +139,14 @@
OFFSET_OF_OBJECT_MEMBER(DexCache, resolved_types_), false);
}
- ObjectArray<AbstractMethod>* GetResolvedMethods() const
+ ObjectArray<ArtMethod>* GetResolvedMethods() const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject< ObjectArray<AbstractMethod>* >(ResolvedMethodsOffset(), false);
+ return GetFieldObject< ObjectArray<ArtMethod>* >(ResolvedMethodsOffset(), false);
}
- ObjectArray<Field>* GetResolvedFields() const
+ ObjectArray<ArtField>* GetResolvedFields() const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject< ObjectArray<Field>* >(ResolvedFieldsOffset(), false);
+ return GetFieldObject< ObjectArray<ArtField>* >(ResolvedFieldsOffset(), false);
}
ObjectArray<StaticStorageBase>* GetInitializedStaticStorage() const
@@ -166,8 +166,8 @@
private:
ObjectArray<StaticStorageBase>* initialized_static_storage_;
String* location_;
- ObjectArray<Object>* resolved_fields_;
- ObjectArray<AbstractMethod>* resolved_methods_;
+ ObjectArray<ArtField>* resolved_fields_;
+ ObjectArray<ArtMethod>* resolved_methods_;
ObjectArray<Class>* resolved_types_;
ObjectArray<String>* strings_;
uint32_t dex_file_;
diff --git a/runtime/mirror/iftable.h b/runtime/mirror/iftable.h
index aea8fdd..421893d 100644
--- a/runtime/mirror/iftable.h
+++ b/runtime/mirror/iftable.h
@@ -32,24 +32,24 @@
void SetInterface(int32_t i, Class* interface) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- ObjectArray<AbstractMethod>* GetMethodArray(int32_t i) const
+ ObjectArray<ArtMethod>* GetMethodArray(int32_t i) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<AbstractMethod>* method_array =
- down_cast<ObjectArray<AbstractMethod>*>(Get((i * kMax) + kMethodArray));
+ ObjectArray<ArtMethod>* method_array =
+ down_cast<ObjectArray<ArtMethod>*>(Get((i * kMax) + kMethodArray));
DCHECK(method_array != NULL);
return method_array;
}
size_t GetMethodArrayCount(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<AbstractMethod>* method_array =
- down_cast<ObjectArray<AbstractMethod>*>(Get((i * kMax) + kMethodArray));
+ ObjectArray<ArtMethod>* method_array =
+ down_cast<ObjectArray<ArtMethod>*>(Get((i * kMax) + kMethodArray));
if (method_array == NULL) {
return 0;
}
return method_array->GetLength();
}
- void SetMethodArray(int32_t i, ObjectArray<AbstractMethod>* new_ma)
+ void SetMethodArray(int32_t i, ObjectArray<ArtMethod>* new_ma)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(new_ma != NULL);
DCHECK(Get((i * kMax) + kMethodArray) == NULL);
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index 5818a80..63396d2 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -19,10 +19,10 @@
#include "object.h"
-#include "abstract_method.h"
+#include "art_field.h"
+#include "art_method.h"
#include "atomic.h"
#include "array-inl.h"
-#include "field.h"
#include "class.h"
#include "monitor.h"
#include "runtime.h"
@@ -112,32 +112,32 @@
return GetClass()->IsArrayClass();
}
-inline bool Object::IsField() const {
- return GetClass()->IsFieldClass();
+inline bool Object::IsArtField() const {
+ return GetClass()->IsArtFieldClass();
}
-inline Field* Object::AsField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(IsField());
- return down_cast<Field*>(this);
+inline ArtField* Object::AsArtField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ DCHECK(IsArtField());
+ return down_cast<ArtField*>(this);
}
-inline const Field* Object::AsField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(IsField());
- return down_cast<const Field*>(this);
+inline const ArtField* Object::AsArtField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ DCHECK(IsArtField());
+ return down_cast<const ArtField*>(this);
}
-inline bool Object::IsMethod() const {
- return GetClass()->IsMethodClass();
+inline bool Object::IsArtMethod() const {
+ return GetClass()->IsArtMethodClass();
}
-inline AbstractMethod* Object::AsMethod() {
- DCHECK(IsMethod());
- return down_cast<AbstractMethod*>(this);
+inline ArtMethod* Object::AsArtMethod() {
+ DCHECK(IsArtMethod());
+ return down_cast<ArtMethod*>(this);
}
-inline const AbstractMethod* Object::AsMethod() const {
- DCHECK(IsMethod());
- return down_cast<const AbstractMethod*>(this);
+inline const ArtMethod* Object::AsArtMethod() const {
+ DCHECK(IsArtMethod());
+ return down_cast<const ArtMethod*>(this);
}
inline bool Object::IsReferenceInstance() const {
@@ -227,8 +227,8 @@
} else {
result = GetClass()->GetObjectSize();
}
- DCHECK(!IsField() || result == sizeof(Field));
- DCHECK(!IsMethod() || result == sizeof(AbstractMethod));
+ DCHECK(!IsArtField() || result == sizeof(ArtField));
+ DCHECK(!IsArtMethod() || result == sizeof(ArtMethod));
return result;
}
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index b2d6e71..92c05b2 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -16,12 +16,12 @@
#include "object.h"
+#include "art_field.h"
+#include "art_field-inl.h"
#include "array-inl.h"
#include "class.h"
#include "class-inl.h"
#include "class_linker-inl.h"
-#include "field.h"
-#include "field-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
#include "iftable-inl.h"
@@ -67,7 +67,7 @@
for (const Class* klass = c; klass != NULL; klass = klass->GetSuperClass()) {
size_t num_reference_fields = klass->NumReferenceInstanceFields();
for (size_t i = 0; i < num_reference_fields; ++i) {
- Field* field = klass->GetInstanceField(i);
+ ArtField* field = klass->GetInstanceField(i);
MemberOffset field_offset = field->GetOffset();
const Object* ref = copy->GetFieldObject<const Object*>(field_offset, false);
heap->WriteBarrierField(copy.get(), field_offset, ref);
@@ -90,11 +90,11 @@
return;
}
for (const Class* cur = c; cur != NULL; cur = cur->GetSuperClass()) {
- ObjectArray<Field>* fields = cur->GetIFields();
+ ObjectArray<ArtField>* fields = cur->GetIFields();
if (fields != NULL) {
size_t num_ref_ifields = cur->NumReferenceInstanceFields();
for (size_t i = 0; i < num_ref_ifields; ++i) {
- Field* field = fields->Get(i);
+ ArtField* field = fields->Get(i);
if (field->GetOffset().Int32Value() == field_offset.Int32Value()) {
FieldHelper fh(field);
CHECK(fh.GetType()->IsAssignableFrom(new_value->GetClass()));
@@ -108,11 +108,11 @@
return;
}
if (IsClass()) {
- ObjectArray<Field>* fields = AsClass()->GetSFields();
+ ObjectArray<ArtField>* fields = AsClass()->GetSFields();
if (fields != NULL) {
size_t num_ref_sfields = AsClass()->NumReferenceStaticFields();
for (size_t i = 0; i < num_ref_sfields; ++i) {
- Field* field = fields->Get(i);
+ ArtField* field = fields->Get(i);
if (field->GetOffset().Int32Value() == field_offset.Int32Value()) {
FieldHelper fh(field);
CHECK(fh.GetType()->IsAssignableFrom(new_value->GetClass()));
diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h
index a40c906..28a91dd 100644
--- a/runtime/mirror/object.h
+++ b/runtime/mirror/object.h
@@ -31,10 +31,10 @@
namespace mirror {
-class AbstractMethod;
+class ArtField;
+class ArtMethod;
class Array;
class Class;
-class Field;
template<class T> class ObjectArray;
template<class T> class PrimitiveArray;
typedef PrimitiveArray<uint8_t> BooleanArray;
@@ -144,17 +144,17 @@
Throwable* AsThrowable() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- bool IsMethod() const;
+ bool IsArtMethod() const;
- AbstractMethod* AsMethod();
+ ArtMethod* AsArtMethod();
- const AbstractMethod* AsMethod() const;
+ const ArtMethod* AsArtMethod() const;
- bool IsField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ bool IsArtField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- Field* AsField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ ArtField* AsArtField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- const Field* AsField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ const ArtField* AsArtField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool IsReferenceInstance() const;
diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h
index 8675c31..6f22618 100644
--- a/runtime/mirror/object_array-inl.h
+++ b/runtime/mirror/object_array-inl.h
@@ -20,8 +20,8 @@
#include "object_array.h"
#include "gc/heap.h"
+#include "mirror/art_field.h"
#include "mirror/class.h"
-#include "mirror/field.h"
#include "runtime.h"
#include "thread.h"
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 540ff9f..814305c 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -20,6 +20,7 @@
#include <stdio.h>
#include "array-inl.h"
+#include "art_field-inl.h"
#include "asm_support.h"
#include "class-inl.h"
#include "class_linker.h"
@@ -27,11 +28,10 @@
#include "common_test.h"
#include "dex_file.h"
#include "entrypoints/entrypoint_utils.h"
-#include "field-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
#include "iftable-inl.h"
-#include "abstract_method-inl.h"
+#include "art_method-inl.h"
#include "object-inl.h"
#include "object_array-inl.h"
#include "sirt_ref.h"
@@ -75,7 +75,7 @@
ASSERT_EQ(STRING_OFFSET_OFFSET, String::OffsetOffset().Int32Value());
ASSERT_EQ(STRING_DATA_OFFSET, Array::DataOffset(sizeof(uint16_t)).Int32Value());
- ASSERT_EQ(METHOD_CODE_OFFSET, AbstractMethod::EntryPointFromCompiledCodeOffset().Int32Value());
+ ASSERT_EQ(METHOD_CODE_OFFSET, ArtMethod::EntryPointFromCompiledCodeOffset().Int32Value());
}
TEST_F(ObjectTest, IsInSamePackage) {
@@ -204,7 +204,7 @@
// pretend we are trying to call 'new char[3]' from String.toCharArray
ScopedObjectAccess soa(Thread::Current());
Class* java_util_Arrays = class_linker_->FindSystemClass("Ljava/util/Arrays;");
- AbstractMethod* sort = java_util_Arrays->FindDirectMethod("sort", "([I)V");
+ ArtMethod* sort = java_util_Arrays->FindDirectMethod("sort", "([I)V");
const DexFile::StringId* string_id = java_lang_dex_file_->FindStringId("[I");
ASSERT_TRUE(string_id != NULL);
const DexFile::TypeId* type_id = java_lang_dex_file_->FindTypeId(
@@ -261,7 +261,7 @@
Class* klass =
class_linker_->FindClass("LStaticsFromCode;", soa.Decode<ClassLoader*>(class_loader));
- AbstractMethod* clinit = klass->FindDirectMethod("<clinit>", "()V");
+ ArtMethod* clinit = klass->FindDirectMethod("<clinit>", "()V");
const DexFile::StringId* klass_string_id = dex_file->FindStringId("LStaticsFromCode;");
ASSERT_TRUE(klass_string_id != NULL);
const DexFile::TypeId* klass_type_id = dex_file->FindTypeId(
@@ -282,8 +282,8 @@
ASSERT_TRUE(field_id != NULL);
uint32_t field_idx = dex_file->GetIndexForFieldId(*field_id);
- Field* field = FindFieldFromCode(field_idx, clinit, Thread::Current(), StaticObjectRead,
- sizeof(Object*), true);
+ ArtField* field = FindFieldFromCode(field_idx, clinit, Thread::Current(), StaticObjectRead,
+ sizeof(Object*), true);
Object* s0 = field->GetObj(klass);
EXPECT_TRUE(s0 != NULL);
@@ -294,7 +294,7 @@
field->SetObj(field->GetDeclaringClass(), NULL);
EXPECT_EQ(NULL, field->GetObj(klass));
- // TODO: more exhaustive tests of all 6 cases of Field::*FromCode
+ // TODO: more exhaustive tests of all 6 cases of ArtField::*FromCode
}
TEST_F(ObjectTest, String) {
@@ -395,29 +395,29 @@
Class* klass2 = linker->FindClass("LProtoCompare2;", class_loader_2.get());
ASSERT_TRUE(klass2 != NULL);
- AbstractMethod* m1_1 = klass1->GetVirtualMethod(0);
+ ArtMethod* m1_1 = klass1->GetVirtualMethod(0);
MethodHelper mh(m1_1);
EXPECT_STREQ(mh.GetName(), "m1");
- AbstractMethod* m2_1 = klass1->GetVirtualMethod(1);
+ ArtMethod* m2_1 = klass1->GetVirtualMethod(1);
mh.ChangeMethod(m2_1);
EXPECT_STREQ(mh.GetName(), "m2");
- AbstractMethod* m3_1 = klass1->GetVirtualMethod(2);
+ ArtMethod* m3_1 = klass1->GetVirtualMethod(2);
mh.ChangeMethod(m3_1);
EXPECT_STREQ(mh.GetName(), "m3");
- AbstractMethod* m4_1 = klass1->GetVirtualMethod(3);
+ ArtMethod* m4_1 = klass1->GetVirtualMethod(3);
mh.ChangeMethod(m4_1);
EXPECT_STREQ(mh.GetName(), "m4");
- AbstractMethod* m1_2 = klass2->GetVirtualMethod(0);
+ ArtMethod* m1_2 = klass2->GetVirtualMethod(0);
mh.ChangeMethod(m1_2);
EXPECT_STREQ(mh.GetName(), "m1");
- AbstractMethod* m2_2 = klass2->GetVirtualMethod(1);
+ ArtMethod* m2_2 = klass2->GetVirtualMethod(1);
mh.ChangeMethod(m2_2);
EXPECT_STREQ(mh.GetName(), "m2");
- AbstractMethod* m3_2 = klass2->GetVirtualMethod(2);
+ ArtMethod* m3_2 = klass2->GetVirtualMethod(2);
mh.ChangeMethod(m3_2);
EXPECT_STREQ(mh.GetName(), "m3");
- AbstractMethod* m4_2 = klass2->GetVirtualMethod(3);
+ ArtMethod* m4_2 = klass2->GetVirtualMethod(3);
mh.ChangeMethod(m4_2);
EXPECT_STREQ(mh.GetName(), "m4");
@@ -593,8 +593,8 @@
EXPECT_TRUE(c->FindInstanceField("Count", "I") == NULL);
// Right name and type.
- Field* f1 = c->FindDeclaredInstanceField("count", "I");
- Field* f2 = c->FindInstanceField("count", "I");
+ ArtField* f1 = c->FindDeclaredInstanceField("count", "I");
+ ArtField* f2 = c->FindInstanceField("count", "I");
EXPECT_TRUE(f1 != NULL);
EXPECT_TRUE(f2 != NULL);
EXPECT_EQ(f1, f2);
@@ -626,8 +626,8 @@
EXPECT_TRUE(c->FindStaticField("cASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;") == NULL);
// Right name and type.
- Field* f1 = c->FindDeclaredStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;");
- Field* f2 = c->FindStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;");
+ ArtField* f1 = c->FindDeclaredStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;");
+ ArtField* f2 = c->FindStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;");
EXPECT_TRUE(f1 != NULL);
EXPECT_TRUE(f2 != NULL);
EXPECT_EQ(f1, f2);
diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc
index 78b76dc..961f6de 100644
--- a/runtime/mirror/throwable.cc
+++ b/runtime/mirror/throwable.cc
@@ -16,7 +16,7 @@
#include "throwable.h"
-#include "abstract_method-inl.h"
+#include "art_method-inl.h"
#include "class-inl.h"
#include "dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
@@ -65,7 +65,7 @@
IntArray* pc_trace = down_cast<IntArray*>(method_trace->Get(depth));
MethodHelper mh;
for (int32_t i = 0; i < depth; ++i) {
- AbstractMethod* method = down_cast<AbstractMethod*>(method_trace->Get(i));
+ ArtMethod* method = down_cast<ArtMethod*>(method_trace->Get(i));
mh.ChangeMethod(method);
uint32_t dex_pc = pc_trace->Get(i);
int32_t line_number = mh.GetLineNumFromDexPC(dex_pc);