RFR(S): 8225670: compiler/types/correctness/* tests fail with "assert(recv == __null || recv->is_klass()) failed: wrong type"
christian.hagedorn at oracle.com
Thu Aug 8 11:38:10 UTC 2019
Please review the following patch:
As I reproduced the bug with , recv still pointed to an InstanceKlass
object at some point which was not translated to a ciInstanceKlass and
therefore the is_klass() check was false which made the assert fail. The
problem can be traced back to the concurrent forced clearing of method
data  using the whitebox API while compilation uses this profile data
to create a ciProfileData wrapper. The profile data, lets say 'pd', is
first completely copied  and then translated  to a ci version
'cipd'. Therefore, 'cipd' initially only contains InstanceKlass entries.
During this translation, we read instanceKlasses from 'pd'  and
translate them into ciInstanceKlasses to store them in 'cipd'. However,
while translating,  can delete a non-NULL InstanceKlass entry in 'pd'
by setting it to NULL. As a result, the non-NULL check  fails and
nothing is updated in 'cipd'. 'cipd' still contains a non-translated
non-NULL InstanceKlass entry from 'pd' which later triggers the
The fix is straight forward to also clear an entry in the ciProfileData
object if a klass is NULL in the ProfileData object. One question
remains that I could not figure out yet: Can the method profile data be
cleared while a method is compiled or is this only a problem specific to
this test using a forced clear through the whitebox API?
More information about the hotspot-compiler-dev