author | ehelin |
Mon, 12 Aug 2013 17:37:02 +0200 | |
changeset 19979 | ebe1dbb6e1aa |
parent 13728 | 882756847a04 |
child 22757 | b2cbb3680b4f |
permissions | -rw-r--r-- |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 |
/* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
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 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_OOPS_METADATA_HPP |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
26 |
#define SHARE_VM_OOPS_METADATA_HPP |
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 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
42 |
// Rehashing support for tables containing pointers to this |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
43 |
unsigned int new_hash(jint seed) { ShouldNotReachHere(); return 0; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 |
virtual bool is_klass() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
46 |
virtual bool is_method() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
47 |
virtual bool is_methodData() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
48 |
virtual bool is_constantPool() const volatile { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
49 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
50 |
virtual const char* internal_name() const = 0; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
51 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 |
void print() const { print_on(tty); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
53 |
void print_value() const { print_value_on(tty); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
54 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
55 |
void print_maybe_null() const { print_on_maybe_null(tty); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
56 |
void print_on_maybe_null(outputStream* st) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
57 |
if (this == NULL) |
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 |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
60 |
print_on(tty); |
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 |
void print_value_on_maybe_null(outputStream* st) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
63 |
if (this == NULL) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
64 |
st->print("NULL"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 |
else |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 |
print_value_on(tty); |
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 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 |
char* print_value_string() const; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
73 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
74 |
// Used to keep metadata alive during class redefinition |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
75 |
// 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
|
76 |
virtual bool on_stack() const { return false; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
77 |
virtual void set_on_stack(const bool value); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
78 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
79 |
// 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
|
80 |
// 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
|
81 |
// 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
|
82 |
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
|
83 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
84 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
85 |
#endif // SHARE_VM_OOPS_METADATA_HPP |