< prev index next >

src/hotspot/share/cds/filemap.hpp

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

*** 29,10 ***
--- 29,11 ---
  #include "include/cds.h"
  #include "logging/logLevel.hpp"
  #include "memory/allocation.hpp"
  #include "oops/array.hpp"
  #include "oops/compressedOops.hpp"
+ #include "runtime/globals.hpp"
  #include "utilities/align.hpp"
  
  // To understand the layout of the CDS archive file:
  //
  // java -Xlog:cds+map=info:file=cds.map:none:filesize=0

*** 172,10 ***
--- 173,38 ---
  
    bool check_region_crc() const;
    void print(outputStream* st, int region_index);
  };
  
+ #define CDS_MUST_MATCH_FLAGS_DO(f) \
+   f(EnableValhalla) \
+   f(FlatArrayElementMaxOops) \
+   f(FlatArrayElementMaxSize) \
+   f(InlineFieldMaxFlatSize) \
+   f(InlineTypePassFieldsAsArgs) \
+   f(InlineTypeReturnedAsFields)
+ 
+ class CDSMustMatchFlags {
+ private:
+   size_t _max_name_width;
+ #define DECLARE_CDS_MUST_MATCH_FLAG(n) \
+   decltype(n) _v_##n;
+   CDS_MUST_MATCH_FLAGS_DO(DECLARE_CDS_MUST_MATCH_FLAG);
+ #undef DECLARE_CDS_MUST_MATCH_FLAG
+ 
+   inline static void do_print(outputStream* st, bool v);
+   inline static void do_print(outputStream* st, intx v);
+   inline static void do_print(outputStream* st, uintx v);
+   inline static void do_print(outputStream* st, double v);
+   void print_info() const;
+ 
+ public:
+   void init();
+   bool runtime_check() const;
+   void print(outputStream* st) const;
+ };
+ 
  class FileMapHeader: private CDSFileMapHeaderBase {
    friend class CDSConstants;
    friend class VMStructs;
  
  private:

*** 222,11 ***
--- 251,13 ---
  
    bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
    bool   _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
                                          // some expensive operations.
    bool   _has_full_module_graph;        // Does this CDS archive contain the full archived module graph?
+   bool   _has_valhalla_patched_classes; // Is this archived dumped with --enable-preview -XX:+EnableValhalla?
    size_t _ptrmap_size_in_bits;          // Size of pointer relocation bitmap
+   CDSMustMatchFlags _must_match;        // These flags must be the same between dumptime and runtime
    size_t _heap_roots_offset;            // Offset of the HeapShared::roots() object, from the bottom
                                          // of the archived heap objects, in bytes.
    char* from_mapped_offset(size_t offset) const {
      return mapped_base_address() + offset;
    }

*** 309,10 ***
--- 340,14 ---
                  size_t common_app_classpath_size);
    static bool is_valid_region(int region) {
      return (0 <= region && region < NUM_CDS_REGIONS);
    }
  
+   bool check_must_match_flags() const {
+     return _must_match.runtime_check();
+   }
+ 
    void print(outputStream* st);
  };
  
  class FileMapInfo : public CHeapObj<mtInternal> {
  private:
< prev index next >