comparison src/cpu/x86/vm/templateTable_x86_64.cpp @ 1513:df736661d0c8

Merge
author jrose
date Tue, 11 May 2010 15:19:19 -0700
parents 2338d41fbd81
children c18cbe5936b8 ab102d5d923e
comparison
equal deleted inserted replaced
1496:e8e83be27dd7 1513:df736661d0c8
56 static inline Address aaddress(int n) { 56 static inline Address aaddress(int n) {
57 return iaddress(n); 57 return iaddress(n);
58 } 58 }
59 59
60 static inline Address iaddress(Register r) { 60 static inline Address iaddress(Register r) {
61 return Address(r14, r, Address::times_8, Interpreter::value_offset_in_bytes()); 61 return Address(r14, r, Address::times_8);
62 } 62 }
63 63
64 static inline Address laddress(Register r) { 64 static inline Address laddress(Register r) {
65 return Address(r14, r, Address::times_8, Interpreter::local_offset_in_bytes(1)); 65 return Address(r14, r, Address::times_8, Interpreter::local_offset_in_bytes(1));
66 } 66 }
416 } 416 }
417 417
418 void TemplateTable::locals_index(Register reg, int offset) { 418 void TemplateTable::locals_index(Register reg, int offset) {
419 __ load_unsigned_byte(reg, at_bcp(offset)); 419 __ load_unsigned_byte(reg, at_bcp(offset));
420 __ negptr(reg); 420 __ negptr(reg);
421 if (TaggedStackInterpreter) __ shlptr(reg, 1); // index = index*2
422 } 421 }
423 422
424 void TemplateTable::iload() { 423 void TemplateTable::iload() {
425 transition(vtos, itos); 424 transition(vtos, itos);
426 if (RewriteFrequentPairs) { 425 if (RewriteFrequentPairs) {
458 } 457 }
459 458
460 // Get the local value into tos 459 // Get the local value into tos
461 locals_index(rbx); 460 locals_index(rbx);
462 __ movl(rax, iaddress(rbx)); 461 __ movl(rax, iaddress(rbx));
463 debug_only(__ verify_local_tag(frame::TagValue, rbx));
464 } 462 }
465 463
466 void TemplateTable::fast_iload2() { 464 void TemplateTable::fast_iload2() {
467 transition(vtos, itos); 465 transition(vtos, itos);
468 locals_index(rbx); 466 locals_index(rbx);
469 __ movl(rax, iaddress(rbx)); 467 __ movl(rax, iaddress(rbx));
470 debug_only(__ verify_local_tag(frame::TagValue, rbx));
471 __ push(itos); 468 __ push(itos);
472 locals_index(rbx, 3); 469 locals_index(rbx, 3);
473 __ movl(rax, iaddress(rbx)); 470 __ movl(rax, iaddress(rbx));
474 debug_only(__ verify_local_tag(frame::TagValue, rbx));
475 } 471 }
476 472
477 void TemplateTable::fast_iload() { 473 void TemplateTable::fast_iload() {
478 transition(vtos, itos); 474 transition(vtos, itos);
479 locals_index(rbx); 475 locals_index(rbx);
480 __ movl(rax, iaddress(rbx)); 476 __ movl(rax, iaddress(rbx));
481 debug_only(__ verify_local_tag(frame::TagValue, rbx));
482 } 477 }
483 478
484 void TemplateTable::lload() { 479 void TemplateTable::lload() {
485 transition(vtos, ltos); 480 transition(vtos, ltos);
486 locals_index(rbx); 481 locals_index(rbx);
487 __ movq(rax, laddress(rbx)); 482 __ movq(rax, laddress(rbx));
488 debug_only(__ verify_local_tag(frame::TagCategory2, rbx));
489 } 483 }
490 484
491 void TemplateTable::fload() { 485 void TemplateTable::fload() {
492 transition(vtos, ftos); 486 transition(vtos, ftos);
493 locals_index(rbx); 487 locals_index(rbx);
494 __ movflt(xmm0, faddress(rbx)); 488 __ movflt(xmm0, faddress(rbx));
495 debug_only(__ verify_local_tag(frame::TagValue, rbx));
496 } 489 }
497 490
498 void TemplateTable::dload() { 491 void TemplateTable::dload() {
499 transition(vtos, dtos); 492 transition(vtos, dtos);
500 locals_index(rbx); 493 locals_index(rbx);
501 __ movdbl(xmm0, daddress(rbx)); 494 __ movdbl(xmm0, daddress(rbx));
502 debug_only(__ verify_local_tag(frame::TagCategory2, rbx));
503 } 495 }
504 496
505 void TemplateTable::aload() { 497 void TemplateTable::aload() {
506 transition(vtos, atos); 498 transition(vtos, atos);
507 locals_index(rbx); 499 locals_index(rbx);
508 __ movptr(rax, aaddress(rbx)); 500 __ movptr(rax, aaddress(rbx));
509 debug_only(__ verify_local_tag(frame::TagReference, rbx));
510 } 501 }
511 502
512 void TemplateTable::locals_index_wide(Register reg) { 503 void TemplateTable::locals_index_wide(Register reg) {
513 __ movl(reg, at_bcp(2)); 504 __ movl(reg, at_bcp(2));
514 __ bswapl(reg); 505 __ bswapl(reg);
515 __ shrl(reg, 16); 506 __ shrl(reg, 16);
516 __ negptr(reg); 507 __ negptr(reg);
517 if (TaggedStackInterpreter) __ shlptr(reg, 1); // index = index*2
518 } 508 }
519 509
520 void TemplateTable::wide_iload() { 510 void TemplateTable::wide_iload() {
521 transition(vtos, itos); 511 transition(vtos, itos);
522 locals_index_wide(rbx); 512 locals_index_wide(rbx);
523 __ movl(rax, iaddress(rbx)); 513 __ movl(rax, iaddress(rbx));
524 debug_only(__ verify_local_tag(frame::TagValue, rbx));
525 } 514 }
526 515
527 void TemplateTable::wide_lload() { 516 void TemplateTable::wide_lload() {
528 transition(vtos, ltos); 517 transition(vtos, ltos);
529 locals_index_wide(rbx); 518 locals_index_wide(rbx);
530 __ movq(rax, laddress(rbx)); 519 __ movq(rax, laddress(rbx));
531 debug_only(__ verify_local_tag(frame::TagCategory2, rbx));
532 } 520 }
533 521
534 void TemplateTable::wide_fload() { 522 void TemplateTable::wide_fload() {
535 transition(vtos, ftos); 523 transition(vtos, ftos);
536 locals_index_wide(rbx); 524 locals_index_wide(rbx);
537 __ movflt(xmm0, faddress(rbx)); 525 __ movflt(xmm0, faddress(rbx));
538 debug_only(__ verify_local_tag(frame::TagValue, rbx));
539 } 526 }
540 527
541 void TemplateTable::wide_dload() { 528 void TemplateTable::wide_dload() {
542 transition(vtos, dtos); 529 transition(vtos, dtos);
543 locals_index_wide(rbx); 530 locals_index_wide(rbx);
544 __ movdbl(xmm0, daddress(rbx)); 531 __ movdbl(xmm0, daddress(rbx));
545 debug_only(__ verify_local_tag(frame::TagCategory2, rbx));
546 } 532 }
547 533
548 void TemplateTable::wide_aload() { 534 void TemplateTable::wide_aload() {
549 transition(vtos, atos); 535 transition(vtos, atos);
550 locals_index_wide(rbx); 536 locals_index_wide(rbx);
551 __ movptr(rax, aaddress(rbx)); 537 __ movptr(rax, aaddress(rbx));
552 debug_only(__ verify_local_tag(frame::TagReference, rbx));
553 } 538 }
554 539
555 void TemplateTable::index_check(Register array, Register index) { 540 void TemplateTable::index_check(Register array, Register index) {
556 // destroys rbx 541 // destroys rbx
557 // check array 542 // check array
652 void TemplateTable::fast_icaload() { 637 void TemplateTable::fast_icaload() {
653 transition(vtos, itos); 638 transition(vtos, itos);
654 // load index out of locals 639 // load index out of locals
655 locals_index(rbx); 640 locals_index(rbx);
656 __ movl(rax, iaddress(rbx)); 641 __ movl(rax, iaddress(rbx));
657 debug_only(__ verify_local_tag(frame::TagValue, rbx));
658 642
659 // eax: index 643 // eax: index
660 // rdx: array 644 // rdx: array
661 __ pop_ptr(rdx); 645 __ pop_ptr(rdx);
662 index_check(rdx, rax); // kills rbx 646 index_check(rdx, rax); // kills rbx
679 } 663 }
680 664
681 void TemplateTable::iload(int n) { 665 void TemplateTable::iload(int n) {
682 transition(vtos, itos); 666 transition(vtos, itos);
683 __ movl(rax, iaddress(n)); 667 __ movl(rax, iaddress(n));
684 debug_only(__ verify_local_tag(frame::TagValue, n));
685 } 668 }
686 669
687 void TemplateTable::lload(int n) { 670 void TemplateTable::lload(int n) {
688 transition(vtos, ltos); 671 transition(vtos, ltos);
689 __ movq(rax, laddress(n)); 672 __ movq(rax, laddress(n));
690 debug_only(__ verify_local_tag(frame::TagCategory2, n));
691 } 673 }
692 674
693 void TemplateTable::fload(int n) { 675 void TemplateTable::fload(int n) {
694 transition(vtos, ftos); 676 transition(vtos, ftos);
695 __ movflt(xmm0, faddress(n)); 677 __ movflt(xmm0, faddress(n));
696 debug_only(__ verify_local_tag(frame::TagValue, n));
697 } 678 }
698 679
699 void TemplateTable::dload(int n) { 680 void TemplateTable::dload(int n) {
700 transition(vtos, dtos); 681 transition(vtos, dtos);
701 __ movdbl(xmm0, daddress(n)); 682 __ movdbl(xmm0, daddress(n));
702 debug_only(__ verify_local_tag(frame::TagCategory2, n));
703 } 683 }
704 684
705 void TemplateTable::aload(int n) { 685 void TemplateTable::aload(int n) {
706 transition(vtos, atos); 686 transition(vtos, atos);
707 __ movptr(rax, aaddress(n)); 687 __ movptr(rax, aaddress(n));
708 debug_only(__ verify_local_tag(frame::TagReference, n));
709 } 688 }
710 689
711 void TemplateTable::aload_0() { 690 void TemplateTable::aload_0() {
712 transition(vtos, atos); 691 transition(vtos, atos);
713 // According to bytecode histograms, the pairs: 692 // According to bytecode histograms, the pairs:
789 768
790 void TemplateTable::istore() { 769 void TemplateTable::istore() {
791 transition(itos, vtos); 770 transition(itos, vtos);
792 locals_index(rbx); 771 locals_index(rbx);
793 __ movl(iaddress(rbx), rax); 772 __ movl(iaddress(rbx), rax);
794 __ tag_local(frame::TagValue, rbx);
795 } 773 }
796 774
797 void TemplateTable::lstore() { 775 void TemplateTable::lstore() {
798 transition(ltos, vtos); 776 transition(ltos, vtos);
799 locals_index(rbx); 777 locals_index(rbx);
800 __ movq(laddress(rbx), rax); 778 __ movq(laddress(rbx), rax);
801 __ tag_local(frame::TagCategory2, rbx);
802 } 779 }
803 780
804 void TemplateTable::fstore() { 781 void TemplateTable::fstore() {
805 transition(ftos, vtos); 782 transition(ftos, vtos);
806 locals_index(rbx); 783 locals_index(rbx);
807 __ movflt(faddress(rbx), xmm0); 784 __ movflt(faddress(rbx), xmm0);
808 __ tag_local(frame::TagValue, rbx);
809 } 785 }
810 786
811 void TemplateTable::dstore() { 787 void TemplateTable::dstore() {
812 transition(dtos, vtos); 788 transition(dtos, vtos);
813 locals_index(rbx); 789 locals_index(rbx);
814 __ movdbl(daddress(rbx), xmm0); 790 __ movdbl(daddress(rbx), xmm0);
815 __ tag_local(frame::TagCategory2, rbx);
816 } 791 }
817 792
818 void TemplateTable::astore() { 793 void TemplateTable::astore() {
819 transition(vtos, vtos); 794 transition(vtos, vtos);
820 __ pop_ptr(rax, rdx); // will need to pop tag too 795 __ pop_ptr(rax);
821 locals_index(rbx); 796 locals_index(rbx);
822 __ movptr(aaddress(rbx), rax); 797 __ movptr(aaddress(rbx), rax);
823 __ tag_local(rdx, rbx); // store tag from stack, might be returnAddr
824 } 798 }
825 799
826 void TemplateTable::wide_istore() { 800 void TemplateTable::wide_istore() {
827 transition(vtos, vtos); 801 transition(vtos, vtos);
828 __ pop_i(); 802 __ pop_i();
829 locals_index_wide(rbx); 803 locals_index_wide(rbx);
830 __ movl(iaddress(rbx), rax); 804 __ movl(iaddress(rbx), rax);
831 __ tag_local(frame::TagValue, rbx);
832 } 805 }
833 806
834 void TemplateTable::wide_lstore() { 807 void TemplateTable::wide_lstore() {
835 transition(vtos, vtos); 808 transition(vtos, vtos);
836 __ pop_l(); 809 __ pop_l();
837 locals_index_wide(rbx); 810 locals_index_wide(rbx);
838 __ movq(laddress(rbx), rax); 811 __ movq(laddress(rbx), rax);
839 __ tag_local(frame::TagCategory2, rbx);
840 } 812 }
841 813
842 void TemplateTable::wide_fstore() { 814 void TemplateTable::wide_fstore() {
843 transition(vtos, vtos); 815 transition(vtos, vtos);
844 __ pop_f(); 816 __ pop_f();
845 locals_index_wide(rbx); 817 locals_index_wide(rbx);
846 __ movflt(faddress(rbx), xmm0); 818 __ movflt(faddress(rbx), xmm0);
847 __ tag_local(frame::TagValue, rbx);
848 } 819 }
849 820
850 void TemplateTable::wide_dstore() { 821 void TemplateTable::wide_dstore() {
851 transition(vtos, vtos); 822 transition(vtos, vtos);
852 __ pop_d(); 823 __ pop_d();
853 locals_index_wide(rbx); 824 locals_index_wide(rbx);
854 __ movdbl(daddress(rbx), xmm0); 825 __ movdbl(daddress(rbx), xmm0);
855 __ tag_local(frame::TagCategory2, rbx);
856 } 826 }
857 827
858 void TemplateTable::wide_astore() { 828 void TemplateTable::wide_astore() {
859 transition(vtos, vtos); 829 transition(vtos, vtos);
860 __ pop_ptr(rax, rdx); // will need to pop tag too 830 __ pop_ptr(rax);
861 locals_index_wide(rbx); 831 locals_index_wide(rbx);
862 __ movptr(aaddress(rbx), rax); 832 __ movptr(aaddress(rbx), rax);
863 __ tag_local(rdx, rbx); // store tag from stack, might be returnAddr
864 } 833 }
865 834
866 void TemplateTable::iastore() { 835 void TemplateTable::iastore() {
867 transition(itos, vtos); 836 transition(itos, vtos);
868 __ pop_i(rbx); 837 __ pop_i(rbx);
970 // Store a NULL 939 // Store a NULL
971 do_oop_store(_masm, element_address, noreg, _bs->kind(), true); 940 do_oop_store(_masm, element_address, noreg, _bs->kind(), true);
972 941
973 // Pop stack arguments 942 // Pop stack arguments
974 __ bind(done); 943 __ bind(done);
975 __ addptr(rsp, 3 * Interpreter::stackElementSize()); 944 __ addptr(rsp, 3 * Interpreter::stackElementSize);
976 } 945 }
977 946
978 void TemplateTable::bastore() { 947 void TemplateTable::bastore() {
979 transition(itos, vtos); 948 transition(itos, vtos);
980 __ pop_i(rbx); 949 __ pop_i(rbx);
1008 } 977 }
1009 978
1010 void TemplateTable::istore(int n) { 979 void TemplateTable::istore(int n) {
1011 transition(itos, vtos); 980 transition(itos, vtos);
1012 __ movl(iaddress(n), rax); 981 __ movl(iaddress(n), rax);
1013 __ tag_local(frame::TagValue, n);
1014 } 982 }
1015 983
1016 void TemplateTable::lstore(int n) { 984 void TemplateTable::lstore(int n) {
1017 transition(ltos, vtos); 985 transition(ltos, vtos);
1018 __ movq(laddress(n), rax); 986 __ movq(laddress(n), rax);
1019 __ tag_local(frame::TagCategory2, n);
1020 } 987 }
1021 988
1022 void TemplateTable::fstore(int n) { 989 void TemplateTable::fstore(int n) {
1023 transition(ftos, vtos); 990 transition(ftos, vtos);
1024 __ movflt(faddress(n), xmm0); 991 __ movflt(faddress(n), xmm0);
1025 __ tag_local(frame::TagValue, n);
1026 } 992 }
1027 993
1028 void TemplateTable::dstore(int n) { 994 void TemplateTable::dstore(int n) {
1029 transition(dtos, vtos); 995 transition(dtos, vtos);
1030 __ movdbl(daddress(n), xmm0); 996 __ movdbl(daddress(n), xmm0);
1031 __ tag_local(frame::TagCategory2, n);
1032 } 997 }
1033 998
1034 void TemplateTable::astore(int n) { 999 void TemplateTable::astore(int n) {
1035 transition(vtos, vtos); 1000 transition(vtos, vtos);
1036 __ pop_ptr(rax, rdx); 1001 __ pop_ptr(rax);
1037 __ movptr(aaddress(n), rax); 1002 __ movptr(aaddress(n), rax);
1038 __ tag_local(rdx, n);
1039 } 1003 }
1040 1004
1041 void TemplateTable::pop() { 1005 void TemplateTable::pop() {
1042 transition(vtos, vtos); 1006 transition(vtos, vtos);
1043 __ addptr(rsp, Interpreter::stackElementSize()); 1007 __ addptr(rsp, Interpreter::stackElementSize);
1044 } 1008 }
1045 1009
1046 void TemplateTable::pop2() { 1010 void TemplateTable::pop2() {
1047 transition(vtos, vtos); 1011 transition(vtos, vtos);
1048 __ addptr(rsp, 2 * Interpreter::stackElementSize()); 1012 __ addptr(rsp, 2 * Interpreter::stackElementSize);
1049 } 1013 }
1050 1014
1051 void TemplateTable::dup() { 1015 void TemplateTable::dup() {
1052 transition(vtos, vtos); 1016 transition(vtos, vtos);
1053 __ load_ptr_and_tag(0, rax, rdx); 1017 __ load_ptr(0, rax);
1054 __ push_ptr(rax, rdx); 1018 __ push_ptr(rax);
1055 // stack: ..., a, a 1019 // stack: ..., a, a
1056 } 1020 }
1057 1021
1058 void TemplateTable::dup_x1() { 1022 void TemplateTable::dup_x1() {
1059 transition(vtos, vtos); 1023 transition(vtos, vtos);
1060 // stack: ..., a, b 1024 // stack: ..., a, b
1061 __ load_ptr_and_tag(0, rax, rdx); // load b 1025 __ load_ptr( 0, rax); // load b
1062 __ load_ptr_and_tag(1, rcx, rbx); // load a 1026 __ load_ptr( 1, rcx); // load a
1063 __ store_ptr_and_tag(1, rax, rdx); // store b 1027 __ store_ptr(1, rax); // store b
1064 __ store_ptr_and_tag(0, rcx, rbx); // store a 1028 __ store_ptr(0, rcx); // store a
1065 __ push_ptr(rax, rdx); // push b 1029 __ push_ptr(rax); // push b
1066 // stack: ..., b, a, b 1030 // stack: ..., b, a, b
1067 } 1031 }
1068 1032
1069 void TemplateTable::dup_x2() { 1033 void TemplateTable::dup_x2() {
1070 transition(vtos, vtos); 1034 transition(vtos, vtos);
1071 // stack: ..., a, b, c 1035 // stack: ..., a, b, c
1072 __ load_ptr_and_tag(0, rax, rdx); // load c 1036 __ load_ptr( 0, rax); // load c
1073 __ load_ptr_and_tag(2, rcx, rbx); // load a 1037 __ load_ptr( 2, rcx); // load a
1074 __ store_ptr_and_tag(2, rax, rdx); // store c in a 1038 __ store_ptr(2, rax); // store c in a
1075 __ push_ptr(rax, rdx); // push c 1039 __ push_ptr(rax); // push c
1076 // stack: ..., c, b, c, c 1040 // stack: ..., c, b, c, c
1077 __ load_ptr_and_tag(2, rax, rdx); // load b 1041 __ load_ptr( 2, rax); // load b
1078 __ store_ptr_and_tag(2, rcx, rbx); // store a in b 1042 __ store_ptr(2, rcx); // store a in b
1079 // stack: ..., c, a, c, c 1043 // stack: ..., c, a, c, c
1080 __ store_ptr_and_tag(1, rax, rdx); // store b in c 1044 __ store_ptr(1, rax); // store b in c
1081 // stack: ..., c, a, b, c 1045 // stack: ..., c, a, b, c
1082 } 1046 }
1083 1047
1084 void TemplateTable::dup2() { 1048 void TemplateTable::dup2() {
1085 transition(vtos, vtos); 1049 transition(vtos, vtos);
1086 // stack: ..., a, b 1050 // stack: ..., a, b
1087 __ load_ptr_and_tag(1, rax, rdx); // load a 1051 __ load_ptr(1, rax); // load a
1088 __ push_ptr(rax, rdx); // push a 1052 __ push_ptr(rax); // push a
1089 __ load_ptr_and_tag(1, rax, rdx); // load b 1053 __ load_ptr(1, rax); // load b
1090 __ push_ptr(rax, rdx); // push b 1054 __ push_ptr(rax); // push b
1091 // stack: ..., a, b, a, b 1055 // stack: ..., a, b, a, b
1092 } 1056 }
1093 1057
1094 void TemplateTable::dup2_x1() { 1058 void TemplateTable::dup2_x1() {
1095 transition(vtos, vtos); 1059 transition(vtos, vtos);
1096 // stack: ..., a, b, c 1060 // stack: ..., a, b, c
1097 __ load_ptr_and_tag(0, rcx, rbx); // load c 1061 __ load_ptr( 0, rcx); // load c
1098 __ load_ptr_and_tag(1, rax, rdx); // load b 1062 __ load_ptr( 1, rax); // load b
1099 __ push_ptr(rax, rdx); // push b 1063 __ push_ptr(rax); // push b
1100 __ push_ptr(rcx, rbx); // push c 1064 __ push_ptr(rcx); // push c
1101 // stack: ..., a, b, c, b, c 1065 // stack: ..., a, b, c, b, c
1102 __ store_ptr_and_tag(3, rcx, rbx); // store c in b 1066 __ store_ptr(3, rcx); // store c in b
1103 // stack: ..., a, c, c, b, c 1067 // stack: ..., a, c, c, b, c
1104 __ load_ptr_and_tag(4, rcx, rbx); // load a 1068 __ load_ptr( 4, rcx); // load a
1105 __ store_ptr_and_tag(2, rcx, rbx); // store a in 2nd c 1069 __ store_ptr(2, rcx); // store a in 2nd c
1106 // stack: ..., a, c, a, b, c 1070 // stack: ..., a, c, a, b, c
1107 __ store_ptr_and_tag(4, rax, rdx); // store b in a 1071 __ store_ptr(4, rax); // store b in a
1108 // stack: ..., b, c, a, b, c 1072 // stack: ..., b, c, a, b, c
1109 } 1073 }
1110 1074
1111 void TemplateTable::dup2_x2() { 1075 void TemplateTable::dup2_x2() {
1112 transition(vtos, vtos); 1076 transition(vtos, vtos);
1113 // stack: ..., a, b, c, d 1077 // stack: ..., a, b, c, d
1114 __ load_ptr_and_tag(0, rcx, rbx); // load d 1078 __ load_ptr( 0, rcx); // load d
1115 __ load_ptr_and_tag(1, rax, rdx); // load c 1079 __ load_ptr( 1, rax); // load c
1116 __ push_ptr(rax, rdx); // push c 1080 __ push_ptr(rax); // push c
1117 __ push_ptr(rcx, rbx); // push d 1081 __ push_ptr(rcx); // push d
1118 // stack: ..., a, b, c, d, c, d 1082 // stack: ..., a, b, c, d, c, d
1119 __ load_ptr_and_tag(4, rax, rdx); // load b 1083 __ load_ptr( 4, rax); // load b
1120 __ store_ptr_and_tag(2, rax, rdx); // store b in d 1084 __ store_ptr(2, rax); // store b in d
1121 __ store_ptr_and_tag(4, rcx, rbx); // store d in b 1085 __ store_ptr(4, rcx); // store d in b
1122 // stack: ..., a, d, c, b, c, d 1086 // stack: ..., a, d, c, b, c, d
1123 __ load_ptr_and_tag(5, rcx, rbx); // load a 1087 __ load_ptr( 5, rcx); // load a
1124 __ load_ptr_and_tag(3, rax, rdx); // load c 1088 __ load_ptr( 3, rax); // load c
1125 __ store_ptr_and_tag(3, rcx, rbx); // store a in c 1089 __ store_ptr(3, rcx); // store a in c
1126 __ store_ptr_and_tag(5, rax, rdx); // store c in a 1090 __ store_ptr(5, rax); // store c in a
1127 // stack: ..., c, d, a, b, c, d 1091 // stack: ..., c, d, a, b, c, d
1128 } 1092 }
1129 1093
1130 void TemplateTable::swap() { 1094 void TemplateTable::swap() {
1131 transition(vtos, vtos); 1095 transition(vtos, vtos);
1132 // stack: ..., a, b 1096 // stack: ..., a, b
1133 __ load_ptr_and_tag(1, rcx, rbx); // load a 1097 __ load_ptr( 1, rcx); // load a
1134 __ load_ptr_and_tag(0, rax, rdx); // load b 1098 __ load_ptr( 0, rax); // load b
1135 __ store_ptr_and_tag(0, rcx, rbx); // store a in b 1099 __ store_ptr(0, rcx); // store a in b
1136 __ store_ptr_and_tag(1, rax, rdx); // store b in a 1100 __ store_ptr(1, rax); // store b in a
1137 // stack: ..., b, a 1101 // stack: ..., b, a
1138 } 1102 }
1139 1103
1140 void TemplateTable::iop2(Operation op) { 1104 void TemplateTable::iop2(Operation op) {
1141 transition(itos, itos); 1105 transition(itos, itos);
1154 } 1118 }
1155 1119
1156 void TemplateTable::lop2(Operation op) { 1120 void TemplateTable::lop2(Operation op) {
1157 transition(ltos, ltos); 1121 transition(ltos, ltos);
1158 switch (op) { 1122 switch (op) {
1159 case add : __ pop_l(rdx); __ addptr (rax, rdx); break; 1123 case add : __ pop_l(rdx); __ addptr(rax, rdx); break;
1160 case sub : __ mov(rdx, rax); __ pop_l(rax); __ subptr (rax, rdx); break; 1124 case sub : __ mov(rdx, rax); __ pop_l(rax); __ subptr(rax, rdx); break;
1161 case _and : __ pop_l(rdx); __ andptr (rax, rdx); break; 1125 case _and : __ pop_l(rdx); __ andptr(rax, rdx); break;
1162 case _or : __ pop_l(rdx); __ orptr (rax, rdx); break; 1126 case _or : __ pop_l(rdx); __ orptr (rax, rdx); break;
1163 case _xor : __ pop_l(rdx); __ xorptr (rax, rdx); break; 1127 case _xor : __ pop_l(rdx); __ xorptr(rax, rdx); break;
1164 default : ShouldNotReachHere(); 1128 default : ShouldNotReachHere();
1165 } 1129 }
1166 } 1130 }
1167 1131
1168 void TemplateTable::idiv() { 1132 void TemplateTable::idiv() {
1169 transition(itos, itos); 1133 transition(itos, itos);
1248 void TemplateTable::fop2(Operation op) { 1212 void TemplateTable::fop2(Operation op) {
1249 transition(ftos, ftos); 1213 transition(ftos, ftos);
1250 switch (op) { 1214 switch (op) {
1251 case add: 1215 case add:
1252 __ addss(xmm0, at_rsp()); 1216 __ addss(xmm0, at_rsp());
1253 __ addptr(rsp, Interpreter::stackElementSize()); 1217 __ addptr(rsp, Interpreter::stackElementSize);
1254 break; 1218 break;
1255 case sub: 1219 case sub:
1256 __ movflt(xmm1, xmm0); 1220 __ movflt(xmm1, xmm0);
1257 __ pop_f(xmm0); 1221 __ pop_f(xmm0);
1258 __ subss(xmm0, xmm1); 1222 __ subss(xmm0, xmm1);
1259 break; 1223 break;
1260 case mul: 1224 case mul:
1261 __ mulss(xmm0, at_rsp()); 1225 __ mulss(xmm0, at_rsp());
1262 __ addptr(rsp, Interpreter::stackElementSize()); 1226 __ addptr(rsp, Interpreter::stackElementSize);
1263 break; 1227 break;
1264 case div: 1228 case div:
1265 __ movflt(xmm1, xmm0); 1229 __ movflt(xmm1, xmm0);
1266 __ pop_f(xmm0); 1230 __ pop_f(xmm0);
1267 __ divss(xmm0, xmm1); 1231 __ divss(xmm0, xmm1);
1280 void TemplateTable::dop2(Operation op) { 1244 void TemplateTable::dop2(Operation op) {
1281 transition(dtos, dtos); 1245 transition(dtos, dtos);
1282 switch (op) { 1246 switch (op) {
1283 case add: 1247 case add:
1284 __ addsd(xmm0, at_rsp()); 1248 __ addsd(xmm0, at_rsp());
1285 __ addptr(rsp, 2 * Interpreter::stackElementSize()); 1249 __ addptr(rsp, 2 * Interpreter::stackElementSize);
1286 break; 1250 break;
1287 case sub: 1251 case sub:
1288 __ movdbl(xmm1, xmm0); 1252 __ movdbl(xmm1, xmm0);
1289 __ pop_d(xmm0); 1253 __ pop_d(xmm0);
1290 __ subsd(xmm0, xmm1); 1254 __ subsd(xmm0, xmm1);
1291 break; 1255 break;
1292 case mul: 1256 case mul:
1293 __ mulsd(xmm0, at_rsp()); 1257 __ mulsd(xmm0, at_rsp());
1294 __ addptr(rsp, 2 * Interpreter::stackElementSize()); 1258 __ addptr(rsp, 2 * Interpreter::stackElementSize);
1295 break; 1259 break;
1296 case div: 1260 case div:
1297 __ movdbl(xmm1, xmm0); 1261 __ movdbl(xmm1, xmm0);
1298 __ pop_d(xmm0); 1262 __ pop_d(xmm0);
1299 __ divsd(xmm0, xmm1); 1263 __ divsd(xmm0, xmm1);
2780 void TemplateTable::fast_xaccess(TosState state) { 2744 void TemplateTable::fast_xaccess(TosState state) {
2781 transition(vtos, state); 2745 transition(vtos, state);
2782 2746
2783 // get receiver 2747 // get receiver
2784 __ movptr(rax, aaddress(0)); 2748 __ movptr(rax, aaddress(0));
2785 debug_only(__ verify_local_tag(frame::TagReference, 0));
2786 // access constant pool cache 2749 // access constant pool cache
2787 __ get_cache_and_index_at_bcp(rcx, rdx, 2); 2750 __ get_cache_and_index_at_bcp(rcx, rdx, 2);
2788 __ movptr(rbx, 2751 __ movptr(rbx,
2789 Address(rcx, rdx, Address::times_8, 2752 Address(rcx, rdx, Address::times_8,
2790 in_bytes(constantPoolCacheOopDesc::base_offset() + 2753 in_bytes(constantPoolCacheOopDesc::base_offset() +
2856 2819
2857 // load receiver if needed (note: no return address pushed yet) 2820 // load receiver if needed (note: no return address pushed yet)
2858 if (load_receiver) { 2821 if (load_receiver) {
2859 __ movl(recv, flags); 2822 __ movl(recv, flags);
2860 __ andl(recv, 0xFF); 2823 __ andl(recv, 0xFF);
2861 if (TaggedStackInterpreter) __ shll(recv, 1); // index*2
2862 Address recv_addr(rsp, recv, Address::times_8, -Interpreter::expr_offset_in_bytes(1)); 2824 Address recv_addr(rsp, recv, Address::times_8, -Interpreter::expr_offset_in_bytes(1));
2863 __ movptr(recv, recv_addr); 2825 __ movptr(recv, recv_addr);
2864 __ verify_oop(recv); 2826 __ verify_oop(recv);
2865 } 2827 }
2866 2828
3608 void TemplateTable::multianewarray() { 3570 void TemplateTable::multianewarray() {
3609 transition(vtos, atos); 3571 transition(vtos, atos);
3610 __ load_unsigned_byte(rax, at_bcp(3)); // get number of dimensions 3572 __ load_unsigned_byte(rax, at_bcp(3)); // get number of dimensions
3611 // last dim is on top of stack; we want address of first one: 3573 // last dim is on top of stack; we want address of first one:
3612 // first_addr = last_addr + (ndims - 1) * wordSize 3574 // first_addr = last_addr + (ndims - 1) * wordSize
3613 if (TaggedStackInterpreter) __ shll(rax, 1); // index*2
3614 __ lea(c_rarg1, Address(rsp, rax, Address::times_8, -wordSize)); 3575 __ lea(c_rarg1, Address(rsp, rax, Address::times_8, -wordSize));
3615 call_VM(rax, 3576 call_VM(rax,
3616 CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray), 3577 CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray),
3617 c_rarg1); 3578 c_rarg1);
3618 __ load_unsigned_byte(rbx, at_bcp(3)); 3579 __ load_unsigned_byte(rbx, at_bcp(3));
3619 if (TaggedStackInterpreter) __ shll(rbx, 1); // index*2
3620 __ lea(rsp, Address(rsp, rbx, Address::times_8)); 3580 __ lea(rsp, Address(rsp, rbx, Address::times_8));
3621 } 3581 }
3622 #endif // !CC_INTERP 3582 #endif // !CC_INTERP