Rewrite cascaded ast.Compare nodes to a sequence of boolean operations ANDed together:
a < b < c
a < b and b < c
Reduce cascaded comparisons into single comparisons
Specialize exception handling. Handle error checking and raising.
Use a C utility function from numba/utility/utilities/virtuallookup.c to look up virtual methods in a hash table.
Use for debugging.
Handle attribute lookup and method calls for autojit extensions with dynamic perfect-hash-based virtual method tables and dynamic object layouts.
Resolve an extension method of a dynamic hash-based vtable:
However, we could preload (**vtab_slot), where function calls invalidate the preload, if we were so inclined.
Lower extension type attribute accesses and method calls.
Resolve an extension attribute.
Resolve an extension method. We currently only support immediate calls of extension methods.
Use a numba function from numba.utility.virtuallookup to look up virtual methods in a hash table.
The virtual method as a Node
Handle attribute lookup and method calls for static extensions with C++/Cython-like virtual method tables and static object layouts.
Resolve an extension attribute for a static object layout.
|Node :||ExtTypeAttribute AST node|
Define various loop implementations.
Implement iteration using indexing.
Length of the iterable
Index element and update index
Implementation of an iterator over a value of a certain type
Get the loop body as a list of statements
Set up an iterator (statement or None)
Get the next iterator element (ExprNode)
Implement iteration over an iterator which has externally callable functions for the getiter and next operations.
Find a suitable iterator type for which we have an implementation
This transforms for loops over objects.
Rewrite a loop like
_arr = array [_s = start] for _i in range(len(_arr)):
i = _i [+ _s] x = _arr[_i] ...
Rewrite a loop like
_xs = xs; _ys = ys... for _i in range(min(len(_xs), len(_ys)...)):
x = _xs[_i]; y = _ys[_i]... ...
This transforms loops over 1D arrays and loops over range().
Convert 1D array iteration to for-range and indexing:
- for value in my_array:
- for i in my_array.shape:
- value = my_array[i] ...
Handle range iteration:
- for i in range(start, stop, step):
nsteps = compute_nsteps(start, stop, step) temp = 0
- while temp < nsteps:
- target = start + temp * step ... temp += 1
Copy cfg basic blocks from one flow node to another
Create a While from a For. The ‘test’ (loop condition) must still be set.
Create a while loop from a flow node (a While or If node)
Temp node with a yet unknown type