diff options
author | Dan Pasanen <invisiblek@cyanogenmod.org> | 2016-12-06 19:30:12 -0600 |
---|---|---|
committer | Dan Pasanen <invisiblek@cyanogenmod.org> | 2016-12-06 19:32:30 -0600 |
commit | 58d4793f8bd82b9daab5bf4fa40d5b68204e71eb (patch) | |
tree | 449265cbacbf925f37ed0bd201e68f080e2537cc /runtime/jit/profiling_info.cc | |
parent | 20af13267def46b2e5f9a6fa6e94ac69056ef16f (diff) | |
parent | 12eb0c532e33ca5d5e98addd580b5ad0a4b71be4 (diff) | |
download | art-cm-14.1_prerebase.tar.gz art-cm-14.1_prerebase.tar.bz2 art-cm-14.1_prerebase.zip |
Merge tag 'android-7.1.1_r4' into cm-14.1cm-14.1_prerebase
Android 7.1.1 release 4
Change-Id: I14b36666b5a478024f3a9ffab90fd675a6157461
Diffstat (limited to 'runtime/jit/profiling_info.cc')
-rw-r--r-- | runtime/jit/profiling_info.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/runtime/jit/profiling_info.cc b/runtime/jit/profiling_info.cc index 07c8051214..216df2fc09 100644 --- a/runtime/jit/profiling_info.cc +++ b/runtime/jit/profiling_info.cc @@ -25,10 +25,33 @@ namespace art { +ProfilingInfo::ProfilingInfo(ArtMethod* method, const std::vector<uint32_t>& entries) + : number_of_inline_caches_(entries.size()), + method_(method), + is_method_being_compiled_(false), + is_osr_method_being_compiled_(false), + current_inline_uses_(0), + saved_entry_point_(nullptr) { + memset(&cache_, 0, number_of_inline_caches_ * sizeof(InlineCache)); + for (size_t i = 0; i < number_of_inline_caches_; ++i) { + cache_[i].dex_pc_ = entries[i]; + } + if (method->IsCopied()) { + // GetHoldingClassOfCopiedMethod is expensive, but creating a profiling info for a copied method + // appears to happen very rarely in practice. + holding_class_ = GcRoot<mirror::Class>( + Runtime::Current()->GetClassLinker()->GetHoldingClassOfCopiedMethod(method)); + } else { + holding_class_ = GcRoot<mirror::Class>(method->GetDeclaringClass()); + } + DCHECK(!holding_class_.IsNull()); +} + bool ProfilingInfo::Create(Thread* self, ArtMethod* method, bool retry_allocation) { // Walk over the dex instructions of the method and keep track of // instructions we are interested in profiling. DCHECK(!method->IsNative()); + const DexFile::CodeItem& code_item = *method->GetCodeItem(); const uint16_t* code_ptr = code_item.insns_; const uint16_t* code_end = code_item.insns_ + code_item.insns_size_in_code_units_; @@ -93,6 +116,14 @@ void ProfilingInfo::AddInvokeInfo(uint32_t dex_pc, mirror::Class* cls) { --i; } else { // We successfully set `cls`, just return. + // Since the instrumentation is marked from the declaring class we need to mark the card so + // that mod-union tables and card rescanning know about the update. + // Note that the declaring class is not necessarily the holding class if the method is + // copied. We need the card mark to be in the holding class since that is from where we + // will visit the profiling info. + if (!holding_class_.IsNull()) { + Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(holding_class_.Read()); + } return; } } |