This should fix the bug where occasionally the close_ bytecode would find a Function in the constant pool instead of a DispatchTable.
Some cells in the constant pool are created by makeSpace with the intention that we can later patch these (used for invalidating targets after deopts).
However, the patching would also write to the C++ contents cache that maps SEXPs to pool indices, and patching multiple times would leave the old mapping outdated.
For example:
makeSpace 42
patch X into 42
patch Y into 42
X gets garbage collected
Z gets allocated to where X used to be
insert of Z finds X in contents and returns 42
Now:
constant pool at 42 returns Y
Z may get collected since it's not reachable from the constant pool
Also, this makes sure that we cannot patch a location that doesn't come from calling makeSpace.
This should fix the bug where occasionally the close_ bytecode would find a Function in the constant pool instead of a DispatchTable.
Some cells in the constant pool are created by makeSpace with the intention that we can later patch these (used for invalidating targets after deopts). However, the patching would also write to the C++ contents cache that maps SEXPs to pool indices, and patching multiple times would leave the old mapping outdated.
For example:
Also, this makes sure that we cannot patch a location that doesn't come from calling makeSpace.