[9] RFR(XS): 8081288: erronous free in RegClass::~RegClass()

Zoltán Majó zoltan.majo at oracle.com
Thu Oct 8 12:36:58 UTC 2015


Hi,


please review the patch for JDK-8081288.

Bug: https://bugs.openjdk.java.net/browse/JDK-8081288


Problem: JDK-8075798 modified the destructor of RegClass to free the 
_classid field of that class:

http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/ac291bc3ece2#l5.50

This is bad software engineering practice because the _classid field 
points to a memory region *not* allocated by the class itself 
(allocation happens in ADLParser::get_ident_common); freeing the memory 
region in RegClass can also lead to errors if ADLParser is changed in 
the future to release memory it has allocated.

The problem was spotted by Krystal Mok.


Solution: Change code to not free _classid.

Webrev: http://cr.openjdk.java.net/~zmajo/8081288/webrev.00/

Testing: JPRT.

Thank you and best regards,


Zoltan



More information about the hotspot-compiler-dev mailing list