annotate src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @ 17524:89152779163c

Merge with jdk8-b132
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 11:59:32 +0200
parents 4ca6dc0799b6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17524
89152779163c Merge with jdk8-b132
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
2 * Copyright (c) 1999, 2013, 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: 1295
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1295
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: 1295
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: 1783
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
26 #include "c1/c1_Defs.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
27 #include "c1/c1_MacroAssembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
28 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
29 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
30 #include "nativeInst_sparc.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
31 #include "oops/compiledICHolder.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
32 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
33 #include "prims/jvmtiExport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
34 #include "register_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
35 #include "runtime/sharedRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
36 #include "runtime/signature.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
37 #include "runtime/vframeArray.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
38 #include "utilities/macros.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
39 #include "vmreg_sparc.inline.hpp"
12835
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
40 #if INCLUDE_ALL_GCS
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
41 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
42 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // Implementation of StubAssembler
a61af66fc99e Initial load
duke
parents:
diff changeset
45
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
46 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // for sparc changing the number of arguments doesn't change
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // anything about the frame size so we'll always lie and claim that
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // we are only passing 1 argument.
a61af66fc99e Initial load
duke
parents:
diff changeset
50 set_num_rt_args(1);
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 assert_not_delayed();
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // bang stack before going to runtime
a61af66fc99e Initial load
duke
parents:
diff changeset
54 set(-os::vm_page_size() + STACK_BIAS, G3_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 st(G0, SP, G3_scratch);
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // debugging support
a61af66fc99e Initial load
duke
parents:
diff changeset
58 assert(number_of_arguments >= 0 , "cannot have negative number of arguments");
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 set_last_Java_frame(SP, noreg);
a61af66fc99e Initial load
duke
parents:
diff changeset
61 if (VerifyThread) mov(G2_thread, O0); // about to be smashed; pass early
a61af66fc99e Initial load
duke
parents:
diff changeset
62 save_thread(L7_thread_cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // do the call
a61af66fc99e Initial load
duke
parents:
diff changeset
64 call(entry_point, relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 if (!VerifyThread) {
a61af66fc99e Initial load
duke
parents:
diff changeset
66 delayed()->mov(G2_thread, O0); // pass thread as first argument
a61af66fc99e Initial load
duke
parents:
diff changeset
67 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 delayed()->nop(); // (thread already passed)
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 int call_offset = offset(); // offset of return address
a61af66fc99e Initial load
duke
parents:
diff changeset
71 restore_thread(L7_thread_cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
72 reset_last_Java_frame();
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // check for pending exceptions
a61af66fc99e Initial load
duke
parents:
diff changeset
75 { Label L;
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
76 Address exception_addr(G2_thread, Thread::pending_exception_offset());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 ld_ptr(exception_addr, Gtemp);
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2321
diff changeset
78 br_null_short(Gtemp, pt, L);
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
79 Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
80 st_ptr(G0, vm_result_addr);
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
81 Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
82 st_ptr(G0, vm_result_addr_2);
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 if (frame_size() == no_frame_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // we use O7 linkage so that forward_exception_entry has the issuing PC
a61af66fc99e Initial load
duke
parents:
diff changeset
86 call(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
88 } else if (_stub_id == Runtime1::forward_exception_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
90 } else {
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
91 AddressLiteral exc(Runtime1::entry_for(Runtime1::forward_exception_id));
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
92 jump_to(exc, G4);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
93 delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 bind(L);
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // get oop result if there is one and reset the value in the thread
a61af66fc99e Initial load
duke
parents:
diff changeset
99 if (oop_result1->is_valid()) { // get oop result if there is one and reset it in the thread
a61af66fc99e Initial load
duke
parents:
diff changeset
100 get_vm_result (oop_result1);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // be a little paranoid and clear the result
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
103 Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104 st_ptr(G0, vm_result_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
107 // get second result if there is one and reset the value in the thread
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
108 if (metadata_result->is_valid()) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
109 get_vm_result_2 (metadata_result);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
110 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // be a little paranoid and clear the result
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
112 Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
113 st_ptr(G0, vm_result_addr_2);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 return call_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
120 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // O0 is reserved for the thread
a61af66fc99e Initial load
duke
parents:
diff changeset
122 mov(arg1, O1);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
123 return call_RT(oop_result1, metadata_result, entry, 1);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
127 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // O0 is reserved for the thread
a61af66fc99e Initial load
duke
parents:
diff changeset
129 mov(arg1, O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
130 mov(arg2, O2); assert(arg2 != O1, "smashed argument");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
131 return call_RT(oop_result1, metadata_result, entry, 2);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
135 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // O0 is reserved for the thread
a61af66fc99e Initial load
duke
parents:
diff changeset
137 mov(arg1, O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
138 mov(arg2, O2); assert(arg2 != O1, "smashed argument");
a61af66fc99e Initial load
duke
parents:
diff changeset
139 mov(arg3, O3); assert(arg3 != O1 && arg3 != O2, "smashed argument");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
140 return call_RT(oop_result1, metadata_result, entry, 3);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // Implementation of Runtime1
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 #define __ sasm->
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 static int cpu_reg_save_offsets[FrameMap::nof_cpu_regs];
a61af66fc99e Initial load
duke
parents:
diff changeset
149 static int fpu_reg_save_offsets[FrameMap::nof_fpu_regs];
a61af66fc99e Initial load
duke
parents:
diff changeset
150 static int reg_save_size_in_words;
a61af66fc99e Initial load
duke
parents:
diff changeset
151 static int frame_size_in_bytes = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
155 "mismatch in calculation");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
156 sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 int frame_size_in_slots = frame_size_in_bytes / sizeof(jint);
a61af66fc99e Initial load
duke
parents:
diff changeset
158 OopMap* oop_map = new OopMap(frame_size_in_slots, 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 int i;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
162 Register r = as_Register(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 if (r == G1 || r == G3 || r == G4 || r == G5) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 int sp_offset = cpu_reg_save_offsets[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
165 oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
a61af66fc99e Initial load
duke
parents:
diff changeset
166 r->as_VMReg());
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 }
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 if (save_fpu_registers) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 FloatRegister r = as_FloatRegister(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
173 int sp_offset = fpu_reg_save_offsets[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
174 oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
a61af66fc99e Initial load
duke
parents:
diff changeset
175 r->as_VMReg());
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178 return oop_map;
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = true) {
a61af66fc99e Initial load
duke
parents:
diff changeset
182 assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
183 "mismatch in calculation");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
184 __ save_frame_c1(frame_size_in_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // Record volatile registers as callee-save values in an OopMap so their save locations will be
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // propagated to the caller frame's RegisterMap during StackFrameStream construction (needed for
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // deoptimization; see compiledVFrame::create_stack_value). The caller's I, L and O registers
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame
a61af66fc99e Initial load
duke
parents:
diff changeset
190 // (as the stub's I's) when the runtime routine called by the stub creates its frame.
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // OopMap frame sizes are in c2 stack slot sizes (sizeof(jint))
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 int i;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
195 Register r = as_Register(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
196 if (r == G1 || r == G3 || r == G4 || r == G5) {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 int sp_offset = cpu_reg_save_offsets[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
198 __ st_ptr(r, SP, (sp_offset * BytesPerWord) + STACK_BIAS);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 }
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202 if (save_fpu_registers) {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 FloatRegister r = as_FloatRegister(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 int sp_offset = fpu_reg_save_offsets[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
206 __ stf(FloatRegisterImpl::S, r, SP, (sp_offset * BytesPerWord) + STACK_BIAS);
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208 }
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 return generate_oop_map(sasm, save_fpu_registers);
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 for (int i = 0; i < FrameMap::nof_cpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 Register r = as_Register(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
216 if (r == G1 || r == G3 || r == G4 || r == G5) {
a61af66fc99e Initial load
duke
parents:
diff changeset
217 __ ld_ptr(SP, (cpu_reg_save_offsets[i] * BytesPerWord) + STACK_BIAS, r);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 }
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 if (restore_fpu_registers) {
a61af66fc99e Initial load
duke
parents:
diff changeset
222 for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
223 FloatRegister r = as_FloatRegister(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
224 __ ldf(FloatRegisterImpl::S, SP, (fpu_reg_save_offsets[i] * BytesPerWord) + STACK_BIAS, r);
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226 }
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229
a61af66fc99e Initial load
duke
parents:
diff changeset
230 void Runtime1::initialize_pd() {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // compute word offsets from SP at which live (non-windowed) registers are captured by stub routines
a61af66fc99e Initial load
duke
parents:
diff changeset
232 //
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // A stub routine will have a frame that is at least large enough to hold
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // a register window save area (obviously) and the volatile g registers
a61af66fc99e Initial load
duke
parents:
diff changeset
235 // and floating registers. A user of save_live_registers can have a frame
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // that has more scratch area in it (although typically they will use L-regs).
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // in that case the frame will look like this (stack growing down)
a61af66fc99e Initial load
duke
parents:
diff changeset
238 //
a61af66fc99e Initial load
duke
parents:
diff changeset
239 // FP -> | |
a61af66fc99e Initial load
duke
parents:
diff changeset
240 // | scratch mem |
a61af66fc99e Initial load
duke
parents:
diff changeset
241 // | " " |
a61af66fc99e Initial load
duke
parents:
diff changeset
242 // --------------
a61af66fc99e Initial load
duke
parents:
diff changeset
243 // | float regs |
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // | " " |
a61af66fc99e Initial load
duke
parents:
diff changeset
245 // ---------------
a61af66fc99e Initial load
duke
parents:
diff changeset
246 // | G regs |
a61af66fc99e Initial load
duke
parents:
diff changeset
247 // | " " |
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // ---------------
a61af66fc99e Initial load
duke
parents:
diff changeset
249 // | abi reg. |
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // | window save |
a61af66fc99e Initial load
duke
parents:
diff changeset
251 // | area |
a61af66fc99e Initial load
duke
parents:
diff changeset
252 // SP -> ---------------
a61af66fc99e Initial load
duke
parents:
diff changeset
253 //
a61af66fc99e Initial load
duke
parents:
diff changeset
254 int i;
a61af66fc99e Initial load
duke
parents:
diff changeset
255 int sp_offset = round_to(frame::register_save_words, 2); // start doubleword aligned
a61af66fc99e Initial load
duke
parents:
diff changeset
256
a61af66fc99e Initial load
duke
parents:
diff changeset
257 // only G int registers are saved explicitly; others are found in register windows
a61af66fc99e Initial load
duke
parents:
diff changeset
258 for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 Register r = as_Register(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
260 if (r == G1 || r == G3 || r == G4 || r == G5) {
a61af66fc99e Initial load
duke
parents:
diff changeset
261 cpu_reg_save_offsets[i] = sp_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
262 sp_offset++;
a61af66fc99e Initial load
duke
parents:
diff changeset
263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
264 }
a61af66fc99e Initial load
duke
parents:
diff changeset
265
a61af66fc99e Initial load
duke
parents:
diff changeset
266 // all float registers are saved explicitly
a61af66fc99e Initial load
duke
parents:
diff changeset
267 assert(FrameMap::nof_fpu_regs == 32, "double registers not handled here");
a61af66fc99e Initial load
duke
parents:
diff changeset
268 for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
269 fpu_reg_save_offsets[i] = sp_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
270 sp_offset++;
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 reg_save_size_in_words = sp_offset - frame::memory_parameter_word_sp_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
273 // this should match assembler::total_frame_size_in_bytes, which
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // isn't callable from this context. It's checked by an assert when
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // it's used though.
a61af66fc99e Initial load
duke
parents:
diff changeset
276 frame_size_in_bytes = align_size_up(sp_offset * wordSize, 8);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 }
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279
a61af66fc99e Initial load
duke
parents:
diff changeset
280 OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) {
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // make a frame and preserve the caller's caller-save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
282 OopMap* oop_map = save_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
283 int call_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
284 if (!has_argument) {
a61af66fc99e Initial load
duke
parents:
diff changeset
285 call_offset = __ call_RT(noreg, noreg, target);
a61af66fc99e Initial load
duke
parents:
diff changeset
286 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
287 call_offset = __ call_RT(noreg, noreg, target, G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
288 }
a61af66fc99e Initial load
duke
parents:
diff changeset
289 OopMapSet* oop_maps = new OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
290 oop_maps->add_gc_map(call_offset, oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
291
a61af66fc99e Initial load
duke
parents:
diff changeset
292 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
293 return oop_maps;
a61af66fc99e Initial load
duke
parents:
diff changeset
294 }
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 OopMapSet* Runtime1::generate_stub_call(StubAssembler* sasm, Register result, address target,
a61af66fc99e Initial load
duke
parents:
diff changeset
298 Register arg1, Register arg2, Register arg3) {
a61af66fc99e Initial load
duke
parents:
diff changeset
299 // make a frame and preserve the caller's caller-save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
300 OopMap* oop_map = save_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302 int call_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
303 if (arg1 == noreg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
304 call_offset = __ call_RT(result, noreg, target);
a61af66fc99e Initial load
duke
parents:
diff changeset
305 } else if (arg2 == noreg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
306 call_offset = __ call_RT(result, noreg, target, arg1);
a61af66fc99e Initial load
duke
parents:
diff changeset
307 } else if (arg3 == noreg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
308 call_offset = __ call_RT(result, noreg, target, arg1, arg2);
a61af66fc99e Initial load
duke
parents:
diff changeset
309 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
310 call_offset = __ call_RT(result, noreg, target, arg1, arg2, arg3);
a61af66fc99e Initial load
duke
parents:
diff changeset
311 }
a61af66fc99e Initial load
duke
parents:
diff changeset
312 OopMapSet* oop_maps = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
313
a61af66fc99e Initial load
duke
parents:
diff changeset
314 oop_maps = new OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
315 oop_maps->add_gc_map(call_offset, oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
316 restore_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
319 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
320
a61af66fc99e Initial load
duke
parents:
diff changeset
321 return oop_maps;
a61af66fc99e Initial load
duke
parents:
diff changeset
322 }
a61af66fc99e Initial load
duke
parents:
diff changeset
323
a61af66fc99e Initial load
duke
parents:
diff changeset
324
a61af66fc99e Initial load
duke
parents:
diff changeset
325 OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
a61af66fc99e Initial load
duke
parents:
diff changeset
326 // make a frame and preserve the caller's caller-save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
327 OopMap* oop_map = save_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
328
a61af66fc99e Initial load
duke
parents:
diff changeset
329 // call the runtime patching routine, returns non-zero if nmethod got deopted.
a61af66fc99e Initial load
duke
parents:
diff changeset
330 int call_offset = __ call_RT(noreg, noreg, target);
a61af66fc99e Initial load
duke
parents:
diff changeset
331 OopMapSet* oop_maps = new OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
332 oop_maps->add_gc_map(call_offset, oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
333
a61af66fc99e Initial load
duke
parents:
diff changeset
334 // re-execute the patched instruction or, if the nmethod was deoptmized, return to the
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // deoptimization handler entry that will cause re-execution of the current bytecode
a61af66fc99e Initial load
duke
parents:
diff changeset
336 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
a61af66fc99e Initial load
duke
parents:
diff changeset
337 assert(deopt_blob != NULL, "deoptimization blob must have been created");
a61af66fc99e Initial load
duke
parents:
diff changeset
338
a61af66fc99e Initial load
duke
parents:
diff changeset
339 Label no_deopt;
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2321
diff changeset
340 __ br_null_short(O0, Assembler::pt, no_deopt);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
341
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // return to the deoptimization handler entry for unpacking and rexecute
a61af66fc99e Initial load
duke
parents:
diff changeset
343 // if we simply returned the we'd deopt as if any call we patched had just
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // returned.
a61af66fc99e Initial load
duke
parents:
diff changeset
345
a61af66fc99e Initial load
duke
parents:
diff changeset
346 restore_live_registers(sasm);
2156
85330eaa15ee 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 2127
diff changeset
347
85330eaa15ee 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 2127
diff changeset
348 AddressLiteral dest(deopt_blob->unpack_with_reexecution());
85330eaa15ee 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 2127
diff changeset
349 __ jump_to(dest, O0);
85330eaa15ee 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 2127
diff changeset
350 __ delayed()->restore();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
351
a61af66fc99e Initial load
duke
parents:
diff changeset
352 __ bind(no_deopt);
a61af66fc99e Initial load
duke
parents:
diff changeset
353 restore_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
355 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
356
a61af66fc99e Initial load
duke
parents:
diff changeset
357 return oop_maps;
a61af66fc99e Initial load
duke
parents:
diff changeset
358 }
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
361
a61af66fc99e Initial load
duke
parents:
diff changeset
362 OopMapSet* oop_maps = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
363 // for better readability
a61af66fc99e Initial load
duke
parents:
diff changeset
364 const bool must_gc_arguments = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
365 const bool dont_gc_arguments = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
366
a61af66fc99e Initial load
duke
parents:
diff changeset
367 // stub code & info for the different stubs
a61af66fc99e Initial load
duke
parents:
diff changeset
368 switch (id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
369 case forward_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
370 {
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
371 oop_maps = generate_handle_exception(id, sasm);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
372 }
a61af66fc99e Initial load
duke
parents:
diff changeset
373 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 case new_instance_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
376 case fast_new_instance_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
377 case fast_new_instance_init_check_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
378 {
a61af66fc99e Initial load
duke
parents:
diff changeset
379 Register G5_klass = G5; // Incoming
a61af66fc99e Initial load
duke
parents:
diff changeset
380 Register O0_obj = O0; // Outgoing
a61af66fc99e Initial load
duke
parents:
diff changeset
381
a61af66fc99e Initial load
duke
parents:
diff changeset
382 if (id == new_instance_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
383 __ set_info("new_instance", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
384 } else if (id == fast_new_instance_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
385 __ set_info("fast new_instance", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
386 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
387 assert(id == fast_new_instance_init_check_id, "bad StubID");
a61af66fc99e Initial load
duke
parents:
diff changeset
388 __ set_info("fast new_instance init check", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
389 }
a61af66fc99e Initial load
duke
parents:
diff changeset
390
a61af66fc99e Initial load
duke
parents:
diff changeset
391 if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
392 UseTLAB && FastTLABRefill) {
a61af66fc99e Initial load
duke
parents:
diff changeset
393 Label slow_path;
a61af66fc99e Initial load
duke
parents:
diff changeset
394 Register G1_obj_size = G1;
a61af66fc99e Initial load
duke
parents:
diff changeset
395 Register G3_t1 = G3;
a61af66fc99e Initial load
duke
parents:
diff changeset
396 Register G4_t2 = G4;
a61af66fc99e Initial load
duke
parents:
diff changeset
397 assert_different_registers(G5_klass, G1_obj_size, G3_t1, G4_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
398
a61af66fc99e Initial load
duke
parents:
diff changeset
399 // Push a frame since we may do dtrace notification for the
a61af66fc99e Initial load
duke
parents:
diff changeset
400 // allocation which requires calling out and we don't want
a61af66fc99e Initial load
duke
parents:
diff changeset
401 // to stomp the real return address.
a61af66fc99e Initial load
duke
parents:
diff changeset
402 __ save_frame(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
403
a61af66fc99e Initial load
duke
parents:
diff changeset
404 if (id == fast_new_instance_init_check_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
405 // make sure the klass is initialized
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
406 __ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1);
12955
252d541466ea 8008242: VerifyOops is broken on SPARC
morris
parents: 12883
diff changeset
407 __ cmp(G3_t1, InstanceKlass::fully_initialized);
252d541466ea 8008242: VerifyOops is broken on SPARC
morris
parents: 12883
diff changeset
408 __ br(Assembler::notEqual, false, Assembler::pn, slow_path);
252d541466ea 8008242: VerifyOops is broken on SPARC
morris
parents: 12883
diff changeset
409 __ delayed()->nop();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
410 }
a61af66fc99e Initial load
duke
parents:
diff changeset
411 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
412 // assert object can be fast path allocated
a61af66fc99e Initial load
duke
parents:
diff changeset
413 {
a61af66fc99e Initial load
duke
parents:
diff changeset
414 Label ok, not_ok;
4762
069ab3f976d3 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 4048
diff changeset
415 __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2321
diff changeset
416 // make sure it's an instance (LH > 0)
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2321
diff changeset
417 __ cmp_and_br_short(G1_obj_size, 0, Assembler::lessEqual, Assembler::pn, not_ok);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
418 __ btst(Klass::_lh_instance_slow_path_bit, G1_obj_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
419 __ br(Assembler::zero, false, Assembler::pn, ok);
a61af66fc99e Initial load
duke
parents:
diff changeset
420 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
421 __ bind(not_ok);
a61af66fc99e Initial load
duke
parents:
diff changeset
422 __ stop("assert(can be fast path allocated)");
a61af66fc99e Initial load
duke
parents:
diff changeset
423 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
424 __ bind(ok);
a61af66fc99e Initial load
duke
parents:
diff changeset
425 }
a61af66fc99e Initial load
duke
parents:
diff changeset
426 #endif // ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
427 // if we got here then the TLAB allocation failed, so try
a61af66fc99e Initial load
duke
parents:
diff changeset
428 // refilling the TLAB or allocating directly from eden.
a61af66fc99e Initial load
duke
parents:
diff changeset
429 Label retry_tlab, try_eden;
a61af66fc99e Initial load
duke
parents:
diff changeset
430 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G5_klass
a61af66fc99e Initial load
duke
parents:
diff changeset
431
a61af66fc99e Initial load
duke
parents:
diff changeset
432 __ bind(retry_tlab);
a61af66fc99e Initial load
duke
parents:
diff changeset
433
a61af66fc99e Initial load
duke
parents:
diff changeset
434 // get the instance size
4762
069ab3f976d3 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 4048
diff changeset
435 __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
2100
b1a2afa37ec4 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 2002
diff changeset
436
0
a61af66fc99e Initial load
duke
parents:
diff changeset
437 __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
2100
b1a2afa37ec4 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 2002
diff changeset
438
0
a61af66fc99e Initial load
duke
parents:
diff changeset
439 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
440 __ verify_oop(O0_obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
441 __ mov(O0, I0);
a61af66fc99e Initial load
duke
parents:
diff changeset
442 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
443 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
444
a61af66fc99e Initial load
duke
parents:
diff changeset
445 __ bind(try_eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
446 // get the instance size
4762
069ab3f976d3 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 4048
diff changeset
447 __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
448 __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
2127
5577848f5923 7011463: Sparc MacroAssembler::incr_allocated_bytes() needs a RegisterOrConstant argument
phh
parents: 2100
diff changeset
449 __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2);
2100
b1a2afa37ec4 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 2002
diff changeset
450
0
a61af66fc99e Initial load
duke
parents:
diff changeset
451 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
452 __ verify_oop(O0_obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
453 __ mov(O0, I0);
a61af66fc99e Initial load
duke
parents:
diff changeset
454 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
455 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
456
a61af66fc99e Initial load
duke
parents:
diff changeset
457 __ bind(slow_path);
a61af66fc99e Initial load
duke
parents:
diff changeset
458
a61af66fc99e Initial load
duke
parents:
diff changeset
459 // pop this frame so generate_stub_call can push it's own
a61af66fc99e Initial load
duke
parents:
diff changeset
460 __ restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
461 }
a61af66fc99e Initial load
duke
parents:
diff changeset
462
a61af66fc99e Initial load
duke
parents:
diff changeset
463 oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_instance), G5_klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
464 // I0->O0: new instance
a61af66fc99e Initial load
duke
parents:
diff changeset
465 }
a61af66fc99e Initial load
duke
parents:
diff changeset
466
a61af66fc99e Initial load
duke
parents:
diff changeset
467 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
468
a61af66fc99e Initial load
duke
parents:
diff changeset
469 case counter_overflow_id:
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1681
diff changeset
470 // G4 contains bci, G5 contains method
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1681
diff changeset
471 oop_maps = generate_stub_call(sasm, noreg, CAST_FROM_FN_PTR(address, counter_overflow), G4, G5);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
472 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
473
a61af66fc99e Initial load
duke
parents:
diff changeset
474 case new_type_array_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
475 case new_object_array_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
476 {
a61af66fc99e Initial load
duke
parents:
diff changeset
477 Register G5_klass = G5; // Incoming
a61af66fc99e Initial load
duke
parents:
diff changeset
478 Register G4_length = G4; // Incoming
a61af66fc99e Initial load
duke
parents:
diff changeset
479 Register O0_obj = O0; // Outgoing
a61af66fc99e Initial load
duke
parents:
diff changeset
480
4762
069ab3f976d3 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 4048
diff changeset
481 Address klass_lh(G5_klass, Klass::layout_helper_offset());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
482 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise");
a61af66fc99e Initial load
duke
parents:
diff changeset
483 assert(Klass::_lh_header_size_mask == 0xFF, "bytewise");
a61af66fc99e Initial load
duke
parents:
diff changeset
484 // Use this offset to pick out an individual byte of the layout_helper:
a61af66fc99e Initial load
duke
parents:
diff changeset
485 const int klass_lh_header_size_offset = ((BytesPerInt - 1) // 3 - 2 selects byte {0,1,0,0}
a61af66fc99e Initial load
duke
parents:
diff changeset
486 - Klass::_lh_header_size_shift / BitsPerByte);
a61af66fc99e Initial load
duke
parents:
diff changeset
487
a61af66fc99e Initial load
duke
parents:
diff changeset
488 if (id == new_type_array_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
489 __ set_info("new_type_array", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
490 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
491 __ set_info("new_object_array", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
492 }
a61af66fc99e Initial load
duke
parents:
diff changeset
493
a61af66fc99e Initial load
duke
parents:
diff changeset
494 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
495 // assert object type is really an array of the proper kind
a61af66fc99e Initial load
duke
parents:
diff changeset
496 {
a61af66fc99e Initial load
duke
parents:
diff changeset
497 Label ok;
a61af66fc99e Initial load
duke
parents:
diff changeset
498 Register G3_t1 = G3;
a61af66fc99e Initial load
duke
parents:
diff changeset
499 __ ld(klass_lh, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
500 __ sra(G3_t1, Klass::_lh_array_tag_shift, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
501 int tag = ((id == new_type_array_id)
a61af66fc99e Initial load
duke
parents:
diff changeset
502 ? Klass::_lh_array_tag_type_value
a61af66fc99e Initial load
duke
parents:
diff changeset
503 : Klass::_lh_array_tag_obj_value);
3839
3d42f82cd811 7063628: Use cbcond on T4
kvn
parents: 2321
diff changeset
504 __ cmp_and_brx_short(G3_t1, tag, Assembler::equal, Assembler::pt, ok);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
505 __ stop("assert(is an array klass)");
a61af66fc99e Initial load
duke
parents:
diff changeset
506 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
507 __ bind(ok);
a61af66fc99e Initial load
duke
parents:
diff changeset
508 }
a61af66fc99e Initial load
duke
parents:
diff changeset
509 #endif // ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
510
a61af66fc99e Initial load
duke
parents:
diff changeset
511 if (UseTLAB && FastTLABRefill) {
a61af66fc99e Initial load
duke
parents:
diff changeset
512 Label slow_path;
a61af66fc99e Initial load
duke
parents:
diff changeset
513 Register G1_arr_size = G1;
a61af66fc99e Initial load
duke
parents:
diff changeset
514 Register G3_t1 = G3;
a61af66fc99e Initial load
duke
parents:
diff changeset
515 Register O1_t2 = O1;
a61af66fc99e Initial load
duke
parents:
diff changeset
516 assert_different_registers(G5_klass, G4_length, G1_arr_size, G3_t1, O1_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
517
a61af66fc99e Initial load
duke
parents:
diff changeset
518 // check that array length is small enough for fast path
a61af66fc99e Initial load
duke
parents:
diff changeset
519 __ set(C1_MacroAssembler::max_array_allocation_length, G3_t1);
12955
252d541466ea 8008242: VerifyOops is broken on SPARC
morris
parents: 12883
diff changeset
520 __ cmp(G4_length, G3_t1);
252d541466ea 8008242: VerifyOops is broken on SPARC
morris
parents: 12883
diff changeset
521 __ br(Assembler::greaterUnsigned, false, Assembler::pn, slow_path);
252d541466ea 8008242: VerifyOops is broken on SPARC
morris
parents: 12883
diff changeset
522 __ delayed()->nop();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
523
a61af66fc99e Initial load
duke
parents:
diff changeset
524 // if we got here then the TLAB allocation failed, so try
a61af66fc99e Initial load
duke
parents:
diff changeset
525 // refilling the TLAB or allocating directly from eden.
a61af66fc99e Initial load
duke
parents:
diff changeset
526 Label retry_tlab, try_eden;
a61af66fc99e Initial load
duke
parents:
diff changeset
527 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G4_length and G5_klass
a61af66fc99e Initial load
duke
parents:
diff changeset
528
a61af66fc99e Initial load
duke
parents:
diff changeset
529 __ bind(retry_tlab);
a61af66fc99e Initial load
duke
parents:
diff changeset
530
a61af66fc99e Initial load
duke
parents:
diff changeset
531 // get the allocation size: (length << (layout_helper & 0x1F)) + header_size
a61af66fc99e Initial load
duke
parents:
diff changeset
532 __ ld(klass_lh, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
533 __ sll(G4_length, G3_t1, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
534 __ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
535 __ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
536 __ add(G1_arr_size, G3_t1, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
537 __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size); // align up
a61af66fc99e Initial load
duke
parents:
diff changeset
538 __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
539
a61af66fc99e Initial load
duke
parents:
diff changeset
540 __ tlab_allocate(O0_obj, G1_arr_size, 0, G3_t1, slow_path); // preserves G1_arr_size
a61af66fc99e Initial load
duke
parents:
diff changeset
541
a61af66fc99e Initial load
duke
parents:
diff changeset
542 __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
543 __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
544 __ sub(G1_arr_size, G3_t1, O1_t2); // body length
a61af66fc99e Initial load
duke
parents:
diff changeset
545 __ add(O0_obj, G3_t1, G3_t1); // body start
a61af66fc99e Initial load
duke
parents:
diff changeset
546 __ initialize_body(G3_t1, O1_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
547 __ verify_oop(O0_obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
548 __ retl();
a61af66fc99e Initial load
duke
parents:
diff changeset
549 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
550
a61af66fc99e Initial load
duke
parents:
diff changeset
551 __ bind(try_eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
552 // get the allocation size: (length << (layout_helper & 0x1F)) + header_size
a61af66fc99e Initial load
duke
parents:
diff changeset
553 __ ld(klass_lh, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
554 __ sll(G4_length, G3_t1, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
555 __ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
556 __ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
557 __ add(G1_arr_size, G3_t1, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
558 __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
559 __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
560
a61af66fc99e Initial load
duke
parents:
diff changeset
561 __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path); // preserves G1_arr_size
2127
5577848f5923 7011463: Sparc MacroAssembler::incr_allocated_bytes() needs a RegisterOrConstant argument
phh
parents: 2100
diff changeset
562 __ incr_allocated_bytes(G1_arr_size, G3_t1, O1_t2);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
563
a61af66fc99e Initial load
duke
parents:
diff changeset
564 __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
565 __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
566 __ sub(G1_arr_size, G3_t1, O1_t2); // body length
a61af66fc99e Initial load
duke
parents:
diff changeset
567 __ add(O0_obj, G3_t1, G3_t1); // body start
a61af66fc99e Initial load
duke
parents:
diff changeset
568 __ initialize_body(G3_t1, O1_t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
569 __ verify_oop(O0_obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
570 __ retl();
a61af66fc99e Initial load
duke
parents:
diff changeset
571 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
572
a61af66fc99e Initial load
duke
parents:
diff changeset
573 __ bind(slow_path);
a61af66fc99e Initial load
duke
parents:
diff changeset
574 }
a61af66fc99e Initial load
duke
parents:
diff changeset
575
a61af66fc99e Initial load
duke
parents:
diff changeset
576 if (id == new_type_array_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
577 oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_type_array), G5_klass, G4_length);
a61af66fc99e Initial load
duke
parents:
diff changeset
578 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
579 oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_object_array), G5_klass, G4_length);
a61af66fc99e Initial load
duke
parents:
diff changeset
580 }
a61af66fc99e Initial load
duke
parents:
diff changeset
581 // I0 -> O0: new array
a61af66fc99e Initial load
duke
parents:
diff changeset
582 }
a61af66fc99e Initial load
duke
parents:
diff changeset
583 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
584
a61af66fc99e Initial load
duke
parents:
diff changeset
585 case new_multi_array_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
586 { // O0: klass
a61af66fc99e Initial load
duke
parents:
diff changeset
587 // O1: rank
a61af66fc99e Initial load
duke
parents:
diff changeset
588 // O2: address of 1st dimension
a61af66fc99e Initial load
duke
parents:
diff changeset
589 __ set_info("new_multi_array", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
590 oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_multi_array), I0, I1, I2);
a61af66fc99e Initial load
duke
parents:
diff changeset
591 // I0 -> O0: new multi array
a61af66fc99e Initial load
duke
parents:
diff changeset
592 }
a61af66fc99e Initial load
duke
parents:
diff changeset
593 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
594
a61af66fc99e Initial load
duke
parents:
diff changeset
595 case register_finalizer_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
596 {
a61af66fc99e Initial load
duke
parents:
diff changeset
597 __ set_info("register_finalizer", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
598
a61af66fc99e Initial load
duke
parents:
diff changeset
599 // load the klass and check the has finalizer flag
a61af66fc99e Initial load
duke
parents:
diff changeset
600 Label register_finalizer;
a61af66fc99e Initial load
duke
parents:
diff changeset
601 Register t = O1;
2002
ac637b7220d1 6985015: C1 needs to support compressed oops
iveresov
parents: 1972
diff changeset
602 __ load_klass(O0, t);
4762
069ab3f976d3 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 4048
diff changeset
603 __ ld(t, in_bytes(Klass::access_flags_offset()), t);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
604 __ set(JVM_ACC_HAS_FINALIZER, G3);
a61af66fc99e Initial load
duke
parents:
diff changeset
605 __ andcc(G3, t, G0);
a61af66fc99e Initial load
duke
parents:
diff changeset
606 __ br(Assembler::notZero, false, Assembler::pt, register_finalizer);
a61af66fc99e Initial load
duke
parents:
diff changeset
607 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
608
a61af66fc99e Initial load
duke
parents:
diff changeset
609 // do a leaf return
a61af66fc99e Initial load
duke
parents:
diff changeset
610 __ retl();
a61af66fc99e Initial load
duke
parents:
diff changeset
611 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
612
a61af66fc99e Initial load
duke
parents:
diff changeset
613 __ bind(register_finalizer);
a61af66fc99e Initial load
duke
parents:
diff changeset
614 OopMap* oop_map = save_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
615 int call_offset = __ call_RT(noreg, noreg,
a61af66fc99e Initial load
duke
parents:
diff changeset
616 CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), I0);
a61af66fc99e Initial load
duke
parents:
diff changeset
617 oop_maps = new OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
618 oop_maps->add_gc_map(call_offset, oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
619
a61af66fc99e Initial load
duke
parents:
diff changeset
620 // Now restore all the live registers
a61af66fc99e Initial load
duke
parents:
diff changeset
621 restore_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
622
a61af66fc99e Initial load
duke
parents:
diff changeset
623 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
624 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
625 }
a61af66fc99e Initial load
duke
parents:
diff changeset
626 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
627
a61af66fc99e Initial load
duke
parents:
diff changeset
628 case throw_range_check_failed_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
629 { __ set_info("range_check_failed", dont_gc_arguments); // arguments will be discarded
a61af66fc99e Initial load
duke
parents:
diff changeset
630 // G4: index
a61af66fc99e Initial load
duke
parents:
diff changeset
631 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
632 }
a61af66fc99e Initial load
duke
parents:
diff changeset
633 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
634
a61af66fc99e Initial load
duke
parents:
diff changeset
635 case throw_index_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
636 { __ set_info("index_range_check_failed", dont_gc_arguments); // arguments will be discarded
a61af66fc99e Initial load
duke
parents:
diff changeset
637 // G4: index
a61af66fc99e Initial load
duke
parents:
diff changeset
638 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
639 }
a61af66fc99e Initial load
duke
parents:
diff changeset
640 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
641
a61af66fc99e Initial load
duke
parents:
diff changeset
642 case throw_div0_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
643 { __ set_info("throw_div0_exception", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
644 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
645 }
a61af66fc99e Initial load
duke
parents:
diff changeset
646 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
647
a61af66fc99e Initial load
duke
parents:
diff changeset
648 case throw_null_pointer_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
649 { __ set_info("throw_null_pointer_exception", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
650 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
651 }
a61af66fc99e Initial load
duke
parents:
diff changeset
652 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
653
a61af66fc99e Initial load
duke
parents:
diff changeset
654 case handle_exception_id:
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
655 { __ set_info("handle_exception", dont_gc_arguments);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
656 oop_maps = generate_handle_exception(id, sasm);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
657 }
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
658 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
659
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
660 case handle_exception_from_callee_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
661 { __ set_info("handle_exception_from_callee", dont_gc_arguments);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
662 oop_maps = generate_handle_exception(id, sasm);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
663 }
a61af66fc99e Initial load
duke
parents:
diff changeset
664 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
665
a61af66fc99e Initial load
duke
parents:
diff changeset
666 case unwind_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
667 {
a61af66fc99e Initial load
duke
parents:
diff changeset
668 // O0: exception
a61af66fc99e Initial load
duke
parents:
diff changeset
669 // I7: address of call to this method
a61af66fc99e Initial load
duke
parents:
diff changeset
670
a61af66fc99e Initial load
duke
parents:
diff changeset
671 __ set_info("unwind_exception", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
672 __ mov(Oexception, Oexception->after_save());
a61af66fc99e Initial load
duke
parents:
diff changeset
673 __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save());
a61af66fc99e Initial load
duke
parents:
diff changeset
674
a61af66fc99e Initial load
duke
parents:
diff changeset
675 __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address),
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
676 G2_thread, Oissuing_pc->after_save());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
677 __ verify_not_null_oop(Oexception->after_save());
1564
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
678
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
679 // Restore SP from L7 if the exception PC is a method handle call site.
1564
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
680 __ mov(O0, G5); // Save the target address.
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
681 __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0);
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
682 __ tst(L0); // Condition codes are preserved over the restore.
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
683 __ restore();
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
684
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
685 __ jmp(G5, 0);
61b2245abf36 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 1295
diff changeset
686 __ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP); // Restore SP if required.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
687 }
a61af66fc99e Initial load
duke
parents:
diff changeset
688 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
689
a61af66fc99e Initial load
duke
parents:
diff changeset
690 case throw_array_store_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
691 {
a61af66fc99e Initial load
duke
parents:
diff changeset
692 __ set_info("throw_array_store_exception", dont_gc_arguments);
2168
e4fee0bdaa85 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 2127
diff changeset
693 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
694 }
a61af66fc99e Initial load
duke
parents:
diff changeset
695 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
696
a61af66fc99e Initial load
duke
parents:
diff changeset
697 case throw_class_cast_exception_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
698 {
a61af66fc99e Initial load
duke
parents:
diff changeset
699 // G4: object
a61af66fc99e Initial load
duke
parents:
diff changeset
700 __ set_info("throw_class_cast_exception", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
701 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
702 }
a61af66fc99e Initial load
duke
parents:
diff changeset
703 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
704
a61af66fc99e Initial load
duke
parents:
diff changeset
705 case throw_incompatible_class_change_error_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
706 {
a61af66fc99e Initial load
duke
parents:
diff changeset
707 __ set_info("throw_incompatible_class_cast_exception", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
708 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
709 }
a61af66fc99e Initial load
duke
parents:
diff changeset
710 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
711
a61af66fc99e Initial load
duke
parents:
diff changeset
712 case slow_subtype_check_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
713 { // Support for uint StubRoutine::partial_subtype_check( Klass sub, Klass super );
a61af66fc99e Initial load
duke
parents:
diff changeset
714 // Arguments :
a61af66fc99e Initial load
duke
parents:
diff changeset
715 //
a61af66fc99e Initial load
duke
parents:
diff changeset
716 // ret : G3
a61af66fc99e Initial load
duke
parents:
diff changeset
717 // sub : G3, argument, destroyed
a61af66fc99e Initial load
duke
parents:
diff changeset
718 // super: G1, argument, not changed
a61af66fc99e Initial load
duke
parents:
diff changeset
719 // raddr: O7, blown by call
644
c517646eef23 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 342
diff changeset
720 Label miss;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
721
a61af66fc99e Initial load
duke
parents:
diff changeset
722 __ save_frame(0); // Blow no registers!
a61af66fc99e Initial load
duke
parents:
diff changeset
723
644
c517646eef23 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 342
diff changeset
724 __ check_klass_subtype_slow_path(G3, G1, L0, L1, L2, L4, NULL, &miss);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
725
a61af66fc99e Initial load
duke
parents:
diff changeset
726 __ mov(1, G3);
644
c517646eef23 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 342
diff changeset
727 __ ret(); // Result in G5 is 'true'
0
a61af66fc99e Initial load
duke
parents:
diff changeset
728 __ delayed()->restore(); // free copy or add can go here
a61af66fc99e Initial load
duke
parents:
diff changeset
729
a61af66fc99e Initial load
duke
parents:
diff changeset
730 __ bind(miss);
a61af66fc99e Initial load
duke
parents:
diff changeset
731 __ mov(0, G3);
644
c517646eef23 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 342
diff changeset
732 __ ret(); // Result in G5 is 'false'
0
a61af66fc99e Initial load
duke
parents:
diff changeset
733 __ delayed()->restore(); // free copy or add can go here
a61af66fc99e Initial load
duke
parents:
diff changeset
734 }
a61af66fc99e Initial load
duke
parents:
diff changeset
735
a61af66fc99e Initial load
duke
parents:
diff changeset
736 case monitorenter_nofpu_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
737 case monitorenter_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
738 { // G4: object
a61af66fc99e Initial load
duke
parents:
diff changeset
739 // G5: lock address
a61af66fc99e Initial load
duke
parents:
diff changeset
740 __ set_info("monitorenter", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
741
a61af66fc99e Initial load
duke
parents:
diff changeset
742 int save_fpu_registers = (id == monitorenter_id);
a61af66fc99e Initial load
duke
parents:
diff changeset
743 // make a frame and preserve the caller's caller-save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
744 OopMap* oop_map = save_live_registers(sasm, save_fpu_registers);
a61af66fc99e Initial load
duke
parents:
diff changeset
745
a61af66fc99e Initial load
duke
parents:
diff changeset
746 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), G4, G5);
a61af66fc99e Initial load
duke
parents:
diff changeset
747
a61af66fc99e Initial load
duke
parents:
diff changeset
748 oop_maps = new OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
749 oop_maps->add_gc_map(call_offset, oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
750 restore_live_registers(sasm, save_fpu_registers);
a61af66fc99e Initial load
duke
parents:
diff changeset
751
a61af66fc99e Initial load
duke
parents:
diff changeset
752 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
753 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
754 }
a61af66fc99e Initial load
duke
parents:
diff changeset
755 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
756
a61af66fc99e Initial load
duke
parents:
diff changeset
757 case monitorexit_nofpu_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
758 case monitorexit_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
759 { // G4: lock address
a61af66fc99e Initial load
duke
parents:
diff changeset
760 // note: really a leaf routine but must setup last java sp
a61af66fc99e Initial load
duke
parents:
diff changeset
761 // => use call_RT for now (speed can be improved by
a61af66fc99e Initial load
duke
parents:
diff changeset
762 // doing last java sp setup manually)
a61af66fc99e Initial load
duke
parents:
diff changeset
763 __ set_info("monitorexit", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
764
a61af66fc99e Initial load
duke
parents:
diff changeset
765 int save_fpu_registers = (id == monitorexit_id);
a61af66fc99e Initial load
duke
parents:
diff changeset
766 // make a frame and preserve the caller's caller-save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
767 OopMap* oop_map = save_live_registers(sasm, save_fpu_registers);
a61af66fc99e Initial load
duke
parents:
diff changeset
768
a61af66fc99e Initial load
duke
parents:
diff changeset
769 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
770
a61af66fc99e Initial load
duke
parents:
diff changeset
771 oop_maps = new OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
772 oop_maps->add_gc_map(call_offset, oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
773 restore_live_registers(sasm, save_fpu_registers);
a61af66fc99e Initial load
duke
parents:
diff changeset
774
a61af66fc99e Initial load
duke
parents:
diff changeset
775 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
776 __ delayed()->restore();
4048
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
777 }
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
778 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
779
4048
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
780 case deoptimize_id:
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
781 {
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
782 __ set_info("deoptimize", dont_gc_arguments);
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
783 OopMap* oop_map = save_live_registers(sasm);
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
784 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
785 oop_maps = new OopMapSet();
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
786 oop_maps->add_gc_map(call_offset, oop_map);
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
787 restore_live_registers(sasm);
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
788 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
789 assert(deopt_blob != NULL, "deoptimization blob must have been created");
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
790 AddressLiteral dest(deopt_blob->unpack_with_reexecution());
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
791 __ jump_to(dest, O0);
cec1757a0134 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 3910
diff changeset
792 __ delayed()->restore();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
793 }
a61af66fc99e Initial load
duke
parents:
diff changeset
794 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
795
a61af66fc99e Initial load
duke
parents:
diff changeset
796 case access_field_patching_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
797 { __ set_info("access_field_patching", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
798 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching));
a61af66fc99e Initial load
duke
parents:
diff changeset
799 }
a61af66fc99e Initial load
duke
parents:
diff changeset
800 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
801
a61af66fc99e Initial load
duke
parents:
diff changeset
802 case load_klass_patching_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
803 { __ set_info("load_klass_patching", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
804 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching));
a61af66fc99e Initial load
duke
parents:
diff changeset
805 }
a61af66fc99e Initial load
duke
parents:
diff changeset
806 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
807
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
808 case load_mirror_patching_id:
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
809 { __ set_info("load_mirror_patching", dont_gc_arguments);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
810 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching));
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
811 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
812 break;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4771
diff changeset
813
12160
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 9155
diff changeset
814 case load_appendix_patching_id:
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 9155
diff changeset
815 { __ set_info("load_appendix_patching", dont_gc_arguments);
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 9155
diff changeset
816 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching));
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 9155
diff changeset
817 }
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 9155
diff changeset
818 break;
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 9155
diff changeset
819
0
a61af66fc99e Initial load
duke
parents:
diff changeset
820 case dtrace_object_alloc_id:
a61af66fc99e Initial load
duke
parents:
diff changeset
821 { // O0: object
a61af66fc99e Initial load
duke
parents:
diff changeset
822 __ set_info("dtrace_object_alloc", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
823 // we can't gc here so skip the oopmap but make sure that all
a61af66fc99e Initial load
duke
parents:
diff changeset
824 // the live registers get saved.
a61af66fc99e Initial load
duke
parents:
diff changeset
825 save_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
826
a61af66fc99e Initial load
duke
parents:
diff changeset
827 __ save_thread(L7_thread_cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
828 __ call(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
a61af66fc99e Initial load
duke
parents:
diff changeset
829 relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
830 __ delayed()->mov(I0, O0);
a61af66fc99e Initial load
duke
parents:
diff changeset
831 __ restore_thread(L7_thread_cache);
a61af66fc99e Initial load
duke
parents:
diff changeset
832
a61af66fc99e Initial load
duke
parents:
diff changeset
833 restore_live_registers(sasm);
a61af66fc99e Initial load
duke
parents:
diff changeset
834 __ ret();
a61af66fc99e Initial load
duke
parents:
diff changeset
835 __ delayed()->restore();
a61af66fc99e Initial load
duke
parents:
diff changeset
836 }
a61af66fc99e Initial load
duke
parents:
diff changeset
837 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
838
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
839 #if INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
840 case g1_pre_barrier_slow_id:
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
841 { // G4: previous value of memory
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
842 BarrierSet* bs = Universe::heap()->barrier_set();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
843 if (bs->kind() != BarrierSet::G1SATBCTLogging) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
844 __ save_frame(0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
845 __ set((int)id, O1);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
846 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
847 __ should_not_reach_here();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
848 break;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
849 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
850
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
851 __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
852
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
853 Register pre_val = G4;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
854 Register tmp = G1_scratch;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
855 Register tmp2 = G3_scratch;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
856
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
857 Label refill, restart;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
858 bool with_frame = false; // I don't know if we can do with-frame.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
859 int satb_q_index_byte_offset =
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
860 in_bytes(JavaThread::satb_mark_queue_offset() +
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
861 PtrQueue::byte_offset_of_index());
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
862 int satb_q_buf_byte_offset =
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
863 in_bytes(JavaThread::satb_mark_queue_offset() +
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
864 PtrQueue::byte_offset_of_buf());
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
865
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
866 __ bind(restart);
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
867 // Load the index into the SATB buffer. PtrQueue::_index is a
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
868 // size_t so ld_ptr is appropriate
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
869 __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
870
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
871 // index == 0?
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
872 __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pn, refill);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
873
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
874 __ ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
875 __ sub(tmp, oopSize, tmp);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
876
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
877 __ st_ptr(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
878 // Use return-from-leaf
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
879 __ retl();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
880 __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
881
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
882 __ bind(refill);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
883 __ save_frame(0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
884
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
885 __ mov(pre_val, L0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
886 __ mov(tmp, L1);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
887 __ mov(tmp2, L2);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
888
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
889 __ call_VM_leaf(L7_thread_cache,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
890 CAST_FROM_FN_PTR(address,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
891 SATBMarkQueueSet::handle_zero_index_for_thread),
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
892 G2_thread);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
893
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
894 __ mov(L0, pre_val);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
895 __ mov(L1, tmp);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
896 __ mov(L2, tmp2);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
897
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
898 __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
899 __ delayed()->restore();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
900 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
901 break;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
902
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
903 case g1_post_barrier_slow_id:
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
904 {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
905 BarrierSet* bs = Universe::heap()->barrier_set();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
906 if (bs->kind() != BarrierSet::G1SATBCTLogging) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
907 __ save_frame(0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
908 __ set((int)id, O1);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
909 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
910 __ should_not_reach_here();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
911 break;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
912 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
913
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
914 __ set_info("g1_post_barrier_slow_id", dont_gc_arguments);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
915
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
916 Register addr = G4;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
917 Register cardtable = G5;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
918 Register tmp = G1_scratch;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
919 Register tmp2 = G3_scratch;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
920 jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
921
12835
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
922 Label not_already_dirty, restart, refill, young_card;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
923
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
924 #ifdef _LP64
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
925 __ srlx(addr, CardTableModRefBS::card_shift, addr);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
926 #else
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
927 __ srl(addr, CardTableModRefBS::card_shift, addr);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
928 #endif
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
929
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
930 AddressLiteral rs(byte_map_base);
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 644
diff changeset
931 __ set(rs, cardtable); // cardtable := <card table base>
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
932 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
933
12835
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
934 __ cmp_and_br_short(tmp, G1SATBCardTableModRefBS::g1_young_card_val(), Assembler::equal, Assembler::pt, young_card);
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
935
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
936 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
937 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
938
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
939 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code");
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
940 __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
941
12835
69944b868a32 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 12160
diff changeset
942 __ bind(young_card);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
943 // We didn't take the branch, so we're already dirty: return.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
944 // Use return-from-leaf
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
945 __ retl();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
946 __ delayed()->nop();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
947
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
948 // Not dirty.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
949 __ bind(not_already_dirty);
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
950
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
951 // Get cardtable + tmp into a reg by itself
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
952 __ add(addr, cardtable, tmp2);
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
953
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
954 // First, dirty it.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
955 __ stb(G0, tmp2, 0); // [cardPtr] := 0 (i.e., dirty).
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
956
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
957 Register tmp3 = cardtable;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
958 Register tmp4 = tmp;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
959
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
960 // these registers are now dead
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
961 addr = cardtable = tmp = noreg;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
962
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
963 int dirty_card_q_index_byte_offset =
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
964 in_bytes(JavaThread::dirty_card_queue_offset() +
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
965 PtrQueue::byte_offset_of_index());
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
966 int dirty_card_q_buf_byte_offset =
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
967 in_bytes(JavaThread::dirty_card_queue_offset() +
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
968 PtrQueue::byte_offset_of_buf());
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
969
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
970 __ bind(restart);
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
971
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
972 // Get the index into the update buffer. PtrQueue::_index is
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
973 // a size_t so ld_ptr is appropriate here.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
974 __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
975
3888
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
976 // index == 0?
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
977 __ cmp_and_brx_short(tmp3, G0, Assembler::equal, Assembler::pn, refill);
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
978
4fe626cbf0bf 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 3839
diff changeset
979 __ ld_ptr(G2_thread, dirty_card_q_buf_byte_offset, tmp4);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
980 __ sub(tmp3, oopSize, tmp3);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
981
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
982 __ st_ptr(tmp2, tmp4, tmp3); // [_buf + index] := <address_of_card>
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
983 // Use return-from-leaf
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
984 __ retl();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
985 __ delayed()->st_ptr(tmp3, G2_thread, dirty_card_q_index_byte_offset);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
986
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
987 __ bind(refill);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
988 __ save_frame(0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
989
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
990 __ mov(tmp2, L0);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
991 __ mov(tmp3, L1);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
992 __ mov(tmp4, L2);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
993
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
994 __ call_VM_leaf(L7_thread_cache,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
995 CAST_FROM_FN_PTR(address,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
996 DirtyCardQueueSet::handle_zero_index_for_thread),
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
997 G2_thread);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
998
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
999 __ mov(L0, tmp2);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1000 __ mov(L1, tmp3);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1001 __ mov(L2, tmp4);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1002
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1003 __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1004 __ delayed()->restore();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1005 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1006 break;
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
1007 #endif // INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
1008
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1009 case predicate_failed_trap_id:
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1010 {
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1011 __ set_info("predicate_failed_trap", dont_gc_arguments);
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1012 OopMap* oop_map = save_live_registers(sasm);
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1013
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1014 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1015
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1016 oop_maps = new OopMapSet();
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1017 oop_maps->add_gc_map(call_offset, oop_map);
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1018
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1019 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1020 assert(deopt_blob != NULL, "deoptimization blob must have been created");
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1021 restore_live_registers(sasm);
9155
bb4a966cc68f 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 8860
diff changeset
1022
bb4a966cc68f 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 8860
diff changeset
1023 AddressLiteral dest(deopt_blob->unpack_with_reexecution());
bb4a966cc68f 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 8860
diff changeset
1024 __ jump_to(dest, O0);
bb4a966cc68f 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 8860
diff changeset
1025 __ delayed()->restore();
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1026 }
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1027 break;
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
1028
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1029 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
1030 { __ set_info("unimplemented entry", dont_gc_arguments);
a61af66fc99e Initial load
duke
parents:
diff changeset
1031 __ save_frame(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
1032 __ set((int)id, O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
1033 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
1034 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
1035 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1036 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
1037 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1038 return oop_maps;
a61af66fc99e Initial load
duke
parents:
diff changeset
1039 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1040
a61af66fc99e Initial load
duke
parents:
diff changeset
1041
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1042 OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1043 __ block_comment("generate_handle_exception");
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1044
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1045 // Save registers, if required.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1046 OopMapSet* oop_maps = new OopMapSet();
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1047 OopMap* oop_map = NULL;
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1048 switch (id) {
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1049 case forward_exception_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1050 // We're handling an exception in the context of a compiled frame.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1051 // The registers have been saved in the standard places. Perform
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1052 // an exception lookup in the caller and dispatch to the handler
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1053 // if found. Otherwise unwind and dispatch to the callers
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1054 // exception handler.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1055 oop_map = generate_oop_map(sasm, true);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1056
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1057 // transfer the pending exception to the exception_oop
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1058 __ ld_ptr(G2_thread, in_bytes(JavaThread::pending_exception_offset()), Oexception);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1059 __ ld_ptr(Oexception, 0, G0);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1060 __ st_ptr(G0, G2_thread, in_bytes(JavaThread::pending_exception_offset()));
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1061 __ add(I7, frame::pc_return_offset, Oissuing_pc);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1062 break;
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1063 case handle_exception_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1064 // At this point all registers MAY be live.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1065 oop_map = save_live_registers(sasm);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1066 __ mov(Oexception->after_save(), Oexception);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1067 __ mov(Oissuing_pc->after_save(), Oissuing_pc);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1068 break;
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1069 case handle_exception_from_callee_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1070 // At this point all registers except exception oop (Oexception)
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1071 // and exception pc (Oissuing_pc) are dead.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1072 oop_map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1073 sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1074 __ save_frame_c1(frame_size_in_bytes);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1075 __ mov(Oexception->after_save(), Oexception);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1076 __ mov(Oissuing_pc->after_save(), Oissuing_pc);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1077 break;
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1078 default: ShouldNotReachHere();
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1079 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1080
a61af66fc99e Initial load
duke
parents:
diff changeset
1081 __ verify_not_null_oop(Oexception);
a61af66fc99e Initial load
duke
parents:
diff changeset
1082
12876
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1083 #ifdef ASSERT
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1084 // check that fields in JavaThread for exception oop and issuing pc are
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1085 // empty before writing to them
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1086 Label oop_empty;
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1087 Register scratch = I7; // We can use I7 here because it's overwritten later anyway.
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1088 __ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch);
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1089 __ br_null(scratch, false, Assembler::pt, oop_empty);
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1090 __ delayed()->nop();
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1091 __ stop("exception oop already set");
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1092 __ bind(oop_empty);
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1093
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1094 Label pc_empty;
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1095 __ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch);
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1096 __ br_null(scratch, false, Assembler::pt, pc_empty);
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1097 __ delayed()->nop();
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1098 __ stop("exception pc already set");
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1099 __ bind(pc_empty);
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1100 #endif
8b80b262e501 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 12160
diff changeset
1101
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1102 // save the exception and issuing pc in the thread
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1103 __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1104 __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
a61af66fc99e Initial load
duke
parents:
diff changeset
1105
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1106 // use the throwing pc as the return address to lookup (has bci & oop map)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1107 __ mov(Oissuing_pc, I7);
a61af66fc99e Initial load
duke
parents:
diff changeset
1108 __ sub(I7, frame::pc_return_offset, I7);
a61af66fc99e Initial load
duke
parents:
diff changeset
1109 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1110 oop_maps->add_gc_map(call_offset, oop_map);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1111
a61af66fc99e Initial load
duke
parents:
diff changeset
1112 // Note: if nmethod has been deoptimized then regardless of
a61af66fc99e Initial load
duke
parents:
diff changeset
1113 // whether it had a handler or not we will deoptimize
a61af66fc99e Initial load
duke
parents:
diff changeset
1114 // by entering the deopt blob with a pending exception.
a61af66fc99e Initial load
duke
parents:
diff changeset
1115
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1116 // Restore the registers that were saved at the beginning, remove
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1117 // the frame and jump to the exception handler.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1118 switch (id) {
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1119 case forward_exception_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1120 case handle_exception_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1121 restore_live_registers(sasm);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1122 __ jmp(O0, 0);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1123 __ delayed()->restore();
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1124 break;
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1125 case handle_exception_from_callee_id:
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1126 // Restore SP from L7 if the exception PC is a method handle call site.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1127 __ mov(O0, G5); // Save the target address.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1128 __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0);
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1129 __ tst(L0); // Condition codes are preserved over the restore.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1130 __ restore();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1131
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1132 __ jmp(G5, 0); // jump to the exception handler
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1133 __ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP); // Restore SP if required.
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1134 break;
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1135 default: ShouldNotReachHere();
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1136 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1137
2321
1b4e6a5d98e0 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 2170
diff changeset
1138 return oop_maps;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1140
a61af66fc99e Initial load
duke
parents:
diff changeset
1141
a61af66fc99e Initial load
duke
parents:
diff changeset
1142 #undef __
a61af66fc99e Initial load
duke
parents:
diff changeset
1143
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1579
diff changeset
1144 const char *Runtime1::pd_name_for_address(address entry) {
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1579
diff changeset
1145 return "<unknown function>";
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1579
diff changeset
1146 }