diff options
Diffstat (limited to 'runtime/compiler_callbacks.h')
-rw-r--r-- | runtime/compiler_callbacks.h | 37 |
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 |