Path: blob/master/runtime/compiler/optimizer/BoolArrayStoreTransformer.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2018, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#ifndef BoolArrayStoreTransformer_h23#define BoolArrayStoreTransformer_h2425#include <set>26#include <vector>27#include "il/ParameterSymbol.hpp"28#include "compile/Compilation.hpp"29#include "infra/Checklist.hpp"30#include "infra/List.hpp"3132class TR_BoolArrayStoreTransformer33{34public:3536typedef TR::typed_allocator<TR::Node*, TR::Region &> NodeAllocator;37typedef std::set<TR::Node*, std::less<TR::Node*>, NodeAllocator> NodeSet;3839TR_BoolArrayStoreTransformer(NodeSet *bstoreiNodes, NodeSet *boolArrayTypeNodes);40void perform();4142typedef TR::typed_allocator<TR_YesNoMaybe, TR::Region &> TypeInfoAllocator;43typedef std::vector<TR_YesNoMaybe, TypeInfoAllocator> TypeInfo;4445TypeInfo * processBlock(TR::Block *block, TypeInfo *typeInfo);46static bool isAnyDimensionBoolArrayNode(TR::Node *node);47static bool isAnyDimensionByteArrayNode(TR::Node *node);48static bool isAnyDimensionBoolArrayParm(TR::ParameterSymbol *symbol);49static bool isAnyDimensionByteArrayParm(TR::ParameterSymbol *symbol);50static bool isBoolArrayNode(TR::Node *node, bool parmAsAuto = true);51static bool isByteArrayNode(TR::Node *node, bool parmAsAuto = true);52static bool isBoolArrayParm(TR::ParameterSymbol *symbol);53static bool isByteArrayParm(TR::ParameterSymbol *symbol);54static int getArrayDimension(TR::Node *node, bool boolType, bool parmAsAuto = true);55static int getArrayDimension(const char * signature, int length, bool boolType);56void findLoadAddressAutoAndFigureOutType(TR::Node *node, TypeInfo * typeInfo, TR::NodeChecklist &boolArrayNodes, TR::NodeChecklist &byteArrayNodes, TR::NodeChecklist &loadAutoNodes);57void mergeTypeInfo(TypeInfo *first, TypeInfo *second);58void collectLocals(TR_Array<List<TR::SymbolReference>> *autosListArray);59void findBoolArrayStoreNodes();60void transformBoolArrayStoreNodes();61void transformUnknownTypeArrayStore();62bool hasBoolArrayAutoOrCheckCast() { return _hasBoolArrayAutoOrCheckCast;}63bool hasByteArrayAutoOrCheckCast() { return _hasByteArrayAutoOrCheckCast;}64void setHasBoolArrayAutoOrCheckCast() { _hasBoolArrayAutoOrCheckCast = true;}65void setHasByteArrayAutoOrCheckCast() { _hasByteArrayAutoOrCheckCast = true;}66void setHasVariantArgs() { _hasVariantArgs = true;}67uint32_t _numLocals;68TR::Compilation *comp() { return _comp; }6970private:71TR::Compilation *_comp;72NodeSet *_bstoreiUnknownArrayTypeNodes;73NodeSet *_bstoreiBoolArrayTypeNodes;74bool _hasBoolArrayAutoOrCheckCast;75bool _hasByteArrayAutoOrCheckCast;76bool _hasVariantArgs;77int32_t _NumOfBstoreiNodesToVisit;78};7980#endif818283