23 * |
23 * |
24 */ |
24 */ |
25 #ifndef SHARE_MEMORY_METASPACEENUMS_HPP |
25 #ifndef SHARE_MEMORY_METASPACEENUMS_HPP |
26 #define SHARE_MEMORY_METASPACEENUMS_HPP |
26 #define SHARE_MEMORY_METASPACEENUMS_HPP |
27 |
27 |
|
28 #include "memory/metaspace.hpp" |
28 #include "utilities/debug.hpp" |
29 #include "utilities/debug.hpp" |
29 |
30 |
30 // MetadataType and MetaspaceType, as well as some convenience functions surrounding them. |
31 // MetadataType and MetaspaceType, as well as some convenience functions surrounding them. |
31 namespace metaspace { |
32 namespace metaspace { |
32 |
33 |
33 /////////////////////// |
34 /////////////////////// |
34 |
35 |
35 enum MetadataType { |
36 /* Moved to metaspace.hpp to keep diff in non-metaspace coding |
36 ClassType, |
37 * small. Would like to have this here and in metaspace:: namespace, |
37 NonClassType, |
38 * eventually. |
38 MetadataTypeCount |
39 * |
39 }; |
40 * enum MetadataType { |
|
41 * ClassType, |
|
42 * NonClassType, |
|
43 * MetadataTypeCount |
|
44 * }; |
|
45 */ |
40 |
46 |
41 inline bool is_class(MetadataType md) { return md == ClassType; } |
47 inline bool is_class(Metaspace::MetadataType md) { return md == Metaspace::ClassType; } |
42 |
48 |
43 inline MetadataType mdtype_from_bool(bool is_class) { return is_class ? ClassType : NonClassType; } |
49 inline Metaspace::MetadataType mdtype_from_bool(bool is_class) { return is_class ? Metaspace::ClassType : Metaspace::NonClassType; } |
44 |
50 |
45 const char* describe_mdtype(MetadataType md); |
51 const char* describe_mdtype(Metaspace::MetadataType md); |
46 |
52 |
47 #ifdef ASSERT |
53 #ifdef ASSERT |
48 inline bool is_valid_mdtype(MetadataType md) { |
54 inline bool is_valid_mdtype(Metaspace::MetadataType md) { |
49 return (int)md >= 0 && (int)md < MetadataTypeCount; |
55 return (int)md >= 0 && (int)md < Metaspace::MetadataTypeCount; |
50 } |
56 } |
51 inline void check_valid_mdtype(MetadataType md) { |
57 inline void check_valid_mdtype(Metaspace::MetadataType md) { |
52 assert(is_valid_mdtype(md), "Wrong value for MetadataType: %d", (int) md); |
58 assert(is_valid_mdtype(md), "Wrong value for MetadataType: %d", (int) md); |
53 } |
59 } |
54 #endif // ASSERT |
60 #endif // ASSERT |
55 |
61 |
56 /////////////////////// |
62 /////////////////////// |