From 4585f876eb5dfb936bd0d6cb6acd78a1f2182ba6 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Fri, 27 Mar 2015 23:45:15 -0700 Subject: ART: Some runtime cleanup Use an enum for the compiler-callback mode. Refactor and remove some unnecessary includes in runtime.h. Change-Id: If2245fa470171311b8e05b677cf6bb28f209585a --- runtime/compiler_callbacks.h | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'runtime/compiler_callbacks.h') 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 -- cgit v1.2.3-59-g8ed1b