forked from id-Software/Quake-III-Arena
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow unaligned load/store in QVM interpreter/x86 compiler
constructions like (dataMask & ~3) was used to protect against out-of-bound load/store when address is 4-byte closer to dataMask but at the same time it effectively cut low address bits for ALL load/store operations which is totally wrong in terms of conformance to ALLOWED (i.e. generated by q3lcc from C sources) low-level operations like packed binary data parsing
- Loading branch information
Showing
4 changed files
with
17 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
566fb0e
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.
Could you explain when a valid, conforming to the standard C (without undefined behaviour) code causes unaligned ASGN instruction to be evaluated? Sounds unlikely to me considering this would cause unaligned memory access and valid C doesn't allow this. Perhaps compiler can do this if it knows target architecture always supports unaligned memory access? This would make LCC not suitable for PPC though.
What do you mean by packed binary data parsing? Packed structs, bitfields?
566fb0e
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've seen an example you gave in pull request. It depends on an undefined behaviour and is a very not portable code. Why should we change this behaviour when the original one was there since first q3 code release?
Few excerpts from ANSI C standard draft, C99 is much more strict and verbose on these things:
566fb0e
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 don't think we've met yet, what project are you referring to when you use "we"?
566fb0e
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.
It's a form of speech, maybe incorrect here. English is not my mother tonque. I'm not affiliated with ioq3, although I co-maintain a GPL2 project that ports ioq3 vm improvements and fixes among other things: https://github.com/mvdevs/jk2mv