< prev index next >

src/hotspot/cpu/x86/x86_64.ad

Print this page

  981       emit_d8(cbuf, framesize);
  982     } else {
  983       emit_opcode(cbuf, 0x81); // addq rsp, #framesize
  984       emit_rm(cbuf, 0x3, 0x00, RSP_enc);
  985       emit_d32(cbuf, framesize);
  986     }
  987   }
  988 
  989   // popq rbp
  990   emit_opcode(cbuf, 0x58 | RBP_enc);
  991 
  992   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
  993     __ reserved_stack_check();
  994   }
  995 
  996   if (do_polling() && C->is_method_compilation()) {
  997     MacroAssembler _masm(&cbuf);
  998     Label dummy_label;
  999     Label* code_stub = &dummy_label;
 1000     if (!C->output()->in_scratch_emit_size()) {
 1001       code_stub = &C->output()->safepoint_poll_table()->add_safepoint(__ offset());


 1002     }
 1003     __ relocate(relocInfo::poll_return_type);
 1004     __ safepoint_poll(*code_stub, r15_thread, true /* at_return */, true /* in_nmethod */);
 1005   }
 1006 }
 1007 
 1008 uint MachEpilogNode::size(PhaseRegAlloc* ra_) const
 1009 {
 1010   return MachNode::size(ra_); // too many variables; just compute it
 1011                               // the hard way
 1012 }
 1013 
 1014 int MachEpilogNode::reloc() const
 1015 {
 1016   return 2; // a large enough number
 1017 }
 1018 
 1019 const Pipeline* MachEpilogNode::pipeline() const
 1020 {
 1021   return MachNode::pipeline_class();

 5173    ins_pipe(ialu_reg_mem); // XXX
 5174 %}
 5175 
 5176 
 5177 // Load Klass Pointer
 5178 instruct loadKlass(rRegP dst, memory mem)
 5179 %{
 5180   match(Set dst (LoadKlass mem));
 5181 
 5182   ins_cost(125); // XXX
 5183   format %{ "movq    $dst, $mem\t# class" %}
 5184   ins_encode %{
 5185     __ movq($dst$$Register, $mem$$Address);
 5186   %}
 5187   ins_pipe(ialu_reg_mem); // XXX
 5188 %}
 5189 
 5190 // Load narrow Klass Pointer
 5191 instruct loadNKlass(rRegN dst, memory mem)
 5192 %{

 5193   match(Set dst (LoadNKlass mem));
 5194 
 5195   ins_cost(125); // XXX
 5196   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5197   ins_encode %{
 5198     __ movl($dst$$Register, $mem$$Address);
 5199   %}
 5200   ins_pipe(ialu_reg_mem); // XXX
 5201 %}
 5202 















 5203 // Load Float
 5204 instruct loadF(regF dst, memory mem)
 5205 %{
 5206   match(Set dst (LoadF mem));
 5207 
 5208   ins_cost(145); // XXX
 5209   format %{ "movss   $dst, $mem\t# float" %}
 5210   ins_encode %{
 5211     __ movflt($dst$$XMMRegister, $mem$$Address);
 5212   %}
 5213   ins_pipe(pipe_slow); // XXX
 5214 %}
 5215 
 5216 // Load Float
 5217 instruct MoveF2VL(vlRegF dst, regF src) %{
 5218   match(Set dst src);
 5219   format %{ "movss $dst,$src\t! load float (4 bytes)" %}
 5220   ins_encode %{
 5221     __ movflt($dst$$XMMRegister, $src$$XMMRegister);
 5222   %}

12208 
12209   format %{ "cmpl    $mem, $src\t# compressed ptr" %}
12210   ins_encode %{
12211     __ cmp_narrow_oop($mem$$Address, (jobject)$src$$constant);
12212   %}
12213   ins_pipe(ialu_cr_reg_mem);
12214 %}
12215 
12216 instruct compN_rReg_imm_klass(rFlagsRegU cr, rRegN op1, immNKlass op2) %{
12217   match(Set cr (CmpN op1 op2));
12218 
12219   format %{ "cmpl    $op1, $op2\t# compressed klass ptr" %}
12220   ins_encode %{
12221     __ cmp_narrow_klass($op1$$Register, (Klass*)$op2$$constant);
12222   %}
12223   ins_pipe(ialu_cr_reg_imm);
12224 %}
12225 
12226 instruct compN_mem_imm_klass(rFlagsRegU cr, memory mem, immNKlass src)
12227 %{

12228   match(Set cr (CmpN src (LoadNKlass mem)));
12229 
12230   format %{ "cmpl    $mem, $src\t# compressed klass ptr" %}
12231   ins_encode %{
12232     __ cmp_narrow_klass($mem$$Address, (Klass*)$src$$constant);
12233   %}
12234   ins_pipe(ialu_cr_reg_mem);
12235 %}
12236 
12237 instruct testN_reg(rFlagsReg cr, rRegN src, immN0 zero) %{
12238   match(Set cr (CmpN src zero));
12239 
12240   format %{ "testl   $src, $src\t# compressed ptr" %}
12241   ins_encode %{ __ testl($src$$Register, $src$$Register); %}
12242   ins_pipe(ialu_cr_reg_imm);
12243 %}
12244 
12245 instruct testN_mem(rFlagsReg cr, memory mem, immN0 zero)
12246 %{
12247   predicate(CompressedOops::base() != NULL);

12906       __ bind(done);
12907     } else {
12908        ShouldNotReachHere();
12909     }
12910   %}
12911   ins_pipe(pipe_jcc);
12912   ins_short_branch(1);
12913 %}
12914 
12915 // ============================================================================
12916 // inlined locking and unlocking
12917 
12918 instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
12919   predicate(Compile::current()->use_rtm());
12920   match(Set cr (FastLock object box));
12921   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
12922   ins_cost(300);
12923   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
12924   ins_encode %{
12925     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12926                  $scr$$Register, $cx1$$Register, $cx2$$Register,
12927                  _counters, _rtm_counters, _stack_rtm_counters,
12928                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
12929                  true, ra_->C->profile_rtm());
12930   %}
12931   ins_pipe(pipe_slow);
12932 %}
12933 
12934 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr, rRegP cx1) %{
12935   predicate(!Compile::current()->use_rtm());
12936   match(Set cr (FastLock object box));
12937   effect(TEMP tmp, TEMP scr, TEMP cx1, USE_KILL box);
12938   ins_cost(300);
12939   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
12940   ins_encode %{
12941     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12942                  $scr$$Register, $cx1$$Register, noreg, _counters, NULL, NULL, NULL, false, false);
12943   %}
12944   ins_pipe(pipe_slow);
12945 %}
12946 
12947 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{

12948   match(Set cr (FastUnlock object box));
12949   effect(TEMP tmp, USE_KILL box);
12950   ins_cost(300);
12951   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
12952   ins_encode %{
12953     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
12954   %}
12955   ins_pipe(pipe_slow);
12956 %}
12957 
























