Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/optimizer/BoolArrayStoreTransformer.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2018, 2019 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 BoolArrayStoreTransformer_h
24
#define BoolArrayStoreTransformer_h
25
26
#include <set>
27
#include <vector>
28
#include "il/ParameterSymbol.hpp"
29
#include "compile/Compilation.hpp"
30
#include "infra/Checklist.hpp"
31
#include "infra/List.hpp"
32
33
class TR_BoolArrayStoreTransformer
34
{
35
public:
36
37
typedef TR::typed_allocator<TR::Node*, TR::Region &> NodeAllocator;
38
typedef std::set<TR::Node*, std::less<TR::Node*>, NodeAllocator> NodeSet;
39
40
TR_BoolArrayStoreTransformer(NodeSet *bstoreiNodes, NodeSet *boolArrayTypeNodes);
41
void perform();
42
43
typedef TR::typed_allocator<TR_YesNoMaybe, TR::Region &> TypeInfoAllocator;
44
typedef std::vector<TR_YesNoMaybe, TypeInfoAllocator> TypeInfo;
45
46
TypeInfo * processBlock(TR::Block *block, TypeInfo *typeInfo);
47
static bool isAnyDimensionBoolArrayNode(TR::Node *node);
48
static bool isAnyDimensionByteArrayNode(TR::Node *node);
49
static bool isAnyDimensionBoolArrayParm(TR::ParameterSymbol *symbol);
50
static bool isAnyDimensionByteArrayParm(TR::ParameterSymbol *symbol);
51
static bool isBoolArrayNode(TR::Node *node, bool parmAsAuto = true);
52
static bool isByteArrayNode(TR::Node *node, bool parmAsAuto = true);
53
static bool isBoolArrayParm(TR::ParameterSymbol *symbol);
54
static bool isByteArrayParm(TR::ParameterSymbol *symbol);
55
static int getArrayDimension(TR::Node *node, bool boolType, bool parmAsAuto = true);
56
static int getArrayDimension(const char * signature, int length, bool boolType);
57
void findLoadAddressAutoAndFigureOutType(TR::Node *node, TypeInfo * typeInfo, TR::NodeChecklist &boolArrayNodes, TR::NodeChecklist &byteArrayNodes, TR::NodeChecklist &loadAutoNodes);
58
void mergeTypeInfo(TypeInfo *first, TypeInfo *second);
59
void collectLocals(TR_Array<List<TR::SymbolReference>> *autosListArray);
60
void findBoolArrayStoreNodes();
61
void transformBoolArrayStoreNodes();
62
void transformUnknownTypeArrayStore();
63
bool hasBoolArrayAutoOrCheckCast() { return _hasBoolArrayAutoOrCheckCast;}
64
bool hasByteArrayAutoOrCheckCast() { return _hasByteArrayAutoOrCheckCast;}
65
void setHasBoolArrayAutoOrCheckCast() { _hasBoolArrayAutoOrCheckCast = true;}
66
void setHasByteArrayAutoOrCheckCast() { _hasByteArrayAutoOrCheckCast = true;}
67
void setHasVariantArgs() { _hasVariantArgs = true;}
68
uint32_t _numLocals;
69
TR::Compilation *comp() { return _comp; }
70
71
private:
72
TR::Compilation *_comp;
73
NodeSet *_bstoreiUnknownArrayTypeNodes;
74
NodeSet *_bstoreiBoolArrayTypeNodes;
75
bool _hasBoolArrayAutoOrCheckCast;
76
bool _hasByteArrayAutoOrCheckCast;
77
bool _hasVariantArgs;
78
int32_t _NumOfBstoreiNodesToVisit;
79
};
80
81
#endif
82
83