src/share/vm/oops/metadata.hpp

Mon, 16 Dec 2013 08:24:33 -0500

author
hseigel
date
Mon, 16 Dec 2013 08:24:33 -0500
changeset 6195
5832cdaf89c6
parent 4037
da91efe96a93
child 6351
f9e35a9dc8c7
permissions
-rw-r--r--

8027804: JCK resolveMethod test fails expecting AbstractMethodError
Summary: Create AME overpass methods and fix method search logic
Reviewed-by: kamg, acorn, lfoltan, coleenp

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

mercurial