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