You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a complete solution, alternative to gnolang#1919, and (I think) closesgnolang#1326.
It creates a new container for "baseless" (floating) values constructed
via `new(xxx)` or `&struct{}`, which currently do not have a base
containing object for that value, and are currently represented as
PointerValues with .Base set to nil.
The containing object is like a Block but minimal -- it only contains
one Value, and has no Source or Parent. The modifications to realm.go
allow for proper ref-counting so that even when there are multiple
references to the baseless value, and even when the value is primitive,
gc and ref-counting works (since the containing HeapItemValue is
ref-counted). PointerValue.Base should now never be nil.
See also
gnolang#1919 (comment) for why
the previous solution doesn't work.
A better optimization than the one mentioned in the comment above, is to
always store the HeapItemValue along with the Value, since the Value's
refcount should always be 1. This is left for the future, after first
checking that this invariant is true.
---------
Co-authored-by: deelawn <[email protected]>
https://gist.github.com/thehowl/e36b0f0d652a2a348a2fcd331a310417
(added as a txtar test
gnoland/cmd/gnoland/testdata
)Changing
*el = n
toel = &n
fixed the issue. Found while trying to reproduce #1167The text was updated successfully, but these errors were encountered: