summaryrefslogtreecommitdiff
path: root/runtime/dex_instruction_utils.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-08-31 15:25:25 +0100
committer Vladimir Marko <vmarko@google.com> 2016-08-31 16:53:30 +0100
commitf04cf5470fd53d93f7ae5b07205284c19fa59f41 (patch)
tree2eeb90611ef858fb542ec475c2d8cbb1ee719d8f /runtime/dex_instruction_utils.h
parent081e7a16c4fcbdb014441a236e12f58eb89ff99a (diff)
Remove workarounds for [D]CHECK()s in constexpr functions.
We're now using C++14, so we can use [D]CHECK()s directly in constexpr functions. Remove the C++11 workaround macros ([D]CHECK_CONSTEXPR) and C++ version checks. Also remove the 'static' qualifier from inline functions in affected files. Test: m test-art-host Change-Id: I0f962ad75e4efe9b65325d022cd272b229574222
Diffstat (limited to 'runtime/dex_instruction_utils.h')
-rw-r--r--runtime/dex_instruction_utils.h26
1 files changed, 1 insertions, 25 deletions
diff --git a/runtime/dex_instruction_utils.h b/runtime/dex_instruction_utils.h
index 2849cd8533..72d82442b5 100644
--- a/runtime/dex_instruction_utils.h
+++ b/runtime/dex_instruction_utils.h
@@ -134,74 +134,54 @@ constexpr bool IsInstructionBinOp2Addr(Instruction::Code code) {
return Instruction::ADD_INT_2ADDR <= code && code <= Instruction::REM_DOUBLE_2ADDR;
}
-// TODO: Remove the #if guards below when we fully migrate to C++14.
-
constexpr bool IsInvokeInstructionRange(Instruction::Code opcode) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionInvoke(opcode));
-#endif
return opcode >= Instruction::INVOKE_VIRTUAL_RANGE;
}
constexpr DexInvokeType InvokeInstructionType(Instruction::Code opcode) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionInvoke(opcode));
-#endif
return static_cast<DexInvokeType>(IsInvokeInstructionRange(opcode)
? (opcode - Instruction::INVOKE_VIRTUAL_RANGE)
: (opcode - Instruction::INVOKE_VIRTUAL));
}
constexpr DexMemAccessType IGetMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionIGet(code));
-#endif
return static_cast<DexMemAccessType>(code - Instruction::IGET);
}
constexpr DexMemAccessType IPutMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionIPut(code));
-#endif
return static_cast<DexMemAccessType>(code - Instruction::IPUT);
}
constexpr DexMemAccessType SGetMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionSGet(code));
-#endif
return static_cast<DexMemAccessType>(code - Instruction::SGET);
}
constexpr DexMemAccessType SPutMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionSPut(code));
-#endif
return static_cast<DexMemAccessType>(code - Instruction::SPUT);
}
constexpr DexMemAccessType AGetMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionAGet(code));
-#endif
return static_cast<DexMemAccessType>(code - Instruction::AGET);
}
constexpr DexMemAccessType APutMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionAPut(code));
-#endif
return static_cast<DexMemAccessType>(code - Instruction::APUT);
}
constexpr DexMemAccessType IGetOrIPutMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionIGetOrIPut(code));
-#endif
return (code >= Instruction::IPUT) ? IPutMemAccessType(code) : IGetMemAccessType(code);
}
-static inline DexMemAccessType IGetQuickOrIPutQuickMemAccessType(Instruction::Code code) {
+inline DexMemAccessType IGetQuickOrIPutQuickMemAccessType(Instruction::Code code) {
DCHECK(IsInstructionIGetQuickOrIPutQuick(code));
switch (code) {
case Instruction::IGET_QUICK: case Instruction::IPUT_QUICK:
@@ -225,16 +205,12 @@ static inline DexMemAccessType IGetQuickOrIPutQuickMemAccessType(Instruction::Co
}
constexpr DexMemAccessType SGetOrSPutMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionSGetOrSPut(code));
-#endif
return (code >= Instruction::SPUT) ? SPutMemAccessType(code) : SGetMemAccessType(code);
}
constexpr DexMemAccessType AGetOrAPutMemAccessType(Instruction::Code code) {
-#if __cplusplus >= 201402 // C++14 allows the DCHECK() in constexpr functions.
DCHECK(IsInstructionAGetOrAPut(code));
-#endif
return (code >= Instruction::APUT) ? APutMemAccessType(code) : AGetMemAccessType(code);
}