[core] gc engine: code rewriting