< prev index next >

src/hotspot/share/memory/iterator.inline.hpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 44,11 ***
  // Defaults to strong claiming.
  inline MetadataVisitingOopIterateClosure::MetadataVisitingOopIterateClosure(ReferenceDiscoverer* rd) :
      ClaimMetadataVisitingOopIterateClosure(ClassLoaderData::_claim_strong, rd) {}
  
  inline void ClaimMetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
!   cld->oops_do(this, _claim);
  }
  
  inline void ClaimMetadataVisitingOopIterateClosure::do_klass(Klass* k) {
    ClassLoaderData* cld = k->class_loader_data();
    ClaimMetadataVisitingOopIterateClosure::do_cld(cld);
--- 44,15 ---
  // Defaults to strong claiming.
  inline MetadataVisitingOopIterateClosure::MetadataVisitingOopIterateClosure(ReferenceDiscoverer* rd) :
      ClaimMetadataVisitingOopIterateClosure(ClassLoaderData::_claim_strong, rd) {}
  
  inline void ClaimMetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
!   if (cld != nullptr) {
+     // Could be null during early VM bootstrap for archived heap objects whose
+     // class has not yet been loaded by CDS.
+     cld->oops_do(this, _claim);
+   }
  }
  
  inline void ClaimMetadataVisitingOopIterateClosure::do_klass(Klass* k) {
    ClassLoaderData* cld = k->class_loader_data();
    ClaimMetadataVisitingOopIterateClosure::do_cld(cld);
< prev index next >