author | stefank |
Thu, 09 May 2019 14:28:30 +0200 | |
changeset 54786 | ebf733a324d4 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
4013 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49480
diff
changeset
|
2 |
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
4013 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4013
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4013
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4013
diff
changeset
|
22 |
* questions. |
4013 | 23 |
* |
24 |
*/ |
|
25 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49480
diff
changeset
|
26 |
#ifndef CPU_ZERO_INTERPRETERRT_ZERO_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49480
diff
changeset
|
27 |
#define CPU_ZERO_INTERPRETERRT_ZERO_HPP |
7397 | 28 |
|
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
47216
diff
changeset
|
29 |
// This is included in the middle of class Interpreter. |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
47216
diff
changeset
|
30 |
// Do not include files here. |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
47216
diff
changeset
|
31 |
|
7397 | 32 |
|
4013 | 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: |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
7397
diff
changeset
|
72 |
SignatureHandlerGeneratorBase(const methodHandle& method, ffi_cif *cif) |
4013 | 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: |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
7397
diff
changeset
|
101 |
SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer) |
6771
3f9a5f169070
6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents:
5547
diff
changeset
|
102 |
: SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->insts_end()), |
4013 | 103 |
_cb(buffer) { |
6771
3f9a5f169070
6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents:
5547
diff
changeset
|
104 |
_cb->set_insts_end((address) (cif() + 1)); |
4013 | 105 |
} |
106 |
||
107 |
private: |
|
108 |
void push(intptr_t value) { |
|
6771
3f9a5f169070
6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents:
5547
diff
changeset
|
109 |
intptr_t *dst = (intptr_t *) _cb->insts_end(); |
3f9a5f169070
6990549: Zero and Shark fixes after 6978355 and 6953144
twisti
parents:
5547
diff
changeset
|
110 |
_cb->set_insts_end((address) (dst + 1)); |
4013 | 111 |
*dst = value; |
112 |
} |
|
113 |
}; |
|
114 |
||
115 |
class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase { |
|
116 |
private: |
|
117 |
intptr_t *_dst; |
|
118 |
||
119 |
public: |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
7397
diff
changeset
|
120 |
SlowSignatureHandlerGenerator(const methodHandle& method, intptr_t* buf) |
4013 | 121 |
: SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) { |
122 |
_dst = (intptr_t *) (cif() + 1); |
|
123 |
} |
|
124 |
||
125 |
private: |
|
126 |
void push(intptr_t value) { |
|
127 |
*(_dst++) = value; |
|
128 |
} |
|
129 |
||
130 |
public: |
|
131 |
SignatureHandler *handler() const { |
|
132 |
return (SignatureHandler *) cif(); |
|
133 |
} |
|
134 |
}; |
|
7397 | 135 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49480
diff
changeset
|
136 |
#endif // CPU_ZERO_INTERPRETERRT_ZERO_HPP |