comparison src/share/vm/interpreter/interpreter.hpp @ 8767:a5de0cc2f91c

8008555: Debugging code in compiled method sometimes leaks memory Summary: support for strings that have same life-time as code that uses them. Reviewed-by: kvn, twisti
author roland
date Mon, 18 Mar 2013 13:19:06 +0100
parents b9a9ed0f8eeb
children de6a9e811145
comparison
equal deleted inserted replaced
8765:592f9722c72e 8767:a5de0cc2f91c
46 friend class VMStructs; 46 friend class VMStructs;
47 private: 47 private:
48 int _size; // the size in bytes 48 int _size; // the size in bytes
49 const char* _description; // a description of the codelet, for debugging & printing 49 const char* _description; // a description of the codelet, for debugging & printing
50 Bytecodes::Code _bytecode; // associated bytecode if any 50 Bytecodes::Code _bytecode; // associated bytecode if any
51 DEBUG_ONLY(CodeComments _comments;) // Comments for annotating assembler output. 51 DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output.
52 52
53 public: 53 public:
54 // Initialization/finalization 54 // Initialization/finalization
55 void initialize(int size, 55 void initialize(int size,
56 CodeComments& comments) { _size = size; DEBUG_ONLY(_comments.assign(comments);) } 56 CodeStrings& strings) { _size = size; DEBUG_ONLY(_strings.assign(strings);) }
57 void finalize() { ShouldNotCallThis(); } 57 void finalize() { ShouldNotCallThis(); }
58 58
59 // General info/converters 59 // General info/converters
60 int size() const { return _size; } 60 int size() const { return _size; }
61 static int code_size_to_size(int code_size) { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; } 61 static int code_size_to_size(int code_size) { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; }
129 // make sure all code is in code buffer 129 // make sure all code is in code buffer
130 (*_masm)->flush(); 130 (*_masm)->flush();
131 131
132 132
133 // commit Codelet 133 // commit Codelet
134 AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->comments()); 134 AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings());
135 // make sure nobody can use _masm outside a CodeletMark lifespan 135 // make sure nobody can use _masm outside a CodeletMark lifespan
136 *_masm = NULL; 136 *_masm = NULL;
137 } 137 }
138 }; 138 };
139 139