< prev index next >

src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"

  26 #include "c1/c1_MacroAssembler.hpp"
  27 #include "c1/c1_Runtime1.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "gc/shared/barrierSet.hpp"
  30 #include "gc/shared/barrierSetAssembler.hpp"
  31 #include "gc/shared/collectedHeap.hpp"
  32 #include "interpreter/interpreter.hpp"
  33 #include "oops/arrayOop.hpp"
  34 #include "oops/markOop.hpp"
  35 #include "runtime/basicLock.hpp"
  36 #include "runtime/biasedLocking.hpp"
  37 #include "runtime/os.hpp"
  38 #include "runtime/sharedRuntime.hpp"
  39 #include "runtime/stubRoutines.hpp"
  40 
  41 int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register scratch, Label& slow_case) {
  42   const int aligned_mask = BytesPerWord -1;
  43   const int hdr_offset = oopDesc::mark_offset_in_bytes();
  44   assert(hdr == rax, "hdr must be rax, for the cmpxchg instruction");
  45   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");


 351     //
 352     // C1Breakpoint and VerifyFPU have one byte first instruction.
 353     // Also first instruction will be one byte "push(rbp)" if stack banging
 354     // code is not generated (see build_frame() above).
 355     // For all these cases generate long instruction first.
 356     fat_nop();
 357   }
 358   if (C1Breakpoint)int3();
 359   // build frame
 360   verify_FPU(0, "method_entry");
 361 }
 362 
 363 void C1_MacroAssembler::load_parameter(int offset_in_words, Register reg) {
 364   // rbp, + 0: link
 365   //     + 1: return address
 366   //     + 2: argument with offset 0
 367   //     + 3: argument with offset 1
 368   //     + 4: ...
 369 
 370   movptr(reg, Address(rbp, (offset_in_words + 2) * BytesPerWord));




 371 }
 372 
 373 #ifndef PRODUCT
 374 
 375 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
 376   if (!VerifyOops) return;
 377   verify_oop_addr(Address(rsp, stack_offset));
 378 }
 379 
 380 void C1_MacroAssembler::verify_not_null_oop(Register r) {
 381   if (!VerifyOops) return;
 382   Label not_null;
 383   testptr(r, r);
 384   jcc(Assembler::notZero, not_null);
 385   stop("non-null oop required");
 386   bind(not_null);
 387   verify_oop(r);
 388 }
 389 
 390 void C1_MacroAssembler::invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) {


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_IR.hpp"
  27 #include "c1/c1_MacroAssembler.hpp"
  28 #include "c1/c1_Runtime1.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "gc/shared/barrierSet.hpp"
  31 #include "gc/shared/barrierSetAssembler.hpp"
  32 #include "gc/shared/collectedHeap.hpp"
  33 #include "interpreter/interpreter.hpp"
  34 #include "oops/arrayOop.hpp"
  35 #include "oops/markOop.hpp"
  36 #include "runtime/basicLock.hpp"
  37 #include "runtime/biasedLocking.hpp"
  38 #include "runtime/os.hpp"
  39 #include "runtime/sharedRuntime.hpp"
  40 #include "runtime/stubRoutines.hpp"
  41 
  42 int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register scratch, Label& slow_case) {
  43   const int aligned_mask = BytesPerWord -1;
  44   const int hdr_offset = oopDesc::mark_offset_in_bytes();
  45   assert(hdr == rax, "hdr must be rax, for the cmpxchg instruction");
  46   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");


 352     //
 353     // C1Breakpoint and VerifyFPU have one byte first instruction.
 354     // Also first instruction will be one byte "push(rbp)" if stack banging
 355     // code is not generated (see build_frame() above).
 356     // For all these cases generate long instruction first.
 357     fat_nop();
 358   }
 359   if (C1Breakpoint)int3();
 360   // build frame
 361   verify_FPU(0, "method_entry");
 362 }
 363 
 364 void C1_MacroAssembler::load_parameter(int offset_in_words, Register reg) {
 365   // rbp, + 0: link
 366   //     + 1: return address
 367   //     + 2: argument with offset 0
 368   //     + 3: argument with offset 1
 369   //     + 4: ...
 370 
 371   movptr(reg, Address(rbp, (offset_in_words + 2) * BytesPerWord));
 372 }
 373 
 374 void C1_MacroAssembler::oopmap_metadata(CodeEmitInfo* info) {
 375   MacroAssembler::oopmap_metadata(info != NULL ? info->oop_map()->index() : -1);
 376 }
 377 
 378 #ifndef PRODUCT
 379 
 380 void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
 381   if (!VerifyOops) return;
 382   verify_oop_addr(Address(rsp, stack_offset));
 383 }
 384 
 385 void C1_MacroAssembler::verify_not_null_oop(Register r) {
 386   if (!VerifyOops) return;
 387   Label not_null;
 388   testptr(r, r);
 389   jcc(Assembler::notZero, not_null);
 390   stop("non-null oop required");
 391   bind(not_null);
 392   verify_oop(r);
 393 }
 394 
 395 void C1_MacroAssembler::invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) {
< prev index next >