Optimize primitive activation [WIP]

Am not yet happy with that, think it should move into the AST.

Signed-off-by: Stefan Marr <git@stefan-marr.de>