2009-12-27

continuations

8.28: adda/continuations:

. how is adda, while coding in c,
controling the stack itself?
. the ultimate goal is to support continuations;
the implementation ultimately involves
making your own stack from heap space,
the design of which can be recalled from assembly programming .

. a key to visualizing the design
is first making a stack system to support native types;
[8.29:
ie, to deal with allignment needs,
an activation record sorts the members according to size,
so that padding can be minimized .
. an array of record of members of varying size
can be restructured as a record of arrays .
] .

compiler optimizations:
. adda has 2 compilers:
. one is straight c for trusted subsystems
then safe c for arbitrary code;
eg, continuations allow monitoring code
and protecting the system from stack overuse;
whereas trusted modules use c's stack .
. generally the trusted code looks more like normal c code
and is allowing the c comiler to do its usual optimizations .
. both adda compilers use the same adda-> etree front end,
then there are various back-end etree transforms
depending on {efficiency, safety} needs;
the final etree is then converted to c code (text)
and given to the C compiler .

10.22: addm/continuations:
motivation:
. how are continuations impl'd?
when is that needed ?
wouldn't it be more efficient for the concerned designers
to break their algor' into smaller chunks
and if one chunk fails,
then start from the output of prev'chunk?
no:
in a mutually recursive algor'
that sort of sequential decomposition
seems to be a daunting, complicated challenge .
. besides,
the mechanisms needed for continuations
are also good for debugging by showing stacked calls .
. conversly,
you should also have modes available,
so that continuations are an option
-- perhaps that mode is low priority ?

addm-based:
. continuations are a perfect match for addm
itself being a lower-priority project than adda .
. continuations really require working at the assembly code level,
exactly where addm is working at .
. they involve implementing your own stack
and computing all the return addresses of your calls
just like the assembler does .

No comments:

Post a Comment