-
Notifications
You must be signed in to change notification settings - Fork 89
Fix initialization of unboxed numbers in static blocks #2528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note - writing an unboxed int32 into the closure environment currently needs to write 64 bits, because I will instead make |
I will discuss this with @TheNumbat |
Well, this was written at a time where everything was a word, so this was reasonable and safe at that time. Clearly, with the advent of non-scannable slots in closures, as well as mixed blocks, we might want to change that, and indeed do sign-extending loads. |
Sounds good; the change to |
Added some more edits / explanations after discussing with @mshinwell |
Please don't rebase this yet, as I'm still reviewing/editing. |
@TheNumbat I've finished. I suggest looking at my new changes commit by commit, but read them all before commenting... |
We've discussed and the appropriate changes have been made
New changes look good, merging |
Flambda2 was incorrectly initializing unboxed static closure slots and static constants.
Closure slots were all assumed to be
Word_val
, which was interpreted as a pointer and hence passed to setfield. It would then callcaml_initialize
with a gc-unfriendly value, like an unboxed float. This also wouldn't fully copy a vec128.Static constant boxed int64s and int64 arrays were incorrectly calling setfield with the unboxed int64 value due to using
Word_int
.WhenConfig.runtime5
was set,make_update
unconditionally used setfield.Naked vec128s would be written off the end of the closure block (this won't actually occur until unboxed vectors are exposed).
I found this in #2519, which re-enabled the assertion that we do not move between float & int registers. That was triggered when attempting to pass an unboxed float to
caml_initialize
.