< prev index next >

src/hotspot/share/cds/metaspaceShared.cpp

Print this page

   1 /*
   2  * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *

  50 #include "classfile/stringTable.hpp"
  51 #include "classfile/symbolTable.hpp"
  52 #include "classfile/systemDictionary.hpp"
  53 #include "classfile/systemDictionaryShared.hpp"
  54 #include "classfile/vmClasses.hpp"
  55 #include "classfile/vmSymbols.hpp"
  56 #include "code/codeCache.hpp"
  57 #include "gc/shared/gcVMOperations.hpp"
  58 #include "interpreter/bytecodeStream.hpp"
  59 #include "interpreter/bytecodes.hpp"
  60 #include "jvm_io.h"
  61 #include "logging/log.hpp"
  62 #include "logging/logMessage.hpp"
  63 #include "logging/logStream.hpp"
  64 #include "memory/metaspace.hpp"
  65 #include "memory/metaspaceClosure.hpp"
  66 #include "memory/resourceArea.hpp"
  67 #include "memory/universe.hpp"
  68 #include "nmt/memTracker.hpp"
  69 #include "oops/compressedKlass.hpp"


  70 #include "oops/instanceMirrorKlass.hpp"
  71 #include "oops/klass.inline.hpp"
  72 #include "oops/objArrayOop.hpp"
  73 #include "oops/oop.inline.hpp"
  74 #include "oops/oopHandle.hpp"
  75 #include "prims/jvmtiExport.hpp"
  76 #include "runtime/arguments.hpp"
  77 #include "runtime/globals.hpp"
  78 #include "runtime/globals_extension.hpp"
  79 #include "runtime/handles.inline.hpp"
  80 #include "runtime/os.inline.hpp"
  81 #include "runtime/safepointVerifiers.hpp"
  82 #include "runtime/sharedRuntime.hpp"
  83 #include "runtime/vmOperations.hpp"
  84 #include "runtime/vmThread.hpp"
  85 #include "sanitizers/leak.hpp"
  86 #include "utilities/align.hpp"
  87 #include "utilities/bitMap.inline.hpp"
  88 #include "utilities/defaultStream.hpp"
  89 #include "utilities/ostream.hpp"

 821       BytecodeVerificationLocal = BytecodeVerificationRemote;
 822     }
 823     ik->link_class(THREAD);
 824     if (HAS_PENDING_EXCEPTION) {
 825       ResourceMark rm(THREAD);
 826       log_warning(cds)("Preload Warning: Verification failed for %s",
 827                     ik->external_name());
 828       CLEAR_PENDING_EXCEPTION;
 829       SystemDictionaryShared::set_class_has_failed_verification(ik);
 830     }
 831     ik->compute_has_loops_flag_for_methods();
 832     BytecodeVerificationLocal = saved;
 833     return true;
 834   } else {
 835     return false;
 836   }
 837 }
 838 
 839 #if INCLUDE_CDS_JAVA_HEAP
 840 void VM_PopulateDumpSharedSpace::dump_java_heap_objects(GrowableArray<Klass*>* klasses) {




 841   if(!HeapShared::can_write()) {
 842     log_info(cds)(
 843       "Archived java heap is not supported as UseG1GC "
 844       "and UseCompressedClassPointers are required."
 845       "Current settings: UseG1GC=%s, UseCompressedClassPointers=%s.",
 846       BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedClassPointers));
 847     return;
 848   }
 849   // Find all the interned strings that should be dumped.
 850   int i;
 851   for (i = 0; i < klasses->length(); i++) {
 852     Klass* k = klasses->at(i);
 853     if (k->is_instance_klass()) {
 854       InstanceKlass* ik = InstanceKlass::cast(k);
 855       if (ik->is_linked()) {
 856         ik->constants()->add_dumped_interned_strings();
 857       }
 858     }
 859   }
 860   if (_extra_interned_strings != nullptr) {

   1 /*
   2  * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *

  50 #include "classfile/stringTable.hpp"
  51 #include "classfile/symbolTable.hpp"
  52 #include "classfile/systemDictionary.hpp"
  53 #include "classfile/systemDictionaryShared.hpp"
  54 #include "classfile/vmClasses.hpp"
  55 #include "classfile/vmSymbols.hpp"
  56 #include "code/codeCache.hpp"
  57 #include "gc/shared/gcVMOperations.hpp"
  58 #include "interpreter/bytecodeStream.hpp"
  59 #include "interpreter/bytecodes.hpp"
  60 #include "jvm_io.h"
  61 #include "logging/log.hpp"
  62 #include "logging/logMessage.hpp"
  63 #include "logging/logStream.hpp"
  64 #include "memory/metaspace.hpp"
  65 #include "memory/metaspaceClosure.hpp"
  66 #include "memory/resourceArea.hpp"
  67 #include "memory/universe.hpp"
  68 #include "nmt/memTracker.hpp"
  69 #include "oops/compressedKlass.hpp"
  70 #include "oops/flatArrayKlass.hpp"
  71 #include "oops/inlineKlass.hpp"
  72 #include "oops/instanceMirrorKlass.hpp"
  73 #include "oops/klass.inline.hpp"
  74 #include "oops/objArrayOop.hpp"
  75 #include "oops/oop.inline.hpp"
  76 #include "oops/oopHandle.hpp"
  77 #include "prims/jvmtiExport.hpp"
  78 #include "runtime/arguments.hpp"
  79 #include "runtime/globals.hpp"
  80 #include "runtime/globals_extension.hpp"
  81 #include "runtime/handles.inline.hpp"
  82 #include "runtime/os.inline.hpp"
  83 #include "runtime/safepointVerifiers.hpp"
  84 #include "runtime/sharedRuntime.hpp"
  85 #include "runtime/vmOperations.hpp"
  86 #include "runtime/vmThread.hpp"
  87 #include "sanitizers/leak.hpp"
  88 #include "utilities/align.hpp"
  89 #include "utilities/bitMap.inline.hpp"
  90 #include "utilities/defaultStream.hpp"
  91 #include "utilities/ostream.hpp"

 823       BytecodeVerificationLocal = BytecodeVerificationRemote;
 824     }
 825     ik->link_class(THREAD);
 826     if (HAS_PENDING_EXCEPTION) {
 827       ResourceMark rm(THREAD);
 828       log_warning(cds)("Preload Warning: Verification failed for %s",
 829                     ik->external_name());
 830       CLEAR_PENDING_EXCEPTION;
 831       SystemDictionaryShared::set_class_has_failed_verification(ik);
 832     }
 833     ik->compute_has_loops_flag_for_methods();
 834     BytecodeVerificationLocal = saved;
 835     return true;
 836   } else {
 837     return false;
 838   }
 839 }
 840 
 841 #if INCLUDE_CDS_JAVA_HEAP
 842 void VM_PopulateDumpSharedSpace::dump_java_heap_objects(GrowableArray<Klass*>* klasses) {
 843   if (CDSConfig::is_valhalla_preview()) {
 844     log_info(cds)("Archived java heap is not yet supported with Valhalla preview");
 845     return;
 846   }
 847   if(!HeapShared::can_write()) {
 848     log_info(cds)(
 849       "Archived java heap is not supported as UseG1GC "
 850       "and UseCompressedClassPointers are required."
 851       "Current settings: UseG1GC=%s, UseCompressedClassPointers=%s.",
 852       BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedClassPointers));
 853     return;
 854   }
 855   // Find all the interned strings that should be dumped.
 856   int i;
 857   for (i = 0; i < klasses->length(); i++) {
 858     Klass* k = klasses->at(i);
 859     if (k->is_instance_klass()) {
 860       InstanceKlass* ik = InstanceKlass::cast(k);
 861       if (ik->is_linked()) {
 862         ik->constants()->add_dumped_interned_strings();
 863       }
 864     }
 865   }
 866   if (_extra_interned_strings != nullptr) {
< prev index next >