summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-12-11 13:34:29 -0800
committer Mathieu Chartier <mathieuc@google.com> 2017-12-11 17:54:15 -0800
commita7f6b8151ee8b8c16a11e148fea1c02ca33dc211 (patch)
treef82167347158bd46e67cf0980af7131f2c7e5453
parent078f96f743805d951cea8f71af768facd17eba78 (diff)
Add ART_DEFAULT_COMPACT_DEX_LEVEL
If specified, this option changes the default compact dex level used by dex2oat. Defaults to none currently. Bug: 63756964 Test: ART_DEFAULT_COMPACT_DEX_LEVEL=fast mm test-art-host-gtest and verify it fails for now. Test: test/testrunner/testrunner.py --host -j64 and verify it passes Change-Id: Ib252f432b3545297725656a5cca40d1bb57b0ced
-rw-r--r--build/Android.common_build.mk5
-rw-r--r--build/art.go3
-rw-r--r--dex2oat/dex2oat.cc2
-rw-r--r--runtime/base/macros.h4
-rw-r--r--runtime/cdex/compact_dex_level.h16
5 files changed, 29 insertions, 1 deletions
diff --git a/build/Android.common_build.mk b/build/Android.common_build.mk
index f5a95fa0cf..08962526dd 100644
--- a/build/Android.common_build.mk
+++ b/build/Android.common_build.mk
@@ -49,6 +49,11 @@ endif
# Enable the read barrier by default.
ART_USE_READ_BARRIER ?= true
+# Default compact dex level to none.
+ifeq ($(ART_DEFAULT_COMPACT_DEX_LEVEL),)
+ART_DEFAULT_COMPACT_DEX_LEVEL := none
+endif
+
ART_CPP_EXTENSION := .cc
ifndef LIBART_IMG_HOST_BASE_ADDRESS
diff --git a/build/art.go b/build/art.go
index 5704b43834..3f598da00a 100644
--- a/build/art.go
+++ b/build/art.go
@@ -66,6 +66,9 @@ func globalFlags(ctx android.BaseContext) ([]string, []string) {
"-DART_READ_BARRIER_TYPE_IS_"+barrierType+"=1")
}
+ cdexLevel := envDefault(ctx, "ART_DEFAULT_COMPACT_DEX_LEVEL", "none")
+ cflags = append(cflags, "-DART_DEFAULT_COMPACT_DEX_LEVEL="+cdexLevel)
+
// We need larger stack overflow guards for ASAN, as the compiled code will have
// larger frame sizes. For simplicity, just use global not-target-specific cflags.
// Note: We increase this for both debug and non-debug, as the overflow gap will
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 27bec1d3e1..82331ba31b 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -2814,7 +2814,7 @@ class Dex2Oat FINAL {
// Dex files we are compiling, does not include the class path dex files.
std::vector<const DexFile*> dex_files_;
std::string no_inline_from_string_;
- CompactDexLevel compact_dex_level_ = CompactDexLevel::kCompactDexLevelNone;
+ CompactDexLevel compact_dex_level_ = kDefaultCompactDexLevel;
std::vector<std::unique_ptr<linker::ElfWriter>> elf_writers_;
std::vector<std::unique_ptr<linker::OatWriter>> oat_writers_;
diff --git a/runtime/base/macros.h b/runtime/base/macros.h
index 6cd7d60253..512e5ce651 100644
--- a/runtime/base/macros.h
+++ b/runtime/base/macros.h
@@ -59,6 +59,10 @@ template<typename T> ART_FRIEND_TEST(test_set_name, individual_test)
#define QUOTE(x) #x
#define STRINGIFY(x) QUOTE(x)
+// Append tokens after evaluating.
+#define APPEND_TOKENS_AFTER_EVAL_2(a, b) a ## b
+#define APPEND_TOKENS_AFTER_EVAL(a, b) APPEND_TOKENS_AFTER_EVAL_2(a, b)
+
#ifndef NDEBUG
#define ALWAYS_INLINE
#else
diff --git a/runtime/cdex/compact_dex_level.h b/runtime/cdex/compact_dex_level.h
index b824462bf0..5aec00195d 100644
--- a/runtime/cdex/compact_dex_level.h
+++ b/runtime/cdex/compact_dex_level.h
@@ -17,6 +17,9 @@
#ifndef ART_RUNTIME_CDEX_COMPACT_DEX_LEVEL_H_
#define ART_RUNTIME_CDEX_COMPACT_DEX_LEVEL_H_
+#include <string>
+
+#include "base/macros.h"
#include "dex_file.h"
namespace art {
@@ -29,6 +32,19 @@ enum class CompactDexLevel {
kCompactDexLevelFast,
};
+#ifndef ART_DEFAULT_COMPACT_DEX_LEVEL
+#error ART_DEFAULT_COMPACT_DEX_LEVEL not specified.
+#else
+#define ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_fast CompactDexLevel::kCompactDexLevelFast
+#define ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_none CompactDexLevel::kCompactDexLevelNone
+
+#define ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT APPEND_TOKENS_AFTER_EVAL( \
+ ART_DEFAULT_COMPACT_DEX_LEVEL_VALUE_, \
+ ART_DEFAULT_COMPACT_DEX_LEVEL)
+
+static constexpr CompactDexLevel kDefaultCompactDexLevel = ART_DEFAULT_COMPACT_DEX_LEVEL_DEFAULT;
+#endif
+
} // namespace art
#endif // ART_RUNTIME_CDEX_COMPACT_DEX_LEVEL_H_