compileLog.cpp revision 1472
1472N/A * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A#
include "incls/_precompiled.incl" 0N/A// ------------------------------------------------------------------ 0N/A// CompileLog::CompileLog 0N/A // link into the global list 0N/A// Advance kind up to a null or space, return this tail. 0N/A// Make sure kind is null-terminated, not space-terminated. 0N/A// Use the buffer if necessary. 0N/A // Tease apart the first word from the rest: 0N/A return "";
// no attrs, no split 0N/A // park it in the buffer, so we can put a null on the end 0N/A// see_tag, pop_tag: Override the default do-nothing methods on xmlStream. 0N/A// These methods provide a hook for managing the the extra context markup. 0N/A// ------------------------------------------------------------------ 0N/A// CompileLog::identify 0N/A // If it has already been identified, just return the id. 0N/A // Lengthen the array, if necessary. 0N/A // Mark this id as processed. 0N/A // (Be sure to do this before any recursive calls to identify.) 0N/A // Now, print the object's identity once, in detail. 0N/A // Pre-identify items that we will need! 0N/A // output a few metrics 0N/A //print(" count='%d'", method->invocation_count()); 0N/A //int bec = method->backedge_count(); 0N/A //if (bec != 0) print(" backedge_count='%d'", bec); 0N/A // Should not happen. 0N/A// ------------------------------------------------------------------ 0N/A// CompileLog::clear_identities 0N/A// Forget which identities have been printed. 0N/A// ------------------------------------------------------------------ 0N/A// CompileLog::finish_log_on_error 0N/A// Note: This function is called after fatal error, avoid unnecessary memory 0N/A// or stack allocation, use only async-safe functions. It's possible JVM is 0N/A// only partially initialized. 0N/A // strings, here we use snprintf() and print_raw() instead. 0N/A // Copy data up to the end of the last <event> element: 0N/A // Copy any remaining data inside a quote: 0N/A int end_cdata = 0;
// state machine [0..2] watching for too many "]]" 0N/A // The rest of this loop amounts to a simple copy operation: 0N/A // { file->write(buf, nr); } 0N/A // However, it must sometimes output the buffer in parts, 0N/A // in case there is a CDATA quote embedded in the fragment. 0N/A const char*
bufp;
// pointer into buf 0N/A size_t nw;
// number written in each pass of the following loop: 0N/A // Write up to any problematic CDATA delimiter (usually all of nr). 0N/A // First, scan ahead into the buf, checking the state machine. 0N/A continue;
// keep scanning 0N/A // else fall through: 0N/A continue;
// keep scanning 0N/A // If we get here, nw is pointing at a bad '>'. 0N/A // It is very rare for this to happen. 0N/A // However, this code has been tested by introducing 0N/A // CDATA sequences into the compilation log. 0N/A // Now nw is the number of characters to write, usually == nr. 0N/A // We are about to go around the loop again. 0N/A // But first, disrupt the ]]> by closing and reopening the quote. 0N/A// ------------------------------------------------------------------ 0N/A// CompileLog::finish_log 0N/A// Called during normal shutdown. For now, any clean-up needed in normal 0N/A// shutdown is also needed in VM abort, so is covered by finish_log_on_error(). 0N/A// Just allocate a buffer and call finish_log_on_error().