Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2036333 | 1.4.0 | Ross Knippel | P3 | Resolved | Fixed | beta |
There's an incorrect re-declaration of the variable "check" in the
following that causes a "free" of the osr codeBlob to never be done
in the case where this thread loses a race to create the osr codeBlob
for a particular signature length.
// The generator method is implemented in runtime_<cpu>.cpp
OSRAdapter* OnStackReplacement::get_osr_adapter(int framesize) {
assert(UseOnStackReplacement, "on-stack replacement not used");
OSRAdapter* osr = NULL;
{ MutexLocker mu(AdapterCache_lock);
// This will potentially grow the array.
osr = _osr_adapters->at_grow(framesize);
}
// Need to create OSR adapter and update list.
if (osr == NULL) {
osr = OptoRuntime::generate_osr_blob(framesize);
if (osr == NULL) {
//CodeCache is probably full
return NULL;
}
OSRAdapter* check = NULL; <---------- correct declaration of check
{ MutexLocker mu(AdapterCache_lock);
// Grap lock and update cache. Check if someone else already updated the
list
OSRAdapter* check = _osr_adapters->at(framesize); <-------- bad re-decl.
if (check == NULL) {
_osr_adapters->at_put(framesize, osr);
}
}
// The adapter already existed
if (check != NULL) { <-------- test is always false because of bad re-decl.
MutexLocker mu(CodeCache_lock);
CodeCache::free(osr);
osr = check;
}
}
return osr;
}
following that causes a "free" of the osr codeBlob to never be done
in the case where this thread loses a race to create the osr codeBlob
for a particular signature length.
// The generator method is implemented in runtime_<cpu>.cpp
OSRAdapter* OnStackReplacement::get_osr_adapter(int framesize) {
assert(UseOnStackReplacement, "on-stack replacement not used");
OSRAdapter* osr = NULL;
{ MutexLocker mu(AdapterCache_lock);
// This will potentially grow the array.
osr = _osr_adapters->at_grow(framesize);
}
// Need to create OSR adapter and update list.
if (osr == NULL) {
osr = OptoRuntime::generate_osr_blob(framesize);
if (osr == NULL) {
//CodeCache is probably full
return NULL;
}
OSRAdapter* check = NULL; <---------- correct declaration of check
{ MutexLocker mu(AdapterCache_lock);
// Grap lock and update cache. Check if someone else already updated the
list
OSRAdapter* check = _osr_adapters->at(framesize); <-------- bad re-decl.
if (check == NULL) {
_osr_adapters->at_put(framesize, osr);
}
}
// The adapter already existed
if (check != NULL) { <-------- test is always false because of bad re-decl.
MutexLocker mu(CodeCache_lock);
CodeCache::free(osr);
osr = check;
}
}
return osr;
}
- backported by
-
JDK-2036333 duplicate osr adapter codeBlobs may not be freed
-
- Resolved
-