summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2025-01-09 14:15:29 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2025-01-10 06:45:56 -0800
commit502bbbac8b2a29de4fe3df786dc66b95bfbe095c (patch)
tree3cb4546d54b913694a31ca5629ebc37681aed0a4
parent790a81400b0bdee14f4d6f6685a65d7558b8d356 (diff)
Clean up `Instruction::CanFlowThrough()`.
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ia8fa55ca846130184759a0554dcd70b3774322dc
-rw-r--r--libdexfile/dex/dex_instruction.cc7
-rw-r--r--libdexfile/dex/dex_instruction.h4
2 files changed, 3 insertions, 8 deletions
diff --git a/libdexfile/dex/dex_instruction.cc b/libdexfile/dex/dex_instruction.cc
index 27feb08d77..4887491509 100644
--- a/libdexfile/dex/dex_instruction.cc
+++ b/libdexfile/dex/dex_instruction.cc
@@ -55,13 +55,6 @@ int32_t Instruction::GetTargetOffset() const {
}
}
-bool Instruction::CanFlowThrough() const {
- const uint16_t* insns = reinterpret_cast<const uint16_t*>(this);
- uint16_t insn = *insns;
- Code opcode = static_cast<Code>(insn & 0xFF);
- return FlagsOf(opcode) & Instruction::kContinue;
-}
-
size_t Instruction::SizeInCodeUnitsComplexOpcode() const {
// Handle special NOP encoded variable length sequences.
uint16_t inst_data = Fetch16(0);
diff --git a/libdexfile/dex/dex_instruction.h b/libdexfile/dex/dex_instruction.h
index cf676681e0..07f035c108 100644
--- a/libdexfile/dex/dex_instruction.h
+++ b/libdexfile/dex/dex_instruction.h
@@ -552,7 +552,9 @@ class Instruction {
int32_t GetTargetOffset() const;
// Returns true if the instruction allows control flow to go to the following instruction.
- bool CanFlowThrough() const;
+ bool CanFlowThrough() const {
+ return (FlagsOf(Opcode()) & Instruction::kContinue) != 0;
+ }
// Returns true if this instruction is a switch.
bool IsSwitch() const {