Tolerate GC map being added twice, if it has the same contents
Change-Id: I3b973c06aa5b170e0b8fb7e28136b65fc8855880
diff --git a/src/dex_verifier.cc b/src/dex_verifier.cc
index 1b4a262..c219042 100644
--- a/src/dex_verifier.cc
+++ b/src/dex_verifier.cc
@@ -3840,7 +3840,11 @@
DexVerifier::GcMapTable DexVerifier::gc_maps_;
void DexVerifier::SetGcMap(Compiler::MethodReference ref, const std::vector<uint8_t>& gc_map) {
- CHECK(GetGcMap(ref) == NULL);
+ const std::vector<uint8_t>* existing_gc_map = GetGcMap(ref);
+ if (existing_gc_map != NULL) {
+ CHECK(*existing_gc_map == gc_map);
+ delete existing_gc_map;
+ }
gc_maps_[ref] = &gc_map;
CHECK(GetGcMap(ref) != NULL);
}