void DexInstruction::verify_encoding() const { auto test = m_count ? new DexInstruction(opcode()) : new DexInstruction(opcode(), 0); if (dests_size()) { test->set_dest(dest()); } for (unsigned i = 0; i < srcs_size(); i++) { test->set_src(i, src(i)); } if (has_range()) { test->set_range_base(range_base()); test->set_range_size(range_size()); } if (has_arg_word_count()) test->set_arg_word_count(arg_word_count()); if (has_literal()) test->set_literal(literal()); if (has_offset()) test->set_offset(offset()); assert_log(m_opcode == test->m_opcode, "%x %x\n", m_opcode, test->m_opcode); for (unsigned i = 0; i < m_count; i++) { assert_log(m_arg[i] == test->m_arg[i], "(%x %x) (%x %x)", m_opcode, m_arg[i], test->m_opcode, test->m_arg[i]); } delete test; }
// generate_hash accumulates the properties of this type into the hash. void Array::generate_hash(HashGenerator& hashgen) const { Type::generate_hash(hashgen); m_element_type->generate_hash(hashgen); if(has_range()) { hashgen.add_int(m_array_range.min.integer); hashgen.add_int(m_array_range.max.integer); } else { hashgen.add_int(m_array_size); } }
// generate_hash accumulates the properties of this type into the hash. void Number::generate_hash(HashGenerator& hashgen) const { Type::generate_hash(hashgen); hashgen.add_int(m_divisor); if(has_modulus()) { hashgen.add_int(m_modulus.integer); } if(has_range()) { hashgen.add_int(m_range.min.integer); hashgen.add_int(m_range.max.integer); } }