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
511 void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_code, CodeEmitInfo* info) {
512 assert(src->is_constant(), "should not call otherwise");
513 assert(dest->is_register(), "should not call otherwise");
514 LIR_Const* c = src->as_constant_ptr();
515
516 switch (c->type()) {
517 case T_INT: {
518 assert(patch_code == lir_patch_none, "no patching handled here");
519 __ movw(dest->as_register(), c->as_jint());
520 break;
521 }
522
523 case T_ADDRESS: {
524 assert(patch_code == lir_patch_none, "no patching handled here");
525 __ mov(dest->as_register(), c->as_jint());
526 break;
527 }
528
529 case T_LONG: {
530 assert(patch_code == lir_patch_none, "no patching handled here");
531 __ mov(dest->as_register_lo(), (intptr_t)c->as_jlong());
532 break;
533 }
534
535 case T_OBJECT: {
536 if (patch_code == lir_patch_none) {
537 jobject2reg(c->as_jobject(), dest->as_register());
538 } else {
539 jobject2reg_with_patching(dest->as_register(), info);
540 }
541 break;
542 }
543
544 case T_METADATA: {
545 if (patch_code != lir_patch_none) {
546 klass2reg_with_patching(dest->as_register(), info);
547 } else {
548 __ mov_metadata(dest->as_register(), c->as_metadata());
549 }
550 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/SCCache.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 "utilities/powerOfTwo.hpp"
47 #include "vmreg_aarch64.inline.hpp"
48
49
50 #ifndef PRODUCT
51 #define COMMENT(x) do { __ block_comment(x); } while (0)
52 #else
53 #define COMMENT(x)
54 #endif
55
56 NEEDS_CLEANUP // remove this definitions ?
57 const Register SYNC_header = r0; // synchronization header
513 void LIR_Assembler::const2reg(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_code, CodeEmitInfo* info) {
514 assert(src->is_constant(), "should not call otherwise");
515 assert(dest->is_register(), "should not call otherwise");
516 LIR_Const* c = src->as_constant_ptr();
517
518 switch (c->type()) {
519 case T_INT: {
520 assert(patch_code == lir_patch_none, "no patching handled here");
521 __ movw(dest->as_register(), c->as_jint());
522 break;
523 }
524
525 case T_ADDRESS: {
526 assert(patch_code == lir_patch_none, "no patching handled here");
527 __ mov(dest->as_register(), c->as_jint());
528 break;
529 }
530
531 case T_LONG: {
532 assert(patch_code == lir_patch_none, "no patching handled here");
533 if (SCCache::is_on_for_write()) {
534 // SCA needs relocation info for card table base
535 address b = c->as_pointer();
536 if (is_card_table_address(b)) {
537 __ lea(dest->as_register_lo(), ExternalAddress(b));
538 break;
539 }
540 if (AOTRuntimeConstants::contains(b)) {
541 __ load_aotrc_address(dest->as_register_lo(), b);
542 break;
543 }
544 }
545 __ mov(dest->as_register_lo(), (intptr_t)c->as_jlong());
546 break;
547 }
548
549 case T_OBJECT: {
550 if (patch_code == lir_patch_none) {
551 jobject2reg(c->as_jobject(), dest->as_register());
552 } else {
553 jobject2reg_with_patching(dest->as_register(), info);
554 }
555 break;
556 }
557
558 case T_METADATA: {
559 if (patch_code != lir_patch_none) {
560 klass2reg_with_patching(dest->as_register(), info);
561 } else {
562 __ mov_metadata(dest->as_register(), c->as_metadata());
563 }
564 break;
|