Path: blob/master/runtime/compiler/arm/codegen/CallSnippet.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2000, 2016 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 ARMCALLSNIPPET_INCL23#define ARMCALLSNIPPET_INCL2425#include "codegen/Snippet.hpp"26#include "codegen/ARMInstruction.hpp"2728class TR_J2IThunk;2930extern void armCodeSync(uint8_t *codePointer, uint32_t codeSize);3132namespace TR {3334class ARMCallSnippet : public TR::Snippet35{36int32_t sizeOfArguments;37uint8_t *callRA;3839public:4041ARMCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s)42: TR::Snippet(cg, c, lab, false), sizeOfArguments(s), callRA(0) {}4344virtual Kind getKind() { return IsCall; }4546virtual uint8_t *emitSnippetBody();4748virtual uint32_t getLength(int32_t estimatedSnippetStart);4950int32_t getSizeOfArguments() {return sizeOfArguments;}51int32_t setSizeOfArguments(int32_t s) {return (sizeOfArguments = s);}5253uint8_t *getCallRA() {return callRA;}54uint8_t *setCallRA(uint8_t *ra) {return (callRA=ra);}5556TR_RuntimeHelper getHelper();5758static uint8_t *generateVIThunk(TR::Node *callNode, int32_t argSize, TR::CodeGenerator *cg);59static TR_J2IThunk *generateInvokeExactJ2IThunk(TR::Node *callNode, int32_t argSize, TR::CodeGenerator *cg, char *signature);60};6162class ARMUnresolvedCallSnippet : public TR::ARMCallSnippet63{6465public:6667ARMUnresolvedCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s)68: TR::ARMCallSnippet(cg, c, lab, s)69{70}7172virtual Kind getKind() { return IsUnresolvedCall; }7374virtual uint8_t *emitSnippetBody();7576virtual uint32_t getLength(int32_t estimatedSnippetStart);77};7879class ARMVirtualSnippet : public TR::Snippet80{81int32_t sizeOfArguments;82TR::LabelSymbol *returnLabel;8384public:8586ARMVirtualSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl)87: TR::Snippet(cg, c, lab, false), sizeOfArguments(s), returnLabel(retl)88{89}9091TR::LabelSymbol *getReturnLabel() {return returnLabel;}92TR::LabelSymbol *setReturnLabel(TR::LabelSymbol *rl) {return (returnLabel=rl);}93};9495class ARMVirtualUnresolvedSnippet : public TR::ARMVirtualSnippet96{97uint8_t *thunkAddress;98public:99100ARMVirtualUnresolvedSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl)101: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(NULL) {}102103ARMVirtualUnresolvedSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl, uint8_t *thunkPtr)104: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(thunkPtr) {}105106virtual Kind getKind() { return IsVirtualUnresolved; }107108virtual uint8_t *emitSnippetBody();109110virtual uint32_t getLength(int32_t estimatedSnippetStart);111};112113class ARMInterfaceCallSnippet : public TR::ARMVirtualSnippet114{115uint8_t *thunkAddress;116public:117118ARMInterfaceCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl)119: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(NULL) {}120121ARMInterfaceCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl122, uint8_t *thunkPtr)123: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(thunkPtr) {}124virtual Kind getKind() { return IsInterfaceCall; }125126virtual uint8_t *emitSnippetBody();127128virtual uint32_t getLength(int32_t estimatedSnippetStart);129};130131}132133#endif134135136