author | coleenp |
Wed, 24 Jul 2019 10:22:11 -0400 | |
changeset 57511 | 00ae3b739184 |
parent 54807 | 33fe50b6d707 |
permissions | -rw-r--r-- |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 |
/* |
53156 | 2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 |
* questions. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 |
*/ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
24 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53156
diff
changeset
|
25 |
#ifndef SHARE_OOPS_METADATA_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53156
diff
changeset
|
26 |
#define SHARE_OOPS_METADATA_HPP |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
28 |
#include "utilities/exceptions.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 |
#include "utilities/globalDefinitions.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 |
#include "utilities/ostream.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 |
// This is the base class for an internal Class related metadata |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
33 |
class Metadata : public MetaspaceObj { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
34 |
// Debugging hook to check that the metadata has not been deleted. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
35 |
NOT_PRODUCT(int _valid;) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
36 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
37 |
NOT_PRODUCT(Metadata() { _valid = 0; }) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
38 |
NOT_PRODUCT(bool is_valid() const volatile { return _valid == 0; }) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
39 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
40 |
int identity_hash() { return (int)(uintptr_t)this; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
41 |
|
23182
6940057d6552
8035735: Metaspace::contains become extremely slow in some cases
coleenp
parents:
22757
diff
changeset
|
42 |
virtual bool is_metadata() const volatile { return true; } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
43 |
virtual bool is_klass() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 |
virtual bool is_method() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 |
virtual bool is_methodData() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
46 |
virtual bool is_constantPool() const volatile { return false; } |
44630
54aa492f2b19
8176887: AOT: SIGSEGV in AOTCodeHeap::next when using specific configuration
iveresov
parents:
35881
diff
changeset
|
47 |
virtual bool is_methodCounters() const volatile { return false; } |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
44630
diff
changeset
|
48 |
virtual int size() const = 0; |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
44630
diff
changeset
|
49 |
virtual MetaspaceObj::Type type() const = 0; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
50 |
virtual const char* internal_name() const = 0; |
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
44630
diff
changeset
|
51 |
virtual void metaspace_pointers_do(MetaspaceClosure* iter) {} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 |
|
54807 | 53 |
void print() const; |
54 |
void print_value() const; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
55 |
|
51265
8329bfbe1b30
8208399: Metadata methods print_(value_)on_maybe_null() compare 'this' to NULL
hseigel
parents:
47216
diff
changeset
|
56 |
static void print_value_on_maybe_null(outputStream* st, const Metadata* m) { |
8329bfbe1b30
8208399: Metadata methods print_(value_)on_maybe_null() compare 'this' to NULL
hseigel
parents:
47216
diff
changeset
|
57 |
if (NULL == m) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
58 |
st->print("NULL"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
59 |
else |
51265
8329bfbe1b30
8208399: Metadata methods print_(value_)on_maybe_null() compare 'this' to NULL
hseigel
parents:
47216
diff
changeset
|
60 |
m->print_value_on(st); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
61 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
62 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
63 |
virtual void print_on(outputStream* st) const; // First level print |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
64 |
virtual void print_value_on(outputStream* st) const = 0; // Second level print |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 |
char* print_value_string() const; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
67 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
68 |
// Used to keep metadata alive during class redefinition |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 |
// Can't assert because is called for delete functions (as an assert) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
70 |
virtual bool on_stack() const { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
71 |
virtual void set_on_stack(const bool value); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
73 |
// Set on_stack bit, so that the metadata is not cleared |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
74 |
// during class redefinition. This is a virtual call because only methods |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
75 |
// and constant pools need to be set, but someday instanceKlasses might also. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
76 |
static void mark_on_stack(Metadata* m) { m->set_on_stack(true); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
77 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
78 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53156
diff
changeset
|
79 |
#endif // SHARE_OOPS_METADATA_HPP |