< prev index next >

src/hotspot/cpu/x86/x86_64.ad

Print this page

  883   MacroAssembler _masm(&cbuf);
  884 
  885   int framesize = C->output()->frame_size_in_bytes();
  886   int bangsize = C->output()->bang_size_in_bytes();
  887 
  888   if (C->clinit_barrier_on_entry()) {
  889     assert(VM_Version::supports_fast_class_init_checks(), "sanity");
  890     assert(!C->method()->holder()->is_not_initialized(), "initialization should have been started");
  891 
  892     Label L_skip_barrier;
  893     Register klass = rscratch1;
  894 
  895     __ mov_metadata(klass, C->method()->holder()->constant_encoding());
  896     __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
  897 
  898     __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
  899 
  900     __ bind(L_skip_barrier);
  901   }
  902 
  903   __ verified_entry(framesize, C->output()->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL);

  904 
  905   C->output()->set_frame_complete(cbuf.insts_size());
  906 
  907   if (C->has_mach_constant_base_node()) {
  908     // NOTE: We set the table base offset here because users might be
  909     // emitted before MachConstantBaseNode.
  910     ConstantTable& constant_table = C->output()->constant_table();
  911     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
  912   }
  913 }
  914 
  915 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
  916 {
  917   return MachNode::size(ra_); // too many variables; just compute it
  918                               // the hard way
  919 }
  920 
  921 int MachPrologNode::reloc() const
  922 {
  923   return 0; // a large enough number

  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   %}

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

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

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

  883   MacroAssembler _masm(&cbuf);
  884 
  885   int framesize = C->output()->frame_size_in_bytes();
  886   int bangsize = C->output()->bang_size_in_bytes();
  887 
  888   if (C->clinit_barrier_on_entry()) {
  889     assert(VM_Version::supports_fast_class_init_checks(), "sanity");
  890     assert(!C->method()->holder()->is_not_initialized(), "initialization should have been started");
  891 
  892     Label L_skip_barrier;
  893     Register klass = rscratch1;
  894 
  895     __ mov_metadata(klass, C->method()->holder()->constant_encoding());
  896     __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
  897 
  898     __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
  899 
  900     __ bind(L_skip_barrier);
  901   }
  902 
  903   int max_monitors = C->method() != NULL ? C->max_monitors() : 0;
  904   __ verified_entry(framesize, C->output()->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL, max_monitors);
  905 
  906   C->output()->set_frame_complete(cbuf.insts_size());
  907 
  908   if (C->has_mach_constant_base_node()) {
  909     // NOTE: We set the table base offset here because users might be
  910     // emitted before MachConstantBaseNode.
  911     ConstantTable& constant_table = C->output()->constant_table();
  912     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
  913   }
  914 }
  915 
  916 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
  917 {
  918   return MachNode::size(ra_); // too many variables; just compute it
  919                               // the hard way
  920 }
  921 
  922 int MachPrologNode::reloc() const
  923 {
  924   return 0; // a large enough number

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

 5176    ins_pipe(ialu_reg_mem); // XXX
 5177 %}
 5178 
 5179 
 5180 // Load Klass Pointer
 5181 instruct loadKlass(rRegP dst, memory mem)
 5182 %{
 5183   match(Set dst (LoadKlass mem));
 5184 
 5185   ins_cost(125); // XXX
 5186   format %{ "movq    $dst, $mem\t# class" %}
 5187   ins_encode %{
 5188     __ movq($dst$$Register, $mem$$Address);
 5189   %}
 5190   ins_pipe(ialu_reg_mem); // XXX
 5191 %}
 5192 
 5193 // Load narrow Klass Pointer
 5194 instruct loadNKlass(rRegN dst, memory mem)
 5195 %{
 5196   predicate(!UseCompactObjectHeaders);
 5197   match(Set dst (LoadNKlass mem));
 5198 
 5199   ins_cost(125); // XXX
 5200   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5201   ins_encode %{
 5202     __ movl($dst$$Register, $mem$$Address);
 5203   %}
 5204   ins_pipe(ialu_reg_mem); // XXX
 5205 %}
 5206 
 5207 instruct loadNKlassLilliput(rRegN dst, indOffset8 mem, rFlagsReg cr)
 5208 %{
 5209   predicate(UseCompactObjectHeaders);
 5210   match(Set dst (LoadNKlass mem));
 5211   effect(TEMP_DEF dst, KILL cr);
 5212   ins_cost(125); // XXX
 5213   format %{ "movl    $dst, $mem\t# compressed klass ptr" %}
 5214   ins_encode %{
 5215     assert($mem$$disp == oopDesc::klass_offset_in_bytes(), "expect correct offset 4, but got: %d", $mem$$disp);
 5216     assert($mem$$index == 4, "expect no index register: %d", $mem$$index);
 5217     Register dst = $dst$$Register;
 5218     Register obj = $mem$$base$$Register;
 5219     C2LoadNKlassStub* stub = new (Compile::current()->comp_arena()) C2LoadNKlassStub(dst);
 5220     Compile::current()->output()->add_stub(stub);
 5221     __ movq(dst, Address(obj, oopDesc::mark_offset_in_bytes()));
 5222     __ testb(dst, markWord::monitor_value);
 5223     __ jcc(Assembler::notZero, stub->entry());
 5224     __ bind(stub->continuation());
 5225     __ shrq(dst, markWord::klass_shift);
 5226   %}
 5227   ins_pipe(pipe_slow); // XXX
 5228 %}
 5229 
 5230 // Load Float
 5231 instruct loadF(regF dst, memory mem)
 5232 %{
 5233   match(Set dst (LoadF mem));
 5234 
 5235   ins_cost(145); // XXX
 5236   format %{ "movss   $dst, $mem\t# float" %}
 5237   ins_encode %{
 5238     __ movflt($dst$$XMMRegister, $mem$$Address);
 5239   %}
 5240   ins_pipe(pipe_slow); // XXX
 5241 %}
 5242 
 5243 // Load Float
 5244 instruct MoveF2VL(vlRegF dst, regF src) %{
 5245   match(Set dst src);
 5246   format %{ "movss $dst,$src\t! load float (4 bytes)" %}
 5247   ins_encode %{
 5248     __ movflt($dst$$XMMRegister, $src$$XMMRegister);
 5249   %}

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

12933       __ bind(done);
12934     } else {
12935        ShouldNotReachHere();
12936     }
12937   %}
12938   ins_pipe(pipe_jcc);
12939   ins_short_branch(1);
12940 %}
12941 
12942 // ============================================================================
12943 // inlined locking and unlocking
12944 
12945 instruct cmpFastLockRTM(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rdx_RegI scr, rRegI cx1, rRegI cx2) %{
12946   predicate(Compile::current()->use_rtm());
12947   match(Set cr (FastLock object box));
12948   effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
12949   ins_cost(300);
12950   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
12951   ins_encode %{
12952     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12953                  $scr$$Register, $cx1$$Register, $cx2$$Register, r15_thread,
12954                  _counters, _rtm_counters, _stack_rtm_counters,
12955                  ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
12956                  true, ra_->C->profile_rtm());
12957   %}
12958   ins_pipe(pipe_slow);
12959 %}
12960 
12961 instruct cmpFastLock(rFlagsReg cr, rRegP object, rbx_RegP box, rax_RegI tmp, rRegP scr, rRegP cx1) %{
12962   predicate(!Compile::current()->use_rtm());
12963   match(Set cr (FastLock object box));
12964   effect(TEMP tmp, TEMP scr, TEMP cx1, USE_KILL box);
12965   ins_cost(300);
12966   format %{ "fastlock $object,$box\t! kills $box,$tmp,$scr" %}
12967   ins_encode %{
12968     __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
12969                  $scr$$Register, $cx1$$Register, noreg, r15_thread, NULL, NULL, NULL, NULL, false, false);
12970   %}
12971   ins_pipe(pipe_slow);
12972 %}
12973 
12974 instruct cmpFastUnlock(rFlagsReg cr, rRegP object, rax_RegP box, rRegP tmp) %{
12975   match(Set cr (FastUnlock object box));
12976   effect(TEMP tmp, USE_KILL box);
12977   ins_cost(300);
12978   format %{ "fastunlock $object,$box\t! kills $box,$tmp" %}
12979   ins_encode %{
12980     __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
12981   %}
12982   ins_pipe(pipe_slow);
12983 %}
12984 
12985 
12986 // ============================================================================
12987 // Safepoint Instructions
12988 instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
12989 %{
< prev index next >