Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep a ref to vex map0 even if mvex feature is disabled #528

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/rust/iced-x86/src/decoder/handlers/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pub(in crate::decoder) struct Tables {
invalid_map: (),

pub(in crate::decoder) handlers_map0: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(all(not(feature = "no_vex"), feature = "mvex"))]
#[cfg(not(feature = "no_vex"))]
#[allow(dead_code)]
pub(in crate::decoder) handlers_vex_map0: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(not(feature = "no_vex"))]
pub(in crate::decoder) handlers_vex_0f: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Expand Down Expand Up @@ -44,7 +45,7 @@ pub(in crate::decoder) struct Tables {
pub(in crate::decoder) handlers_mvex_0f38: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(feature = "mvex")]
pub(in crate::decoder) handlers_mvex_0f3a: Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
#[cfg(not(all(not(feature = "no_vex"), feature = "mvex")))]
#[cfg(feature = "no_vex")]
#[allow(dead_code)]
handlers_vex_map0: (),
#[cfg(feature = "no_vex")]
Expand Down
14 changes: 2 additions & 12 deletions src/rust/iced-x86/src/decoder/table_de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,11 @@ pub(super) fn read_evex() -> (
)
}

#[cfg(all(not(feature = "no_vex"), feature = "mvex"))]
type VexMap0Type = Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>;
#[cfg(all(not(feature = "no_vex"), not(feature = "mvex")))]
type VexMap0Type = ();

#[cfg(not(feature = "no_vex"))]
#[must_use]
#[allow(clippy::let_unit_value)]
pub(super) fn read_vex() -> (
VexMap0Type,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Vec<(OpCodeHandlerDecodeFn, &'static OpCodeHandler)>,
Expand All @@ -327,13 +322,8 @@ pub(super) fn read_vex() -> (
let mut deserializer = TableDeserializer::new(data_vex::TBL_DATA, data_vex::MAX_ID_NAMES, handler_reader);
deserializer.deserialize();

#[cfg(feature = "mvex")]
let map0 = deserializer.table(data_vex::HANDLERS_MAP0_INDEX);
#[cfg(not(feature = "mvex"))]
let map0 = ();

(
map0,
deserializer.table(data_vex::HANDLERS_MAP0_INDEX),
deserializer.table(data_vex::HANDLERS_0F_INDEX),
deserializer.table(data_vex::HANDLERS_0F38_INDEX),
deserializer.table(data_vex::HANDLERS_0F3A_INDEX),
Expand Down