Path: blob/master/runtime/compiler/optimizer/EscapeAnalysisTools.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2019, 2020 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 ESCAPEANALYSISTOOLS_INCL23#define ESCAPEANALYSISTOOLS_INCL2425#include <stdint.h> // for int32_t26#include "optimizer/Optimization.hpp" // for Optimization27#include "optimizer/OptimizationManager.hpp" // for OptimizationManager28#include "optimizer/EscapeAnalysis.hpp"29#include "il/SymbolReference.hpp"3031namespace TR { class Block; class Node; }3233//typedef TR::typed_allocator<TR::Node *, TR::Region &> NodeDequeAllocator;34//typedef std::deque<TR::Node *, NodeDequeAllocator> NodeDeque;3536class TR_EscapeAnalysisTools37{38public:39TR_EscapeAnalysisTools(TR::Compilation *comp);4041// TODO: Bring Doxygen comments up to date42/**43* Create a "fake" call to the \c escapeHelper gathering references to all44* live autos and pending pushes.45*46* \param[in] block An OSR induce block containing the call represented by47* \c induceCall. The fake \c escapeHelper call that is48* generated will be added at the end of this block.49* \param[in] induceCall The call to the OSR induction helper in \c block.50* Used as the source of byte code info for the fake51* \c escapeHelper52*/53void insertFakeEscapeForOSR(TR::Block *block, TR::Node *induceCall);545556void insertFakeEscapeForLoads(TR::Block *block, TR::Node *node, NodeDeque *loads);57//static bool isFakeEscape(TR::Node *node) { return node->getSymbolReference()->getReferenceNumber() == TR_prepareForOSR;}58static bool isFakeEscape(TR::Node *node) { return node->isEAEscapeHelperCall(); }59private:60TR::Compilation *_comp;6162/**63* Used by \ref insertFakePrepareForOSR to gather \c aloads of autos and64* pending pushes.65*/66NodeDeque *_loads;6768/**69* Gather live autos and pending pushes at the point of a call to the OSR70* induction helper in the context of an inlined method or the outermost71* method. Create an \c aload reference to each such auto or pending push.72*73* \c aloads are gathered in \ref _loads.74*75* \param[in] rms The method whose live autos and pending pushes are to be76* processed77* \param[in] induceDefiningMap \ref DefiningMap mapping from live symbol78* references captured during the OSR def liveness analysis79* to symbol references defining those symbols in the current80* trees81* \param[in] methodData \ref TR_OSRMethodData at this point in the82* relevant method83* \param[in] byteCodeIndex The bytecode index at this point inside the84* relevant method85*/86void processAutosAndPendingPushes(TR::ResolvedMethodSymbol *rms, DefiningMap *induceDefiningMap, TR_OSRMethodData *methodData, int32_t byteCodeIndex);8788/**89* Create \c aload references to each live symbol reference among those90* listed in the \c symbolReferences argument.91*92* \c aloads are gathered in \ref _loads.93*94* \param[in] symbolReferences \ref TR_Array<> of symbol references for95* autos or pending pushes96* \param[in] induceDefiningMap \ref DefiningMap mapping from live symbol97* references captured during the OSR def liveness analysis98* to symbol references defining those symbols in the current99* trees100* \param[in] deadSymRefs Liveness info for \c symbolReferences - a101* \ref TR_BitVector of symbols that are not live at the102* relevant point103*/104void processSymbolReferences(TR_Array<List<TR::SymbolReference>> *symbolReferences, DefiningMap *induceDefiningMap, TR_BitVector *deadSymRefs);105};106107#endif108109110111