Commit 6549d43
authored
[clr-interp] Fix additional iteration in Copy_Ref implementation on arm64 (#120879)
After a loop iteration is done, the code is subtracting 16, obtaining
the current remaining counter. If the remaining counter is bigger than 0
then we do another iteration. This is wrong, because we can only do
another 16 byte copy iteration if the remaining counter is bigger or
equal to 16. In order to be correct, the code would have to branch to
the very beginning of the macro. In case of negative result, we would
fallback to 8 byte copy, but, if the result is negative, it means we
already overcopied, so this implementation is wrong.
The fix makes it such that when we subtract 16 after an iteration, we
don't obtain the current remaining counter, rather the potential
remaining counter, in case we did another copy iteration. If this
counter is positive, then it is safe to do another iteration, if it is
negative then we can't copy 16 bytes at a time, fallback to the next
case.
The PR also removes redundant looping for 8 bytes copy scenario, which
can be hit at most once.1 parent 9bb1d21 commit 6549d43
2 files changed
+6
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
949 | 949 | | |
950 | 950 | | |
951 | 951 | | |
952 | | - | |
| 952 | + | |
953 | 953 | | |
954 | 954 | | |
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
958 | | - | |
959 | | - | |
960 | | - | |
| 958 | + | |
961 | 959 | | |
| 960 | + | |
962 | 961 | | |
963 | 962 | | |
964 | | - | |
965 | 963 | | |
966 | 964 | | |
967 | 965 | | |
968 | | - | |
969 | 966 | | |
970 | | - | |
971 | 967 | | |
972 | 968 | | |
973 | 969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1300 | 1300 | | |
1301 | 1301 | | |
1302 | 1302 | | |
1303 | | - | |
| 1303 | + | |
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
1307 | 1307 | | |
1308 | 1308 | | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
| 1309 | + | |
1312 | 1310 | | |
| 1311 | + | |
1313 | 1312 | | |
1314 | 1313 | | |
1315 | | - | |
1316 | 1314 | | |
1317 | 1315 | | |
1318 | 1316 | | |
1319 | | - | |
1320 | 1317 | | |
1321 | | - | |
1322 | 1318 | | |
1323 | 1319 | | |
1324 | 1320 | | |
| |||
0 commit comments