< prev index next >

src/hotspot/cpu/x86/x86_64.ad

Print this page

  905   C2_MacroAssembler _masm(&cbuf);
  906 
  907   int framesize = C->output()->frame_size_in_bytes();
  908   int bangsize = C->output()->bang_size_in_bytes();
  909 
  910   if (C->clinit_barrier_on_entry()) {
  911     assert(VM_Version::supports_fast_class_init_checks(), "sanity");
  912     assert(!C->method()->holder()->is_not_initialized(), "initialization should have been started");
  913 
  914     Label L_skip_barrier;
  915     Register klass = rscratch1;
  916 
  917     __ mov_metadata(klass, C->method()->holder()->constant_encoding());
  918     __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
  919 
  920     __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
  921 
  922     __ bind(L_skip_barrier);
  923   }
  924 
  925   __ verified_entry(framesize, C->output()->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL);

  926 
  927   C->output()->set_frame_complete(cbuf.insts_size());
  928 
  929   if (C->has_mach_constant_base_node()) {
  930     // NOTE: We set the table base offset here because users might be
  931     // emitted before MachConstantBaseNode.
  932     ConstantTable& constant_table = C->output()->constant_table();
  933     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
  934   }
  935 }
  936 
  937 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
  938 {
  939   return MachNode::size(ra_); // too many variables; just compute it
  940                               // the hard way
  941 }
  942 
  943 int MachPrologNode::reloc() const
  944 {
  945   return 0; // a large enough number

 5297    ins_pipe(ialu_reg_mem); // XXX
 5298 %}
 5299 
 5300 
 5301 // Load Klass Pointer
 5302 instruct loadKlass(rRegP dst, memory mem)
 5303 %{
 5304   match(Set dst (LoadKlass mem));
 5305 
 5306   ins_cost(125); // XXX
 5307   format %{ "movq    $dst, $mem\t# class" %}
 5308   ins_encode %{
 5309     __ movq($dst$$Register, $mem$$Address);
 5310   %}
 5311   ins_pipe(ialu_reg_mem); // XXX
 5312 %}
 5313 
 5314 // Load narrow Klass Pointer
 5315 instruct loadNKlass(rRegN dst, memory mem)
 5316 %{

 5317   match(Set dst (LoadNKlass mem));
 5318 
 5319   ins_cost(125); // XXX
 5320   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5321   ins_encode %{
 5322     __ movl($dst$$Register, $mem$$Address);
 5323   %}
 5324   ins_pipe(ialu_reg_mem); // XXX
 5325 %}
 5326 























 5327 // Load Float
 5328 instruct loadF(regF dst, memory mem)
 5329 %{
 5330   match(Set dst (LoadF mem));
 5331 
 5332   ins_cost(145); // XXX
 5333   format %{ "movss   $dst, $mem\t# float" %}
 5334   ins_encode %{
 5335     __ movflt($dst$$XMMRegister, $mem$$Address);
 5336   %}
 5337   ins_pipe(pipe_slow); // XXX
 5338 %}
 5339 
 5340 // Load Double
 5341 instruct loadD_partial(regD dst, memory mem)
 5342 %{
 5343   predicate(!UseXmmLoadAndClearUpper);
 5344   match(Set dst (LoadD mem));
 5345 
 5346   ins_cost(145); // XXX

12658 
12659   format %{ "cmpl    $mem, $src\t# compressed ptr" %}
12660   ins_encode %{
12661     __ cmp_narrow_oop($mem$$Address, (jobject)$src$$constant);
12662   %}
12663   ins_pipe(ialu_cr_reg_mem);
12664 %}
12665 
12666 instruct compN_rReg_imm_klass(rFlagsRegU cr, rRegN op1, immNKlass op2) %{
12667   match(Set cr (CmpN op1 op2));
12668 
12669   format %{ "cmpl    $op1, $op2\t# compressed klass ptr" %}
12670   ins_encode %{
12671     __ cmp_narrow_klass($op1$$Register, (Klass*)$op2$$constant);
12672   %}
12673   ins_pipe(ialu_cr_reg_imm);
12674 %}
12675 
12676 instruct compN_mem_imm_klass(rFlagsRegU cr, memory mem, immNKlass src)
12677 %{

12678   match(Set cr (CmpN src (LoadNKlass mem)));
12679 
12680   format %{ "cmpl    $mem, $src\t# compressed klass ptr" %}
12681   ins_encode %{
12682     __ cmp_narrow_klass($mem$$Address, (Klass*)$src$$constant);
12683   %}
12684   ins_pipe(ialu_cr_reg_mem);
12685 %}
12686 
12687 instruct testN_reg(rFlagsReg cr, rRegN src, immN0 zero) %{
12688   match(Set cr (CmpN src zero));
12689 
12690   format %{ "testl   $src, $src\t# compressed ptr" %}
12691   ins_encode %{ __ testl($src$$Register, $src$$Register); %}
12692   ins_pipe(ialu_cr_reg_imm);
12693 %}
12694 
12695 instruct testN_mem(rFlagsReg cr, memory mem, immN0 zero)
12696 %{
12697   predicate(CompressedOops::base() != NULL);

13344       __ bind(done);
13345     } else {
13346        ShouldNotReachHere();
13347     }
13348   %}
13349   ins_pipe(pipe_jcc);
13350   ins_short_branch(1);
13351 %}
13352 
13353 // ============================================================================
13354 // inlined locking and unlocking
13355 
13356 instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
13357   predicate(Compile::current()->use_rtm());
13358   match(Set cr (FastLock object box));
13359   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
13360   ins_cost(300);
13361   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
13362   ins_encode %{
13363     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13364                  $scr$$Register, $cx1$$Register, $cx2$$Register,
13365                  _rtm_counters, _stack_rtm_counters,
13366                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
13367                  true, ra_->C->profile_rtm());
13368   %}
13369   ins_pipe(pipe_slow);
13370 %}
13371 
13372 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr) %{
13373   predicate(!Compile::current()->use_rtm());
13374   match(Set cr (FastLock object box));
13375   effect(TEMP tmp, TEMP scr, USE_KILL box);
13376   ins_cost(300);
13377   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
13378   ins_encode %{
13379     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13380                  $scr$$Register, noreg, noreg, NULL, NULL, NULL, false, false);
13381   %}
13382   ins_pipe(pipe_slow);
13383 %}
13384 
13385 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{
13386   match(Set cr (FastUnlock object box));
13387   effect(TEMP tmp, USE_KILL box);
13388   ins_cost(300);
13389   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
13390   ins_encode %{
13391     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
13392   %}
13393   ins_pipe(pipe_slow);
13394 %}
13395 
13396 
13397 // ============================================================================
13398 // Safepoint Instructions
13399 instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
13400 %{

  905   C2_MacroAssembler _masm(&cbuf);
  906 
  907   int framesize = C->output()->frame_size_in_bytes();
  908   int bangsize = C->output()->bang_size_in_bytes();
  909 
  910   if (C->clinit_barrier_on_entry()) {
  911     assert(VM_Version::supports_fast_class_init_checks(), "sanity");
  912     assert(!C->method()->holder()->is_not_initialized(), "initialization should have been started");
  913 
  914     Label L_skip_barrier;
  915     Register klass = rscratch1;
  916 
  917     __ mov_metadata(klass, C->method()->holder()->constant_encoding());
  918     __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
  919 
  920     __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
  921 
  922     __ bind(L_skip_barrier);
  923   }
  924 
  925   int max_monitors = C->method() != NULL ? C->max_monitors() : 0;
  926   __ verified_entry(framesize, C->output()->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL, max_monitors);
  927 
  928   C->output()->set_frame_complete(cbuf.insts_size());
  929 
  930   if (C->has_mach_constant_base_node()) {
  931     // NOTE: We set the table base offset here because users might be
  932     // emitted before MachConstantBaseNode.
  933     ConstantTable& constant_table = C->output()->constant_table();
  934     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
  935   }
  936 }
  937 
  938 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
  939 {
  940   return MachNode::size(ra_); // too many variables; just compute it
  941                               // the hard way
  942 }
  943 
  944 int MachPrologNode::reloc() const
  945 {
  946   return 0; // a large enough number

 5298    ins_pipe(ialu_reg_mem); // XXX
 5299 %}
 5300 
 5301 
 5302 // Load Klass Pointer
 5303 instruct loadKlass(rRegP dst, memory mem)
 5304 %{
 5305   match(Set dst (LoadKlass mem));
 5306 
 5307   ins_cost(125); // XXX
 5308   format %{ "movq    $dst, $mem\t# class" %}
 5309   ins_encode %{
 5310     __ movq($dst$$Register, $mem$$Address);
 5311   %}
 5312   ins_pipe(ialu_reg_mem); // XXX
 5313 %}
 5314 
 5315 // Load narrow Klass Pointer
 5316 instruct loadNKlass(rRegN dst, memory mem)
 5317 %{
 5318   predicate(!UseCompactObjectHeaders);
 5319   match(Set dst (LoadNKlass mem));
 5320 
 5321   ins_cost(125); // XXX
 5322   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5323   ins_encode %{
 5324     __ movl($dst$$Register, $mem$$Address);
 5325   %}
 5326   ins_pipe(ialu_reg_mem); // XXX
 5327 %}
 5328 
 5329 instruct loadNKlassLilliput(rRegN dst, indOffset8 mem, rFlagsReg cr)
 5330 %{
 5331   predicate(UseCompactObjectHeaders);
 5332   match(Set dst (LoadNKlass mem));
 5333   effect(TEMP_DEF dst, KILL cr);
 5334   ins_cost(125); // XXX
 5335   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5336   ins_encode %{
 5337     assert($mem$$disp == oopDesc::klass_offset_in_bytes(), "expect correct offset 4, but got: %d", $mem$$disp);
 5338     assert($mem$$index == 4, "expect no index register: %d", $mem$$index);
 5339     Register dst = $dst$$Register;
 5340     Register obj = $mem$$base$$Register;
 5341     C2LoadNKlassStub* stub = new (Compile::current()->comp_arena()) C2LoadNKlassStub(dst);
 5342     Compile::current()->output()->add_stub(stub);
 5343     __ movq(dst, Address(obj, oopDesc::mark_offset_in_bytes()));
 5344     __ testb(dst, markWord::monitor_value);
 5345     __ jcc(Assembler::notZero, stub->entry());
 5346     __ bind(stub->continuation());
 5347     __ shrq(dst, markWord::klass_shift);
 5348   %}
 5349   ins_pipe(pipe_slow); // XXX
 5350 %}
 5351 
 5352 // Load Float
 5353 instruct loadF(regF dst, memory mem)
 5354 %{
 5355   match(Set dst (LoadF mem));
 5356 
 5357   ins_cost(145); // XXX
 5358   format %{ "movss   $dst, $mem\t# float" %}
 5359   ins_encode %{
 5360     __ movflt($dst$$XMMRegister, $mem$$Address);
 5361   %}
 5362   ins_pipe(pipe_slow); // XXX
 5363 %}
 5364 
 5365 // Load Double
 5366 instruct loadD_partial(regD dst, memory mem)
 5367 %{
 5368   predicate(!UseXmmLoadAndClearUpper);
 5369   match(Set dst (LoadD mem));
 5370 
 5371   ins_cost(145); // XXX

12683 
12684   format %{ "cmpl    $mem, $src\t# compressed ptr" %}
12685   ins_encode %{
12686     __ cmp_narrow_oop($mem$$Address, (jobject)$src$$constant);
12687   %}
12688   ins_pipe(ialu_cr_reg_mem);
12689 %}
12690 
12691 instruct compN_rReg_imm_klass(rFlagsRegU cr, rRegN op1, immNKlass op2) %{
12692   match(Set cr (CmpN op1 op2));
12693 
12694   format %{ "cmpl    $op1, $op2\t# compressed klass ptr" %}
12695   ins_encode %{
12696     __ cmp_narrow_klass($op1$$Register, (Klass*)$op2$$constant);
12697   %}
12698   ins_pipe(ialu_cr_reg_imm);
12699 %}
12700 
12701 instruct compN_mem_imm_klass(rFlagsRegU cr, memory mem, immNKlass src)
12702 %{
12703   predicate(!UseCompactObjectHeaders);
12704   match(Set cr (CmpN src (LoadNKlass mem)));
12705 
12706   format %{ "cmpl    $mem, $src\t# compressed klass ptr" %}
12707   ins_encode %{
12708     __ cmp_narrow_klass($mem$$Address, (Klass*)$src$$constant);
12709   %}
12710   ins_pipe(ialu_cr_reg_mem);
12711 %}
12712 
12713 instruct testN_reg(rFlagsReg cr, rRegN src, immN0 zero) %{
12714   match(Set cr (CmpN src zero));
12715 
12716   format %{ "testl   $src, $src\t# compressed ptr" %}
12717   ins_encode %{ __ testl($src$$Register, $src$$Register); %}
12718   ins_pipe(ialu_cr_reg_imm);
12719 %}
12720 
12721 instruct testN_mem(rFlagsReg cr, memory mem, immN0 zero)
12722 %{
12723   predicate(CompressedOops::base() != NULL);

13370       __ bind(done);
13371     } else {
13372        ShouldNotReachHere();
13373     }
13374   %}
13375   ins_pipe(pipe_jcc);
13376   ins_short_branch(1);
13377 %}
13378 
13379 // ============================================================================
13380 // inlined locking and unlocking
13381 
13382 instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
13383   predicate(Compile::current()->use_rtm());
13384   match(Set cr (FastLock object box));
13385   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
13386   ins_cost(300);
13387   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
13388   ins_encode %{
13389     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13390                  $scr$$Register, $cx1$$Register, $cx2$$Register, r15_thread,
13391                  _rtm_counters, _stack_rtm_counters,
13392                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
13393                  true, ra_->C->profile_rtm());
13394   %}
13395   ins_pipe(pipe_slow);
13396 %}
13397 
13398 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr) %{
13399   predicate(!Compile::current()->use_rtm());
13400   match(Set cr (FastLock object box));
13401   effect(TEMP tmp, TEMP scr, USE_KILL box);
13402   ins_cost(300);
13403   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
13404   ins_encode %{
13405     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13406                  $scr$$Register, noreg, noreg, r15_thread, NULL, NULL, NULL, false, false);
13407   %}
13408   ins_pipe(pipe_slow);
13409 %}
13410 
13411 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{
13412   match(Set cr (FastUnlock object box));
13413   effect(TEMP tmp, USE_KILL box);
13414   ins_cost(300);
13415   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
13416   ins_encode %{
13417     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
13418   %}
13419   ins_pipe(pipe_slow);
13420 %}
13421 
13422 
13423 // ============================================================================
13424 // Safepoint Instructions
13425 instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
13426 %{
< prev index next >