Path: blob/master/runtime/compiler/aarch64/codegen/J9TreeEvaluator.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2019, 2021 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 J9_ARM64_TREE_EVALUATOR_INCL23#define J9_ARM64_TREE_EVALUATOR_INCL2425/*26* The following #define and typedef must appear before any #includes in this file27*/28#ifndef J9_TREE_EVALUATOR_CONNECTOR29#define J9_TREE_EVALUATOR_CONNECTOR30namespace J9 { namespace ARM64 { class TreeEvaluator; } }31namespace J9 { typedef J9::ARM64::TreeEvaluator TreeEvaluatorConnector; }32#else33#error J9::ARM64::TreeEvaluator expected to be a primary connector, but a J9 connector is already defined34#endif353637#include "compiler/codegen/J9TreeEvaluator.hpp" // include parent38#include "il/LabelSymbol.hpp"3940namespace J941{4243namespace ARM6444{4546class OMR_EXTENSIBLE TreeEvaluator: public J9::TreeEvaluator47{48public:4950static TR::Register *awrtbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);51static TR::Register *awrtbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);5253static TR::Register *irdbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);54static TR::Register *irdbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);55static TR::Register *ardbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);56static TR::Register *ardbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);57static TR::Register *fwrtbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);58static TR::Register *fwrtbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);59static TR::Register *dwrtbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);60static TR::Register *dwrtbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);6162static TR::Register *DIVCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);6364static TR::Register *flushEvaluator(TR::Node *node, TR::CodeGenerator *cg);65static TR::Register *BNDCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);66static TR::Register *conditionalHelperEvaluator(TR::Node *node, TR::CodeGenerator *cg);67/*68* Generates instructions to fill in the J9JITWatchedStaticFieldData.fieldAddress, J9JITWatchedStaticFieldData.fieldClass for static fields,69* and J9JITWatchedInstanceFieldData.offset for instance fields at runtime. Used for fieldwatch support.70* @param dataSnippetRegister: Optional, can be used to pass the address of the snippet inside the register.71*/72static void generateFillInDataBlockSequenceForUnresolvedField (TR::CodeGenerator *cg, TR::Node *node, TR::Snippet *dataSnippet, bool isWrite, TR::Register *sideEffectRegister, TR::Register *dataSnippetRegister);7374/*75* Generate instructions for static/instance field access report.76* @param dataSnippetRegister: Optional, can be used to pass the address of the snippet inside the register.77*/78static void generateTestAndReportFieldWatchInstructions(TR::CodeGenerator *cg, TR::Node *node, TR::Snippet *dataSnippet, bool isWrite, TR::Register *sideEffectRegister, TR::Register *valueReg, TR::Register *dataSnippetRegister);7980/**81* @brief Generates instructions for inlining new/newarray/anewarray82*83* @param[in] node: node84* @param[in] cg: code generator85*86* @return register containing allocated object, NULL if inlining is not possible87*/88static TR::Register *VMnewEvaluator(TR::Node *node, TR::CodeGenerator *cg);8990static TR::Register *monexitEvaluator(TR::Node *node, TR::CodeGenerator *cg);9192static TR::Register *instanceofEvaluator(TR::Node *node, TR::CodeGenerator *cg);9394/**95* @brief Generates instructions for inlining instanceof96*97* @param[in] node: node98* @param[in] cg: code generator99*100* @return register containing the result of instanceof101*/102static TR::Register *VMinstanceofEvaluator(TR::Node *node, TR::CodeGenerator *cg);103104/**105* @brief Generates instructions for inlining checkcast106*107* @param[in] node: node108* @param[in] cg: code generator109*110* @return register whcih is always NULL111*/112static TR::Register *VMcheckcastEvaluator(TR::Node *node, TR::CodeGenerator *cg);113114static TR::Register *checkcastAndNULLCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);115116static TR::Register *checkcastEvaluator(TR::Node *node, TR::CodeGenerator *cg);117118static TR::Register *newObjectEvaluator(TR::Node *node, TR::CodeGenerator *cg);119120static TR::Register *newArrayEvaluator(TR::Node *node, TR::CodeGenerator *cg);121122static TR::Register *anewArrayEvaluator(TR::Node *node, TR::CodeGenerator *cg);123124static TR::Register *monentEvaluator(TR::Node *node, TR::CodeGenerator *cg);125126static TR::Register *arraylengthEvaluator(TR::Node *node, TR::CodeGenerator *cg);127128static TR::Register *multianewArrayEvaluator(TR::Node *node, TR::CodeGenerator *cg);129130static TR::Register *asynccheckEvaluator(TR::Node *node, TR::CodeGenerator *cg);131132static TR::Register *ArrayStoreCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);133134static TR::Register *ArrayCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);135136static TR::Register *arraycopyEvaluator(TR::Node *node, TR::CodeGenerator *cg);137138static TR::Register *ZEROCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);139140static TR::Instruction *generateVFTMaskInstruction(TR::CodeGenerator *cg, TR::Node *node, TR::Register *dstReg, TR::Register *srcReg, TR::Instruction *preced=NULL);141static TR::Instruction *generateVFTMaskInstruction(TR::CodeGenerator *cg, TR::Node *node, TR::Register *reg, TR::Instruction *preced=NULL);142143static TR::Register *loadaddrEvaluator(TR::Node *node, TR::CodeGenerator *cg);144145/*146* @brief Calls helper function for float/double remainder147* @param[in] node : node148* @param[in] cg : CodeGenerator149* @param[in] isSinglePrecision : true if type is single precision float150*/151static TR::Register *fremHelper(TR::Node *node, TR::CodeGenerator *cg, bool isSinglePrecision);152static TR::Register *fremEvaluator(TR::Node *node, TR::CodeGenerator *cg);153static TR::Register *dremEvaluator(TR::Node *node, TR::CodeGenerator *cg);154static TR::Register *NULLCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);155static TR::Register *resolveAndNULLCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);156static TR::Register *evaluateNULLCHKWithPossibleResolve(TR::Node *node, bool needResolution, TR::CodeGenerator *cg);157158static TR::Register *BNDCHKwithSpineCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);159160/**161* @brief Handles direct call nodes162* @param[in] node : node163* @param[in] cg : CodeGenerator164* @return register containing result165*/166static TR::Register *directCallEvaluator(TR::Node *node, TR::CodeGenerator *cg);167168/**169* @brief Generates the sequence to handle cases where the monitor object is value type170* @param[in] node : the monitor enter/exit node171* @param[in] mergeLabel : the label to return from OOL code172* @param[in] helperCallLabel : the label for OOL code calling VM monitor enter/exit helpers. If null, an OOL code section is created.173* @param[in] objReg : register for the monitor object174* @param[in] temp1Reg : temporary register 1175* @param[in] temp2Reg : temporary register 2176* @param[in] cg : CodeGenerator177* @param[in] classFlag : class flag178*/179static void generateCheckForValueMonitorEnterOrExit(TR::Node *node, TR::LabelSymbol *mergeLabel, TR::LabelSymbol *helperCallLabel, TR::Register *objReg, TR::Register *temp1Reg, TR::Register *temp2Reg, TR::CodeGenerator *cg, int32_t classFlag);180181/**182* @brief Generates array copy code with array store check183* @param[in] node : node184* @param[in] cg : CodeGenerator185*/186static void genArrayCopyWithArrayStoreCHK(TR::Node *node, TR::CodeGenerator *cg);187188/**189* @brief Generates write barrier code for array copy190* @param[in] node : node191* @param[in] srcObjReg : register for the source object192* @param[in] dstObjReg : register for the destination object193* @param[in] cg : CodeGenerator194*/195static void genWrtbarForArrayCopy(TR::Node *node, TR::Register *srcObjReg, TR::Register *dstObjReg, TR::CodeGenerator *cg);196};197198} // ARM64199200} // J9201202#endif203204205