diff options
| -rw-r--r-- | build/Android.oat.mk | 2 | ||||
| -rw-r--r-- | compiler/driver/compiler_options.cc | 20 | ||||
| -rw-r--r-- | compiler/optimizing/optimizing_cfi_test.cc | 4 | ||||
| -rwxr-xr-x | test/etc/run-test-jar | 3 |
4 files changed, 19 insertions, 10 deletions
diff --git a/build/Android.oat.mk b/build/Android.oat.mk index 3f9ea15fb3..517ac5c28d 100644 --- a/build/Android.oat.mk +++ b/build/Android.oat.mk @@ -111,6 +111,7 @@ $$(core_image_name): $$(HOST_CORE_DEX_LOCATIONS) $$(core_dex2oat_dependency) $$(LOCAL_$(2)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION) \ --host --android-root=$$(HOST_OUT) \ --generate-debug-info --generate-build-id --compile-pic \ + --runtime-arg -XX:SlowDebug=true \ $$(PRIVATE_CORE_MULTI_PARAM) $$(PRIVATE_CORE_COMPILE_OPTIONS) $$(core_oat_name): $$(core_image_name) @@ -214,6 +215,7 @@ $$(core_image_name): $$(TARGET_CORE_DEX_FILES) $$(core_dex2oat_dependency) --instruction-set-features=$$($(2)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ --android-root=$$(PRODUCT_OUT)/system \ --generate-debug-info --generate-build-id --compile-pic \ + --runtime-arg -XX:SlowDebug=true \ $$(PRIVATE_CORE_COMPILE_OPTIONS) || (rm $$(PRIVATE_CORE_OAT_NAME); exit 1) $$(core_oat_name): $$(core_image_name) diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc index c0a9a05aa6..1780b1d7ed 100644 --- a/compiler/driver/compiler_options.cc +++ b/compiler/driver/compiler_options.cc @@ -20,6 +20,7 @@ #include "android-base/stringprintf.h" +#include "base/runtime_debug.h" #include "base/variant_map.h" #include "cmdline_parser.h" #include "compiler_options_map-inl.h" @@ -68,17 +69,16 @@ CompilerOptions::~CompilerOptions() { // because we don't want to include the PassManagerOptions definition from the header file. } +namespace { + +bool kEmitRuntimeReadBarrierChecks = kIsDebugBuild && + RegisterRuntimeDebugFlag(&kEmitRuntimeReadBarrierChecks); + +} // namespace + bool CompilerOptions::EmitRunTimeChecksInDebugMode() const { - // Run-time checks (e.g. Marking Register checks) are only emitted - // in debug mode, and - // - when running on device; or - // - when running on host, but only - // - when compiling the core image (which is used only for testing); or - // - when JIT compiling (only relevant for non-native methods). - // This is to prevent these checks from being emitted into pre-opted - // boot image or apps, as these are compiled with dex2oatd. - return kIsDebugBuild && - (kIsTargetBuild || IsCoreImage() || Runtime::Current()->UseJitCompilation()); + // Run-time checks (e.g. Marking Register checks) are only emitted in slow-debug mode. + return kEmitRuntimeReadBarrierChecks; } bool CompilerOptions::ParseDumpInitFailures(const std::string& option, std::string* error_msg) { diff --git a/compiler/optimizing/optimizing_cfi_test.cc b/compiler/optimizing/optimizing_cfi_test.cc index 4ad29961be..e2b2106f65 100644 --- a/compiler/optimizing/optimizing_cfi_test.cc +++ b/compiler/optimizing/optimizing_cfi_test.cc @@ -18,6 +18,7 @@ #include <vector> #include "arch/instruction_set.h" +#include "base/runtime_debug.h" #include "cfi_test.h" #include "driver/compiler_options.h" #include "gtest/gtest.h" @@ -56,6 +57,9 @@ class OptimizingCFITest : public CFITest { ArenaAllocator* GetAllocator() { return pool_and_allocator_.GetAllocator(); } void SetUpFrame(InstructionSet isa) { + // Ensure that slow-debug is off, so that there is no unexpected read-barrier check emitted. + SetRuntimeDebugFlagsEnabled(false); + // Setup simple context. std::string error; isa_features_ = InstructionSetFeatures::FromVariant(isa, "default", &error); diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index 4844d1e758..132099a45d 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -90,6 +90,9 @@ SYNC_BEFORE_RUN="n" # When running a debug build, we want to run with all checks. ANDROID_FLAGS="${ANDROID_FLAGS} -XX:SlowDebug=true" +# The same for dex2oatd, both prebuild and runtime-driven. +ANDROID_FLAGS="${ANDROID_FLAGS} -Xcompiler-option --runtime-arg -Xcompiler-option -XX:SlowDebug=true" +COMPILER_FLAGS="${COMPILER_FLAGS} --runtime-arg -XX:SlowDebug=true" while true; do if [ "x$1" = "x--quiet" ]; then |