Author: wmb Date: Wed Dec 8 00:40:03 2010 New Revision: 2066 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2066
Log: Generic - fixed invalid assumption in dispose.fth - it assumed that allocated memory for the transient area was above the dictionary. Violation of the assumption caused end-module to crash.
Modified: forth/lib/dispose.fth
Modified: forth/lib/dispose.fth ============================================================================== --- forth/lib/dispose.fth Fri Dec 3 08:10:10 2010 (r2065) +++ forth/lib/dispose.fth Wed Dec 8 00:40:03 2010 (r2066) @@ -63,6 +63,16 @@ 0 value resboundary \ Lower boundary of region to dispose 0 value tranboundary
+: transient-item? ( item -- transient? ) + tranboundary there within +; +: resident-item? ( item -- resident? ) + origin >link resboundary within +; +: safe-transient-item? ( item -- safe-transient? ) + transtart tranboundary within +; + \ relink removes transients from any linked list. It must be called \ with a known good first link, as it doesn't know how to reset \ the head of the list, which is usually a global variable. @@ -71,13 +81,13 @@ \ Skip over all consecutive words in the transient vocabulary dup begin ( prev-item this-item ) - item@ dup tranboundary >= ( prev-item next-item tran? ) + item@ dup transient-item? ( prev-item next-item tran? ) dup if over showit then 0= until ( prev-item next-kept-item ) \ Link the next non-transient word to the previous non-transient one - dup rot item! ( next-kept-item ) - dup resboundary < ( next-kept-item <resboundary? ) - over transtart >= ( next-kept-item <resboundary? safe-transient? ) + dup rot item! ( next-kept-item ) + dup resident-item? ( next-kept-item resident? ) + over safe-transient-item? ( next-kept-item resident? safe-transient? ) or until drop ; @@ -101,7 +111,7 @@ : relink-buffer:s ( -- ) ['] buf-link@ is item@ ['] buf-link! is item! ['] buffer:. is link. buffer-link begin \ Check for transient at head - link@ dup tranboundary >= + link@ dup transient-item? while dup showit >buffer-link repeat buffer-link link! @@ -116,7 +126,7 @@ : relink-voc-list ( -- ) ['] voc-link@ is item@ ['] voc-link! is item! ['] vocab. is link. voc-link begin \ Check for transient at head - link@ dup tranboundary >= + link@ dup transient-item? while dup showit >voc-link repeat voc-link link!