Changeset 6364 for branches/x8664call
 Timestamp:
 Apr 29, 2007, 9:27:29 AM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/x8664call/ccl/lispkernel/x86spentry64.s
r6351 r6364 38 38 ]) 39 39 40 define([pop_jump_builtin],[41 pop %ra042 jump_builtin($1,$2)43 ])44 40 45 41 … … 61 57 __(xorq %imm1,%imm0) 62 58 __(movq %imm0,misc_data_offset(%arg_z)) 63 __( jmp *%ra0)59 __(ret) 64 60 _endsubp(fix_overflow) 65 61 66 62 67 _spentry(nfix_overflow)68 C(nfix_one_bit_overflow):69 __(movq $two_digit_bignum_header,%imm0)70 __(Misc_Alloc_Fixed([],aligned_bignum_size(2)))71 __(unbox_fixnum(%arg_z,%imm0))72 __(movq $0xe000000000000000,%imm1)73 __(mov %temp0,%arg_z)74 __(xorq %imm1,%imm0)75 __(movq %imm0,misc_data_offset(%arg_z))76 __(ret)77 _endsubp(nfix_overflow)78 79 63 /* Make a lisp integer (fixnum or twodigit bignum) from the signed */ 80 64 /* 64bit value in %imm0. */ … … 91 75 __(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(2))) 92 76 __(movq %mm0,misc_data_offset(%arg_z)) 93 0: __( jmp *%ra0)77 0: __(ret) 94 78 _endsubp(makes64) 95 79 96 _spentry(nmakes64)97 __(movq %imm0,%imm1)98 __(shlq $fixnumshift,%imm1)99 __(movq %imm1,%arg_z)100 __(sarq $fixnumshift,%imm1)101 __(cmpq %imm1,%imm0)102 __(jz,pt 0f)103 __(movd %imm0,%mm0)104 __(movq $two_digit_bignum_header,%imm0)105 __(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(2)))106 __(movq %mm0,misc_data_offset(%arg_z))107 0: __(ret)108 _endsubp(nmakes64)109 80 110 81 … … 143 114 __(movq %mm0,misc_data_offset(%arg_z)) 144 115 __(movq %mm1,misc_data_offset+8(%arg_z)) 145 __( jmp *%ra0)116 __(ret) 146 117 3: __(mov $three_digit_bignum_header,%imm0) 147 118 __(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(3))) 148 119 __(movq %mm0,misc_data_offset(%arg_z)) 149 120 __(movd %mm1,misc_data_offset+8(%arg_z)) 150 __( jmp *%ra0)121 __(ret) 151 122 _endfn 152 123 153 /* %imm1:%imm0 constitute a signed integer, almost certainly a bignum. */154 /* Make a lisp integer out of those 128 bits .. */155 156 _startfn(C(nmakes128))157 158 /* We're likely to have to make a bignum out of the integer in %imm1 and */159 /* %imm0. We'll need to use %imm0 and %imm1 to cons the bignum, and */160 /* will need to do some arithmetic (determining significant bigits) */161 /* on %imm0 and %imm1 in order to know how large that bignum needs to be. */162 /* Cache %imm0 and %imm1 in %mm0 and %mm1. */163 164 __(movd %imm0,%mm0)165 __(movd %imm1,%mm1)166 167 /* If %imm1 is just a sign extension of %imm0, make a 64bit signed integer. */168 169 __(sarq $63,%imm0)170 __(cmpq %imm0,%imm1)171 __(movd %mm0,%imm0)172 __(je _SPnmakes64)173 174 /* Otherwise, if the high 32 bits of %imm1 are a signextension of the */175 /* low 32 bits of %imm1, make a 3digit bignum. If the upper 32 bits */176 /* of %imm1 are significant, make a 4 digit bignum */177 178 __(movq %imm1,%imm0)179 __(shlq $32,%imm0)180 __(sarq $32,%imm0)181 __(cmpq %imm0,%imm1)182 __(jz 3f)183 __(mov $four_digit_bignum_header,%imm0)184 __(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(4)))185 __(movq %mm0,misc_data_offset(%arg_z))186 __(movq %mm1,misc_data_offset+8(%arg_z))187 __(ret)188 3: __(mov $three_digit_bignum_header,%imm0)189 __(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(3)))190 __(movq %mm0,misc_data_offset(%arg_z))191 __(movd %mm1,misc_data_offset+8(%arg_z))192 __(ret)193 _endfn194 124 195 125 /* %imm1:%imm0 constitute an unsigned integer, almost certainly a bignum. */ … … 226 156 __(movq %mm0,misc_data_offset(%arg_z)) 227 157 __(movd %mm1,misc_data_offset+8(%arg_z)) 228 __( jmp *%ra0)158 __(ret) 229 159 4: __(movq $four_digit_bignum_header,%imm0) 230 160 __(Misc_Alloc_Fixed(%arg_z,aligned_bignum_size(4))) … … 234 164 6: __(movq %mm0,misc_data_offset(%arg_z)) 235 165 __(movq %mm0,misc_data_offset+8(%arg_z)) 236 __( jmpq *%ra0)166 __(ret) 237 167 _endfn 238 168 … … 549 479 local_label(misc_ref_node): 550 480 __(movq misc_data_offset(%arg_y,%arg_z),%arg_z) 551 __( jmp *%ra0)481 __(ret) 552 482 local_label(misc_ref_u64): 553 483 __(movq misc_data_offset(%arg_y,%arg_z),%imm0) … … 558 488 __(Misc_Alloc_Fixed(%arg_z,double_float.size)) 559 489 __(movsd %fp1,double_float.value(%arg_z)) 560 __( jmp *%ra0)490 __(ret) 561 491 local_label(misc_ref_fixnum_vector): 562 492 __(movq misc_data_offset(%arg_y,%arg_z),%imm0) 563 493 __(box_fixnum(%imm0,%arg_z)) 564 __( jmp *%ra0)494 __(ret) 565 495 local_label(misc_ref_s64): 566 496 __(movq misc_data_offset(%arg_y,%arg_z),%imm0) … … 571 501 __(movl misc_data_offset(%arg_y,%imm0),%imm0_l) 572 502 __(box_fixnum(%imm0,%arg_z)) 573 __( jmp *%ra0)503 __(ret) 574 504 local_label(misc_ref_s32): 575 505 __(movq %arg_z,%imm0) … … 577 507 __(movslq misc_data_offset(%arg_y,%imm0),%imm0) 578 508 __(box_fixnum(%imm0,%arg_z)) 579 __( jmp *%ra0)509 __(ret) 580 510 local_label(misc_ref_single_float_vector): 581 511 __(movq %arg_z,%imm0) … … 585 515 __(shl $32,%imm0) 586 516 __(lea subtag_single_float(%imm0),%arg_z) 587 __( jmp *%ra0)517 __(ret) 588 518 local_label(misc_ref_u8): 589 519 __(movq %arg_z,%imm0) … … 591 521 __(movzbl misc_data_offset(%arg_y,%imm0),%imm0_l) 592 522 __(box_fixnum(%imm0,%arg_z)) 593 __( jmp *%ra0)523 __(ret) 594 524 local_label(misc_ref_s8): 595 525 __(movq %arg_z,%imm0) … … 597 527 __(movsbq misc_data_offset(%arg_y,%imm0),%imm0) 598 528 __(box_fixnum(%imm0,%arg_z)) 599 __( jmp *%ra0)529 __(ret) 600 530 local_label(misc_ref_string): 601 531 __(movq %arg_z,%imm0) … … 604 534 __(shlq $charcode_shift,%imm0) 605 535 __(leaq subtag_character(%imm0),%arg_z) 606 __( jmp *%ra0)536 __(ret) 607 537 local_label(misc_ref_new_string): 608 538 __(movq %arg_z,%imm0) … … 611 541 __(shlq $charcode_shift,%imm0) 612 542 __(leaq subtag_character(%imm0),%arg_z) 613 __( jmp *%ra0)543 __(ret) 614 544 local_label(misc_ref_u16): 615 545 __(movq %arg_z,%imm0) … … 617 547 __(movzwl misc_data_offset(%arg_y,%imm0),%imm0_l) 618 548 __(box_fixnum(%imm0,%arg_z)) 619 __( jmp *%ra0)549 __(ret) 620 550 local_label(misc_ref_s16): 621 551 __(movq %arg_z,%imm0) … … 623 553 __(movswq misc_data_offset(%arg_y,%imm0),%imm0) 624 554 __(box_fixnum(%imm0,%arg_z)) 625 __( jmp *%ra0)555 __(ret) 626 556 local_label(misc_ref_bit_vector): 627 557 __(unbox_fixnum(%arg_z,%imm0)) … … 634 564 __(andl $fixnum_one,%imm0_l) 635 565 __(movq %imm0,%arg_z) 636 __( jmp *%ra0)566 __(ret) 637 567 local_label(misc_ref_invalid): 638 568 __(movq $XBADVEC,%arg_x) … … 1013 943 __(jne local_label(misc_set_bad)) 1014 944 9: __(movq %imm0,misc_data_offset(%arg_x,%arg_y)) 1015 __( jmp *%ra0)945 __(ret) 1016 946 local_label(misc_set_fixnum_vector): 1017 947 __(movq %arg_z,%imm0) … … 1020 950 __(jne local_label(misc_set_bad)) 1021 951 __(movq %imm0,misc_data_offset(%arg_x,%arg_y)) 1022 __( jmp *%ra0)952 __(ret) 1023 953 local_label(misc_set_s64): 1024 954 __(movq %arg_z,%imm0) … … 1038 968 __(jne local_label(misc_set_bad)) 1039 969 9: __(movq %imm0,misc_data_offset(%arg_x,%arg_y)) 1040 __( jmp *%ra0)970 __(ret) 1041 971 local_label(misc_set_bad): 1042 972 __(movq %arg_z,%arg_y) … … 1054 984 __(movq double_float.value(%arg_z),%imm0) 1055 985 __(movq %imm0,misc_dfloat_offset(%arg_x,%arg_y)) 1056 __( jmp *%ra0)986 __(ret) 1057 987 local_label(misc_set_s32): 1058 988 __(movq %arg_z,%imm0) … … 1067 997 __(shr $fixnumshift,%imm0) 1068 998 __(movl %imm0_l,misc_data_offset(%arg_x,%imm1)) 1069 __( jmp *%ra0)999 __(ret) 1070 1000 local_label(misc_set_single_float_vector): 1071 1001 __(cmpb $tag_single_float,%arg_z_b) … … 1076 1006 __(shr $32,%imm0) 1077 1007 __(movl %imm0_l,misc_data_offset(%arg_x,%imm1)) 1078 __( jmp *%ra0)1008 __(ret) 1079 1009 local_label(misc_set_u32): 1080 1010 __(movq %arg_y,%imm1) … … 1085 1015 __(unbox_fixnum(%arg_z,%imm0)) 1086 1016 __(movl %imm0_l,misc_data_offset(%arg_x,%imm1)) 1087 __( jmp *%ra0)1017 __(ret) 1088 1018 local_label(misc_set_bit_vector): 1089 1019 __(testq $~fixnumone,%arg_z) … … 1097 1027 local_label(misc_set_set_bit): 1098 1028 __(btsq %imm0,misc_data_offset(%arg_x,%imm1,8)) 1099 __( jmp *%ra0)1029 __(ret) 1100 1030 local_label(misc_set_clr_bit): 1101 1031 __(btrq %imm0,misc_data_offset(%arg_x,%imm1,8)) 1102 __( jmp *%ra0)1032 __(ret) 1103 1033 local_label(misc_set_u8): 1104 1034 __(testq $~(0xff<<fixnumshift),%arg_z) … … 1108 1038 __(shrq $3,%imm1) 1109 1039 __(movb %imm0_b,misc_data_offset(%arg_x,%imm1)) 1110 __( jmp *%ra0)1040 __(ret) 1111 1041 local_label(misc_set_s8): 1112 1042 __(movq %arg_z,%imm0) … … 1121 1051 __(shrq $3,%imm1) 1122 1052 __(movb %imm0_b,misc_data_offset(%arg_x,%imm1)) 1123 __( jmp *%ra0)1053 __(ret) 1124 1054 local_label(misc_set_string): 1125 1055 __(cmpb $subtag_character,%arg_z_b) … … 1130 1060 __(shrq $3,%imm1) 1131 1061 __(movb %imm0_b,misc_data_offset(%arg_x,%imm1)) 1132 __( jmp *%ra0)1062 __(ret) 1133 1063 local_label(misc_set_new_string): 1134 1064 __(cmpb $subtag_character,%arg_z_b) … … 1139 1069 __(shrq $1,%imm1) 1140 1070 __(movl %imm0_l,misc_data_offset(%arg_x,%imm1)) 1141 __( jmp *%ra0)1071 __(ret) 1142 1072 local_label(misc_set_s16): 1143 1073 __(movq %arg_z,%imm0) … … 1152 1082 __(shrq $fixnumshift,%imm0) 1153 1083 __(movw %imm0_w,misc_data_offset(%arg_x,%imm1)) 1154 __( jmp *%ra0)1084 __(ret) 1155 1085 local_label(misc_set_u16): 1156 1086 __(movq %arg_y,%imm1) … … 1160 1090 __(unbox_fixnum(%arg_z,%imm0)) 1161 1091 __(movw %imm0_w,misc_data_offset(%arg_x,%imm1)) 1162 __( jmp *%ra0)1092 __(ret) 1163 1093 local_label(misc_set_invalid): 1164 1094 __(push $XSETBADVEC) … … 1192 1122 __(cmovneq node_size(%rsp,%nargs_q),%arg_z) 1193 1123 __(leaveq) 1194 __(popq %ra0)1195 __(jmp *%ra0) 1124 __(ret) 1125 1196 1126 1197 1127 /* actually need to return values ; always need to copy */ … … 1229 1159 1230 1160 _spentry(mkcatch1v) 1231 __( Make_Catch(0))1232 __( jmp *%ra0)1161 __(nMake_Catch(0)) 1162 __(ret) 1233 1163 _endsubp(mkcatch1v) 1234 1164 1235 _spentry(nmkcatch1v)1236 __(nMake_Catch(0))1237 __(ret)1238 _endsubp(nmkcatch1v)1239 1240 1165 _spentry(mkunwind) 1241 1166 __(movq $undefined,%arg_z) … … 1243 1168 __(jmp *%ra0) 1244 1169 _endsubp(mkunwind) 1245 1170 1246 1171 /* this takes a return address in %ra0; it's "new" in that it does the 1247 1172 double binding of *interruptlevel* outofline */ … … 1259 1184 __(jmp _SPbind_interrupt_level) 1260 1185 _endsubp(nmkunwind) 1261 1262 1186 1263 1187 _spentry(mkcatchmv) 1264 __( Make_Catch(fixnumone))1265 __( jmp *%ra0)1188 __(nMake_Catch(fixnumone)) 1189 __(ret) 1266 1190 _endsubp(mkcatchmv) 1267 1268 _spentry(nmkcatchmv)1269 __(nMake_Catch(fixnumone))1270 __(ret)1271 _endsubp(nmkcatchmv)1272 1191 1273 1192 _spentry(throw) … … 1305 1224 __(jz local_label(_threw_one_value_dont_unbind)) 1306 1225 __(lea local_label(_threw_one_value_dont_unbind)(%rip),%ra0) 1226 __(push %ra0) 1307 1227 __(jmp _SPunbind_to) 1308 1228 __(tra(local_label(_threw_one_value_dont_unbind))) … … 1334 1254 __(cmpq %imm0,%imm1) 1335 1255 __(je local_label(_threw_multiple_dont_unbind)) 1336 __(leaq local_label(_threw_multiple_dont_unbind)(%rip),%r10) 1256 __(leaq local_label(_threw_multiple_dont_unbind)(%rip),%ra0) 1257 __(push %ra0) 1337 1258 __(jmp _SPunbind_to) 1338 1259 __(tra(local_label(_threw_multiple_dont_unbind))) … … 1386 1307 __(push %ra0) 1387 1308 __(leaq local_label(_nthrowv_back_from_unbind)(%rip),%ra0) 1309 __(push %ra0) 1388 1310 __(jmp _SPunbind_to) 1389 1311 __(tra(local_label(_nthrowv_back_from_unbind))) … … 1472 1394 /* Ready to call cleanup code. set up tra, jmp to %xfn */ 1473 1395 __(leaq local_label(_nthrowv_called_cleanup)(%rip),%ra0) 1396 __(push %ra0) 1474 1397 __(movb $0,%rcontext:tcr.unwinding) 1475 1398 __(jmp *%xfn) … … 1522 1445 __(push %ra0) 1523 1446 __(leaq local_label(_nthrow1v_back_from_unbind)(%rip),%ra0) 1447 __(push %ra0) 1524 1448 __(jmp _SPunbind_to) 1525 1449 __(tra(local_label(_nthrow1v_back_from_unbind))) … … 1580 1504 __(leaq local_label(_nthrow1v_called_cleanup)(%rip),%ra0) 1581 1505 __(movb $0,%rcontext:tcr.unwinding) 1506 __(push %ra0) 1582 1507 __(jmp *%xfn) 1583 1508 __(tra(local_label(_nthrow1v_called_cleanup))) … … 1623 1548 __(movq $XSYMNOBIND,%arg_y) 1624 1549 __(set_nargs(2)) 1550 __(push %ra0) 1625 1551 __(jmp _SPksignalerr) 1626 1552 _endsubp(bind) … … 1653 1579 9: __(movq $XSYMNOBIND,%arg_y) 1654 1580 __(set_nargs(2)) 1581 __(push %ra0) 1655 1582 __(jmp _SPksignalerr) 1656 1583 _endsubp(bind_self) … … 1673 1600 9: __(movq $XSYMNOBIND,%arg_y) 1674 1601 __(set_nargs(2)) 1602 __(push %ra0) 1675 1603 __(jmp _SPksignalerr) 1676 1604 _endsubp(bind_nil) … … 1707 1635 9: __(movq $XSYMNOBIND,%arg_y) 1708 1636 __(set_nargs(2)) 1637 __(push %ra0) 1709 1638 __(jmp _SPksignalerr) 1710 1639 _endsubp(bind_self_boundp_check) … … 1821 1750 /* setting the bit needs to be done atomically, unless we're sure that other */ 1822 1751 /* threads are suspended.) */ 1823 /* We can unconditionally set the suspended thread's RIP to its RA0. */1752 /* We can unconditionally set the suspended thread's RIP to the return address. */ 1824 1753 1825 1754 … … 1830 1759 __(_rplaca(%arg_y,%arg_z)) 1831 1760 __(ja 1f) 1832 0: __( jmp *%ra0)1761 0: __(ret) 1833 1762 1: __(movq %arg_y,%imm0) 1834 1763 __(subq lisp_global(heap_start),%imm0) … … 1843 1772 __(lock) 1844 1773 __(btsq %imm0,(%temp0,%imm1,8)) 1845 __( jmp *%ra0)1774 __(ret) 1846 1775 _endsubp(rplaca) 1847 1776 … … 1852 1781 __(_rplacd(%arg_y,%arg_z)) 1853 1782 __(ja 1f) 1854 0: __( jmp *%ra0)1783 0: __(ret) 1855 1784 1: __(movq %arg_y,%imm0) 1856 1785 __(subq lisp_global(heap_start),%imm0) … … 1865 1794 __(lock) 1866 1795 __(btsq %imm0,(%temp0,%imm1,8)) 1867 __( jmp *%ra0)1796 __(ret) 1868 1797 _endsubp(rplacd) 1869 1798 … … 1877 1806 __(movq %arg_z,misc_data_offset(%arg_x,%arg_y)) 1878 1807 __(ja 1f) 1879 0: __( jmp *%ra0)1808 0: __(ret) 1880 1809 1: __(lea misc_data_offset(%arg_x,%arg_y),%imm0) 1881 1810 __(subq lisp_global(heap_start),%imm0) … … 1890 1819 __(lock) 1891 1820 __(btsq %imm0,(%temp0,%imm1,8)) 1892 __( jmp *%ra0)1821 __(ret) 1893 1822 _endsubp(gvset) 1894 1823 … … 1904 1833 __(movq %arg_z,misc_data_offset(%arg_x,%arg_y)) 1905 1834 __(ja 1f) 1906 0: __( jmp *%ra0)1835 0: __(ret) 1907 1836 1: __(lea misc_data_offset(%arg_x,%arg_y),%imm0) 1908 1837 __(subq lisp_global(heap_start),%imm0) … … 1927 1856 __(lock) 1928 1857 __(btsq %imm0,(%temp0,%imm1,8)) 1929 __( jmp *%ra0)1858 __(ret) 1930 1859 _endsubp(set_hash_key) 1931 1860 … … 1964 1893 C(egc_write_barrier_end): 1965 1894 2: __(movl $t_value,%arg_z_l) 1966 __( jmp *%ra0)1895 __(ret) 1967 1896 3: __(movl $nil_value,%arg_z_l) 1968 __( jmp *%ra0)1897 __(ret) 1969 1898 _endsubp(store_node_conditional) 1970 1899 … … 2005 1934 8: __(movq $XIMPROPERLIST,%arg_y) 2006 1935 __(set_nargs(2)) 1936 __(push %ra0) 2007 1937 __(jmp _SPksignalerr) 2008 1938 9: /* Whew */ … … 2023 1953 __(jne 2f) 2024 1954 __(TSP_Alloc_Fixed(2*node_size,%imm0)) 2025 __( jmp *%ra0)1955 __(ret) 2026 1956 2: __(movq %imm0,%imm1) 2027 1957 __(add %imm1,%imm1) … … 2053 1983 __(jne 3b) 2054 1984 __(movq %temp1,%rcontext:tcr.db_link) 2055 __( jmp *%ra0)1985 __(ret) 2056 1986 _endsubp(progvsave) 2057 1987 … … 2117 2047 __(movq %imm0,tsp_frame.fixed_overhead(%temp0)) 2118 2048 __(leaq tsp_frame.fixed_overhead+fulltag_misc(%temp0),%arg_z) 2119 __( jmp *%ra0)2049 __(ret) 2120 2050 local_label(stack_misc_alloc_heap_alloc_ivector): 2121 2051 __(movq %rcontext:tcr.foreign_sp,%imm1) … … 2132 2062 __(movq %imm0,(%temp0)) 2133 2063 __(leaq fulltag_misc(%temp0),%arg_z) 2134 __( jmp *%ra0)2064 __(ret) 2135 2065 local_label(stack_misc_alloc_heap_alloc_gvector): 2136 2066 __(TSP_Alloc_Fixed(0,%imm0)) … … 2175 2105 2176 2106 _spentry(values) 2107 __(movq (%temp0),%ra0) 2177 2108 __(ref_global(ret1val_addr,%imm1)) 2178 2109 __(cmpq %imm1,%ra0) … … 2183 2114 __(cmovneq node_size(%rsp,%nargs_q),%arg_z) 2184 2115 __(movq %temp0,%rsp) 2185 __( jmp *%ra0)2186 0: __(movq (%temp0),%ra0)2187 __(lea node_size(%temp0),%temp0)2116 __(ret) 2117 0: __(movq 8(%temp0),%ra0) 2118 __(addq $2*node_size,%temp0) 2188 2119 __(lea (%rsp,%nargs_q),%imm0) 2189 2120 __(jmp 2f) 2190 1: __( lea node_size(%imm0),%imm0)2121 1: __(subq $node_size,%imm0) 2191 2122 __(movq (%imm0),%temp1) 2192 __( lea node_size(%temp0),%temp0)2123 __(subq $node_size,%temp0) 2193 2124 __(movq %temp1,(%temp0)) 2194 2125 2: __(cmpq %imm0,%rsp) … … 2413 2344 __(movl $XBADKEYS,%arg_y_l) 2414 2345 __(set_nargs(2)) 2346 __(push %ra0) 2415 2347 __(jmp _SPksignalerr) 2416 2348 9: __(jmp *%ra0) … … 2488 2420 2489 2421 2490 /* Prepend all but the first four (3 words of code, inner fn) and last */2491 /* (lfbits) elements of %fn to the "arglist". */2492 2493 _spentry(call_closure)2494 __(subq $fulltag_functionfulltag_misc,%fn)2495 __(vector_length(%fn,%imm0))2496 __(movzwl %nargs,%nargs_l)2497 2498 __(subq $5<<fixnumshift,%imm0) /* imm0 = inherited arg count */2499 __(cmpw $nargregs<<fixnumshift,%nargs)2500 __(jna,pt local_label(no_insert))2501 2502 /* Some arguments have already been pushed. Push imm0's worth */2503 /* of NILs, copy those arguments that have already been vpushed from */2504 /* the old TOS to the new, then insert all of the inerited args */2505 /* and go to the function. */2506 2507 __(movq %imm0,%imm1)2508 local_label(push_nil_loop):2509 __(push $nil_value)2510 __(sub $fixnumone,%imm1)2511 __(jne local_label(push_nil_loop))2512 2513 /* Need to use arg regs as temporaries here. */2514 __(movq %rsp,%temp1)2515 __(push %arg_z)2516 __(push %arg_y)2517 __(push %arg_x)2518 __(lea 3*node_size(%rsp,%imm0),%arg_x)2519 __(lea nargregs<<fixnumshift(%nargs_q),%arg_y)2520 local_label(copy_already_loop):2521 __(movq (%arg_x),%arg_z)2522 __(addq $fixnumone,%arg_x)2523 __(movq %arg_z,(%temp1))2524 __(addq $fixnumone,%temp1)2525 __(subq $fixnumone,%arg_y)2526 __(jne local_label(copy_already_loop))2527 2528 __(movl $4<<fixnumshift,%imm1_l) /* skip code, new fn */2529 local_label(insert_loop):2530 __(movq misc_data_offset(%fn,%imm1),%arg_z)2531 __(addq $node_size,%imm1)2532 __(addw $fixnum_one,%nargs)2533 __(subq $node_size,%arg_x)2534 __(movq %arg_z,(%arg_x))2535 __(subq $fixnum_one,%imm0)2536 __(jne local_label(insert_loop))2537 2538 /* Recover the argument registers, pushed earlier */2539 __(pop %arg_x)2540 __(pop %arg_y)2541 __(pop %arg_z)2542 __(jmp local_label(go))2543 2544 /* Here if nothing was pushed by the caller. If we're */2545 /* going to push anything, we have to reserve a stack */2546 /* frame first. (We'll need to push something if the */2547 /* sum of %nargs and %imm0 is greater than nargregs) */2548 2549 local_label(no_insert):2550 __(lea (%nargs_q,%imm0),%imm1)2551 __(cmpq $nargregs<<fixnumshift,%imm1)2552 __(jna local_label(no_insert_no_frame))2553 /* Reserve space for a stack frame */2554 __(push $reserved_frame_marker)2555 __(push $reserved_frame_marker)2556 local_label(no_insert_no_frame):2557 /* nargregs or fewer args were already vpushed. */2558 /* if exactly nargregs, vpush remaining inherited vars. */2559 __(cmpw $nargregs<<fixnumshift,%nargs)2560 __(movl $4<<fixnumshift,%imm1_l) /* skip code, new fn */2561 __(leaq 4<<fixnumshift(%imm0),%temp1)2562 __(jnz local_label(set_regs))2563 local_label(vpush_remaining):2564 __(push misc_data_offset(%fn,%imm1))2565 __(addq $node_size,%imm1)2566 __(addw $fixnumone,%nargs)2567 __(subq $node_size,%imm0)2568 __(jnz local_label(vpush_remaining))2569 __(jmp local_label(go))2570 local_label(set_regs):2571 /* if nargs was > 1 (and we know that it was < 3), it must have */2572 /* been 2. Set arg_x, then vpush the remaining args. */2573 __(cmpw $fixnumone,%nargs)2574 __(jle local_label(set_y_z))2575 local_label(set_arg_x):2576 __(subq $node_size,%temp1)2577 __(movq misc_data_offset(%fn,%temp1),%arg_x)2578 __(addw $fixnumone,%nargs)2579 __(subq $fixnumone,%imm0)2580 __(jne local_label(vpush_remaining))2581 __(jmp local_label(go))2582 /* Maybe set arg_y or arg_z, preceding args */2583 local_label(set_y_z):2584 __(jne local_label(set_arg_z))2585 /* Set arg_y, maybe arg_x, preceding args */2586 local_label(set_arg_y):2587 __(subq $node_size,%temp1)2588 __(movq misc_data_offset(%fn,%temp1),%arg_y)2589 __(addw $fixnumone,%nargs)2590 __(subq $fixnum_one,%imm0)2591 __(jnz local_label(set_arg_x))2592 __(jmp local_label(go))2593 local_label(set_arg_z):2594 __(subq $node_size,%temp1)2595 __(movq misc_data_offset(%fn,%temp1),%arg_z)2596 __(addw $fixnumone,%nargs)2597 __(subq $fixnum_one,%imm0)2598 __(jne local_label(set_arg_y))2599 local_label(go):2600 __(movq misc_data_offset+(3*node_size)(%fn),%fn)2601 __(jmp *%fn)2602 _endsubp(call_closure)2603 2422 2604 2423 _spentry(getxlong) … … 2649 2468 __(movq $XNOSPREAD,%arg_y) 2650 2469 __(set_nargs(2)) 2470 __(push %ra0) 2651 2471 __(jmp _SPksignalerr) 2652 2472 _endsubp(spreadargz) … … 2671 2491 __(lea (%rbp,%imm1),%rsp) 2672 2492 __(movq 8(%rbp),%ra0) 2673 __(movq 0(%rbp),%rbp) 2493 __(movq (%rbp),%rbp) 2494 __(pushq %ra0) 2674 2495 __(do_funcall()) 2675 2496 /* All args in regs; exactly the same as the tfuncallvsp case */ 2676 2497 9: 2677 2498 __(leave) 2678 __(pop %ra0)2679 2499 __(do_funcall()) 2680 2500 _endsubp(tfuncallgen) … … 2695 2515 __(lea (%rbp,%imm1),%rsp) 2696 2516 __(movq 8(%rbp),%ra0) 2697 __(movq 0(%rbp),%rbp) 2517 __(movq (%rbp),%rbp) 2518 __(push %ra0) 2698 2519 __(do_funcall()) 2699 2520 _endsubp(tfuncallslide) … … 2702 2523 _spentry(tfuncallvsp) 2703 2524 __(leave) 2704 __(pop %ra0)2705 2525 __(do_funcall()) 2706 2526 _endsubp(tfuncallvsp) … … 2722 2542 __(lea (%rbp,%imm1),%rsp) 2723 2543 __(movq 8(%rbp),%ra0) 2724 __(movq 0(%rbp),%rbp) 2544 __(movq (%rbp),%rbp) 2545 __(pushq %ra0) 2725 2546 __(jump_fname()) 2726 2547 /* All args in regs; exactly the same as the tcallsymvsp case */ 2727 2548 9: 2728 2549 __(leave) 2729 __(pop %ra0)2730 2550 __(jump_fname()) 2731 2551 _endsubp(tcallsymgen) … … 2746 2566 __(movq 8(%rbp),%ra0) 2747 2567 __(movq 0(%rbp),%rbp) 2568 __(pushq %ra0) 2748 2569 __(jump_fname()) 2749 2570 _endsubp(tcallsymslide) … … 2751 2572 _spentry(tcallsymvsp) 2752 2573 __(leave) 2753 __(pop %ra0)2754 2574 __(jump_fname()) 2755 2575 _endsubp(tcallsymvsp) … … 2773 2593 __(movq lisp_frame.savera0(%rbp),%ra0) 2774 2594 __(movq lisp_frame.backlink(%rbp),%rbp) 2595 __(pushq %ra0) 2775 2596 __(jmp *%fn) 2776 2597 /* All args in regs; exactly the same as the tcallnfnvsp case */ … … 2778 2599 __(movq %temp0,%fn) 2779 2600 __(leave) 2780 __(pop %ra0)2781 2601 __(jmp *%fn) 2782 2602 _endsubp(tcallnfngen) … … 2798 2618 __(movq lisp_frame.savera0(%rbp),%ra0) 2799 2619 __(movq lisp_frame.backlink(%rbp),%rbp) 2620 __(pushq %ra0) 2800 2621 __(jmp *%fn) 2801 2622 _endsubp(tcallnfnslide) … … 2804 2625 __(movq %temp0,%fn) 2805 2626 __(leave) 2806 __(pop %ra0)2807 2627 __(jmp *%fn) 2808 2628 _endsubp(tcallnfnvsp) … … 2827 2647 __(movsd %fpzero,macptr.domain(%arg_z)) 2828 2648 __(movsd %fpzero,macptr.type(%arg_z)) 2829 __( jmp *%ra0)2649 __(ret) 2830 2650 1: __(movq %rcontext:tcr.foreign_sp,%imm1) 2831 2651 __(subq $dnode_size,%rcontext:tcr.foreign_sp) … … 2857 2677 2: __(cmpq %imm0,%imm1) 2858 2678 __(jne 1b) 2859 __( jmp *%ra0)2679 __(ret) 2860 2680 9: __(movq %rcontext:tcr.foreign_sp,%imm1) 2861 2681 __(subq $dnode_size,%rcontext:tcr.foreign_sp) … … 2884 2704 __(jge 0b) 2885 2705 __(movq %temp1,%arg_z) 2886 __( jmp *%ra0)2706 __(ret) 2887 2707 2: __(TSP_Alloc_Fixed(0,%imm0)) 2888 2708 __(jmp 4f) … … 2891 2711 __(jge 3b) 2892 2712 __(movq %temp1,%arg_z) 2893 __( jmp *%ra0)2713 __(ret) 2894 2714 _endsubp(makestacklist) 2895 2715 … … 2960 2780 __(dnode_align(%imm1,node_size,%imm1)) 2961 2781 __(Misc_Alloc(%arg_z)) 2962 __( jmp *%ra0)2782 __(ret) 2963 2783 local_label(misc_alloc_not_u56): 2964 2784 __(uuo_error_reg_not_type(Rarg_y,error_object_not_unsigned_byte_56)) … … 3154 2974 __(movq %whole_reg,%arg_z) 3155 2975 __(set_nargs(2)) 2976 __(push %ra0) 3156 2977 __(jmp _SPksignalerr) 3157 2978 _endfn(C(destbind1)) … … 3167 2988 __(movq %whole_reg,%arg_z) 3168 2989 __(set_nargs(2)) 2990 __(push %ra0) 3169 2991 __(jmp _SPksignalerr) 3170 2992 _endsubp(macro_bind) … … 3198 3020 __(shr $num_subtag_bits,%imm0) 3199 3021 __(movslq misc_data_offset4(%arg_z,%imm0,4),%imm0) 3200 8: __( jmp *%ra0)3022 8: __(ret) 3201 3023 9: __(uuo_error_reg_not_type(Rarg_z,error_object_not_integer)) 3202 3024 _endsubp(integer_sign) … … 3359 3181 3360 3182 _spentry(misc_alloc_init) 3361 __(push %ra0)3362 3183 __(push %rbp) 3363 3184 __(movq %rsp,%rbp) … … 3366 3187 __(movq %arg_x,%arg_y) 3367 3188 __(lea local_label(misc_alloc_init_back)(%rip),%ra0) 3189 __(push %ra0) 3368 3190 __(jmp _SPmisc_alloc) 3369 3191 __(tra(local_label(misc_alloc_init_back))) 3370 3192 __(pop %arg_y) 3371 3193 __(leave) 3372 __(pop %ra0)3373 3194 __(movq $nrs.init_misc,%fname) 3374 3195 __(set_nargs(2)) … … 3377 3198 3378 3199 _spentry(stack_misc_alloc_init) 3379 __(push %ra0)3380 3200 __(push %rbp) 3381 3201 __(movq %rsp,%rbp) … … 3384 3204 __(movq %arg_x,%arg_y) 3385 3205 __(lea local_label(stack_misc_alloc_init_back)(%rip),%ra0) 3206 __(push %ra0) 3386 3207 __(jmp _SPstack_misc_alloc) 3387 3208 __(tra(local_label(stack_misc_alloc_init_back))) 3388 3209 __(pop %arg_y) 3389 3210 __(leave) 3390 __(pop %ra0)3391 3211 __(movq $nrs.init_misc,%fname) 3392 3212 __(set_nargs(2)) … … 3400 3220 C(popj): 3401 3221 __(leave) 3402 __(pop %ra0) 3403 __(jmp *%ra0) 3222 __(ret) 3404 3223 _endsubp(popj) 3405 3224 … … 3412 3231 __(jne 1f) 3413 3232 __(sarq $fixnumshift,%imm0) 3414 __( jmp *%ra0)3233 __(ret) 3415 3234 1: __(andb $tagmask,%imm0_b) 3416 3235 __(cmpb $tag_misc,%imm0_b) … … 3427 3246 __(testq %imm0,%imm0) 3428 3247 __(js 9f) 3429 __( jmp *%ra0)3248 __(ret) 3430 3249 3: __(movq misc_data_offset(%arg_z),%imm0) 3431 3250 __(cmpl $0,misc_data_offset+8(%arg_z)) 3432 3251 __(jne 9f) 3433 __( jmp *%ra0)3252 __(ret) 3434 3253 9: __(uuo_error_reg_not_type(Rarg_z,error_object_not_u64)) 3435 3254 _endsubp(getu64) … … 3451 3270 __(movq misc_data_offset(%arg_z),%imm0) 3452 3271 __(jne 9f) 3453 8: __( jmp *%ra0)3272 8: __(ret) 3454 3273 9: __(uuo_error_reg_not_type(Rarg_z,error_object_not_u64)) 3455 3274 _endsubp(gets64) … … 3471 3290 __(Misc_Alloc(%arg_z)) 3472 3291 __(movq %mm0,misc_data_offset(%arg_z)) 3473 __( jmp *%ra0)3292 __(ret) 3474 3293 3: __(movl $three_digit_bignum_header,%imm0_l) 3475 3294 __(movl $aligned_bignum_size(3),%imm1_l) 3476 3295 __(Misc_Alloc(%arg_z)) 3477 3296 __(movq %mm0,misc_data_offset(%arg_z)) 3478 9: __( jmp *%ra0)3297 9: __(ret) 3479 3298 _endsubp(makeu64) 3480 3299 … … 3491 3310 __(jne 8f) 3492 3311 7: __(movq symbol.vcell(%arg_y),%arg_z) 3493 8: __( jmp *%ra0)3312 8: __(ret) 3494 3313 _endsubp(specref) 3495 3314 … … 3504 3323 __(je 1f) 3505 3324 __(movq %arg_z,(%imm1,%imm0)) 3506 __( jmp *%ra0)3325 __(ret) 3507 3326 1: __(lea fulltag_miscfulltag_symbol(%arg_y),%arg_x) 3508 3327 __(movq $1<<fixnumshift,%arg_y) … … 3523 3342 __(jne,pt 9f) 3524 3343 __(uuo_error_reg_unbound(Rarg_y)) 3525 9: __( jmp *%ra0)3344 9: __(ret) 3526 3345 _endsubp(specrefcheck) 3527 3346 … … 3558 3377 __(movq %arg_y,(%arg_x,%temp1)) 3559 3378 __(movq %imm1,%rcontext:tcr.db_link) 3560 __( jmp *%ra0)3379 __(ret) 3561 3380 _endsubp(unbind) 3562 3381 … … 3572 3391 __(jne 1b) 3573 3392 __(movq %imm1,%rcontext:tcr.db_link) 3574 __( jmp *%ra0)3393 __(ret) 3575 3394 _endsubp(unbind_n) 3576 3395 … … 3586 3405 __(jne 1b) 3587 3406 __(movq %imm1,%rcontext:tcr.db_link) 3588 __( jmp *%ra0)3407 __(ret) 3589 3408 _endsubp(unbind_to) 3590 3409 … … 3649 3468 __(movq %imm1,%rcontext:tcr.db_link) 3650 3469 __(js,pn 1f) 3651 0: __( jmp *%ra0)3470 0: __(ret) 3652 3471 1: __(testq %temp0,%temp0) 3653 3472 __(js 0b) 3654 3473 __(check_pending_enabled_interrupt(2f)) 3655 2: __( jmp *%ra0)3474 2: __(ret) 3656 3475 _endsubp(unbind_interrupt_level) 3657 3476 … … 3663 3482 __(shrq $fixnumshift,%imm0) 3664 3483 __(jne _SPunbind_n) 3665 __( jmp *%ra0)3484 __(ret) 3666 3485 _endsubp(progvrestore) 3667 3486 … … 3676 3495 __(addq %arg_y,%arg_z) 3677 3496 __(jo,pn C(fix_one_bit_overflow)) 3678 __( jmp *%ra0)3497 __(ret) 3679 3498 1: __(jump_builtin(_builtin_plus,2)) 3680 3499 _endsubp(builtin_plus) … … 3691 3510 __(subq %arg_y,%arg_z) 3692 3511 __(jo,pn C(fix_one_bit_overflow)) 3693 __( jmp *%ra0)3512 __(ret) 3694 3513 1: __(jump_builtin(_builtin_minus,2)) 3695 3514 _endsubp(builtin_minus) … … 3708 3527 __(jo 1f) 3709 3528 __(mov %imm0,%arg_z) 3710 __( jmp *%ra0)3529 __(ret) 3711 3530 1: __(unbox_fixnum(%arg_z,%imm0)) 3712 3531 __(unbox_fixnum(%arg_y,%imm1)) … … 3727 3546 __(rcmpq(%arg_z,%arg_y)) 3728 3547 __(condition_to_boolean(e,%imm0,%arg_z)) 3729 __( jmp *%ra0)3548 __(ret) 3730 3549 1: __(jump_builtin(_builtin_eq,2)) 3731 3550 _endsubp(builtin_eq) … … 3739 3558 __(rcmpq(%arg_z,%arg_y)) 3740 3559 __(condition_to_boolean(ne,%imm0,%arg_z)) 3741 __( jmp *%ra0)3560 __(ret) 3742 3561 1: __(jump_builtin(_builtin_ne,2)) 3743 3562 _endsubp(builtin_ne) … … 3751 3570 __(rcmpq(%arg_y,%arg_z)) 3752 3571 __(condition_to_boolean(g,%imm0,%arg_z)) 3753 __( jmp *%ra0)3572 __(ret) 3754 3573 1: __(jump_builtin(_builtin_gt,2)) 3755 3574 _endsubp(builtin_gt) … … 3763 3582 __(rcmpq(%arg_y,%arg_z)) 3764 3583 __(condition_to_boolean(ge,%imm0,%arg_z)) 3765 __( jmp *%ra0)3584 __(ret) 3766 3585 1: __(jump_builtin(_builtin_ge,2)) 3767 3586 _endsubp(builtin_ge) … … 3775 3594 __(rcmpq(%arg_y,%arg_z)) 3776 3595 __(condition_to_boolean(l,%imm0,%arg_z)) 3777 __( jmp *%ra0)3596 __(ret) 3778 3597 1: __(jump_builtin(_builtin_lt,2)) 3779 3598 _endsubp(builtin_lt) … … 3787 3606 __(rcmpq(%arg_y,%arg_z)) 3788 3607 __(condition_to_boolean(le,%imm0,%arg_z)) 3789 __( jmp *%ra0)3608 __(ret) 3790 3609 1: __(jump_builtin(_builtin_le,2)) 3791 3610 _endsubp(builtin_le) … … 3808 3627 __(jump_builtin(_builtin_eql,2)) 3809 3628 1: __(movl $t_value,%arg_z_l) 3810 __( jmp *%ra0)3629 __(ret) 3811 3630 2: __(movl $nil_value,%arg_z_l) 3812 __( jmp *%ra0)3631 __(ret) 3813 3632 _endsubp(builtin_eql) 3814 3633 … … 3826 3645 __(movq %arg_z,%arg_y) 3827 3646 __(vector_length(%arg_y,%arg_z)) 3828 __( jmp *%ra0)3647 __(ret) 3829 3648 1: /* vector header */ 3830 3649 __(movq vectorH.logsize(%arg_z),%arg_z) 3831 __( jmp *%ra0)3650 __(ret) 3832 3651 2: /* list. Maybe null, maybe dotted or circular. */ 3833 3652 __(movq $fixnumone,%temp2) … … 3853 3672 9: 3854 3673 __(movq %temp2,%arg_z) 3855 __( jmp *%ra0)3674 __(ret) 3856 3675 _endsubp(builtin_length) 3857 3676 … … 3867 3686 __(jb 2f) 3868 3687 __(movl $nil_value,%arg_z_l) 3869 __( jmp *%ra0)3688 __(ret) 3870 3689 1: __(movl $t_value,%arg_z_l) 3871 __( jmp *%ra0)3690 __(ret) 3872 3691 2: 3873 3692 __(jump_builtin(_builtin_seqtype,1)) … … 3895 3714 __(jnz 4f) 3896 3715 __(movq %arg_x,%arg_z) 3897 __( jmp *%ra0)3716 __(ret) 3898 3717 4: __(cmpb $fulltag_nil,%arg_z_b) 3899 3718 5: __(jnz 1b) 3900 __( jmp *%ra0)3719 __(ret) 3901 3720 _endsubp(builtin_assq) 3902 3721 … … 3916 3735 __(movq %temp0,%arg_z) 3917 3736 3: __(jnz 1b) 3918 4: __( jmp *%ra0)3737 4: __(ret) 3919 3738 _endsubp(builtin_memq) 3920 3739 … … 3938 3757 __(bt %imm0,%arg_z) 3939 3758 __(condition_to_boolean(b,%imm0,%arg_z)) 3940 __( jmp *%ra0)3759 __(ret) 3941 3760 1: __(jump_builtin(_builtin_logbitp,2)) 3942 3761 _endsubp(builtin_logbitp) … … 3948 3767 __(jne 1f) 3949 3768 __(orq %arg_y,%arg_z) 3950 __( jmp *%ra0)3769 __(ret) 3951 3770 1: 3952 3771 __(jump_builtin(_builtin_logior,2)) … … 3960 3779 __(jne 1f) 3961 3780 __(andq %arg_y,%arg_z) 3962 __( jmp *%ra0)3781 __(ret) 3963 3782 1: 3964 3783 __(jump_builtin(_builtin_logand,2)) … … 3970 3789 __(negq %arg_z) 3971 3790 __(jo,pn C(fix_one_bit_overflow)) 3972 __( jmp *%ra0)3791 __(ret) 3973 3792 1: 3974 3793 __(jump_builtin(_builtin_negate,1)) … … 3981 3800 __(jne 1f) 3982 3801 __(xorq %arg_y,%arg_z) 3983 __( jmp *%ra0)3802 __(ret) 3984 3803 1: 3985 3804 __(jump_builtin(_builtin_logxor,2)) … … 4010 3829 __(jnz 1f) 4011 3830 __(movq %arg_y,%arg_z) /* shift by 0 */ 4012 __( jmp *%ra0)3831 __(ret) 4013 3832 1: __(jns 3f) 4014 3833 __(rcmpq(%imm0,$63)) … … 4016 3835 __(sar $63,%imm1) 4017 3836 __(box_fixnum(%imm1,%arg_z)) 4018 __( jmp *%ra0)3837 __(ret) 4019 3838 2: /* Rightshift by small fixnum */ 4020 3839 __(negb %imm0_b) … … 4023 3842 __(xorl %ecx,%ecx) 4024 3843 __(box_fixnum(%imm1,%arg_z)) 4025 __( jmp *%ra0)3844 __(ret) 4026 3845 3: /* Left shift by fixnum. We cant shift by more than 63 bits, though */ 4027 3846 /* shifting by 64 is actually easy. */ … … 4088 3907 0: 4089 3908 /* Save lisp registers */ 3909 __(push %rbp) 3910 __(movq %rsp,%rbp) 4090 3911 __(push %temp0) 4091 3912 __(push %temp1) … … 4097 3918 __(push %save1) 4098 3919 __(push %save2) 4099 __(push %save3) 3920 __(push %save3) /* 10 registers pushed after %rbp */ 4100 3921 __(push %fn) 4101 __(push %ra0)4102 __(push %rbp)4103 __(movq %rsp,%rbp)4104 3922 __(movq %rsp,%rcontext:tcr.save_vsp) 4105 3923 __(movq %rbp,%rcontext:tcr.save_rbp) … … 4171 3989 __(movq $TCR_STATE_LISP,%rcontext:tcr.valence) 4172 3990 __(movq %rcontext:tcr.save_vsp,%rsp) 4173 __(pop %rbp) 4174 __(pop %ra0) 3991 __(movq %rcontext:tcr.save_rbp,%rbp) 4175 3992 __(pop %fn) 4176 3993 __(pop %save3) … … 4186 4003 __(check_pending_interrupt(%temp0)) 4187 4004 __(pop %temp0) 4188 __(jmp *%ra0) 4005 __(leave) 4006 __(ret) 4189 4007 _endsubp(ffcall) 4190 4008 … … 4198 4016 0: 4199 4017 /* Save lisp registers */ 4018 __(push %rbp) 4019 __(movq %rsp,%rbp) 4200 4020 __(push %temp0) 4201 4021 __(push %temp1) … … 4210 4030 __(movq macptr.address(%arg_y),%rbx) /* %rbx nonvolatile */ 4211 4031 __(push %fn) 4212 __(push %ra0)4213 __(push %rbp)4214 __(movq %rsp,%rbp)4215 4032 __(movq %rsp,%rcontext:tcr.save_vsp) 4216 4033 __(movq %rbp,%rcontext:tcr.save_rbp) … … 4286 4103 __(movq $TCR_STATE_LISP,%rcontext:tcr.valence) 4287 4104 __(movq %rcontext:tcr.save_vsp,%rsp) 4288 __(pop %rbp) 4289 __(pop %ra0) 4105 __(movq %rcontext:tcr.save_rbp,%rbp) 4290 4106 __(pop %fn) 4291 4107 __(pop %save3) … … 4301 4117 __(check_pending_interrupt(%temp0)) 4302 4118 __(pop %temp0) 4303 __(jmp *%ra0) 4119 __(leave) 4120 __(ret) 4304 4121 _endsubp(ffcall_returning_registers) 4305 4122 4306 4123 _spentry(syscall) 4307 4124 /* Save lisp registers */ 4125 __(push %rbp) 4126 __(movq %rsp,%rbp) 4308 4127 __(push %temp0) 4309 4128 __(push %temp1) … … 4317 4136 __(push %save3) 4318 4137 __(push %fn) 4319 __(push %ra0)4320 __(push %rbp)4321 __(movq %rsp,%rbp)4322 4138 __(movq %rsp,%rcontext:tcr.save_vsp) 4139 __(movq %rbp,%rcontext:tcr.save_rbp) 4323 4140 __(movq %rcontext:tcr.foreign_sp,%rsp) 4324 4141 __(movq $TCR_STATE_FOREIGN,%rcontext:tcr.valence) … … 4356 4173 __(movq $TCR_STATE_LISP,%rcontext:tcr.valence) 4357 4174 __(movq %rcontext:tcr.save_vsp,%rsp) 4358 __(pop %rbp) 4359 __(pop %ra0) 4175 __(movq %rcontext:tcr.save_rbp,%rbp) 4360 4176 __(pop %fn) 4361 4177 __(pop %save3) … … 4370 4186 __(check_pending_interrupt(%temp0)) 4371 4187 __(pop %temp0) 4372 __(jmp *%ra0) 4188 __(leave) 4189 __(ret) 4373 4190 _endsubp(syscall) 4374 4191 … … 4517 4334 __(movq %rcontext:tcr.save_rbp,%rbp) 4518 4335 __(movq $nrs.callbacks,%fname) 4336 __(lea local_label(back_from_callback)(%rip),%ra0) 4519 4337 __(set_nargs(2)) 4520 __(lea local_label(back_from_callback)(%rip),%ra0)4338 __(push %ra0) 4521 4339 __(jump_fname()) 4522 4340 __(tra(local_label(back_from_callback))) … … 4707 4525 4708 4526 4709 /* %arg_z < %arg_y + %arg_z. Do the fixnum case  including overflow  */ 4710 /* inline. Call out otherwise. */ 4711 _spentry(nbuiltin_plus) 4712 __(movb %arg_z_b,%imm0_b) 4713 __(orb %arg_y_b,%imm0_b) 4714 __(testb $fixnummask,%imm0_b) 4715 __(jne 1f) 4716 __(addq %arg_y,%arg_z) 4717 __(jo,pn C(nfix_one_bit_overflow)) 4718 __(ret) 4719 1: __(pop_jump_builtin(_builtin_plus,2)) 4720 _endsubp(nbuiltin_plus) 4721 4722 4723 /* %arg_z < %arg_z  %arg_y. Do the fixnum case  including overflow  */ 4724 /* inline. Call out otherwise. */ 4725 _spentry(nbuiltin_minus) 4726 __(movb %arg_z_b,%imm0_b) 4727 __(orb %arg_y_b,%imm0_b) 4728 __(testb $fixnummask,%imm0_b) 4729 __(jne 1f) 4730 __(xchgq %arg_y,%arg_z) 4731 __(subq %arg_y,%arg_z) 4732 __(jo,pn C(nfix_one_bit_overflow)) 4733 __(ret) 4734 1: __(pop_jump_builtin(_builtin_minus,2)) 4735 _endsubp(nbuiltin_minus) 4736 4737 /* %arg_z < %arg_z * %arg_y. Do the fixnum case  including overflow  */ 4738 /* inline. Call out otherwise. */ 4739 _spentry(nbuiltin_times) 4740 __(movb %arg_z_b,%imm0_b) 4741 __(orb %arg_y_b,%imm0_b) 4742 __(testb $fixnummask,%imm0_b) 4743 __(jne 2f) 4744 __(unbox_fixnum(%arg_z,%imm0)) 4745 /* 128bit fixnum result in %imm1:%imm0. Overflow set if %imm1 */ 4746 /* is significant */ 4747 __(imul %arg_y) 4748 __(jo 1f) 4749 __(mov %imm0,%arg_z) 4750 __(ret) 4751 1: __(unbox_fixnum(%arg_z,%imm0)) 4752 __(unbox_fixnum(%arg_y,%imm1)) 4753 __(imul %imm1) 4754 __(jmp C(nmakes128)) 4755 2: __(pop_jump_builtin(_builtin_times,2)) 4756 _endsubp(nbuiltin_times) 4757 4758 _spentry(nbuiltin_div) 4759 __(pop_jump_builtin(_builtin_div,2)) 4760 4761 /* %arg_z < (= %arg_y %arg_z). */ 4762 _spentry(nbuiltin_eq) 4763 __(movb %arg_z_b,%imm0_b) 4764 __(orb %arg_y_b,%imm0_b) 4765 __(testb $fixnummask,%imm0_b) 4766 __(jne 1f) 4767 __(rcmpq(%arg_z,%arg_y)) 4768 __(condition_to_boolean(e,%imm0,%arg_z)) 4769 __(ret) 4770 1: __(pop_jump_builtin(_builtin_eq,2)) 4771 _endsubp(nbuiltin_eq) 4772 4773 /* %arg_z < (/= %arg_y %arg_z). */ 4774 _spentry(nbuiltin_ne) 4775 __(movb %arg_z_b,%imm0_b) 4776 __(orb %arg_y_b,%imm0_b) 4777 __(testb $fixnummask,%imm0_b) 4778 __(jne 1f) 4779 __(rcmpq(%arg_z,%arg_y)) 4780 __(condition_to_boolean(ne,%imm0,%arg_z)) 4781 __(ret) 4782 1: __(pop_jump_builtin(_builtin_ne,2)) 4783 _endsubp(nbuiltin_ne) 4784 4785 /* %arg_z < (> %arg_y %arg_z). */ 4786 _spentry(nbuiltin_gt) 4787 __(movb %arg_z_b,%imm0_b) 4788 __(orb %arg_y_b,%imm0_b) 4789 __(testb $fixnummask,%imm0_b) 4790 __(jne 1f) 4791 __(rcmpq(%arg_y,%arg_z)) 4792 __(condition_to_boolean(g,%imm0,%arg_z)) 4793 __(ret) 4794 1: __(pop_jump_builtin(_builtin_gt,2)) 4795 _endsubp(nbuiltin_gt) 4796 4797 /* %arg_z < (>= %arg_y %arg_z). */ 4798 _spentry(nbuiltin_ge) 4799 __(movb %arg_z_b,%imm0_b) 4800 __(orb %arg_y_b,%imm0_b) 4801 __(testb $fixnummask,%imm0_b) 4802 __(jne 1f) 4803 __(rcmpq(%arg_y,%arg_z)) 4804 __(condition_to_boolean(ge,%imm0,%arg_z)) 4805 __(ret) 4806 1: __(pop_jump_builtin(_builtin_ge,2)) 4807 _endsubp(nbuiltin_ge) 4808 4809 /* %arg_z < (< %arg_y %arg_z). */ 4810 _spentry(nbuiltin_lt) 4811 __(movb %arg_z_b,%imm0_b) 4812 __(orb %arg_y_b,%imm0_b) 4813 __(testb $fixnummask,%imm0_b) 4814 __(jne 1f) 4815 __(rcmpq(%arg_y,%arg_z)) 4816 __(condition_to_boolean(l,%imm0,%arg_z)) 4817 __(ret) 4818 1: __(pop_jump_builtin(_builtin_lt,2)) 4819 _endsubp(nbuiltin_lt) 4820 4821 /* %arg_z < (<= %arg_y %arg_z). */ 4822 _spentry(nbuiltin_le) 4823 __(movb %arg_z_b,%imm0_b) 4824 __(orb %arg_y_b,%imm0_b) 4825 __(testb $fixnummask,%imm0_b) 4826 __(jne 1f) 4827 __(rcmpq(%arg_y,%arg_z)) 4828 __(condition_to_boolean(le,%imm0,%arg_z)) 4829 __(ret) 4830 1: __(pop_jump_builtin(_builtin_le,2)) 4831 _endsubp(nbuiltin_le) 4832 4833 _spentry(nbuiltin_eql) 4834 __(cmpq %arg_y,%arg_z) 4835 __(je 1f) 4836 /* Not EQ. Could only possibly be EQL if both are tagmisc */ 4837 /* and both have the same subtag */ 4838 __(extract_lisptag(%arg_y,%imm0)) 4839 __(extract_lisptag(%arg_z,%imm1)) 4840 __(cmpb $tag_misc,%imm0_b) 4841 __(jne 2f) 4842 __(cmpb %imm0_b,%imm1_b) 4843 __(jne 2f) 4844 __(extract_subtag(%arg_y,%imm0_b)) 4845 __(extract_subtag(%arg_z,%imm1_b)) 4846 __(cmpb %imm0_b,%imm1_b) 4847 __(jne 2f) 4848 __(pop_jump_builtin(_builtin_eql,2)) 4849 1: __(movl $t_value,%arg_z_l) 4850 __(ret) 4851 2: __(movl $nil_value,%arg_z_l) 4852 __(ret) 4853 _endsubp(nbuiltin_eql) 4854 4855 _spentry(nbuiltin_length) 4856 __(extract_lisptag(%arg_z,%imm0)) 4857 __(cmpb $tag_list,%imm0_b) 4858 __(jz 2f) 4859 __(cmpb $tag_misc,%imm0_b) 4860 __(jnz 8f) 4861 __(extract_subtag(%arg_z,%imm0_b)) 4862 __(rcmpb(%imm0_b,$min_vector_subtag)) 4863 __(jb 8f) 4864 __(je 1f) 4865 /* (simplearray * (*)) */ 4866 __(movq %arg_z,%arg_y) 4867 __(vector_length(%arg_y,%arg_z)) 4868 __(ret) 4869 1: /* vector header */ 4870 __(movq vectorH.logsize(%arg_z),%arg_z) 4871 __(ret) 4872 2: /* list. Maybe null, maybe dotted or circular. */ 4873 __(movq $fixnumone,%temp2) 4874 __(movq %arg_z,%temp0) /* fast pointer */ 4875 __(movq %arg_z,%temp1) /* slow pointer */ 4876 3: __(extract_lisptag(%temp0,%imm0)) 4877 __(compare_reg_to_nil(%temp0)) 4878 __(leaq fixnumone(%temp2),%temp2) 4879 __(je 9f) 4880 __(cmpb $tag_list,%imm0_b) 4881 __(jne 8f) 4882 __(extract_lisptag(%temp1,%imm1)) 4883 __(testb $fixnumone,%temp2_b) 4884 __(_cdr(%temp0,%temp0)) 4885 __(je 3b) 4886 __(cmpb $tag_list,%imm1_b) 4887 __(jne 8f) 4888 __(_cdr(%temp1,%temp1)) 4889 __(cmpq %temp0,%temp1) 4890 __(jne 3b) 4891 8: 4892 __(pop_jump_builtin(_builtin_length,1)) 4893 9: 4894 __(movq %temp2,%arg_z) 4895 __(ret) 4896 _endsubp(nbuiltin_length) 4897 4898 4899 _spentry(nbuiltin_seqtype) 4900 __(extract_lisptag(%arg_z,%imm0)) 4901 __(cmpb $tag_list,%imm0_b) 4902 __(jz 1f) 4903 __(cmpb $tag_misc,%imm0_b) 4904 __(jne 2f) 4905 __(movb misc_subtag_offset(%arg_z),%imm0_b) 4906 __(rcmpb(%imm0_b,$min_vector_subtag)) 4907 __(jb 2f) 4908 __(movl $nil_value,%arg_z_l) 4909 __(ret) 4910 1: __(movl $t_value,%arg_z_l) 4911 __(ret) 4912 2: 4913 __(pop_jump_builtin(_builtin_seqtype,1)) 4914 _endsubp(nbuiltin_seqtype) 4915 4916 _spentry(nbuiltin_assq) 4917 __(cmpb $fulltag_nil,%arg_z_b) 4918 __(jz 5f) 4919 1: __(movb $tagmask,%imm0_b) 4920 __(andb %arg_z_b,%imm0_b) 4921 __(cmpb $tag_list,%imm0_b) 4922 __(jz,pt 2f) 4923 __(uuo_error_reg_not_list(Rarg_z)) 4924 2: __(_car(%arg_z,%arg_x)) 4925 __(_cdr(%arg_z,%arg_z)) 4926 __(cmpb $fulltag_nil,%arg_x_b) 4927 __(jz 4f) 4928 __(movb $tagmask,%imm0_b) 4929 __(andb %arg_x_b,%imm0_b) 4930 __(cmpb $tag_list,%imm0_b) 4931 __(jz,pt 3f) 4932 __(uuo_error_reg_not_list(Rarg_x)) 4933 3: __(_car(%arg_x,%temp0)) 4934 __(cmpq %temp0,%arg_y) 4935 __(jnz 4f) 4936 __(movq %arg_x,%arg_z) 4937 __(ret) 4938 4: __(cmpb $fulltag_nil,%arg_z_b) 4939 5: __(jnz 1b) 4940 __(ret) 4941 _endsubp(nbuiltin_assq) 4942 4943 _spentry(nbuiltin_memq) 4944 __(cmpb $fulltag_nil,%arg_z_b) 4945 __(jmp 3f) 4946 1: __(movb $tagmask,%imm0_b) 4947 __(andb %arg_z_b,%imm0_b) 4948 __(cmpb $tag_list,%imm0_b) 4949 __(jz,pt 2f) 4950 __(uuo_error_reg_not_list(Rarg_z)) 4951 2: __(_car(%arg_z,%arg_x)) 4952 __(_cdr(%arg_z,%temp0)) 4953 __(cmpq %arg_x,%arg_y) 4954 __(jz 4f) 4955 __(cmpb $fulltag_nil,%temp0_b) 4956 __(movq %temp0,%arg_z) 4957 3: __(jnz 1b) 4958 4: __(ret) 4959 _endsubp(nbuiltin_memq) 4960 4961 4962 _spentry(nbuiltin_logbitp) 4963 __(movb %arg_z_b,%imm0_b) 4964 __(orb %arg_y_b,%imm0_b) 4965 __(testb $fixnummask,%imm0_b) 4966 __(jnz 1f) 4967 __(unbox_fixnum(%arg_y,%imm0)) 4968 __(movl $logbitp_max_bit1+fixnumshift,%imm1_l) 4969 __(js 1f) /* bit number negative */ 4970 __(addb $fixnumshift,%imm0_b) 4971 __(cmpq $logbitp_max_bit<<fixnumshift,%arg_y) 4972 __(cmovael %imm1_l,%imm0_l) 4973 __(bt %imm0,%arg_z) 4974 __(condition_to_boolean(b,%imm0,%arg_z)) 4975 __(ret) 4976 1: __(pop_jump_builtin(_builtin_logbitp,2)) 4977 _endsubp(nbuiltin_logbitp) 4978 4979 _spentry(nbuiltin_logior) 4980 __(movb %arg_y_b,%imm0_b) 4981 __(orb %arg_z_b,%imm0_b) 4982 __(testb $fixnummask,%imm0_b) 4983 __(jne 1f) 4984 __(orq %arg_y,%arg_z) 4985 __(ret) 4986 1: 4987 __(pop_jump_builtin(_builtin_logior,2)) 4988 4989 _endsubp(nbuiltin_logior) 4990 4991 _spentry(nbuiltin_logand) 4992 __(movb %arg_y_b,%imm0_b) 4993 __(orb %arg_z_b,%imm0_b) 4994 __(testb $fixnummask,%imm0_b) 4995 __(jne 1f) 4996 __(andq %arg_y,%arg_z) 4997 __(ret) 4998 1: 4999 __(pop_jump_builtin(_builtin_logand,2)) 5000 _endsubp(nbuiltin_logand) 5001 5002 _spentry(nbuiltin_negate) 5003 __(testb $fixnummask,%arg_z_b) 5004 __(jne 1f) 5005 __(negq %arg_z) 5006 __(jo,pn C(nfix_one_bit_overflow)) 5007 __(ret) 5008 1: 5009 __(pop_jump_builtin(_builtin_negate,1)) 5010 _endsubp(nbuiltin_negate) 5011 5012 _spentry(nbuiltin_logxor) 5013 __(movb %arg_y_b,%imm0_b) 5014 __(orb %arg_z_b,%imm0_b) 5015 __(testb $fixnummask,%imm0_b) 5016 __(jne 1f) 5017 __(xorq %arg_y,%arg_z) 5018 __(ret) 5019 1: 5020 __(pop_jump_builtin(_builtin_logxor,2)) 5021 _endsubp(nbuiltin_logxor) 5022 5023 5024 _spentry(nbuiltin_aset1) 5025 __(pop %ra0) /* for now */ 5026 __(extract_typecode(%arg_x,%imm0)) 5027 __(box_fixnum(%imm0,%temp0)) 5028 __(cmpb $min_vector_subtag,%imm0_b) 5029 __(ja _SPsubtag_misc_set) 5030 __(jump_builtin(_builtin_aset1,3)) 5031 _endsubp(nbuiltin_aset1) 5032 5033 /* We have to be a little careful here %cl has to be used for */ 5034 /* the (unboxed) shift count in all variablelength shifts, and */ 5035 /* %temp2 = %rcx. Zero all but the low 8 (or 6) bits of %rcx, */ 5036 /* so that the shift count doesn't confuse the GC. */ 5037 5038 _spentry(nbuiltin_ash) 5039 __(movb %arg_y_b,%imm0_b) 5040 __(orb %arg_z_b,%imm0_b) 5041 __(testb $fixnummask,%imm0_b) 5042 __(jne 9f) 5043 __(unbox_fixnum(%arg_y,%imm1)) 5044 __(unbox_fixnum(%arg_z,%imm0)) 5045 /* Z flag set if zero ASH shift count */ 5046 __(jnz 1f) 5047 __(movq %arg_y,%arg_z) /* shift by 0 */ 5048 __(ret) 5049 1: __(jns 3f) 5050 __(rcmpq(%imm0,$63)) 5051 __(jg 2f) 5052 __(sar $63,%imm1) 5053 __(box_fixnum(%imm1,%arg_z)) 5054 __(ret) 5055 2: /* Rightshift by small fixnum */ 5056 __(negb %imm0_b) 5057 __(movzbl %imm0_b,%ecx) 5058 __(sar %cl,%imm1) 5059 __(xorl %ecx,%ecx) 5060 __(box_fixnum(%imm1,%arg_z)) 5061 __(ret) 5062 3: /* Left shift by fixnum. We cant shift by more than 63 bits, though */ 5063 /* shifting by 64 is actually easy. */ 5064 __(rcmpq(%imm0,$64)) 5065 __(jg 9f) 5066 __(jne 4f) 5067 /* leftshift by 64bits exactly */ 5068 __(xorl %imm0_l,%imm0_l) 5069 __(jmp C(nmakes128)) 5070 4: /* leftshift by 1..63 bits. Safe to move shift count to %rcx/%cl */ 5071 __(movzbl %imm0_b,%ecx) /* zeroextending mov */ 5072 __(movq %imm1,%imm0) 5073 __(sarq $63,%imm1) 5074 __(js 5f) 5075 __(shld %cl,%imm0,%imm1) 5076 __(shl %cl,%imm0) 5077 __(xorb %cl,%cl) 5078 __(jmp C(nmakes128)) 5079 5: __(shld %cl,%imm0,%imm1) 5080 __(shl %cl,%imm0) 5081 __(xorb %cl,%cl) 5082 __(jmp C(nmakes128)) 5083 9: 5084 __(pop_jump_builtin(_builtin_ash,2)) 5085 _endsubp(nbuiltin_ash) 5086 5087 _spentry(nbuiltin_aref1) 5088 __(pop %ra0) /* for now */ 5089 __(extract_typecode(%arg_y,%imm0)) 5090 __(cmpb $min_vector_subtag,%imm0_b) 5091 __(box_fixnum_no_flags(%imm0,%arg_x)) 5092 __(ja _SPsubtag_misc_ref) 5093 __(jump_builtin(_builtin_aref1,2)) 5094 _endsubp(nbuiltin_aref1) 5095 5096 5097 _spentry(nmakeu64) 5098 __(movq %imm0,%imm1) 5099 __(shlq $fixnumshift+1,%imm1) 5100 __(movq %imm1,%arg_z) /* Tagged as a fixnum, 2x */ 5101 __(shrq $fixnumshift+1,%imm1) 5102 __(shrq %arg_z) 5103 __(cmpq %imm0,%imm1) 5104 __(je 9f) 5105 __(testq %imm0,%imm0) 5106 __(movd %imm0,%mm0) 5107 __(js 3f) 5108 /* Make a 2digit bignum. */ 5109 __(movl $two_digit_bignum_header,%imm0_l) 5110 __(movl $aligned_bignum_size(2),%imm1_l) 5111 __(Misc_Alloc(%arg_z)) 5112 __(movq %mm0,misc_data_offset(%arg_z)) 5113 __(jmp *%ra0) 5114 3: __(movl $three_digit_bignum_header,%imm0_l) 5115 __(movl $aligned_bignum_size(3),%imm1_l) 5116 __(Misc_Alloc(%arg_z)) 5117 __(movq %mm0,misc_data_offset(%arg_z)) 5118 9: __(ret) 5119 _endsubp(nmakeu64) 5120 5121 /* on entry: arg_z = symbol. On exit, arg_z = value (possibly */ 5122 /* unbound_marker), arg_y = symbol */ 5123 _spentry(nspecref) 5124 __(movq symbol.binding_index(%arg_z),%imm0) 5125 __(cmp %rcontext:tcr.tlb_limit,%imm0) 5126 __(movq %rcontext:tcr.tlb_pointer,%imm1) 5127 __(movq %arg_z,%arg_y) 5128 __(jae 7f) 5129 __(movq (%imm1,%imm0),%arg_z) 5130 __(cmpb $no_thread_local_binding_marker,%arg_z_b) 5131 __(jne 8f) 5132 7: __(movq symbol.vcell(%arg_y),%arg_z) 5133 8: __(ret) 5134 _endsubp(nspecref) 5135 5136 /* arg_y = special symbol, arg_z = new value. */ 5137 _spentry(nspecset) 5138 __(movq symbol.binding_index(%arg_y),%imm0) 5139 __(cmp %rcontext:tcr.tlb_limit,%imm0) 5140 __(movq %rcontext:tcr.tlb_pointer,%imm1) 5141 __(jae 1f) 5142 __(movq (%imm1,%imm0),%arg_x) 5143 __(cmpb $no_thread_local_binding_marker,%arg_x_b) 5144 __(je 1f) 5145 __(movq %arg_z,(%imm1,%imm0)) 5146 __(ret) 5147 1: __(lea fulltag_miscfulltag_symbol(%arg_y),%arg_x) 5148 __(movq $1<<fixnumshift,%arg_y) 5149 __(pop %ra0) 5150 __(jmp _SPgvset) 5151 _endsubp(nspecset) 5152 5153 _spentry(nspecrefcheck) 5154 __(movq symbol.binding_index(%arg_z),%imm0) 5155 __(cmp %rcontext:tcr.tlb_limit,%imm0) 5156 __(movq %rcontext:tcr.tlb_pointer,%imm1) 5157 __(movq %arg_z,%arg_y) 5158 __(jae 7f) 5159 __(movq (%imm1,%imm0),%arg_z) 5160 __(cmpb $no_thread_local_binding_marker,%arg_z_b) 5161 __(jne 8f) 5162 7: __(movq symbol.vcell(%arg_y),%arg_z) 5163 8: __(cmpb $unbound_marker,%arg_z_b) 5164 __(jne,pt 9f) 5165 __(uuo_error_reg_unbound(Rarg_y)) 5166 9: __(ret) 5167 _endsubp(nspecrefcheck) 4527 5168 4528 5169 4529 /* Prepend all but the first five (4 words of code, inner fn) and last */ 5170 4530 /* (lfbits) elements of %fn to the "arglist". */ 5171 4531 5172 _spentry(ncall_closure) 4532 _spentry(call_closure) 4533 new_local_labels() 5173 4534 __(subq $fulltag_functionfulltag_misc,%fn) 5174 4535 __(vector_length(%fn,%imm0)) … … 5176 4537 5177 4538 __(subq $6<<fixnumshift,%imm0) /* imm0 = inherited arg count */ 4539 __(lea (%nargs_q,%imm0),%imm1) 4540 __(cmpw $nargregs<<fixnumshift,%imm1_w) 4541 __(jna,pt local_label(regs_only)) 4542 __(pop %ra0) 5178 4543 __(cmpw $nargregs<<fixnumshift,%nargs) 5179 __(jna,pt local_label(n no_insert))4544 __(jna,pt local_label(no_insert)) 5180 4545 5181 4546 /* Some arguments have already been pushed. Push imm0's worth */ … … 5185 4550 5186 4551 __(movq %imm0,%imm1) 5187 local_label( npush_nil_loop):4552 local_label(push_nil_loop): 5188 4553 __(push $nil_value) 5189 4554 __(sub $fixnumone,%imm1) 5190 __(jne local_label( npush_nil_loop))4555 __(jne local_label(push_nil_loop)) 5191 4556 5192 4557 /* Need to use arg regs as temporaries here. */ … … 5197 4562 __(lea 3*node_size(%rsp,%imm0),%arg_x) 5198 4563 __(lea nargregs<<fixnumshift(%nargs_q),%arg_y) 5199 local_label( ncopy_already_loop):4564 local_label(copy_already_loop): 5200 4565 __(movq (%arg_x),%arg_z) 5201 4566 __(addq $fixnumone,%arg_x) … … 5203 4568 __(addq $fixnumone,%temp1) 5204 4569 __(subq $fixnumone,%arg_y) 5205 __(jne local_label( ncopy_already_loop))4570 __(jne local_label(copy_already_loop)) 5206 4571 5207 4572 __(movl $5<<fixnumshift,%imm1_l) /* skip code, new fn */ 5208 local_label( ninsert_loop):4573 local_label(insert_loop): 5209 4574 __(movq misc_data_offset(%fn,%imm1),%arg_z) 5210 4575 __(addq $node_size,%imm1) … … 5213 4578 __(movq %arg_z,(%arg_x)) 5214 4579 __(subq $fixnum_one,%imm0) 5215 __(jne local_label( ninsert_loop))4580 __(jne local_label(insert_loop)) 5216 4581 5217 4582 /* Recover the argument registers, pushed earlier */ … … 5219 4584 __(pop %arg_y) 5220 4585 __(pop %arg_z) 5221 __(jmp local_label( ngo))4586 __(jmp local_label(go)) 5222 4587 5223 4588 /* Here if nothing was pushed by the caller. If we're */ … … 5226 4591 /* sum of %nargs and %imm0 is greater than nargregs) */ 5227 4592 5228 local_label(n no_insert):4593 local_label(no_insert): 5229 4594 __(lea (%nargs_q,%imm0),%imm1) 5230 4595 __(cmpq $nargregs<<fixnumshift,%imm1) 5231 __(jna local_label(n no_insert_no_frame))4596 __(jna local_label(no_insert_no_frame)) 5232 4597 /* Reserve space for a stack frame */ 5233 4598 __(push $reserved_frame_marker) 5234 4599 __(push $reserved_frame_marker) 5235 local_label(n no_insert_no_frame):4600 local_label(no_insert_no_frame): 5236 4601 /* nargregs or fewer args were already vpushed. */ 5237 4602 /* if exactly nargregs, vpush remaining inherited vars. */ … … 5239 4604 __(movl $5<<fixnumshift,%imm1_l) /* skip code, new fn */ 5240 4605 __(leaq 5<<fixnumshift(%imm0),%temp1) 5241 __(jnz local_label( nset_regs))5242 local_label( nvpush_remaining):4606 __(jnz local_label(set_regs)) 4607 local_label(vpush_remaining): 5243 4608 __(push misc_data_offset(%fn,%imm1)) 5244 4609 __(addq $node_size,%imm1) 5245 4610 __(addw $fixnumone,%nargs) 5246 4611 __(subq $node_size,%imm0) 5247 __(jnz local_label( nvpush_remaining))5248 __(jmp local_label( ngo))5249 local_label( nset_regs):4612 __(jnz local_label(vpush_remaining)) 4613 __(jmp local_label(go)) 4614 local_label(set_regs): 5250 4615 /* if nargs was > 1 (and we know that it was < 3), it must have */ 5251 4616 /* been 2. Set arg_x, then vpush the remaining args. */ 5252 4617 __(cmpw $fixnumone,%nargs) 5253 __(jle local_label( nset_y_z))5254 local_label( nset_arg_x):4618 __(jle local_label(set_y_z)) 4619 local_label(set_arg_x): 5255 4620 __(subq $node_size,%temp1) 5256 4621 __(movq misc_data_offset(%fn,%temp1),%arg_x) 5257 4622 __(addw $fixnumone,%nargs) 5258 4623 __(subq $fixnumone,%imm0) 5259 __(jne local_label( nvpush_remaining))5260 __(jmp local_label( ngo))4624 __(jne local_label(vpush_remaining)) 4625 __(jmp local_label(go)) 5261 4626 /* Maybe set arg_y or arg_z, preceding args */ 5262 local_label( nset_y_z):5263 __(jne local_label( nset_arg_z))4627 local_label(set_y_z): 4628 __(jne local_label(set_arg_z)) 5264 4629 /* Set arg_y, maybe arg_x, preceding args */ 5265 local_label( nset_arg_y):4630 local_label(set_arg_y): 5266 4631 __(subq $node_size,%temp1) 5267 4632 __(movq misc_data_offset(%fn,%temp1),%arg_y) 5268 4633 __(addw $fixnumone,%nargs) 5269 4634 __(subq $fixnum_one,%imm0) 5270 __(jnz local_label( nset_arg_x))5271 __(jmp local_label( ngo))5272 local_label( nset_arg_z):4635 __(jnz local_label(set_arg_x)) 4636 __(jmp local_label(go)) 4637 local_label(set_arg_z): 5273 4638 __(subq $node_size,%temp1) 5274 4639 __(movq misc_data_offset(%fn,%temp1),%arg_z) 5275 4640 __(addw $fixnumone,%nargs) 5276 4641 __(subq $fixnum_one,%imm0) 5277 __(jne local_label( nset_arg_y))5278 local_label( ngo):4642 __(jne local_label(set_arg_y)) 4643 local_label(go): 5279 4644 __(movq misc_data_offset+(4*node_size)(%fn),%fn) 5280 __(jmp *%fn) 5281 _endsubp(ncall_closure) 4645 __(push %ra0) 4646 __(jmp *%fn) 4647 local_label(regs_only): 4648 __(leaq 5<<fixnumshift(%imm0),%temp1) 4649 __(testw %nargs,%nargs) 4650 __(jne local_label(some_args)) 4651 __(cmpw $node_size,%imm0) 4652 __(movq misc_data_offsetnode_size(%fn,%temp1),%arg_z) 4653 __(je local_label(rgo)) 4654 __(cmpw $2*node_size,%imm0) 4655 __(movq misc_data_offset(node_size*2)(%fn,%temp1),%arg_y) 4656 __(je local_label(rgo)) 4657 __(movq misc_data_offset(node_size*3)(%fn,%temp1),%arg_x) 4658 local_label(rgo): 4659 __(addw %imm0_w,%nargs) 4660 __(jmp *misc_data_offset+(4*node_size)(%fn)) 4661 local_label(some_args): 4662 __(cmpw $2*node_size,%nargs) 4663 __(jz local_label(rtwo)) 4664 /* One arg was passed, could be one or two inherited args */ 4665 __(cmpw $node_size,%imm0) 4666 __(movq misc_data_offsetnode_size(%fn,%temp1),%arg_y) 4667 __(je local_label(rgo)) 4668 __(movq misc_data_offset(node_size*2)(%fn,%temp1),%arg_x) 4669 __(jmp local_label(rgo)) 4670 local_label(rtwo): 4671 __(movq misc_data_offsetnode_size(%fn,%temp1),%arg_x) 4672 __(jmp local_label(rgo)) 4673 _endsubp(call_closure) 5282 4674 5283 4675
Note: See TracChangeset
for help on using the changeset viewer.