< prev index next >

src/hotspot/share/cds/cdsHeapVerifier.cpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2022, 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.
--- 1,7 ---
  /*
!  * Copyright (c) 2022, 2025, 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.

*** 94,11 ***
    // Unfortunately this needs to be manually maintained. If
    // test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedEnumTest.java fails,
    // you might need to fix the core library code, or fix the ADD_EXCL entries below.
    //
    //       class                                         field                     type
!   ADD_EXCL("java/lang/ClassLoader",                      "scl");                   // A
    ADD_EXCL("java/lang/Module",                           "ALL_UNNAMED_MODULE",     // A
                                                           "ALL_UNNAMED_MODULE_SET", // A
                                                           "EVERYONE_MODULE",        // A
                                                           "EVERYONE_SET");          // A
  
--- 94,11 ---
    // Unfortunately this needs to be manually maintained. If
    // test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedEnumTest.java fails,
    // you might need to fix the core library code, or fix the ADD_EXCL entries below.
    //
    //       class                                         field                     type
!   ADD_EXCL("java/lang/ClassLoader$Holder",               "scl");                   // A
    ADD_EXCL("java/lang/Module",                           "ALL_UNNAMED_MODULE",     // A
                                                           "ALL_UNNAMED_MODULE_SET", // A
                                                           "EVERYONE_MODULE",        // A
                                                           "EVERYONE_SET");          // A
  

*** 132,21 ***
      ADD_EXCL("java/lang/invoke/InvokerBytecodeGenerator", "MEMBERNAME_FACTORY",    // D
                                                            "CD_Object_array",       // E same as <...>ConstantUtils.CD_Object_array::CD_Object
                                                            "INVOKER_SUPER_DESC");   // E same as java.lang.constant.ConstantDescs::CD_Object
    }
  
  # undef ADD_EXCL
  
    ClassLoaderDataGraph::classes_do(this);
  }
  
  CDSHeapVerifier::~CDSHeapVerifier() {
    if (_problems > 0) {
      log_error(cds, heap)("Scanned %d objects. Found %d case(s) where "
                           "an object points to a static field that "
                           "may hold a different value at runtime.", _archived_objs, _problems);
!     MetaspaceShared::unrecoverable_writing_error();
    }
  }
  
  class CDSHeapVerifier::CheckStaticFields : public FieldClosure {
    CDSHeapVerifier* _verifier;
--- 132,27 ---
      ADD_EXCL("java/lang/invoke/InvokerBytecodeGenerator", "MEMBERNAME_FACTORY",    // D
                                                            "CD_Object_array",       // E same as <...>ConstantUtils.CD_Object_array::CD_Object
                                                            "INVOKER_SUPER_DESC");   // E same as java.lang.constant.ConstantDescs::CD_Object
    }
  
+   // These are used by BuiltinClassLoader::negativeLookupCache, etc but seem to be
+   // OK. TODO - we should completely disable the caching unless ArchiveLoaderLookupCache
+   // is enabled
+   ADD_EXCL("java/lang/Boolean",                           "TRUE",                  // E
+                                                           "FALSE");                // E
+ 
  # undef ADD_EXCL
  
    ClassLoaderDataGraph::classes_do(this);
  }
  
  CDSHeapVerifier::~CDSHeapVerifier() {
    if (_problems > 0) {
      log_error(cds, heap)("Scanned %d objects. Found %d case(s) where "
                           "an object points to a static field that "
                           "may hold a different value at runtime.", _archived_objs, _problems);
!     //MetaspaceShared::unrecoverable_writing_error(); // FIXME -- leyden+JEP483 merge
    }
  }
  
  class CDSHeapVerifier::CheckStaticFields : public FieldClosure {
    CDSHeapVerifier* _verifier;
< prev index next >