[sgen] Don't loop endlessly when out of memory.
[sgen] Fix crash in late pinning.

Our code assumed that late-pinned objects don't have a tag, but they
obviously have the pin tag, so use the safe function.
[sgen] Don't store pin queue addresses, only indexes.  Fixes #24084.

The pin queue can get relocated as a side-effect of resizing when late
pinning happens, so we can't count on pointers into it to remain valid.
Merge pull request #1381 from schani/fix-23401

Fix 23401