kaseyc edited PR #2622 from operand
to main
:
This is in preparation for refactoring all x64::Inst arms to use OperandSize.
Current uses of OperandSize fall into two categories:
1. XMM operations which require 32/64 bit operands
2. Immediates which only care about 64-bit or not.Adds assertions to existing Inst constructors to check that they are passed valid sizes.
This change also removes the implicit widening of 1 and 2 byte values to 4 bytes. from_bytes() is only used by category 2, so removing this behavior will not change any visible behavior.Overall this change should be a no-op.
kaseyc edited PR #2622 from operand
to main
:
This is in preparation for refactoring all x64::Inst arms to use OperandSize.
Current uses of OperandSize fall into two categories:
1. XMM operations which require 32/64 bit operands
2. Immediates which only care about 64-bit or not.Adds assertions to existing Inst constructors to check that they are passed valid sizes.
This change also removes the implicit widening of 1 and 2 byte values to 4 bytes. from_bytes() is only used by category 2, so removing this behavior will not change any visible behavior.Overall this change should be a no-op.
Partially addresses #2586.
kaseyc has marked PR #2622 as ready for review.
cfallin submitted PR Review.
cfallin created PR Review Comment:
This is a nice helper for asserts! I think it might be good to make the name a bit more explicit: maybe
is_one_of(sizes)
?
cfallin submitted PR Review.
cfallin created PR Review Comment:
We can do
sizes.iter().any(|val| self == *val)
here, I think.
kaseyc submitted PR Review.
kaseyc created PR Review Comment:
This branch kind of jumped out at me. Both sides do similar things with OperandSize, but the if 0 case only widens I64 types (not B64 or R64).
I left it as is to keep this a pure refactor, but it struck me as odd.
kaseyc updated PR #2622 from operand
to main
:
This is in preparation for refactoring all x64::Inst arms to use OperandSize.
Current uses of OperandSize fall into two categories:
1. XMM operations which require 32/64 bit operands
2. Immediates which only care about 64-bit or not.Adds assertions to existing Inst constructors to check that they are passed valid sizes.
This change also removes the implicit widening of 1 and 2 byte values to 4 bytes. from_bytes() is only used by category 2, so removing this behavior will not change any visible behavior.Overall this change should be a no-op.
Partially addresses #2586.
kaseyc submitted PR Review.
kaseyc created PR Review Comment:
That is a much better name, thank you.
kaseyc submitted PR Review.
kaseyc created PR Review Comment:
Done, thanks.
I mostly write C++ these days and my Rust is, ah, rusty.
kaseyc updated PR #2622 from operand
to main
:
This is in preparation for refactoring all x64::Inst arms to use OperandSize.
Current uses of OperandSize fall into two categories:
1. XMM operations which require 32/64 bit operands
2. Immediates which only care about 64-bit or not.Adds assertions to existing Inst constructors to check that they are passed valid sizes.
This change also removes the implicit widening of 1 and 2 byte values to 4 bytes. from_bytes() is only used by category 2, so removing this behavior will not change any visible behavior.Overall this change should be a no-op.
Partially addresses #2586.
cfallin submitted PR Review.
cfallin submitted PR Review.
cfallin created PR Review Comment:
Hmm, yes, good catch -- I think that for consistency this should match the widening logic in the
value != 0
case below. (It's harmless in practice as the 32-bitxor
will zero the top 32 bits anyway, but we might as well be consistent.)
kaseyc updated PR #2622 from operand
to main
:
This is in preparation for refactoring all x64::Inst arms to use OperandSize.
Current uses of OperandSize fall into two categories:
1. XMM operations which require 32/64 bit operands
2. Immediates which only care about 64-bit or not.Adds assertions to existing Inst constructors to check that they are passed valid sizes.
This change also removes the implicit widening of 1 and 2 byte values to 4 bytes. from_bytes() is only used by category 2, so removing this behavior will not change any visible behavior.Overall this change should be a no-op.
Partially addresses #2586.
kaseyc created PR Review Comment:
Updated.
kaseyc submitted PR Review.
abrown merged PR #2622.
Last updated: Dec 23 2024 at 12:05 UTC