]> gitweb.factorcode.org Git - factor.git/blob - basis/cpu/x86/x86.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / cpu / x86 / x86.factor
1 ! Copyright (C) 2005, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs alien alien.c-types arrays strings
4 cpu.x86.assembler cpu.x86.assembler.private cpu.architecture
5 kernel kernel.private math memory namespaces make sequences
6 words system layouts combinators math.order fry locals
7 compiler.constants compiler.cfg.registers
8 compiler.cfg.instructions compiler.cfg.intrinsics
9 compiler.codegen compiler.codegen.fixup ;
10 IN: cpu.x86
11
12 << enable-fixnum-log2 >>
13
14 ! Add some methods to the assembler to be more useful to the backend
15 M: label JMP 0 JMP rc-relative label-fixup ;
16 M: label JUMPcc [ 0 ] dip JUMPcc rc-relative label-fixup ;
17
18 M: x86 two-operand? t ;
19
20 HOOK: temp-reg-1 cpu ( -- reg )
21 HOOK: temp-reg-2 cpu ( -- reg )
22
23 HOOK: param-reg-1 cpu ( -- reg )
24 HOOK: param-reg-2 cpu ( -- reg )
25
26 HOOK: pic-tail-reg cpu ( -- reg )
27
28 M: x86 %load-immediate MOV ;
29
30 M: x86 %load-reference swap 0 MOV rc-absolute-cell rel-immediate ;
31
32 HOOK: ds-reg cpu ( -- reg )
33 HOOK: rs-reg cpu ( -- reg )
34
35 : reg-stack ( n reg -- op ) swap cells neg [+] ;
36
37 GENERIC: loc>operand ( loc -- operand )
38
39 M: ds-loc loc>operand n>> ds-reg reg-stack ;
40 M: rs-loc loc>operand n>> rs-reg reg-stack ;
41
42 M: x86 %peek loc>operand MOV ;
43 M: x86 %replace loc>operand swap MOV ;
44 : (%inc) ( n reg -- ) swap cells dup 0 > [ ADD ] [ neg SUB ] if ; inline
45 M: x86 %inc-d ( n -- ) ds-reg (%inc) ;
46 M: x86 %inc-r ( n -- ) rs-reg (%inc) ;
47
48 : align-stack ( n -- n' )
49     os macosx? cpu x86.64? or [ 16 align ] when ;
50
51 HOOK: reserved-area-size cpu ( -- n )
52
53 M: x86 stack-frame-size ( stack-frame -- i )
54     [ spill-counts>> [ swap reg-size * ] { } assoc>map sum ]
55     [ params>> ]
56     [ return>> ]
57     tri + +
58     3 cells +
59     reserved-area-size +
60     align-stack ;
61
62 M: x86 %call ( word -- ) 0 CALL rc-relative rel-word-pic ;
63
64 M: x86 %jump ( word -- )
65     pic-tail-reg 0 MOV 2 cells 1 + rc-absolute-cell rel-here
66     0 JMP rc-relative rel-word-pic-tail ;
67
68 M: x86 %jump-label ( label -- ) 0 JMP rc-relative label-fixup ;
69
70 M: x86 %return ( -- ) 0 RET ;
71
72 : code-alignment ( align -- n )
73     [ building get [ integer? ] count dup ] dip align swap - ;
74
75 : align-code ( n -- )
76     0 <repetition> % ;
77
78 M: x86 %dispatch-label ( word -- )
79     0 cell, rc-absolute-cell rel-word ;
80
81 :: (%slot) ( obj slot tag temp -- op )
82     temp slot obj [+] LEA
83     temp tag neg [+] ; inline
84
85 :: (%slot-imm) ( obj slot tag -- op )
86     obj slot cells tag - [+] ; inline
87
88 M: x86 %slot ( dst obj slot tag temp -- ) (%slot) MOV ;
89 M: x86 %slot-imm ( dst obj slot tag -- ) (%slot-imm) MOV ;
90 M: x86 %set-slot ( src obj slot tag temp -- ) (%slot) swap MOV ;
91 M: x86 %set-slot-imm ( src obj slot tag -- ) (%slot-imm) swap MOV ;
92
93 M: x86 %add     [+] LEA ;
94 M: x86 %add-imm [+] LEA ;
95 M: x86 %sub     nip SUB ;
96 M: x86 %sub-imm neg [+] LEA ;
97 M: x86 %mul     nip swap IMUL2 ;
98 M: x86 %mul-imm nip IMUL2 ;
99 M: x86 %and     nip AND ;
100 M: x86 %and-imm nip AND ;
101 M: x86 %or      nip OR ;
102 M: x86 %or-imm  nip OR ;
103 M: x86 %xor     nip XOR ;
104 M: x86 %xor-imm nip XOR ;
105 M: x86 %shl-imm nip SHL ;
106 M: x86 %shr-imm nip SHR ;
107 M: x86 %sar-imm nip SAR ;
108 M: x86 %not     drop NOT ;
109 M: x86 %log2    BSR ;
110
111 : ?MOV ( dst src -- )
112     2dup = [ 2drop ] [ MOV ] if ; inline
113
114 :: move>args ( src1 src2 -- )
115     {
116         { [ src1 param-reg-2 = ] [ param-reg-1 src2 ?MOV param-reg-1 param-reg-2 XCHG ] }
117         { [ src1 param-reg-1 = ] [ param-reg-2 src2 ?MOV ] }
118         { [ src2 param-reg-1 = ] [ param-reg-2 src1 ?MOV param-reg-1 param-reg-2 XCHG ] }
119         { [ src2 param-reg-2 = ] [ param-reg-1 src1 ?MOV ] }
120         [
121             param-reg-1 src1 MOV
122             param-reg-2 src2 MOV
123         ]
124     } cond ;
125
126 HOOK: %alien-invoke-tail cpu ( func dll -- )
127
128 :: overflow-template ( src1 src2 insn inverse func -- )
129     <label> "no-overflow" set
130     src1 src2 insn call
131     ds-reg [] src1 MOV
132     "no-overflow" get JNO
133     src1 src2 inverse call
134     src1 src2 move>args
135     %prepare-alien-invoke
136     func f %alien-invoke
137     "no-overflow" resolve-label ; inline
138
139 :: overflow-template-tail ( src1 src2 insn inverse func -- )
140     <label> "no-overflow" set
141     src1 src2 insn call
142     "no-overflow" get JNO
143     src1 src2 inverse call
144     src1 src2 move>args
145     %prepare-alien-invoke
146     func f %alien-invoke-tail
147     "no-overflow" resolve-label
148     ds-reg [] src1 MOV
149     0 RET ; inline
150
151 M: x86 %fixnum-add ( src1 src2 -- )
152     [ ADD ] [ SUB ] "overflow_fixnum_add" overflow-template ;
153
154 M: x86 %fixnum-add-tail ( src1 src2 -- )
155     [ ADD ] [ SUB ] "overflow_fixnum_add" overflow-template-tail ;
156
157 M: x86 %fixnum-sub ( src1 src2 -- )
158     [ SUB ] [ ADD ] "overflow_fixnum_subtract" overflow-template ;
159
160 M: x86 %fixnum-sub-tail ( src1 src2 -- )
161     [ SUB ] [ ADD ] "overflow_fixnum_subtract" overflow-template-tail ;
162
163 M:: x86 %fixnum-mul ( src1 src2 temp1 temp2 -- )
164     "no-overflow" define-label
165     temp1 src1 MOV
166     temp1 tag-bits get SAR
167     src2 temp1 IMUL2
168     ds-reg [] temp1 MOV
169     "no-overflow" get JNO
170     src1 src2 move>args
171     param-reg-1 tag-bits get SAR
172     param-reg-2 tag-bits get SAR
173     %prepare-alien-invoke
174     "overflow_fixnum_multiply" f %alien-invoke
175     "no-overflow" resolve-label ;
176
177 M:: x86 %fixnum-mul-tail ( src1 src2 temp1 temp2 -- )
178     "overflow" define-label
179     temp1 src1 MOV
180     temp1 tag-bits get SAR
181     src2 temp1 IMUL2
182     "overflow" get JO
183     ds-reg [] temp1 MOV
184     0 RET
185     "overflow" resolve-label
186     src1 src2 move>args
187     param-reg-1 tag-bits get SAR
188     param-reg-2 tag-bits get SAR
189     %prepare-alien-invoke
190     "overflow_fixnum_multiply" f %alien-invoke-tail ;
191
192 : bignum@ ( reg n -- op )
193     cells bignum tag-number - [+] ; inline
194
195 M:: x86 %integer>bignum ( dst src temp -- )
196     #! on entry, inreg is a signed 32-bit quantity
197     #! exits with tagged ptr to bignum in outreg
198     #! 1 cell header, 1 cell length, 1 cell sign, + digits
199     #! length is the # of digits + sign
200     [
201         "end" define-label
202         ! Load cached zero value
203         dst 0 >bignum %load-reference
204         src 0 CMP
205         ! Is it zero? Then just go to the end and return this zero
206         "end" get JE
207         ! Allocate a bignum
208         dst 4 cells bignum temp %allot
209         ! Write length
210         dst 1 bignum@ 2 tag-fixnum MOV
211         ! Store value
212         dst 3 bignum@ src MOV
213         ! Compute sign
214         temp src MOV
215         temp cell-bits 1- SAR
216         temp 1 AND
217         ! Store sign
218         dst 2 bignum@ temp MOV
219         ! Make negative value positive
220         temp temp ADD
221         temp NEG
222         temp 1 ADD
223         src temp IMUL2
224         ! Store the bignum
225         dst 3 bignum@ temp MOV
226         "end" resolve-label
227     ] with-scope ;
228
229 M:: x86 %bignum>integer ( dst src temp -- )
230     [
231         "end" define-label
232         ! load length
233         temp src 1 bignum@ MOV
234         ! if the length is 1, its just the sign and nothing else,
235         ! so output 0
236         dst 0 MOV
237         temp 1 tag-fixnum CMP
238         "end" get JE
239         ! load the value
240         dst src 3 bignum@ MOV
241         ! load the sign
242         temp src 2 bignum@ MOV
243         ! convert it into -1 or 1
244         temp temp ADD
245         temp NEG
246         temp 1 ADD
247         ! make dst signed
248         temp dst IMUL2
249         "end" resolve-label
250     ] with-scope ;
251
252 M: x86 %add-float nip ADDSD ;
253 M: x86 %sub-float nip SUBSD ;
254 M: x86 %mul-float nip MULSD ;
255 M: x86 %div-float nip DIVSD ;
256
257 M: x86 %integer>float CVTSI2SD ;
258 M: x86 %float>integer CVTTSD2SI ;
259
260 M: x86 %copy ( dst src -- ) ?MOV ;
261
262 M: x86 %copy-float ( dst src -- )
263     2dup = [ 2drop ] [ MOVSD ] if ;
264
265 M: x86 %unbox-float ( dst src -- )
266     float-offset [+] MOVSD ;
267
268 M:: x86 %unbox-any-c-ptr ( dst src temp -- )
269     [
270         { "is-byte-array" "end" "start" } [ define-label ] each
271         dst 0 MOV
272         temp src MOV
273         ! We come back here with displaced aliens
274         "start" resolve-label
275         ! Is the object f?
276         temp \ f tag-number CMP
277         "end" get JE
278         ! Is the object an alien?
279         temp header-offset [+] alien type-number tag-fixnum CMP
280         "is-byte-array" get JNE
281         ! If so, load the offset and add it to the address
282         dst temp alien-offset [+] ADD
283         ! Now recurse on the underlying alien
284         temp temp underlying-alien-offset [+] MOV
285         "start" get JMP
286         "is-byte-array" resolve-label
287         ! Add byte array address to address being computed
288         dst temp ADD
289         ! Add an offset to start of byte array's data
290         dst byte-array-offset ADD
291         "end" resolve-label
292     ] with-scope ;
293
294 M:: x86 %box-float ( dst src temp -- )
295     dst 16 float temp %allot
296     dst float-offset [+] src MOVSD ;
297
298 : alien@ ( reg n -- op ) cells alien tag-number - [+] ;
299
300 M:: x86 %box-alien ( dst src temp -- )
301     [
302         "end" define-label
303         dst \ f tag-number MOV
304         src 0 CMP
305         "end" get JE
306         dst 4 cells alien temp %allot
307         dst 1 alien@ \ f tag-number MOV
308         dst 2 alien@ \ f tag-number MOV
309         ! Store src in alien-offset slot
310         dst 3 alien@ src MOV
311         "end" resolve-label
312     ] with-scope ;
313
314 : small-reg-4 ( reg -- reg' )
315     H{
316         { EAX EAX }
317         { ECX ECX }
318         { EDX EDX }
319         { EBX EBX }
320         { ESP ESP }
321         { EBP EBP }
322         { ESI ESP }
323         { EDI EDI }
324
325         { RAX EAX }
326         { RCX ECX }
327         { RDX EDX }
328         { RBX EBX }
329         { RSP ESP }
330         { RBP EBP }
331         { RSI ESP }
332         { RDI EDI }
333     } at ; inline
334
335 : small-reg-2 ( reg -- reg' )
336     small-reg-4 H{
337         { EAX AX }
338         { ECX CX }
339         { EDX DX }
340         { EBX BX }
341         { ESP SP }
342         { EBP BP }
343         { ESI SI }
344         { EDI DI }
345     } at ; inline
346
347 : small-reg-1 ( reg -- reg' )
348     small-reg-4 {
349         { EAX AL }
350         { ECX CL }
351         { EDX DL }
352         { EBX BL }
353     } at ; inline
354
355 : small-reg ( reg size -- reg' )
356     {
357         { 1 [ small-reg-1 ] }
358         { 2 [ small-reg-2 ] }
359         { 4 [ small-reg-4 ] }
360     } case ;
361
362 : small-regs ( -- regs ) { EAX ECX EDX EBX } ; inline
363
364 : small-reg-that-isn't ( exclude -- reg' )
365     small-regs swap [ small-reg-4 ] map '[ _ memq? not ] find nip ;
366
367 : with-save/restore ( reg quot -- )
368     [ drop PUSH ] [ call ] [ drop POP ] 2tri ; inline
369
370 :: with-small-register ( dst exclude quot: ( new-dst -- ) -- )
371     #! If the destination register overlaps a small register, we
372     #! call the quot with that. Otherwise, we find a small
373     #! register that is not in exclude, and call quot, saving
374     #! and restoring the small register.
375     dst small-reg-4 small-regs memq? [ dst quot call ] [
376         exclude small-reg-that-isn't
377         [ quot call ] with-save/restore
378     ] if ; inline
379
380 M:: x86 %string-nth ( dst src index temp -- )
381     "end" define-label
382     dst { src index temp } [| new-dst |
383         ! Load the least significant 7 bits into new-dst.
384         ! 8th bit indicates whether we have to load from
385         ! the aux vector or not.
386         temp src index [+] LEA
387         new-dst 1 small-reg temp string-offset [+] MOV
388         new-dst new-dst 1 small-reg MOVZX
389         ! Do we have to look at the aux vector?
390         new-dst HEX: 80 CMP
391         "end" get JL
392         ! Yes, this is a non-ASCII character. Load aux vector
393         temp src string-aux-offset [+] MOV
394         new-dst temp XCHG
395         ! Compute index
396         new-dst index ADD
397         new-dst index ADD
398         ! Load high 16 bits
399         new-dst 2 small-reg new-dst byte-array-offset [+] MOV
400         new-dst new-dst 2 small-reg MOVZX
401         new-dst 7 SHL
402         ! Compute code point
403         new-dst temp XOR
404         "end" resolve-label
405         dst new-dst ?MOV
406     ] with-small-register ;
407
408 M:: x86 %set-string-nth-fast ( ch str index temp -- )
409     ch { index str temp } [| new-ch |
410         new-ch ch ?MOV
411         temp str index [+] LEA
412         temp string-offset [+] new-ch 1 small-reg MOV
413     ] with-small-register ;
414
415 :: %alien-integer-getter ( dst src size quot -- )
416     dst { src } [| new-dst |
417         new-dst dup size small-reg dup src [] MOV
418         quot call
419         dst new-dst ?MOV
420     ] with-small-register ; inline
421
422 : %alien-unsigned-getter ( dst src size -- )
423     [ MOVZX ] %alien-integer-getter ; inline
424
425 M: x86 %alien-unsigned-1 1 %alien-unsigned-getter ;
426 M: x86 %alien-unsigned-2 2 %alien-unsigned-getter ;
427
428 : %alien-signed-getter ( dst src size -- )
429     [ MOVSX ] %alien-integer-getter ; inline
430
431 M: x86 %alien-signed-1 1 %alien-signed-getter ;
432 M: x86 %alien-signed-2 2 %alien-signed-getter ;
433 M: x86 %alien-signed-4 4 %alien-signed-getter ;
434
435 M: x86 %alien-unsigned-4 4 [ 2drop ] %alien-integer-getter ;
436
437 M: x86 %alien-cell [] MOV ;
438 M: x86 %alien-float dupd [] MOVSS dup CVTSS2SD ;
439 M: x86 %alien-double [] MOVSD ;
440
441 :: %alien-integer-setter ( ptr value size -- )
442     value { ptr } [| new-value |
443         new-value value ?MOV
444         ptr [] new-value size small-reg MOV
445     ] with-small-register ; inline
446
447 M: x86 %set-alien-integer-1 1 %alien-integer-setter ;
448 M: x86 %set-alien-integer-2 2 %alien-integer-setter ;
449 M: x86 %set-alien-integer-4 4 %alien-integer-setter ;
450 M: x86 %set-alien-cell [ [] ] dip MOV ;
451 M: x86 %set-alien-float dup dup CVTSD2SS [ [] ] dip MOVSS ;
452 M: x86 %set-alien-double [ [] ] dip MOVSD ;
453
454 : load-zone-ptr ( reg -- )
455     #! Load pointer to start of zone array
456     0 MOV "nursery" f rc-absolute-cell rel-dlsym ;
457
458 : load-allot-ptr ( nursery-ptr allot-ptr -- )
459     [ drop load-zone-ptr ] [ swap cell [+] MOV ] 2bi ;
460
461 : inc-allot-ptr ( nursery-ptr n -- )
462     [ cell [+] ] dip 8 align ADD ;
463
464 : store-header ( temp class -- )
465     [ [] ] [ type-number tag-fixnum ] bi* MOV ;
466
467 : store-tagged ( dst tag -- )
468     tag-number OR ;
469
470 M:: x86 %allot ( dst size class nursery-ptr -- )
471     nursery-ptr dst load-allot-ptr
472     dst class store-header
473     dst class store-tagged
474     nursery-ptr size inc-allot-ptr ;
475
476 M:: x86 %write-barrier ( src card# table -- )
477     #! Mark the card pointed to by vreg.
478     ! Mark the card
479     card# src MOV
480     card# card-bits SHR
481     table "cards_offset" f %alien-global
482     table table [] MOV
483     table card# [+] card-mark <byte> MOV
484
485     ! Mark the card deck
486     card# deck-bits card-bits - SHR
487     table "decks_offset" f %alien-global
488     table table [] MOV
489     table card# [+] card-mark <byte> MOV ;
490
491 M: x86 %gc ( -- )
492     "end" define-label
493     temp-reg-1 load-zone-ptr
494     temp-reg-2 temp-reg-1 cell [+] MOV
495     temp-reg-2 1024 ADD
496     temp-reg-1 temp-reg-1 3 cells [+] MOV
497     temp-reg-2 temp-reg-1 CMP
498     "end" get JLE
499     %prepare-alien-invoke
500     "minor_gc" f %alien-invoke
501     "end" resolve-label ;
502
503 M: x86 %alien-global
504     [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;
505
506 HOOK: stack-reg cpu ( -- reg )
507
508 : decr-stack-reg ( n -- )
509     dup 0 = [ drop ] [ stack-reg swap SUB ] if ;
510
511 : incr-stack-reg ( n -- )
512     dup 0 = [ drop ] [ stack-reg swap ADD ] if ;
513
514 M: x86 %epilogue ( n -- ) cell - incr-stack-reg ;
515
516 :: %boolean ( dst temp word -- )
517     dst \ f tag-number MOV
518     temp 0 MOV \ t rc-absolute-cell rel-immediate
519     dst temp word execute ; inline
520
521 M: x86 %compare ( dst temp cc src1 src2 -- )
522     CMP {
523         { cc< [ \ CMOVL %boolean ] }
524         { cc<= [ \ CMOVLE %boolean ] }
525         { cc> [ \ CMOVG %boolean ] }
526         { cc>= [ \ CMOVGE %boolean ] }
527         { cc= [ \ CMOVE %boolean ] }
528         { cc/= [ \ CMOVNE %boolean ] }
529     } case ;
530
531 M: x86 %compare-imm ( dst temp cc src1 src2 -- )
532     %compare ;
533
534 M: x86 %compare-float ( dst temp cc src1 src2 -- )
535     UCOMISD {
536         { cc< [ \ CMOVB %boolean ] }
537         { cc<= [ \ CMOVBE %boolean ] }
538         { cc> [ \ CMOVA %boolean ] }
539         { cc>= [ \ CMOVAE %boolean ] }
540         { cc= [ \ CMOVE %boolean ] }
541         { cc/= [ \ CMOVNE %boolean ] }
542     } case ;
543
544 M: x86 %compare-branch ( label cc src1 src2 -- )
545     CMP {
546         { cc< [ JL ] }
547         { cc<= [ JLE ] }
548         { cc> [ JG ] }
549         { cc>= [ JGE ] }
550         { cc= [ JE ] }
551         { cc/= [ JNE ] }
552     } case ;
553
554 M: x86 %compare-imm-branch ( label src1 src2 cc -- )
555     %compare-branch ;
556
557 M: x86 %compare-float-branch ( label cc src1 src2 -- )
558     UCOMISD {
559         { cc< [ JB ] }
560         { cc<= [ JBE ] }
561         { cc> [ JA ] }
562         { cc>= [ JAE ] }
563         { cc= [ JE ] }
564         { cc/= [ JNE ] }
565     } case ;
566
567 : stack@ ( n -- op ) stack-reg swap [+] ;
568
569 : param@ ( n -- op ) reserved-area-size + stack@ ;
570
571 : spill-integer-base ( stack-frame -- n )
572     [ params>> ] [ return>> ] bi + reserved-area-size + ;
573
574 : spill-integer@ ( n -- op )
575     cells
576     stack-frame get spill-integer-base
577     + stack@ ;
578
579 : spill-float-base ( stack-frame -- n )
580     [ spill-integer-base ]
581     [ spill-counts>> int-regs swap at int-regs reg-size * ]
582     bi + ;
583
584 : spill-float@ ( n -- op )
585     double-float-regs reg-size *
586     stack-frame get spill-float-base
587     + stack@ ;
588
589 M: x86 %spill-integer ( src n -- ) spill-integer@ swap MOV ;
590 M: x86 %reload-integer ( dst n -- ) spill-integer@ MOV ;
591
592 M: x86 %spill-float ( src n -- ) spill-float@ swap MOVSD ;
593 M: x86 %reload-float ( dst n -- ) spill-float@ MOVSD ;
594
595 M: x86 %loop-entry 16 code-alignment [ NOP ] times ;
596
597 M: int-regs %save-param-reg drop [ param@ ] dip MOV ;
598 M: int-regs %load-param-reg drop swap param@ MOV ;
599
600 GENERIC: MOVSS/D ( dst src reg-class -- )
601
602 M: single-float-regs MOVSS/D drop MOVSS ;
603 M: double-float-regs MOVSS/D drop MOVSD ;
604
605 M: float-regs %save-param-reg [ param@ ] 2dip MOVSS/D ;
606 M: float-regs %load-param-reg [ swap param@ ] dip MOVSS/D ;
607
608 GENERIC: push-return-reg ( reg-class -- )
609 GENERIC: load-return-reg ( n reg-class -- )
610 GENERIC: store-return-reg ( n reg-class -- )
611
612 M: x86 %prepare-alien-invoke
613     #! Save Factor stack pointers in case the C code calls a
614     #! callback which does a GC, which must reliably trace
615     #! all roots.
616     temp-reg-1 "stack_chain" f %alien-global
617     temp-reg-1 temp-reg-1 [] MOV
618     temp-reg-1 [] stack-reg MOV
619     temp-reg-1 [] cell SUB
620     temp-reg-1 2 cells [+] ds-reg MOV
621     temp-reg-1 3 cells [+] rs-reg MOV ;
622
623 M: x86 value-struct? drop t ;
624
625 M: x86 small-enough? ( n -- ? )
626     HEX: -80000000 HEX: 7fffffff between? ;
627
628 : next-stack@ ( n -- operand )
629     #! nth parameter from the next stack frame. Used to box
630     #! input values to callbacks; the callback has its own
631     #! stack frame set up, and we want to read the frame
632     #! set up by the caller.
633     stack-frame get total-size>> + stack@ ;