diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index ad819d5d409..cc97b6650bc 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -307,6 +307,7 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment, _type_profile_width = TypeProfileWidth; _bci_profile_width = BciProfileWidth; _profile_traps = ProfileTraps; + _profile_exception_handlers = ProfileExceptionHandlers; _type_profile_casts = TypeProfileCasts; _spec_trap_limit_extra_entries = SpecTrapLimitExtraEntries; _max_heap_size = MaxHeapSize; @@ -1947,6 +1948,14 @@ bool FileMapHeader::validate() { return false; } + if (_profile_exception_handlers != ProfileExceptionHandlers) { + AOTMetaspace::report_loading_error("The %s's ProfileExceptionHandlers setting (%s)" + " does not equal the current ProfileExceptionHandlers setting (%s).", file_type, + _profile_exception_handlers ? "enabled" : "disabled", + ProfileExceptionHandlers ? "enabled" : "disabled"); + + return false; + } if (_spec_trap_limit_extra_entries != SpecTrapLimitExtraEntries) { AOTMetaspace::report_loading_error("The %s's SpecTrapLimitExtraEntries setting (%d)" " does not equal the current SpecTrapLimitExtraEntries setting (%d).", file_type, diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index 02dd8597013..d0713c17482 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -193,6 +193,7 @@ private: intx _type_profile_width; intx _bci_profile_width; bool _profile_traps; + bool _profile_exception_handlers; bool _type_profile_casts; int _spec_trap_limit_extra_entries; diff --git a/test/hotspot/jtreg/runtime/cds/appcds/aotProfile/AOTProfileFlags.java b/test/hotspot/jtreg/runtime/cds/appcds/aotProfile/AOTProfileFlags.java index 4dc4512e01c..4ad42cb715b 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/aotProfile/AOTProfileFlags.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/aotProfile/AOTProfileFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, 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 @@ -121,6 +121,7 @@ public class AOTProfileFlags { trainAndRun("TypeProfileArgsLimit", "-XX:TypeProfileArgsLimit=2", "-XX:TypeProfileArgsLimit=3", errorPattern); trainAndRun("TypeProfileParamsLimit", "-XX:TypeProfileParmsLimit=2", "-XX:TypeProfileParmsLimit=3", errorPattern); trainAndRun("TypeProfileWidth", "-XX:TypeProfileWidth=2", "-XX:TypeProfileWidth=3", errorPattern); + trainAndRun("ProfileExceptionHandlers", "-XX:+ProfileExceptionHandlers", "-XX:-ProfileExceptionHandlers", errorPattern); if (Platform.isDebugBuild()) { trainAndRun("ProfileTraps", "-XX:+ProfileTraps", "-XX:-ProfileTraps", errorPattern); trainAndRun("TypeProfileCasts", "-XX:+TypeProfileCasts", "-XX:-TypeProfileCasts", errorPattern);