-
-
Couldn't load subscription status.
- Fork 926
core: Use same RNG algorithm as avmplus #21938
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?
Conversation
Could you please elaborate on that? I feel like #21907 could be related... |
|
#20244 (comment) |
|
The test requires integer multiplication, and Flash's AVM2 optimizer does this integer multiplication even with the regular |
|
Also, I think the |
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.
Can you add the SWF in the issue as a test?
|
@Randomno can I use modified SWF file as test? |
|
Koong (the author of it) says yes |
4cb20bf to
a14655d
Compare
c9d1786 to
d1f1c98
Compare
tests/tests/swfs/avm2/rng/output.txt
Outdated
| @@ -0,0 +1,3 @@ | |||
| 743483584 | |||
| 5402 | |||
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.
Are these results consistent for you in Flash Player? For me, the first two numbers outputted are random with each run.
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.
Not consistent
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.
In that case can you modify the SWF to only output the last number? For this test I think we'd want the output to be reproducible in Flash Player.
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.
How about this? Removed most of the extra stuff, just traces true if the two numbers match.
However, it sometimes fails in Flash (as did the original version of the test). I think there's either an error in the algorithm, or Flash is executing stuff weirdly. Maybe should test with a pause between each step.
I tend to get 80% success rate in Flash Player 32.
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 fixed the consistency issue, it sometimes did not work because a double was not converted to a uint and when the polynomial used in the rng got too large values didn't match up.
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.
Hm yeah, in 1000 attempts I got 7 failures. Target, probe, doublecheck:
7043, 1970344600, 266490418
653, 310941477, 1794949550
6349, 753898449, 1488657303
8564, 749768811, 1196820749
2950, 240060092, 1191158361
1542, 1440380734, 774071793
7838, 1007439541, 429495897
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.
maybe triplecheck is needed?
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.
As far as I can tell the reversing itself is flawless now, when it breaks it seems to be during the rng calling part. No clue why, I can look into it tomorrow.
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.
Main.zip
I think this should always work? I tested 1000 times and did not fail
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.
@Lord-McSweeney I think it should be consistent now?
I didn't really understand how rng function is called inside avmplus, but this does fix RandomnessTest.swf from #20244, with some multiply opcodes replaced with multiply_i
RandomnessTest.zip