]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg.build-stack-frame: fix tests.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 12 Dec 2014 23:22:22 +0000 (15:22 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 12 Dec 2014 23:22:22 +0000 (15:22 -0800)
basis/compiler/cfg/build-stack-frame/build-stack-frame-docs.factor
basis/compiler/cfg/build-stack-frame/build-stack-frame-tests.factor
basis/compiler/cfg/build-stack-frame/build-stack-frame.factor

index 0c45b68201386a39c6999998c88ce6f9a3f19001..f3a0a989a1a5b8fd3ce0719a2cec7c5807de812f 100644 (file)
@@ -16,4 +16,8 @@ HELP: compute-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 and stores the " { $slot "allot-area-base" } ", " { $slot "spill-area-base" } " and " { $slot "total-size" } " slots of a stack frame." } ;
+
 ABOUT: "compiler.cfg.build-stack-frame"
index a585400eae8c254e36726f6d64363dc0438bbc63..c60a44ab53e8493a6b0c82b8b22d55b6a2a0bafb 100644 (file)
@@ -1,6 +1,5 @@
-USING: accessors compiler.cfg compiler.cfg.build-stack-frame
-compiler.cfg.instructions compiler.cfg.stack-frame cpu.x86 kernel layouts
-math slots.syntax system tools.test ;
+USING: compiler.cfg.build-stack-frame compiler.cfg.stack-frame
+cpu.x86 math slots.syntax tools.test ;
 IN: compiler.cfg.build-stack-frame.tests
 
 {
@@ -17,7 +16,7 @@ IN: compiler.cfg.build-stack-frame.tests
        { allot-area-size 10 }
        { spill-area-align 8 }
        { spill-area-size 16 }
-    } dup finalize-stack-frame
+    } finalize-stack-frame
     slots[ allot-area-base spill-area-base total-size ]
     ! Exclude any reserved stack space 32 bytes on win64, 0 bytes
     ! on all other platforms.
index 6b7eb4546ee8a114ca2ba8b650c3a218c921a93d..7ea0e71f2c08263bd5f16ecad655b11be827c8d8 100644 (file)
@@ -56,6 +56,11 @@ M: insn compute-stack-frame* drop ;
     [ allot-area-size>> + ]
     [ spill-area-align>> ] tri align ;
 
+: finalize-stack-frame ( stack-frame -- stack-frame )
+    dup calculate-allot-area-base >>allot-area-base
+    dup calculate-spill-area-base >>spill-area-base
+    dup stack-frame-size >>total-size ;
+
 : <stack-frame> ( cfg -- stack-frame )
     stack-frame new
         over spill-area-size>> >>spill-area-size
@@ -63,9 +68,7 @@ M: insn compute-stack-frame* drop ;
         allot-area-size get >>allot-area-size
         allot-area-align get >>allot-area-align
         param-area-size get >>params
-        dup calculate-allot-area-base >>allot-area-base
-        dup calculate-spill-area-base >>spill-area-base
-        dup stack-frame-size >>total-size ;
+        finalize-stack-frame ;
 
 : compute-stack-frame ( cfg -- stack-frame/f )
     [ [ instructions>> [ compute-stack-frame* ] each ] each-basic-block ]