< prev index next >

src/hotspot/share/asm/codeBuffer.cpp

Print this page




1087   CodeString* next_comment() const {
1088     CodeString* s = _next;
1089     while (s != NULL && !s->is_comment()) {
1090       s = s->_next;
1091     }
1092     return s;
1093   }
1094 };
1095 
1096 CodeString* CodeStrings::find(intptr_t offset) const {
1097   CodeString* a = _strings->first_comment();
1098   while (a != NULL && a->offset() != offset) {
1099     a = a->next_comment();
1100   }
1101   return a;
1102 }
1103 
1104 // Convenience for add_comment.
1105 CodeString* CodeStrings::find_last(intptr_t offset) const {
1106   CodeString* a = _strings_last;
1107   while (a != NULL && !a->is_comment() && a->offset() > offset) {
1108     a = a->_prev;
1109   }
1110   return a;
1111 }
1112 
1113 void CodeStrings::add_comment(intptr_t offset, const char * comment) {
1114   check_valid();
1115   CodeString* c      = new CodeString(comment, offset);
1116   CodeString* inspos = (_strings == NULL) ? NULL : find_last(offset);
1117 
1118   if (inspos) {
1119     // insert after already existing comments with same offset
1120     c->set_next(inspos->next());
1121     inspos->set_next(c);
1122   } else {
1123     // no comments with such offset, yet. Insert before anything else.
1124     c->set_next(_strings);
1125     _strings = c;
1126   }
1127   if (c->next() == NULL) {




1087   CodeString* next_comment() const {
1088     CodeString* s = _next;
1089     while (s != NULL && !s->is_comment()) {
1090       s = s->_next;
1091     }
1092     return s;
1093   }
1094 };
1095 
1096 CodeString* CodeStrings::find(intptr_t offset) const {
1097   CodeString* a = _strings->first_comment();
1098   while (a != NULL && a->offset() != offset) {
1099     a = a->next_comment();
1100   }
1101   return a;
1102 }
1103 
1104 // Convenience for add_comment.
1105 CodeString* CodeStrings::find_last(intptr_t offset) const {
1106   CodeString* a = _strings_last;
1107   while (a != NULL && !(a->is_comment() && a->offset() == offset)) {
1108     a = a->_prev;
1109   }
1110   return a;
1111 }
1112 
1113 void CodeStrings::add_comment(intptr_t offset, const char * comment) {
1114   check_valid();
1115   CodeString* c      = new CodeString(comment, offset);
1116   CodeString* inspos = (_strings == NULL) ? NULL : find_last(offset);
1117 
1118   if (inspos) {
1119     // insert after already existing comments with same offset
1120     c->set_next(inspos->next());
1121     inspos->set_next(c);
1122   } else {
1123     // no comments with such offset, yet. Insert before anything else.
1124     c->set_next(_strings);
1125     _strings = c;
1126   }
1127   if (c->next() == NULL) {


< prev index next >