diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-02-13 18:02:13 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-02-18 10:45:12 -0800 |
commit | 815873ecc312b1d231acce71e1a16f42cdaf09f2 (patch) | |
tree | 18ba2fa951775e60b240271bfe975e6e2cfc654c /runtime/runtime.cc | |
parent | 2befd09cf4fe89a18a655f3e1dd310831bfa769f (diff) | |
download | art-815873ecc312b1d231acce71e1a16f42cdaf09f2.zip art-815873ecc312b1d231acce71e1a16f42cdaf09f2.tar.gz art-815873ecc312b1d231acce71e1a16f42cdaf09f2.tar.bz2 |
Change root visitor to use Object**.
Simplifies code and improves the performance of root visiting since
we usually don't need to check to see if the object moved.
Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index e1b0ed4..e66e5af 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1333,26 +1333,23 @@ void Runtime::VisitNonThreadRoots(RootCallback* callback, void* arg) { mirror::PrimitiveArray<int16_t>::VisitRoots(callback, arg); // ShortArray java_vm_->VisitRoots(callback, arg); if (pre_allocated_OutOfMemoryError_ != nullptr) { - pre_allocated_OutOfMemoryError_ = down_cast<mirror::Throwable*>( - callback(pre_allocated_OutOfMemoryError_, arg, 0, kRootVMInternal)); + callback(reinterpret_cast<mirror::Object**>(&pre_allocated_OutOfMemoryError_), arg, 0, + kRootVMInternal); DCHECK(pre_allocated_OutOfMemoryError_ != nullptr); } - resolution_method_ = down_cast<mirror::ArtMethod*>(callback(resolution_method_, arg, 0, - kRootVMInternal)); + callback(reinterpret_cast<mirror::Object**>(&resolution_method_), arg, 0, kRootVMInternal); DCHECK(resolution_method_ != nullptr); if (HasImtConflictMethod()) { - imt_conflict_method_ = down_cast<mirror::ArtMethod*>(callback(imt_conflict_method_, arg, 0, - kRootVMInternal)); + callback(reinterpret_cast<mirror::Object**>(&imt_conflict_method_), arg, 0, kRootVMInternal); } if (HasDefaultImt()) { - default_imt_ = down_cast<mirror::ObjectArray<mirror::ArtMethod>*>(callback(default_imt_, arg, - 0, kRootVMInternal)); + callback(reinterpret_cast<mirror::Object**>(&default_imt_), arg, 0, kRootVMInternal); } for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) { if (callee_save_methods_[i] != nullptr) { - callee_save_methods_[i] = down_cast<mirror::ArtMethod*>( - callback(callee_save_methods_[i], arg, 0, kRootVMInternal)); + callback(reinterpret_cast<mirror::Object**>(&callee_save_methods_[i]), arg, 0, + kRootVMInternal); } } { |