[core] gc engine: code refactoring