about summary refs log tree commit diff stats
path: root/mu_instructions
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-08-01 16:25:34 -0700
committerKartik Agaram <vc@akkartik.com>2020-08-01 16:25:34 -0700
commitaf983921f6c4170584d5e2a60e0c04556c3f621f (patch)
tree2c1ec449795cd0fc89d927647c41c61b7f6e1110 /mu_instructions
parentd01d4f0c9faaa45117ae7eef0287c5872746b4d5 (diff)
downloadmu-af983921f6c4170584d5e2a60e0c04556c3f621f.tar.gz
6697
Diffstat (limited to 'mu_instructions')
-rw-r--r--mu_instructions22
1 files changed, 9 insertions, 13 deletions
diff --git a/mu_instructions b/mu_instructions
index e28edfff..3f9810a6 100644
--- a/mu_instructions
+++ b/mu_instructions
@@ -236,19 +236,6 @@ var/reg: (addr T_f) <- get var2/reg2: (addr T), f
 var/reg: (addr T_f) <- get var2: T, f
   => "8d/copy-address *(ebp+" var2.stack-offset "+" offset(f) ") " reg "/r32"
 
-# Handles for safe access to the heap
-
-out/reg: (addr T) <- lookup in: (handle T)
-  => # payload_allocid = in->address->allocid
-     "8b/-> *(epb+" (in.stack-offset+4) ") " reg "/r32"
-     "8b/-> *" reg " " reg "/r32"
-     # if (payload_allocid != handle->allocid) abort
-     "39/compare *(ebp+" in.stack-offset ") " reg "/r32"
-     "0f 85/jump-if-!= $lookup:abort/disp32"
-     # return payload
-     "8b/-> *(epb+" (in.stack-offset+4) ") " reg "/r32"
-     "81 0/subop/add %" reg " 4/imm32"  # skip payload->allocid
-
 # Allocating memory
 
 allocate in: (addr handle T)
@@ -257,4 +244,13 @@ allocate in: (addr handle T)
 populate in: (addr handle array T), num  # can be literal or variable on stack or register
   => "(allocate-array2 Heap " size-of(T) " " num " " in ")"
 
+populate-stream in: (addr handle stream T), num  # can be literal or variable on stack or register
+  => "(new-stream Heap " size-of(T) " " num " " in ")"
+
+read-from-stream s: (addr stream T), out: (addr T)
+  => "(read-from-stream " s " " out " " size-of(T) ")"
+
+write-to-stream s: (addr stream T), in: (addr T)
+  => "(write-to-stream " s " " in " " size-of(T) ")"
+
 vim:ft=mu:nowrap:textwidth=0