< prev index next >

src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp

Print this page

  1 /*
  2  * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.

115   address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
116   __ far_call(RuntimeAddress(a));
117   ce->add_call_info_here(_info);
118   ce->verify_oop_map(_info);
119   debug_only(__ should_not_reach_here());
120 }
121 
122 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
123   if (_offset != -1) {
124     ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
125   }
126   __ bind(_entry);
127   __ far_call(Address(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type));
128   ce->add_call_info_here(_info);
129   ce->verify_oop_map(_info);
130 #ifdef ASSERT
131   __ should_not_reach_here();
132 #endif
133 }
134 


































































135 
136 
137 // Implementation of NewInstanceStub
138 
139 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
140   _result = result;
141   _klass = klass;
142   _klass_reg = klass_reg;
143   _info = new CodeEmitInfo(info);
144   assert(stub_id == Runtime1::new_instance_id                 ||

145          stub_id == Runtime1::fast_new_instance_id            ||
146          stub_id == Runtime1::fast_new_instance_init_check_id,
147          "need new_instance id");
148   _stub_id   = stub_id;
149 }
150 
151 
152 
153 void NewInstanceStub::emit_code(LIR_Assembler* ce) {
154   assert(__ rsp_offset() == 0, "frame size should be fixed");
155   __ bind(_entry);
156   __ mov(r3, _klass_reg->as_register());
157   __ far_call(RuntimeAddress(Runtime1::entry_for(_stub_id)));
158   ce->add_call_info_here(_info);
159   ce->verify_oop_map(_info);
160   assert(_result->as_register() == r0, "result must in r0,");
161   __ b(_continuation);
162 }
163 
164 
165 // Implementation of NewTypeArrayStub
166 
167 // Implementation of NewTypeArrayStub
168 
169 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
170   _klass_reg = klass_reg;
171   _length = length;
172   _result = result;
173   _info = new CodeEmitInfo(info);
174 }
175 
176 
177 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
178   assert(__ rsp_offset() == 0, "frame size should be fixed");
179   __ bind(_entry);
180   assert(_length->as_register() == r19, "length must in r19,");
181   assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
182   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_type_array_id)));
183   ce->add_call_info_here(_info);
184   ce->verify_oop_map(_info);
185   assert(_result->as_register() == r0, "result must in r0");
186   __ b(_continuation);
187 }
188 
189 
190 // Implementation of NewObjectArrayStub
191 
192 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {

193   _klass_reg = klass_reg;
194   _result = result;
195   _length = length;
196   _info = new CodeEmitInfo(info);

197 }
198 
199 
200 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
201   assert(__ rsp_offset() == 0, "frame size should be fixed");
202   __ bind(_entry);
203   assert(_length->as_register() == r19, "length must in r19,");
204   assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
205   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));






206   ce->add_call_info_here(_info);
207   ce->verify_oop_map(_info);
208   assert(_result->as_register() == r0, "result must in r0");
209   __ b(_continuation);
210 }
211 // Implementation of MonitorAccessStubs
212 
213 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
214 : MonitorAccessStub(obj_reg, lock_reg)
215 {
216   _info = new CodeEmitInfo(info);





217 }
218 
219 
220 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
221   assert(__ rsp_offset() == 0, "frame size should be fixed");
222   __ bind(_entry);










223   ce->store_parameter(_obj_reg->as_register(),  1);
224   ce->store_parameter(_lock_reg->as_register(), 0);
225   Runtime1::StubID enter_id;
226   if (ce->compilation()->has_fpu_code()) {
227     enter_id = Runtime1::monitorenter_id;
228   } else {
229     enter_id = Runtime1::monitorenter_nofpu_id;
230   }
231   __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
232   ce->add_call_info_here(_info);
233   ce->verify_oop_map(_info);
234   __ b(_continuation);
235 }
236 
237 
238 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
239   __ bind(_entry);
240   if (_compute_lock) {
241     // lock_reg was destroyed by fast unlocking attempt => recompute it
242     ce->monitor_address(_monitor_ix, _lock_reg);

  1 /*
  2  * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.

115   address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
116   __ far_call(RuntimeAddress(a));
117   ce->add_call_info_here(_info);
118   ce->verify_oop_map(_info);
119   debug_only(__ should_not_reach_here());
120 }
121 
122 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
123   if (_offset != -1) {
124     ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
125   }
126   __ bind(_entry);
127   __ far_call(Address(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type));
128   ce->add_call_info_here(_info);
129   ce->verify_oop_map(_info);
130 #ifdef ASSERT
131   __ should_not_reach_here();
132 #endif
133 }
134 
135 // Implementation of LoadFlattenedArrayStub
136 
137 LoadFlattenedArrayStub::LoadFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
138   _array = array;
139   _index = index;
140   _result = result;
141   _scratch_reg = FrameMap::r0_oop_opr;
142   _info = new CodeEmitInfo(info);
143 }
144 
145 void LoadFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
146   assert(__ rsp_offset() == 0, "frame size should be fixed");
147   __ bind(_entry);
148   ce->store_parameter(_array->as_register(), 1);
149   ce->store_parameter(_index->as_register(), 0);
150   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::load_flattened_array_id)));
151   ce->add_call_info_here(_info);
152   ce->verify_oop_map(_info);
153   if (_result->as_register() != r0) {
154     __ mov(_result->as_register(), r0);
155   }
156   __ b(_continuation);
157 }
158 
159 
160 // Implementation of StoreFlattenedArrayStub
161 
162 StoreFlattenedArrayStub::StoreFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr value, CodeEmitInfo* info) {
163   _array = array;
164   _index = index;
165   _value = value;
166   _scratch_reg = FrameMap::r0_oop_opr;
167   _info = new CodeEmitInfo(info);
168 }
169 
170 
171 void StoreFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
172   assert(__ rsp_offset() == 0, "frame size should be fixed");
173   __ bind(_entry);
174   ce->store_parameter(_array->as_register(), 2);
175   ce->store_parameter(_index->as_register(), 1);
176   ce->store_parameter(_value->as_register(), 0);
177   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::store_flattened_array_id)));
178   ce->add_call_info_here(_info);
179   ce->verify_oop_map(_info);
180   __ b(_continuation);
181 }
182 
183 // Implementation of SubstitutabilityCheckStub
184 SubstitutabilityCheckStub::SubstitutabilityCheckStub(LIR_Opr left, LIR_Opr right, CodeEmitInfo* info) {
185   _left = left;
186   _right = right;
187   _scratch_reg = FrameMap::r0_oop_opr;
188   _info = new CodeEmitInfo(info);
189 }
190 
191 void SubstitutabilityCheckStub::emit_code(LIR_Assembler* ce) {
192   assert(__ rsp_offset() == 0, "frame size should be fixed");
193   __ bind(_entry);
194   ce->store_parameter(_left->as_register(), 1);
195   ce->store_parameter(_right->as_register(), 0);
196   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::substitutability_check_id)));
197   ce->add_call_info_here(_info);
198   ce->verify_oop_map(_info);
199   __ b(_continuation);
200 }
201 
202 
203 // Implementation of NewInstanceStub
204 
205 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
206   _result = result;
207   _klass = klass;
208   _klass_reg = klass_reg;
209   _info = new CodeEmitInfo(info);
210   assert(stub_id == Runtime1::new_instance_id                 ||
211          stub_id == Runtime1::new_instance_no_inline_id       ||
212          stub_id == Runtime1::fast_new_instance_id            ||
213          stub_id == Runtime1::fast_new_instance_init_check_id,
214          "need new_instance id");
215   _stub_id   = stub_id;
216 }
217 


218 void NewInstanceStub::emit_code(LIR_Assembler* ce) {
219   assert(__ rsp_offset() == 0, "frame size should be fixed");
220   __ bind(_entry);
221   __ mov(r3, _klass_reg->as_register());
222   __ far_call(RuntimeAddress(Runtime1::entry_for(_stub_id)));
223   ce->add_call_info_here(_info);
224   ce->verify_oop_map(_info);
225   assert(_result->as_register() == r0, "result must in r0,");
226   __ b(_continuation);
227 }
228 
229 
230 // Implementation of NewTypeArrayStub
231 
232 // Implementation of NewTypeArrayStub
233 
234 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
235   _klass_reg = klass_reg;
236   _length = length;
237   _result = result;
238   _info = new CodeEmitInfo(info);
239 }
240 
241 
242 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
243   assert(__ rsp_offset() == 0, "frame size should be fixed");
244   __ bind(_entry);
245   assert(_length->as_register() == r19, "length must in r19,");
246   assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
247   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_type_array_id)));
248   ce->add_call_info_here(_info);
249   ce->verify_oop_map(_info);
250   assert(_result->as_register() == r0, "result must in r0");
251   __ b(_continuation);
252 }
253 
254 
255 // Implementation of NewObjectArrayStub
256 
257 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result,
258                                        CodeEmitInfo* info, bool is_null_free) {
259   _klass_reg = klass_reg;
260   _result = result;
261   _length = length;
262   _info = new CodeEmitInfo(info);
263   _is_null_free = is_null_free;
264 }
265 
266 
267 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
268   assert(__ rsp_offset() == 0, "frame size should be fixed");
269   __ bind(_entry);
270   assert(_length->as_register() == r19, "length must in r19,");
271   assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
272 
273   if (_is_null_free) {
274     __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_flat_array_id)));
275   } else {
276     __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
277   }
278 
279   ce->add_call_info_here(_info);
280   ce->verify_oop_map(_info);
281   assert(_result->as_register() == r0, "result must in r0");
282   __ b(_continuation);
283 }
284 // Implementation of MonitorAccessStubs
285 
286 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info,  CodeStub* throw_imse_stub, LIR_Opr scratch_reg)
287 : MonitorAccessStub(obj_reg, lock_reg)
288 {
289   _info = new CodeEmitInfo(info);
290   _scratch_reg = scratch_reg;
291   _throw_imse_stub = throw_imse_stub;
292   if (_throw_imse_stub != NULL) {
293     assert(_scratch_reg != LIR_OprFact::illegalOpr, "must be");
294   }
295 }
296 
297 
298 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
299   assert(__ rsp_offset() == 0, "frame size should be fixed");
300   __ bind(_entry);
301   if (_throw_imse_stub != NULL) {
302     // When we come here, _obj_reg has already been checked to be non-null.
303     __ ldr(rscratch1, Address(_obj_reg->as_register(), oopDesc::mark_offset_in_bytes()));
304     __ mov(rscratch2, markWord::inline_type_pattern);
305     __ andr(rscratch1, rscratch1, rscratch2);
306 
307     __ cmp(rscratch1, rscratch2);
308     __ br(Assembler::EQ, *_throw_imse_stub->entry());
309   }
310 
311   ce->store_parameter(_obj_reg->as_register(),  1);
312   ce->store_parameter(_lock_reg->as_register(), 0);
313   Runtime1::StubID enter_id;
314   if (ce->compilation()->has_fpu_code()) {
315     enter_id = Runtime1::monitorenter_id;
316   } else {
317     enter_id = Runtime1::monitorenter_nofpu_id;
318   }
319   __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
320   ce->add_call_info_here(_info);
321   ce->verify_oop_map(_info);
322   __ b(_continuation);
323 }
324 
325 
326 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
327   __ bind(_entry);
328   if (_compute_lock) {
329     // lock_reg was destroyed by fast unlocking attempt => recompute it
330     ce->monitor_address(_monitor_ix, _lock_reg);
< prev index next >