From f09280141f18fbe8cef0ed576cf932e12e315666 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 17 Sep 2018 22:57:10 -0700 Subject: 4548: start of a compiler for a new experimental low-level language --- transect/compiler2 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 transect/compiler2 (limited to 'transect/compiler2') diff --git a/transect/compiler2 b/transect/compiler2 new file mode 100644 index 00000000..5c06cc4f --- /dev/null +++ b/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 -- cgit 1.4.1-2-gfad0