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