Commit 19e96622184fea70b0b2ed238affdb869b1e21da

Authored by Alain Prouté
1 parent 56ee3cb4

-

Showing 1 changed file with 57 additions and 58 deletions   Show diff stats
anubis_dev/library/a2a/generic/preformater.anubis
@@ -78,11 +78,10 @@ type GeoParms: @@ -78,11 +78,10 @@ type GeoParms:
78 78
79 Default values for 32 and 64 bits machines: 79 Default values for 32 and 64 bits machines:
80 80
81 -define GeoParms default_32_geoparms = geoparms(8,32,32,4,30,128).  
82 -define GeoParms default_64_geoparms = geoparms(8,64,64,8,48,256). 81 +define GeoParms default_32_geoparms = geoparms((Int)8,(Int)32,(Int)32,(Int)4,(Int)1,(Int)30,(Int)128).
  82 +define GeoParms default_64_geoparms = geoparms((Int)8,(Int)64,(Int)64,(Int)8,(Int)1,(Int)48,(Int)256).
83 83
84 84
85 -  
86 *** [] General principles 85 *** [] General principles
87 86
88 Data are represented either 'directly' or 'indirectly'. 'Directly' 87 Data are represented either 'directly' or 'indirectly'. 'Directly'
@@ -258,7 +257,7 @@ define Int @@ -258,7 +257,7 @@ define Int
258 AnubisType type 257 AnubisType type
259 ) = 258 ) =
260 if tb is tbox(allt,alld,parms) then 259 if tb is tbox(allt,alld,parms) then
261 - if parms is geoparms(samu,wrdw,ptrw,algu,aptrw,ithh) then 260 + if parms is geoparms(samu,wrdw,ptrw,halu,salu,aptw,ithh) then
262 if type is 261 if type is
263 { 262 {
264 parameter(name) then should_not_happen(0), 263 parameter(name) then should_not_happen(0),
@@ -323,65 +322,65 @@ type Implementation: @@ -323,65 +322,65 @@ type Implementation:
323 322
324 *** [] High level instructions 323 *** [] High level instructions
325 324
326 -public type HLInstr:  
327 -  
328 - /* allocate a segment of a given size (in bits) and push the pointer on top of stack */  
329 - alloc_push (Int width),  
330 -  
331 - /* push a constant on top of stack */  
332 - push_cst (Int width, // width of datum (the width of stack slot will be computed from it)  
333 - Int value), // value to be pushed  
334 -  
335 - /* pop a value from top of stack and glue it into the glue register */  
336 - pop_glue (Int width, // width of value  
337 - Int disp), // displacement in glue register  
338 -  
339 - /* push the content of the glue register on top of stack */  
340 - push_glue (Int width), // width of datum to be pushed  
341 -  
342 - mov (Int src_address,  
343 - Int dst_address,  
344 - Int width).  
345 325
  326 +public type StackPos:
  327 + /* Type and position of a datum in the stack */
  328 + stk (AnubisType type,
  329 + Int depth), // datum directly in the stack at depth 'depth'
  330 + mctxt (AnubisType type,
  331 + Int stack_depth, // datum in a micro-context at depth 'stack_depth' in the stack
  332 + Int offset). // and at offset 'offset' in the micro-context
346 333
347 - *** [] Generating constructors 334 +
  335 +
  336 +public type HLInstr:
  337 + /* label (pseudo-instruction) */
  338 + label (Int name),
348 339
  340 + /* make a virtual copy */
  341 + copy (StackPos pos),
349 342
350 -define List(HLInstr)  
351 - make_small_glue  
352 - (  
353 - Int iw,  
354 - List(CompImplem) comps  
355 - ) =  
356 - if comps is  
357 - {  
358 - [ ] then [ ],  
359 - [c1 . others] then if c1 is comp(off,cw,impl) then  
360 - [ glue()  
361 -  
362 - ]  
363 - }. 343 + /* make a virtual deletion */
  344 + delete (StackPos pos),
364 345
  346 + /* move a datum (no copy; if a copy is needed, it must be performed before the move) */
  347 + move (StackPos source,
  348 + StackPos destination),
365 349
366 -define List(HLInstr)  
367 - constructor  
368 - (  
369 - TypeImplem implem,  
370 - Int index  
371 - ) =  
372 - if implem is sum(tw,alts)  
373 - if alt is  
374 - {  
375 - small(iw,i,n,comps) then  
376 - [  
377 - push_cst(tw,i)  
378 - . make_small_glue(iw,comps)  
379 - ],  
380 -  
381 - mixed(iw,i,n,comps) then [],  
382 - large(iw,i,n,comps) then []  
383 - }.  
384 -  
385 - 350 + /* get the alternative index of the datum on top of stack (and put it in the index register) */
  351 + index (AnubisType type),
  352 +
  353 + /* switch (jmp to the label whose rank is in the index register) */
  354 + switch (List(Int) labels),
386 355
  356 + /* compact (compact data on the stack (via the glue register)) */
  357 + compact (AnubisAlternative alt),
  358 +
  359 + /* extract (extract a datum from a compacted representation and push it on the stack) */
  360 + extract (AnubisAlternative alt,
  361 + Int component_rank),
  362 +
  363 + /* address (push a label on the stack; this may be a return address) */
  364 + address (Int label_name),
  365 +
  366 + /* closure (construct a multiclosure and push it on the stack) */
  367 + closure (List(Int) code_labels, // codes of functions
  368 + Int gc_label, // deletion code of closure
  369 + List(StackPos) micro_data), // data to be put into the micro-context (no copy;
  370 + // virtual copies must have been performed before
  371 + // this instruction is executed)
  372 +
  373 + /* apply a function to its argument (everything is on the stack) */
  374 + apply (AnubisType arg_type), // type of argument
  375 +
  376 + /* return from a call */
  377 + ret,
  378 +
  379 + /* unreachable (control should never reach this point) */
  380 + unreachable.
  381 +
  382 +
  383 +
  384 +
  385 + *** [] Generating constructors
387 386