-
Notifications
You must be signed in to change notification settings - Fork 6.2k
KT-57335 Add test for inline class over Vector128 #5634
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
base: master
Are you sure you want to change the base?
KT-57335 Add test for inline class over Vector128 #5634
Conversation
Add a regression test to verify that inline classes wrapping Vector128 work correctly and values are passed via registers. ^KT-57335 Fixed
|
@kunyavskiy I'm not sure if entering Experimental into the compilation arguments and annotation in the box() method is correct (I looked at the code of the tests nearby), I would like to hear your opinion on how best to implement this little test |
| } | ||
|
|
||
| return "OK" | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of adding such a test is to prevent the original crash from happening again. That means that the code should crash when compiled and run with Kotlin 1.8.10. Does this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the test to use a single-file structure, strictly matching the original reproduction case. The test should now reliably fail if the regression recurs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check the code from the test with Kotlin 1.8.10? Does it crash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I verified it manually on Windows x64 using the 1.8.10 standalone compiler
The application crashes silently at runtime. It produces no output and terminates immediately with exit code -1073741819 (which corresponds to 0xC0000005 - Access Violation)
This confirms the test accurately reproduces the regression as a hard crash on the target platform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just checked it, and it doesn't crash for me. Which source code did you compile, with which flags?
At the very least, it means that the test doesn't reliably reproduce the crash.
The problem is most likely specific to the stack pointer alignment when entering the box function. So, depending on the caller frames, the same code may crash or not crash.
All this affects the usefulness of the test. It should reliably reproduce the issue, regardless of the caller frames and other context. I can imagine you can achieve that by calling the problematic code multiple times, having different stack frame sizes in the caller.
Please experiment with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the insight regarding the stack pointer alignment! I have updated the test to ensure reliability:
Introduced a recursive function confuseStackAndRun(depth: Int) to shift the stack pointer
The test now iterates through recursion depths from 0 to 10
This approach forces the runtime to execute the problematic code with various stack alignments, ensuring the crash is triggered regardless of the initial caller frame
| } | ||
|
|
||
| return "OK" | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just checked it, and it doesn't crash for me. Which source code did you compile, with which flags?
At the very least, it means that the test doesn't reliably reproduce the crash.
The problem is most likely specific to the stack pointer alignment when entering the box function. So, depending on the caller frames, the same code may crash or not crash.
All this affects the usefulness of the test. It should reliably reproduce the issue, regardless of the caller frames and other context. I can imagine you can achieve that by calling the problematic code multiple times, having different stack frame sizes in the caller.
Please experiment with that.
b82ecf7 to
5e58d89
Compare
Added a test to verify that the built-in classes wrapping Vector128 are functioning correctly and that values are being passed through registers
KT-57335