summaryrefslogtreecommitdiffstats
path: root/compiler/driver
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-07-30 01:26:50 -0700
committerIan Rogers <irogers@google.com>2013-08-13 18:09:46 -0700
commitea46f950e7a51585db293cd7f047de190a482414 (patch)
tree9dddc8073547a2dcb58a19e1728932a89cb149c3 /compiler/driver
parent5e3572709b5a5d59957f835db4f73760ecef08da (diff)
downloadart-ea46f950e7a51585db293cd7f047de190a482414.zip
art-ea46f950e7a51585db293cd7f047de190a482414.tar.gz
art-ea46f950e7a51585db293cd7f047de190a482414.tar.bz2
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
Diffstat (limited to 'compiler/driver')
-rw-r--r--compiler/driver/compiler_driver.cc34
-rw-r--r--compiler/driver/compiler_driver.h6
-rw-r--r--compiler/driver/compiler_driver_test.cc6
3 files changed, 23 insertions, 23 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 144271d..82f51f2 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -33,11 +33,11 @@
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap.h"
#include "gc/space/space.h"
+#include "mirror/art_field-inl.h"
+#include "mirror/art_method-inl.h"
#include "mirror/class_loader.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
-#include "mirror/field-inl.h"
-#include "mirror/abstract_method-inl.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/throwable.h"
@@ -515,7 +515,7 @@ static DexToDexCompilationLevel GetDexToDexCompilationlevel(mirror::ClassLoader*
}
}
-void CompilerDriver::CompileOne(const mirror::AbstractMethod* method, base::TimingLogger& timings) {
+void CompilerDriver::CompileOne(const mirror::ArtMethod* method, base::TimingLogger& timings) {
DCHECK(!Runtime::Current()->IsStarted());
Thread* self = Thread::Current();
jobject jclass_loader;
@@ -632,12 +632,12 @@ static bool ResolveCatchBlockExceptionsClassVisitor(mirror::Class* c, void* arg)
reinterpret_cast<std::set<std::pair<uint16_t, const DexFile*> >*>(arg);
MethodHelper mh;
for (size_t i = 0; i < c->NumVirtualMethods(); ++i) {
- mirror::AbstractMethod* m = c->GetVirtualMethod(i);
+ mirror::ArtMethod* m = c->GetVirtualMethod(i);
mh.ChangeMethod(m);
ResolveExceptionsForMethod(&mh, *exceptions_to_resolve);
}
for (size_t i = 0; i < c->NumDirectMethods(); ++i) {
- mirror::AbstractMethod* m = c->GetDirectMethod(i);
+ mirror::ArtMethod* m = c->GetDirectMethod(i);
mh.ChangeMethod(m);
ResolveExceptionsForMethod(&mh, *exceptions_to_resolve);
}
@@ -895,7 +895,7 @@ static mirror::Class* ComputeCompilingMethodsClass(ScopedObjectAccess& soa,
dex_cache, class_loader);
}
-static mirror::Field* ComputeFieldReferencedFromCompilingMethod(ScopedObjectAccess& soa,
+static mirror::ArtField* ComputeFieldReferencedFromCompilingMethod(ScopedObjectAccess& soa,
const DexCompilationUnit* mUnit,
uint32_t field_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -905,7 +905,7 @@ static mirror::Field* ComputeFieldReferencedFromCompilingMethod(ScopedObjectAcce
class_loader, false);
}
-static mirror::AbstractMethod* ComputeMethodReferencedFromCompilingMethod(ScopedObjectAccess& soa,
+static mirror::ArtMethod* ComputeMethodReferencedFromCompilingMethod(ScopedObjectAccess& soa,
const DexCompilationUnit* mUnit,
uint32_t method_idx,
InvokeType type)
@@ -923,7 +923,7 @@ bool CompilerDriver::ComputeInstanceFieldInfo(uint32_t field_idx, const DexCompi
field_offset = -1;
is_volatile = true;
// Try to resolve field and ignore if an Incompatible Class Change Error (ie is static).
- mirror::Field* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx);
+ mirror::ArtField* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx);
if (resolved_field != NULL && !resolved_field->IsStatic()) {
mirror::Class* referrer_class =
ComputeCompilingMethodsClass(soa, resolved_field->GetDeclaringClass()->GetDexCache(),
@@ -974,7 +974,7 @@ bool CompilerDriver::ComputeStaticFieldInfo(uint32_t field_idx, const DexCompila
is_referrers_class = false;
is_volatile = true;
// Try to resolve field and ignore if an Incompatible Class Change Error (ie isn't static).
- mirror::Field* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx);
+ mirror::ArtField* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx);
if (resolved_field != NULL && resolved_field->IsStatic()) {
mirror::Class* referrer_class =
ComputeCompilingMethodsClass(soa, resolved_field->GetDeclaringClass()->GetDexCache(),
@@ -1051,7 +1051,7 @@ bool CompilerDriver::ComputeStaticFieldInfo(uint32_t field_idx, const DexCompila
void CompilerDriver::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type,
mirror::Class* referrer_class,
- mirror::AbstractMethod* method,
+ mirror::ArtMethod* method,
uintptr_t& direct_code,
uintptr_t& direct_method,
bool update_stats) {
@@ -1114,7 +1114,7 @@ bool CompilerDriver::ComputeInvokeInfo(const DexCompilationUnit* mUnit, const ui
vtable_idx = -1;
direct_code = 0;
direct_method = 0;
- mirror::AbstractMethod* resolved_method =
+ mirror::ArtMethod* resolved_method =
ComputeMethodReferencedFromCompilingMethod(soa, mUnit, target_method.dex_method_index,
invoke_type);
if (resolved_method != NULL) {
@@ -1179,7 +1179,7 @@ bool CompilerDriver::ComputeInvokeInfo(const DexCompilationUnit* mUnit, const ui
mUnit->GetClassLinker()->FindDexCache(*devirt_map_target->dex_file);
mirror::ClassLoader* class_loader =
soa.Decode<mirror::ClassLoader*>(mUnit->GetClassLoader());
- mirror::AbstractMethod* called_method =
+ mirror::ArtMethod* called_method =
mUnit->GetClassLinker()->ResolveMethod(*devirt_map_target->dex_file,
devirt_map_target->dex_method_index,
target_dex_cache, class_loader, NULL,
@@ -1471,7 +1471,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag
mirror::DexCache* dex_cache = class_linker->FindDexCache(dex_file);
ClassDataItemIterator it(dex_file, class_data);
while (it.HasNextStaticField()) {
- mirror::Field* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache,
+ mirror::ArtField* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache,
class_loader, true);
if (field == NULL) {
CHECK(self->IsExceptionPending());
@@ -1487,7 +1487,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag
requires_constructor_barrier = true;
}
- mirror::Field* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache,
+ mirror::ArtField* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache,
class_loader, false);
if (field == NULL) {
CHECK(self->IsExceptionPending());
@@ -1500,7 +1500,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag
class_def_index);
}
while (it.HasNextDirectMethod()) {
- mirror::AbstractMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(),
+ mirror::ArtMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(),
dex_cache, class_loader, NULL,
it.GetMethodInvokeType(class_def));
if (method == NULL) {
@@ -1510,7 +1510,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag
it.Next();
}
while (it.HasNextVirtualMethod()) {
- mirror::AbstractMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(),
+ mirror::ArtMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(),
dex_cache, class_loader, NULL,
it.GetMethodInvokeType(class_def));
if (method == NULL) {
@@ -2073,7 +2073,7 @@ static void InitializeClass(const ParallelCompilationManager* manager, size_t cl
LOG(INFO) << "Initializing: " << descriptor;
if (StringPiece(descriptor) == "Ljava/lang/Void;") {
// Hand initialize j.l.Void to avoid Dex file operations in un-started runtime.
- mirror::ObjectArray<mirror::Field>* fields = klass->GetSFields();
+ mirror::ObjectArray<mirror::ArtField>* fields = klass->GetSFields();
CHECK_EQ(fields->GetLength(), 1);
fields->Get(0)->SetObj(klass, manager->GetClassLinker()->FindPrimitiveClass('V'));
klass->SetStatus(mirror::Class::kStatusInitialized);
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index b5222c9..21a44ea 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -99,7 +99,7 @@ class CompilerDriver {
LOCKS_EXCLUDED(Locks::mutator_lock_);
// Compile a single Method
- void CompileOne(const mirror::AbstractMethod* method, base::TimingLogger& timings)
+ void CompileOne(const mirror::ArtMethod* method, base::TimingLogger& timings)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
InstructionSet GetInstructionSet() const {
@@ -301,7 +301,7 @@ class CompilerDriver {
// Compute constant code and method pointers when possible
void GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type,
mirror::Class* referrer_class,
- mirror::AbstractMethod* method,
+ mirror::ArtMethod* method,
uintptr_t& direct_code, uintptr_t& direct_method,
bool update_stats)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -425,7 +425,7 @@ class CompilerDriver {
CompilerEnableAutoElfLoadingFn compiler_enable_auto_elf_loading_;
typedef const void* (*CompilerGetMethodCodeAddrFn)
- (const CompilerDriver& driver, const CompiledMethod* cm, const mirror::AbstractMethod* method);
+ (const CompilerDriver& driver, const CompiledMethod* cm, const mirror::ArtMethod* method);
CompilerGetMethodCodeAddrFn compiler_get_method_code_addr_;
bool support_boot_image_fixup_;
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index 8ee9cf6..c6687bb 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -24,10 +24,10 @@
#include "common_test.h"
#include "dex_file.h"
#include "gc/heap.h"
+#include "mirror/art_method-inl.h"
#include "mirror/class.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
-#include "mirror/abstract_method-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
@@ -115,7 +115,7 @@ TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) {
}
EXPECT_EQ(dex->NumMethodIds(), dex_cache->NumResolvedMethods());
for (size_t i = 0; i < dex_cache->NumResolvedMethods(); i++) {
- mirror::AbstractMethod* method = dex_cache->GetResolvedMethod(i);
+ mirror::ArtMethod* method = dex_cache->GetResolvedMethod(i);
EXPECT_TRUE(method != NULL) << "method_idx=" << i
<< " " << dex->GetMethodDeclaringClassDescriptor(dex->GetMethodId(i))
<< " " << dex->GetMethodName(dex->GetMethodId(i));
@@ -126,7 +126,7 @@ TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) {
}
EXPECT_EQ(dex->NumFieldIds(), dex_cache->NumResolvedFields());
for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) {
- mirror::Field* field = dex_cache->GetResolvedField(i);
+ mirror::ArtField* field = dex_cache->GetResolvedField(i);
EXPECT_TRUE(field != NULL) << "field_idx=" << i
<< " " << dex->GetFieldDeclaringClassDescriptor(dex->GetFieldId(i))
<< " " << dex->GetFieldName(dex->GetFieldId(i));