author | ihse |
Mon, 26 Nov 2018 14:18:22 +0100 | |
branch | ihse-manpages-branch |
changeset 57043 | 23d7457ca4c6 |
parent 51618 | 54b344d9dd4e |
permissions | -rw-r--r-- |
29183 | 1 |
/* |
50380
bec342339138
8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents:
49368
diff
changeset
|
2 |
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
29183 | 3 |
* Copyright (c) 2014, Red Hat Inc. All rights reserved. |
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 |
#include "precompiled.hpp" |
|
50380
bec342339138
8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents:
49368
diff
changeset
|
27 |
#include "asm/macroAssembler.inline.hpp" |
29183 | 28 |
#include "assembler_aarch64.inline.hpp" |
29 |
#include "code/vtableStubs.hpp" |
|
30 |
#include "interp_masm_aarch64.hpp" |
|
31 |
#include "memory/resourceArea.hpp" |
|
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
32 |
#include "oops/compiledICHolder.hpp" |
29183 | 33 |
#include "oops/instanceKlass.hpp" |
34 |
#include "oops/klassVtable.hpp" |
|
35 |
#include "runtime/sharedRuntime.hpp" |
|
36 |
#include "vmreg_aarch64.inline.hpp" |
|
37 |
#ifdef COMPILER2 |
|
38 |
#include "opto/runtime.hpp" |
|
39 |
#endif |
|
40 |
||
41 |
// machine-dependent part of VtableStubs: create VtableStub of correct size and |
|
42 |
// initialize its code |
|
43 |
||
44 |
#define __ masm-> |
|
45 |
||
46 |
#ifndef PRODUCT |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
47 |
extern "C" void bad_compiled_vtable_index(JavaThread* thread, oop receiver, int index); |
29183 | 48 |
#endif |
49 |
||
50 |
VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
51 |
// Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
52 |
const int stub_code_length = code_size_limit(true); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
53 |
VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); |
45620
d66b032663cb
8181906: AArch64: port bugfix for 7009641 to AArch64
fyang
parents:
35899
diff
changeset
|
54 |
// Can be NULL if there is no free space in the code cache. |
d66b032663cb
8181906: AArch64: port bugfix for 7009641 to AArch64
fyang
parents:
35899
diff
changeset
|
55 |
if (s == NULL) { |
d66b032663cb
8181906: AArch64: port bugfix for 7009641 to AArch64
fyang
parents:
35899
diff
changeset
|
56 |
return NULL; |
d66b032663cb
8181906: AArch64: port bugfix for 7009641 to AArch64
fyang
parents:
35899
diff
changeset
|
57 |
} |
d66b032663cb
8181906: AArch64: port bugfix for 7009641 to AArch64
fyang
parents:
35899
diff
changeset
|
58 |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
59 |
// Count unused bytes in instruction sequences of variable size. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
60 |
// We add them to the computed buffer size in order to avoid |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
61 |
// overflow in subsequently generated stubs. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
62 |
address start_pc; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
63 |
int slop_bytes = 0; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
64 |
int slop_delta = 0; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
65 |
|
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
66 |
ResourceMark rm; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
67 |
CodeBuffer cb(s->entry_point(), stub_code_length); |
29183 | 68 |
MacroAssembler* masm = new MacroAssembler(&cb); |
69 |
||
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
70 |
#if (!defined(PRODUCT) && defined(COMPILER2)) |
29183 | 71 |
if (CountCompiledCalls) { |
48669
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
72 |
__ lea(r16, ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); |
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
73 |
__ incrementw(Address(r16)); |
29183 | 74 |
} |
75 |
#endif |
|
76 |
||
77 |
// get receiver (need to skip return address on top of stack) |
|
78 |
assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0"); |
|
79 |
||
80 |
// get receiver klass |
|
81 |
address npe_addr = __ pc(); |
|
48669
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
82 |
__ load_klass(r16, j_rarg0); |
29183 | 83 |
|
84 |
#ifndef PRODUCT |
|
85 |
if (DebugVtables) { |
|
86 |
Label L; |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
87 |
// TODO: find upper bound for this debug code. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
88 |
start_pc = __ pc(); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
89 |
|
29183 | 90 |
// check offset vs vtable length |
48669
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
91 |
__ ldrw(rscratch1, Address(r16, Klass::vtable_length_offset())); |
29183 | 92 |
__ cmpw(rscratch1, vtable_index * vtableEntry::size()); |
93 |
__ br(Assembler::GT, L); |
|
94 |
__ enter(); |
|
95 |
__ mov(r2, vtable_index); |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
96 |
|
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
97 |
__ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, r2); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
98 |
const ptrdiff_t estimate = 256; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
99 |
const ptrdiff_t codesize = __ pc() - start_pc; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
100 |
slop_delta = estimate - codesize; // call_VM varies in length, depending on data |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
101 |
slop_bytes += slop_delta; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
102 |
assert(slop_delta >= 0, "vtable #%d: Code size estimate (%d) for DebugVtables too small, required: %d", vtable_index, (int)estimate, (int)codesize); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
103 |
|
29183 | 104 |
__ leave(); |
105 |
__ bind(L); |
|
106 |
} |
|
107 |
#endif // PRODUCT |
|
108 |
||
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
109 |
start_pc = __ pc(); |
48669
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
110 |
__ lookup_virtual_method(r16, vtable_index, rmethod); |
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
111 |
slop_delta = 8 - (int)(__ pc() - start_pc); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
112 |
slop_bytes += slop_delta; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
113 |
assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); |
29183 | 114 |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
115 |
#ifndef PRODUCT |
29183 | 116 |
if (DebugVtables) { |
117 |
Label L; |
|
118 |
__ cbz(rmethod, L); |
|
119 |
__ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); |
|
120 |
__ cbnz(rscratch1, L); |
|
121 |
__ stop("Vtable entry is NULL"); |
|
122 |
__ bind(L); |
|
123 |
} |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
124 |
#endif // PRODUCT |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
125 |
|
29183 | 126 |
// r0: receiver klass |
127 |
// rmethod: Method* |
|
128 |
// r2: receiver |
|
129 |
address ame_addr = __ pc(); |
|
130 |
__ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); |
|
131 |
__ br(rscratch1); |
|
132 |
||
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
133 |
masm->flush(); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
134 |
bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0); |
29183 | 135 |
|
136 |
return s; |
|
137 |
} |
|
138 |
||
139 |
||
140 |
VtableStub* VtableStubs::create_itable_stub(int itable_index) { |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
141 |
// Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
142 |
const int stub_code_length = code_size_limit(false); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
143 |
VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
144 |
// Can be NULL if there is no free space in the code cache. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
145 |
if (s == NULL) { |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
146 |
return NULL; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
147 |
} |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
148 |
// Count unused bytes in instruction sequences of variable size. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
149 |
// We add them to the computed buffer size in order to avoid |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
150 |
// overflow in subsequently generated stubs. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
151 |
address start_pc; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
152 |
int slop_bytes = 0; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
153 |
int slop_delta = 0; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
154 |
|
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
155 |
ResourceMark rm; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
156 |
CodeBuffer cb(s->entry_point(), stub_code_length); |
29183 | 157 |
MacroAssembler* masm = new MacroAssembler(&cb); |
158 |
||
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
159 |
#if (!defined(PRODUCT) && defined(COMPILER2)) |
29183 | 160 |
if (CountCompiledCalls) { |
161 |
__ lea(r10, ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); |
|
162 |
__ incrementw(Address(r10)); |
|
163 |
} |
|
164 |
#endif |
|
165 |
||
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
166 |
// get receiver (need to skip return address on top of stack) |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
167 |
assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0"); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
168 |
|
29183 | 169 |
// Entry arguments: |
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
170 |
// rscratch2: CompiledICHolder |
29183 | 171 |
// j_rarg0: Receiver |
172 |
||
48669
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
173 |
// Most registers are in use; we'll use r16, rmethod, r10, r11 |
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
174 |
const Register recv_klass_reg = r10; |
48669
51d97ee431ff
8196136: AArch64: Correct register use in patch for JDK-8195685
adinn
parents:
48652
diff
changeset
|
175 |
const Register holder_klass_reg = r16; // declaring interface klass (DECC) |
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
176 |
const Register resolved_klass_reg = rmethod; // resolved interface klass (REFC) |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
177 |
const Register temp_reg = r11; |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
178 |
const Register icholder_reg = rscratch2; |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
179 |
|
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
180 |
Label L_no_such_interface; |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
181 |
|
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
182 |
__ ldr(resolved_klass_reg, Address(icholder_reg, CompiledICHolder::holder_klass_offset())); |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
183 |
__ ldr(holder_klass_reg, Address(icholder_reg, CompiledICHolder::holder_metadata_offset())); |
29183 | 184 |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
185 |
start_pc = __ pc(); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
186 |
|
29183 | 187 |
// get receiver klass (also an implicit null-check) |
188 |
address npe_addr = __ pc(); |
|
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
189 |
__ load_klass(recv_klass_reg, j_rarg0); |
29183 | 190 |
|
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
191 |
// Receiver subtype check against REFC. |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
192 |
// Destroys recv_klass_reg value. |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
193 |
__ lookup_interface_method(// inputs: rec. class, interface |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
194 |
recv_klass_reg, resolved_klass_reg, noreg, |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
195 |
// outputs: scan temp. reg1, scan temp. reg2 |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
196 |
recv_klass_reg, temp_reg, |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
197 |
L_no_such_interface, |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
198 |
/*return_method=*/false); |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
199 |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
200 |
const ptrdiff_t typecheckSize = __ pc() - start_pc; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
201 |
start_pc = __ pc(); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
202 |
|
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
203 |
// Get selected method from declaring class and itable index |
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
204 |
__ load_klass(recv_klass_reg, j_rarg0); // restore recv_klass_reg |
29183 | 205 |
__ lookup_interface_method(// inputs: rec. class, interface, itable index |
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
206 |
recv_klass_reg, holder_klass_reg, itable_index, |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
207 |
// outputs: method, scan temp. reg |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
208 |
rmethod, temp_reg, |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
209 |
L_no_such_interface); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
210 |
|
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
211 |
const ptrdiff_t lookupSize = __ pc() - start_pc; |
29183 | 212 |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
213 |
// Reduce "estimate" such that "padding" does not drop below 8. |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
214 |
const ptrdiff_t estimate = 152; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
215 |
const ptrdiff_t codesize = typecheckSize + lookupSize; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
216 |
slop_delta = (int)(estimate - codesize); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
217 |
slop_bytes += slop_delta; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
218 |
assert(slop_delta >= 0, "itable #%d: Code size estimate (%d) for lookup_interface_method too small, required: %d", itable_index, (int)estimate, (int)codesize); |
29183 | 219 |
|
220 |
#ifdef ASSERT |
|
221 |
if (DebugVtables) { |
|
222 |
Label L2; |
|
223 |
__ cbz(rmethod, L2); |
|
224 |
__ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); |
|
225 |
__ cbnz(rscratch1, L2); |
|
226 |
__ stop("compiler entrypoint is null"); |
|
227 |
__ bind(L2); |
|
228 |
} |
|
229 |
#endif // ASSERT |
|
230 |
||
231 |
// rmethod: Method* |
|
232 |
// j_rarg0: receiver |
|
233 |
address ame_addr = __ pc(); |
|
234 |
__ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); |
|
235 |
__ br(rscratch1); |
|
236 |
||
48652
7c03f19d38a7
8195685: AArch64: AArch64 cannot build with JDK-8174962
aph
parents:
47216
diff
changeset
|
237 |
__ bind(L_no_such_interface); |
49368
2ed1c37df3a5
8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
goetz
parents:
48669
diff
changeset
|
238 |
// Handle IncompatibleClassChangeError in itable stubs. |
2ed1c37df3a5
8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
goetz
parents:
48669
diff
changeset
|
239 |
// More detailed error message. |
2ed1c37df3a5
8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
goetz
parents:
48669
diff
changeset
|
240 |
// We force resolving of the call site by jumping to the "handle |
2ed1c37df3a5
8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
goetz
parents:
48669
diff
changeset
|
241 |
// wrong method" stub, and so let the interpreter runtime do all the |
2ed1c37df3a5
8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
goetz
parents:
48669
diff
changeset
|
242 |
// dirty work. |
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
243 |
assert(SharedRuntime::get_handle_wrong_method_stub() != NULL, "check initialization order"); |
49368
2ed1c37df3a5
8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
goetz
parents:
48669
diff
changeset
|
244 |
__ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); |
29183 | 245 |
|
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
246 |
masm->flush(); |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
247 |
bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, 0); |
29183 | 248 |
|
249 |
return s; |
|
250 |
} |
|
251 |
||
51618
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
252 |
int VtableStub::pd_code_alignment() { |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
253 |
// aarch64 cache line size is not an architected constant. We just align on 4 bytes (instruction size). |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
254 |
const unsigned int icache_line_size = 4; |
54b344d9dd4e
8207343: Automate vtable/itable stub size calculation
lucy
parents:
50380
diff
changeset
|
255 |
return icache_line_size; |
29183 | 256 |
} |