• Kevin Modzelewski's avatar
    Add some lifetime information to temporaries in the cfg · ca2ed310
    Kevin Modzelewski authored
    By adding a 'is_kill' flag to AST_Name nodes, which say that
    this is the last use of this name.  This handles some common cases
    of keeping temporaries alive for too long.
    
    For some rare cases, there is no AST_Name that is a last use:
    for example, the iterator object of a for loop is live after
    every time it is used, but dies when exiting the loop.
    
    For those, we insert a `del #foo` instead.
    
    The interpreter and bjit use these flags to remove temporaries
    from the vregs.
    
    The LLVM jit ignores them since it has its own way of handling
    lifetime.  It ignores any `del` statements on temporary names
    as an optimization.
    
    This does not handle decref'ing temporaries on an exception.
    ca2ed310
ast.cpp 51.6 KB