comparison src/share/vm/utilities/debug.hpp @ 2152:0fa27f37d4d4

6977804: G1: remove the zero-filling thread Summary: This changeset removes the zero-filling thread from G1 and collapses the two free region lists we had before (the "free" and "unclean" lists) into one. The new free list uses the new heap region sets / lists abstractions that we'll ultimately use it to keep track of all regions in the heap. A heap region set was also introduced for the humongous regions. Finally, this change increases the concurrency between the thread that completes freeing regions (after a cleanup pause) and the rest of the system (before we'd have to wait for said thread to complete before allocating a new region). The changest also includes a lot of refactoring and code simplification. Reviewed-by: jcoomes, johnc
author tonyp
date Wed, 19 Jan 2011 19:30:42 -0500
parents f95d63e2154a
children 3582bf76420e
comparison
equal deleted inserted replaced
2151:cb913d743d09 2152:0fa27f37d4d4
32 // Simple class to format the ctor arguments into a fixed-sized buffer. 32 // Simple class to format the ctor arguments into a fixed-sized buffer.
33 template <size_t bufsz = 256> 33 template <size_t bufsz = 256>
34 class FormatBuffer { 34 class FormatBuffer {
35 public: 35 public:
36 inline FormatBuffer(const char * format, ...); 36 inline FormatBuffer(const char * format, ...);
37 inline void append(const char* format, ...);
37 operator const char *() const { return _buf; } 38 operator const char *() const { return _buf; }
38 39
39 private: 40 private:
40 FormatBuffer(const FormatBuffer &); // prevent copies 41 FormatBuffer(const FormatBuffer &); // prevent copies
41 42
46 template <size_t bufsz> 47 template <size_t bufsz>
47 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) { 48 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) {
48 va_list argp; 49 va_list argp;
49 va_start(argp, format); 50 va_start(argp, format);
50 vsnprintf(_buf, bufsz, format, argp); 51 vsnprintf(_buf, bufsz, format, argp);
52 va_end(argp);
53 }
54
55 template <size_t bufsz>
56 void FormatBuffer<bufsz>::append(const char* format, ...) {
57 // Given that the constructor does a vsnprintf we can assume that
58 // _buf is already initialized.
59 size_t len = strlen(_buf);
60 char* buf_end = _buf + len;
61
62 va_list argp;
63 va_start(argp, format);
64 vsnprintf(buf_end, bufsz - len, format, argp);
51 va_end(argp); 65 va_end(argp);
52 } 66 }
53 67
54 // Used to format messages for assert(), guarantee(), fatal(), etc. 68 // Used to format messages for assert(), guarantee(), fatal(), etc.
55 typedef FormatBuffer<> err_msg; 69 typedef FormatBuffer<> err_msg;