2009-12-16

translation

7.6: adda/oop/registering operation clusters:
. for a type.class like Number
-- whose functions are operations (output is same type as input) --
the functions are often done in clusters
corresponding to expression trees .
. while the straightforward way to eval' an expr'tree
is to recursively eval' subtrees,
the efficient way is load all of the expression's inputs
into the type-mgt's register set,
so that you're calling type-mgt just once on that whole expr'tree
rather than for each operation .

10.23: adda/function calling vs stack loading:
. instead of num's type'mgt using functions,
adda uses a translate to calculator entry .

12.1: adda/translate/c`alloca:
. alloca is exactly designed for adda's
heap as stack-based trailer design!
but it's not std because of
not being easy to impl on all platforms .

adda/translate/c`calloc:
. by translating to calloc instead of malloc,
user is unable to invade privacy of others
who didn't zero their free's .

12.9: adda/concurrency/impl'ing a scheduler in c:

. to simulate multithreading,
the scheduler becomes the actual main program,
while the coprograms are translated into bite-sized "(scheduler slices)
which are then assigned to an array of function pointers .
. the scheduler can then sequence through several such arrays .
. if a subprogram is large eno' to need scheduler slicing,
then the scheduler has to include a calling mechanism
where the coprog's current location is placed on the coprog's stack
and then things continue as is typical of asm lang,
except that the instructions are scheduler slices,
and the return locations are refering to a tuple:
the subprogram's array,
and an index into that array .

. how does the translater know where to make the slices?
first, the adda user helps by finely decomposing the program
into subprogram calls, so then each call becomes a scheduler slice;
ie, the scheduler makes that call, waits for the return,
and then decides what coprogram to work on next .
. all loop bodies could become slices .

. all the function arrays have to use the same inout.type?
either the scheduler may need to impl' its own data stack anyway;
or things might be fudged with casts;
or, calls to functions of arbitrary arg's
can be boxed within std calls
where there is no arg or one having a ptr to environ, etc .

. in the asm model,
the call instruction handles arbitrary arg's like so:
the caller loads the stack with what the sub' expects,
then the sub' refers to all its locals as being
an offset from the current coprogram's stack pointer .
. to emulate this, a parameterized subprogram would
expect the scheduler's stack pointer to access the act'rec .
. the scheduler would start the call by
getting a new arg'rec with malloc,
pushing that onto the data stack;
then after calling, it would free arg'rec it popped from the data stack .

12.26: adda/translation/handling c's small linker namespace:
. the ada`package can be impl'd in c
by exporting a record of function pointers .
so then the linker's small name space need contain
only the names of packages .

12.26: news.adda/security/Flawfinder for c:
. flawfinder is a program that examines C source code
and reports possible security weaknesses (``flaws'') sorted by risk level.
It's very useful for quickly finding and removing
some security problems before a program is widely release


No comments:

Post a Comment