Eroxl's Notes
Dynamic Control Flow

Dynamic control flow refers to control flow where the target of a jump or call is determined at runtime rather than at compile time. This contrasts with static control flow, where the compiler knows the exact destination address at compile time.

Types of Dynamic Control Flow

Function Pointers

Function pointers allow procedures to be called indirectly by storing procedure addresses in variables and jumping to those addresses at runtime.

Polymorphic Dispatch

In object-oriented languages like Java, method calls on objects use polymorphic dispatch to determine which implementation to call based on the object's actual type at runtime.

Jump Tables

Jump tables enable efficient implementation of multi-way branches, such as switch statements, by storing destination addresses in an array indexed by the condition value.

Implementation

Dynamic control flow requires: