Path: blob/master/src/hotspot/share/compiler/compileLog.hpp
40930 views
/*1* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_COMPILER_COMPILELOG_HPP25#define SHARE_COMPILER_COMPILELOG_HPP2627#include "utilities/xmlstream.hpp"2829class ciBaseObject;30class ciKlass;31class ciObject;32class ciMetadata;33class ciSymbol;3435// CompileLog36//37// An open stream for logging information about activities in a38// compiler thread. There is exactly one per CompilerThread,39// if the +LogCompilation switch is enabled.40class CompileLog : public xmlStream {41private:42const char* _file; // name of file where XML goes43julong _file_end; // last good end of file44intx _thread_id; // which compile thread4546stringStream _context; // optional, killable context marker47char _context_buffer[100];4849char* _identities; // array of boolean50int _identities_limit;51int _identities_capacity;5253CompileLog* _next; // static chain of all logs5455static CompileLog* _first; // head of static chain5657void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);5859public:60CompileLog(const char* file_name, FILE* fp, intx thread_id);61~CompileLog();6263intx thread_id() { return _thread_id; }64const char* file() { return _file; }6566// Optional context marker, to help place actions that occur during67// parsing. If there is no log output until the next context string68// or reset, context string will be silently ignored69stringStream* context() { return &_context; }70void clear_context() { context()->reset(); }71void set_context(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);7273void name(ciSymbol* s); // name='s'74void name(Symbol* s) { xmlStream::name(s); }75void name(ciKlass* k);7677// Output an object description, return obj->ident().78int identify(ciBaseObject* obj);79void clear_identities();8081void inline_fail (const char* reason);82void inline_success(const char* reason);8384// virtuals85virtual void see_tag(const char* tag, bool push);86virtual void pop_tag(const char* tag);8788// make a provisional end of log mark89void mark_file_end() { _file_end = out()->count(); }9091// Print code cache statistics92void code_cache_state();9394// copy all logs to the given stream95static void finish_log(outputStream* out);96static void finish_log_on_error(outputStream* out, char *buf, int buflen);97};9899#endif // SHARE_COMPILER_COMPILELOG_HPP100101102