OSDN Git Service

dex_instruction: k45cc HasVarArgs
authorNarayan Kamath <narayan@google.com>
Mon, 15 Aug 2016 15:08:18 +0000 (16:08 +0100)
committerNarayan Kamath <narayan@google.com>
Thu, 18 Aug 2016 09:36:29 +0000 (10:36 +0100)
Change-Id: I3be92269bb78c96ec41ab533c5792bd369c02178
Test: make test-art-host
bug: 30550796

runtime/dex_instruction-inl.h
runtime/dex_instruction_test.cc

index 3d0fea0..f6ed1f0 100644 (file)
@@ -505,11 +505,11 @@ inline uint16_t Instruction::VRegH_4rcc() const {
 }
 
 inline bool Instruction::HasVarArgs() const {
-  return FormatOf(Opcode()) == k35c;
+  return (FormatOf(Opcode()) == k35c) || (FormatOf(Opcode()) == k45cc);
 }
 
 inline void Instruction::GetVarArgs(uint32_t arg[kMaxVarArgRegs], uint16_t inst_data) const {
-  DCHECK_EQ(FormatOf(Opcode()), k35c);
+  DCHECK(HasVarArgs());
 
   /*
    * Note that the fields mentioned in the spec don't appear in
index 00c8e07..95e4181 100644 (file)
@@ -92,6 +92,15 @@ TEST(Instruction, PropertiesOf45cc) {
   ASSERT_TRUE(ins->HasVRegH());
   ASSERT_EQ(32, ins->VRegH());
   ASSERT_EQ(32, ins->VRegH_45cc());
+
+  ASSERT_TRUE(ins->HasVarArgs());
+
+  uint32_t arg_regs[Instruction::kMaxVarArgRegs];
+  ins->GetVarArgs(arg_regs);
+  ASSERT_EQ(0xeu, arg_regs[0]);
+  ASSERT_EQ(0xfu, arg_regs[1]);
+  ASSERT_EQ(0xau, arg_regs[2]);
+  ASSERT_EQ(0xcu, arg_regs[3]);
 }
 
 TEST(Instruction, PropertiesOf4rcc) {
@@ -118,6 +127,8 @@ TEST(Instruction, PropertiesOf4rcc) {
   ASSERT_TRUE(ins->HasVRegH());
   ASSERT_EQ(32, ins->VRegH());
   ASSERT_EQ(32, ins->VRegH_4rcc());
+
+  ASSERT_FALSE(ins->HasVarArgs());
 }
 
 }  // namespace art