Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Inline encoder cache #76

Open
pgoodman opened this issue Dec 5, 2014 · 0 comments
Open

Inline encoder cache #76

pgoodman opened this issue Dec 5, 2014 · 0 comments

Comments

@pgoodman
Copy link
Member

pgoodman commented Dec 5, 2014

Most instructions have the same stage- and commit-encoding, meaning that they don't depend on anything specific to their encoded location (such as having a RIP-relative operand). For such instructions, I think we could benefit from having a simple "cache" for these instruction encodings, so that we don't waste time re-encoding them. There are some options available to us.

One option is to re-use operand memory for this purpose, as there are almost certainly unused operands. This enables re-use of existing space.

Another option is to use Instruction::transient_meta. This would limit cached encodings to 8 bytes, but this is not too onerous.

Another option is to add in a whole new char[arch::Instruction::MAX_INSTRUCTION_LENGTH] array into the instruction. arch::Instructions are massive anyway so, in the grand scheme of things it's not making things much worse--especially if sizeof(NativeInstruction) is not a multiple of the cache line size, so there's that.

Anyway, this is a nice, simple-to-do thing that would require a bit of poking about in the instruction encoding to flag "uncachable" instructions as stage-encode time, then re-use cached encodings at commit-encode time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant