Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/optimizer/EscapeAnalysisTools.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2019, 2020 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
#ifndef ESCAPEANALYSISTOOLS_INCL
24
#define ESCAPEANALYSISTOOLS_INCL
25
26
#include <stdint.h> // for int32_t
27
#include "optimizer/Optimization.hpp" // for Optimization
28
#include "optimizer/OptimizationManager.hpp" // for OptimizationManager
29
#include "optimizer/EscapeAnalysis.hpp"
30
#include "il/SymbolReference.hpp"
31
32
namespace TR { class Block; class Node; }
33
34
//typedef TR::typed_allocator<TR::Node *, TR::Region &> NodeDequeAllocator;
35
//typedef std::deque<TR::Node *, NodeDequeAllocator> NodeDeque;
36
37
class TR_EscapeAnalysisTools
38
{
39
public:
40
TR_EscapeAnalysisTools(TR::Compilation *comp);
41
42
// TODO: Bring Doxygen comments up to date
43
/**
44
* Create a "fake" call to the \c escapeHelper gathering references to all
45
* live autos and pending pushes.
46
*
47
* \param[in] block An OSR induce block containing the call represented by
48
* \c induceCall. The fake \c escapeHelper call that is
49
* generated will be added at the end of this block.
50
* \param[in] induceCall The call to the OSR induction helper in \c block.
51
* Used as the source of byte code info for the fake
52
* \c escapeHelper
53
*/
54
void insertFakeEscapeForOSR(TR::Block *block, TR::Node *induceCall);
55
56
57
void insertFakeEscapeForLoads(TR::Block *block, TR::Node *node, NodeDeque *loads);
58
//static bool isFakeEscape(TR::Node *node) { return node->getSymbolReference()->getReferenceNumber() == TR_prepareForOSR;}
59
static bool isFakeEscape(TR::Node *node) { return node->isEAEscapeHelperCall(); }
60
private:
61
TR::Compilation *_comp;
62
63
/**
64
* Used by \ref insertFakePrepareForOSR to gather \c aloads of autos and
65
* pending pushes.
66
*/
67
NodeDeque *_loads;
68
69
/**
70
* Gather live autos and pending pushes at the point of a call to the OSR
71
* induction helper in the context of an inlined method or the outermost
72
* method. Create an \c aload reference to each such auto or pending push.
73
*
74
* \c aloads are gathered in \ref _loads.
75
*
76
* \param[in] rms The method whose live autos and pending pushes are to be
77
* processed
78
* \param[in] induceDefiningMap \ref DefiningMap mapping from live symbol
79
* references captured during the OSR def liveness analysis
80
* to symbol references defining those symbols in the current
81
* trees
82
* \param[in] methodData \ref TR_OSRMethodData at this point in the
83
* relevant method
84
* \param[in] byteCodeIndex The bytecode index at this point inside the
85
* relevant method
86
*/
87
void processAutosAndPendingPushes(TR::ResolvedMethodSymbol *rms, DefiningMap *induceDefiningMap, TR_OSRMethodData *methodData, int32_t byteCodeIndex);
88
89
/**
90
* Create \c aload references to each live symbol reference among those
91
* listed in the \c symbolReferences argument.
92
*
93
* \c aloads are gathered in \ref _loads.
94
*
95
* \param[in] symbolReferences \ref TR_Array<> of symbol references for
96
* autos or pending pushes
97
* \param[in] induceDefiningMap \ref DefiningMap mapping from live symbol
98
* references captured during the OSR def liveness analysis
99
* to symbol references defining those symbols in the current
100
* trees
101
* \param[in] deadSymRefs Liveness info for \c symbolReferences - a
102
* \ref TR_BitVector of symbols that are not live at the
103
* relevant point
104
*/
105
void processSymbolReferences(TR_Array<List<TR::SymbolReference>> *symbolReferences, DefiningMap *induceDefiningMap, TR_BitVector *deadSymRefs);
106
};
107
108
#endif
109
110
111