From 049d68181e4862271acc027bcb0b4cf5bcc122b6 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Fri, 18 May 2018 14:46:49 +0100 Subject: Rewrite stackmap verification code. The new version is more complicated but it gives much higher confidence about the correctness of the stackmap encoding. The old version was comparing the internal builder entries to the decoded information, which verified the bit-level manipulations, but it did not verify that we created the internal state correctly. The new version directly compares the parameters passed to the StackMapStream and the decoded values. This way, it really tests the whole system. It uses lambda captures to record the parameters. Test: test-art-host-gtest-stack_map_test Change-Id: Ib92819cc35ce0d790128392d303f6feabd7d9c74 --- compiler/optimizing/stack_map_stream.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'compiler/optimizing/stack_map_stream.h') diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index cefe165a67..c758bca951 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -30,7 +30,7 @@ namespace art { -class DexRegisterMap; +class CodeInfo; /** * Collects and builds stack maps for a method. All the stack maps @@ -138,11 +138,6 @@ class StackMapStream : public ValueObject { void CreateDexRegisterMap(); - void CheckDexRegisterMap(const DexRegisterMap& dex_register_map, - size_t dex_register_mask_index, - size_t dex_register_map_index) const; - void CheckCodeInfo(MemoryRegion region) const; - const InstructionSet instruction_set_; BitTableBuilder stack_maps_; BitTableBuilder register_masks_; @@ -171,9 +166,9 @@ class StackMapStream : public ValueObject { ArenaBitVector temp_dex_register_mask_; ScopedArenaVector temp_dex_register_map_; - // Records num_dex_registers for every StackMapEntry and InlineInfoEntry. - // Only used in debug builds to verify the dex registers at the end. - std::vector dcheck_num_dex_registers_; + // A set of lambda functions to be executed at the end to verify + // the encoded data. It is generally only used in debug builds. + std::vector> dchecks_; DISALLOW_COPY_AND_ASSIGN(StackMapStream); }; -- cgit v1.2.3-59-g8ed1b