8205923: ZGC: Verification applies load barrier before verification

Reviewed-by: pliden, eosterlund
This commit is contained in:
Stefan Karlsson 2018-06-27 15:02:53 +02:00
parent 45c5c6fda4
commit 03d213bcda
3 changed files with 19 additions and 5 deletions

View File

@ -77,7 +77,8 @@ class OopIterateClosure : public OopClosure {
enum ReferenceIterationMode {
DO_DISCOVERY, // Apply closure and discover references
DO_DISCOVERED_AND_DISCOVERY, // Apply closure to discovered field and do discovery
DO_FIELDS // Apply closure to all fields
DO_FIELDS, // Apply closure to all fields
DO_FIELDS_EXCEPT_REFERENT // Apply closure to all fields except the referent field
};
// The default iteration mode is to do discovery.

View File

@ -131,6 +131,10 @@ class InstanceRefKlass: public InstanceKlass {
template <typename T, class OopClosureType, class Contains>
static void oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains);
// Apply the closure to all fields, except the referent field. No reference discovery is done.
template <typename T, class OopClosureType, class Contains>
static void oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains);
template <typename T>
static void trace_reference_gc(const char *s, oop obj) NOT_DEBUG_RETURN;

View File

@ -88,6 +88,14 @@ void InstanceRefKlass::oop_oop_iterate_discovery(oop obj, ReferenceType type, Oo
do_discovered<T>(obj, closure, contains);
}
template <typename T, class OopClosureType, class Contains>
void InstanceRefKlass::oop_oop_iterate_discovered_and_discovery(oop obj, ReferenceType type, OopClosureType* closure, Contains& contains) {
// Explicitly apply closure to the discovered field.
do_discovered<T>(obj, closure, contains);
// Then do normal reference processing with discovery.
oop_oop_iterate_discovery<T>(obj, type, closure, contains);
}
template <typename T, class OopClosureType, class Contains>
void InstanceRefKlass::oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains) {
do_referent<T>(obj, closure, contains);
@ -95,11 +103,8 @@ void InstanceRefKlass::oop_oop_iterate_fields(oop obj, OopClosureType* closure,
}
template <typename T, class OopClosureType, class Contains>
void InstanceRefKlass::oop_oop_iterate_discovered_and_discovery(oop obj, ReferenceType type, OopClosureType* closure, Contains& contains) {
// Explicitly apply closure to the discovered field.
void InstanceRefKlass::oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains) {
do_discovered<T>(obj, closure, contains);
// Then do normal reference processing with discovery.
oop_oop_iterate_discovery<T>(obj, type, closure, contains);
}
template <typename T, class OopClosureType, class Contains>
@ -117,6 +122,10 @@ void InstanceRefKlass::oop_oop_iterate_ref_processing(oop obj, OopClosureType* c
trace_reference_gc<T>("do_fields", obj);
oop_oop_iterate_fields<T>(obj, closure, contains);
break;
case OopIterateClosure::DO_FIELDS_EXCEPT_REFERENT:
trace_reference_gc<T>("do_fields_except_referent", obj);
oop_oop_iterate_fields_except_referent<T>(obj, closure, contains);
break;
default:
ShouldNotReachHere();
}