Permalink
Browse files

bugfix: local names are now freed correctly even with quotations.

  • Loading branch information...
1 parent 3ce54f1 commit 367d4158b4f9eb224573fe4682789ee5040d2a99 anton committed Feb 9, 2012
Showing with 12 additions and 12 deletions.
  1. +6 −7 glocals.fs
  2. +2 −1 kernel/comp.fs
  3. +4 −4 quotations.fs
View
@@ -79,11 +79,6 @@
\ aligned correctly, but our locals stack must be float-aligned between
\ words.
-\ Other things about the internals are pretty unclear now.
-
-\ Currently locals may only be
-\ defined at the outer level and TO is not supported.
-
require search.fs
require float.fs
require extend.fs \ for case
@@ -572,12 +567,15 @@ forth definitions
latest latestxt
clear-leave-stack
0 locals-size !
- locals-mem-list @ free-list
- 0 locals-mem-list !
0 locals-list !
dead-code off
defstart ;
+:noname ( -- )
+ locals-mem-list @ free-list
+ 0 locals-mem-list ! ;
+is free-old-local-names
+
: locals-;-hook ( sys addr xt sys -- sys )
def?
0 TO locals-wordlist
@@ -657,6 +655,7 @@ forth definitions
' locals-:-hook IS :-hook
' locals-;-hook IS ;-hook
+
' (then-like) IS then-like
' (begin-like) IS begin-like
' (again-like) IS again-like
View
@@ -567,7 +567,7 @@ interpret/compile: TO ( w "name" -- ) \ core-ext
\ \ : ; 24feb93py
defer :-hook ( sys1 -- sys2 )
-
+defer free-old-local-names ( -- )
defer ;-hook ( sys2 -- sys1 )
0 Constant defstart
@@ -578,6 +578,7 @@ defer ;-hook ( sys2 -- sys1 )
defstart ] :-hook ;
: : ( "name" -- colon-sys ) \ core colon
+ free-old-local-names
Header (:noname) ;
: :noname ( -- xt colon-sys ) \ core-ext colon-no-name
View
@@ -3,17 +3,17 @@
:noname false :noname ;
:noname locals-wordlist last @ lastcfa @
postpone AHEAD
- locals-list @ locals-list off
- locals-dp @ dup >r postpone SCOPE
- true :noname r> locals-dp ! ;
+ locals-list @ locals-list off
+ postpone SCOPE
+ true :noname ;
interpret/compile: [: ( -- quotation-sys )
\G Starts a quotation
: ;] ( compile-time: quotation-sys -- ; run-time: -- xt )
\g ends a quotation
POSTPONE ; >r IF
] postpone ENDSCOPE
- locals-dp ! locals-list !
+ locals-list !
postpone THEN
lastcfa ! last ! to locals-wordlist
r> postpone ALiteral

0 comments on commit 367d415

Please sign in to comment.