DEBUG_ENABLE_ASSERT = 1 << 2,
DEBUG_ENABLE_SAFEMODE = 1 << 3,
DEBUG_ENABLE_JNI_LOGGING = 1 << 4,
- DEBUG_ENABLE_JIT = 1 << 5,
- DEBUG_GENERATE_DEBUG_INFO = 1 << 6,
+ DEBUG_GENERATE_DEBUG_INFO = 1 << 5,
};
Runtime* const runtime = Runtime::Current();
if (safe_mode) {
// Ensure that any (secondary) oat files will be interpreted.
runtime->AddCompilerOption("--compiler-filter=interpret-only");
+ runtime->SetSafeMode(true);
debug_flags &= ~DEBUG_ENABLE_SAFEMODE;
}
- bool use_jit = false;
- if ((debug_flags & DEBUG_ENABLE_JIT) != 0) {
- if (safe_mode) {
- LOG(INFO) << "Not enabling JIT due to safe mode";
- } else {
- use_jit = true;
- LOG(INFO) << "Late-enabling JIT";
- }
- debug_flags &= ~DEBUG_ENABLE_JIT;
- }
- runtime->GetJITOptions()->SetUseJIT(use_jit);
-
const bool generate_debug_info = (debug_flags & DEBUG_GENERATE_DEBUG_INFO) != 0;
if (generate_debug_info) {
runtime->AddCompilerOption("--generate-debug-info");
zygote_max_failed_boots_(0),
experimental_flags_(ExperimentalFlags::kNone),
oat_file_manager_(nullptr),
- is_low_memory_mode_(false) {
+ is_low_memory_mode_(false),
+ safe_mode_(false) {
CheckAsmSupportOffsetsAndSizes();
std::fill(callee_save_methods_, callee_save_methods_ + arraysize(callee_save_methods_), 0u);
}
// before fork aren't attributed to an app.
heap_->ResetGcPerformanceInfo();
- if (jit_.get() == nullptr && jit_options_->UseJIT()) {
- // Create the JIT if the flag is set and we haven't already create it (happens for run-tests).
+ if (!safe_mode_ && jit_options_->UseJIT()) {
+ DCHECK(jit_.get() == nullptr) << "The zygote should not JIT";
+ // Create the JIT if the flag is set.
CreateJit();
}
double GetHashTableMinLoadFactor() const;
double GetHashTableMaxLoadFactor() const;
+ void SetSafeMode(bool mode) {
+ safe_mode_ = mode;
+ }
+
private:
static void InitPlatformSignalHandlers();
// Whether or not we are on a low RAM device.
bool is_low_memory_mode_;
+ // Whether the application should run in safe mode, that is, interpreter only.
+ bool safe_mode_;
+
DISALLOW_COPY_AND_ASSIGN(Runtime);
};
std::ostream& operator<<(std::ostream& os, const Runtime::CalleeSaveType& rhs);