v5: Speedup x86 decoding with the help of LUT tables#2907
Merged
Conversation
lu: Disassembled 37602620 instructions (35221820 valid, 2380800 bad), 6015.21 ms v5: Disassembled 37602620 instructions (35221820 valid, 2380800 bad), 7291.75 ms
Rot127
requested changes
May 1, 2026
Collaborator
Rot127
left a comment
There was a problem hiding this comment.
Good idea. I am not the biggest fan of allocating it instead of a static table, but we can change this once we find the time to update x86.
|
|
||
| // Build insn_reg lookup table (low 16 bits = Intel, high 16 bits = ATT). | ||
| h->x86_insn_reg_lut = (uint32_t *)cs_mem_calloc(id_max + 1, sizeof(uint32_t)); | ||
| if (h->x86_insn_reg_lut) { |
Collaborator
There was a problem hiding this comment.
Invert and return early please. Also CS_ASSERT_RET
Rot127
approved these changes
May 1, 2026
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.
lu: Disassembled 37602620 instructions (35221820 valid, 2380800 bad), 6015.21 ms
v5: Disassembled 37602620 instructions (35221820 valid, 2380800 bad), 7291.75 ms
That's around 20% faster
Your checklist for this pull request
Detailed description
arm64 disassembler uses lut tables to speedup decoding, x86 was the slow one here, so i just make it happen there
...
Test plan
...
Closing issues
...