8212992: Change mirror accessor in Klass::verify_on() to use AS_NO_KEEPALIVE

Reviewed-by: coleenp, pliden
This commit is contained in:
Erik Österlund 2018-11-20 10:08:19 +01:00
parent 8b1844626a
commit dc260a5369
4 changed files with 12 additions and 3 deletions

View File

@ -59,6 +59,10 @@ oop Klass::java_mirror() const {
return _java_mirror.resolve();
}
oop Klass::java_mirror_no_keepalive() const {
return _java_mirror.peek();
}
bool Klass::is_cloneable() const {
return _access_flags.is_cloneable_fast() ||
is_subtype_of(SystemDictionary::Cloneable_klass());
@ -746,8 +750,8 @@ void Klass::verify_on(outputStream* st) {
}
}
if (java_mirror() != NULL) {
guarantee(oopDesc::is_oop(java_mirror()), "should be instance");
if (java_mirror_no_keepalive() != NULL) {
guarantee(oopDesc::is_oop(java_mirror_no_keepalive()), "should be instance");
}
}

View File

@ -257,6 +257,7 @@ protected:
// java mirror
oop java_mirror() const;
oop java_mirror_no_keepalive() const;
void set_java_mirror(Handle m);
oop archived_java_mirror_raw() NOT_CDS_JAVA_HEAP_RETURN_(NULL); // no GC barrier

View File

@ -44,6 +44,7 @@ public:
OopHandle(oop* w) : _obj(w) {}
inline oop resolve() const;
inline oop peek() const;
// Used only for removing handle.
oop* ptr_raw() const { return _obj; }

View File

@ -32,5 +32,8 @@ inline oop OopHandle::resolve() const {
return (_obj == NULL) ? (oop)NULL : NativeAccess<>::oop_load(_obj);
}
#endif // SHARE_VM_OOPS_OOPHANDLE_INLINE_HPP
inline oop OopHandle::peek() const {
return (_obj == NULL) ? (oop)NULL : NativeAccess<AS_NO_KEEPALIVE>::oop_load(_obj);
}
#endif // SHARE_VM_OOPS_OOPHANDLE_INLINE_HPP