summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2015-09-15 17:03:55 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-09-15 17:03:55 +0000
commit1e9c1ffa2fc148fc8d0ee5eb1222dd894116e68d (patch)
tree0caf77956d845e3f4e94cd994df0bc9626e1aeee
parentada5ccd318fb02f9d5c7b20c9d6fed9ffa614961 (diff)
parent1147b9bd68323c753ed1a0b6106b205fd640c820 (diff)
Merge "Use image pointer size for profile info"
-rw-r--r--runtime/art_method-inl.h7
-rw-r--r--runtime/art_method.cc3
-rw-r--r--runtime/art_method.h6
-rw-r--r--runtime/gc/collector/concurrent_copying.cc2
-rw-r--r--runtime/jit/jit_instrumentation.cc2
-rw-r--r--runtime/mirror/class-inl.h4
-rw-r--r--runtime/runtime.cc9
7 files changed, 17 insertions, 16 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index a84c20a355..d6b2b7e04d 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -528,13 +528,12 @@ inline mirror::Class* ArtMethod::GetReturnType(bool resolve, size_t ptr_size) {
}
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(),
@@ -542,11 +541,11 @@ void ArtMethod::VisitRoots(RootVisitorType& visitor) {
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);
}
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 6044a2a334..92648b9b1b 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -601,12 +601,13 @@ const uint8_t* ArtMethod::GetQuickenedInfo() {
}
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;
}
diff --git a/runtime/art_method.h b/runtime/art_method.h
index 9ee8ee69f1..f78c8274b0 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -392,8 +392,8 @@ class ArtMethod FINAL {
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() {
@@ -460,7 +460,7 @@ class ArtMethod FINAL {
// 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_);
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 4cbcdc5d42..399591b93d 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1472,7 +1472,7 @@ void ConcurrentCopying::AssertToSpaceInvariant(GcRootSource* gc_root_source,
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));
diff --git a/runtime/jit/jit_instrumentation.cc b/runtime/jit/jit_instrumentation.cc
index f48568271d..d437dd5d56 100644
--- a/runtime/jit/jit_instrumentation.cc
+++ b/runtime/jit/jit_instrumentation.cc
@@ -98,7 +98,7 @@ void JitInstrumentationListener::InvokeVirtualOrInterface(Thread* thread,
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());
}
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 10b381d59d..93f2aea38e 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -842,10 +842,10 @@ void mirror::Class::VisitNativeRoots(Visitor& visitor, size_t pointer_size) {
}
}
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);
}
}
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index bbadb1eb79..6b144cf48b 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1399,19 +1399,20 @@ void Runtime::VisitConstantRoots(RootVisitor* visitor) {
// 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);
}
}
}