|
44 | 44 | #include "classfile/systemDictionaryShared.hpp" |
45 | 45 | #include "classfile/vmClasses.hpp" |
46 | 46 | #include "classfile/vmSymbols.hpp" |
| 47 | +#include "compiler/compilerDefinitions.inline.hpp" |
47 | 48 | #include "jvm.h" |
48 | 49 | #include "logging/log.hpp" |
49 | 50 | #include "logging/logMessage.hpp" |
@@ -232,6 +233,8 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment, |
232 | 233 | } else { |
233 | 234 | _narrow_klass_pointer_bits = _narrow_klass_shift = -1; |
234 | 235 | } |
| 236 | + // Which JIT compier is used |
| 237 | + _compiler_type = (u1)CompilerConfig::compiler_type(); |
235 | 238 | _type_profile_level = TypeProfileLevel; |
236 | 239 | _type_profile_args_limit = TypeProfileArgsLimit; |
237 | 240 | _type_profile_parms_limit = TypeProfileParmsLimit; |
@@ -1935,6 +1938,23 @@ bool FileMapHeader::validate() { |
1935 | 1938 | CompactStrings ? "enabled" : "disabled"); |
1936 | 1939 | return false; |
1937 | 1940 | } |
| 1941 | + bool jvmci_compiler_is_enabled = CompilerConfig::is_jvmci_compiler_enabled(); |
| 1942 | + CompilerType compiler_type = CompilerConfig::compiler_type(); |
| 1943 | + CompilerType archive_compiler_type = CompilerType(_compiler_type); |
| 1944 | + // JVMCI compiler does different type profiling settigns and generate |
| 1945 | + // different code. We can't use archive which was produced |
| 1946 | + // without it and reverse. |
| 1947 | + // Only allow mix when JIT compilation is disabled. |
| 1948 | + // Interpreter is used by default when dumping archive. |
| 1949 | + bool intepreter_is_used = (archive_compiler_type == CompilerType::compiler_none) || |
| 1950 | + (compiler_type == CompilerType::compiler_none); |
| 1951 | + if (!intepreter_is_used && |
| 1952 | + jvmci_compiler_is_enabled != (archive_compiler_type == CompilerType::compiler_jvmci)) { |
| 1953 | + MetaspaceShared::report_loading_error("The %s's JIT compiler setting (%s)" |
| 1954 | + " does not equal the current setting (%s).", file_type, |
| 1955 | + compilertype2name(archive_compiler_type), compilertype2name(compiler_type)); |
| 1956 | + return false; |
| 1957 | + } |
1938 | 1958 | if (TrainingData::have_data()) { |
1939 | 1959 | if (_type_profile_level != TypeProfileLevel) { |
1940 | 1960 | MetaspaceShared::report_loading_error("The %s's TypeProfileLevel setting (%d)" |
|
0 commit comments