85 int width() const { return _width; }
86 int position() const { return _position; }
87 int newlines() const { return _newlines; }
88 julong count() const { return _precount + _position; }
89 void set_count(julong count) { _precount = count - _position; }
90 void set_position(int pos) { _position = pos; }
91
92 // printing
93 void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
94 void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
95 void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
96 void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
97 void print_raw(const char* str) { write(str, strlen(str)); }
98 void print_raw(const char* str, int len) { write(str, len); }
99 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); }
100 void print_raw_cr(const char* str, int len){ write(str, len); cr(); }
101 void print_data(void* data, size_t len, bool with_ascii);
102 void put(char ch);
103 void sp(int count = 1);
104 void cr();
105 void bol() { if (_position > 0) cr(); }
106
107 // Time stamp
108 TimeStamp& time_stamp() { return _stamp; }
109 void stamp();
110 void stamp(bool guard, const char* prefix, const char* suffix);
111 void stamp(bool guard) {
112 stamp(guard, "", ": ");
113 }
114 // Date stamp
115 void date_stamp(bool guard, const char* prefix, const char* suffix);
116 // A simplified call that includes a suffix of ": "
117 void date_stamp(bool guard) {
118 date_stamp(guard, "", ": ");
119 }
120
121 // portable printing of 64 bit integers
122 void print_jlong(jlong value);
123 void print_julong(julong value);
124
134
135 void dec_cr() { dec(); cr(); }
136 void inc_cr() { inc(); cr(); }
137 };
138
139 // standard output
140 // ANSI C++ name collision
141 extern outputStream* tty; // tty output
142
143 class streamIndentor : public StackObj {
144 private:
145 outputStream* _str;
146 int _amount;
147
148 public:
149 streamIndentor(outputStream* str, int amt = 2) : _str(str), _amount(amt) {
150 _str->inc(_amount);
151 }
152 ~streamIndentor() { _str->dec(_amount); }
153 };
154
155
156 // advisory locking for the shared tty stream:
157 class ttyLocker: StackObj {
158 friend class ttyUnlocker;
159 private:
160 intx _holder;
161
162 public:
163 static intx hold_tty(); // returns a "holder" token
164 static void release_tty(intx holder); // must witness same token
165 static bool release_tty_if_locked(); // returns true if lock was released
166 static void break_tty_lock_for_safepoint(intx holder);
167
168 ttyLocker() { _holder = hold_tty(); }
169 ~ttyLocker() { release_tty(_holder); }
170 };
171
172 // Release the tty lock if it's held and reacquire it if it was
173 // locked. Used to avoid lock ordering problems.
174 class ttyUnlocker: StackObj {
|
85 int width() const { return _width; }
86 int position() const { return _position; }
87 int newlines() const { return _newlines; }
88 julong count() const { return _precount + _position; }
89 void set_count(julong count) { _precount = count - _position; }
90 void set_position(int pos) { _position = pos; }
91
92 // printing
93 void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
94 void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
95 void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
96 void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
97 void print_raw(const char* str) { write(str, strlen(str)); }
98 void print_raw(const char* str, int len) { write(str, len); }
99 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); }
100 void print_raw_cr(const char* str, int len){ write(str, len); cr(); }
101 void print_data(void* data, size_t len, bool with_ascii);
102 void put(char ch);
103 void sp(int count = 1);
104 void cr();
105 void cr_indent();
106 void bol() { if (_position > 0) cr(); }
107
108 // Time stamp
109 TimeStamp& time_stamp() { return _stamp; }
110 void stamp();
111 void stamp(bool guard, const char* prefix, const char* suffix);
112 void stamp(bool guard) {
113 stamp(guard, "", ": ");
114 }
115 // Date stamp
116 void date_stamp(bool guard, const char* prefix, const char* suffix);
117 // A simplified call that includes a suffix of ": "
118 void date_stamp(bool guard) {
119 date_stamp(guard, "", ": ");
120 }
121
122 // portable printing of 64 bit integers
123 void print_jlong(jlong value);
124 void print_julong(julong value);
125
135
136 void dec_cr() { dec(); cr(); }
137 void inc_cr() { inc(); cr(); }
138 };
139
140 // standard output
141 // ANSI C++ name collision
142 extern outputStream* tty; // tty output
143
144 class streamIndentor : public StackObj {
145 private:
146 outputStream* _str;
147 int _amount;
148
149 public:
150 streamIndentor(outputStream* str, int amt = 2) : _str(str), _amount(amt) {
151 _str->inc(_amount);
152 }
153 ~streamIndentor() { _str->dec(_amount); }
154 };
155
156 // advisory locking for the shared tty stream:
157 class ttyLocker: StackObj {
158 friend class ttyUnlocker;
159 private:
160 intx _holder;
161
162 public:
163 static intx hold_tty(); // returns a "holder" token
164 static void release_tty(intx holder); // must witness same token
165 static bool release_tty_if_locked(); // returns true if lock was released
166 static void break_tty_lock_for_safepoint(intx holder);
167
168 ttyLocker() { _holder = hold_tty(); }
169 ~ttyLocker() { release_tty(_holder); }
170 };
171
172 // Release the tty lock if it's held and reacquire it if it was
173 // locked. Used to avoid lock ordering problems.
174 class ttyUnlocker: StackObj {
|