May fix some random crashes in dex2oat due to cross compilation.
Change-Id: I633652500e8c7dfec38044dffd07eb467973d82a
}
template<typename RootVisitorType>
-void ArtMethod::VisitRoots(RootVisitorType& visitor) {
+void ArtMethod::VisitRoots(RootVisitorType& visitor, size_t pointer_size) {
ArtMethod* interface_method = nullptr;
mirror::Class* klass = declaring_class_.Read();
if (UNLIKELY(klass != nullptr && klass->IsProxyClass())) {
// For normal methods, dex cache shortcuts will be visited through the declaring class.
// However, for proxies we need to keep the interface method alive, so we visit its roots.
- size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
interface_method = mirror::DexCache::GetElementPtrSize(
GetDexCacheResolvedMethods(pointer_size),
GetDexMethodIndex(),
DCHECK(interface_method != nullptr);
DCHECK_EQ(interface_method,
Runtime::Current()->GetClassLinker()->FindMethodForProxy(klass, this));
- interface_method->VisitRoots(visitor);
+ interface_method->VisitRoots(visitor, pointer_size);
}
visitor.VisitRootIfNonNull(declaring_class_.AddressWithoutBarrier());
- ProfilingInfo* profiling_info = GetProfilingInfo();
+ ProfilingInfo* profiling_info = GetProfilingInfo(pointer_size);
if (hotness_count_ != 0 && !IsNative() && profiling_info != nullptr) {
profiling_info->VisitRoots(visitor);
}
}
ProfilingInfo* ArtMethod::CreateProfilingInfo() {
+ DCHECK(!Runtime::Current()->IsAotCompiler());
ProfilingInfo* info = ProfilingInfo::Create(this);
MemberOffset offset = ArtMethod::EntryPointFromJniOffset(sizeof(void*));
uintptr_t pointer = reinterpret_cast<uintptr_t>(this) + offset.Uint32Value();
if (!reinterpret_cast<Atomic<ProfilingInfo*>*>(pointer)->
CompareExchangeStrongSequentiallyConsistent(nullptr, info)) {
- return GetProfilingInfo();
+ return GetProfilingInfo(sizeof(void*));
} else {
return info;
}
ProfilingInfo* CreateProfilingInfo() SHARED_REQUIRES(Locks::mutator_lock_);
- ProfilingInfo* GetProfilingInfo() {
- return reinterpret_cast<ProfilingInfo*>(GetEntryPointFromJni());
+ ProfilingInfo* GetProfilingInfo(size_t pointer_size) {
+ return reinterpret_cast<ProfilingInfo*>(GetEntryPointFromJniPtrSize(pointer_size));
}
void* GetEntryPointFromJni() {
// NO_THREAD_SAFETY_ANALYSIS since we don't know what the callback requires.
template<typename RootVisitorType>
- void VisitRoots(RootVisitorType& visitor) NO_THREAD_SAFETY_ANALYSIS;
+ void VisitRoots(RootVisitorType& visitor, size_t pointer_size) NO_THREAD_SAFETY_ANALYSIS;
const DexFile* GetDexFile() SHARED_REQUIRES(Locks::mutator_lock_);
ArtMethod* method = gc_root_source->GetArtMethod();
LOG(INTERNAL_FATAL) << "gc root in method " << method << " " << PrettyMethod(method);
RootPrinter root_printer;
- method->VisitRoots(root_printer);
+ method->VisitRoots(root_printer, sizeof(void*));
}
ref->GetLockWord(false).Dump(LOG(INTERNAL_FATAL));
region_space_->DumpNonFreeRegions(LOG(INTERNAL_FATAL));
uint32_t dex_pc,
ArtMethod* callee ATTRIBUTE_UNUSED) {
DCHECK(this_object != nullptr);
- ProfilingInfo* info = caller->GetProfilingInfo();
+ ProfilingInfo* info = caller->GetProfilingInfo(sizeof(void*));
if (info != nullptr) {
info->AddInvokeInfo(thread, dex_pc, this_object->GetClass());
}
}
}
for (ArtMethod& method : GetDirectMethods(pointer_size)) {
- method.VisitRoots(visitor);
+ method.VisitRoots(visitor, pointer_size);
}
for (ArtMethod& method : GetVirtualMethods(pointer_size)) {
- method.VisitRoots(visitor);
+ method.VisitRoots(visitor, pointer_size);
}
}
// Visiting the roots of these ArtMethods is not currently required since all the GcRoots are
// null.
BufferedRootVisitor<16> buffered_visitor(visitor, RootInfo(kRootVMInternal));
+ const size_t pointer_size = GetClassLinker()->GetImagePointerSize();
if (HasResolutionMethod()) {
- resolution_method_->VisitRoots(buffered_visitor);
+ resolution_method_->VisitRoots(buffered_visitor, pointer_size);
}
if (HasImtConflictMethod()) {
- imt_conflict_method_->VisitRoots(buffered_visitor);
+ imt_conflict_method_->VisitRoots(buffered_visitor, pointer_size);
}
if (imt_unimplemented_method_ != nullptr) {
- imt_unimplemented_method_->VisitRoots(buffered_visitor);
+ imt_unimplemented_method_->VisitRoots(buffered_visitor, pointer_size);
}
for (size_t i = 0; i < kLastCalleeSaveType; ++i) {
auto* m = reinterpret_cast<ArtMethod*>(callee_save_methods_[i]);
if (m != nullptr) {
- m->VisitRoots(buffered_visitor);
+ m->VisitRoots(buffered_visitor, pointer_size);
}
}
}