about summary refs log tree commit diff stats
path: root/061channel.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-13 22:43:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-13 22:50:49 -0700
commit77d5b5d658830bd24724f945e0d6ddf6a06adc0e (patch)
tree94c50c0ddfa6d55dc1189d62243ceeacaf783326 /061channel.mu
parent84e4ed1ab58d5b34cf92919aedbb15736a7349d9 (diff)
downloadmu-77d5b5d658830bd24724f945e0d6ddf6a06adc0e.tar.gz
1780 - now we always reclaim local scopes
But still no difference in either memory footprint or in running time.
This will teach me -- for the umpteenth time -- to optimize before
measuring.
Diffstat (limited to '061channel.mu')
-rw-r--r--061channel.mu16
1 files changed, 8 insertions, 8 deletions
diff --git a/061channel.mu b/061channel.mu
index 5b3f31d3..9f86ba2d 100644
--- a/061channel.mu
+++ b/061channel.mu
@@ -33,7 +33,7 @@ container channel [
 
 # result:address:channel <- new-channel capacity:number
 recipe new-channel [
-  new-default-space
+  local-scope
   # result = new channel
   result:address:channel <- new channel:type
   # result.first-full = 0
@@ -52,7 +52,7 @@ recipe new-channel [
 
 # chan:address:channel <- write chan:address:channel, val:location
 recipe write [
-  new-default-space
+  local-scope
   chan:address:channel <- next-ingredient
   val:location <- next-ingredient
   {
@@ -81,7 +81,7 @@ recipe write [
 
 # result:location, chan:address:channel <- read chan:address:channel
 recipe read [
-  new-default-space
+  local-scope
   chan:address:channel <- next-ingredient
   {
     # block if chan is empty
@@ -107,7 +107,7 @@ recipe read [
 ]
 
 recipe clear-channel [
-  new-default-space
+  local-scope
   chan:address:channel <- next-ingredient
   {
     empty?:boolean <- channel-empty? chan:address:channel
@@ -185,7 +185,7 @@ scenario channel-wrap [
 
 # An empty channel has first-empty and first-full both at the same value.
 recipe channel-empty? [
-  new-default-space
+  local-scope
   chan:address:channel <- next-ingredient
   # return chan.first-full == chan.first-free
   full:number <- get chan:address:channel/deref, first-full:offset
@@ -197,7 +197,7 @@ recipe channel-empty? [
 # A full channel has first-empty just before first-full, wasting one slot.
 # (Other alternatives: https://en.wikipedia.org/wiki/Circular_buffer#Full_.2F_Empty_Buffer_Distinction)
 recipe channel-full? [
-  new-default-space
+  local-scope
   chan:address:channel <- next-ingredient
   # tmp = chan.first-free + 1
   tmp:number <- get chan:address:channel/deref, first-free:offset
@@ -217,7 +217,7 @@ recipe channel-full? [
 
 # result:number <- channel-capacity chan:address:channel
 recipe channel-capacity [
-  new-default-space
+  local-scope
   chan:address:channel <- next-ingredient
   q:address:array:location <- get chan:address:channel/deref, data:offset
   result:number <- length q:address:array:location/deref
@@ -279,7 +279,7 @@ scenario channel-read-not-full [
 # helper for channels of characters in particular
 # out:address:channel <- buffer-lines in:address:channel, out:address:channel
 recipe buffer-lines [
-  new-default-space
+  local-scope
 #?   $print [buffer-lines: aaa
 #? ]
   in:address:channel <- next-ingredient