1/*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 "precompiled.hpp"
26#include "runtime/globals.hpp"
27#include "runtime/globals_extension.hpp"
28#include "compiler/compilerDefinitions.hpp"
29
30const char* compilertype2name_tab[compiler_number_of_types] = {
31  "",
32  "c1",
33  "c2",
34  "jvmci",
35  "shark"
36};
37
38#if defined(COMPILER2) || defined(SHARK)
39CompLevel  CompLevel_highest_tier      = CompLevel_full_optimization;  // pure C2 and tiered or JVMCI and tiered
40#elif defined(COMPILER1)
41CompLevel  CompLevel_highest_tier      = CompLevel_simple;             // pure C1 or JVMCI
42#else
43CompLevel  CompLevel_highest_tier      = CompLevel_none;
44#endif
45
46#if defined(TIERED)
47CompLevel  CompLevel_initial_compile   = CompLevel_full_profile;        // tiered
48#elif defined(COMPILER1) || INCLUDE_JVMCI
49CompLevel  CompLevel_initial_compile   = CompLevel_simple;              // pure C1 or JVMCI
50#elif defined(COMPILER2) || defined(SHARK)
51CompLevel  CompLevel_initial_compile   = CompLevel_full_optimization;   // pure C2
52#else
53CompLevel  CompLevel_initial_compile   = CompLevel_none;
54#endif
55
56#if defined(COMPILER2)
57CompMode  Compilation_mode             = CompMode_server;
58#elif defined(COMPILER1)
59CompMode  Compilation_mode             = CompMode_client;
60#else
61CompMode  Compilation_mode             = CompMode_none;
62#endif
63
64#ifdef TIERED
65void set_client_compilation_mode() {
66  Compilation_mode = CompMode_client;
67  CompLevel_highest_tier = CompLevel_simple;
68  CompLevel_initial_compile = CompLevel_simple;
69  FLAG_SET_ERGO(bool, TieredCompilation, false);
70  FLAG_SET_ERGO(bool, ProfileInterpreter, false);
71#if INCLUDE_JVMCI
72  FLAG_SET_ERGO(bool, EnableJVMCI, false);
73  FLAG_SET_ERGO(bool, UseJVMCICompiler, false);
74#endif
75#if INCLUDE_AOT
76  FLAG_SET_ERGO(bool, UseAOT, false);
77#endif
78  if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
79    FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
80  }
81  if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
82    FLAG_SET_ERGO(uintx, InitialCodeCacheSize, 160*K);
83  }
84  if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
85    FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, 32*M);
86  }
87  if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
88    FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 27*M);
89  }
90  if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
91    FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0);
92  }
93  if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) {
94    FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, 5*M);
95  }
96  if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) {
97    FLAG_SET_ERGO(uintx, CodeCacheExpansionSize, 32*K);
98  }
99  if (FLAG_IS_DEFAULT(MetaspaceSize)) {
100    FLAG_SET_ERGO(size_t, MetaspaceSize, 12*M);
101  }
102  if (FLAG_IS_DEFAULT(MaxRAM)) {
103    // Do not use FLAG_SET_ERGO to update MaxRAM, as this will impact
104    // heap setting done based on available phys_mem (see Arguments::set_heap_size).
105    FLAG_SET_DEFAULT(MaxRAM, 1ULL*G);
106  }
107  if (FLAG_IS_DEFAULT(CompileThreshold)) {
108    FLAG_SET_ERGO(intx, CompileThreshold, 1500);
109  }
110  if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
111    FLAG_SET_ERGO(intx, OnStackReplacePercentage, 933);
112  }
113  if (FLAG_IS_DEFAULT(CICompilerCount)) {
114    FLAG_SET_ERGO(intx, CICompilerCount, 1);
115  }
116}
117#endif // TIERED
118