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