summaryrefslogtreecommitdiff
path: root/runtime/compiler_callbacks.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2015-03-27 23:45:15 -0700
committer Andreas Gampe <agampe@google.com> 2015-03-27 23:46:09 -0700
commit4585f876eb5dfb936bd0d6cb6acd78a1f2182ba6 (patch)
treee9dfed086f56245e74862caa813c708bc4f500f9 /runtime/compiler_callbacks.h
parente2c29f4a2717923f190c944a06e02f7d8c3ddcb6 (diff)
ART: Some runtime cleanup
Use an enum for the compiler-callback mode. Refactor and remove some unnecessary includes in runtime.h. Change-Id: If2245fa470171311b8e05b677cf6bb28f209585a
Diffstat (limited to 'runtime/compiler_callbacks.h')
-rw-r--r--runtime/compiler_callbacks.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/runtime/compiler_callbacks.h b/runtime/compiler_callbacks.h
index 3fabe3ed44..b296e39c5e 100644
--- a/runtime/compiler_callbacks.h
+++ b/runtime/compiler_callbacks.h
@@ -29,27 +29,32 @@ class MethodVerifier;
} // namespace verifier
class CompilerCallbacks {
- public:
- virtual ~CompilerCallbacks() { }
+ public:
+ enum class CallbackMode { // private
+ kCompileBootImage,
+ kCompileApp
+ };
- virtual bool MethodVerified(verifier::MethodVerifier* verifier)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0;
- virtual void ClassRejected(ClassReference ref) = 0;
+ virtual ~CompilerCallbacks() { }
- // Return true if we should attempt to relocate to a random base address if we have not already
- // done so. Return false if relocating in this way would be problematic.
- virtual bool IsRelocationPossible() = 0;
+ virtual bool MethodVerified(verifier::MethodVerifier* verifier)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0;
+ virtual void ClassRejected(ClassReference ref) = 0;
- bool IsBootImage() {
- return boot_image_;
- }
+ // Return true if we should attempt to relocate to a random base address if we have not already
+ // done so. Return false if relocating in this way would be problematic.
+ virtual bool IsRelocationPossible() = 0;
- protected:
- explicit CompilerCallbacks(bool boot_image) : boot_image_(boot_image) { }
+ bool IsBootImage() {
+ return mode_ == CallbackMode::kCompileBootImage;
+ }
- private:
- // Whether the compiler is creating a boot image.
- const bool boot_image_;
+ protected:
+ explicit CompilerCallbacks(CallbackMode mode) : mode_(mode) { }
+
+ private:
+ // Whether the compiler is creating a boot image.
+ const CallbackMode mode_;
};
} // namespace art