ART: Fix RegTypeCache for instance field declaring class

For bytecode instruction:

  iget(-*) ClassB->field:type

where the resolved field is actually declared in ClassA (ClassB
extends ClassA), MethodVerifier would create a RegType representing
ClassA but cache it under the descriptor "ClassB".

This is a bug but does not have any implications on correctness
because earlier resolution of ClassB (part of IGET handling) creates
another cache entry with the "ClassB" descriptor. Because the latter,
wrong entry is always imprecise (ClassA cannot be final because ClassB
extends it), either the earlier entry will be discovered or neither
of them will be a match.

Descriptor was replaced with the correct one and a DCHECK added when
creating a RegType to make sure the descriptor matches.

Bug: 30458218
Change-Id: I19e1bdd5dd79e5eac558122a06b9128d0a5c021f
Test: m test-art-host-run-test
Test: art/test/run-test --host 800-smali
5 files changed