summaryrefslogtreecommitdiff
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 68b956b17e..66bb80315d 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -62,6 +62,7 @@
#include "base/stl_util.h"
#include "base/systrace.h"
#include "base/unix_file/fd_file.h"
+#include "cha.h"
#include "class_linker-inl.h"
#include "compiler_callbacks.h"
#include "debugger.h"
@@ -349,6 +350,7 @@ Runtime::~Runtime() {
delete monitor_list_;
delete monitor_pool_;
delete class_linker_;
+ delete cha_;
delete heap_;
delete intern_table_;
delete oat_file_manager_;
@@ -1203,6 +1205,7 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
CHECK_GE(GetHeap()->GetContinuousSpaces().size(), 1U);
class_linker_ = new ClassLinker(intern_table_);
+ cha_ = new ClassHierarchyAnalysis;
if (GetHeap()->HasBootImageSpace()) {
bool result = class_linker_->InitFromBootImage(&error_msg);
if (!result) {
@@ -1733,9 +1736,24 @@ void Runtime::VisitImageRoots(RootVisitor* visitor) {
}
}
+static ArtMethod* CreateRuntimeMethod(ClassLinker* class_linker, LinearAlloc* linear_alloc) {
+ const PointerSize image_pointer_size = class_linker->GetImagePointerSize();
+ const size_t method_alignment = ArtMethod::Alignment(image_pointer_size);
+ const size_t method_size = ArtMethod::Size(image_pointer_size);
+ LengthPrefixedArray<ArtMethod>* method_array = class_linker->AllocArtMethodArray(
+ Thread::Current(),
+ linear_alloc,
+ 1);
+ ArtMethod* method = &method_array->At(0, method_size, method_alignment);
+ CHECK(method != nullptr);
+ method->SetDexMethodIndex(DexFile::kDexNoIndex);
+ CHECK(method->IsRuntimeMethod());
+ return method;
+}
+
ArtMethod* Runtime::CreateImtConflictMethod(LinearAlloc* linear_alloc) {
ClassLinker* const class_linker = GetClassLinker();
- ArtMethod* method = class_linker->CreateRuntimeMethod(linear_alloc);
+ ArtMethod* method = CreateRuntimeMethod(class_linker, linear_alloc);
// When compiling, the code pointer will get set later when the image is loaded.
const PointerSize pointer_size = GetInstructionSetPointerSize(instruction_set_);
if (IsAotCompiler()) {
@@ -1756,7 +1774,7 @@ void Runtime::SetImtConflictMethod(ArtMethod* method) {
}
ArtMethod* Runtime::CreateResolutionMethod() {
- auto* method = GetClassLinker()->CreateRuntimeMethod(GetLinearAlloc());
+ auto* method = CreateRuntimeMethod(GetClassLinker(), GetLinearAlloc());
// When compiling, the code pointer will get set later when the image is loaded.
if (IsAotCompiler()) {
PointerSize pointer_size = GetInstructionSetPointerSize(instruction_set_);
@@ -1768,7 +1786,7 @@ ArtMethod* Runtime::CreateResolutionMethod() {
}
ArtMethod* Runtime::CreateCalleeSaveMethod() {
- auto* method = GetClassLinker()->CreateRuntimeMethod(GetLinearAlloc());
+ auto* method = CreateRuntimeMethod(GetClassLinker(), GetLinearAlloc());
PointerSize pointer_size = GetInstructionSetPointerSize(instruction_set_);
method->SetEntryPointFromQuickCompiledCodePtrSize(nullptr, pointer_size);
DCHECK_NE(instruction_set_, kNone);