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 |
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); |
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); |