8224624: Inefficiencies in CodeStrings::add_comment cause timeouts

Changing CodeStrings to a doubly-linked-list and searching for the comment with the right offset in reverse.

Reviewed-by: kvn
This commit is contained in:
Tobias Hartmann 2019-08-22 12:24:02 +02:00
parent 0941bf8b5e
commit 7cff981f5a
2 changed files with 29 additions and 9 deletions

View file

@ -249,6 +249,7 @@ class CodeStrings {
private:
#ifndef PRODUCT
CodeString* _strings;
CodeString* _strings_last;
#ifdef ASSERT
// Becomes true after copy-out, forbids further use.
bool _defunct; // Zero bit pattern is "valid", see memset call in decode_env::decode_env
@ -262,6 +263,7 @@ private:
void set_null_and_invalidate() {
#ifndef PRODUCT
_strings = NULL;
_strings_last = NULL;
#ifdef ASSERT
_defunct = true;
#endif
@ -272,6 +274,7 @@ public:
CodeStrings() {
#ifndef PRODUCT
_strings = NULL;
_strings_last = NULL;
#ifdef ASSERT
_defunct = false;
#endif