angr.go.optimization_passes.type_switch_simplifier

class angr.go.optimization_passes.type_switch_simplifier.GoTypeSwitchSimplifier

Bases: OptimizationPass, CFGTransformationMixin

Strip the search machinery the compiler puts in front of a type switch.

Concrete cases are found through a binary search over t.Hash whose leaves compare t against the case’s type descriptor; the hash tests are redundant with those comparisons, so the tree collapses into a chain of descriptor comparisons. Interface cases (go1.22+) first probe an inline cache before calling runtime.interfaceSwitch; the probe loop is dropped and the call always runs. Assertions and conversions to interface types probe the same kind of cache ahead of runtime.typeAssert.

ARCHES = None
PLATFORMS = None
STAGE: OptimizationPassStage = 7
NAME = 'Simplify Go type switches'
__init__(func, manager, **kwargs)