- Entries in the compiler database
- Variable properties
- Procedure properties
Entries in the compiler database
The compiler database maps each user- or internal variable name to a property list holding various properties that are obtained through a previous analysis pass over the compiled code. Additionally, the database contains entries for each procedure-id (a unique internal symbol identifier) for each lambda node processed during analysis.
Note that the interaction of these properties may be quite subtle and the influence certain combinations of variable and/or procedure attributes control all further optimization and translation phases. Performing modifications in the database should only be done with great care.
[property] captured -> <boolean>
If true: variable is used outside it's home-scope and so lexically visible in an inner (nested) lambda.
[property] global -> <boolean>
If true: variable does not occur in any lambda-list.
[property] call-sites -> ((<lambda-id> <node>) ...)
Known nodes of call-sites (##core#call nodes) that invoke a procedure bound to this variable.
[property] home -> <lambda-id>
Procedure which introduces this variable (either in the lambda-list or via let).
[property] unknown -> <boolean>
If true: variable can not have a known value.
[property] assigned -> <boolean>
If true: variable is assigned somewhere.
[property] assigned-locally -> <boolean>
If true: variable has been assigned inside user lambda.
[property] undefined -> <boolean>
If true: variable is unknown yet but may be known later. letrec expands into let forms binding variables to ##core#undefined and this will result in this property being set.
[property] value -> <node>
Variable has a known value refering to a node.
[property] potential-value -> <node>
Global variable was assigned this value and may potentially be known.
currently not used, I believe - fw
[property] references -> (<node> ...)
Nodes that are accesses of this variable (##core#variable nodes).
[property] side-effecting -> <boolean>
If true: variable names side-effecting standard-binding.
[property] foldable -> <boolean>
If true: variable names foldable standard-binding.
[property] boxed -> <boolean>
If true: variable has to be boxed after closure-conversion (i.e. is assigned to).
[property] contractable -> <boolean>
If true: variable names contractable procedure (known and called only once). A variable is contractable if it has a procedure as known value, has only one use and one call-site and if the lambda has no free non-global variables or is an internal lambda.
[property] inlinable -> <boolean>
If true: variable names potentially inlinable procedure.
[property] collapsable -> <boolean>
If true: variable is collapsable, that is, it refers to a known constant value which is either collapsable itself or is only referenced once.
[property] removable -> <boolean>
If true: variable is not used.
[property] replacable -> <variable>
Variable can be replaced by another variable. A replacable variable has a variable as known value and if either that variable has a known value itself, or if it is not captured and referenced only once, the target and the source are never assigned and the source is non-global or we are in block-mode. The target-variable is not allowed to be global. The variable that can be substituted for the current one is marked as replacing. This is done to prohibit beta-contraction of the replacing variable (It wouldn't be there, if it was contracted).
Also make a variable replacable, if it has a known value of the form (lambda (<xvar>) (<kvar> <xvar>)) and is an internally created procedure.
[property] replacing -> <boolean>
If true: variable can replace another variable (don't remove).
[property] standard-binding -> <boolean>
If true: variable names a standard binding as defined in c-platform.scm.
[property] extended-binding -> <boolean>
If true: variable names an extended binding as defined in c-platform.scm.
[property] unused -> <boolean>
If true: variable is a formal parameter that is never used. Another way to look at it is that a variable that has a known value that is a procedure, and if the number of call-sites is equal to the number of references (does not escape), then make all formal parameters unused which are never referenced or assigned (if no rest parameter exist). Also marks the procedure as has-unused-parameters (if not in callback-names). If the procedure is internal (a continuation) do NOT mark unused parameters.
[property] rest-parameter -> #f | 'vector | 'list
If true: variable holds rest-argument list mode
[property] o-r/access-count -> <n>
Contains number of references to this variable where the reference is an arguments of a optimizable rest operators (a standard operator that accesses the rest-argument and which can be replaced by a more efficient vector-operation).
[property] constant -> <boolean>
If true: variable has fixed value.
[property] contains -> (<lambda-id> ...)
Procedures contained in this lambda.
[property] contained-in -> <lambda-id>
Procedure containing this lambda.
[property] has-unused-parameters -> <boolean>
If true: procedure has unused formal parameters.
[property] use-expr -> (<lambda-id> ...)
Marks non-direct use-sites of common subexpression.
[property] closure-size -> <integer>
Number of free variables stored in a closure.
[property] customizable -> <boolean>
If true: all call sites are known, procedure does not escape.
[property] simple -> <boolean>
If true: procedure only calls its continuation and no other procedures.
[property] explicit-rest -> <boolean>
A procedure that is called with consed rest list and has no unused parameter variables.
[property] captured-variables -> (<var> ...)
List of closed over variables.