< prev index next >

src/hotspot/share/classfile/javaClasses.inline.hpp

Print this page
@@ -124,10 +124,17 @@
  
  bool java_lang_String::is_instance(oop obj) {
    return obj != nullptr && obj->klass() == vmClasses::String_klass();
  }
  
+ // We need to be able to check if this is a string even when we are in an
+ // erroneous state where the klass is corrupted/can't be read safely.
+ // This happens when printing an oop during GC error reporting.
+ bool java_lang_String::is_instance_without_asserts(oop obj) {
+   return obj != nullptr && obj->klass_without_asserts() == vmClasses::String_klass();
+ }
+ 
  // Accessors
  
  oop java_lang_ref_Reference::weak_referent_no_keepalive(oop ref) {
    assert(java_lang_ref_Reference::is_weak(ref) || java_lang_ref_Reference::is_soft(ref), "must be Weak or Soft Reference");
    return ref->obj_field_access<ON_WEAK_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
< prev index next >