< prev index next >

src/hotspot/cpu/riscv/c1_CodeStubs_riscv.cpp

Print this page

183 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
184   _klass_reg = klass_reg;
185   _result = result;
186   _length = length;
187   _info = new CodeEmitInfo(info);
188 }
189 
190 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
191   assert(__ rsp_offset() == 0, "frame size should be fixed");
192   __ bind(_entry);
193   assert(_length->as_register() == x9, "length must in x9");
194   assert(_klass_reg->as_register() == x13, "klass_reg must in x13");
195   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
196   ce->add_call_info_here(_info);
197   ce->verify_oop_map(_info);
198   assert(_result->as_register() == x10, "result must in x10");
199   __ j(_continuation);
200 }
201 
202 // Implementation of MonitorAccessStubs
203 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
204 : MonitorAccessStub(obj_reg, lock_reg) {
205   _info = new CodeEmitInfo(info);
206 }
207 
208 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
209   assert(__ rsp_offset() == 0, "frame size should be fixed");
210   __ bind(_entry);
211   ce->store_parameter(_obj_reg->as_register(),  1);
212   ce->store_parameter(_lock_reg->as_register(), 0);
213   Runtime1::StubID enter_id;
214   if (ce->compilation()->has_fpu_code()) {
215     enter_id = Runtime1::monitorenter_id;
216   } else {
217     enter_id = Runtime1::monitorenter_nofpu_id;
218   }
219   __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
220   ce->add_call_info_here(_info);
221   ce->verify_oop_map(_info);
222   __ j(_continuation);
223 }
224 
225 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
226   __ bind(_entry);
227   if (_compute_lock) {
228     // lock_reg was destroyed by fast unlocking attempt => recompute it
229     ce->monitor_address(_monitor_ix, _lock_reg);
230   }
231   ce->store_parameter(_lock_reg->as_register(), 0);
232   // note: non-blocking leaf routine => no call info needed
233   Runtime1::StubID exit_id;
234   if (ce->compilation()->has_fpu_code()) {
235     exit_id = Runtime1::monitorexit_id;
236   } else {
237     exit_id = Runtime1::monitorexit_nofpu_id;
238   }
239   __ la(ra, _continuation);
240   __ far_jump(RuntimeAddress(Runtime1::entry_for(exit_id)));
241 }
242 
243 // Implementation of patching:
244 // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
245 // - Replace original code with a call to the stub
246 // At Runtime:
247 // - call to stub, jump to runtime
248 // - in runtime: preserve all registers (rspecially objects, i.e., source and destination object)
249 // - in runtime: after initializing class, restore original code, reexecute instruction
250 
251 int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;

183 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
184   _klass_reg = klass_reg;
185   _result = result;
186   _length = length;
187   _info = new CodeEmitInfo(info);
188 }
189 
190 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
191   assert(__ rsp_offset() == 0, "frame size should be fixed");
192   __ bind(_entry);
193   assert(_length->as_register() == x9, "length must in x9");
194   assert(_klass_reg->as_register() == x13, "klass_reg must in x13");
195   __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
196   ce->add_call_info_here(_info);
197   ce->verify_oop_map(_info);
198   assert(_result->as_register() == x10, "result must in x10");
199   __ j(_continuation);
200 }
201 
202 // Implementation of MonitorAccessStubs
203 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, CodeEmitInfo* info)
204 : MonitorAccessStub(obj_reg) {
205   _info = new CodeEmitInfo(info);
206 }
207 
208 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
209   assert(__ rsp_offset() == 0, "frame size should be fixed");
210   __ bind(_entry);
211   ce->store_parameter(_obj_reg->as_register(),  0);

212   Runtime1::StubID enter_id;
213   if (ce->compilation()->has_fpu_code()) {
214     enter_id = Runtime1::monitorenter_id;
215   } else {
216     enter_id = Runtime1::monitorenter_nofpu_id;
217   }
218   __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
219   ce->add_call_info_here(_info);
220   ce->verify_oop_map(_info);
221   __ j(_continuation);
222 }
223 
224 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
225   __ bind(_entry);
226   ce->store_parameter(_obj_reg->as_register(), 0);




227   // note: non-blocking leaf routine => no call info needed
228   Runtime1::StubID exit_id;
229   if (ce->compilation()->has_fpu_code()) {
230     exit_id = Runtime1::monitorexit_id;
231   } else {
232     exit_id = Runtime1::monitorexit_nofpu_id;
233   }
234   __ la(ra, _continuation);
235   __ far_jump(RuntimeAddress(Runtime1::entry_for(exit_id)));
236 }
237 
238 // Implementation of patching:
239 // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
240 // - Replace original code with a call to the stub
241 // At Runtime:
242 // - call to stub, jump to runtime
243 // - in runtime: preserve all registers (rspecially objects, i.e., source and destination object)
244 // - in runtime: after initializing class, restore original code, reexecute instruction
245 
246 int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;
< prev index next >