-
Notifications
You must be signed in to change notification settings - Fork 110
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
Mixed-arithmetic handling only works for float+int, not int+float #669
Comments
I don't remember, there are many possible path, what if not Jitted ? |
Note that the primitiveLessThan should fail: it only handle SmallInteger argument (and receiver). |
It appears that the JIT does thing differently than the (stack) interpreter. The interpreter will try things in this order when interpreting the send of a special selector for arithmetic or comparison - for example in
In this scheme, if we add handling of conversions in SmallInteger primitives, we will just duplicate the work done in the 2nd stage of bytecodePrimAdd for no added value, but just a few more wasted cycles. The JIT will only try to handle the case of both SmallIntegers
Then it will fallback to a message send which goes through the primitives. The other way around, I let Eliot explain while the second stage was skipped, but it might be that it consumes two many instructions: remember that the purpose is to inline the specialSelectors send, so we might end up with lot of instructions... If it doesn't pay statistically (except in micro benchmarks), then it's not worth it, because it will exhaust the space devoted to jitted code more rapidly (and remember, specialSelectors are sent from many places !). We saw that adding conversions in integer primitives is not ideal, at least for the interpreted code. |
I played around with VM parameter 75. It does indeed show a change for the float-based primitives (i.e., 541, 542, ...) but not the integer-based primitives (i.e., 1, 2, 3, ...).
Is this expected behavior? In the VMMaker sources, it looks like it should work at least for comparisons (i.e., 3 to 8):
Is
genPrimitiveLessThan
not the one in charge here? Hm....So, debugging
3+4.0
shows that the primitive will fail, which it should not when mixed-arithmetic would work as expected.The text was updated successfully, but these errors were encountered: