Refactored gc_safes to make them more convenient to use.

[#57143634]
Fix build error.
Self-review