Ignore OP_UNDEF when JITing similar to interpreter and original quake3 - #410
Closed
krsh732 wants to merge 1 commit into
Closed
Ignore OP_UNDEF when JITing similar to interpreter and original quake3#410krsh732 wants to merge 1 commit into
krsh732 wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original quake3.exe treats
OP_UNDEFas a NOP in interpreted (implicitly causeDEBUG_VMwasn't defined for the builds and so it falls through to the next iteration)[1]. Similarly, it's also a NOP in JIT as it has an explicitcase 0: break;[2].Why does any of this matter? After all,
OP_IGNOREis a thing and q3e correctly handles it for interpreted and JIT...?Well... other engines such as original quake 3/ioq3 don't for JIT and they fallthrough to Com_Error because they don't have a case for
OP_IGNORE[3]. Normally, none of this should matter as lcc/q3asm aren't going to be using either of these instructions, however we are patching some QVMs and it'd be nice to have a context-free single instruction NOP that works on all engines and modes (ie. JIT and interpreted).For that reason, I've put up this PR to align quake3e with other engines, but feel free to close this if you don't want to.
Note: AFAICS none of the other uses of
OP_UNDEFas a default/sentinel for optimization reasons should matter, so they were just left as-is.[1] https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb10315479fc00086f08e25d968b4b43c49/code/qcommon/vm_interpreted.c#L411-L414
[2] https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb10315479fc00086f08e25d968b4b43c49/code/qcommon/vm_x86.c#L442-L443
[3] https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb10315479fc00086f08e25d968b4b43c49/code/qcommon/vm_x86.c#L1047-L1048