From 8afeb85d3def12b559b7565fb6d3956f81b55132 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Wed, 2 Apr 2014 14:55:49 -0700 Subject: Pass instruction-set from runtime through to spawned dex2oat. Change-Id: I1727af7beb9f710c29124d4d6bc9175e4856f3cc --- runtime/runtime.cc | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'runtime/runtime.cc') diff --git a/runtime/runtime.cc b/runtime/runtime.cc index a830018..b0a6584 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -79,6 +79,8 @@ namespace art { static constexpr bool kEnableJavaStackTraceHandler = true; +const char* Runtime::kDefaultInstructionSetFeatures = + STRINGIFY(ART_DEFAULT_INSTRUCTION_SET_FEATURES); Runtime* Runtime::instance_ = NULL; Runtime::Runtime() @@ -1216,6 +1218,59 @@ void Runtime::SetFaultMessage(const std::string& message) { fault_message_ = message; } +void Runtime::AddCurrentRuntimeFeaturesAsDex2OatArguments(std::vector* argv) + const { + argv->push_back("--runtime-arg"); + std::string checkstr = "-implicit-checks"; + + int nchecks = 0; + char checksep = ':'; + + if (!ExplicitNullChecks()) { + checkstr += checksep; + checksep = ','; + checkstr += "null"; + ++nchecks; + } + if (!ExplicitSuspendChecks()) { + checkstr += checksep; + checksep = ','; + checkstr += "suspend"; + ++nchecks; + } + + if (!ExplicitStackOverflowChecks()) { + checkstr += checksep; + checksep = ','; + checkstr += "stack"; + ++nchecks; + } + + if (nchecks == 0) { + checkstr += ":none"; + } + argv->push_back(checkstr); + + // Make the dex2oat instruction set match that of the launching runtime. If we have multiple + // architecture support, dex2oat may be compiled as a different instruction-set than that + // currently being executed. +#if defined(__arm__) + argv->push_back("--instruction-set=arm"); +#elif defined(__aarch64__) + argv->push_back("--instruction-set=arm64"); +#elif defined(__i386__) + argv->push_back("--instruction-set=x86"); +#elif defined(__x86_64__) + argv->push_back("--instruction-set=x86_64"); +#elif defined(__mips__) + argv->push_back("--instruction-set=mips"); +#endif + + std::string features("--instruction-set-features="); + features += GetDefaultInstructionSetFeatures(); + argv->push_back(features); +} + void Runtime::UpdateProfilerState(int state) { LOG(DEBUG) << "Profiler state updated to " << state; } -- cgit v1.1