< prev index next >

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Print this page




3029 void LIR_Assembler::store_parameter(Metadata* m,  int offset_from_rsp_in_words) {
3030   assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
3031   int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
3032   assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
3033   __ mov_metadata(Address(rsp, offset_from_rsp_in_bytes), m);
3034 }
3035 
3036 
3037 // This code replaces a call to arraycopy; no exception may
3038 // be thrown in this code, they must be thrown in the System.arraycopy
3039 // activation frame; we could save some checks if this would not be the case
3040 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
3041   ciArrayKlass* default_type = op->expected_type();
3042   Register src = op->src()->as_register();
3043   Register dst = op->dst()->as_register();
3044   Register src_pos = op->src_pos()->as_register();
3045   Register dst_pos = op->dst_pos()->as_register();
3046   Register length  = op->length()->as_register();
3047   Register tmp = op->tmp()->as_register();
3048 



3049   CodeStub* stub = op->stub();
3050   int flags = op->flags();
3051   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
3052   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
3053 
3054   // if we don't know anything, just go through the generic arraycopy
3055   if (default_type == NULL) {
3056     Label done;
3057     // save outgoing arguments on stack in case call to System.arraycopy is needed
3058     // HACK ALERT. This code used to push the parameters in a hardwired fashion
3059     // for interpreter calling conventions. Now we have to do it in new style conventions.
3060     // For the moment until C1 gets the new register allocator I just force all the
3061     // args to the right place (except the register args) and then on the back side
3062     // reload the register args properly if we go slow path. Yuck
3063 
3064     // These are proper for the calling convention
3065     store_parameter(length, 2);
3066     store_parameter(dst_pos, 1);
3067     store_parameter(dst, 0);
3068 


3467 
3468   __ lea(res, ExternalAddress(StubRoutines::crc_table_addr()));
3469   __ notl(crc); // ~crc
3470   __ update_byte_crc32(crc, val, res);
3471   __ notl(crc); // ~crc
3472   __ mov(res, crc);
3473 }
3474 
3475 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
3476   Register obj = op->obj_opr()->as_register();  // may not be an oop
3477   Register hdr = op->hdr_opr()->as_register();
3478   Register lock = op->lock_opr()->as_register();
3479   if (!UseFastLocking) {
3480     __ jmp(*op->stub()->entry());
3481   } else if (op->code() == lir_lock) {
3482     Register scratch = noreg;
3483     if (UseBiasedLocking) {
3484       scratch = op->scratch_opr()->as_register();
3485     }
3486     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");

3487     // add debug info for NullPointerException only if one is possible
3488     int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
3489     if (op->info() != NULL) {
3490       add_debug_info_for_null_check(null_check_offset, op->info());
3491     }
3492     // done
3493   } else if (op->code() == lir_unlock) {
3494     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3495     __ unlock_object(hdr, obj, lock, *op->stub()->entry());
3496   } else {
3497     Unimplemented();
3498   }
3499   __ bind(*op->stub()->continuation());
3500 }
3501 
3502 
3503 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
3504   ciMethod* method = op->profiled_method();
3505   int bci          = op->profiled_bci();
3506   ciMethod* callee = op->profiled_callee();




3029 void LIR_Assembler::store_parameter(Metadata* m,  int offset_from_rsp_in_words) {
3030   assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
3031   int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
3032   assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
3033   __ mov_metadata(Address(rsp, offset_from_rsp_in_bytes), m);
3034 }
3035 
3036 
3037 // This code replaces a call to arraycopy; no exception may
3038 // be thrown in this code, they must be thrown in the System.arraycopy
3039 // activation frame; we could save some checks if this would not be the case
3040 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
3041   ciArrayKlass* default_type = op->expected_type();
3042   Register src = op->src()->as_register();
3043   Register dst = op->dst()->as_register();
3044   Register src_pos = op->src_pos()->as_register();
3045   Register dst_pos = op->dst_pos()->as_register();
3046   Register length  = op->length()->as_register();
3047   Register tmp = op->tmp()->as_register();
3048 
3049   __ resolve_for_read(IN_HEAP, src);
3050   __ resolve_for_write(IN_HEAP, dst);
3051 
3052   CodeStub* stub = op->stub();
3053   int flags = op->flags();
3054   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
3055   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
3056 
3057   // if we don't know anything, just go through the generic arraycopy
3058   if (default_type == NULL) {
3059     Label done;
3060     // save outgoing arguments on stack in case call to System.arraycopy is needed
3061     // HACK ALERT. This code used to push the parameters in a hardwired fashion
3062     // for interpreter calling conventions. Now we have to do it in new style conventions.
3063     // For the moment until C1 gets the new register allocator I just force all the
3064     // args to the right place (except the register args) and then on the back side
3065     // reload the register args properly if we go slow path. Yuck
3066 
3067     // These are proper for the calling convention
3068     store_parameter(length, 2);
3069     store_parameter(dst_pos, 1);
3070     store_parameter(dst, 0);
3071 


3470 
3471   __ lea(res, ExternalAddress(StubRoutines::crc_table_addr()));
3472   __ notl(crc); // ~crc
3473   __ update_byte_crc32(crc, val, res);
3474   __ notl(crc); // ~crc
3475   __ mov(res, crc);
3476 }
3477 
3478 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
3479   Register obj = op->obj_opr()->as_register();  // may not be an oop
3480   Register hdr = op->hdr_opr()->as_register();
3481   Register lock = op->lock_opr()->as_register();
3482   if (!UseFastLocking) {
3483     __ jmp(*op->stub()->entry());
3484   } else if (op->code() == lir_lock) {
3485     Register scratch = noreg;
3486     if (UseBiasedLocking) {
3487       scratch = op->scratch_opr()->as_register();
3488     }
3489     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3490     __ resolve_for_write(IN_HEAP, obj);
3491     // add debug info for NullPointerException only if one is possible
3492     int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
3493     if (op->info() != NULL) {
3494       add_debug_info_for_null_check(null_check_offset, op->info());
3495     }
3496     // done
3497   } else if (op->code() == lir_unlock) {
3498     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3499     __ unlock_object(hdr, obj, lock, *op->stub()->entry());
3500   } else {
3501     Unimplemented();
3502   }
3503   __ bind(*op->stub()->continuation());
3504 }
3505 
3506 
3507 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
3508   ciMethod* method = op->profiled_method();
3509   int bci          = op->profiled_bci();
3510   ciMethod* callee = op->profiled_callee();


< prev index next >