Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/optimizer/J9OptimizationManager.cpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2021 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#include "optimizer/OptimizationManager.hpp"
24
#include "optimizer/OptimizationManager_inlines.hpp"
25
26
#include "codegen/CodeGenerator.hpp"
27
#include "env/FrontEnd.hpp"
28
#include "compile/Compilation.hpp"
29
#include "compile/CompilationTypes.hpp"
30
#include "compile/Method.hpp"
31
#include "control/Options.hpp"
32
#include "control/Options_inlines.hpp"
33
#include "env/CompilerEnv.hpp"
34
#include "il/DataTypes.hpp"
35
#include "il/ResolvedMethodSymbol.hpp"
36
#include "infra/Flags.hpp"
37
#include "optimizer/Optimizations.hpp"
38
39
40
namespace TR { class Optimizer; }
41
struct OptimizationStrategy;
42
43
J9::OptimizationManager::OptimizationManager(TR::Optimizer *o, OptimizationFactory factory, OMR::Optimizations optNum, const OptimizationStrategy *groupOfOpts)
44
: OMR::OptimizationManager(o, factory, optNum, groupOfOpts)
45
{
46
// set flags if necessary
47
switch (self()->id())
48
{
49
case OMR::dynamicLiteralPool:
50
_flags.set(doesNotRequireAliasSets);
51
break;
52
case OMR::redundantMonitorElimination:
53
_flags.set(requiresStructure | requiresLocalsValueNumbering);
54
break;
55
case OMR::escapeAnalysis:
56
_flags.set(requiresStructure | checkStructure | dumpStructure |
57
requiresLocalsUseDefInfo | requiresLocalsValueNumbering | cannotOmitTrivialDefs);
58
break;
59
case OMR::globalLiveVariablesForGC:
60
_flags.set(requiresStructure);
61
break;
62
case OMR::recompilationModifier:
63
if (self()->comp()->getMethodHotness() > cold)
64
self()->setRequiresStructure(true);
65
break;
66
case OMR::dataAccessAccelerator:
67
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
68
break;
69
case OMR::stringBuilderTransformer:
70
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
71
break;
72
case OMR::stringPeepholes:
73
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
74
break;
75
case OMR::switchAnalyzer:
76
_flags.set(checkTheCFG);
77
break;
78
case OMR::idiomRecognition:
79
_flags.set(requiresStructure | checkStructure | dumpStructure |
80
requiresLocalsUseDefInfo | requiresLocalsValueNumbering);
81
if (self()->comp()->getMethodHotness() >= warm)
82
_flags.set(requiresLocalsUseDefInfo | doesNotRequireLoadsAsDefs);
83
break;
84
case OMR::loopAliasRefiner:
85
_flags.set(requiresStructure | checkStructure | dumpStructure);
86
self()->setDoesNotRequireAliasSets(false);
87
break;
88
case OMR::allocationSinking:
89
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
90
break;
91
case OMR::varHandleTransformer:
92
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
93
break;
94
case OMR::methodHandleTransformer:
95
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
96
break;
97
case OMR::unsafeFastPath:
98
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
99
break;
100
case OMR::recognizedCallTransformer:
101
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
102
break;
103
case OMR::samplingJProfiling:
104
_flags.set(requiresStructure | checkStructure | dumpStructure);
105
break;
106
case OMR::SPMDKernelParallelization:
107
_flags.set(requiresLocalsUseDefInfo | doesNotRequireLoadsAsDefs | requiresLocalsValueNumbering);
108
break;
109
case OMR::osrGuardInsertion:
110
_flags.set(doNotSetFrequencies);
111
break;
112
case OMR::osrGuardRemoval:
113
_flags.set(requiresStructure);
114
break;
115
case OMR::osrExceptionEdgeRemoval:
116
_flags.set(doesNotRequireAliasSets);
117
break;
118
case OMR::jProfilingBlock:
119
_flags.set(doesNotRequireAliasSets);
120
break;
121
case OMR::jProfilingRecompLoopTest:
122
_flags.set(requiresStructure);
123
break;
124
case OMR::handleRecompilationOps:
125
_flags.set(doesNotRequireAliasSets | supportsIlGenOptLevel);
126
break;
127
default:
128
// do nothing
129
break;
130
}
131
}
132
133