mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8253453: SourceFileInfoTable should be allocated lazily
Reviewed-by: neliasso, chagedorn
This commit is contained in:
parent
e10b53853a
commit
e9be2db7ac
1 changed files with 12 additions and 5 deletions
|
@ -202,10 +202,17 @@ class decode_env {
|
||||||
15889, // prime number
|
15889, // prime number
|
||||||
ResourceObj::C_HEAP> SourceFileInfoTable;
|
ResourceObj::C_HEAP> SourceFileInfoTable;
|
||||||
|
|
||||||
static SourceFileInfoTable _src_table;
|
static SourceFileInfoTable* _src_table;
|
||||||
static const char* _cached_src;
|
static const char* _cached_src;
|
||||||
static GrowableArray<const char*>* _cached_src_lines;
|
static GrowableArray<const char*>* _cached_src_lines;
|
||||||
|
|
||||||
|
static SourceFileInfoTable& src_table() {
|
||||||
|
if (_src_table == NULL) {
|
||||||
|
_src_table = new (ResourceObj::C_HEAP, mtCode)SourceFileInfoTable();
|
||||||
|
}
|
||||||
|
return *_src_table;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
decode_env(CodeBuffer* code, outputStream* output);
|
decode_env(CodeBuffer* code, outputStream* output);
|
||||||
decode_env(CodeBlob* code, outputStream* output, CodeStrings c = CodeStrings() /* , ptrdiff_t offset */);
|
decode_env(CodeBlob* code, outputStream* output, CodeStrings c = CodeStrings() /* , ptrdiff_t offset */);
|
||||||
|
@ -229,7 +236,7 @@ class decode_env {
|
||||||
|
|
||||||
bool decode_env::_optionsParsed = false;
|
bool decode_env::_optionsParsed = false;
|
||||||
|
|
||||||
decode_env::SourceFileInfoTable decode_env::_src_table;
|
decode_env::SourceFileInfoTable* decode_env::_src_table = NULL;
|
||||||
const char* decode_env::_cached_src = NULL;
|
const char* decode_env::_cached_src = NULL;
|
||||||
GrowableArray<const char*>* decode_env::_cached_src_lines = NULL;
|
GrowableArray<const char*>* decode_env::_cached_src_lines = NULL;
|
||||||
|
|
||||||
|
@ -238,17 +245,17 @@ void decode_env::hook(const char* file, int line, address pc) {
|
||||||
// necessary as we add to the table only when PrintInterpreter is true,
|
// necessary as we add to the table only when PrintInterpreter is true,
|
||||||
// which means we are debugging the VM and a little bit of extra
|
// which means we are debugging the VM and a little bit of extra
|
||||||
// memory usage doesn't matter.
|
// memory usage doesn't matter.
|
||||||
SourceFileInfo* found = _src_table.get(pc);
|
SourceFileInfo* found = src_table().get(pc);
|
||||||
if (found != NULL) {
|
if (found != NULL) {
|
||||||
found->append(file, line);
|
found->append(file, line);
|
||||||
} else {
|
} else {
|
||||||
SourceFileInfo sfi(file, line);
|
SourceFileInfo sfi(file, line);
|
||||||
_src_table.put(pc, sfi); // sfi is copied by value
|
src_table().put(pc, sfi); // sfi is copied by value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void decode_env::print_hook_comments(address pc, bool newline) {
|
void decode_env::print_hook_comments(address pc, bool newline) {
|
||||||
SourceFileInfo* found = _src_table.get(pc);
|
SourceFileInfo* found = src_table().get(pc);
|
||||||
outputStream* st = output();
|
outputStream* st = output();
|
||||||
if (found != NULL) {
|
if (found != NULL) {
|
||||||
for (SourceFileInfo::Link *link = found->head; link; link = link->next) {
|
for (SourceFileInfo::Link *link = found->head; link; link = link->next) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue