Move simple runtime accessors to header file
Change-Id: I6831e067d8b7ce4d81b6daf9bd6a8af21fecfde3
diff --git a/src/runtime.cc b/src/runtime.cc
index 2dfbefd..784a3f6 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -606,14 +606,6 @@
VLOG(startup) << "Runtime::StartDaemonThreads exiting";
}
-bool Runtime::IsShuttingDown() const {
- return shutting_down_;
-}
-
-bool Runtime::IsStarted() const {
- return started_;
-}
-
bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) {
CHECK_EQ(sysconf(_SC_PAGE_SIZE), kPageSize);
@@ -787,10 +779,6 @@
Thread::Current()->GetStats()->Clear(kinds >> 16);
}
-RuntimeStats* Runtime::GetStats() {
- return &stats_;
-}
-
int32_t Runtime::GetStat(int kind) {
RuntimeStats* stats;
if (kind < (1<<16)) {
@@ -871,15 +859,6 @@
}
}
-bool Runtime::HasJniDlsymLookupStub() const {
- return jni_stub_array_ != NULL;
-}
-
-ByteArray* Runtime::GetJniDlsymLookupStub() const {
- CHECK(jni_stub_array_ != NULL);
- return jni_stub_array_;
-}
-
void Runtime::SetJniDlsymLookupStub(ByteArray* jni_stub_array) {
CHECK(jni_stub_array != NULL) << " jni_stub_array=" << jni_stub_array;
CHECK(jni_stub_array_ == NULL || jni_stub_array_ == jni_stub_array)
@@ -887,42 +866,12 @@
jni_stub_array_ = jni_stub_array;
}
-bool Runtime::HasAbstractMethodErrorStubArray() const {
- return abstract_method_error_stub_array_ != NULL;
-}
-
-ByteArray* Runtime::GetAbstractMethodErrorStubArray() const {
- CHECK(abstract_method_error_stub_array_ != NULL);
- return abstract_method_error_stub_array_;
-}
-
void Runtime::SetAbstractMethodErrorStubArray(ByteArray* abstract_method_error_stub_array) {
CHECK(abstract_method_error_stub_array != NULL);
CHECK(abstract_method_error_stub_array_ == NULL || abstract_method_error_stub_array_ == abstract_method_error_stub_array);
abstract_method_error_stub_array_ = abstract_method_error_stub_array;
}
-
-Runtime::TrampolineType Runtime::GetTrampolineType(Method* method) {
- if (method == NULL) {
- return Runtime::kUnknownMethod;
- } else if (method->IsStatic()) {
- return Runtime::kStaticMethod;
- } else {
- return Runtime::kUnknownMethod;
- }
-}
-
-bool Runtime::HasResolutionStubArray(TrampolineType type) const {
- return resolution_stub_array_[type] != NULL;
-}
-
-ByteArray* Runtime::GetResolutionStubArray(TrampolineType type) const {
- CHECK(HasResolutionStubArray(type));
- DCHECK_LT(static_cast<int>(type), static_cast<int>(kLastTrampolineMethodType));
- return resolution_stub_array_[type];
-}
-
void Runtime::SetResolutionStubArray(ByteArray* resolution_stub_array, TrampolineType type) {
CHECK(resolution_stub_array != NULL);
CHECK(!HasResolutionStubArray(type) || resolution_stub_array_[type] == resolution_stub_array);
@@ -941,20 +890,6 @@
return method.get();
}
-bool Runtime::HasResolutionMethod() const {
- return resolution_method_ != NULL;
-}
-
-// Returns a special method that calls into a trampoline for runtime method resolution
-Method* Runtime::GetResolutionMethod() const {
- CHECK(HasResolutionMethod());
- return resolution_method_;
-}
-
-void Runtime::SetResolutionMethod(Method* method) {
- resolution_method_ = method;
-}
-
Method* Runtime::CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type) {
Class* method_class = Method::GetMethodClass();
SirtRef<Method> method(down_cast<Method*>(method_class->AllocObject()));
@@ -1003,16 +938,6 @@
return method.get();
}
-bool Runtime::HasCalleeSaveMethod(CalleeSaveType type) const {
- return callee_save_method_[type] != NULL;
-}
-
-// Returns a special method that describes all callee saves being spilled to the stack.
-Method* Runtime::GetCalleeSaveMethod(CalleeSaveType type) const {
- CHECK(HasCalleeSaveMethod(type));
- return callee_save_method_[type];
-}
-
void Runtime::SetCalleeSaveMethod(Method* method, CalleeSaveType type) {
DCHECK_LT(static_cast<int>(type), static_cast<int>(kLastCalleeSaveType));
callee_save_method_[type] = method;
@@ -1029,15 +954,6 @@
tracer_ = NULL;
}
-bool Runtime::IsMethodTracingActive() const {
- return (tracer_ != NULL);
-}
-
-Trace* Runtime::GetTracer() const {
- CHECK(IsMethodTracingActive());
- return tracer_;
-}
-
const std::vector<const DexFile*>& Runtime::GetCompileTimeClassPath(const ClassLoader* class_loader) {
if (class_loader == NULL) {
return GetClassLinker()->GetBootClassPath();
diff --git a/src/runtime.h b/src/runtime.h
index b682b67..55dab07 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -108,8 +108,13 @@
// Starts a runtime, which may cause threads to be started and code to run.
void Start();
- bool IsShuttingDown() const;
- bool IsStarted() const;
+ bool IsShuttingDown() const {
+ return shutting_down_;
+ }
+
+ bool IsStarted() const {
+ return started_;
+ }
static Runtime* Current() {
return instance_;
@@ -181,12 +186,26 @@
void VisitRoots(Heap::RootVisitor* visitor, void* arg) const;
- bool HasJniDlsymLookupStub() const;
- ByteArray* GetJniDlsymLookupStub() const;
+ bool HasJniDlsymLookupStub() const {
+ return jni_stub_array_ != NULL;
+ }
+
+ ByteArray* GetJniDlsymLookupStub() const {
+ CHECK(HasJniDlsymLookupStub());
+ return jni_stub_array_;
+ }
+
void SetJniDlsymLookupStub(ByteArray* jni_stub_array);
- bool HasAbstractMethodErrorStubArray() const;
- ByteArray* GetAbstractMethodErrorStubArray() const;
+ bool HasAbstractMethodErrorStubArray() const {
+ return abstract_method_error_stub_array_ != NULL;
+ }
+
+ ByteArray* GetAbstractMethodErrorStubArray() const {
+ CHECK(abstract_method_error_stub_array_ != NULL);
+ return abstract_method_error_stub_array_;
+ }
+
void SetAbstractMethodErrorStubArray(ByteArray* abstract_method_error_stub_array);
enum TrampolineType {
@@ -194,16 +213,34 @@
kUnknownMethod,
kLastTrampolineMethodType // Value used for iteration
};
- static TrampolineType GetTrampolineType(Method* method);
- bool HasResolutionStubArray(TrampolineType type) const;
- ByteArray* GetResolutionStubArray(TrampolineType type) const;
+
+ bool HasResolutionStubArray(TrampolineType type) const {
+ return resolution_stub_array_[type] != NULL;
+ }
+
+ ByteArray* GetResolutionStubArray(TrampolineType type) const {
+ CHECK(HasResolutionStubArray(type));
+ DCHECK_LT(static_cast<int>(type), static_cast<int>(kLastTrampolineMethodType));
+ return resolution_stub_array_[type];
+ }
+
void SetResolutionStubArray(ByteArray* resolution_stub_array, TrampolineType type);
- // Returns a special method to trampoline into runtime resolution
+ // Returns a special method that calls into a trampoline for runtime method resolution
+ Method* GetResolutionMethod() const {
+ CHECK(HasResolutionMethod());
+ return resolution_method_;
+ }
+
+ bool HasResolutionMethod() const {
+ return resolution_method_ != NULL;
+ }
+
+ void SetResolutionMethod(Method* method) {
+ resolution_method_ = method;
+ }
+
Method* CreateResolutionMethod();
- bool HasResolutionMethod() const;
- Method* GetResolutionMethod() const;
- void SetResolutionMethod(Method* method);
// Returns a special method that describes all callee saves being spilled to the stack.
enum CalleeSaveType {
@@ -212,17 +249,28 @@
kRefsAndArgs,
kLastCalleeSaveType // Value used for iteration
};
- Method* CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type);
- bool HasCalleeSaveMethod(CalleeSaveType type) const;
- Method* GetCalleeSaveMethod(CalleeSaveType type) const;
+
+ bool HasCalleeSaveMethod(CalleeSaveType type) const {
+ return callee_save_method_[type] != NULL;
+ }
+
+ Method* GetCalleeSaveMethod(CalleeSaveType type) const {
+ CHECK(HasCalleeSaveMethod(type));
+ return callee_save_method_[type];
+ }
+
void SetCalleeSaveMethod(Method* method, CalleeSaveType type);
+ Method* CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type);
+
Method* CreateRefOnlyCalleeSaveMethod(InstructionSet instruction_set);
Method* CreateRefAndArgsCalleeSaveMethod(InstructionSet instruction_set);
int32_t GetStat(int kind);
- RuntimeStats* GetStats();
+ RuntimeStats* GetStats() {
+ return &stats_;
+ }
bool HasStatsEnabled() const {
return stats_enabled_;
@@ -236,12 +284,20 @@
void EnableMethodTracing(Trace* tracer);
void DisableMethodTracing();
- bool IsMethodTracingActive() const;
- Trace* GetTracer() const;
+
+ bool IsMethodTracingActive() const {
+ return tracer_ != NULL;
+ }
+
+ Trace* GetTracer() const {
+ CHECK(IsMethodTracingActive());
+ return tracer_;
+ }
bool UseCompileTimeClassPath() const {
return use_compile_time_class_path_;
}
+
const std::vector<const DexFile*>& GetCompileTimeClassPath(const ClassLoader* class_loader);
void SetCompileTimeClassPath(const ClassLoader* class_loader, std::vector<const DexFile*>& class_path);