< prev index next >

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Print this page


   1 /*
   2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *


2150   assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
2151   int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
2152   assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
2153   __ lea(rscratch1, __ constant_oop_address(o));
2154   __ str(rscratch1, Address(sp, offset_from_rsp_in_bytes));
2155 }
2156 
2157 
2158 // This code replaces a call to arraycopy; no exception may
2159 // be thrown in this code, they must be thrown in the System.arraycopy
2160 // activation frame; we could save some checks if this would not be the case
2161 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
2162   ciArrayKlass* default_type = op->expected_type();
2163   Register src = op->src()->as_register();
2164   Register dst = op->dst()->as_register();
2165   Register src_pos = op->src_pos()->as_register();
2166   Register dst_pos = op->dst_pos()->as_register();
2167   Register length  = op->length()->as_register();
2168   Register tmp = op->tmp()->as_register();
2169 



2170   CodeStub* stub = op->stub();
2171   int flags = op->flags();
2172   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
2173   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
2174 
2175   // if we don't know anything, just go through the generic arraycopy
2176   if (default_type == NULL // || basic_type == T_OBJECT
2177       ) {
2178     Label done;
2179     assert(src == r1 && src_pos == r2, "mismatch in calling convention");
2180 
2181     // Save the arguments in case the generic arraycopy fails and we
2182     // have to fall back to the JNI stub
2183     __ stp(dst,     dst_pos, Address(sp, 0*BytesPerWord));
2184     __ stp(length,  src_pos, Address(sp, 2*BytesPerWord));
2185     __ str(src,              Address(sp, 4*BytesPerWord));
2186 
2187     address copyfunc_addr = StubRoutines::generic_arraycopy();
2188     assert(copyfunc_addr != NULL, "generic arraycopy stub required");
2189 


2493  }
2494 
2495   __ bind(*stub->continuation());
2496 }
2497 
2498 
2499 
2500 
2501 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
2502   Register obj = op->obj_opr()->as_register();  // may not be an oop
2503   Register hdr = op->hdr_opr()->as_register();
2504   Register lock = op->lock_opr()->as_register();
2505   if (!UseFastLocking) {
2506     __ b(*op->stub()->entry());
2507   } else if (op->code() == lir_lock) {
2508     Register scratch = noreg;
2509     if (UseBiasedLocking) {
2510       scratch = op->scratch_opr()->as_register();
2511     }
2512     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");

2513     // add debug info for NullPointerException only if one is possible
2514     int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
2515     if (op->info() != NULL) {
2516       add_debug_info_for_null_check(null_check_offset, op->info());
2517     }
2518     // done
2519   } else if (op->code() == lir_unlock) {
2520     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2521     __ unlock_object(hdr, obj, lock, *op->stub()->entry());
2522   } else {
2523     Unimplemented();
2524   }
2525   __ bind(*op->stub()->continuation());
2526 }
2527 
2528 
2529 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
2530   ciMethod* method = op->profiled_method();
2531   int bci          = op->profiled_bci();
2532   ciMethod* callee = op->profiled_callee();


   1 /*
   2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, 2018, Red Hat, Inc. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *


2150   assert(offset_from_rsp_in_words >= 0, "invalid offset from rsp");
2151   int offset_from_rsp_in_bytes = offset_from_rsp_in_words * BytesPerWord;
2152   assert(offset_from_rsp_in_bytes < frame_map()->reserved_argument_area_size(), "invalid offset");
2153   __ lea(rscratch1, __ constant_oop_address(o));
2154   __ str(rscratch1, Address(sp, offset_from_rsp_in_bytes));
2155 }
2156 
2157 
2158 // This code replaces a call to arraycopy; no exception may
2159 // be thrown in this code, they must be thrown in the System.arraycopy
2160 // activation frame; we could save some checks if this would not be the case
2161 void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
2162   ciArrayKlass* default_type = op->expected_type();
2163   Register src = op->src()->as_register();
2164   Register dst = op->dst()->as_register();
2165   Register src_pos = op->src_pos()->as_register();
2166   Register dst_pos = op->dst_pos()->as_register();
2167   Register length  = op->length()->as_register();
2168   Register tmp = op->tmp()->as_register();
2169 
2170   __ resolve_for_read(IN_HEAP, src);
2171   __ resolve_for_write(IN_HEAP, dst);
2172 
2173   CodeStub* stub = op->stub();
2174   int flags = op->flags();
2175   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
2176   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
2177 
2178   // if we don't know anything, just go through the generic arraycopy
2179   if (default_type == NULL // || basic_type == T_OBJECT
2180       ) {
2181     Label done;
2182     assert(src == r1 && src_pos == r2, "mismatch in calling convention");
2183 
2184     // Save the arguments in case the generic arraycopy fails and we
2185     // have to fall back to the JNI stub
2186     __ stp(dst,     dst_pos, Address(sp, 0*BytesPerWord));
2187     __ stp(length,  src_pos, Address(sp, 2*BytesPerWord));
2188     __ str(src,              Address(sp, 4*BytesPerWord));
2189 
2190     address copyfunc_addr = StubRoutines::generic_arraycopy();
2191     assert(copyfunc_addr != NULL, "generic arraycopy stub required");
2192 


2496  }
2497 
2498   __ bind(*stub->continuation());
2499 }
2500 
2501 
2502 
2503 
2504 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
2505   Register obj = op->obj_opr()->as_register();  // may not be an oop
2506   Register hdr = op->hdr_opr()->as_register();
2507   Register lock = op->lock_opr()->as_register();
2508   if (!UseFastLocking) {
2509     __ b(*op->stub()->entry());
2510   } else if (op->code() == lir_lock) {
2511     Register scratch = noreg;
2512     if (UseBiasedLocking) {
2513       scratch = op->scratch_opr()->as_register();
2514     }
2515     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2516     __ resolve_for_write(IN_HEAP, obj);
2517     // add debug info for NullPointerException only if one is possible
2518     int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
2519     if (op->info() != NULL) {
2520       add_debug_info_for_null_check(null_check_offset, op->info());
2521     }
2522     // done
2523   } else if (op->code() == lir_unlock) {
2524     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2525     __ unlock_object(hdr, obj, lock, *op->stub()->entry());
2526   } else {
2527     Unimplemented();
2528   }
2529   __ bind(*op->stub()->continuation());
2530 }
2531 
2532 
2533 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
2534   ciMethod* method = op->profiled_method();
2535   int bci          = op->profiled_bci();
2536   ciMethod* callee = op->profiled_callee();


< prev index next >