|
1 /* |
|
2 * Copyright (c) 2019, SAP SE. All rights reserved. |
|
3 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
|
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 * |
|
6 * This code is free software; you can redistribute it and/or modify it |
|
7 * under the terms of the GNU General Public License version 2 only, as |
|
8 * published by the Free Software Foundation. |
|
9 * |
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 * version 2 for more details (a copy is included in the LICENSE file that |
|
14 * accompanied this code). |
|
15 * |
|
16 * You should have received a copy of the GNU General Public License version |
|
17 * 2 along with this work; if not, write to the Free Software Foundation, |
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 * |
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 * or visit www.oracle.com if you need additional information or have any |
|
22 * questions. |
|
23 * |
|
24 */ |
|
25 #ifndef SHARE_MEMORY_METASPACEENUMS_HPP |
|
26 #define SHARE_MEMORY_METASPACEENUMS_HPP |
|
27 |
|
28 #include "utilities/debug.hpp" |
|
29 |
|
30 // MetadataType and MetaspaceType, as well as some convenience functions surrounding them. |
|
31 namespace metaspace { |
|
32 |
|
33 /////////////////////// |
|
34 |
|
35 enum MetadataType { |
|
36 ClassType, |
|
37 NonClassType, |
|
38 MetadataTypeCount |
|
39 }; |
|
40 |
|
41 inline bool is_class(MetadataType md) { return md == ClassType; } |
|
42 |
|
43 inline MetadataType mdtype_from_bool(bool is_class) { return is_class ? ClassType : NonClassType; } |
|
44 |
|
45 const char* describe_mdtype(MetadataType md); |
|
46 |
|
47 #ifdef ASSERT |
|
48 inline bool is_valid_mdtype(MetadataType md) { |
|
49 return (int)md >= 0 && (int)md < MetadataTypeCount; |
|
50 } |
|
51 inline void check_valid_mdtype(MetadataType md) { |
|
52 assert(is_valid_mdtype(md), "Wrong value for MetadataType: %d", (int) md); |
|
53 } |
|
54 #endif // ASSERT |
|
55 |
|
56 /////////////////////// |
|
57 |
|
58 enum MetaspaceType { |
|
59 ZeroMetaspaceType = 0, |
|
60 StandardMetaspaceType = ZeroMetaspaceType, |
|
61 BootMetaspaceType = StandardMetaspaceType + 1, |
|
62 UnsafeAnonymousMetaspaceType = BootMetaspaceType + 1, |
|
63 ReflectionMetaspaceType = UnsafeAnonymousMetaspaceType + 1, |
|
64 MetaspaceTypeCount |
|
65 }; |
|
66 |
|
67 const char* describe_spacetype(MetaspaceType st); |
|
68 |
|
69 #ifdef ASSERT |
|
70 inline bool is_valid_spacetype(MetaspaceType st) { |
|
71 return (int)st >= 0 && (int)st < MetaspaceTypeCount; |
|
72 } |
|
73 inline void check_valid_spacetype(MetaspaceType st) { |
|
74 assert(is_valid_spacetype(st), "Wrong value for MetaspaceType: %d", (int) st); |
|
75 } |
|
76 #endif |
|
77 |
|
78 } // namespace metaspace |
|
79 |
|
80 #endif // SHARE_MEMORY_METASPACEENUMS_HPP |