< prev index next >

src/hotspot/share/asm/codeBuffer.cpp

Print this page

        

*** 1048,1083 **** class CodeString: public CHeapObj<mtCode> { private: friend class CodeStrings; const char * _string; CodeString* _next; - CodeString* _prev; intptr_t _offset; ~CodeString() { ! assert(_next == NULL && _prev == NULL, "wrong interface for freeing list"); os::free((void*)_string); } bool is_comment() const { return _offset >= 0; } public: CodeString(const char * string, intptr_t offset = -1) ! : _next(NULL), _prev(NULL), _offset(offset) { _string = os::strdup(string, mtCode); } const char * string() const { return _string; } intptr_t offset() const { assert(_offset >= 0, "offset for non comment?"); return _offset; } CodeString* next() const { return _next; } ! void set_next(CodeString* next) { ! _next = next; ! if (next != NULL) { ! next->_prev = this; ! } ! } CodeString* first_comment() { if (is_comment()) { return this; } else { --- 1048,1077 ---- class CodeString: public CHeapObj<mtCode> { private: friend class CodeStrings; const char * _string; CodeString* _next; intptr_t _offset; ~CodeString() { ! assert(_next == NULL, "wrong interface for freeing list"); os::free((void*)_string); } bool is_comment() const { return _offset >= 0; } public: CodeString(const char * string, intptr_t offset = -1) ! : _next(NULL), _offset(offset) { _string = os::strdup(string, mtCode); } const char * string() const { return _string; } intptr_t offset() const { assert(_offset >= 0, "offset for non comment?"); return _offset; } CodeString* next() const { return _next; } ! void set_next(CodeString* next) { _next = next; } CodeString* first_comment() { if (is_comment()) { return this; } else {
*** 1101,1113 **** return a; } // Convenience for add_comment. CodeString* CodeStrings::find_last(intptr_t offset) const { ! CodeString* a = _strings_last; ! while (a != NULL && !a->is_comment() && a->offset() > offset) { ! a = a->_prev; } return a; } void CodeStrings::add_comment(intptr_t offset, const char * comment) { --- 1095,1110 ---- return a; } // Convenience for add_comment. CodeString* CodeStrings::find_last(intptr_t offset) const { ! CodeString* a = find(offset); ! if (a != NULL) { ! CodeString* c = NULL; ! while (((c = a->next_comment()) != NULL) && (c->offset() == offset)) { ! a = c; ! } } return a; } void CodeStrings::add_comment(intptr_t offset, const char * comment) {
*** 1122,1141 **** } else { // no comments with such offset, yet. Insert before anything else. c->set_next(_strings); _strings = c; } - if (c->next() == NULL) { - _strings_last = c; - } } void CodeStrings::assign(CodeStrings& other) { other.check_valid(); assert(is_null(), "Cannot assign onto non-empty CodeStrings"); _strings = other._strings; - _strings_last = other._strings_last; #ifdef ASSERT _defunct = false; #endif other.set_null_and_invalidate(); } --- 1119,1134 ----
*** 1147,1161 **** other.check_valid(); check_valid(); assert(is_null(), "Cannot copy onto non-empty CodeStrings"); CodeString* n = other._strings; CodeString** ps = &_strings; - CodeString* prev = NULL; while (n != NULL) { *ps = new CodeString(n->string(),n->offset()); - (*ps)->_prev = prev; - prev = *ps; ps = &((*ps)->_next); n = n->next(); } } --- 1140,1151 ----
*** 1188,1214 **** CodeString* n = _strings; while (n) { // unlink the node from the list saving a pointer to the next CodeString* p = n->next(); n->set_next(NULL); - if (p != NULL) { - assert(p->_prev == n, "missing prev link"); - p->_prev = NULL; - } delete n; n = p; } set_null_and_invalidate(); } const char* CodeStrings::add_string(const char * string) { check_valid(); CodeString* s = new CodeString(string); s->set_next(_strings); - if (_strings == NULL) { - _strings_last = s; - } _strings = s; assert(s->string() != NULL, "should have a string"); return s->string(); } --- 1178,1197 ----
< prev index next >