metadata.cpp revision 3602:da91efe96a93
188758Sache/*
288758Sache * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
388758Sache * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
488758Sache *
588758Sache * This code is free software; you can redistribute it and/or modify it
688758Sache * under the terms of the GNU General Public License version 2 only, as
788758Sache * published by the Free Software Foundation.
888758Sache *
988758Sache * This code is distributed in the hope that it will be useful, but WITHOUT
1088758Sache * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1188758Sache * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1288758Sache * version 2 for more details (a copy is included in the LICENSE file that
1388758Sache * accompanied this code).
1488758Sache *
1588758Sache * You should have received a copy of the GNU General Public License version
1688758Sache * 2 along with this work; if not, write to the Free Software Foundation,
1788758Sache * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1888758Sache *
1988758Sache * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2088758Sache * or visit www.oracle.com if you need additional information or have any
2188758Sache * questions.
2288758Sache *
2388758Sache */
2488758Sache
2588758Sache#include "precompiled.hpp"
2688758Sache#include "oops/metadata.hpp"
2788758Sache#include "memory/metaspace.hpp"
2888758Sache#include "memory/resourceArea.hpp"
2988758Sache#include "prims/jvmtiRedefineClasses.hpp"
3088758Sache
3188758Sachevoid Metadata::set_on_stack(const bool value) {
3288758Sache  // nothing to set for most metadata
3388758Sache  // Can't inline because this materializes the vtable on some C++ compilers.
3488758Sache}
3588758Sache
3688758Sachevoid Metadata::print_on(outputStream* st) const {
3788758Sache  ResourceMark rm;
3888758Sache  // print title
3988758Sache  st->print("%s", internal_name());
4088758Sache  print_address_on(st);
4188758Sache  st->cr();
4288758Sache}
4388758Sache
4488758Sachechar* Metadata::print_value_string() const {
4588758Sache  char buf[100];
4688758Sache  stringStream st(buf, sizeof(buf));
4788758Sache  if (this == NULL) {
4888758Sache    st.print("NULL");
4988758Sache  } else {
5088758Sache    print_value_on(&st);
5188758Sache  }
5288758Sache  return st.as_string();
5388758Sache}
5488758Sache