ART: Add experimental constexpr
Add a constexpr flag to bypass a branch in the verifier when there
are no experimental dex instructions. Guarantee the value with
static_asserts.
Bug: 10921004
Test: m test-art-host
Change-Id: Ib77b6142c4d2debe4b4d4fec60c02d92b1e7349f
diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc
index 9f34c12..7dc62ed 100644
--- a/runtime/dex_instruction.cc
+++ b/runtime/dex_instruction.cc
@@ -537,6 +537,14 @@
DEX_INSTRUCTION_LIST(VAR_ARGS_RANGE_CHECK)
#undef DEX_INSTRUCTION_LIST
#undef VAR_ARGS_RANGE_CHECK
+
+ #define EXPERIMENTAL_CHECK(o, c, pname, f, i, a, v) \
+ static_assert(kHaveExperimentalInstructions || (((a) & kExperimental) == 0), \
+ "Unexpected experimental instruction.");
+ #include "dex_instruction_list.h"
+ DEX_INSTRUCTION_LIST(EXPERIMENTAL_CHECK)
+ #undef DEX_INSTRUCTION_LIST
+ #undef EXPERIMENTAL_CHECK
};
std::ostream& operator<<(std::ostream& os, const Instruction::Code& code) {