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 *
23 */
24
25 #include "code/codeCache.hpp"
26 #include "compiler/compilerDefinitions.inline.hpp"
27 #include "interpreter/invocationCounter.hpp"
28 #include "jvm_io.h"
29 #include "runtime/arguments.hpp"
30 #include "runtime/continuation.hpp"
31 #include "runtime/flags/jvmFlag.hpp"
32 #include "runtime/flags/jvmFlagAccess.hpp"
33 #include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
34 #include "runtime/flags/jvmFlagLimit.hpp"
35 #include "runtime/globals.hpp"
36 #include "runtime/globals_extension.hpp"
37 #include "utilities/defaultStream.hpp"
38
39 const char* compilertype2name_tab[compiler_number_of_types] = {
40 "",
41 "c1",
42 "c2",
43 "jvmci"
44 };
312 }
313 // Enable SegmentedCodeCache if tiered compilation is enabled, ReservedCodeCacheSize >= 240M
314 // and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).
315 if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&
316 8 * CodeCache::page_size() <= ReservedCodeCacheSize) {
317 FLAG_SET_ERGO(SegmentedCodeCache, true);
318 }
319 if (Arguments::is_compiler_only()) { // -Xcomp
320 // Be much more aggressive in tiered mode with -Xcomp and exercise C2 more.
321 // We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and
322 // compile a level 4 (C2) and then continue executing it.
323 if (FLAG_IS_DEFAULT(Tier3InvokeNotifyFreqLog)) {
324 FLAG_SET_CMDLINE(Tier3InvokeNotifyFreqLog, 0);
325 }
326 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
327 FLAG_SET_CMDLINE(Tier4InvocationThreshold, 0);
328 }
329 }
330 }
331
332 if (CompileThresholdScaling < 0) {
333 vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", nullptr);
334 }
335
336 if (CompilationModeFlag::disable_intermediate()) {
337 if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {
338 FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);
339 }
340
341 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
342 FLAG_SET_DEFAULT(Tier4InvocationThreshold, 5000);
343 }
344 if (FLAG_IS_DEFAULT(Tier4MinInvocationThreshold)) {
345 FLAG_SET_DEFAULT(Tier4MinInvocationThreshold, 600);
346 }
347 if (FLAG_IS_DEFAULT(Tier4CompileThreshold)) {
348 FLAG_SET_DEFAULT(Tier4CompileThreshold, 10000);
349 }
350 if (FLAG_IS_DEFAULT(Tier4BackEdgeThreshold)) {
351 FLAG_SET_DEFAULT(Tier4BackEdgeThreshold, 15000);
571
572 // This property is also checked when selecting the heap size. Since client
573 // emulation mode influences Java heap memory usage, part of the logic must
574 // occur before choosing the heap size.
575 if (should_set_client_emulation_mode_flags()) {
576 set_client_emulation_mode_flags();
577 }
578
579 set_legacy_emulation_flags();
580 set_compilation_policy_flags();
581
582 #if INCLUDE_JVMCI
583 // Check that JVMCI supports selected GC.
584 // Should be done after GCConfig::initialize() was called.
585 JVMCIGlobals::check_jvmci_supported_gc();
586
587 // Do JVMCI specific settings
588 set_jvmci_specific_flags();
589 #endif
590
591 if (UseOnStackReplacement && !UseLoopCounter) {
592 warning("On-stack-replacement requires loop counters; enabling loop counters");
593 FLAG_SET_DEFAULT(UseLoopCounter, true);
594 }
595
596 if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {
597 if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
598 warning("ProfileInterpreter disabled due to client emulation mode");
599 }
600 FLAG_SET_CMDLINE(ProfileInterpreter, false);
601 }
602
603 #ifdef COMPILER2
604 if (!EliminateLocks) {
605 EliminateNestedLocks = false;
606 }
607 if (!Inline || !IncrementalInline) {
608 IncrementalInline = false;
609 IncrementalInlineMH = false;
610 IncrementalInlineVirtual = false;
|
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 *
23 */
24
25 #include "code/aotCodeCache.hpp"
26 #include "code/codeCache.hpp"
27 #include "compiler/compilerDefinitions.inline.hpp"
28 #include "interpreter/invocationCounter.hpp"
29 #include "jvm_io.h"
30 #include "runtime/arguments.hpp"
31 #include "runtime/continuation.hpp"
32 #include "runtime/flags/jvmFlag.hpp"
33 #include "runtime/flags/jvmFlagAccess.hpp"
34 #include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
35 #include "runtime/flags/jvmFlagLimit.hpp"
36 #include "runtime/globals.hpp"
37 #include "runtime/globals_extension.hpp"
38 #include "utilities/defaultStream.hpp"
39
40 const char* compilertype2name_tab[compiler_number_of_types] = {
41 "",
42 "c1",
43 "c2",
44 "jvmci"
45 };
313 }
314 // Enable SegmentedCodeCache if tiered compilation is enabled, ReservedCodeCacheSize >= 240M
315 // and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).
316 if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&
317 8 * CodeCache::page_size() <= ReservedCodeCacheSize) {
318 FLAG_SET_ERGO(SegmentedCodeCache, true);
319 }
320 if (Arguments::is_compiler_only()) { // -Xcomp
321 // Be much more aggressive in tiered mode with -Xcomp and exercise C2 more.
322 // We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and
323 // compile a level 4 (C2) and then continue executing it.
324 if (FLAG_IS_DEFAULT(Tier3InvokeNotifyFreqLog)) {
325 FLAG_SET_CMDLINE(Tier3InvokeNotifyFreqLog, 0);
326 }
327 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
328 FLAG_SET_CMDLINE(Tier4InvocationThreshold, 0);
329 }
330 }
331 }
332
333 // Current Leyden implementation requires SegmentedCodeCache: the archive-backed AOT code
334 // cache would be initialized only then. Force SegmentedCodeCache if we are loading/storing
335 // AOT code. TODO: Resolve this in code cache initialization code.
336 if (!SegmentedCodeCache && AOTCodeCache::is_caching_enabled()) {
337 FLAG_SET_ERGO(SegmentedCodeCache, true);
338 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
339 FLAG_SET_ERGO(ReservedCodeCacheSize,
340 MIN2(CODE_CACHE_DEFAULT_LIMIT, (size_t)ReservedCodeCacheSize * 5));
341 }
342 }
343
344 if (CompileThresholdScaling < 0) {
345 vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", nullptr);
346 }
347
348 if (CompilationModeFlag::disable_intermediate()) {
349 if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {
350 FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);
351 }
352
353 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
354 FLAG_SET_DEFAULT(Tier4InvocationThreshold, 5000);
355 }
356 if (FLAG_IS_DEFAULT(Tier4MinInvocationThreshold)) {
357 FLAG_SET_DEFAULT(Tier4MinInvocationThreshold, 600);
358 }
359 if (FLAG_IS_DEFAULT(Tier4CompileThreshold)) {
360 FLAG_SET_DEFAULT(Tier4CompileThreshold, 10000);
361 }
362 if (FLAG_IS_DEFAULT(Tier4BackEdgeThreshold)) {
363 FLAG_SET_DEFAULT(Tier4BackEdgeThreshold, 15000);
583
584 // This property is also checked when selecting the heap size. Since client
585 // emulation mode influences Java heap memory usage, part of the logic must
586 // occur before choosing the heap size.
587 if (should_set_client_emulation_mode_flags()) {
588 set_client_emulation_mode_flags();
589 }
590
591 set_legacy_emulation_flags();
592 set_compilation_policy_flags();
593
594 #if INCLUDE_JVMCI
595 // Check that JVMCI supports selected GC.
596 // Should be done after GCConfig::initialize() was called.
597 JVMCIGlobals::check_jvmci_supported_gc();
598
599 // Do JVMCI specific settings
600 set_jvmci_specific_flags();
601 #endif
602
603 if (PreloadOnly) {
604 // Disable profiling/counter updates in interpreter and C1.
605 // This effectively disables most of the normal JIT (re-)compilations.
606 FLAG_SET_DEFAULT(ProfileInterpreter, false);
607 FLAG_SET_DEFAULT(UseOnStackReplacement, false);
608 FLAG_SET_DEFAULT(UseLoopCounter, false);
609
610 // Disable compilations through training data replay.
611 FLAG_SET_DEFAULT(AOTReplayTraining, false);
612 }
613
614 if (UseOnStackReplacement && !UseLoopCounter) {
615 warning("On-stack-replacement requires loop counters; enabling loop counters");
616 FLAG_SET_DEFAULT(UseLoopCounter, true);
617 }
618
619 if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {
620 if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
621 warning("ProfileInterpreter disabled due to client emulation mode");
622 }
623 FLAG_SET_CMDLINE(ProfileInterpreter, false);
624 }
625
626 #ifdef COMPILER2
627 if (!EliminateLocks) {
628 EliminateNestedLocks = false;
629 }
630 if (!Inline || !IncrementalInline) {
631 IncrementalInline = false;
632 IncrementalInlineMH = false;
633 IncrementalInlineVirtual = false;
|