Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/templateTable_x86_32.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 |
---|---|
48 static inline Address faddress(int n) { return iaddress(n); } | 48 static inline Address faddress(int n) { return iaddress(n); } |
49 static inline Address daddress(int n) { return laddress(n); } | 49 static inline Address daddress(int n) { return laddress(n); } |
50 static inline Address aaddress(int n) { return iaddress(n); } | 50 static inline Address aaddress(int n) { return iaddress(n); } |
51 | 51 |
52 static inline Address iaddress(Register r) { | 52 static inline Address iaddress(Register r) { |
53 return Address(rdi, r, Interpreter::stackElementScale(), Interpreter::value_offset_in_bytes()); | 53 return Address(rdi, r, Interpreter::stackElementScale()); |
54 } | 54 } |
55 static inline Address laddress(Register r) { | 55 static inline Address laddress(Register r) { |
56 return Address(rdi, r, Interpreter::stackElementScale(), Interpreter::local_offset_in_bytes(1)); | 56 return Address(rdi, r, Interpreter::stackElementScale(), Interpreter::local_offset_in_bytes(1)); |
57 } | 57 } |
58 static inline Address haddress(Register r) { | 58 static inline Address haddress(Register r) { |
59 return Address(rdi, r, Interpreter::stackElementScale(), Interpreter::local_offset_in_bytes(0)); | 59 return Address(rdi, r, Interpreter::stackElementScale(), Interpreter::local_offset_in_bytes(0)); |
60 } | 60 } |
61 | 61 |
62 static inline Address faddress(Register r) { return iaddress(r); }; | 62 static inline Address faddress(Register r) { return iaddress(r); } |
63 static inline Address daddress(Register r) { | 63 static inline Address daddress(Register r) { return laddress(r); } |
64 assert(!TaggedStackInterpreter, "This doesn't work"); | 64 static inline Address aaddress(Register r) { return iaddress(r); } |
65 return laddress(r); | |
66 }; | |
67 static inline Address aaddress(Register r) { return iaddress(r); }; | |
68 | 65 |
69 // expression stack | 66 // expression stack |
70 // (Note: Must not use symmetric equivalents at_rsp_m1/2 since they store | 67 // (Note: Must not use symmetric equivalents at_rsp_m1/2 since they store |
71 // data beyond the rsp which is potentially unsafe in an MT environment; | 68 // data beyond the rsp which is potentially unsafe in an MT environment; |
72 // an interrupt may overwrite that data.) | 69 // an interrupt may overwrite that data.) |
446 } | 443 } |
447 | 444 |
448 // Get the local value into tos | 445 // Get the local value into tos |
449 locals_index(rbx); | 446 locals_index(rbx); |
450 __ movl(rax, iaddress(rbx)); | 447 __ movl(rax, iaddress(rbx)); |
451 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
452 } | 448 } |
453 | 449 |
454 | 450 |
455 void TemplateTable::fast_iload2() { | 451 void TemplateTable::fast_iload2() { |
456 transition(vtos, itos); | 452 transition(vtos, itos); |
457 locals_index(rbx); | 453 locals_index(rbx); |
458 __ movl(rax, iaddress(rbx)); | 454 __ movl(rax, iaddress(rbx)); |
459 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
460 __ push(itos); | 455 __ push(itos); |
461 locals_index(rbx, 3); | 456 locals_index(rbx, 3); |
462 __ movl(rax, iaddress(rbx)); | 457 __ movl(rax, iaddress(rbx)); |
463 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
464 } | 458 } |
465 | 459 |
466 void TemplateTable::fast_iload() { | 460 void TemplateTable::fast_iload() { |
467 transition(vtos, itos); | 461 transition(vtos, itos); |
468 locals_index(rbx); | 462 locals_index(rbx); |
469 __ movl(rax, iaddress(rbx)); | 463 __ movl(rax, iaddress(rbx)); |
470 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
471 } | 464 } |
472 | 465 |
473 | 466 |
474 void TemplateTable::lload() { | 467 void TemplateTable::lload() { |
475 transition(vtos, ltos); | 468 transition(vtos, ltos); |
476 locals_index(rbx); | 469 locals_index(rbx); |
477 __ movptr(rax, laddress(rbx)); | 470 __ movptr(rax, laddress(rbx)); |
478 NOT_LP64(__ movl(rdx, haddress(rbx))); | 471 NOT_LP64(__ movl(rdx, haddress(rbx))); |
479 debug_only(__ verify_local_tag(frame::TagCategory2, rbx)); | |
480 } | 472 } |
481 | 473 |
482 | 474 |
483 void TemplateTable::fload() { | 475 void TemplateTable::fload() { |
484 transition(vtos, ftos); | 476 transition(vtos, ftos); |
485 locals_index(rbx); | 477 locals_index(rbx); |
486 __ fld_s(faddress(rbx)); | 478 __ fld_s(faddress(rbx)); |
487 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
488 } | 479 } |
489 | 480 |
490 | 481 |
491 void TemplateTable::dload() { | 482 void TemplateTable::dload() { |
492 transition(vtos, dtos); | 483 transition(vtos, dtos); |
493 locals_index(rbx); | 484 locals_index(rbx); |
494 if (TaggedStackInterpreter) { | 485 __ fld_d(daddress(rbx)); |
495 // Get double out of locals array, onto temp stack and load with | |
496 // float instruction into ST0 | |
497 __ movl(rax, laddress(rbx)); | |
498 __ movl(rdx, haddress(rbx)); | |
499 __ push(rdx); // push hi first | |
500 __ push(rax); | |
501 __ fld_d(Address(rsp, 0)); | |
502 __ addptr(rsp, 2*wordSize); | |
503 debug_only(__ verify_local_tag(frame::TagCategory2, rbx)); | |
504 } else { | |
505 __ fld_d(daddress(rbx)); | |
506 } | |
507 } | 486 } |
508 | 487 |
509 | 488 |
510 void TemplateTable::aload() { | 489 void TemplateTable::aload() { |
511 transition(vtos, atos); | 490 transition(vtos, atos); |
512 locals_index(rbx); | 491 locals_index(rbx); |
513 __ movptr(rax, aaddress(rbx)); | 492 __ movptr(rax, aaddress(rbx)); |
514 debug_only(__ verify_local_tag(frame::TagReference, rbx)); | |
515 } | 493 } |
516 | 494 |
517 | 495 |
518 void TemplateTable::locals_index_wide(Register reg) { | 496 void TemplateTable::locals_index_wide(Register reg) { |
519 __ movl(reg, at_bcp(2)); | 497 __ movl(reg, at_bcp(2)); |
525 | 503 |
526 void TemplateTable::wide_iload() { | 504 void TemplateTable::wide_iload() { |
527 transition(vtos, itos); | 505 transition(vtos, itos); |
528 locals_index_wide(rbx); | 506 locals_index_wide(rbx); |
529 __ movl(rax, iaddress(rbx)); | 507 __ movl(rax, iaddress(rbx)); |
530 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
531 } | 508 } |
532 | 509 |
533 | 510 |
534 void TemplateTable::wide_lload() { | 511 void TemplateTable::wide_lload() { |
535 transition(vtos, ltos); | 512 transition(vtos, ltos); |
536 locals_index_wide(rbx); | 513 locals_index_wide(rbx); |
537 __ movptr(rax, laddress(rbx)); | 514 __ movptr(rax, laddress(rbx)); |
538 NOT_LP64(__ movl(rdx, haddress(rbx))); | 515 NOT_LP64(__ movl(rdx, haddress(rbx))); |
539 debug_only(__ verify_local_tag(frame::TagCategory2, rbx)); | |
540 } | 516 } |
541 | 517 |
542 | 518 |
543 void TemplateTable::wide_fload() { | 519 void TemplateTable::wide_fload() { |
544 transition(vtos, ftos); | 520 transition(vtos, ftos); |
545 locals_index_wide(rbx); | 521 locals_index_wide(rbx); |
546 __ fld_s(faddress(rbx)); | 522 __ fld_s(faddress(rbx)); |
547 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
548 } | 523 } |
549 | 524 |
550 | 525 |
551 void TemplateTable::wide_dload() { | 526 void TemplateTable::wide_dload() { |
552 transition(vtos, dtos); | 527 transition(vtos, dtos); |
553 locals_index_wide(rbx); | 528 locals_index_wide(rbx); |
554 if (TaggedStackInterpreter) { | 529 __ fld_d(daddress(rbx)); |
555 // Get double out of locals array, onto temp stack and load with | |
556 // float instruction into ST0 | |
557 __ movl(rax, laddress(rbx)); | |
558 __ movl(rdx, haddress(rbx)); | |
559 __ push(rdx); // push hi first | |
560 __ push(rax); | |
561 __ fld_d(Address(rsp, 0)); | |
562 __ addl(rsp, 2*wordSize); | |
563 debug_only(__ verify_local_tag(frame::TagCategory2, rbx)); | |
564 } else { | |
565 __ fld_d(daddress(rbx)); | |
566 } | |
567 } | 530 } |
568 | 531 |
569 | 532 |
570 void TemplateTable::wide_aload() { | 533 void TemplateTable::wide_aload() { |
571 transition(vtos, atos); | 534 transition(vtos, atos); |
572 locals_index_wide(rbx); | 535 locals_index_wide(rbx); |
573 __ movptr(rax, aaddress(rbx)); | 536 __ movptr(rax, aaddress(rbx)); |
574 debug_only(__ verify_local_tag(frame::TagReference, rbx)); | |
575 } | 537 } |
576 | 538 |
577 void TemplateTable::index_check(Register array, Register index) { | 539 void TemplateTable::index_check(Register array, Register index) { |
578 // Pop ptr into array | 540 // Pop ptr into array |
579 __ pop_ptr(array); | 541 __ pop_ptr(array); |
670 void TemplateTable::fast_icaload() { | 632 void TemplateTable::fast_icaload() { |
671 transition(vtos, itos); | 633 transition(vtos, itos); |
672 // load index out of locals | 634 // load index out of locals |
673 locals_index(rbx); | 635 locals_index(rbx); |
674 __ movl(rax, iaddress(rbx)); | 636 __ movl(rax, iaddress(rbx)); |
675 debug_only(__ verify_local_tag(frame::TagValue, rbx)); | |
676 | 637 |
677 // rdx: array | 638 // rdx: array |
678 index_check(rdx, rax); | 639 index_check(rdx, rax); |
679 // rax,: index | 640 // rax,: index |
680 __ load_unsigned_short(rbx, Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | 641 __ load_unsigned_short(rbx, Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); |
693 | 654 |
694 | 655 |
695 void TemplateTable::iload(int n) { | 656 void TemplateTable::iload(int n) { |
696 transition(vtos, itos); | 657 transition(vtos, itos); |
697 __ movl(rax, iaddress(n)); | 658 __ movl(rax, iaddress(n)); |
698 debug_only(__ verify_local_tag(frame::TagValue, n)); | |
699 } | 659 } |
700 | 660 |
701 | 661 |
702 void TemplateTable::lload(int n) { | 662 void TemplateTable::lload(int n) { |
703 transition(vtos, ltos); | 663 transition(vtos, ltos); |
704 __ movptr(rax, laddress(n)); | 664 __ movptr(rax, laddress(n)); |
705 NOT_LP64(__ movptr(rdx, haddress(n))); | 665 NOT_LP64(__ movptr(rdx, haddress(n))); |
706 debug_only(__ verify_local_tag(frame::TagCategory2, n)); | |
707 } | 666 } |
708 | 667 |
709 | 668 |
710 void TemplateTable::fload(int n) { | 669 void TemplateTable::fload(int n) { |
711 transition(vtos, ftos); | 670 transition(vtos, ftos); |
712 __ fld_s(faddress(n)); | 671 __ fld_s(faddress(n)); |
713 debug_only(__ verify_local_tag(frame::TagValue, n)); | |
714 } | 672 } |
715 | 673 |
716 | 674 |
717 void TemplateTable::dload(int n) { | 675 void TemplateTable::dload(int n) { |
718 transition(vtos, dtos); | 676 transition(vtos, dtos); |
719 if (TaggedStackInterpreter) { | 677 __ fld_d(daddress(n)); |
720 // Get double out of locals array, onto temp stack and load with | |
721 // float instruction into ST0 | |
722 __ movl(rax, laddress(n)); | |
723 __ movl(rdx, haddress(n)); | |
724 __ push(rdx); // push hi first | |
725 __ push(rax); | |
726 __ fld_d(Address(rsp, 0)); | |
727 __ addptr(rsp, 2*wordSize); // reset rsp | |
728 debug_only(__ verify_local_tag(frame::TagCategory2, n)); | |
729 } else { | |
730 __ fld_d(daddress(n)); | |
731 } | |
732 } | 678 } |
733 | 679 |
734 | 680 |
735 void TemplateTable::aload(int n) { | 681 void TemplateTable::aload(int n) { |
736 transition(vtos, atos); | 682 transition(vtos, atos); |
737 __ movptr(rax, aaddress(n)); | 683 __ movptr(rax, aaddress(n)); |
738 debug_only(__ verify_local_tag(frame::TagReference, n)); | |
739 } | 684 } |
740 | 685 |
741 | 686 |
742 void TemplateTable::aload_0() { | 687 void TemplateTable::aload_0() { |
743 transition(vtos, atos); | 688 transition(vtos, atos); |
807 | 752 |
808 void TemplateTable::istore() { | 753 void TemplateTable::istore() { |
809 transition(itos, vtos); | 754 transition(itos, vtos); |
810 locals_index(rbx); | 755 locals_index(rbx); |
811 __ movl(iaddress(rbx), rax); | 756 __ movl(iaddress(rbx), rax); |
812 __ tag_local(frame::TagValue, rbx); | |
813 } | 757 } |
814 | 758 |
815 | 759 |
816 void TemplateTable::lstore() { | 760 void TemplateTable::lstore() { |
817 transition(ltos, vtos); | 761 transition(ltos, vtos); |
818 locals_index(rbx); | 762 locals_index(rbx); |
819 __ movptr(laddress(rbx), rax); | 763 __ movptr(laddress(rbx), rax); |
820 NOT_LP64(__ movptr(haddress(rbx), rdx)); | 764 NOT_LP64(__ movptr(haddress(rbx), rdx)); |
821 __ tag_local(frame::TagCategory2, rbx); | |
822 } | 765 } |
823 | 766 |
824 | 767 |
825 void TemplateTable::fstore() { | 768 void TemplateTable::fstore() { |
826 transition(ftos, vtos); | 769 transition(ftos, vtos); |
827 locals_index(rbx); | 770 locals_index(rbx); |
828 __ fstp_s(faddress(rbx)); | 771 __ fstp_s(faddress(rbx)); |
829 __ tag_local(frame::TagValue, rbx); | |
830 } | 772 } |
831 | 773 |
832 | 774 |
833 void TemplateTable::dstore() { | 775 void TemplateTable::dstore() { |
834 transition(dtos, vtos); | 776 transition(dtos, vtos); |
835 locals_index(rbx); | 777 locals_index(rbx); |
836 if (TaggedStackInterpreter) { | 778 __ fstp_d(daddress(rbx)); |
837 // Store double on stack and reload into locals nonadjacently | |
838 __ subptr(rsp, 2 * wordSize); | |
839 __ fstp_d(Address(rsp, 0)); | |
840 __ pop(rax); | |
841 __ pop(rdx); | |
842 __ movptr(laddress(rbx), rax); | |
843 __ movptr(haddress(rbx), rdx); | |
844 __ tag_local(frame::TagCategory2, rbx); | |
845 } else { | |
846 __ fstp_d(daddress(rbx)); | |
847 } | |
848 } | 779 } |
849 | 780 |
850 | 781 |
851 void TemplateTable::astore() { | 782 void TemplateTable::astore() { |
852 transition(vtos, vtos); | 783 transition(vtos, vtos); |
853 __ pop_ptr(rax, rdx); // will need to pop tag too | 784 __ pop_ptr(rax); |
854 locals_index(rbx); | 785 locals_index(rbx); |
855 __ movptr(aaddress(rbx), rax); | 786 __ movptr(aaddress(rbx), rax); |
856 __ tag_local(rdx, rbx); // need to store same tag in local may be returnAddr | |
857 } | 787 } |
858 | 788 |
859 | 789 |
860 void TemplateTable::wide_istore() { | 790 void TemplateTable::wide_istore() { |
861 transition(vtos, vtos); | 791 transition(vtos, vtos); |
862 __ pop_i(rax); | 792 __ pop_i(rax); |
863 locals_index_wide(rbx); | 793 locals_index_wide(rbx); |
864 __ movl(iaddress(rbx), rax); | 794 __ movl(iaddress(rbx), rax); |
865 __ tag_local(frame::TagValue, rbx); | |
866 } | 795 } |
867 | 796 |
868 | 797 |
869 void TemplateTable::wide_lstore() { | 798 void TemplateTable::wide_lstore() { |
870 transition(vtos, vtos); | 799 transition(vtos, vtos); |
871 __ pop_l(rax, rdx); | 800 __ pop_l(rax, rdx); |
872 locals_index_wide(rbx); | 801 locals_index_wide(rbx); |
873 __ movptr(laddress(rbx), rax); | 802 __ movptr(laddress(rbx), rax); |
874 NOT_LP64(__ movl(haddress(rbx), rdx)); | 803 NOT_LP64(__ movl(haddress(rbx), rdx)); |
875 __ tag_local(frame::TagCategory2, rbx); | |
876 } | 804 } |
877 | 805 |
878 | 806 |
879 void TemplateTable::wide_fstore() { | 807 void TemplateTable::wide_fstore() { |
880 wide_istore(); | 808 wide_istore(); |
886 } | 814 } |
887 | 815 |
888 | 816 |
889 void TemplateTable::wide_astore() { | 817 void TemplateTable::wide_astore() { |
890 transition(vtos, vtos); | 818 transition(vtos, vtos); |
891 __ pop_ptr(rax, rdx); | 819 __ pop_ptr(rax); |
892 locals_index_wide(rbx); | 820 locals_index_wide(rbx); |
893 __ movptr(aaddress(rbx), rax); | 821 __ movptr(aaddress(rbx), rax); |
894 __ tag_local(rdx, rbx); | |
895 } | 822 } |
896 | 823 |
897 | 824 |
898 void TemplateTable::iastore() { | 825 void TemplateTable::iastore() { |
899 transition(itos, vtos); | 826 transition(itos, vtos); |
988 // Store NULL, (noreg means NULL to do_oop_store) | 915 // Store NULL, (noreg means NULL to do_oop_store) |
989 do_oop_store(_masm, element_address, noreg, _bs->kind(), true); | 916 do_oop_store(_masm, element_address, noreg, _bs->kind(), true); |
990 | 917 |
991 // Pop stack arguments | 918 // Pop stack arguments |
992 __ bind(done); | 919 __ bind(done); |
993 __ addptr(rsp, 3 * Interpreter::stackElementSize()); | 920 __ addptr(rsp, 3 * Interpreter::stackElementSize); |
994 } | 921 } |
995 | 922 |
996 | 923 |
997 void TemplateTable::bastore() { | 924 void TemplateTable::bastore() { |
998 transition(itos, vtos); | 925 transition(itos, vtos); |
1022 | 949 |
1023 | 950 |
1024 void TemplateTable::istore(int n) { | 951 void TemplateTable::istore(int n) { |
1025 transition(itos, vtos); | 952 transition(itos, vtos); |
1026 __ movl(iaddress(n), rax); | 953 __ movl(iaddress(n), rax); |
1027 __ tag_local(frame::TagValue, n); | |
1028 } | 954 } |
1029 | 955 |
1030 | 956 |
1031 void TemplateTable::lstore(int n) { | 957 void TemplateTable::lstore(int n) { |
1032 transition(ltos, vtos); | 958 transition(ltos, vtos); |
1033 __ movptr(laddress(n), rax); | 959 __ movptr(laddress(n), rax); |
1034 NOT_LP64(__ movptr(haddress(n), rdx)); | 960 NOT_LP64(__ movptr(haddress(n), rdx)); |
1035 __ tag_local(frame::TagCategory2, n); | |
1036 } | 961 } |
1037 | 962 |
1038 | 963 |
1039 void TemplateTable::fstore(int n) { | 964 void TemplateTable::fstore(int n) { |
1040 transition(ftos, vtos); | 965 transition(ftos, vtos); |
1041 __ fstp_s(faddress(n)); | 966 __ fstp_s(faddress(n)); |
1042 __ tag_local(frame::TagValue, n); | |
1043 } | 967 } |
1044 | 968 |
1045 | 969 |
1046 void TemplateTable::dstore(int n) { | 970 void TemplateTable::dstore(int n) { |
1047 transition(dtos, vtos); | 971 transition(dtos, vtos); |
1048 if (TaggedStackInterpreter) { | 972 __ fstp_d(daddress(n)); |
1049 __ subptr(rsp, 2 * wordSize); | |
1050 __ fstp_d(Address(rsp, 0)); | |
1051 __ pop(rax); | |
1052 __ pop(rdx); | |
1053 __ movl(laddress(n), rax); | |
1054 __ movl(haddress(n), rdx); | |
1055 __ tag_local(frame::TagCategory2, n); | |
1056 } else { | |
1057 __ fstp_d(daddress(n)); | |
1058 } | |
1059 } | 973 } |
1060 | 974 |
1061 | 975 |
1062 void TemplateTable::astore(int n) { | 976 void TemplateTable::astore(int n) { |
1063 transition(vtos, vtos); | 977 transition(vtos, vtos); |
1064 __ pop_ptr(rax, rdx); | 978 __ pop_ptr(rax); |
1065 __ movptr(aaddress(n), rax); | 979 __ movptr(aaddress(n), rax); |
1066 __ tag_local(rdx, n); | |
1067 } | 980 } |
1068 | 981 |
1069 | 982 |
1070 void TemplateTable::pop() { | 983 void TemplateTable::pop() { |
1071 transition(vtos, vtos); | 984 transition(vtos, vtos); |
1072 __ addptr(rsp, Interpreter::stackElementSize()); | 985 __ addptr(rsp, Interpreter::stackElementSize); |
1073 } | 986 } |
1074 | 987 |
1075 | 988 |
1076 void TemplateTable::pop2() { | 989 void TemplateTable::pop2() { |
1077 transition(vtos, vtos); | 990 transition(vtos, vtos); |
1078 __ addptr(rsp, 2*Interpreter::stackElementSize()); | 991 __ addptr(rsp, 2*Interpreter::stackElementSize); |
1079 } | 992 } |
1080 | 993 |
1081 | 994 |
1082 void TemplateTable::dup() { | 995 void TemplateTable::dup() { |
1083 transition(vtos, vtos); | 996 transition(vtos, vtos); |
1084 // stack: ..., a | 997 // stack: ..., a |
1085 __ load_ptr_and_tag(0, rax, rdx); | 998 __ load_ptr(0, rax); |
1086 __ push_ptr(rax, rdx); | 999 __ push_ptr(rax); |
1087 // stack: ..., a, a | 1000 // stack: ..., a, a |
1088 } | 1001 } |
1089 | 1002 |
1090 | 1003 |
1091 void TemplateTable::dup_x1() { | 1004 void TemplateTable::dup_x1() { |
1092 transition(vtos, vtos); | 1005 transition(vtos, vtos); |
1093 // stack: ..., a, b | 1006 // stack: ..., a, b |
1094 __ load_ptr_and_tag(0, rax, rdx); // load b | 1007 __ load_ptr( 0, rax); // load b |
1095 __ load_ptr_and_tag(1, rcx, rbx); // load a | 1008 __ load_ptr( 1, rcx); // load a |
1096 __ store_ptr_and_tag(1, rax, rdx); // store b | 1009 __ store_ptr(1, rax); // store b |
1097 __ store_ptr_and_tag(0, rcx, rbx); // store a | 1010 __ store_ptr(0, rcx); // store a |
1098 __ push_ptr(rax, rdx); // push b | 1011 __ push_ptr(rax); // push b |
1099 // stack: ..., b, a, b | 1012 // stack: ..., b, a, b |
1100 } | 1013 } |
1101 | 1014 |
1102 | 1015 |
1103 void TemplateTable::dup_x2() { | 1016 void TemplateTable::dup_x2() { |
1104 transition(vtos, vtos); | 1017 transition(vtos, vtos); |
1105 // stack: ..., a, b, c | 1018 // stack: ..., a, b, c |
1106 __ load_ptr_and_tag(0, rax, rdx); // load c | 1019 __ load_ptr( 0, rax); // load c |
1107 __ load_ptr_and_tag(2, rcx, rbx); // load a | 1020 __ load_ptr( 2, rcx); // load a |
1108 __ store_ptr_and_tag(2, rax, rdx); // store c in a | 1021 __ store_ptr(2, rax); // store c in a |
1109 __ push_ptr(rax, rdx); // push c | 1022 __ push_ptr(rax); // push c |
1110 // stack: ..., c, b, c, c | 1023 // stack: ..., c, b, c, c |
1111 __ load_ptr_and_tag(2, rax, rdx); // load b | 1024 __ load_ptr( 2, rax); // load b |
1112 __ store_ptr_and_tag(2, rcx, rbx); // store a in b | 1025 __ store_ptr(2, rcx); // store a in b |
1113 // stack: ..., c, a, c, c | 1026 // stack: ..., c, a, c, c |
1114 __ store_ptr_and_tag(1, rax, rdx); // store b in c | 1027 __ store_ptr(1, rax); // store b in c |
1115 // stack: ..., c, a, b, c | 1028 // stack: ..., c, a, b, c |
1116 } | 1029 } |
1117 | 1030 |
1118 | 1031 |
1119 void TemplateTable::dup2() { | 1032 void TemplateTable::dup2() { |
1120 transition(vtos, vtos); | 1033 transition(vtos, vtos); |
1121 // stack: ..., a, b | 1034 // stack: ..., a, b |
1122 __ load_ptr_and_tag(1, rax, rdx); // load a | 1035 __ load_ptr(1, rax); // load a |
1123 __ push_ptr(rax, rdx); // push a | 1036 __ push_ptr(rax); // push a |
1124 __ load_ptr_and_tag(1, rax, rdx); // load b | 1037 __ load_ptr(1, rax); // load b |
1125 __ push_ptr(rax, rdx); // push b | 1038 __ push_ptr(rax); // push b |
1126 // stack: ..., a, b, a, b | 1039 // stack: ..., a, b, a, b |
1127 } | 1040 } |
1128 | 1041 |
1129 | 1042 |
1130 void TemplateTable::dup2_x1() { | 1043 void TemplateTable::dup2_x1() { |
1131 transition(vtos, vtos); | 1044 transition(vtos, vtos); |
1132 // stack: ..., a, b, c | 1045 // stack: ..., a, b, c |
1133 __ load_ptr_and_tag(0, rcx, rbx); // load c | 1046 __ load_ptr( 0, rcx); // load c |
1134 __ load_ptr_and_tag(1, rax, rdx); // load b | 1047 __ load_ptr( 1, rax); // load b |
1135 __ push_ptr(rax, rdx); // push b | 1048 __ push_ptr(rax); // push b |
1136 __ push_ptr(rcx, rbx); // push c | 1049 __ push_ptr(rcx); // push c |
1137 // stack: ..., a, b, c, b, c | 1050 // stack: ..., a, b, c, b, c |
1138 __ store_ptr_and_tag(3, rcx, rbx); // store c in b | 1051 __ store_ptr(3, rcx); // store c in b |
1139 // stack: ..., a, c, c, b, c | 1052 // stack: ..., a, c, c, b, c |
1140 __ load_ptr_and_tag(4, rcx, rbx); // load a | 1053 __ load_ptr( 4, rcx); // load a |
1141 __ store_ptr_and_tag(2, rcx, rbx); // store a in 2nd c | 1054 __ store_ptr(2, rcx); // store a in 2nd c |
1142 // stack: ..., a, c, a, b, c | 1055 // stack: ..., a, c, a, b, c |
1143 __ store_ptr_and_tag(4, rax, rdx); // store b in a | 1056 __ store_ptr(4, rax); // store b in a |
1144 // stack: ..., b, c, a, b, c | 1057 // stack: ..., b, c, a, b, c |
1145 // stack: ..., b, c, a, b, c | 1058 // stack: ..., b, c, a, b, c |
1146 } | 1059 } |
1147 | 1060 |
1148 | 1061 |
1149 void TemplateTable::dup2_x2() { | 1062 void TemplateTable::dup2_x2() { |
1150 transition(vtos, vtos); | 1063 transition(vtos, vtos); |
1151 // stack: ..., a, b, c, d | 1064 // stack: ..., a, b, c, d |
1152 __ load_ptr_and_tag(0, rcx, rbx); // load d | 1065 __ load_ptr( 0, rcx); // load d |
1153 __ load_ptr_and_tag(1, rax, rdx); // load c | 1066 __ load_ptr( 1, rax); // load c |
1154 __ push_ptr(rax, rdx); // push c | 1067 __ push_ptr(rax); // push c |
1155 __ push_ptr(rcx, rbx); // push d | 1068 __ push_ptr(rcx); // push d |
1156 // stack: ..., a, b, c, d, c, d | 1069 // stack: ..., a, b, c, d, c, d |
1157 __ load_ptr_and_tag(4, rax, rdx); // load b | 1070 __ load_ptr( 4, rax); // load b |
1158 __ store_ptr_and_tag(2, rax, rdx); // store b in d | 1071 __ store_ptr(2, rax); // store b in d |
1159 __ store_ptr_and_tag(4, rcx, rbx); // store d in b | 1072 __ store_ptr(4, rcx); // store d in b |
1160 // stack: ..., a, d, c, b, c, d | 1073 // stack: ..., a, d, c, b, c, d |
1161 __ load_ptr_and_tag(5, rcx, rbx); // load a | 1074 __ load_ptr( 5, rcx); // load a |
1162 __ load_ptr_and_tag(3, rax, rdx); // load c | 1075 __ load_ptr( 3, rax); // load c |
1163 __ store_ptr_and_tag(3, rcx, rbx); // store a in c | 1076 __ store_ptr(3, rcx); // store a in c |
1164 __ store_ptr_and_tag(5, rax, rdx); // store c in a | 1077 __ store_ptr(5, rax); // store c in a |
1165 // stack: ..., c, d, a, b, c, d | 1078 // stack: ..., c, d, a, b, c, d |
1166 // stack: ..., c, d, a, b, c, d | 1079 // stack: ..., c, d, a, b, c, d |
1167 } | 1080 } |
1168 | 1081 |
1169 | 1082 |
1170 void TemplateTable::swap() { | 1083 void TemplateTable::swap() { |
1171 transition(vtos, vtos); | 1084 transition(vtos, vtos); |
1172 // stack: ..., a, b | 1085 // stack: ..., a, b |
1173 __ load_ptr_and_tag(1, rcx, rbx); // load a | 1086 __ load_ptr( 1, rcx); // load a |
1174 __ load_ptr_and_tag(0, rax, rdx); // load b | 1087 __ load_ptr( 0, rax); // load b |
1175 __ store_ptr_and_tag(0, rcx, rbx); // store a in b | 1088 __ store_ptr(0, rcx); // store a in b |
1176 __ store_ptr_and_tag(1, rax, rdx); // store b in a | 1089 __ store_ptr(1, rax); // store b in a |
1177 // stack: ..., b, a | 1090 // stack: ..., b, a |
1178 } | 1091 } |
1179 | 1092 |
1180 | 1093 |
1181 void TemplateTable::iop2(Operation op) { | 1094 void TemplateTable::iop2(Operation op) { |
1182 transition(itos, itos); | 1095 transition(itos, itos); |
1183 switch (op) { | 1096 switch (op) { |
1184 case add : __ pop_i(rdx); __ addl (rax, rdx); break; | 1097 case add : __ pop_i(rdx); __ addl (rax, rdx); break; |
1185 case sub : __ mov(rdx, rax); __ pop_i(rax); __ subl (rax, rdx); break; | 1098 case sub : __ mov(rdx, rax); __ pop_i(rax); __ subl (rax, rdx); break; |
1186 case mul : __ pop_i(rdx); __ imull(rax, rdx); break; | 1099 case mul : __ pop_i(rdx); __ imull(rax, rdx); break; |
1187 case _and : __ pop_i(rdx); __ andl (rax, rdx); break; | 1100 case _and : __ pop_i(rdx); __ andl (rax, rdx); break; |
1188 case _or : __ pop_i(rdx); __ orl (rax, rdx); break; | 1101 case _or : __ pop_i(rdx); __ orl (rax, rdx); break; |
1189 case _xor : __ pop_i(rdx); __ xorl (rax, rdx); break; | 1102 case _xor : __ pop_i(rdx); __ xorl (rax, rdx); break; |
1190 case shl : __ mov(rcx, rax); __ pop_i(rax); __ shll (rax); break; // implicit masking of lower 5 bits by Intel shift instr. | 1103 case shl : __ mov(rcx, rax); __ pop_i(rax); __ shll (rax); break; // implicit masking of lower 5 bits by Intel shift instr. |
1191 case shr : __ mov(rcx, rax); __ pop_i(rax); __ sarl (rax); break; // implicit masking of lower 5 bits by Intel shift instr. | 1104 case shr : __ mov(rcx, rax); __ pop_i(rax); __ sarl (rax); break; // implicit masking of lower 5 bits by Intel shift instr. |
1192 case ushr : __ mov(rcx, rax); __ pop_i(rax); __ shrl (rax); break; // implicit masking of lower 5 bits by Intel shift instr. | 1105 case ushr : __ mov(rcx, rax); __ pop_i(rax); __ shrl (rax); break; // implicit masking of lower 5 bits by Intel shift instr. |
1193 default : ShouldNotReachHere(); | 1106 default : ShouldNotReachHere(); |
1194 } | 1107 } |
1197 | 1110 |
1198 void TemplateTable::lop2(Operation op) { | 1111 void TemplateTable::lop2(Operation op) { |
1199 transition(ltos, ltos); | 1112 transition(ltos, ltos); |
1200 __ pop_l(rbx, rcx); | 1113 __ pop_l(rbx, rcx); |
1201 switch (op) { | 1114 switch (op) { |
1202 case add : __ addl(rax, rbx); __ adcl(rdx, rcx); break; | 1115 case add : __ addl(rax, rbx); __ adcl(rdx, rcx); break; |
1203 case sub : __ subl(rbx, rax); __ sbbl(rcx, rdx); | 1116 case sub : __ subl(rbx, rax); __ sbbl(rcx, rdx); |
1204 __ mov(rax, rbx); __ mov(rdx, rcx); break; | 1117 __ mov (rax, rbx); __ mov (rdx, rcx); break; |
1205 case _and: __ andl(rax, rbx); __ andl(rdx, rcx); break; | 1118 case _and : __ andl(rax, rbx); __ andl(rdx, rcx); break; |
1206 case _or : __ orl (rax, rbx); __ orl (rdx, rcx); break; | 1119 case _or : __ orl (rax, rbx); __ orl (rdx, rcx); break; |
1207 case _xor: __ xorl(rax, rbx); __ xorl(rdx, rcx); break; | 1120 case _xor : __ xorl(rax, rbx); __ xorl(rdx, rcx); break; |
1208 default : ShouldNotReachHere(); | 1121 default : ShouldNotReachHere(); |
1209 } | 1122 } |
1210 } | 1123 } |
1211 | 1124 |
1212 | 1125 |
1213 void TemplateTable::idiv() { | 1126 void TemplateTable::idiv() { |
1297 } | 1210 } |
1298 | 1211 |
1299 | 1212 |
1300 void TemplateTable::fop2(Operation op) { | 1213 void TemplateTable::fop2(Operation op) { |
1301 transition(ftos, ftos); | 1214 transition(ftos, ftos); |
1302 __ pop_ftos_to_rsp(); // pop ftos into rsp | |
1303 switch (op) { | 1215 switch (op) { |
1304 case add: __ fadd_s (at_rsp()); break; | 1216 case add: __ fadd_s (at_rsp()); break; |
1305 case sub: __ fsubr_s(at_rsp()); break; | 1217 case sub: __ fsubr_s(at_rsp()); break; |
1306 case mul: __ fmul_s (at_rsp()); break; | 1218 case mul: __ fmul_s (at_rsp()); break; |
1307 case div: __ fdivr_s(at_rsp()); break; | 1219 case div: __ fdivr_s(at_rsp()); break; |
1313 } | 1225 } |
1314 | 1226 |
1315 | 1227 |
1316 void TemplateTable::dop2(Operation op) { | 1228 void TemplateTable::dop2(Operation op) { |
1317 transition(dtos, dtos); | 1229 transition(dtos, dtos); |
1318 __ pop_dtos_to_rsp(); // pop dtos into rsp | |
1319 | 1230 |
1320 switch (op) { | 1231 switch (op) { |
1321 case add: __ fadd_d (at_rsp()); break; | 1232 case add: __ fadd_d (at_rsp()); break; |
1322 case sub: __ fsubr_d(at_rsp()); break; | 1233 case sub: __ fsubr_d(at_rsp()); break; |
1323 case mul: { | 1234 case mul: { |
1555 } | 1466 } |
1556 | 1467 |
1557 | 1468 |
1558 void TemplateTable::float_cmp(bool is_float, int unordered_result) { | 1469 void TemplateTable::float_cmp(bool is_float, int unordered_result) { |
1559 if (is_float) { | 1470 if (is_float) { |
1560 __ pop_ftos_to_rsp(); | |
1561 __ fld_s(at_rsp()); | 1471 __ fld_s(at_rsp()); |
1562 } else { | 1472 } else { |
1563 __ pop_dtos_to_rsp(); | |
1564 __ fld_d(at_rsp()); | 1473 __ fld_d(at_rsp()); |
1565 __ pop(rdx); | 1474 __ pop(rdx); |
1566 } | 1475 } |
1567 __ pop(rcx); | 1476 __ pop(rcx); |
1568 __ fcmp2int(rax, unordered_result < 0); | 1477 __ fcmp2int(rax, unordered_result < 0); |
2852 | 2761 |
2853 void TemplateTable::fast_xaccess(TosState state) { | 2762 void TemplateTable::fast_xaccess(TosState state) { |
2854 transition(vtos, state); | 2763 transition(vtos, state); |
2855 // get receiver | 2764 // get receiver |
2856 __ movptr(rax, aaddress(0)); | 2765 __ movptr(rax, aaddress(0)); |
2857 debug_only(__ verify_local_tag(frame::TagReference, 0)); | |
2858 // access constant pool cache | 2766 // access constant pool cache |
2859 __ get_cache_and_index_at_bcp(rcx, rdx, 2); | 2767 __ get_cache_and_index_at_bcp(rcx, rdx, 2); |
2860 __ movptr(rbx, Address(rcx, | 2768 __ movptr(rbx, Address(rcx, |
2861 rdx, | 2769 rdx, |
2862 Address::times_ptr, | 2770 Address::times_ptr, |