Wed, 24 Feb 2010 07:00:33 -0800
6928081: G1: rename parameters common with CMS
Summary: Rename marking stack sizing flags to be common between G1 and CMS
Reviewed-by: ysr, tonyp
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | class defaultStream : public xmlTextStream { |
duke@435 | 26 | friend void ostream_abort(); |
duke@435 | 27 | public: |
duke@435 | 28 | enum { NO_WRITER = -1 }; |
duke@435 | 29 | private: |
duke@435 | 30 | bool _inited; |
duke@435 | 31 | fileStream* _log_file; // XML-formatted file shared by all threads |
duke@435 | 32 | static int _output_fd; |
duke@435 | 33 | static int _error_fd; |
duke@435 | 34 | static FILE* _output_stream; |
duke@435 | 35 | static FILE* _error_stream; |
duke@435 | 36 | |
duke@435 | 37 | void init(); |
duke@435 | 38 | void init_log(); |
duke@435 | 39 | void finish_log(); |
duke@435 | 40 | void finish_log_on_error(char *buf, int buflen); |
duke@435 | 41 | public: |
duke@435 | 42 | // must defer time stamp due to the fact that os::init() hasn't |
duke@435 | 43 | // yet been called and os::elapsed_counter() may not be valid |
duke@435 | 44 | defaultStream() { |
duke@435 | 45 | _log_file = NULL; |
duke@435 | 46 | _inited = false; |
duke@435 | 47 | _writer = -1; |
duke@435 | 48 | _last_writer = -1; |
duke@435 | 49 | } |
duke@435 | 50 | |
duke@435 | 51 | ~defaultStream() { |
duke@435 | 52 | if (has_log_file()) finish_log(); |
duke@435 | 53 | } |
duke@435 | 54 | |
duke@435 | 55 | static inline FILE* output_stream() { |
duke@435 | 56 | return DisplayVMOutputToStderr ? _error_stream : _output_stream; |
duke@435 | 57 | } |
duke@435 | 58 | static inline FILE* error_stream() { |
duke@435 | 59 | return DisplayVMOutputToStdout ? _output_stream : _error_stream; |
duke@435 | 60 | } |
duke@435 | 61 | static inline int output_fd() { |
duke@435 | 62 | return DisplayVMOutputToStderr ? _error_fd : _output_fd; |
duke@435 | 63 | } |
duke@435 | 64 | static inline int error_fd() { |
duke@435 | 65 | return DisplayVMOutputToStdout ? _output_fd : _error_fd; |
duke@435 | 66 | } |
duke@435 | 67 | |
duke@435 | 68 | virtual void write(const char* s, size_t len); |
duke@435 | 69 | |
duke@435 | 70 | void flush() { |
duke@435 | 71 | // once we can determine whether we are in a signal handler, we |
duke@435 | 72 | // should add the following assert here: |
duke@435 | 73 | // assert(xxxxxx, "can not flush buffer inside signal handler"); |
duke@435 | 74 | xmlTextStream::flush(); |
duke@435 | 75 | fflush(output_stream()); |
duke@435 | 76 | if (has_log_file()) _log_file->flush(); |
duke@435 | 77 | } |
duke@435 | 78 | |
duke@435 | 79 | // advisory lock/unlock of _writer field: |
duke@435 | 80 | private: |
duke@435 | 81 | intx _writer; // thread_id with current rights to output |
duke@435 | 82 | intx _last_writer; |
duke@435 | 83 | public: |
duke@435 | 84 | intx hold(intx writer_id); |
duke@435 | 85 | void release(intx holder); |
duke@435 | 86 | intx writer() { return _writer; } |
duke@435 | 87 | bool has_log_file(); |
duke@435 | 88 | |
duke@435 | 89 | static defaultStream* instance; // sole instance |
duke@435 | 90 | }; |