2149 assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
2150 int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
2151 assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
2152 __ lea(rscratch1, __ constant_oop_address(o));
2153 __ str(rscratch1, Address(sp, offset_from_rsp_in_bytes));
2154 }
2155
2156
2157 // This code replaces a call to arraycopy; no exception may
2158 // be thrown in this code, they must be thrown in the System.arraycopy
2159 // activation frame; we could save some checks if this would not be the case
2160 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
2161 ciArrayKlass* default_type = op->expected_type();
2162 Register src = op->src()->as_register();
2163 Register dst = op->dst()->as_register();
2164 Register src_pos = op->src_pos()->as_register();
2165 Register dst_pos = op->dst_pos()->as_register();
2166 Register length = op->length()->as_register();
2167 Register tmp = op->tmp()->as_register();
2168
2169 CodeStub* stub = op->stub();
2170 int flags = op->flags();
2171 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
2172 if (basic_type == T_ARRAY) basic_type = T_OBJECT;
2173
2174 // if we don't know anything, just go through the generic arraycopy
2175 if (default_type == NULL // || basic_type == T_OBJECT
2176 ) {
2177 Label done;
2178 assert(src == r1 && src_pos == r2, "mismatch in calling convention");
2179
2180 // Save the arguments in case the generic arraycopy fails and we
2181 // have to fall back to the JNI stub
2182 __ stp(dst, dst_pos, Address(sp, 0*BytesPerWord));
2183 __ stp(length, src_pos, Address(sp, 2*BytesPerWord));
2184 __ str(src, Address(sp, 4*BytesPerWord));
2185
2186 address copyfunc_addr = StubRoutines::generic_arraycopy();
2187 assert(copyfunc_addr != NULL, "generic arraycopy stub required");
2188
2492 }
2493
2494 __ bind(*stub->continuation());
2495 }
2496
2497
2498
2499
2500 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
2501 Register obj = op->obj_opr()->as_register(); // may not be an oop
2502 Register hdr = op->hdr_opr()->as_register();
2503 Register lock = op->lock_opr()->as_register();
2504 if (!UseFastLocking) {
2505 __ b(*op->stub()->entry());
2506 } else if (op->code() == lir_lock) {
2507 Register scratch = noreg;
2508 if (UseBiasedLocking) {
2509 scratch = op->scratch_opr()->as_register();
2510 }
2511 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2512 // add debug info for NullPointerException only if one is possible
2513 int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
2514 if (op->info() != NULL) {
2515 add_debug_info_for_null_check(null_check_offset, op->info());
2516 }
2517 // done
2518 } else if (op->code() == lir_unlock) {
2519 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2520 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
2521 } else {
2522 Unimplemented();
2523 }
2524 __ bind(*op->stub()->continuation());
2525 }
2526
2527
2528 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
2529 ciMethod* method = op->profiled_method();
2530 int bci = op->profiled_bci();
2531 ciMethod* callee = op->profiled_callee();
|
2149 assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
2150 int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
2151 assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
2152 __ lea(rscratch1, __ constant_oop_address(o));
2153 __ str(rscratch1, Address(sp, offset_from_rsp_in_bytes));
2154 }
2155
2156
2157 // This code replaces a call to arraycopy; no exception may
2158 // be thrown in this code, they must be thrown in the System.arraycopy
2159 // activation frame; we could save some checks if this would not be the case
2160 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
2161 ciArrayKlass* default_type = op->expected_type();
2162 Register src = op->src()->as_register();
2163 Register dst = op->dst()->as_register();
2164 Register src_pos = op->src_pos()->as_register();
2165 Register dst_pos = op->dst_pos()->as_register();
2166 Register length = op->length()->as_register();
2167 Register tmp = op->tmp()->as_register();
2168
2169 __ resolve_for_read(IN_HEAP, src);
2170 __ resolve_for_write(IN_HEAP, dst);
2171
2172 CodeStub* stub = op->stub();
2173 int flags = op->flags();
2174 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
2175 if (basic_type == T_ARRAY) basic_type = T_OBJECT;
2176
2177 // if we don't know anything, just go through the generic arraycopy
2178 if (default_type == NULL // || basic_type == T_OBJECT
2179 ) {
2180 Label done;
2181 assert(src == r1 && src_pos == r2, "mismatch in calling convention");
2182
2183 // Save the arguments in case the generic arraycopy fails and we
2184 // have to fall back to the JNI stub
2185 __ stp(dst, dst_pos, Address(sp, 0*BytesPerWord));
2186 __ stp(length, src_pos, Address(sp, 2*BytesPerWord));
2187 __ str(src, Address(sp, 4*BytesPerWord));
2188
2189 address copyfunc_addr = StubRoutines::generic_arraycopy();
2190 assert(copyfunc_addr != NULL, "generic arraycopy stub required");
2191
2495 }
2496
2497 __ bind(*stub->continuation());
2498 }
2499
2500
2501
2502
2503 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
2504 Register obj = op->obj_opr()->as_register(); // may not be an oop
2505 Register hdr = op->hdr_opr()->as_register();
2506 Register lock = op->lock_opr()->as_register();
2507 if (!UseFastLocking) {
2508 __ b(*op->stub()->entry());
2509 } else if (op->code() == lir_lock) {
2510 Register scratch = noreg;
2511 if (UseBiasedLocking) {
2512 scratch = op->scratch_opr()->as_register();
2513 }
2514 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2515 __ resolve_for_write(IN_HEAP, obj);
2516 // add debug info for NullPointerException only if one is possible
2517 int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
2518 if (op->info() != NULL) {
2519 add_debug_info_for_null_check(null_check_offset, op->info());
2520 }
2521 // done
2522 } else if (op->code() == lir_unlock) {
2523 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2524 __ unlock_object(hdr, obj, lock, *op->stub()->entry());
2525 } else {
2526 Unimplemented();
2527 }
2528 __ bind(*op->stub()->continuation());
2529 }
2530
2531
2532 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
2533 ciMethod* method = op->profiled_method();
2534 int bci = op->profiled_bci();
2535 ciMethod* callee = op->profiled_callee();
|