diff options
| author | 2014-05-07 15:43:14 -0700 | |
|---|---|---|
| committer | 2014-05-13 14:45:54 -0700 | |
| commit | eb8167a4f4d27fce0530f6724ab8032610cd146b (patch) | |
| tree | bcfeaf13ad78f2dd68466bbd0e20c71944f7e854 /compiler/dex/mir_method_info.cc | |
| parent | 6fb66a2bc4e1c0b7931101153e58714991237af7 (diff) | |
Add Handle/HandleScope and delete SirtRef.
Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.
Renamed StackIndirectReferenceTable to HandleScope.
Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.
Renamed Handle::get -> Get.
Bug: 8473721
Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
Diffstat (limited to 'compiler/dex/mir_method_info.cc')
| -rw-r--r-- | compiler/dex/mir_method_info.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/compiler/dex/mir_method_info.cc b/compiler/dex/mir_method_info.cc index 2c33ef18f5..cc2bd953d8 100644 --- a/compiler/dex/mir_method_info.cc +++ b/compiler/dex/mir_method_info.cc @@ -19,10 +19,10 @@ #include "driver/compiler_driver.h" #include "driver/dex_compilation_unit.h" #include "driver/compiler_driver-inl.h" -#include "mirror/class_loader.h" // Only to allow casts in SirtRef<ClassLoader>. -#include "mirror/dex_cache.h" // Only to allow casts in SirtRef<DexCache>. +#include "mirror/class_loader.h" // Only to allow casts in Handle<ClassLoader>. +#include "mirror/dex_cache.h" // Only to allow casts in Handle<DexCache>. #include "scoped_thread_state_change.h" -#include "sirt_ref.h" +#include "handle_scope-inl.h" namespace art { @@ -45,11 +45,12 @@ void MirMethodLoweringInfo::Resolve(CompilerDriver* compiler_driver, // We're going to resolve methods and check access in a tight loop. It's better to hold // the lock and needed references once than re-acquiring them again and again. ScopedObjectAccess soa(Thread::Current()); - SirtRef<mirror::DexCache> dex_cache(soa.Self(), compiler_driver->GetDexCache(mUnit)); - SirtRef<mirror::ClassLoader> class_loader(soa.Self(), - compiler_driver->GetClassLoader(soa, mUnit)); - SirtRef<mirror::Class> referrer_class(soa.Self(), - compiler_driver->ResolveCompilingMethodsClass(soa, dex_cache, class_loader, mUnit)); + StackHandleScope<3> hs(soa.Self()); + Handle<mirror::DexCache> dex_cache(hs.NewHandle(compiler_driver->GetDexCache(mUnit))); + Handle<mirror::ClassLoader> class_loader( + hs.NewHandle(compiler_driver->GetClassLoader(soa, mUnit))); + Handle<mirror::Class> referrer_class(hs.NewHandle( + compiler_driver->ResolveCompilingMethodsClass(soa, dex_cache, class_loader, mUnit))); // Even if the referrer class is unresolved (i.e. we're compiling a method without class // definition) we still want to resolve methods and record all available info. @@ -73,10 +74,10 @@ void MirMethodLoweringInfo::Resolve(CompilerDriver* compiler_driver, MethodReference target_method(mUnit->GetDexFile(), it->MethodIndex()); int fast_path_flags = compiler_driver->IsFastInvoke( - soa, dex_cache, class_loader, mUnit, referrer_class.get(), resolved_method, &invoke_type, + soa, dex_cache, class_loader, mUnit, referrer_class.Get(), resolved_method, &invoke_type, &target_method, devirt_target, &it->direct_code_, &it->direct_method_); bool needs_clinit = - compiler_driver->NeedsClassInitialization(referrer_class.get(), resolved_method); + compiler_driver->NeedsClassInitialization(referrer_class.Get(), resolved_method); uint16_t other_flags = it->flags_ & ~(kFlagFastPath | kFlagNeedsClassInitialization | (kInvokeTypeMask << kBitSharpTypeBegin)); it->flags_ = other_flags | |