File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1041,13 +1041,18 @@ bool Metaspace::is_in_nonclass_metaspace(const void* ptr) {
1041
1041
return VirtualSpaceList::vslist_nonclass ()->contains ((MetaWord*)ptr);
1042
1042
}
1043
1043
1044
- #ifdef ASSERT
1045
1044
bool Metaspace::metadata_is_live (const Metadata* md) {
1045
+ #ifndef ASSERT
1046
+ return contains (md);
1047
+ #else
1046
1048
return md->metadata_token_is_valid () && contains (md); // flesh out later
1049
+ #endif
1047
1050
}
1048
1051
1049
1052
bool Metaspace::klass_is_live (const Klass* k, bool must_have_narrow_klass_id) {
1053
+ #ifndef ASSERT
1054
+ return contains (k);
1055
+ #else
1050
1056
return ((const Metadata*)k)->metadata_token_is_valid_klass () && contains (k); // flesh out later
1057
+ #endif
1051
1058
}
1052
-
1053
- #endif // ASSERT
Original file line number Diff line number Diff line change @@ -155,16 +155,15 @@ class Metaspace : public AllStatic {
155
155
return ptr < _class_space_end && ptr >= _class_space_start;
156
156
}
157
157
158
- #ifdef ASSERT
159
158
// xxx_is_live functions returns true if the pointer given points to
160
- // valid metadata. In detail, it checks that:
159
+ // valid metadata. In release builds, it is equivalent to Metaspace::contains. In debug
160
+ // builds, it checks that:
161
161
// - the specified metadata is inside class-space or metaspace in committed, readable memory
162
162
// - not marked as dead space (i.e. not returned prematurely via Metaspace::deallocate)
163
163
// - correctly aligned for the type (esp. Klass)
164
164
// - Metadata token is valid specific to this type
165
165
static bool metadata_is_live (const Metadata* md);
166
166
static bool klass_is_live (const Klass* k, bool must_have_narrow_klass_id);
167
- #endif
168
167
169
168
// Free empty virtualspaces
170
169
static void purge (bool classes_unloaded);
You can’t perform that action at this time.
0 commit comments