< prev index next >

src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp

Print this page

298   if (!OptoReg::is_reg(opto_reg)) {
299     return OptoReg::Bad;
300   }
301 
302   const VMReg vm_reg = OptoReg::as_VMReg(opto_reg);
303   if (vm_reg->is_FloatRegister()) {
304     return opto_reg & ~1;
305   }
306 
307   return opto_reg;
308 }
309 
310 #undef __
311 #define __ _masm->
312 
313 class ZSaveLiveRegisters {
314 private:
315   MacroAssembler* const _masm;
316   RegSet                _gp_regs;
317   FloatRegSet           _fp_regs;

318 
319 public:
320   void initialize(ZLoadBarrierStubC2* stub) {
321     // Record registers that needs to be saved/restored
322     RegMaskIterator rmi(stub->live());
323     while (rmi.has_next()) {
324       const OptoReg::Name opto_reg = rmi.next();
325       if (OptoReg::is_reg(opto_reg)) {
326         const VMReg vm_reg = OptoReg::as_VMReg(opto_reg);
327         if (vm_reg->is_Register()) {
328           _gp_regs += RegSet::of(vm_reg->as_Register());
329         } else if (vm_reg->is_FloatRegister()) {
330           _fp_regs += FloatRegSet::of(vm_reg->as_FloatRegister());


331         } else {
332           fatal("Unknown register type");
333         }
334       }
335     }
336 
337     // Remove C-ABI SOE registers, scratch regs and _ref register that will be updated
338     _gp_regs -= RegSet::range(r19, r30) + RegSet::of(r8, r9, stub->ref());
339   }
340 
341   ZSaveLiveRegisters(MacroAssembler* masm, ZLoadBarrierStubC2* stub) :
342       _masm(masm),
343       _gp_regs(),
344       _fp_regs() {

345 
346     // Figure out what registers to save/restore
347     initialize(stub);
348 
349     // Save registers
350     __ push(_gp_regs, sp);
351     __ push_fp(_fp_regs, sp);

352   }
353 
354   ~ZSaveLiveRegisters() {
355     // Restore registers

356     __ pop_fp(_fp_regs, sp);
357 
358     // External runtime call may clobber ptrue reg
359     __ reinitialize_ptrue();
360 
361     __ pop(_gp_regs, sp);
362   }
363 };
364 
365 #undef __
366 #define __ _masm->
367 
368 class ZSetupArguments {
369 private:
370   MacroAssembler* const _masm;
371   const Register        _ref;
372   const Address         _ref_addr;
373 
374 public:
375   ZSetupArguments(MacroAssembler* masm, ZLoadBarrierStubC2* stub) :

298   if (!OptoReg::is_reg(opto_reg)) {
299     return OptoReg::Bad;
300   }
301 
302   const VMReg vm_reg = OptoReg::as_VMReg(opto_reg);
303   if (vm_reg->is_FloatRegister()) {
304     return opto_reg & ~1;
305   }
306 
307   return opto_reg;
308 }
309 
310 #undef __
311 #define __ _masm->
312 
313 class ZSaveLiveRegisters {
314 private:
315   MacroAssembler* const _masm;
316   RegSet                _gp_regs;
317   FloatRegSet           _fp_regs;
318   PRegSet               _p_regs;
319 
320 public:
321   void initialize(ZLoadBarrierStubC2* stub) {
322     // Record registers that needs to be saved/restored
323     RegMaskIterator rmi(stub->live());
324     while (rmi.has_next()) {
325       const OptoReg::Name opto_reg = rmi.next();
326       if (OptoReg::is_reg(opto_reg)) {
327         const VMReg vm_reg = OptoReg::as_VMReg(opto_reg);
328         if (vm_reg->is_Register()) {
329           _gp_regs += RegSet::of(vm_reg->as_Register());
330         } else if (vm_reg->is_FloatRegister()) {
331           _fp_regs += FloatRegSet::of(vm_reg->as_FloatRegister());
332         } else if (vm_reg->is_PRegister()) {
333           _p_regs += PRegSet::of(vm_reg->as_PRegister());
334         } else {
335           fatal("Unknown register type");
336         }
337       }
338     }
339 
340     // Remove C-ABI SOE registers, scratch regs and _ref register that will be updated
341     _gp_regs -= RegSet::range(r19, r30) + RegSet::of(r8, r9, stub->ref());
342   }
343 
344   ZSaveLiveRegisters(MacroAssembler* masm, ZLoadBarrierStubC2* stub) :
345       _masm(masm),
346       _gp_regs(),
347       _fp_regs(),
348       _p_regs() {
349 
350     // Figure out what registers to save/restore
351     initialize(stub);
352 
353     // Save registers
354     __ push(_gp_regs, sp);
355     __ push_fp(_fp_regs, sp);
356     __ push_p(_p_regs, sp);
357   }
358 
359   ~ZSaveLiveRegisters() {
360     // Restore registers
361     __ pop_p(_p_regs, sp);
362     __ pop_fp(_fp_regs, sp);
363 
364     // External runtime call may clobber ptrue reg
365     __ reinitialize_ptrue();
366 
367     __ pop(_gp_regs, sp);
368   }
369 };
370 
371 #undef __
372 #define __ _masm->
373 
374 class ZSetupArguments {
375 private:
376   MacroAssembler* const _masm;
377   const Register        _ref;
378   const Address         _ref_addr;
379 
380 public:
381   ZSetupArguments(MacroAssembler* masm, ZLoadBarrierStubC2* stub) :
< prev index next >