Mercurial > hg > truffle
annotate src/cpu/sparc/vm/vtableStubs_sparc.cpp @ 710:e5b0439ef4ae
6655638: dynamic languages need method handles
Summary: initial implementation, with known omissions (x86/64, sparc, compiler optim., c-oops, C++ interp.)
Reviewed-by: kvn, twisti, never
author | jrose |
---|---|
date | Wed, 08 Apr 2009 10:56:49 -0700 |
parents | 1d037ecd7960 |
children | 6b2273dd6fa9 |
rev | line source |
---|---|
0 | 1 /* |
196 | 2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_vtableStubs_sparc.cpp.incl" | |
27 | |
28 // machine-dependent part of VtableStubs: create vtableStub of correct size and | |
29 // initialize its code | |
30 | |
31 #define __ masm-> | |
32 | |
33 | |
34 #ifndef PRODUCT | |
35 extern "C" void bad_compiled_vtable_index(JavaThread* thread, oopDesc* receiver, int index); | |
36 #endif | |
37 | |
38 | |
39 // Used by compiler only; may use only caller saved, non-argument registers | |
40 // NOTE: %%%% if any change is made to this stub make sure that the function | |
41 // pd_code_size_limit is changed to ensure the correct size for VtableStub | |
42 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { | |
43 const int sparc_code_length = VtableStub::pd_code_size_limit(true); | |
44 VtableStub* s = new(sparc_code_length) VtableStub(true, vtable_index); | |
45 ResourceMark rm; | |
46 CodeBuffer cb(s->entry_point(), sparc_code_length); | |
47 MacroAssembler* masm = new MacroAssembler(&cb); | |
48 | |
49 #ifndef PRODUCT | |
50 if (CountCompiledCalls) { | |
51 Address ctr(G5, SharedRuntime::nof_megamorphic_calls_addr()); | |
52 __ sethi(ctr); | |
53 __ ld(ctr, G3_scratch); | |
54 __ inc(G3_scratch); | |
55 __ st(G3_scratch, ctr); | |
56 } | |
57 #endif /* PRODUCT */ | |
58 | |
59 assert(VtableStub::receiver_location() == O0->as_VMReg(), "receiver expected in O0"); | |
60 | |
61 // get receiver klass | |
62 address npe_addr = __ pc(); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
63 __ load_klass(O0, G3_scratch); |
0 | 64 |
65 // set methodOop (in case of interpreted method), and destination address | |
66 int entry_offset = instanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size(); | |
67 #ifndef PRODUCT | |
68 if (DebugVtables) { | |
69 Label L; | |
70 // check offset vs vtable length | |
71 __ ld(G3_scratch, instanceKlass::vtable_length_offset()*wordSize, G5); | |
72 __ cmp(G5, vtable_index*vtableEntry::size()); | |
73 __ br(Assembler::greaterUnsigned, false, Assembler::pt, L); | |
74 __ delayed()->nop(); | |
75 __ set(vtable_index, O2); | |
76 __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), O0, O2); | |
77 __ bind(L); | |
78 } | |
79 #endif | |
80 int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes(); | |
81 if( __ is_simm13(v_off) ) { | |
82 __ ld_ptr(G3, v_off, G5_method); | |
83 } else { | |
84 __ set(v_off,G5); | |
85 __ ld_ptr(G3, G5, G5_method); | |
86 } | |
87 | |
88 #ifndef PRODUCT | |
89 if (DebugVtables) { | |
90 Label L; | |
91 __ br_notnull(G5_method, false, Assembler::pt, L); | |
92 __ delayed()->nop(); | |
93 __ stop("Vtable entry is ZERO"); | |
94 __ bind(L); | |
95 } | |
96 #endif | |
97 | |
98 address ame_addr = __ pc(); // if the vtable entry is null, the method is abstract | |
99 // NOTE: for vtable dispatches, the vtable entry will never be null. | |
100 | |
101 __ ld_ptr(G5_method, in_bytes(methodOopDesc::from_compiled_offset()), G3_scratch); | |
102 | |
103 // jump to target (either compiled code or c2iadapter) | |
104 __ JMP(G3_scratch, 0); | |
105 // load methodOop (in case we call c2iadapter) | |
106 __ delayed()->nop(); | |
107 | |
108 masm->flush(); | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
109 |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
110 if (PrintMiscellaneous && (WizardMode || Verbose)) { |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
111 tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d", |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
112 vtable_index, s->entry_point(), |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
113 (int)(s->code_end() - s->entry_point()), |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
114 (int)(s->code_end() - __ pc())); |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
115 } |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
116 guarantee(__ pc() <= s->code_end(), "overflowed buffer"); |
709
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
117 // shut the door on sizing bugs |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
118 int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
119 assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add"); |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
120 |
0 | 121 s->set_exception_points(npe_addr, ame_addr); |
122 return s; | |
123 } | |
124 | |
125 | |
126 // NOTE: %%%% if any change is made to this stub make sure that the function | |
127 // pd_code_size_limit is changed to ensure the correct size for VtableStub | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
128 VtableStub* VtableStubs::create_itable_stub(int itable_index) { |
0 | 129 const int sparc_code_length = VtableStub::pd_code_size_limit(false); |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
130 VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index); |
0 | 131 ResourceMark rm; |
132 CodeBuffer cb(s->entry_point(), sparc_code_length); | |
133 MacroAssembler* masm = new MacroAssembler(&cb); | |
134 | |
135 Register G3_klassOop = G3_scratch; | |
136 Register G5_interface = G5; // Passed in as an argument | |
137 Label search; | |
138 | |
139 // Entry arguments: | |
140 // G5_interface: Interface | |
141 // O0: Receiver | |
142 assert(VtableStub::receiver_location() == O0->as_VMReg(), "receiver expected in O0"); | |
143 | |
144 // get receiver klass (also an implicit null-check) | |
145 address npe_addr = __ pc(); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
146 __ load_klass(O0, G3_klassOop); |
0 | 147 __ verify_oop(G3_klassOop); |
148 | |
149 // Push a new window to get some temp registers. This chops the head of all | |
150 // my 64-bit %o registers in the LION build, but this is OK because no longs | |
151 // are passed in the %o registers. Instead, longs are passed in G1 and G4 | |
152 // and so those registers are not available here. | |
153 __ save(SP,-frame::register_save_words*wordSize,SP); | |
154 | |
155 #ifndef PRODUCT | |
156 if (CountCompiledCalls) { | |
157 Address ctr(L0, SharedRuntime::nof_megamorphic_calls_addr()); | |
158 __ sethi(ctr); | |
159 __ ld(ctr, L1); | |
160 __ inc(L1); | |
161 __ st(L1, ctr); | |
162 } | |
163 #endif /* PRODUCT */ | |
164 | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
165 Label throw_icce; |
0 | 166 |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
167 Register L5_method = L5; |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
168 __ lookup_interface_method(// inputs: rec. class, interface, itable index |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
169 G3_klassOop, G5_interface, itable_index, |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
170 // outputs: method, scan temp. reg |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
171 L5_method, L2, L3, |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
172 throw_icce); |
0 | 173 |
174 #ifndef PRODUCT | |
175 if (DebugVtables) { | |
176 Label L01; | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
177 __ bpr(Assembler::rc_nz, false, Assembler::pt, L5_method, L01); |
0 | 178 __ delayed()->nop(); |
179 __ stop("methodOop is null"); | |
180 __ bind(L01); | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
181 __ verify_oop(L5_method); |
0 | 182 } |
183 #endif | |
184 | |
185 // If the following load is through a NULL pointer, we'll take an OS | |
186 // exception that should translate into an AbstractMethodError. We need the | |
187 // window count to be correct at that time. | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
188 __ restore(L5_method, 0, G5_method); |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
189 // Restore registers *before* the AME point. |
0 | 190 |
191 address ame_addr = __ pc(); // if the vtable entry is null, the method is abstract | |
192 __ ld_ptr(G5_method, in_bytes(methodOopDesc::from_compiled_offset()), G3_scratch); | |
193 | |
194 // G5_method: methodOop | |
195 // O0: Receiver | |
196 // G3_scratch: entry point | |
197 __ JMP(G3_scratch, 0); | |
198 __ delayed()->nop(); | |
199 | |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
200 __ bind(throw_icce); |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
201 Address icce(G3_scratch, StubRoutines::throw_IncompatibleClassChangeError_entry()); |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
202 __ jump_to(icce, 0); |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
203 __ delayed()->restore(); |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
204 |
0 | 205 masm->flush(); |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
206 |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
207 if (PrintMiscellaneous && (WizardMode || Verbose)) { |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
208 tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
209 itable_index, s->entry_point(), |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
210 (int)(s->code_end() - s->entry_point()), |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
211 (int)(s->code_end() - __ pc())); |
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
212 } |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
213 guarantee(__ pc() <= s->code_end(), "overflowed buffer"); |
709
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
214 // shut the door on sizing bugs |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
215 int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
216 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add"); |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
217 |
0 | 218 s->set_exception_points(npe_addr, ame_addr); |
219 return s; | |
220 } | |
221 | |
222 | |
223 int VtableStub::pd_code_size_limit(bool is_vtable_stub) { | |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
224 if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000; |
0 | 225 else { |
226 const int slop = 2*BytesPerInstWord; // sethi;add (needed for long offsets) | |
227 if (is_vtable_stub) { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
228 // ld;ld;ld,jmp,nop |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
229 const int basic = 5*BytesPerInstWord + |
642
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
623
diff
changeset
|
230 // shift;add for load_klass (only shift with zero heap based) |
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
623
diff
changeset
|
231 (UseCompressedOops ? |
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
623
diff
changeset
|
232 ((Universe::narrow_oop_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0); |
0 | 233 return basic + slop; |
234 } else { | |
623
9adddb8c0fc8
6812831: factor duplicated assembly code for megamorphic invokeinterface (for 6655638)
jrose
parents:
196
diff
changeset
|
235 const int basic = (28 LP64_ONLY(+ 6)) * BytesPerInstWord + |
642
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
623
diff
changeset
|
236 // shift;add for load_klass (only shift with zero heap based) |
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
623
diff
changeset
|
237 (UseCompressedOops ? |
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
623
diff
changeset
|
238 ((Universe::narrow_oop_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0); |
0 | 239 return (basic + slop); |
240 } | |
241 } | |
709
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
242 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
243 // In order to tune these parameters, run the JVM with VM options |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
244 // +PrintMiscellaneous and +WizardMode to see information about |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
245 // actual itable stubs. Look for lines like this: |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
246 // itable #1 at 0x5551212[116] left over: 8 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
247 // Reduce the constants so that the "left over" number is 8 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
248 // Do not aim at a left-over number of zero, because a very |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
249 // large vtable or itable offset (> 4K) will require an extra |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
250 // sethi/or pair of instructions. |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
251 // |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
252 // The JVM98 app. _202_jess has a megamorphic interface call. |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
253 // The itable code looks like this: |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
254 // Decoding VtableStub itbl[1]@16 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
255 // ld [ %o0 + 4 ], %g3 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
256 // save %sp, -64, %sp |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
257 // ld [ %g3 + 0xe8 ], %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
258 // sll %l2, 2, %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
259 // add %l2, 0x134, %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
260 // and %l2, -8, %l2 ! NOT_LP64 only |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
261 // add %g3, %l2, %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
262 // add %g3, 4, %g3 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
263 // ld [ %l2 ], %l5 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
264 // brz,pn %l5, throw_icce |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
265 // cmp %l5, %g5 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
266 // be %icc, success |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
267 // add %l2, 8, %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
268 // loop: |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
269 // ld [ %l2 ], %l5 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
270 // brz,pn %l5, throw_icce |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
271 // cmp %l5, %g5 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
272 // bne,pn %icc, loop |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
273 // add %l2, 8, %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
274 // success: |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
275 // ld [ %l2 + -4 ], %l2 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
276 // ld [ %g3 + %l2 ], %l5 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
277 // restore %l5, 0, %g5 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
278 // ld [ %g5 + 0x44 ], %g3 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
279 // jmp %g3 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
280 // nop |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
281 // throw_icce: |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
282 // sethi %hi(throw_ICCE_entry), %g3 |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
283 // ! 5 more instructions here, LP64_ONLY |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
284 // jmp %g3 + %lo(throw_ICCE_entry) |
1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
jrose
parents:
642
diff
changeset
|
285 // restore |
0 | 286 } |
287 | |
288 | |
289 int VtableStub::pd_code_alignment() { | |
290 // UltraSPARC cache line size is 8 instructions: | |
291 const unsigned int icache_line_size = 32; | |
292 return icache_line_size; | |
293 } |