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
All globals in Foolang are intended to be deeply immutable, in order to allow safe sharing across threads.
So far this has not been enforced, however, and turns out I'd violated this constraint in the compiler a couple of times.
So time to fix that in compiled code at the very least.
(I'm still debating how to do it generally: Any#makeImmutable seems a bit intrusive...)
PR #696 does this by giving all non-immediate objects a common header, which includes an allocation flag, which the primitive methods and slot accessors can check and trap on.
An objectively nicer option would be write-protecting static memory, but this is the easier approach right now. (I'm not actually sure if I can write-protect parts of the static heap, and creating separate mappings on all three platforms seems like too much work right now - in particular because I'm kind of thinking I want to support non-protected implementations as well, in order to be able to put Foolang on an Arduino...)
I'll be very interested to see how many more existing violations this shakes out from code...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
All globals in Foolang are intended to be deeply immutable, in order to allow safe sharing across threads.
So far this has not been enforced, however, and turns out I'd violated this constraint in the compiler a couple of times.
So time to fix that in compiled code at the very least.
(I'm still debating how to do it generally:
Any#makeImmutable
seems a bit intrusive...)PR #696 does this by giving all non-immediate objects a common header, which includes an allocation flag, which the primitive methods and slot accessors can check and trap on.
An objectively nicer option would be write-protecting static memory, but this is the easier approach right now. (I'm not actually sure if I can write-protect parts of the static heap, and creating separate mappings on all three platforms seems like too much work right now - in particular because I'm kind of thinking I want to support non-protected implementations as well, in order to be able to put Foolang on an Arduino...)
I'll be very interested to see how many more existing violations this shakes out from code...
Beta Was this translation helpful? Give feedback.
All reactions