-
Bug
-
Resolution: Fixed
-
P4
-
8u112, 9
-
b89
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142682 | emb-9 | Zoltan Majo | P4 | Resolved | Fixed | team |
Freeing _classid in the destructor of RegClass is likely to be erronous. Here is the explanation provided by Krystal Mok:
"When I was looking at the call chain that leads to RegClass' constructor, get_ident() is what's passed into RegClass as classid.
The comment on get_ident_common() says:
http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/ac291bc3ece2/src/share/vm/adlc/adlparse.cpp#l4560
//------------------------------get_ident_common-------------------------------
// Looks for an identifier in the buffer, and turns it into a null terminated
// string(still inside the file buffer). Returns a pointer to the string or
// NULL if some other token is found instead.
char *ADLParser::get_ident_common(bool do_preproc) {
So normally, the string returned should be still inside the file buffer (if no preprocessing is needed...), and shouldn't need to be free'd afterwards; but if preprocessing is needed, then yes, there's dynamically allocated memory for the string returned.
get_ident() is get_ident_common(true), so it's possible that preprocessing is needed; but from the RegClass constructor, it'd be hard to tell whether the string passed in is from the file buffer or from a dynamically allocated piece of memory."
"When I was looking at the call chain that leads to RegClass' constructor, get_ident() is what's passed into RegClass as classid.
The comment on get_ident_common() says:
http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/ac291bc3ece2/src/share/vm/adlc/adlparse.cpp#l4560
//------------------------------get_ident_common-------------------------------
// Looks for an identifier in the buffer, and turns it into a null terminated
// string(still inside the file buffer). Returns a pointer to the string or
// NULL if some other token is found instead.
char *ADLParser::get_ident_common(bool do_preproc) {
So normally, the string returned should be still inside the file buffer (if no preprocessing is needed...), and shouldn't need to be free'd afterwards; but if preprocessing is needed, then yes, there's dynamically allocated memory for the string returned.
get_ident() is get_ident_common(true), so it's possible that preprocessing is needed; but from the RegClass constructor, it'd be hard to tell whether the string passed in is from the file buffer or from a dynamically allocated piece of memory."
- backported by
-
JDK-8142682 erronous free in RegClass::~RegClass()
-
- Resolved
-
- relates to
-
JDK-8075798 Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
-
- Resolved
-