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);
573
574 // This property is also checked when selecting the heap size. Since client
575 // emulation mode influences Java heap memory usage, part of the logic must
576 // occur before choosing the heap size.
577 if (should_set_client_emulation_mode_flags()) {
578 set_client_emulation_mode_flags();
579 }
580
581 set_legacy_emulation_flags();
582 set_compilation_policy_flags();
583
584 #if INCLUDE_JVMCI
585 // Check that JVMCI supports selected GC.
586 // Should be done after GCConfig::initialize() was called.
587 JVMCIGlobals::check_jvmci_supported_gc();
588
589 // Do JVMCI specific settings
590 set_jvmci_specific_flags();
591 #endif
592
593 if (UseOnStackReplacement && !UseLoopCounter) {
594 warning("On-stack-replacement requires loop counters; enabling loop counters");
595 FLAG_SET_DEFAULT(UseLoopCounter, true);
596 }
597
598 if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {
599 if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
600 warning("ProfileInterpreter disabled due to client emulation mode");
601 }
602 FLAG_SET_CMDLINE(ProfileInterpreter, false);
603 }
604
605 #ifdef COMPILER2
606 if (!EliminateLocks) {
607 EliminateNestedLocks = false;
608 }
609 if (!Inline || !IncrementalInline) {
610 IncrementalInline = false;
611 IncrementalInlineMH = false;
612 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);
585
586 // This property is also checked when selecting the heap size. Since client
587 // emulation mode influences Java heap memory usage, part of the logic must
588 // occur before choosing the heap size.
589 if (should_set_client_emulation_mode_flags()) {
590 set_client_emulation_mode_flags();
591 }
592
593 set_legacy_emulation_flags();
594 set_compilation_policy_flags();
595
596 #if INCLUDE_JVMCI
597 // Check that JVMCI supports selected GC.
598 // Should be done after GCConfig::initialize() was called.
599 JVMCIGlobals::check_jvmci_supported_gc();
600
601 // Do JVMCI specific settings
602 set_jvmci_specific_flags();
603 #endif
604
605 if (PreloadOnly) {
606 // Disable profiling/counter updates in interpreter and C1.
607 // This effectively disables most of the normal JIT (re-)compilations.
608 FLAG_SET_DEFAULT(ProfileInterpreter, false);
609 FLAG_SET_DEFAULT(UseOnStackReplacement, false);
610 FLAG_SET_DEFAULT(UseLoopCounter, false);
611
612 // Disable compilations through training data replay.
613 FLAG_SET_DEFAULT(AOTReplayTraining, false);
614 }
615
616 if (UseOnStackReplacement && !UseLoopCounter) {
617 warning("On-stack-replacement requires loop counters; enabling loop counters");
618 FLAG_SET_DEFAULT(UseLoopCounter, true);
619 }
620
621 if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {
622 if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
623 warning("ProfileInterpreter disabled due to client emulation mode");
624 }
625 FLAG_SET_CMDLINE(ProfileInterpreter, false);
626 }
627
628 #ifdef COMPILER2
629 if (!EliminateLocks) {
630 EliminateNestedLocks = false;
631 }
632 if (!Inline || !IncrementalInline) {
633 IncrementalInline = false;
634 IncrementalInlineMH = false;
635 IncrementalInlineVirtual = false;
|