annotate src/hotspot/share/oops/metadata.cpp @ 51314:82adcc8ad853

8208604: Metadata::print_value_string() compares 'this' to NULL Summary: Remove the comparison and add asserts to check for NULL Reviewed-by: coleenp, gziemski
author hseigel
date Mon, 06 Aug 2018 14:20:58 -0400
parents 71c04702a3d5
children 33fe50b6d707
rev   line source
coleenp@13728 1 /*
hseigel@51314 2 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
coleenp@13728 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
coleenp@13728 4 *
coleenp@13728 5 * This code is free software; you can redistribute it and/or modify it
coleenp@13728 6 * under the terms of the GNU General Public License version 2 only, as
coleenp@13728 7 * published by the Free Software Foundation.
coleenp@13728 8 *
coleenp@13728 9 * This code is distributed in the hope that it will be useful, but WITHOUT
coleenp@13728 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
coleenp@13728 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
coleenp@13728 12 * version 2 for more details (a copy is included in the LICENSE file that
coleenp@13728 13 * accompanied this code).
coleenp@13728 14 *
coleenp@13728 15 * You should have received a copy of the GNU General Public License version
coleenp@13728 16 * 2 along with this work; if not, write to the Free Software Foundation,
coleenp@13728 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
coleenp@13728 18 *
coleenp@13728 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
coleenp@13728 20 * or visit www.oracle.com if you need additional information or have any
coleenp@13728 21 * questions.
coleenp@13728 22 *
coleenp@13728 23 */
coleenp@13728 24
coleenp@13728 25 #include "precompiled.hpp"
coleenp@13728 26 #include "oops/metadata.hpp"
coleenp@13728 27 #include "memory/metaspace.hpp"
coleenp@13728 28 #include "memory/resourceArea.hpp"
coleenp@13728 29 #include "prims/jvmtiRedefineClasses.hpp"
coleenp@13728 30
coleenp@13728 31 void Metadata::set_on_stack(const bool value) {
coleenp@13728 32 // nothing to set for most metadata
coleenp@13728 33 // Can't inline because this materializes the vtable on some C++ compilers.
coleenp@13728 34 }
coleenp@13728 35
coleenp@13728 36 void Metadata::print_on(outputStream* st) const {
coleenp@13728 37 ResourceMark rm;
coleenp@13728 38 // print title
coleenp@13728 39 st->print("%s", internal_name());
coleenp@13728 40 print_address_on(st);
coleenp@13728 41 st->cr();
coleenp@13728 42 }
coleenp@13728 43
coleenp@13728 44 char* Metadata::print_value_string() const {
kvn@42650 45 char buf[256];
coleenp@13728 46 stringStream st(buf, sizeof(buf));
hseigel@51314 47 print_value_on(&st);
coleenp@13728 48 return st.as_string();
coleenp@13728 49 }