[delegate] Improve trampoline caching

Why do we need this new ifdef here?