Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 367d4158b4f9eb224573fe4682789ee5040d2a99 1 parent 3ce54f1
authored
13  glocals.fs
@@ -79,11 +79,6 @@
79 79
 \ aligned correctly, but our locals stack must be float-aligned between
80 80
 \ words.
81 81
 
82  
-\ Other things about the internals are pretty unclear now.
83  
-
84  
-\ Currently locals may only be
85  
-\ defined at the outer level and TO is not supported.
86  
-
87 82
 require search.fs
88 83
 require float.fs
89 84
 require extend.fs \ for case
@@ -572,12 +567,15 @@ forth definitions
572 567
     latest latestxt
573 568
     clear-leave-stack
574 569
     0 locals-size !
575  
-    locals-mem-list @ free-list
576  
-    0 locals-mem-list !
577 570
     0 locals-list !
578 571
     dead-code off
579 572
     defstart ;
580 573
 
  574
+:noname ( -- )
  575
+    locals-mem-list @ free-list
  576
+    0 locals-mem-list ! ;
  577
+is free-old-local-names
  578
+
581 579
 : locals-;-hook ( sys addr xt sys -- sys )
582 580
     def?
583 581
     0 TO locals-wordlist
@@ -657,6 +655,7 @@ forth definitions
657 655
 ' locals-:-hook IS :-hook
658 656
 ' locals-;-hook IS ;-hook
659 657
 
  658
+
660 659
 ' (then-like)  IS then-like
661 660
 ' (begin-like) IS begin-like
662 661
 ' (again-like) IS again-like
3  kernel/comp.fs
@@ -567,7 +567,7 @@ interpret/compile: TO ( w "name" -- ) \ core-ext
567 567
 \ \ : ;                                                  	24feb93py
568 568
 
569 569
 defer :-hook ( sys1 -- sys2 )
570  
-
  570
+defer free-old-local-names ( -- )
571 571
 defer ;-hook ( sys2 -- sys1 )
572 572
 
573 573
 0 Constant defstart
@@ -578,6 +578,7 @@ defer ;-hook ( sys2 -- sys1 )
578 578
     defstart ] :-hook ;
579 579
 
580 580
 : : ( "name" -- colon-sys ) \ core	colon
  581
+    free-old-local-names
581 582
     Header (:noname) ;
582 583
 
583 584
 : :noname ( -- xt colon-sys ) \ core-ext	colon-no-name
8  quotations.fs
@@ -3,9 +3,9 @@
3 3
 :noname  false :noname ;
4 4
 :noname  locals-wordlist last @ lastcfa @
5 5
     postpone AHEAD
6  
-    locals-list @  locals-list off
7  
-    locals-dp @ dup >r     postpone SCOPE
8  
-    true  :noname  r> locals-dp ! ;
  6
+    locals-list @ locals-list off
  7
+    postpone SCOPE
  8
+    true  :noname  ;
9 9
 interpret/compile: [: ( -- quotation-sys )
10 10
 \G Starts a quotation
11 11
 
@@ -13,7 +13,7 @@ interpret/compile: [: ( -- quotation-sys )
13 13
     \g ends a quotation
14 14
     POSTPONE ; >r IF
15 15
 	]  postpone ENDSCOPE
16  
-	locals-dp !  locals-list !
  16
+	locals-list !
17 17
 	postpone THEN
18 18
 	lastcfa ! last ! to locals-wordlist
19 19
 	r> postpone ALiteral

0 notes on commit 367d415

Please sign in to comment.
Something went wrong with that request. Please try again.