< prev index next >

src/share/vm/logging/logStream.cpp

Print this page
rev 13288 : imported patch 8181917-refactor-ul-logstream
rev 13289 : [mq]: 8181917-refactor-ul-logstream-delta

*** 51,61 **** assert(_cap <= reasonable_max, "sanity"); if (_cap == reasonable_max) { return; } ! size_t newcap = align_up(atleast + 64, 64); if (newcap > reasonable_max) { log_info(logging)("Suspiciously long log line: \"%.100s%s", _buf, (_pos >= 100 ? "..." : "")); newcap = reasonable_max; } --- 51,62 ---- assert(_cap <= reasonable_max, "sanity"); if (_cap == reasonable_max) { return; } ! const size_t additional_expansion = 256; ! size_t newcap = align_up(atleast + additional_expansion, additional_expansion); if (newcap > reasonable_max) { log_info(logging)("Suspiciously long log line: \"%.100s%s", _buf, (_pos >= 100 ? "..." : "")); newcap = reasonable_max; }
*** 77,91 **** } void LogStream::LineBuffer::append(const char* s, size_t len) { assert(_buf[_pos] == '\0', "sanity"); assert(_pos < _cap, "sanity"); ! try_ensure_cap(_pos + len + 1); // try_ensure_cap may not have enlarged the capacity to the full requested // extend or may have not worked at all. In that case, just gracefully work // with what we have already; just truncate if necessary. ! if (_pos + len + 1 > _cap) { len = _cap - _pos - 1; if (len == 0) { return; } } --- 78,93 ---- } void LogStream::LineBuffer::append(const char* s, size_t len) { assert(_buf[_pos] == '\0', "sanity"); assert(_pos < _cap, "sanity"); ! const size_t minimum_capacity_needed = _pos + len + 1; ! try_ensure_cap(minimum_capacity_needed); // try_ensure_cap may not have enlarged the capacity to the full requested // extend or may have not worked at all. In that case, just gracefully work // with what we have already; just truncate if necessary. ! if (_cap < minimum_capacity_needed) { len = _cap - _pos - 1; if (len == 0) { return; } }
*** 100,110 **** } void LogStream::write(const char* s, size_t len) { if (len > 0 && s[len - 1] == '\n') { _current_line.append(s, len - 1); // omit the newline. ! _log_handle.print("%s", _current_line.ptr()); _current_line.reset(); } else { _current_line.append(s, len); } update_position(s, len); --- 102,112 ---- } void LogStream::write(const char* s, size_t len) { if (len > 0 && s[len - 1] == '\n') { _current_line.append(s, len - 1); // omit the newline. ! _log_handle.print("%s", _current_line.buffer()); _current_line.reset(); } else { _current_line.append(s, len); } update_position(s, len);
< prev index next >