angr.go.optimization_passes.stack_inits

Stack initializations the compiler expands inline.

make(map[K]V) of a map that does not escape (go1.24+ swiss maps): the compiler places the maps.Map header and one group on the stack, zeroes both, marks the group’s control word empty, points dirPtr at the group and seeds the hash with runtime.rand(). The whole sequence becomes m := make(map[K]V) and &header becomes m.

Large zero values are cleared by a loop over the variable (plus stores for the tail); that is one memset.

class angr.go.optimization_passes.stack_inits.SmallMapFolder

Bases: _StackScan

See the module docstring.

run()
Return type:

list[Block]

class angr.go.optimization_passes.stack_inits.StackClearFolder

Bases: _StackScan

A loop clearing a stack variable stride bytes per trip, plus the stores clearing its tail, is one memset(&v, 0, size); the code generator spells a whole-variable clear as v = T{}.

run()
Return type:

bool

class angr.go.optimization_passes.stack_inits.GoSmallMapFolder

Bases: OptimizationPass, CFGTransformationMixin

make(map[K]V) of a non-escaping map, inlined onto the stack (see the module docstring). Runs before the map accesses are rewritten, while their type descriptors still name the map type.

ARCHES = None
PLATFORMS = None
STAGE: OptimizationPassStage = 7
NAME = 'Fold Go stack-allocated map initializations'
__init__(func, manager, **kwargs)
callee_name(call)
Return type:

str | None

Parameters:

call (Call)