Fixed execution functions to avoid redundant code generation.
Replaced virtual task_base with a dispatch function.

This should make code more efficient and will reduce binary size
since vtables won't need to be emitted.