summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2014-01-31 09:18:20 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2014-01-31 09:18:20 -0500
commitee684dab2b5e4bb1c487a529285f53a43de05653 (patch)
tree75bc37598490554b1cf4c8fcd2cbf8b9964b685a
parentc20a9086f607cfcc699958d3aaeb40e8662f06f3 (diff)
todo
-rw-r--r--TODO57
1 files changed, 53 insertions, 4 deletions
diff --git a/TODO b/TODO
index 79e97aa..75ae853 100644
--- a/TODO
+++ b/TODO
@@ -53,10 +53,59 @@
In the case where we can detect that an expression doesn't escape,
the array based stack could then be used. Is detection as simple as
there being no function calls in the expression? And no
- statement-expressions, presumably.
-
- This will have to be considered an optimization.
-
+ statement-expressions, presumably. Not sure. This will have to be
+ considered an optimization.
+
+ With these changes, will it be possible to move the return address
+ back onto the 'stack'? If so, the contents of an environment will
+ look like this:
+
+ env_t *outer;
+ env_t *prev;
+ stack_t *stack;
+ [variables]
+
+ A label consists of a code pointer, an environment, and a stack
+ pointer. Jumping to a label consists of activating the
+ environment, resetting the stack pointer, and then going to the
+ code pointer.
+
+ Is is in fact going to be the case that a label will *always* have
+ a stack height of zero? Then jumping to a label just needs to set
+ the stack pointer to NULL. Jumping into the middle of an expression
+ that hasn't been activated seems ill-defined, which would indicate
+ that the (expression) stack height is indeed NULL. (This probably
+ then precludes having the return pointer stored on the stack).
+
+ Preliminary conclusions:
+
+ - expression stack must become a heap allocated tree
+ - environments need to contain
+ - prev_env [the environment to restore after return]
+ - outer_env [pointer to containing environment]
+ - return address [where to jump when returning]
+ - stack pointer [pointer to node of the expression tree]
+
+ = Returning:
+ - push the return value on top of the stack in the return environment
+ - restore outer environment
+ - jump to return address
+
+ = Generating a label:
+ - push env and code pointer
+
+ = Goto:
+ - restore env
+ - set expression stack pointer to NULL
+ - goto code pointer
+
+ = Call:
+ - Allocate new env
+ - Store current env as prev_env
+ - Store closure env as outer
+ - Set stack pointer to NULL
+ - Set return address to current address
+ - Jump to function
- Short-term tasks: