/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "code/nmethod.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "oops/methodDataOop.hpp"
#include "oops/methodOop.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/xmlstream.hpp"
_last_flush = 0;
_text_init._outer_xmlStream = this;
_text = &_text_init;
#ifdef ASSERT
_element_depth = 0;
_element_close_stack_ptr[0] = '\0';
#endif
// Make sure each log uses the same base for time stamps.
if (is_open()) {
}
}
#ifdef ASSERT
}
#endif
// Pass the given chars directly to _out.
if (!is_open()) return;
update_position(s, len);
}
// Pass the given chars directly to _out, except that
// we watch for special "<&>" chars.
// This is suitable for either attribute text or for body text.
// We don't fool with "<![CDATA[" quotes, just single-character entities.
// This makes it easier for dumb tools to parse the output.
if (!is_open()) return;
// All normally printed material goes inside XML quotes.
// This leaves the output free to include markup also.
// Scan the string looking for inadvertant "<&>" chars
char ch = s[i];
// Escape special chars.
switch (ch) {
// These are important only in attrs, but we do them always:
// This is a freebie.
}
if (written < i) {
written = i;
}
written++;
}
}
// Print the clean remainder. Usually, it is all of s.
}
}
// ------------------------------------------------------------------
// Outputs XML text, with special characters quoted.
}
// ------------------------------------------------------------------
print_raw("<");
}
#ifdef ASSERT
/// Debugging goo to make sure element tags nest properly.
// ------------------------------------------------------------------
if (!push) return;
// tag goes up until either null or space:
// push the tag onto the stack, pulling down the pointer
}
_element_depth += 1;
}
// ------------------------------------------------------------------
bool bad_tag = false;
_element_depth -= 1;
bad_tag = true;
}
if (*cur_tag == 0) {
bad_tag = true;
} else {
// Pop the stack, by skipping over the tag and its null.
_element_depth -= 1;
}
{
assert(false, "bad tag in log");
}
}
#endif
// ------------------------------------------------------------------
// First word in formatted string is element kind, and any subsequent
// words must be XML attributes. Outputs "<kind .../>".
}
// ------------------------------------------------------------------
end_elem();
}
// ------------------------------------------------------------------
// First word in formatted string is element kind, and any subsequent
// words must be XML attributes. Outputs "<kind ...", not including "/>".
}
// ------------------------------------------------------------------
}
// ------------------------------------------------------------------
// Outputs "/>".
print_raw("/>\n");
}
// ------------------------------------------------------------------
// Outputs formatted text, followed by "/>".
end_elem();
}
// ------------------------------------------------------------------
// First word in formatted string is element kind, and any subsequent
// words must be XML attributes. Outputs "<kind ...>".
}
// ------------------------------------------------------------------
end_head();
}
// ------------------------------------------------------------------
// First word in formatted string is element kind, and any subsequent
// words must be XML attributes. Outputs "<kind ...", not including ">".
}
// ------------------------------------------------------------------
}
// ------------------------------------------------------------------
// Outputs ">".
print_raw(">\n");
}
// ------------------------------------------------------------------
// Outputs formatted text, followed by ">".
end_head();
}
// ------------------------------------------------------------------
// Outputs "</kind>".
print_raw("</");
print_raw(">\n");
}
// ------------------------------------------------------------------
// Outputs "<kind_done ... stamp='D.DD'/> </kind>".
}
// ------------------------------------------------------------------
// Outputs "<kind_done stamp='D.DD'/> </kind>".
// Because done_raw() doesn't need to format strings, it's simpler than
// done(), and can be called safely by fatal error handler.
print_raw("<");
print_raw("_done stamp='");
print_raw_cr("'/>");
print_raw("</");
print_raw_cr(">");
}
// ------------------------------------------------------------------
// Output the trailing event with the timestamp.
stamp();
end_elem();
// Output the tail-tag of the enclosing element.
}
// Output a timestamp attribute.
print_raw(" stamp='");
print_raw("'");
}
// ------------------------------------------------------------------
// This is used only when there is no ciMethod available.
print_raw(" method='");
}
}
}
//method->print_short_name(text());
}
// ------------------------------------------------------------------
// This is used only when there is no ciKlass available.
print_raw(" klass='");
print_raw("'");
}
//klass->print_short_name(log->out());
}
print_raw(" name='");
print_raw("'");
}
//name->print_short_name(text());
}
if (x.is_null()) return;
print_raw(" ");
print_raw("='");
object_text(x);
print_raw("'");
}
if (x.is_null()) return;
//x->print_value_on(text());
if (x->is_method())
method_text(methodOop(x()));
else if (x->is_klass())
klass_text(klassOop(x()));
else
x->print_value_on(text());
}
_last_flush = count();
}
if (_outer_xmlStream == NULL) return;
}
if (_outer_xmlStream == NULL) return;
}