}
}
-void JitCodeCache::GetCompiledArtMethods(const std::set<std::string>& dex_base_locations,
- std::vector<ArtMethod*>& methods) {
+void JitCodeCache::GetProfiledMethods(const std::set<std::string>& dex_base_locations,
+ std::vector<MethodReference>& methods) {
ScopedTrace trace(__FUNCTION__);
MutexLock mu(Thread::Current(), lock_);
- for (auto it : method_code_map_) {
- if (ContainsElement(dex_base_locations, it.second->GetDexFile()->GetBaseLocation())) {
- methods.push_back(it.second);
+ for (const ProfilingInfo* info : profiling_infos_) {
+ ArtMethod* method = info->GetMethod();
+ const DexFile* dex_file = method->GetDexFile();
+ if (ContainsElement(dex_base_locations, dex_file->GetBaseLocation())) {
+ methods.emplace_back(dex_file, method->GetDexMethodIndex());
}
}
}
#include "gc/accounting/bitmap.h"
#include "gc_root.h"
#include "jni.h"
+#include "method_reference.h"
#include "oat_file.h"
#include "object_callbacks.h"
#include "safe_map.h"
void* MoreCore(const void* mspace, intptr_t increment);
- // Adds to `methods` all the compiled ArtMethods which are part of any of the given dex locations.
- void GetCompiledArtMethods(const std::set<std::string>& dex_base_locations,
- std::vector<ArtMethod*>& methods)
+ // Adds to `methods` all profiled methods which are part of any of the given dex locations.
+ void GetProfiledMethods(const std::set<std::string>& dex_base_locations,
+ std::vector<MethodReference>& methods)
REQUIRES(!lock_)
SHARED_REQUIRES(Locks::mutator_lock_);
}
bool ProfileCompilationInfo::AddMethodsAndClasses(
- const std::vector<ArtMethod*>& methods,
+ const std::vector<MethodReference>& methods,
const std::set<DexCacheResolvedClasses>& resolved_classes) {
- ScopedObjectAccess soa(Thread::Current());
- for (ArtMethod* method : methods) {
- const DexFile* dex_file = method->GetDexFile();
- if (!AddMethodIndex(GetProfileDexFileKey(dex_file->GetLocation()),
- dex_file->GetLocationChecksum(),
- method->GetDexMethodIndex())) {
+ for (const MethodReference& method : methods) {
+ if (!AddMethodIndex(GetProfileDexFileKey(method.dex_file->GetLocation()),
+ method.dex_file->GetLocationChecksum(),
+ method.dex_method_index)) {
return false;
}
}
namespace art {
-class ArtMethod;
-class DexCacheProfileData;
-
// TODO: rename file.
/**
* Profile information in a format suitable to be queried by the compiler and
static const uint8_t kProfileVersion[];
// Add the given methods and classes to the current profile object.
- bool AddMethodsAndClasses(const std::vector<ArtMethod*>& methods,
+ bool AddMethodsAndClasses(const std::vector<MethodReference>& methods,
const std::set<DexCacheResolvedClasses>& resolved_classes);
// Loads profile information from the given file descriptor.
bool Load(int fd);
DexFileData* GetOrAddDexFileData(const std::string& dex_location, uint32_t checksum);
bool AddMethodIndex(const std::string& dex_location, uint32_t checksum, uint16_t method_idx);
bool AddClassIndex(const std::string& dex_location, uint32_t checksum, uint16_t class_idx);
- bool AddResolvedClasses(const DexCacheResolvedClasses& classes)
- SHARED_REQUIRES(Locks::mutator_lock_);
+ bool AddResolvedClasses(const DexCacheResolvedClasses& classes);
// Parsing functionality.
#include "class_linker-inl.h"
#include "common_runtime_test.h"
#include "dex_file.h"
+#include "method_reference.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
#include "handle_scope-inl.h"
const std::vector<ArtMethod*>& methods,
const std::set<DexCacheResolvedClasses>& resolved_classes) {
ProfileCompilationInfo info;
- if (!info.AddMethodsAndClasses(methods, resolved_classes)) {
+ std::vector<MethodReference> method_refs;
+ ScopedObjectAccess soa(Thread::Current());
+ for (ArtMethod* method : methods) {
+ method_refs.emplace_back(method->GetDexFile(), method->GetDexMethodIndex());
+ }
+ if (!info.AddMethodsAndClasses(method_refs, resolved_classes)) {
return false;
}
return info.MergeAndSave(filename, nullptr, false);
}
}
ProfileCompilationInfo* info = GetCachedProfiledInfo(filename);
- info->AddMethodsAndClasses(std::vector<ArtMethod*>(), resolved_classes_for_location);
+ info->AddMethodsAndClasses(std::vector<MethodReference>(), resolved_classes_for_location);
total_number_of_profile_entries_cached += resolved_classes_for_location.size();
}
max_number_of_profile_entries_cached_ = std::max(
}
const std::string& filename = it.first;
const std::set<std::string>& locations = it.second;
- std::vector<ArtMethod*> methods;
+ std::vector<MethodReference> methods;
{
ScopedObjectAccess soa(Thread::Current());
- jit_code_cache_->GetCompiledArtMethods(locations, methods);
+ jit_code_cache_->GetProfiledMethods(locations, methods);
total_number_of_code_cache_queries_++;
}