micropython

TO_DO.txt

409:bcdd14822a46
2011-03-23 Paul Boddie Made ObjectSet more usable as a set member and as a collection. Store products of ObjectSet instances in a set, not a list. Fixed the HTML generation to show attribute types again.
     1 Attribute Usage
     2 ===============
     3 
     4 Consider attribute assignment observations, along with the possibility of class attribute
     5 assignment.
     6 
     7   Note direct assignments as usual, indirect assignments via the attribute usage
     8   mechanism. During attribute collection and inference, add assigned values to all
     9   inferred targets.
    10 
    11   Since class attributes can be assigned, StoreAttrIndex would no longer need to reject
    12   static attributes, although this might still be necessary where attribute usage analysis
    13   has not been performed.
    14 
    15   Potentially consider changing static attribute details to use object-relative offsets in
    16   order to simplify the instruction implementations. This might allow us to eliminate the
    17   static attribute flag for attributes in the object table, at least at run-time.
    18 
    19 Consider attribute usage observations being suspended inside blocks where AttributeError
    20 may be caught (although this doesn't anticipate such exceptions being caught outside a
    21 function altogether).
    22 
    23 Consider type deduction and its consequences where types belong to the same hierarchy
    24 and where a guard could be generated for the most general type.
    25 
    26 Consider permitting multiple class alternatives where the attributes are all identical.
    27 
    28 Support class attribute positioning similar to instance attribute positioning, potentially
    29 (for both) based on usage observations. For example, if __iter__ is used on two classes,
    30 the class attribute could be exposed at a similar relative position to the class (and
    31 potentially accessible using a LoadAttr-style instruction).
    32 
    33 **** Constant attribute users need not maintain usage since they are already resolved. ****
    34 
    35 Loop entry points should capture usage to update later assignments in the loop.
    36 The continue and break statements should affect usage propagation.
    37 
    38 Consider handling CallFunc in micropython.inspect in order to produce instances of specific classes.
    39 Then, consider adding support for guard removal/verification where known instances are involved.
    40 Consider handling branches of values within namespaces in order to support more precise value usage.
    41 
    42 Frame Optimisations
    43 ===================
    44 
    45 Stack frame replacement where a local frame is unused after a call, such as in a tail call
    46 situation.
    47 
    48 Local assignment detection plus frame re-use. Example: slice.__init__ calls
    49 xrange.__init__ with the same arguments which are unchanged in xrange.__init__. There is
    50 therefore no need to build a new frame for this call.
    51 
    52 Function Specialisation
    53 =======================
    54 
    55 Specialisation of certain functions, such as isinstance(x, cls) where cls is a known
    56 constant.
    57 
    58 Structure and Object Table Optimisations
    59 ========================================
    60 
    61 Fix object table entries for attributes not provided by any known object, or provide an
    62 error, potentially overridden by options. For example, the augmented assignment methods
    63 are not supported by the built-in objects and thus the operator module functions cause
    64 the compilation to fail. Alternatively, just supply the methods since something has to do
    65 so in the builtins.
    66 
    67 Consider attribute merging where many attributes are just aliases for the same underlying
    68 definition.
    69 
    70 Consider references to defaults as occurring only within the context of a particular
    71 function, thus eliminating default value classes if such functions are not themselves
    72 invoked.
    73 
    74 Scope Handling
    75 ==============
    76 
    77 Consider merging the InspectedModule.store tests with the scope conflict handling.
    78 
    79 Consider labelling _scope on assignments and dealing with the assignment of removed
    80 attributes, possibly removing the entire assignment, and distinguishing between such cases
    81 and unknown names.
    82 
    83 Check name origin where multiple branches could yield multiple scope interpretations:
    84 
    85 ----
    86 try:
    87     set # built-in name
    88 except NameError:
    89     from sets import Set as set # local definition of name
    90 
    91 set # could be confused by the local definition at run-time
    92 ----
    93 
    94 Object Coverage
    95 ===============
    96 
    97 Support __init__ traversal (and other implicit names) more effectively.
    98 
    99 Other
   100 =====
   101 
   102 Support tuple as a function returning any input tuple uncopied.
   103 
   104 Check context_value initialisation (avoiding or handling None effectively).
   105 
   106 __getitem__ could be written in Python, using a native method only to access fragments.
   107 
   108 Consider better "macro" support where new expressions need to be generated and processed.
   109 
   110 Detect TestIdentity results involving constants, potentially optimising status-affected
   111 instructions:
   112 
   113   TestIdentity(x, y) # where x is always y
   114   JumpIfFalse(...)   # would be removed (never false)
   115   JumpIfTrue(...)    # changed to Jump(...)
   116 
   117 Status-affected blocks could be optimised away for such constant-related results.