about summary refs log tree commit diff stats
path: root/archive/2.transect/compiler2
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-01-01 17:04:37 -0800
committerKartik Agaram <vc@akkartik.com>2020-01-01 17:04:37 -0800
commit2a4088119cf41175457414dfa59bd4064b8f0562 (patch)
tree64fe184e399f9870ebd481a90eec34d51e5dff68 /archive/2.transect/compiler2
parent23fd294d85959c6b476bcdc35ed6ad508cc99b8f (diff)
downloadmu-2a4088119cf41175457414dfa59bd4064b8f0562.tar.gz
5852
Diffstat (limited to 'archive/2.transect/compiler2')
-rw-r--r--archive/2.transect/compiler227
1 files changed, 27 insertions, 0 deletions
diff --git a/archive/2.transect/compiler2 b/archive/2.transect/compiler2
new file mode 100644
index 00000000..5c06cc4f
--- /dev/null
+++ b/archive/2.transect/compiler2
@@ -0,0 +1,27 @@
+to dereference a heap allocation
+  copy handle to stack
+  perform lookup to stack
+
+lookup x in *(ESP+4) of type (handle T)
+
+  reg <- copy *(ESP+5) : (address T stack)
+  payload alloc id <- copy *reg
+  address alloc id <- copy *(ESP+4)
+  compare payload alloc id, address alloc id
+  jump if not equal to print stack trace and panic
+  address <- add reg, 1
+
+types:
+
+  address T reg
+  address T stack
+  address T heap
+  address T global
+
+copy down this spectrum is not permitted, but up is.
+
+addresses aren't allowed in types, globals and on the heap. Only handles.
+addresses are only for temporary manipulations.
+
+
+*(address T) <- copy T