Do not create array classes of temporary component type
This commit fixes a bug in CreateArrayClass which allows racing threads
to create an array with a temporary class as its component type. The
problem manifests in production as a permanently broken array class
throwing ArrayStoreException on every write attempt.
Commit adds a runtime test reproducing the problem. The test uses a
misbehaving ClassLoader to deterministically reproduce necessary
conditions. In real life the problem can occur when JIT creates an array
class and fails to load the component type due to custom class loader -
if another thread started loading the component class then LookupClass
call in CreateArrayClass might acquire reference to a temporary class.
Test: ./art/test.py -r --host 2287-no-temp-component-class -b
Flag: EXEMPT bugfix
Change-Id: I4d75a7b59a15a0d1e9a50d8b527d10f9b3408014
9 files changed