src/share/vm/ci/ciMetadata.hpp

Sat, 01 Sep 2012 13:25:18 -0400

author
coleenp
date
Sat, 01 Sep 2012 13:25:18 -0400
changeset 4037
da91efe96a93
child 4267
bd7a7ce2e264
permissions
-rw-r--r--

6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>

coleenp@4037 1 /*
coleenp@4037 2 * Copyright (c) 1999, 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_CI_CIMETADATA_HPP
coleenp@4037 26 #define SHARE_VM_CI_CIMETADATA_HPP
coleenp@4037 27
coleenp@4037 28 #include "ci/ciBaseObject.hpp"
coleenp@4037 29 #include "ci/ciClassList.hpp"
coleenp@4037 30 #include "memory/allocation.hpp"
coleenp@4037 31 #include "runtime/handles.hpp"
coleenp@4037 32 #include "runtime/jniHandles.hpp"
coleenp@4037 33
coleenp@4037 34 // ciMetadata
coleenp@4037 35 //
coleenp@4037 36 // Compiler interface to metadata object in the VM, not Java object.
coleenp@4037 37
coleenp@4037 38 class ciMetadata: public ciBaseObject {
coleenp@4037 39 CI_PACKAGE_ACCESS
coleenp@4037 40 friend class ciEnv;
coleenp@4037 41
coleenp@4037 42 protected:
coleenp@4037 43 Metadata* _metadata;
coleenp@4037 44
coleenp@4037 45 ciMetadata(): _metadata(NULL) {}
coleenp@4037 46 ciMetadata(Metadata* o): _metadata(o) {}
coleenp@4037 47
coleenp@4037 48 virtual bool is_classless() const { return false; }
coleenp@4037 49 public:
coleenp@4037 50 bool is_loaded() const { return _metadata != NULL || is_classless(); }
coleenp@4037 51
coleenp@4037 52 virtual bool is_metadata() const { return true; }
coleenp@4037 53
coleenp@4037 54 virtual bool is_type() const { return false; }
coleenp@4037 55 virtual bool is_cpcache() const { return false; }
coleenp@4037 56 virtual bool is_return_address() const { return false; }
coleenp@4037 57 virtual bool is_method() const { return false; }
coleenp@4037 58 virtual bool is_method_data() const { return false; }
coleenp@4037 59 virtual bool is_klass() const { return false; }
coleenp@4037 60 virtual bool is_instance_klass() const { return false; }
coleenp@4037 61 virtual bool is_array_klass() const { return false; }
coleenp@4037 62 virtual bool is_obj_array_klass() const { return false; }
coleenp@4037 63 virtual bool is_type_array_klass() const { return false; }
coleenp@4037 64
coleenp@4037 65 ciMethod* as_method() {
coleenp@4037 66 assert(is_method(), "bad cast");
coleenp@4037 67 return (ciMethod*)this;
coleenp@4037 68 }
coleenp@4037 69 ciMethodData* as_method_data() {
coleenp@4037 70 assert(is_method_data(), "bad cast");
coleenp@4037 71 return (ciMethodData*)this;
coleenp@4037 72 }
coleenp@4037 73 ciSymbol* as_symbol() {
coleenp@4037 74 assert(is_symbol(), "bad cast");
coleenp@4037 75 return (ciSymbol*)this;
coleenp@4037 76 }
coleenp@4037 77 ciType* as_type() {
coleenp@4037 78 assert(is_type(), "bad cast");
coleenp@4037 79 return (ciType*)this;
coleenp@4037 80 }
coleenp@4037 81 ciReturnAddress* as_return_address() {
coleenp@4037 82 assert(is_return_address(), "bad cast");
coleenp@4037 83 return (ciReturnAddress*)this;
coleenp@4037 84 }
coleenp@4037 85 ciKlass* as_klass() {
coleenp@4037 86 assert(is_klass(), "bad cast");
coleenp@4037 87 return (ciKlass*)this;
coleenp@4037 88 }
coleenp@4037 89 ciInstanceKlass* as_instance_klass() {
coleenp@4037 90 assert(is_instance_klass(), "bad cast");
coleenp@4037 91 return (ciInstanceKlass*)this;
coleenp@4037 92 }
coleenp@4037 93 ciArrayKlass* as_array_klass() {
coleenp@4037 94 assert(is_array_klass(), "bad cast");
coleenp@4037 95 return (ciArrayKlass*)this;
coleenp@4037 96 }
coleenp@4037 97 ciObjArrayKlass* as_obj_array_klass() {
coleenp@4037 98 assert(is_obj_array_klass(), "bad cast");
coleenp@4037 99 return (ciObjArrayKlass*)this;
coleenp@4037 100 }
coleenp@4037 101 ciTypeArrayKlass* as_type_array_klass() {
coleenp@4037 102 assert(is_type_array_klass(), "bad cast");
coleenp@4037 103 return (ciTypeArrayKlass*)this;
coleenp@4037 104 }
coleenp@4037 105
coleenp@4037 106 Metadata* constant_encoding() { return _metadata; }
coleenp@4037 107
coleenp@4037 108 bool equals(ciMetadata* obj) const { return (this == obj); }
coleenp@4037 109
coleenp@4037 110 int hash() { return ident() * 31; } // ???
coleenp@4037 111
coleenp@4037 112 void print(outputStream* st);
coleenp@4037 113 virtual void print_impl(outputStream* st) {}
coleenp@4037 114 virtual const char* type_string() { return "ciMetadata"; }
coleenp@4037 115
coleenp@4037 116 void print() { print(tty); }
coleenp@4037 117 void print_metadata(outputStream* st = tty);
coleenp@4037 118
coleenp@4037 119 };
coleenp@4037 120 #endif // SHARE_VM_CI_CIMETADATA_HPP

mercurial