Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/cpu/zero/interpreterRT_zero.hpp
40931 views
1
/*
2
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
3
* Copyright 2007, 2008 Red Hat, Inc.
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
*
6
* This code is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 2 only, as
8
* published by the Free Software Foundation.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*
24
*/
25
26
#ifndef CPU_ZERO_INTERPRETERRT_ZERO_HPP
27
#define CPU_ZERO_INTERPRETERRT_ZERO_HPP
28
29
// This is included in the middle of class Interpreter.
30
// Do not include files here.
31
32
33
class SignatureHandler {
34
public:
35
static SignatureHandler *from_handlerAddr(address handlerAddr) {
36
return (SignatureHandler *) handlerAddr;
37
}
38
39
public:
40
ffi_cif* cif() const {
41
return (ffi_cif *) this;
42
}
43
44
int argument_count() const {
45
return cif()->nargs;
46
}
47
48
ffi_type** argument_types() const {
49
return (ffi_type**) (cif() + 1);
50
}
51
52
ffi_type* argument_type(int i) const {
53
return argument_types()[i];
54
}
55
56
ffi_type* result_type() const {
57
return *(argument_types() + argument_count());
58
}
59
60
protected:
61
friend class InterpreterRuntime;
62
friend class SignatureHandlerLibrary;
63
64
void finalize();
65
};
66
67
class SignatureHandlerGeneratorBase : public NativeSignatureIterator {
68
private:
69
ffi_cif* _cif;
70
71
protected:
72
SignatureHandlerGeneratorBase(const methodHandle& method, ffi_cif *cif)
73
: NativeSignatureIterator(method), _cif(cif) {
74
_cif->nargs = 0;
75
}
76
77
ffi_cif *cif() const {
78
return _cif;
79
}
80
81
public:
82
void generate(uint64_t fingerprint);
83
84
private:
85
void pass_int();
86
void pass_long();
87
void pass_float();
88
void pass_double();
89
void pass_object();
90
91
private:
92
void push(BasicType type);
93
virtual void push(intptr_t value) = 0;
94
};
95
96
class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
97
private:
98
CodeBuffer* _cb;
99
100
public:
101
SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer);
102
103
private:
104
void push(intptr_t value);
105
};
106
107
class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
108
private:
109
intptr_t *_dst;
110
111
public:
112
SlowSignatureHandlerGenerator(const methodHandle& method, intptr_t* buf)
113
: SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {
114
_dst = (intptr_t *) (cif() + 1);
115
}
116
117
private:
118
void push(intptr_t value) {
119
*(_dst++) = value;
120
}
121
122
public:
123
SignatureHandler *handler() const {
124
return (SignatureHandler *) cif();
125
}
126
};
127
128
#endif // CPU_ZERO_INTERPRETERRT_ZERO_HPP
129
130