@@ -227,11 +227,13 @@ if (!is_in(object)) { return false; } - if (!Metaspace::contains(object->klass_without_asserts())) { + // With compact headers, we can't safely access the class, due + // to possibly forwarded objects. + if (!UseCompactObjectHeaders && !Metaspace::contains(object->klass_without_asserts())) { return false; } return true; }