Changeset 13680
- Timestamp:
- May 1, 2010, 8:24:09 PM (15 years ago)
- Location:
- branches/arm/lisp-kernel
- Files:
-
- 3 edited
-
arm-constants.s (modified) (7 diffs)
-
arm-macros.s (modified) (3 diffs)
-
arm-spentry.s (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-constants.s
r13679 r13680 43 43 44 44 /* registers. These assignments may not be viable. */ 45 /* a lisp_frame contains the caller's fn, vsp (or an adjusted copy), */ 46 /* a proxy for sp, and the lr. (we need to use a proxy for sp, since */ 47 /* use of sp in the register list is deprecated and we generally save / */ 48 /* restore lisp_frames on sp and use writeback to sp. */ 49 50 define(`fn',`r0') 51 define(`vsp',`r1') 52 define(`arg_z',`r2') 53 define(`arg_y',`r3') 54 define(`arg_x',`r4') 55 define(`temp0',`r5') 56 define(`temp1',`r6') 57 define(`temp2',`r7') 58 define(`imm0',`r8') /* even, so ldrd/strd can use imm0/imm1 */ 59 define(`imm1',`r9') 60 define(`imm2',`r10') 45 46 define(`arg_z',`r0') 47 define(`arg_y',`r1') 48 define(`arg_x',`r2') 49 define(`temp0',`r3') 50 define(`temp1',`r4') 51 define(`temp2',`r5') 52 define(`imm0',`r6') /* even, so ldrd/strd can use imm0/imm1 */ 53 define(`imm1',`r7') 54 define(`imm2',`r9') 55 define(`vsp',`r9') 56 define(`fn',`r10') 61 57 define(`rcontext',`r11') 62 58 define(`allocptr',`r12') … … 128 124 nil_value = (0x10000000+fulltag_nil) 129 125 misc_bias = fulltag_misc 130 cons_bias = tag_list 126 cons_bias = tag_list 127 128 unsigned_byte_24_mask = 0xe0000003 /* bits that should be clear in a boxed */ 129 /* (UNSIGNED-BYTE 24) */ 130 131 131 132 132 /* Functions are of (conceptually) unlimited size. */ … … 190 190 191 191 /*Immediate subtags. */ 192 define_subtag(lisp_frame_marker,fulltag_imm,2) 192 193 define_subtag(character,fulltag_imm,9) 193 194 define_subtag(unbound,fulltag_imm,6) … … 201 202 illegal_marker = subtag_illegal 202 203 no_thread_local_binding_marker = subtag_no_thread_local_binding 204 lisp_frame_marker = subtag_lisp_frame_marker 205 206 203 207 /*Numeric subtags. */ 204 208 … … 337 341 338 342 _struct(lisp_frame,0) 343 _node(marker) 339 344 _node(savefn) 340 345 _node(savevsp) 341 _node(savesp)342 346 _node(savelr) 343 347 _ends … … 676 680 define(`TCR_STATE_EXCEPTION_RETURN',4) 677 681 678 define(`RESERVATION_DISCHARGE',0x2004)679 682 680 683 lisp_globals_limit = fulltag_nil … … 750 753 xtype_bit = 40 751 754 752 755 stack_alloc_limit = 0x8000 753 756 754 757 INTERRUPT_LEVEL_BINDING_INDEX = fixnumone -
branches/arm/lisp-kernel/arm-macros.s
r13679 r13680 168 168 ') 169 169 170 /* This approach may not work if the symbol is too far from nil */171 170 define(`ref_nrs_symbol',` 172 __(mov $1,#nil_value)173 __(add $1,$ 1,#nrs.$2)171 __(movc16($3,nrs.$2)) 172 __(add $1,$3,#nil_value) 174 173 ') 175 174 … … 216 215 217 216 218 /* $1 = sp copy for instruction restriction, $2 = value for lisp_frame.savevsp */217 /* $1 = arg/temp reg for lisp_frame_marker, $2 = value for lisp_frame.savevsp */ 219 218 define(`build_lisp_frame',` 220 __(mov $1,sp) 221 __(stmdb sp!,{fn,ifelse($2,$2,vsp),$1,lr}) 222 ') 223 224 /* Have to use a temp (> vsp, < sp) to avoid having sp in the register list */ 219 __(mov $1,#lisp_frame_marker) 220 __(stmdb sp!,{$1,ifelse($2,$2,vsp),fn,lr}) 221 ') 222 223 /* This has the odd side effect of loading lisp_frame_marker into 224 the arg/temp/imm reg $1. I think that that's probably better 225 than adjusting sp and loading the other regs ; it'd be good 226 to say (at interrupt time) that there's either a lisp frame 227 on the stack or there isn't. */ 225 228 define(`restore_lisp_frame',` 226 __(ldm sp!,{ fn,vsp,$1,lr})229 __(ldm sp!,{$1,vsp,fn,lr}) 227 230 ') 228 231 229 232 define(`return_lisp_frame',` 230 __(ldm sp!,{ fn,vsp,$1,pc})233 __(ldm sp!,{$1,vsp,fn,pc}) 231 234 ') 232 235 … … 411 414 ') 412 415 413 414 /* Zero $3 bytes worth of doublewords, starting at offset $2 relative */ 415 /* to the base register $1. */ 416 417 418 ifdef(`DARWIN',` 419 .macro zero_doublewords 420 .if $2 421 stfd fp_zero,$1($0) 422 zero_doublewords $0,$1+8,$2-8 423 .endif 424 .endmacro 425 ') 426 427 ifdef(`LINUX',` 428 .macro zero_doublewords base,disp,nbytes 429 .if \nbytes 430 stfd fp_zero,\disp(\base) 431 zero_doublewords \base,\disp+8,\nbytes-8 432 .endif 433 .endm 434 ') 435 436 define(`Set_TSP_Frame_Unboxed',` 437 __(str(tsp,tsp_frame.type(tsp))) 438 ') 439 440 define(`Set_TSP_Frame_Boxed',` 441 __(str(rzero,tsp_frame.type(tsp))) 442 ') 443 444 /* A newly allocated TSP frame is always "raw" (has non-zero type, indicating */ 445 /* that it doesn't contain tagged data. */ 446 447 define(`TSP_Alloc_Fixed_Unboxed',` 448 __(stru(tsp,-($1+tsp_frame.data_offset)(tsp))) 449 __(Set_TSP_Frame_Unboxed()) 450 ') 451 452 define(`TSP_Alloc_Fixed_Unboxed_Zeroed',` 453 __(TSP_Alloc_Fixed_Unboxed($1)) 454 __(zero_doublewords tsp,tsp_frame.fixed_overhead,$1) 455 ') 456 457 define(`TSP_Alloc_Fixed_Boxed',` 458 __(TSP_Alloc_Fixed_Unboxed_Zeroed($1)) 459 __(Set_TSP_Frame_Boxed()) 460 ') 461 462 463 464 465 466 /* This assumes that the backpointer points to the first byte beyond */ 467 /* each frame. If we allow segmented tstacks, that constraint might */ 468 /* complicate their implementation. */ 469 /* We don't need to know the size of the frame (positive or negative, */ 470 /* with or without header). $1 and $2 are temp registers, $3 is an */ 471 /* optional CR field. */ 472 473 474 /* Handle the general case, where the frame might be empty */ 475 define(`Zero_TSP_Frame',` 476 __(new_macro_labels()) 477 __(la $1,tsp_frame.size-8(tsp)) 478 __(ldr($2,tsp_frame.backlink(tsp))) 479 __(la $2,-8($2)) 480 __(b macro_label(zero_tsp_test)) 481 macro_label(zero_tsp_loop): 482 __(stfdu fp_zero,8($1)) 483 macro_label(zero_tsp_test): 484 __(cmpr(ifelse($3,`',`cr0',$3),$1,$2)) 485 __(bne ifelse($3,`',`cr0',$3),macro_label(zero_tsp_loop)) 486 ') 487 488 /* Save some branching when we know that the frame can't be empty.*/ 489 define(`Zero_TSP_Frame_nz',` 490 new_macro_labels() 491 __(la $1,tsp_frame.size-8(tsp)) 492 __(ldr($2,tsp_frame.backlink(tsp))) 493 __(la $2,-8($2)) 494 macro_label(zero_tsp_loop): 495 __(stfdu fp_zero,8($1)) 496 __(cmpr(ifelse($3,`',`cr0',$3),$1,$2)) 497 __(bne ifelse($3,`',`cr0',$3),macro_label(zero_tsp_loop)) 498 ') 499 500 /* $1 = 8-byte-aligned size, positive. $2 (optiional) set */ 501 /* to negated size. */ 502 define(`TSP_Alloc_Var_Unboxed',` 503 __(neg ifelse($2,`',$1,$2),$1) 504 __(strux(tsp,tsp,ifelse($2,`',$1,$2))) 505 __(Set_TSP_Frame_Unboxed()) 506 ') 507 508 define(`TSP_Alloc_Var_Boxed',` 509 __(TSP_Alloc_Var_Unboxed($1)) 510 __(Zero_TSP_Frame($1,$2)) 511 __(Set_TSP_Frame_Boxed()) 512 ') 513 514 515 define(`TSP_Alloc_Var_Boxed_nz',` 516 __(TSP_Alloc_Var_Unboxed($1)) 517 __(Zero_TSP_Frame_nz($1,$2)) 518 __(Set_TSP_Frame_Boxed()) 519 ') 416 /* Stack-allocate an ivector and zero its contents; caller may 417 change subtag of header after it's zeroed. 418 $1 = header (tagged as subtag_u32_vector until zeroed), $2 = dnode- 419 aligned size in bytes). Both $1 and $2 are modified here. */ 420 define(`stack_allocate_zeroed_word_vector',` 421 new_macro_labels() 422 __(str $1,[sp,-$2]!) 423 __(mov $1,#0) 424 __(add $2,sp,$2) 425 __(b macro_label(test)) 426 macro_label(loop): 427 __(str $1,[$2]) 428 macro_label(test): 429 __(sub $2,#dnode_size) 430 __(cmp $2,sp) 431 __(str $1,[$2,#node_size]) 432 __(bne macro_label(loop)) 433 ') 434 520 435 521 436 define(`check_enabled_pending_interrupt',` -
branches/arm/lisp-kernel/arm-spentry.s
r13679 r13680 185 185 186 186 _spentry(makeu64) 187 __(cmp imm1, 0)187 __(cmp imm1,#0) 188 188 __(beq _SPmakeu32) 189 189 __(blt 3f) … … 983 983 __(mov arg_z,#nil_value) 984 984 C(stkconslist_star): 985 __(mov temp2,nargs,lsl 1)985 __(mov temp2,nargs,lsl #1) 986 986 __(add temp2,temp2,#node_size) 987 987 __(mov imm0,temp2,lsl #num_subtag_bits-word_shift) 988 988 __(orr imm0,imm0,#subtag_u32_vector) 989 __(add temp2,temp2,#node_size) 990 __(mov imm1,#0) 991 __(mov temp1,sp) 992 __(str imm0,[sp,-temp2]!) 993 __(add temp2,sp,#dnode_size) 994 __(str imm1,[sp,#node_size]) 989 __(stack_allocate_zeroed_word_vector(imm0,temp2)) 995 990 __(mov imm0,#subtag_simple_vector) 996 __(b 2f)997 1: __(str imm1,[temp1,#-node_size]!)998 __(str imm1,[temp1,#-node_size]!)999 2: __(cmp temp2,temp1)1000 __(bne 1b)1001 991 __(strb imm0,[sp,#0]) 1002 992 __(add imm1,sp,#dnode_size+fulltag_cons) … … 1024 1014 __(mov imm0,nargs,lsl #num_subtag_bits-fixnumshift) 1025 1015 __(orr imm0,imm0,#subtag_u32_vector) 1026 __(mov temp1,sp) 1027 __(str imm0,[sp,-imm1]!) 1028 __(mov temp2,#0) 1029 __(str temp0,[sp,#node_size]) 1030 __(add sp,temp0,#dnode_size) 1016 __(stack_allocate_zeroed_word_vector(imm0,imm1)) 1031 1017 __(mov imm0,#subtag_simple_vector) 1032 __(b 2f)1033 1: __(str temp2,[temp1,#-node_size]!)1034 __(str temp2,[temp1,#-node_size]!)1035 2: __(cmp temp1,temp0)1036 __(bne 1b)1037 1018 __(strb imm0,[sp,#0]) 1038 1019 __(add arg_z,sp,#fulltag_misc) … … 1132 1113 dnl 1133 1114 1134 dnl /* Allocate a miscobj on the temp stack. (Push a frame on the tsp and */ 1135 dnl /* heap-cons the object if there's no room on the tstack.) */ 1136 dnl _spentry(stack_misc_alloc) 1137 dnl __(rlwinm. imm2,arg_y,32-fixnumshift,0,(8+fixnumshift)-1) 1138 dnl __(unbox_fixnum(imm0,arg_z)) 1139 dnl __(extract_fulltag(imm1,imm0)) 1140 dnl __(bne- cr0,9f) 1141 dnl __(cmpri(cr0,imm1,fulltag_nodeheader)) 1142 dnl __(mov imm3,imm0) 1143 dnl __(cmplri(cr1,imm0,max_32_bit_ivector_subtag)) 1144 dnl __(rlwimi imm0,arg_y,num_subtag_bits-fixnum_shift,0,31-num_subtag_bits) /* imm0 now = header */ 1145 dnl __(mov imm2,arg_y) 1146 dnl __(beq cr0,1f) /* do probe if node object */ 1147 dnl /* (fixnum element count = byte count). */ 1148 dnl __(cmplri(cr0,imm3,max_16_bit_ivector_subtag)) 1149 dnl __(bng cr1,1f) /* do probe if 32-bit imm object */ 1150 dnl __(cmplri(cr1,imm3,max_8_bit_ivector_subtag)) 1151 dnl __(srwi imm2,imm2,1) 1152 dnl __(bgt cr0,3f) 1153 dnl __(bgt cr1,1f) 1154 dnl __(srwi imm2,imm2,1) 1155 dnl /* imm2 now = byte count. Add 4 for header, 7 to align, then */ 1156 dnl /* clear low three bits. */ 1157 dnl 1: 1158 dnl __(dnode_align(imm3,imm2,tsp_frame.fixed_overhead+node_size)) 1159 dnl __(cmplri(cr0,imm3,tstack_alloc_limit)) /* more than limit ? */ 1160 dnl __(bgt- cr0,0f) 1161 dnl __(TSP_Alloc_Var_Boxed_nz(imm3,imm4)) 1162 dnl 1163 dnl /* Slap the header on the vector, then return. */ 1164 dnl __(str(imm0,tsp_frame.data_offset(tsp))) 1165 dnl __(la arg_z,tsp_frame.data_offset+fulltag_misc(tsp)) 1166 dnl __(bx lr) 1167 dnl 9: 1168 dnl 1169 dnl 1170 dnl 1171 dnl /* Too large to safely fit on tstack. Heap-cons the vector, but make */ 1172 dnl /* sure that there's an empty tsp frame to keep the compiler happy. */ 1173 dnl 0: 1174 dnl __(TSP_Alloc_Fixed_Unboxed(0)) 1175 dnl __(b _SPmisc_alloc) 1176 dnl 3: 1177 dnl __(cmplri(imm3,subtag_double_float_vector)) 1178 dnl __(slwi imm2,arg_y,1) 1179 dnl __(beq 1b) 1180 dnl __(addi imm2,arg_y,7<<fixnumshift) 1181 dnl __(srwi imm2,imm2,fixnumshift+3) 1182 dnl __(b 1b) 1115 /* Allocate a uvector on the stack. (Push a frame on the stack and */ 1116 /* heap-cons the object if there's no room on the stack.) */ 1117 _spentry(stack_misc_alloc) 1118 __(tst arg_y,#unsigned_byte_24_mask) 1119 __(uuo_error_reg_not_xtype(ne,arg_y,xtype_unsigned_byte_24)) 1120 __(unbox_fixnum(imm0,arg_z)) 1121 __(extract_fulltag(imm1,imm0)) 1122 __(cmp imm1,#fulltag_nodeheader) 1123 __(bne 1f) 1124 __(dnode_align(imm1,arg_y,node_size)) 1125 __(cmp imm1,#stack_alloc_limit) 1126 __(bge 9f) 1127 __(mov imm0,#subtag_u32_vector) 1128 __(orr imm0,imm0,arg_y,lsl #num_subtag_bits-fixnumshift) 1129 __(stack_allocate_zeroed_word_vector(imm0,imm1)) 1130 __(unbox_fixnum(imm0,arg_z)) 1131 __(strb imm0,[sp]) 1132 __(add arg_z,sp,#fulltag_misc) 1133 __(bx lr) 1134 1: __(mov imm0,arg_y,lsl #num_subtag_bits-fixnumshift) 1135 __(orr imm0,imm0,arg_z,lsr #fixnumshift) 1136 __(cmp arg_z,#max_32_bit_ivector_subtag<<fixnumshift) 1137 __(movle imm1,arg_y) 1138 __(ble 8f) 1139 __(cmp arg_z,#max_8_bit_ivector_subtag<<fixnumshift) 1140 __(movle imm1,arg_y,lsr #fixnumshift) 1141 __(ble 8f) 1142 __(cmp arg_z,#max_16_bit_ivector_subtag<<fixnumshift) 1143 __(movle imm1,arg_y,lsr #1) 1144 __(ble 8f) 1145 __(cmp arg_z,#subtag_double_float) 1146 __(moveq imm1,arg_y,lsl #1) 1147 __(addeq imm1,imm1,#node_size) 1148 __(addne imm1,arg_y,#7<<fixnumshift) 1149 __(movne imm1,imm1,lsr#3+fixnumshift) 1150 8: __(dnode_align(imm1,imm1,node_size)) 1151 __(cmp imm1,#stack_alloc_limit) 1152 __(bhs 9f) 1153 __(stack_allocate_zeroed_word_vector(imm0,imm1)) 1154 __(add arg_z,sp,#fulltag_misc) 1155 __(bx lr) 1156 9: 1157 1158 /* Too large to safely fit on tstack. Heap-cons the vector, but make */ 1159 /* sure that there's an empty tsp frame to keep the compiler happy. */ 1160 0: 1161 __(movc16(imm0,make_header(1,subtag_u32_vector))) 1162 __(mov imm1,#0) 1163 __(stmdb sp!,{imm0,imm1}) 1164 __(b _SPmisc_alloc) 1183 1165 1184 1166 … … 1263 1245 dnl __(srawi imm2,imm2,31) 1264 1246 dnl __(or imm2,imm2,imm1) 1265 dnl __(addi imm1,imm1, fixnumone)1247 dnl __(addi imm1,imm1,#fixnumone) 1266 1248 dnl __(cmpr(cr0,imm1,imm0)) 1267 1249 dnl __(subf imm2,nargs,imm2) … … 1517 1499 1518 1500 _spentry(ksignalerr) 1519 __(ref_nrs_symbol(fname,errdisp ))1501 __(ref_nrs_symbol(fname,errdisp,imm0)) 1520 1502 __(jump_fname) 1521 1503 … … 1658 1640 dnl __(mtctr loc_pc) 1659 1641 dnl __(bctr) 1660 dnl 1661 dnl 1662 dnl /* Everything up to the last arg has been vpushed, nargs is set to */ 1663 dnl /* the (boxed) count of things already pushed. */ 1664 dnl /* On exit, arg_x, arg_y, arg_z, and nargs are set as per a normal */ 1665 dnl /* function call (this may require vpopping a few things.) */ 1666 dnl /* ppc2-invoke-fn assumes that temp1 is preserved here. */ 1667 dnl _spentry(spreadargz) 1668 dnl __(extract_lisptag(imm1,arg_z)) 1669 dnl __(cmpri(cr1,imm1,tag_list)) 1670 dnl __(cmpri(cr0,arg_z,nil_value)) 1671 dnl __(mov imm0,#0) 1672 dnl __(mov arg_y,arg_z) /* save in case of error */ 1673 dnl __(beq cr0,2f) 1674 dnl 1: 1675 dnl __(bne- cr1,3f) 1676 dnl __(_car(arg_x,arg_z)) 1677 dnl __(_cdr(arg_z,arg_z)) 1678 dnl __(cmpri(cr0,arg_z,nil_value)) 1679 dnl __(extract_lisptag(imm1,arg_z)) 1680 dnl __(cmpri(cr1,imm1,tag_list)) 1681 dnl __(vpush1(arg_x)) 1682 dnl __(addi imm0,imm0,fixnum_one) 1683 dnl __(bne cr0,1b) 1684 dnl 2: 1685 dnl __(add. nargs,nargs,imm0) 1686 dnl __(cmpri(cr2,nargs,2<<fixnumshift)) 1687 dnl __(beqlr- cr0) 1688 dnl __(vpop(arg_z)) 1689 dnl __(bltlr cr2) 1690 dnl __(vpop(arg_y)) 1691 dnl __(beqlr cr2) 1692 dnl __(vpop(arg_x)) 1693 dnl __(bx lr) 1694 dnl /* Discard whatever's been vpushed already, complain. */ 1695 dnl 3: 1696 dnl __(add vsp,vsp,imm0) 1697 dnl __(mov arg_z,arg_y) /* recover original arg_z */ 1698 dnl __(mov arg_y,#XNOSPREAD) 1699 dnl __(set_nargs(2)) 1700 dnl __(b _SPksignalerr) 1701 dnl 1702 dnl /* Tail-recursively funcall temp0. */ 1703 dnl /* Pretty much the same as the tcallsym* cases above. */ 1704 dnl _spentry(tfuncallgen) 1705 dnl __(cmpri(cr0,nargs,nargregs<<fixnumshift)) 1706 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1707 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1708 dnl __(mtlr loc_pc) 1709 dnl __(ble cr0,2f) 1710 dnl __(ldr imm0,[sp,#lisp_frame.savevsp]) 1711 dnl __(discard_lisp_frame()) 1712 dnl /* can use nfn (= temp2) as a temporary */ 1713 dnl __(subi imm1,nargs,nargregs<<fixnumshift) 1714 dnl __(add imm1,imm1,vsp) 1715 dnl 1: 1716 dnl __(ldru(temp2,-node_size(imm1))) 1717 dnl __(cmpr(cr0,imm1,vsp)) 1718 dnl __(push(temp2,imm0)) 1719 dnl __(bne cr0,1b) 1720 dnl __(mov vsp,imm0) 1721 dnl __(do_funcall()) 1722 dnl 2: 1723 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 1724 dnl __(discard_lisp_frame()) 1725 dnl __(do_funcall()) 1726 dnl 1727 dnl 1728 dnl /* Some args were vpushed. Slide them down to the base of */ 1729 dnl /* the current frame, then do funcall. */ 1730 dnl _spentry(tfuncallslide) 1731 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1732 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1733 dnl __(ldr imm0,[sp,#lisp_frame.savevsp]) 1734 dnl __(discard_lisp_frame()) 1735 dnl /* can use nfn (= temp2) as a temporary */ 1736 dnl __(subi imm1,nargs,nargregs<<fixnumshift) 1737 dnl __(add imm1,imm1,vsp) 1738 dnl __(mtlr loc_pc) 1739 dnl 1: 1740 dnl __(ldru(temp2,-node_size(imm1))) 1741 dnl __(cmpr(cr0,imm1,vsp)) 1742 dnl __(push(temp2,imm0)) 1743 dnl __(bne cr0,1b) 1744 dnl __(mov vsp,imm0) 1745 dnl __(do_funcall()) 1746 dnl 1747 dnl /* No args were vpushed; recover saved context & do funcall */ 1748 dnl _spentry(tfuncallvsp) 1749 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1750 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1751 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 1752 dnl __(mtlr loc_pc) 1753 dnl __(discard_lisp_frame()) 1754 dnl __(do_funcall()) 1755 dnl 1756 dnl /* Tail-recursively call the (known symbol) in fname. */ 1757 dnl /* In the general case, we don't know if any args were */ 1758 dnl /* vpushed or not. If so, we have to "slide" them down */ 1759 dnl /* to the base of the frame. If not, we can just restore */ 1760 dnl /* vsp, lr, fn from the saved lisp frame on the control stack. */ 1761 dnl _spentry(tcallsymgen) 1762 dnl __(cmpri(cr0,nargs,nargregs<<fixnumshift)) 1763 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1764 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1765 dnl __(mtlr loc_pc) 1766 dnl __(ble cr0,2f) 1767 dnl 1768 dnl __(ldr imm0,[sp,#lisp_frame.savevsp]) 1769 dnl __(discard_lisp_frame()) 1770 dnl /* can use nfn (= temp2) as a temporary */ 1771 dnl __(subi imm1,nargs,nargregs<<fixnumshift) 1772 dnl __(add imm1,imm1,vsp) 1773 dnl 1: 1774 dnl __(ldru(temp2,-node_size(imm1))) 1775 dnl __(cmpr(cr0,imm1,vsp)) 1776 dnl __(push(temp2,imm0)) 1777 dnl __(bne cr0,1b) 1778 dnl __(mov vsp,imm0) 1779 dnl __(jump_fname) 1780 dnl 1781 dnl 2: 1782 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 1783 dnl __(discard_lisp_frame()) 1784 dnl __(jump_fname) 1785 dnl 1786 dnl 1787 dnl /* Some args were vpushed. Slide them down to the base of */ 1788 dnl /* the current frame, then do funcall. */ 1789 dnl _spentry(tcallsymslide) 1790 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1791 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1792 dnl __(ldr imm0,[sp,#lisp_frame.savevsp]) 1793 dnl __(discard_lisp_frame()) 1794 dnl __(mtlr loc_pc) 1795 dnl /* can use nfn (= temp2) as a temporary */ 1796 dnl __(subi imm1,nargs,nargregs<<fixnumshift) 1797 dnl __(add imm1,imm1,vsp) 1798 dnl 1: 1799 dnl __(ldru(temp2,-node_size(imm1))) 1800 dnl __(cmpr(cr0,imm1,vsp)) 1801 dnl __(push(temp2,imm0)) 1802 dnl __(bne cr0,1b) 1803 dnl __(mov vsp,imm0) 1804 dnl __(jump_fname) 1805 dnl 1806 dnl /* No args were vpushed; recover saved context & call symbol */ 1807 dnl _spentry(tcallsymvsp) 1808 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1809 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1810 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 1811 dnl __(discard_lisp_frame()) 1812 dnl __(mtlr loc_pc) 1813 dnl __(jump_fname) 1814 dnl 1815 dnl /* Tail-recursively call the function in nfn. */ 1816 dnl /* Pretty much the same as the tcallsym* cases above. */ 1817 dnl _spentry(tcallnfngen) 1818 dnl __(cmpri(cr0,nargs,nargregs<<fixnumshift)) 1819 dnl __(ble cr0,_SPtcallnfnvsp) 1820 dnl __(b _SPtcallnfnslide) 1821 dnl 1822 dnl /* Some args were vpushed. Slide them down to the base of */ 1823 dnl /* the current frame, then do funcall. */ 1824 dnl _spentry(tcallnfnslide) 1825 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1826 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1827 dnl __(ldr imm0,[sp,#lisp_frame.savevsp]) 1828 dnl __(discard_lisp_frame()) 1829 dnl __(mtlr loc_pc) 1830 dnl /* Since we have a known function, can use fname as a temporary. */ 1831 dnl __(subi imm1,nargs,nargregs<<fixnumshift) 1832 dnl __(add imm1,imm1,vsp) 1833 dnl 1: 1834 dnl __(ldru(fname,-node_size(imm1))) 1835 dnl __(cmpr(cr0,imm1,vsp)) 1836 dnl __(push(fname,imm0)) 1837 dnl __(bne cr0,1b) 1838 dnl __(mov vsp,imm0) 1839 dnl __(jump_nfn()) 1840 dnl 1841 dnl _spentry(tcallnfnvsp) 1842 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 1843 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 1844 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 1845 dnl __(discard_lisp_frame()) 1846 dnl __(mtlr loc_pc) 1847 dnl __(jump_nfn()) 1642 1643 1644 /* Everything up to the last arg has been vpushed, nargs is set to */ 1645 /* the (boxed) count of things already pushed. */ 1646 /* On exit, arg_x, arg_y, arg_z, and nargs are set as per a normal */ 1647 /* function call (this may require vpopping a few things.) */ 1648 /* ppc2-invoke-fn assumes that temp1 is preserved here. */ 1649 _spentry(spreadargz) 1650 __(extract_lisptag(imm1,arg_z)) 1651 __(cmp arg_z,#nil_value) 1652 __(mov imm0,#0) 1653 __(mov arg_y,arg_z) /* save in case of error */ 1654 __(beq 2f) 1655 1: 1656 __(cmp imm1,#tag_list) 1657 __(bne 3f) 1658 __(_car(arg_x,arg_z)) 1659 __(_cdr(arg_z,arg_z)) 1660 __(cmp arg_z,#nil_value) 1661 __(extract_lisptag(imm1,arg_z)) 1662 __(vpush1(arg_x)) 1663 __(add imm0,imm0,#fixnum_one) 1664 __(bne 1b) 1665 2: 1666 __(adds nargs,nargs,imm0) 1667 __(bxeq lr) 1668 __(vpop_argregs_nz) 1669 __(bx lr) 1670 1671 /* Discard whatever's been vpushed already, complain. */ 1672 3: 1673 __(add vsp,vsp,imm0) 1674 __(mov arg_z,arg_y) /* recover original arg_z */ 1675 __(mov arg_y,#XNOSPREAD) 1676 __(set_nargs(2)) 1677 __(b _SPksignalerr) 1678 1679 /* Tail-recursively funcall temp0. */ 1680 /* Pretty much the same as the tcallsym* cases above. */ 1681 _spentry(tfuncallgen) 1682 __(cmp nargs,#nargregs<<fixnumshift) 1683 __(ldr lr,[sp,#lisp_frame.savelr]) 1684 __(ldr fn,[sp,#lisp_frame.savefn]) 1685 __(ble 2f) 1686 __(ldr imm0,[sp,#lisp_frame.savevsp]) 1687 __(discard_lisp_frame()) 1688 /* can use temp0 as a temporary */ 1689 __(sub imm1,nargs,#nargregs<<fixnumshift) 1690 __(add imm1,imm1,vsp) 1691 1: 1692 __(ldr temp0,[imm1,#-node_size]!) 1693 __(cmp imm1,vsp) 1694 __(push1(temp2,imm0)) 1695 __(bne 1b) 1696 __(mov vsp,imm0) 1697 __(funcall_nfn()) 1698 2: 1699 __(ldr vsp,[sp,#lisp_frame.savevsp]) 1700 __(discard_lisp_frame()) 1701 __(funcall_nfn()) 1702 1703 1704 /* Some args were vpushed. Slide them down to the base of */ 1705 /* the current frame, then do funcall. */ 1706 _spentry(tfuncallslide) 1707 __(restore_lisp_frame(imm0)) 1708 /* can use temp0 as a temporary */ 1709 __(sub imm1,nargs,#nargregs<<fixnumshift) 1710 __(add imm1,imm1,vsp) 1711 1: 1712 __(ldr temp0,[imm1,#-node_size]!) 1713 __(cmp imm1,vsp) 1714 __(push1(temp0,imm0)) 1715 __(bne 1b) 1716 __(mov vsp,imm0) 1717 __(funcall_nfn()) 1718 1719 /* No args were vpushed; recover saved context & do funcall */ 1720 _spentry(tfuncallvsp) 1721 __(restore_lisp_frame(imm0)) 1722 __(funcall_nfn()) 1723 1724 /* Tail-recursively call the (known symbol) in fname. */ 1725 /* In the general case, we don't know if any args were */ 1726 /* vpushed or not. If so, we have to "slide" them down */ 1727 /* to the base of the frame. If not, we can just restore */ 1728 /* vsp, lr, fn from the saved lisp frame on the control stack. */ 1729 _spentry(tcallsymgen) 1730 __(cmp nargs,#nargregs<<fixnumshift) 1731 __(ldr lr,[sp,#lisp_frame.savelr]) 1732 __(ldr fn,[sp,#lisp_frame.savefn]) 1733 __(ble 2f) 1734 1735 __(ldr imm0,[sp,#lisp_frame.savevsp]) 1736 __(discard_lisp_frame()) 1737 /* can use nfn (= temp2) as a temporary */ 1738 __(sub imm1,nargs,#nargregs<<fixnumshift) 1739 __(add imm1,imm1,vsp) 1740 1: 1741 __(ldr temp2,[imm1,#-node_size]!) 1742 __(cmp imm1,vsp) 1743 __(push1(temp2,imm0)) 1744 __(bne 1b) 1745 __(mov vsp,imm0) 1746 __(jump_fname) 1747 1748 2: 1749 __(ldr vsp,[sp,#lisp_frame.savevsp]) 1750 __(discard_lisp_frame()) 1751 __(jump_fname) 1752 1753 1754 /* Some args were vpushed. Slide them down to the base of */ 1755 /* the current frame, then do funcall. */ 1756 _spentry(tcallsymslide) 1757 __(ldr lr,[sp,#lisp_frame.savelr]) 1758 __(ldr fn,[sp,#lisp_frame.savefn]) 1759 __(ldr imm0,[sp,#lisp_frame.savevsp]) 1760 __(discard_lisp_frame()) 1761 /* can use nfn (= temp2) as a temporary */ 1762 __(sub imm1,nargs,#nargregs<<fixnumshift) 1763 __(add imm1,imm1,vsp) 1764 1: 1765 __(ldr temp2,[imm1,#-node_size]!) 1766 __(cmp imm1,vsp) 1767 __(push1(temp2,imm0)) 1768 __(bne 1b) 1769 __(mov vsp,imm0) 1770 __(jump_fname) 1771 1772 /* No args were vpushed; recover saved context & call symbol */ 1773 _spentry(tcallsymvsp) 1774 __(restore_lisp_frame(imm0)) 1775 __(jump_fname) 1776 1777 /* Tail-recursively call the function in nfn. */ 1778 /* Pretty much the same as the tcallsym* cases above. */ 1779 _spentry(tcallnfngen) 1780 __(cmp nargs,#nargregs<<fixnumshift) 1781 __(ble _SPtcallnfnvsp) 1782 __(b _SPtcallnfnslide) 1783 1784 /* Some args were vpushed. Slide them down to the base of */ 1785 /* the current frame, then do funcall. */ 1786 _spentry(tcallnfnslide) 1787 __(ldr lr,[sp,#lisp_frame.savelr]) 1788 __(ldr fn,[sp,#lisp_frame.savefn]) 1789 __(ldr imm0,[sp,#lisp_frame.savevsp]) 1790 __(discard_lisp_frame()) 1791 /* Since we have a known function, can use fname as a temporary. */ 1792 __(sub imm1,nargs,#nargregs<<fixnumshift) 1793 __(add imm1,imm1,vsp) 1794 1: 1795 __(ldr fname,[imm1,#-node_size]!) 1796 __(cmp imm1,vsp) 1797 __(push1(fname,imm0)) 1798 __(bne 1b) 1799 __(mov vsp,imm0) 1800 __(jump_nfn()) 1801 1802 _spentry(tcallnfnvsp) 1803 __(restore_lisp_frame(imm0)) 1804 __(jump_nfn()) 1848 1805 1849 1806 /* Reference index arg_z of a misc-tagged object (arg_y). */ … … 1877 1834 __(bgt _SPsubtag_misc_ref) 1878 1835 __(jump_builtin(_builtin_aref1,2)) 1879 dnl 1880 dnl 1881 dnl /* Make a cons cell on the vstack. Always push 3 words, 'cause we're */ 1882 dnl /* not sure how the vstack will be aligned. */ 1883 dnl _spentry(stkconsyz) 1884 dnl __(mov imm0,#nil_value) 1885 dnl __(vpush1(imm0)) 1886 dnl __(vpush1(imm0)) 1887 dnl __(vpush1(imm0)) 1888 dnl __(andi. imm0,vsp,1<<word_shift) /* (oddp vsp ?) */ 1889 dnl __(beq cr0,1f) 1890 dnl __(str(arg_y,node_size*2(vsp))) /* car */ 1891 dnl __(str(arg_z,node_size(vsp))) /* cdr */ 1892 dnl __(la arg_z,fulltag_cons+node_size(vsp)) 1893 dnl __(bx lr) 1894 dnl 1: 1895 dnl __(str(arg_y,node_size(vsp))) /* car, again */ 1896 dnl __(str(arg_z,0(vsp))) 1897 dnl __(la arg_z,fulltag_cons(vsp)) 1898 dnl __(bx lr) 1899 dnl 1900 dnl /* Make a stack-consed value cell. Much like the case of */ 1901 dnl /* stack-allocating a cons cell. Imm0 points to the closed-over value */ 1902 dnl /* (already vpushed). Replace that locative with the vcell. */ 1903 dnl _spentry(stkvcell0) 1904 dnl __(sub imm1,imm0,vsp) /* imm1 = delta from vsp to value cell loc */ 1905 dnl __(mov arg_z,#nil_value) 1906 dnl __(vpush1(arg_z)) 1907 dnl __(vpush1(arg_z)) 1908 dnl __(vpush1(arg_z)) 1909 dnl __(addi imm1,imm1,node_size*3) 1910 dnl __(add imm0,vsp,imm1) /* in case stack overflowed */ 1911 dnl __(andi. imm1,vsp,1<<word_shift) /* (oddp vsp) ? */ 1912 dnl __(mov imm1,#value_cell_header) 1913 dnl __(ldr arg_z,[imm0,#0]) 1914 dnl __(beq cr0,1f) 1915 dnl __(str(arg_z,node_size*2(vsp))) 1916 dnl __(str(imm1,node_size(vsp))) 1917 dnl __(la arg_z,fulltag_misc+node_size(vsp)) 1918 dnl __(str(arg_z,0(imm0))) 1919 dnl __(bx lr) 1920 dnl 1: 1921 dnl __(str(arg_z,node_size(vsp))) 1922 dnl __(str(imm1,0(vsp))) 1923 dnl __(la arg_z,fulltag_misc(vsp)) 1924 dnl __(str(arg_z,0(imm0))) 1925 dnl __(bx lr) 1926 dnl 1927 dnl 1928 dnl _spentry(stkvcellvsp) 1929 dnl __(mov arg_z,#nil_value) 1930 dnl __(vpush1(arg_z)) 1931 dnl __(vpush1(arg_z)) 1932 dnl __(vpush1(arg_z)) 1933 dnl __(mov imm1,#node_size*3) 1934 dnl __(add imm0,vsp,imm1) /* in case stack overflowed */ 1935 dnl __(andi. imm1,vsp,1<<word_shift) /* (oddp vsp) ? */ 1936 dnl __(mov imm1,#value_cell_header) 1937 dnl __(ldr arg_z,[imm0,#0]) 1938 dnl __(beq cr0,1f) 1939 dnl __(str(arg_z,node_size*2(vsp))) 1940 dnl __(str(imm1,node_size(vsp))) 1941 dnl __(la arg_z,fulltag_misc+node_size(vsp)) 1942 dnl __(str(arg_z,0(imm0))) 1943 dnl __(bx lr) 1944 dnl 1: 1945 dnl __(str(arg_z,node_size(vsp))) 1946 dnl __(str(imm1,0(vsp))) 1947 dnl __(la arg_z,fulltag_misc(vsp)) 1948 dnl __(str(arg_z,0(imm0))) 1949 dnl __(bx lr) 1950 dnl 1836 1951 1837 dnl /* Make a "raw" area on the temp stack, stack-cons a macptr to point to it, */ 1952 1838 dnl /* and return the macptr. Size (in bytes, boxed) is in arg_z on entry; macptr */ … … 1998 1884 dnl __(mov fname,#nrs.new_gcable_ptr) 1999 1885 dnl __(jump_fname()) 2000 dnl 2001 dnl/* Make a list of length arg_y (boxed), initial-element arg_z (boxed) on */2002 dnl/* the tstack. Return the list in arg_z. */2003 dnl_spentry(makestacklist)2004 dnl__(add imm0,arg_y,arg_y)2005 dnl __(cmplri(cr1,imm0,((tstack_alloc_limit+1)-cons.size)))2006 dnl __(addi imm0,imm0,tsp_frame.fixed_overhead)2007 dnl __(bge cr1,3f)2008 dnl __(TSP_Alloc_Var_Boxed(imm0,imm1))2009 dnl __(mov imm1,arg_y)2010 dnl __(cmpri(cr1,imm1,0))2011 dnl __(mov arg_y,arg_z)2012 dnl __(mov arg_z,#nil_value)2013 dnl __(ldr imm2,[tsp,#tsp_frame.backlink])2014 dnl __(la imm2,-tsp_frame.fixed_overhead+fulltag_cons(imm2))2015 dnl __(b 2f)2016 dnl 1: 2017 dnl __(subi imm1,imm1,fixnum1)2018 dnl __(cmpri(cr1,imm1,0))2019 dnl __(_rplacd(imm2,arg_z)) 2020 dnl __(_rplaca(imm2,arg_y))2021 dnl __(mov arg_z,imm2)2022 dnl __(subi imm2,imm2,cons.size)2023 dnl 2: 2024 dnl __(bne cr1,1b)2025 dnl __(bx lr) 2026 dnl 2027 dnl 3: 2028 dnl __(cmpri(cr1,arg_y,0)) 2029 dnl __(TSP_Alloc_Fixed_Boxed(0)) /* make the compiler happy */ 2030 dnl __(mov imm1,arg_y) /* count */ 2031 dnl __(mov arg_y,arg_z) /* initial value*/2032 dnl __(mov arg_z,#nil_value) /* result*/2033 dnl __(b 5f) 2034 dnl 4: 2035 dnl __(subi imm1,imm1,fixnum1) 2036 dnl __(cmpri(cr1,imm1,0))2037 dnl __(Cons(arg_z,arg_y,arg_z))2038 dnl 5:2039 dnl __(bne cr1,4b)2040 dnl__(bx lr)2041 dnl 1886 1887 /* Make a list of length arg_y (boxed), initial-element arg_z (boxed) on */ 1888 /* the tstack. Return the list in arg_z. */ 1889 _spentry(makestacklist) 1890 __(add imm0,arg_y,arg_y) 1891 __(mov imm1,imm0,lsl #num_subtag_bits-fixnumshift) 1892 __(add imm1,imm1,#4<<num_subtag_bits) 1893 __(orr imm1,imm1,#subtag_u32_vector) 1894 __(add imm0,imm0,#dnode_size) 1895 __(cmp imm0,#stack_alloc_limit) 1896 __(bge 4f) 1897 __(stack_allocate_zeroed_word_vector(imm1,imm0)) 1898 __(mov imm0,#subtag_simple_vector) 1899 __(strb imm0,[sp,#0]) 1900 __(add imm2,sp,#dnode_size+fulltag_cons) 1901 __(movs imm1,arg_y) 1902 __(mov arg_y,arg_z) 1903 __(mov arg_z,#nil_value) 1904 __(b 3f) 1905 2: 1906 __(_rplacd(imm2,arg_z)) 1907 __(_rplaca(imm2,arg_y)) 1908 __(mov arg_z,imm2) 1909 __(add imm2,imm2,#cons.size) 1910 __(subs imm1,imm1,#fixnumone) 1911 3: 1912 __(bne 2b) 1913 __(bx lr) 1914 4: 1915 __(movc16(imm0,make_header(1,subtag_u32_vector))) 1916 __(str imm0,[sp,#-8]!) 1917 __(movs imm1,arg_y) /* count */ 1918 __(mov arg_y,arg_z) /* initial value */ 1919 __(mov arg_z,#nil_value) /* result */ 1920 __(b 6f) 1921 5: 1922 __(Cons(arg_z,arg_y,arg_z)) 1923 __(subs imm1,imm1,#fixnumone) 1924 6: 1925 __(bne 5b) 1926 __(bx lr) 1927 2042 1928 dnl /* subtype (boxed) vpushed before initial values. (Had better be a */ 2043 1929 dnl /* node header subtag.) Nargs set to count of things vpushed. */ … … 2075 1961 /* the object's header (fulltag = fulltag_immheader or fulltag_nodeheader.) */ 2076 1962 2077 unsigned_byte_24_mask = 0xe0000003 /* bits that should be clear in a boxed */2078 /* (UNSIGNED-BYTE 24) */2079 1963 _spentry(misc_alloc) 2080 1964 __(tst arg_y,#unsigned_byte_24_mask) … … 2422 2306 __(add imm0,imm0,#misc_data_offset-4) /* bias, less 1 element */ 2423 2307 __(ldr imm0,[arg_z,imm0]) 2424 __(cmp imm0, 0)2308 __(cmp imm0,#0) 2425 2309 __(movge imm0,#1) 2426 2310 __(movlt imm0,#-1) … … 2428 2312 2429 2313 2430 dnl /* like misc_set, only pass the (boxed) subtag in temp0 */ 2431 dnl _spentry(subtag_misc_set) 2432 dnl __(trap_unless_fulltag_equal(arg_x,fulltag_misc,imm0)) 2433 dnl __(trap_unless_lisptag_equal(arg_y,tag_fixnum,imm0)) 2434 dnl __(vector_length(imm0,arg_x,imm1)) 2435 dnl __(trlge(arg_y,imm0)) 2436 dnl __(unbox_fixnum(imm1,temp0)) 2437 dnl __(b C(misc_set_common)) 2438 2439 2440 dnl 2441 dnl /* misc_set (vector index newval). Pretty damned similar to */ 2442 dnl /* misc_ref, as one might imagine. */ 2443 dnl 2444 dnl _spentry(misc_set) 2445 dnl __(trap_unless_fulltag_equal(arg_x,fulltag_misc,imm0)) 2446 dnl __(trap_unless_lisptag_equal(arg_y,tag_fixnum,imm0)) 2447 dnl __(vector_length(imm0,arg_x,imm1)) 2448 dnl __(trlge(arg_y,imm0)) 2449 dnl __(extract_lowbyte(imm1,imm1)) 2450 dnl __(b C(misc_set_common)) 2314 /* like misc_set, only pass the (boxed) subtag in temp0 */ 2315 _spentry(subtag_misc_set) 2316 __(trap_unless_fulltag_equal(arg_x,fulltag_misc,imm0)) 2317 __(trap_unless_fixnum(arg_y)) 2318 __(vector_length(imm0,arg_x,imm1)) 2319 __(cmp arg_y,imm0) 2320 __(uuo_error_vector_bounds(hs,arg_y,arg_x)) 2321 __(unbox_fixnum(imm1,temp0)) 2322 __(b C(misc_set_common)) 2323 2324 2325 2326 /* misc_set (vector index newval). Pretty damned similar to */ 2327 /* misc_ref, as one might imagine. */ 2328 2329 _spentry(misc_set) 2330 __(trap_unless_fulltag_equal(arg_x,fulltag_misc,imm0)) 2331 __(trap_unless_fixnum(arg_y)) 2332 __(vector_length(imm0,arg_x,imm1)) 2333 __(cmp arg_y,imm0) 2334 __(uuo_error_vector_bounds(hs,arg_y,arg_x)) 2335 __(extract_lowbyte(imm1,imm1)) 2336 __(b C(misc_set_common)) 2451 2337 dnl 2452 2338 dnl /* "spread" the lexpr in arg_z. */ … … 2480 2366 dnl 8: 2481 2367 dnl __(cmpri(cr3,imm0,4<<fixnumshift)) 2482 dnl __(subi imm0,imm0, fixnumone)2368 dnl __(subi imm0,imm0,#fixnumone) 2483 2369 dnl __(ldru(arg_z,-node_size(imm1))) 2484 2370 dnl __(vpush1(arg_z)) … … 2597 2483 dnl __(bx lr) 2598 2484 dnl 2599 dnl 2600 dnl /* Like misc_alloc (a LOT like it, since it does most of the work), but takes */ 2601 dnl /* an initial-value arg in arg_z, element_count in arg_x, subtag in arg_y. */ 2602 dnl /* Calls out to %init-misc, which does the rest of the work. */ 2603 dnl 2604 dnl _spentry(misc_alloc_init) 2605 dnl __(mflr loc_pc) 2606 dnl __(build_lisp_frame(fn,loc_pc,vsp)) 2607 dnl __(mov fn,#0) 2608 dnl __(mov temp0,arg_z) /* initval */ 2609 dnl __(mov arg_z,arg_y) /* subtag */ 2610 dnl __(mov arg_y,arg_x) /* element-count */ 2611 dnl __(bl _SPmisc_alloc) 2612 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 2613 dnl __(mtlr loc_pc) 2614 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 2615 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 2616 dnl __(discard_lisp_frame()) 2617 dnl __(mov fname,#nrs.init_misc) 2618 dnl __(set_nargs(2)) 2619 dnl __(mov arg_y,temp0) 2620 dnl __(jump_fname()) 2621 dnl 2622 dnl /* As in stack_misc_alloc above, only with a non-default initial-value. */ 2623 dnl 2624 dnl _spentry(stack_misc_alloc_init) 2625 dnl __(mflr loc_pc) 2626 dnl __(build_lisp_frame(fn,loc_pc,vsp)) 2627 dnl __(mov fn,#0) 2628 dnl __(mov temp0,arg_z) /* initval */ 2629 dnl __(mov arg_z,arg_y) /* subtag */ 2630 dnl __(mov arg_y,arg_x) /* element-count */ 2631 dnl __(bl _SPstack_misc_alloc) 2632 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 2633 dnl __(mtlr loc_pc) 2634 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 2635 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 2636 dnl __(discard_lisp_frame()) 2637 dnl __(mov fname,#nrs.init_misc) 2638 dnl __(set_nargs(2)) 2639 dnl __(mov arg_y,temp0) 2640 dnl __(jump_fname()) 2641 dnl 2642 dnl 2643 dnl _spentry(callbuiltin) 2644 dnl __(ref_nrs_value(fname,builtin_functions)) 2645 dnl __(la imm0,misc_data_offset(imm0)) 2646 dnl __(ldrx(fname,fname,imm0)) 2647 dnl __(jump_fname()) 2648 dnl 2649 dnl /* the value of the nilreg-relative symbol %builtin-functions% should be */ 2650 dnl /* a vector of symbols. Call the symbol indexed by imm0 (boxed) and */ 2651 dnl /* return a single value. */ 2652 dnl 2653 dnl _spentry(callbuiltin0) 2654 dnl __(set_nargs(0)) 2655 dnl __(ref_nrs_value(fname,builtin_functions)) 2656 dnl __(la imm0,misc_data_offset(imm0)) 2657 dnl __(ldrx(fname,fname,imm0)) 2658 dnl __(jump_fname()) 2659 dnl 2660 dnl _spentry(callbuiltin1) 2661 dnl __(ref_nrs_value(fname,builtin_functions)) 2662 dnl __(set_nargs(1)) 2663 dnl __(la imm0,misc_data_offset(imm0)) 2664 dnl __(ldrx(fname,fname,imm0)) 2665 dnl __(jump_fname()) 2666 dnl 2667 dnl _spentry(callbuiltin2) 2668 dnl __(set_nargs(2)) 2669 dnl __(ref_nrs_value(fname,builtin_functions)) 2670 dnl __(la imm0,misc_data_offset(imm0)) 2671 dnl __(ldrx(fname,fname,imm0)) 2672 dnl __(jump_fname()) 2673 dnl 2674 dnl 2675 dnl _spentry(callbuiltin3) 2676 dnl __(set_nargs(3)) 2677 dnl __(ref_nrs_value(fname,builtin_functions)) 2678 dnl __(la imm0,misc_data_offset(imm0)) 2679 dnl __(ldrx(fname,fname,imm0)) 2680 dnl __(jump_fname()) 2681 dnl 2682 dnl 2683 dnl _spentry(popj) 2684 dnl .globl C(popj) 2685 dnl C(popj): 2686 dnl __(ldr loc_pc,[sp,#lisp_frame.savelr]) 2687 dnl __(ldr vsp,[sp,#lisp_frame.savevsp]) 2688 dnl __(mtlr loc_pc) 2689 dnl __(ldr fn,[sp,#lisp_frame.savefn]) 2690 dnl __(discard_lisp_frame()) 2691 dnl __(bx lr) 2485 2486 /* Like misc_alloc (a LOT like it, since it does most of the work), but takes */ 2487 /* an initial-value arg in arg_z, element_count in arg_x, subtag in arg_y. */ 2488 /* Calls out to %init-misc, which does the rest of the work. */ 2489 2490 _spentry(misc_alloc_init) 2491 __(build_lisp_frame(imm0)) 2492 __(mov fn,#0) 2493 __(mov temp2,arg_z) /* initval */ 2494 __(mov arg_z,arg_y) /* subtag */ 2495 __(mov arg_y,arg_x) /* element-count */ 2496 __(bl _SPmisc_alloc) 2497 __(restore_lisp_frame(imm0)) 2498 __(ref_nrs_symbol(fname,init_misc,imm0)) 2499 __(set_nargs(2)) 2500 __(mov arg_y,temp2) 2501 __(jump_fname()) 2502 2503 /* As in stack_misc_alloc above, only with a non-default initial-value. */ 2504 /* The funny part here is that we build a lisp frame, then push a vector 2505 /* on top of it. Shuffle things around, carefully. */ 2506 2507 2508 _spentry(stack_misc_alloc_init) 2509 __(build_lisp_frame(imm0)) 2510 __(mov arg_x,sp) 2511 __(mov fn,#0) 2512 __(mov temp2,arg_z) /* initval */ 2513 __(mov arg_z,arg_y) /* subtag */ 2514 __(mov arg_y,arg_x) /* element-count */ 2515 __(bl _SPstack_misc_alloc) 2516 __(mov imm0,#0) 2517 __(ldr lr,[arg_x,#lisp_frame.savelr]) 2518 __(ldr fn,[arg_x,#lisp_frame.savefn]) 2519 __(ldr vsp,[arg_x,#lisp_frame.savevsp]) 2520 __(ldr imm1,[sp]) 2521 __(add imm2,imm1,#lisp_frame.size) 2522 __(str imm2,[sp]) 2523 __(str imm0,[arg_x,#lisp_frame.savelr]) 2524 __(str imm0,[arg_x,#lisp_frame.savefn]) 2525 __(str imm0,[arg_x,#lisp_frame.savevsp]) 2526 __(str imm0,[arg_x,#lisp_frame.marker]) 2527 __(str imm1,[sp,#lisp_frame.size]!) 2528 __(add arg_z,arg_z,#lisp_frame.size) 2529 __(ref_nrs_symbol(fname,init_misc,imm0)) 2530 __(set_nargs(2)) 2531 __(mov arg_y,temp2) 2532 __(jump_fname()) 2533 2534 _spentry(popj) 2535 .globl C(popj) 2536 C(popj): 2537 __(return_lisp_frame(imm0)) 2538 2692 2539 dnl 2693 2540 dnl _spentry(restorefullcontext) … … 2754 2601 dnl __(mov fn,#0) 2755 2602 dnl __(bx lr) 2756 dnl 2757 dnl 2758 dnl 2759 dnl 2760 dnl _spentry(builtin_div) 2761 dnl __(jump_builtin(_builtin_div,2)) 2762 dnl 2763 dnl 2764 dnl 2765 dnl _spentry(builtin_eql) 2766 dnl __(cmpr(cr1,arg_y,arg_z)) 2767 dnl __(extract_fulltag(imm2,arg_y)) 2768 dnl __(extract_fulltag(imm3,arg_z)) 2769 dnl __(beq cr1,1f) 2770 dnl __(cmpri(cr1,imm2,fulltag_misc)) 2771 dnl __(cmpri(cr0,imm3,fulltag_misc)) 2772 dnl __(bne cr1,2f) 2773 dnl __(extract_subtag(imm0,arg_y)) 2774 dnl __(bne cr0,2f) 2775 dnl __(extract_subtag(imm1,arg_z)) 2776 dnl __(cmpr(cr0,imm0,imm1)) 2777 dnl __(bne cr0,2f) 2778 dnl __(jump_builtin(_builtin_eql,2)) 2779 dnl 1: __(mov arg_z,#t_value) 2780 dnl __(bx lr) 2781 dnl 2: __(mov arg_z,#nil_value) 2782 dnl __(bx lr) 2603 2604 2605 2606 2607 _spentry(builtin_div) 2608 __(jump_builtin(_builtin_div,2)) 2609 2610 _spentry(builtin_eql) 2611 __(cmp arg_y,arg_z) 2612 __(beq 1f) 2613 __(extract_fulltag(imm0,arg_y)) 2614 __(extract_fulltag(imm1,arg_z)) 2615 __(cmp imm0,imm1) 2616 __(bne 2f) 2617 __(cmp imm0,#fulltag_misc) 2618 __(bne 2f) 2619 __(jump_builtin(_builtin_eql,2)) 2620 1: __(mov arg_z,#nil_value) 2621 __(add arg_z,arg_z,#t_offset) 2622 __(bx lr) 2623 2: __(mov arg_z,#nil_value) 2624 __(bx lr) 2783 2625 dnl 2784 2626 dnl _spentry(builtin_length) … … 2907 2749 /* Shift right */ 2908 2750 __(unbox_fixnum(imm2,arg_z)) 2909 __(rsb imm2,imm2, 0)2751 __(rsb imm2,imm2,#0) 2910 2752 __(cmp imm2,#32) 2911 2753 __(movge imm2,#31)
Note:
See TracChangeset
for help on using the changeset viewer.
