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 *
24 */
25
26 #include "asm/macroAssembler.inline.hpp"
27 #include "asm/assembler.hpp"
28 #include "c1/c1_CodeStubs.hpp"
29 #include "c1/c1_Compilation.hpp"
30 #include "c1/c1_LIRAssembler.hpp"
31 #include "c1/c1_MacroAssembler.hpp"
32 #include "c1/c1_Runtime1.hpp"
33 #include "c1/c1_ValueStack.hpp"
34 #include "ci/ciArrayKlass.hpp"
35 #include "ci/ciInstance.hpp"
36 #include "code/compiledIC.hpp"
37 #include "gc/shared/collectedHeap.hpp"
38 #include "gc/shared/gc_globals.hpp"
39 #include "nativeInst_aarch64.hpp"
40 #include "oops/objArrayKlass.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/sharedRuntime.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "utilities/powerOfTwo.hpp"
45 #include "vmreg_aarch64.inline.hpp"
46
47
48 #ifndef PRODUCT
49 #define COMMENT(x) do { __ block_comment(x); } while (0)
50 #else
51 #define COMMENT(x)
52 #endif
53
54 NEEDS_CLEANUP // remove this definitions ?
55 const Register SYNC_header = r0; // synchronization header
56 const Register SHIFT_count = r0; // where count for shift operations must be
57
58 #define __ _masm->
59
60
61 static void select_different_registers(Register preserve,
62 Register extra,
63 Register &tmp1,
507 void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_code, CodeEmitInfo* info) {
508 assert(src->is_constant(), "should not call otherwise");
509 assert(dest->is_register(), "should not call otherwise");
510 LIR_Const* c = src->as_constant_ptr();
511
512 switch (c->type()) {
513 case T_INT: {
514 assert(patch_code == lir_patch_none, "no patching handled here");
515 __ movw(dest->as_register(), c->as_jint());
516 break;
517 }
518
519 case T_ADDRESS: {
520 assert(patch_code == lir_patch_none, "no patching handled here");
521 __ mov(dest->as_register(), c->as_jint());
522 break;
523 }
524
525 case T_LONG: {
526 assert(patch_code == lir_patch_none, "no patching handled here");
527 __ mov(dest->as_register_lo(), (intptr_t)c->as_jlong());
528 break;
529 }
530
531 case T_OBJECT: {
532 if (patch_code == lir_patch_none) {
533 jobject2reg(c->as_jobject(), dest->as_register());
534 } else {
535 jobject2reg_with_patching(dest->as_register(), info);
536 }
537 break;
538 }
539
540 case T_METADATA: {
541 if (patch_code != lir_patch_none) {
542 klass2reg_with_patching(dest->as_register(), info);
543 } else {
544 __ mov_metadata(dest->as_register(), c->as_metadata());
545 }
546 break;
|
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 *
24 */
25
26 #include "asm/macroAssembler.inline.hpp"
27 #include "asm/assembler.hpp"
28 #include "c1/c1_CodeStubs.hpp"
29 #include "c1/c1_Compilation.hpp"
30 #include "c1/c1_LIRAssembler.hpp"
31 #include "c1/c1_MacroAssembler.hpp"
32 #include "c1/c1_Runtime1.hpp"
33 #include "c1/c1_ValueStack.hpp"
34 #include "ci/ciArrayKlass.hpp"
35 #include "ci/ciInstance.hpp"
36 #include "ci/ciUtilities.hpp"
37 #include "code/aotCodeCache.hpp"
38 #include "code/compiledIC.hpp"
39 #include "gc/shared/collectedHeap.hpp"
40 #include "gc/shared/gc_globals.hpp"
41 #include "nativeInst_aarch64.hpp"
42 #include "oops/objArrayKlass.hpp"
43 #include "runtime/frame.inline.hpp"
44 #include "runtime/sharedRuntime.hpp"
45 #include "runtime/stubRoutines.hpp"
46 #include "runtime/threadIdentifier.hpp"
47 #include "utilities/powerOfTwo.hpp"
48 #include "vmreg_aarch64.inline.hpp"
49
50
51 #ifndef PRODUCT
52 #define COMMENT(x) do { __ block_comment(x); } while (0)
53 #else
54 #define COMMENT(x)
55 #endif
56
57 NEEDS_CLEANUP // remove this definitions ?
58 const Register SYNC_header = r0; // synchronization header
59 const Register SHIFT_count = r0; // where count for shift operations must be
60
61 #define __ _masm->
62
63
64 static void select_different_registers(Register preserve,
65 Register extra,
66 Register &tmp1,
510 void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_code, CodeEmitInfo* info) {
511 assert(src->is_constant(), "should not call otherwise");
512 assert(dest->is_register(), "should not call otherwise");
513 LIR_Const* c = src->as_constant_ptr();
514
515 switch (c->type()) {
516 case T_INT: {
517 assert(patch_code == lir_patch_none, "no patching handled here");
518 __ movw(dest->as_register(), c->as_jint());
519 break;
520 }
521
522 case T_ADDRESS: {
523 assert(patch_code == lir_patch_none, "no patching handled here");
524 __ mov(dest->as_register(), c->as_jint());
525 break;
526 }
527
528 case T_LONG: {
529 assert(patch_code == lir_patch_none, "no patching handled here");
530 if (AOTCodeCache::is_on_for_dump()) {
531 // AOT code needs relocation info for card table base
532 address b = c->as_pointer();
533 if (is_card_table_address(b)) {
534 __ lea(dest->as_register_lo(), ExternalAddress(b));
535 break;
536 }
537 if (b == (address)ThreadIdentifier::unsafe_offset()) {
538 __ lea(dest->as_register_lo(), ExternalAddress(b));
539 break;
540 }
541 #if INCLUDE_CDS
542 if (AOTRuntimeConstants::contains(b)) {
543 __ load_aotrc_address(dest->as_register_lo(), b);
544 break;
545 }
546 #endif
547 }
548 __ mov(dest->as_register_lo(), (intptr_t)c->as_jlong());
549 break;
550 }
551
552 case T_OBJECT: {
553 if (patch_code == lir_patch_none) {
554 jobject2reg(c->as_jobject(), dest->as_register());
555 } else {
556 jobject2reg_with_patching(dest->as_register(), info);
557 }
558 break;
559 }
560
561 case T_METADATA: {
562 if (patch_code != lir_patch_none) {
563 klass2reg_with_patching(dest->as_register(), info);
564 } else {
565 __ mov_metadata(dest->as_register(), c->as_metadata());
566 }
567 break;
|