Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/arm/codegen/CallSnippet.hpp
6004 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2016 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 ARMCALLSNIPPET_INCL
24
#define ARMCALLSNIPPET_INCL
25
26
#include "codegen/Snippet.hpp"
27
#include "codegen/ARMInstruction.hpp"
28
29
class TR_J2IThunk;
30
31
extern void armCodeSync(uint8_t *codePointer, uint32_t codeSize);
32
33
namespace TR {
34
35
class ARMCallSnippet : public TR::Snippet
36
{
37
int32_t sizeOfArguments;
38
uint8_t *callRA;
39
40
public:
41
42
ARMCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s)
43
: TR::Snippet(cg, c, lab, false), sizeOfArguments(s), callRA(0) {}
44
45
virtual Kind getKind() { return IsCall; }
46
47
virtual uint8_t *emitSnippetBody();
48
49
virtual uint32_t getLength(int32_t estimatedSnippetStart);
50
51
int32_t getSizeOfArguments() {return sizeOfArguments;}
52
int32_t setSizeOfArguments(int32_t s) {return (sizeOfArguments = s);}
53
54
uint8_t *getCallRA() {return callRA;}
55
uint8_t *setCallRA(uint8_t *ra) {return (callRA=ra);}
56
57
TR_RuntimeHelper getHelper();
58
59
static uint8_t *generateVIThunk(TR::Node *callNode, int32_t argSize, TR::CodeGenerator *cg);
60
static TR_J2IThunk *generateInvokeExactJ2IThunk(TR::Node *callNode, int32_t argSize, TR::CodeGenerator *cg, char *signature);
61
};
62
63
class ARMUnresolvedCallSnippet : public TR::ARMCallSnippet
64
{
65
66
public:
67
68
ARMUnresolvedCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s)
69
: TR::ARMCallSnippet(cg, c, lab, s)
70
{
71
}
72
73
virtual Kind getKind() { return IsUnresolvedCall; }
74
75
virtual uint8_t *emitSnippetBody();
76
77
virtual uint32_t getLength(int32_t estimatedSnippetStart);
78
};
79
80
class ARMVirtualSnippet : public TR::Snippet
81
{
82
int32_t sizeOfArguments;
83
TR::LabelSymbol *returnLabel;
84
85
public:
86
87
ARMVirtualSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl)
88
: TR::Snippet(cg, c, lab, false), sizeOfArguments(s), returnLabel(retl)
89
{
90
}
91
92
TR::LabelSymbol *getReturnLabel() {return returnLabel;}
93
TR::LabelSymbol *setReturnLabel(TR::LabelSymbol *rl) {return (returnLabel=rl);}
94
};
95
96
class ARMVirtualUnresolvedSnippet : public TR::ARMVirtualSnippet
97
{
98
uint8_t *thunkAddress;
99
public:
100
101
ARMVirtualUnresolvedSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl)
102
: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(NULL) {}
103
104
ARMVirtualUnresolvedSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl, uint8_t *thunkPtr)
105
: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(thunkPtr) {}
106
107
virtual Kind getKind() { return IsVirtualUnresolved; }
108
109
virtual uint8_t *emitSnippetBody();
110
111
virtual uint32_t getLength(int32_t estimatedSnippetStart);
112
};
113
114
class ARMInterfaceCallSnippet : public TR::ARMVirtualSnippet
115
{
116
uint8_t *thunkAddress;
117
public:
118
119
ARMInterfaceCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl)
120
: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(NULL) {}
121
122
ARMInterfaceCallSnippet(TR::CodeGenerator *cg, TR::Node *c, TR::LabelSymbol *lab, int32_t s, TR::LabelSymbol *retl
123
, uint8_t *thunkPtr)
124
: TR::ARMVirtualSnippet(cg, c, lab, s, retl), thunkAddress(thunkPtr) {}
125
virtual Kind getKind() { return IsInterfaceCall; }
126
127
virtual uint8_t *emitSnippetBody();
128
129
virtual uint32_t getLength(int32_t estimatedSnippetStart);
130
};
131
132
}
133
134
#endif
135
136