12958 
12959 // ============================================================================
12960 // Safepoint Instructions
12961 instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
12962 %{
12963   match(SafePoint poll);
12964   effect(KILL cr, USE poll);
12965 
12966   format %{ "testl   rax, [$poll]\t"
12967             "# Safepoint: poll for GC" %}
12968   ins_cost(125);
12969   size(4); /* setting an explicit size will cause debug builds to assert if size is incorrect */
12970   ins_encode %{
12971     __ relocate(relocInfo::poll_type);
12972     address pre_pc = __ pc();
12973     __ testl(rax, Address($poll$$Register, 0));
12974     assert(nativeInstruction_at(pre_pc)->is_safepoint_poll(), "must emit test %%eax [reg]");
12975   %}
12976   ins_pipe(ialu_reg_mem);
12977 %}

  981       emit_d8(cbuf, framesize);
  982     } else {
  983       emit_opcode(cbuf, 0x81); // addq rsp, #framesize
  984       emit_rm(cbuf, 0x3, 0x00, RSP_enc);
  985       emit_d32(cbuf, framesize);
  986     }
  987   }
  988 
  989   // popq rbp
  990   emit_opcode(cbuf, 0x58 | RBP_enc);
  991 
  992   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
  993     __ reserved_stack_check();
  994   }
  995 
  996   if (do_polling() && C->is_method_compilation()) {
  997     MacroAssembler _masm(&cbuf);
  998     Label dummy_label;
  999     Label* code_stub = &dummy_label;
 1000     if (!C->output()->in_scratch_emit_size()) {
 1001       C2SafepointPollStub* stub = new (C->comp_arena()) C2SafepointPollStub(__ offset());
 1002       C->output()->add_stub(stub);
 1003       code_stub = &stub->entry();
 1004     }
 1005     __ relocate(relocInfo::poll_return_type);
 1006     __ safepoint_poll(*code_stub, r15_thread, true /* at_return */, true /* in_nmethod */);
 1007   }
 1008 }
 1009 
 1010 uint MachEpilogNode::size(PhaseRegAlloc* ra_) const
 1011 {
 1012   return MachNode::size(ra_); // too many variables; just compute it
 1013                               // the hard way
 1014 }
 1015 
 1016 int MachEpilogNode::reloc() const
 1017 {
 1018   return 2; // a large enough number
 1019 }
 1020 
 1021 const Pipeline* MachEpilogNode::pipeline() const
 1022 {
 1023   return MachNode::pipeline_class();

 5175    ins_pipe(ialu_reg_mem); // XXX
 5176 %}
 5177 
 5178 
 5179 // Load Klass Pointer
 5180 instruct loadKlass(rRegP dst, memory mem)
 5181 %{
 5182   match(Set dst (LoadKlass mem));
 5183 
 5184   ins_cost(125); // XXX
 5185   format %{ "movq    $dst, $mem\t# class" %}
 5186   ins_encode %{
 5187     __ movq($dst$$Register, $mem$$Address);
 5188   %}
 5189   ins_pipe(ialu_reg_mem); // XXX
 5190 %}
 5191 
 5192 // Load narrow Klass Pointer
 5193 instruct loadNKlass(rRegN dst, memory mem)
 5194 %{
 5195   predicate(!UseCompactObjectHeaders);
 5196   match(Set dst (LoadNKlass mem));
 5197 
 5198   ins_cost(125); // XXX
 5199   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5200   ins_encode %{
 5201     __ movl($dst$$Register, $mem$$Address);
 5202   %}
 5203   ins_pipe(ialu_reg_mem); // XXX
 5204 %}
 5205 
 5206 instruct loadNKlassCompactHeaders(rRegN dst, memory mem, rFlagsReg cr)
 5207 %{
 5208   predicate(UseCompactObjectHeaders);
 5209   match(Set dst (LoadNKlass mem));
 5210   effect(KILL cr);
 5211   ins_cost(125); // XXX
 5212   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5213   ins_encode %{
 5214     Register index = $mem$$index != 4 ? $mem$$index$$Register : noreg;
 5215     Address::ScaleFactor sf = (index != noreg) ? static_cast<Address::ScaleFactor>($mem$$scale) : Address::no_scale;
 5216     __ load_nklass_compact_c2($dst$$Register, $mem$$base$$Register, index, sf, $mem$$disp);
 5217   %}
 5218   ins_pipe(pipe_slow); // XXX
 5219 %}
 5220 
 5221 // Load Float
 5222 instruct loadF(regF dst, memory mem)
 5223 %{
 5224   match(Set dst (LoadF mem));
 5225 
 5226   ins_cost(145); // XXX
 5227   format %{ "movss   $dst, $mem\t# float" %}
 5228   ins_encode %{
 5229     __ movflt($dst$$XMMRegister, $mem$$Address);
 5230   %}
 5231   ins_pipe(pipe_slow); // XXX
 5232 %}
 5233 
 5234 // Load Float
 5235 instruct MoveF2VL(vlRegF dst, regF src) %{
 5236   match(Set dst src);
 5237   format %{ "movss $dst,$src\t! load float (4 bytes)" %}
 5238   ins_encode %{
 5239     __ movflt($dst$$XMMRegister, $src$$XMMRegister);
 5240   %}

12226 
12227   format %{ "cmpl    $mem, $src\t# compressed ptr" %}
12228   ins_encode %{
12229     __ cmp_narrow_oop($mem$$Address, (jobject)$src$$constant);
12230   %}
12231   ins_pipe(ialu_cr_reg_mem);
12232 %}
12233 
12234 instruct compN_rReg_imm_klass(rFlagsRegU cr, rRegN op1, immNKlass op2) %{
12235   match(Set cr (CmpN op1 op2));
12236 
12237   format %{ "cmpl    $op1, $op2\t# compressed klass ptr" %}
12238   ins_encode %{
12239     __ cmp_narrow_klass($op1$$Register, (Klass*)$op2$$constant);
12240   %}
12241   ins_pipe(ialu_cr_reg_imm);
12242 %}
12243 
12244 instruct compN_mem_imm_klass(rFlagsRegU cr, memory mem, immNKlass src)
12245 %{
12246   predicate(!UseCompactObjectHeaders);
12247   match(Set cr (CmpN src (LoadNKlass mem)));
12248 
12249   format %{ "cmpl    $mem, $src\t# compressed klass ptr" %}
12250   ins_encode %{
12251     __ cmp_narrow_klass($mem$$Address, (Klass*)$src$$constant);
12252   %}
12253   ins_pipe(ialu_cr_reg_mem);
12254 %}
12255 
12256 instruct testN_reg(rFlagsReg cr, rRegN src, immN0 zero) %{
12257   match(Set cr (CmpN src zero));
12258 
12259   format %{ "testl   $src, $src\t# compressed ptr" %}
12260   ins_encode %{ __ testl($src$$Register, $src$$Register); %}
12261   ins_pipe(ialu_cr_reg_imm);
12262 %}
12263 
12264 instruct testN_mem(rFlagsReg cr, memory mem, immN0 zero)
12265 %{
12266   predicate(CompressedOops::base() != NULL);

12925       __ bind(done);
12926     } else {
12927        ShouldNotReachHere();
12928     }
12929   %}
12930   ins_pipe(pipe_jcc);
12931   ins_short_branch(1);
12932 %}
12933 
12934 // ============================================================================
12935 // inlined locking and unlocking
12936 
12937 instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
12938   predicate(Compile::current()->use_rtm());
12939   match(Set cr (FastLock object box));
12940   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
12941   ins_cost(300);
12942   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
12943   ins_encode %{
12944     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12945                  $scr$$Register, $cx1$$Register, $cx2$$Register, r15_thread,
12946                  _counters, _rtm_counters, _stack_rtm_counters,
12947                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
12948                  true, ra_->C->profile_rtm());
12949   %}
12950   ins_pipe(pipe_slow);
12951 %}
12952 
12953 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr, rRegP cx1) %{
12954   predicate(LockingMode != LM_LIGHTWEIGHT && !Compile::current()->use_rtm());
12955   match(Set cr (FastLock object box));
12956   effect(TEMP tmp, TEMP scr, TEMP cx1, USE_KILL box);
12957   ins_cost(300);
12958   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
12959   ins_encode %{
12960     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12961                  $scr$$Register, $cx1$$Register, noreg, r15_thread, _counters, NULL, NULL, NULL, false, false);
12962   %}
12963   ins_pipe(pipe_slow);
12964 %}
12965 
12966 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{
12967   predicate(LockingMode != LM_LIGHTWEIGHT);
12968   match(Set cr (FastUnlock object box));
12969   effect(TEMP tmp, USE_KILL box);
12970   ins_cost(300);
12971   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
12972   ins_encode %{
12973     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
12974   %}
12975   ins_pipe(pipe_slow);
12976 %}
12977 
12978 instruct cmpFastLockLightweight(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI rax_reg, rRegP tmp) %{
12979   predicate(LockingMode == LM_LIGHTWEIGHT);
12980   match(Set cr (FastLock object box));
12981   effect(TEMP rax_reg, TEMP tmp, USE_KILL box);
12982   ins_cost(300);
12983   format %{ "fastlock $object,$box\t! kills $box,$rax_reg,$tmp" %}
12984   ins_encode %{
12985     __ fast_lock_lightweight($object$$Register, $box$$Register, $rax_reg$$Register, $tmp$$Register, r15_thread);
12986   %}
12987   ins_pipe(pipe_slow);
12988 %}
12989 
12990 instruct cmpFastUnlockLightweight(rFlagsReg cr, rRegP object, rax_RegP rax_reg, rRegP tmp) %{
12991   predicate(LockingMode == LM_LIGHTWEIGHT);
12992   match(Set cr (FastUnlock object rax_reg));
12993   effect(TEMP tmp, USE_KILL rax_reg);
12994   ins_cost(300);
12995   format %{ "fastunlock $object,$rax_reg\t! kills $rax_reg,$tmp" %}
12996   ins_encode %{
12997     __ fast_unlock_lightweight($object$$Register, $rax_reg$$Register, $tmp$$Register, r15_thread);
12998   %}
12999   ins_pipe(pipe_slow);
13000 %}
13001 
13002 
13003 // ============================================================================
13004 // Safepoint Instructions
13005 instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
13006 %{
13007   match(SafePoint poll);
13008   effect(KILL cr, USE poll);
13009 
13010   format %{ "testl   rax, [$poll]\t"
13011             "# Safepoint: poll for GC" %}
13012   ins_cost(125);
13013   size(4); /* setting an explicit size will cause debug builds to assert if size is incorrect */
13014   ins_encode %{
13015     __ relocate(relocInfo::poll_type);
13016     address pre_pc = __ pc();
13017     __ testl(rax, Address($poll$$Register, 0));
13018     assert(nativeInstruction_at(pre_pc)->is_safepoint_poll(), "must emit test %%eax [reg]");
13019   %}
13020   ins_pipe(ialu_reg_mem);
13021 %}
< prev index next >