Mercurial > hg > truffle
annotate src/share/vm/utilities/defaultStream.hpp @ 20543:e7d0505c8a30
8059758: Footprint regressions with JDK-8038423
Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything.
Reviewed-by: jwilhelm, brutisso
author | tschatzl |
---|---|
date | Fri, 10 Oct 2014 15:51:58 +0200 |
parents | f95d63e2154a |
children | a4fdab16b621 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_UTILITIES_DEFAULTSTREAM_HPP |
26 #define SHARE_VM_UTILITIES_DEFAULTSTREAM_HPP | |
27 | |
28 #include "utilities/xmlstream.hpp" | |
29 | |
0 | 30 class defaultStream : public xmlTextStream { |
31 friend void ostream_abort(); | |
32 public: | |
33 enum { NO_WRITER = -1 }; | |
34 private: | |
35 bool _inited; | |
36 fileStream* _log_file; // XML-formatted file shared by all threads | |
37 static int _output_fd; | |
38 static int _error_fd; | |
39 static FILE* _output_stream; | |
40 static FILE* _error_stream; | |
41 | |
42 void init(); | |
43 void init_log(); | |
44 void finish_log(); | |
45 void finish_log_on_error(char *buf, int buflen); | |
46 public: | |
47 // must defer time stamp due to the fact that os::init() hasn't | |
48 // yet been called and os::elapsed_counter() may not be valid | |
49 defaultStream() { | |
50 _log_file = NULL; | |
51 _inited = false; | |
52 _writer = -1; | |
53 _last_writer = -1; | |
54 } | |
55 | |
56 ~defaultStream() { | |
57 if (has_log_file()) finish_log(); | |
58 } | |
59 | |
60 static inline FILE* output_stream() { | |
61 return DisplayVMOutputToStderr ? _error_stream : _output_stream; | |
62 } | |
63 static inline FILE* error_stream() { | |
64 return DisplayVMOutputToStdout ? _output_stream : _error_stream; | |
65 } | |
66 static inline int output_fd() { | |
67 return DisplayVMOutputToStderr ? _error_fd : _output_fd; | |
68 } | |
69 static inline int error_fd() { | |
70 return DisplayVMOutputToStdout ? _output_fd : _error_fd; | |
71 } | |
72 | |
73 virtual void write(const char* s, size_t len); | |
74 | |
75 void flush() { | |
76 // once we can determine whether we are in a signal handler, we | |
77 // should add the following assert here: | |
78 // assert(xxxxxx, "can not flush buffer inside signal handler"); | |
79 xmlTextStream::flush(); | |
80 fflush(output_stream()); | |
81 if (has_log_file()) _log_file->flush(); | |
82 } | |
83 | |
84 // advisory lock/unlock of _writer field: | |
85 private: | |
86 intx _writer; // thread_id with current rights to output | |
87 intx _last_writer; | |
88 public: | |
89 intx hold(intx writer_id); | |
90 void release(intx holder); | |
91 intx writer() { return _writer; } | |
92 bool has_log_file(); | |
93 | |
94 static defaultStream* instance; // sole instance | |
95 }; | |
1972 | 96 |
97 #endif // SHARE_VM_UTILITIES_DEFAULTSTREAM_HPP |