core: improve script_trace() performance with a wrapper macro