3006 void LIR_Assembler::store_parameter(Metadata* m, int offset_from_rsp_in_words) {
3007 assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
3008 int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
3009 assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
3010 __ mov_metadata(Address(rsp, offset_from_rsp_in_bytes), m);
3011 }
3012
3013
3014 // This code replaces a call to arraycopy; no exception may
3015 // be thrown in this code, they must be thrown in the System.arraycopy
3016 // activation frame; we could save some checks if this would not be the case
3017 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
3018 ciArrayKlass* default_type = op->expected_type();
3019 Register src = op->src()->as_register();
3020 Register dst = op->dst()->as_register();
3021 Register src_pos = op->src_pos()->as_register();
3022 Register dst_pos = op->dst_pos()->as_register();
3023 Register length = op->length()->as_register();
3024 Register tmp = op->tmp()->as_register();
3025
3026 CodeStub* stub = op->stub();
3027 int flags = op->flags();
3028 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
3029 if (basic_type == T_ARRAY) basic_type = T_OBJECT;
3030
3031 // if we don't know anything, just go through the generic arraycopy
3032 if (default_type == NULL) {
3033 Label done;
3034 // save outgoing arguments on stack in case call to System.arraycopy is needed
3035 // HACK ALERT. This code used to push the parameters in a hardwired fashion
3036 // for interpreter calling conventions. Now we have to do it in new style conventions.
3037 // For the moment until C1 gets the new register allocator I just force all the
3038 // args to the right place (except the register args) and then on the back side
3039 // reload the register args properly if we go slow path. Yuck
3040
3041 // These are proper for the calling convention
3042 store_parameter(length, 2);
3043 store_parameter(dst_pos, 1);
3044 store_parameter(dst, 0);
3045
3444
3445 __ lea(res, ExternalAddress(StubRoutines::crc_table_addr()));
3446 __ notl(crc); // ~crc
3447 __ update_byte_crc32(crc, val, res);
3448 __ notl(crc); // ~crc
3449 __ mov(res, crc);
3450 }
3451
3452 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
3453 Register obj = op->obj_opr()->as_register(); // may not be an oop
3454 Register hdr = op->hdr_opr()->as_register();
3455 Register lock = op->lock_opr()->as_register();
3456 if (!UseFastLocking) {
3457 __ jmp(*op->stub()->entry());
3458 } else if (op->code() == lir_lock) {
3459 Register scratch = noreg;
3460 if (UseBiasedLocking) {
3461 scratch = op->scratch_opr()->as_register();
3462 }
3463 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3464 // add debug info for NullPointerException only if one is possible
3465 int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
3466 if (op->info() != NULL) {
3467 add_debug_info_for_null_check(null_check_offset, op->info());
3468 }
3469 // done
3470 } else if (op->code() == lir_unlock) {
3471 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3472 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
3473 } else {
3474 Unimplemented();
3475 }
3476 __ bind(*op->stub()->continuation());
3477 }
3478
3479
3480 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
3481 ciMethod* method = op->profiled_method();
3482 int bci = op->profiled_bci();
3483 ciMethod* callee = op->profiled_callee();
|
3006 void LIR_Assembler::store_parameter(Metadata* m, int offset_from_rsp_in_words) {
3007 assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
3008 int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
3009 assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
3010 __ mov_metadata(Address(rsp, offset_from_rsp_in_bytes), m);
3011 }
3012
3013
3014 // This code replaces a call to arraycopy; no exception may
3015 // be thrown in this code, they must be thrown in the System.arraycopy
3016 // activation frame; we could save some checks if this would not be the case
3017 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
3018 ciArrayKlass* default_type = op->expected_type();
3019 Register src = op->src()->as_register();
3020 Register dst = op->dst()->as_register();
3021 Register src_pos = op->src_pos()->as_register();
3022 Register dst_pos = op->dst_pos()->as_register();
3023 Register length = op->length()->as_register();
3024 Register tmp = op->tmp()->as_register();
3025
3026 __ resolve_for_read(IN_HEAP, src);
3027 __ resolve_for_write(IN_HEAP, dst);
3028
3029 CodeStub* stub = op->stub();
3030 int flags = op->flags();
3031 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
3032 if (basic_type == T_ARRAY) basic_type = T_OBJECT;
3033
3034 // if we don't know anything, just go through the generic arraycopy
3035 if (default_type == NULL) {
3036 Label done;
3037 // save outgoing arguments on stack in case call to System.arraycopy is needed
3038 // HACK ALERT. This code used to push the parameters in a hardwired fashion
3039 // for interpreter calling conventions. Now we have to do it in new style conventions.
3040 // For the moment until C1 gets the new register allocator I just force all the
3041 // args to the right place (except the register args) and then on the back side
3042 // reload the register args properly if we go slow path. Yuck
3043
3044 // These are proper for the calling convention
3045 store_parameter(length, 2);
3046 store_parameter(dst_pos, 1);
3047 store_parameter(dst, 0);
3048
3447
3448 __ lea(res, ExternalAddress(StubRoutines::crc_table_addr()));
3449 __ notl(crc); // ~crc
3450 __ update_byte_crc32(crc, val, res);
3451 __ notl(crc); // ~crc
3452 __ mov(res, crc);
3453 }
3454
3455 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
3456 Register obj = op->obj_opr()->as_register(); // may not be an oop
3457 Register hdr = op->hdr_opr()->as_register();
3458 Register lock = op->lock_opr()->as_register();
3459 if (!UseFastLocking) {
3460 __ jmp(*op->stub()->entry());
3461 } else if (op->code() == lir_lock) {
3462 Register scratch = noreg;
3463 if (UseBiasedLocking) {
3464 scratch = op->scratch_opr()->as_register();
3465 }
3466 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3467 __ resolve_for_write(IN_HEAP, obj);
3468 // add debug info for NullPointerException only if one is possible
3469 int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
3470 if (op->info() != NULL) {
3471 add_debug_info_for_null_check(null_check_offset, op->info());
3472 }
3473 // done
3474 } else if (op->code() == lir_unlock) {
3475 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
3476 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
3477 } else {
3478 Unimplemented();
3479 }
3480 __ bind(*op->stub()->continuation());
3481 }
3482
3483
3484 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
3485 ciMethod* method = op->profiled_method();
3486 int bci = op->profiled_bci();
3487 ciMethod* callee = op->profiled_callee();
|