annotate src/cpu/sparc/vm/vtableStubs_sparc.cpp @ 2376:c7f3d0b4570f

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