8008555: Debugging code in compiled method sometimes leaks memory

Support for strings that have same life-time as code that uses them.

Reviewed-by: kvn, twisti
This commit is contained in:
Roland Westrelin 2013-03-18 13:19:06 +01:00
parent d824b431de
commit 8f1814d874
16 changed files with 174 additions and 121 deletions

View file

@ -48,12 +48,12 @@ class InterpreterCodelet: public Stub {
int _size; // the size in bytes
const char* _description; // a description of the codelet, for debugging & printing
Bytecodes::Code _bytecode; // associated bytecode if any
DEBUG_ONLY(CodeComments _comments;) // Comments for annotating assembler output.
DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output.
public:
// Initialization/finalization
void initialize(int size,
CodeComments& comments) { _size = size; DEBUG_ONLY(_comments.assign(comments);) }
CodeStrings& strings) { _size = size; DEBUG_ONLY(_strings.assign(strings);) }
void finalize() { ShouldNotCallThis(); }
// General info/converters
@ -131,7 +131,7 @@ class CodeletMark: ResourceMark {
// commit Codelet
AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->comments());
AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings());
// make sure nobody can use _masm outside a CodeletMark lifespan
*_masm = NULL;
}