compiler.cfg.build-stack-frame: stub docs and tests for vocab
parent
cbc8681187
commit
8a0b4c3d26
|
@ -0,0 +1,19 @@
|
|||
USING: assocs compiler.cfg compiler.cfg.stack-frame help.markup help.syntax ;
|
||||
IN: compiler.cfg.build-stack-frame
|
||||
|
||||
ARTICLE: "compiler.cfg.build-stack-frame" "Computing stack frame size and layout"
|
||||
"The " { $vocab-link "compiler.cfg.build-stack-frame" } " vocab builds stack frames for cfg:s." ;
|
||||
|
||||
HELP: frame-required?
|
||||
{ $var-description "Whether the word being compiled requires a stack frame or not. Most words does, but very simple words does not." } ;
|
||||
|
||||
HELP: compute-stack-frame
|
||||
{ $values { "cfg" cfg } { "stack-frame/f" stack-frame } }
|
||||
{ $description "Initializes a stack frame for a cfg, if it needs one." }
|
||||
{ $see-also frame-required? } ;
|
||||
|
||||
HELP: finalize-stack-frame
|
||||
{ $values { "stack-frame" stack-frame } }
|
||||
{ $description "Calculates the " { $slot "allot-area-base" } ", " { $slot "spill-area-base" } " and " { $slot "total-size" } " slots of a stack frame." } ;
|
||||
|
||||
ABOUT: "compiler.cfg.build-stack-frame"
|
|
@ -0,0 +1,22 @@
|
|||
USING: accessors compiler.cfg compiler.cfg.build-stack-frame
|
||||
compiler.cfg.instructions compiler.cfg.stack-frame kernel slots.syntax
|
||||
tools.test ;
|
||||
IN: compiler.cfg.build-stack-frame.tests
|
||||
|
||||
{
|
||||
! 91 8 align
|
||||
96
|
||||
! 91 8 align 16 +
|
||||
112
|
||||
! 91 8 align 16 + 16 8 align + cell + 16 align
|
||||
144
|
||||
} [
|
||||
T{ stack-frame
|
||||
{ params 91 }
|
||||
{ allot-area-align 8 }
|
||||
{ allot-area-size 10 }
|
||||
{ spill-area-align 8 }
|
||||
{ spill-area-size 16 }
|
||||
} dup finalize-stack-frame
|
||||
slots[ allot-area-base spill-area-base total-size ]
|
||||
] unit-test
|
Loading…
Reference in New Issue