8216987: ciMethodData::load_data() unpacks MDOs with non-atomic copy

Doerr, Martin martin.doerr at sap.com
Mon Jan 14 15:30:09 UTC 2019

Hi Erik,

this looks good.

Best regards,

-----Original Message-----
From: hotspot-compiler-dev <hotspot-compiler-dev-bounces at openjdk.java.net> On Behalf Of Erik Österlund
Sent: Montag, 14. Januar 2019 16:18
To: hotspot compiler <hotspot-compiler-dev at openjdk.java.net>
Subject: 8216987: ciMethodData::load_data() unpacks MDOs with non-atomic copy


The ciMethodData::load_data() member function copies a raw MDO to the 
compiler mirror of said MDO. However, the copy is performed using a 
non-atomic copy function, despite being updated concurrently. This could 
potentially cause word tearing when reading metadata pointers, causing 
the VM to crash... in theory.

While this is not a problem when unpacking the extra data section, 
because it is done under a lock, the same can not be said about the rest 
of the MDO. So it should either be protected by a lock, or use an atomic 
copy function instead.

This patch adds an extra seat belt by performing atomic heap word copy 




More information about the hotspot-compiler-dev mailing list