src/share/vm/compiler/compileLog.hpp

Mon, 14 Jan 2013 13:52:08 -0500

author
vladidan
date
Mon, 14 Jan 2013 13:52:08 -0500
changeset 4438
9deda4d8e126
parent 4154
c3e799c37717
child 5226
813f26e34135
permissions
-rw-r--r--

8005204: Code Cache Reduction: command line options implementation
Summary: Adding more detailed output on CodeCache usage
Reviewed-by: kvn, vladidan
Contributed-by: Alexander Harlap <alexander.harlap@oracle.com>

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. 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 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_COMPILER_COMPILELOG_HPP
stefank@2314 26 #define SHARE_VM_COMPILER_COMPILELOG_HPP
stefank@2314 27
stefank@2314 28 #include "utilities/xmlstream.hpp"
stefank@2314 29
coleenp@4037 30 class ciBaseObject;
duke@435 31 class ciObject;
coleenp@4037 32 class ciMetadata;
duke@435 33 class ciSymbol;
duke@435 34
duke@435 35 // CompileLog
duke@435 36 //
duke@435 37 // An open stream for logging information about activities in a
duke@435 38 // compiler thread. There is exactly one per CompilerThread,
duke@435 39 // if the +LogCompilation switch is enabled.
duke@435 40 class CompileLog : public xmlStream {
duke@435 41 private:
duke@435 42 const char* _file; // name of file where XML goes
duke@435 43 julong _file_end; // last good end of file
duke@435 44 intx _thread_id; // which compile thread
duke@435 45
duke@435 46 stringStream _context; // optional, killable context marker
duke@435 47 char _context_buffer[100];
duke@435 48
duke@435 49 char* _identities; // array of boolean
duke@435 50 int _identities_limit;
duke@435 51 int _identities_capacity;
duke@435 52
duke@435 53 CompileLog* _next; // static chain of all logs
duke@435 54
duke@435 55 static CompileLog* _first; // head of static chain
duke@435 56
duke@435 57 void va_tag(bool push, const char* format, va_list ap);
duke@435 58
duke@435 59 public:
duke@435 60 CompileLog(const char* file, FILE* fp, intx thread_id);
duke@435 61 ~CompileLog();
duke@435 62
duke@435 63 intx thread_id() { return _thread_id; }
duke@435 64 const char* file() { return _file; }
vlivanov@4154 65
vlivanov@4154 66 // Optional context marker, to help place actions that occur during
vlivanov@4154 67 // parsing. If there is no log output until the next context string
vlivanov@4154 68 // or reset, context string will be silently ignored
duke@435 69 stringStream* context() { return &_context; }
vlivanov@4154 70 void clear_context() { context()->reset(); }
vlivanov@4154 71 void set_context(const char* format, ...);
duke@435 72
duke@435 73 void name(ciSymbol* s); // name='s'
coleenp@2497 74 void name(Symbol* s) { xmlStream::name(s); }
duke@435 75
duke@435 76 // Output an object description, return obj->ident().
coleenp@4037 77 int identify(ciBaseObject* obj);
duke@435 78 void clear_identities();
duke@435 79
vlivanov@4154 80 void inline_fail (const char* reason);
vlivanov@4154 81 void inline_success(const char* reason);
vlivanov@4154 82
duke@435 83 // virtuals
duke@435 84 virtual void see_tag(const char* tag, bool push);
duke@435 85 virtual void pop_tag(const char* tag);
duke@435 86
duke@435 87 // make a provisional end of log mark
duke@435 88 void mark_file_end() { _file_end = out()->count(); }
duke@435 89
vlivanov@4154 90 // Print code cache statistics
vlivanov@4154 91 void code_cache_state();
vlivanov@4154 92
duke@435 93 // copy all logs to the given stream
duke@435 94 static void finish_log(outputStream* out);
duke@435 95 static void finish_log_on_error(outputStream* out, char *buf, int buflen);
duke@435 96 };
stefank@2314 97
stefank@2314 98 #endif // SHARE_VM_COMPILER_COMPILELOG_HPP

mercurial