ART: Some runtime cleanup
Use an enum for the compiler-callback mode.
Refactor and remove some unnecessary includes in runtime.h.
Change-Id: If2245fa470171311b8e05b677cf6bb28f209585a
diff --git a/runtime/compiler_callbacks.h b/runtime/compiler_callbacks.h
index 3fabe3e..b296e39 100644
--- a/runtime/compiler_callbacks.h
+++ b/runtime/compiler_callbacks.h
@@ -29,27 +29,32 @@
} // 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