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 };
309 }
310 // Enable SegmentedCodeCache if tiered compilation is enabled, ReservedCodeCacheSize >= 240M
311 // and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).
312 if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&
313 8 * CodeCache::page_size() <= ReservedCodeCacheSize) {
314 FLAG_SET_ERGO(SegmentedCodeCache, true);
315 }
316 if (Arguments::is_compiler_only()) { // -Xcomp
317 // Be much more aggressive in tiered mode with -Xcomp and exercise C2 more.
318 // We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and
319 // compile a level 4 (C2) and then continue executing it.
320 if (FLAG_IS_DEFAULT(Tier3InvokeNotifyFreqLog)) {
321 FLAG_SET_CMDLINE(Tier3InvokeNotifyFreqLog, 0);
322 }
323 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
324 FLAG_SET_CMDLINE(Tier4InvocationThreshold, 0);
325 }
326 }
327 }
328
329 if (CompileThresholdScaling < 0) {
330 vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", nullptr);
331 }
332
333 if (CompilationModeFlag::disable_intermediate()) {
334 if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {
335 FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);
336 }
337
338 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
339 FLAG_SET_DEFAULT(Tier4InvocationThreshold, 5000);
340 }
341 if (FLAG_IS_DEFAULT(Tier4MinInvocationThreshold)) {
342 FLAG_SET_DEFAULT(Tier4MinInvocationThreshold, 600);
343 }
344 if (FLAG_IS_DEFAULT(Tier4CompileThreshold)) {
345 FLAG_SET_DEFAULT(Tier4CompileThreshold, 10000);
346 }
347 if (FLAG_IS_DEFAULT(Tier4BackEdgeThreshold)) {
348 FLAG_SET_DEFAULT(Tier4BackEdgeThreshold, 15000);
558
559 // This property is also checked when selecting the heap size. Since client
560 // emulation mode influences Java heap memory usage, part of the logic must
561 // occur before choosing the heap size.
562 if (should_set_client_emulation_mode_flags()) {
563 set_client_emulation_mode_flags();
564 }
565
566 set_legacy_emulation_flags();
567 set_compilation_policy_flags();
568
569 #if INCLUDE_JVMCI
570 // Check that JVMCI supports selected GC.
571 // Should be done after GCConfig::initialize() was called.
572 JVMCIGlobals::check_jvmci_supported_gc();
573
574 // Do JVMCI specific settings
575 set_jvmci_specific_flags();
576 #endif
577
578 if (UseOnStackReplacement && !UseLoopCounter) {
579 warning("On-stack-replacement requires loop counters; enabling loop counters");
580 FLAG_SET_DEFAULT(UseLoopCounter, true);
581 }
582
583 if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {
584 if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
585 warning("ProfileInterpreter disabled due to client emulation mode");
586 }
587 FLAG_SET_CMDLINE(ProfileInterpreter, false);
588 }
589
590 #ifdef COMPILER2
591 if (!EliminateLocks) {
592 EliminateNestedLocks = false;
593 }
594 if (!Inline || !IncrementalInline) {
595 IncrementalInline = false;
596 IncrementalInlineMH = false;
597 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 };
310 }
311 // Enable SegmentedCodeCache if tiered compilation is enabled, ReservedCodeCacheSize >= 240M
312 // and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).
313 if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&
314 8 * CodeCache::page_size() <= ReservedCodeCacheSize) {
315 FLAG_SET_ERGO(SegmentedCodeCache, true);
316 }
317 if (Arguments::is_compiler_only()) { // -Xcomp
318 // Be much more aggressive in tiered mode with -Xcomp and exercise C2 more.
319 // We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and
320 // compile a level 4 (C2) and then continue executing it.
321 if (FLAG_IS_DEFAULT(Tier3InvokeNotifyFreqLog)) {
322 FLAG_SET_CMDLINE(Tier3InvokeNotifyFreqLog, 0);
323 }
324 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
325 FLAG_SET_CMDLINE(Tier4InvocationThreshold, 0);
326 }
327 }
328 }
329
330 // Current Leyden implementation requires SegmentedCodeCache: the archive-backed AOT code
331 // cache would be initialized only then. Force SegmentedCodeCache if we are loading/storing
332 // AOT code. TODO: Resolve this in code cache initialization code.
333 if (!SegmentedCodeCache && AOTCodeCache::is_caching_enabled()) {
334 FLAG_SET_ERGO(SegmentedCodeCache, true);
335 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
336 FLAG_SET_ERGO(ReservedCodeCacheSize,
337 MIN2(CODE_CACHE_DEFAULT_LIMIT, (size_t)ReservedCodeCacheSize * 5));
338 }
339 }
340
341 if (CompileThresholdScaling < 0) {
342 vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", nullptr);
343 }
344
345 if (CompilationModeFlag::disable_intermediate()) {
346 if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {
347 FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);
348 }
349
350 if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {
351 FLAG_SET_DEFAULT(Tier4InvocationThreshold, 5000);
352 }
353 if (FLAG_IS_DEFAULT(Tier4MinInvocationThreshold)) {
354 FLAG_SET_DEFAULT(Tier4MinInvocationThreshold, 600);
355 }
356 if (FLAG_IS_DEFAULT(Tier4CompileThreshold)) {
357 FLAG_SET_DEFAULT(Tier4CompileThreshold, 10000);
358 }
359 if (FLAG_IS_DEFAULT(Tier4BackEdgeThreshold)) {
360 FLAG_SET_DEFAULT(Tier4BackEdgeThreshold, 15000);
570
571 // This property is also checked when selecting the heap size. Since client
572 // emulation mode influences Java heap memory usage, part of the logic must
573 // occur before choosing the heap size.
574 if (should_set_client_emulation_mode_flags()) {
575 set_client_emulation_mode_flags();
576 }
577
578 set_legacy_emulation_flags();
579 set_compilation_policy_flags();
580
581 #if INCLUDE_JVMCI
582 // Check that JVMCI supports selected GC.
583 // Should be done after GCConfig::initialize() was called.
584 JVMCIGlobals::check_jvmci_supported_gc();
585
586 // Do JVMCI specific settings
587 set_jvmci_specific_flags();
588 #endif
589
590 if (PreloadOnly) {
591 // Disable profiling/counter updates in interpreter and C1.
592 // This effectively disables most of the normal JIT (re-)compilations.
593 FLAG_SET_DEFAULT(ProfileInterpreter, false);
594 FLAG_SET_DEFAULT(UseOnStackReplacement, false);
595 FLAG_SET_DEFAULT(UseLoopCounter, false);
596
597 // Disable compilations through training data replay.
598 FLAG_SET_DEFAULT(AOTReplayTraining, false);
599 }
600
601 if (UseOnStackReplacement && !UseLoopCounter) {
602 warning("On-stack-replacement requires loop counters; enabling loop counters");
603 FLAG_SET_DEFAULT(UseLoopCounter, true);
604 }
605
606 if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {
607 if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
608 warning("ProfileInterpreter disabled due to client emulation mode");
609 }
610 FLAG_SET_CMDLINE(ProfileInterpreter, false);
611 }
612
613 #ifdef COMPILER2
614 if (!EliminateLocks) {
615 EliminateNestedLocks = false;
616 }
617 if (!Inline || !IncrementalInline) {
618 IncrementalInline = false;
619 IncrementalInlineMH = false;
620 IncrementalInlineVirtual = false;
|