Yue Li wrote:
   Are signatures preserved only until type checking phase before the
code generation phase?

Any declaration will involve a name, a description of some sort and some code. The description might be the type of a value or in the case of a structure or signature a data-structure representing the signature. The code may involve evaluating some expression or, in the case of signature, infix and simple type bindings it may be zero. The resulting of compiling anything is a unit->unit function which when called executes the code and also side-effects the name-space to put the declared value into the name-space.

  Could you introduce a little bit on how CR CL and LOCALS are
determined in the later phase of code generation? Thanks again!

LOCALS is used as a high-water mark to indicate the maximum number of local bindings in the function. Not all the bindings may be present because often they are created as part of the inline function expansion process and then removed if they are not actually referenced.

CL is false if the function has non-local references but does not require a closure. This may happen if it is declared as local to another function but is only ever called and not, for example, returned as a result. Creating a closure requires heap allocation so it's better if it can be avoided.

CR has to do with when the register that contains the address of the closure is no longer required and can be reused.

All these are computed within later phases of the code-generator.

Regards,
David
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to