annotate src/share/vm/oops/metadata.hpp @ 5820:87ee5ee27509

Added tag jdk8-b132 for changeset 0c94c41dcd70
author katleman
date Tue, 04 Mar 2014 11:51:03 -0800
parents
children
rev   line source
coleenp@3602 1 /*
coleenp@3602 2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
coleenp@3602 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
coleenp@3602 4 *
coleenp@3602 5 * This code is free software; you can redistribute it and/or modify it
coleenp@3602 6 * under the terms of the GNU General Public License version 2 only, as
coleenp@3602 7 * published by the Free Software Foundation.
coleenp@3602 8 *
coleenp@3602 9 * This code is distributed in the hope that it will be useful, but WITHOUT
coleenp@3602 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
coleenp@3602 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
coleenp@3602 12 * version 2 for more details (a copy is included in the LICENSE file that
coleenp@3602 13 * accompanied this code).
coleenp@3602 14 *
coleenp@3602 15 * You should have received a copy of the GNU General Public License version
coleenp@3602 16 * 2 along with this work; if not, write to the Free Software Foundation,
coleenp@3602 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
coleenp@3602 18 *
coleenp@3602 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
coleenp@3602 20 * or visit www.oracle.com if you need additional information or have any
coleenp@3602 21 * questions.
coleenp@3602 22 *
coleenp@3602 23 */
coleenp@3602 24
coleenp@3602 25 #ifndef SHARE_VM_OOPS_METADATA_HPP
coleenp@3602 26 #define SHARE_VM_OOPS_METADATA_HPP
coleenp@3602 27
coleenp@3602 28 #include "utilities/exceptions.hpp"
coleenp@3602 29 #include "utilities/globalDefinitions.hpp"
coleenp@3602 30 #include "utilities/ostream.hpp"
coleenp@3602 31
coleenp@3602 32 // This is the base class for an internal Class related metadata
coleenp@3602 33 class Metadata : public MetaspaceObj {
coleenp@3602 34 // Debugging hook to check that the metadata has not been deleted.
coleenp@3602 35 NOT_PRODUCT(int _valid;)
coleenp@3602 36 public:
coleenp@3602 37 NOT_PRODUCT(Metadata() { _valid = 0; })
coleenp@3602 38 NOT_PRODUCT(bool is_valid() const volatile { return _valid == 0; })
coleenp@3602 39
coleenp@3602 40 int identity_hash() { return (int)(uintptr_t)this; }
coleenp@3602 41
coleenp@3602 42 // Rehashing support for tables containing pointers to this
coleenp@3602 43 unsigned int new_hash(jint seed) { ShouldNotReachHere(); return 0; }
coleenp@3602 44
coleenp@3602 45 virtual bool is_klass() const volatile { return false; }
coleenp@3602 46 virtual bool is_method() const volatile { return false; }
coleenp@3602 47 virtual bool is_methodData() const volatile { return false; }
coleenp@3602 48 virtual bool is_constantPool() const volatile { return false; }
coleenp@3602 49
coleenp@3602 50 virtual const char* internal_name() const = 0;
coleenp@3602 51
coleenp@3602 52 void print() const { print_on(tty); }
coleenp@3602 53 void print_value() const { print_value_on(tty); }
coleenp@3602 54
coleenp@3602 55 void print_maybe_null() const { print_on_maybe_null(tty); }
coleenp@3602 56 void print_on_maybe_null(outputStream* st) const {
coleenp@3602 57 if (this == NULL)
coleenp@3602 58 st->print("NULL");
coleenp@3602 59 else
coleenp@3602 60 print_on(tty);
coleenp@3602 61 }
coleenp@3602 62 void print_value_on_maybe_null(outputStream* st) const {
coleenp@3602 63 if (this == NULL)
coleenp@3602 64 st->print("NULL");
coleenp@3602 65 else
coleenp@3602 66 print_value_on(tty);
coleenp@3602 67 }
coleenp@3602 68
coleenp@3602 69 virtual void print_on(outputStream* st) const; // First level print
coleenp@3602 70 virtual void print_value_on(outputStream* st) const = 0; // Second level print
coleenp@3602 71
coleenp@3602 72 char* print_value_string() const;
coleenp@3602 73
coleenp@3602 74 // Used to keep metadata alive during class redefinition
coleenp@3602 75 // Can't assert because is called for delete functions (as an assert)
coleenp@3602 76 virtual bool on_stack() const { return false; }
coleenp@3602 77 virtual void set_on_stack(const bool value);
coleenp@3602 78
coleenp@3602 79 // Set on_stack bit, so that the metadata is not cleared
coleenp@3602 80 // during class redefinition. This is a virtual call because only methods
coleenp@3602 81 // and constant pools need to be set, but someday instanceKlasses might also.
coleenp@3602 82 static void mark_on_stack(Metadata* m) { m->set_on_stack(true); }
coleenp@3602 83 };
coleenp@3602 84
coleenp@3602 85 #endif // SHARE_VM_OOPS_METADATA_HPP