Reduce binary size using const arrays
Before, the mnemonic arrays would be generated on the stack at runtime in each parse function. This ensures that the arrays themselves are treated as const data.
This commit is contained in:
parent
c8026715f0
commit
0de65eb1b6
File diff suppressed because it is too large
Load Diff
|
@ -465,6 +465,10 @@ fn gen_mnemonic(
|
|||
bitset.extend(quote! { | (ins.#modifier() as usize) << #i });
|
||||
}
|
||||
}
|
||||
Ok(quote! { ParsedIns { mnemonic: [#(#names),*][#bitset], args: #arguments } })
|
||||
let names_len = Literal::usize_unsuffixed(names.len());
|
||||
Ok(quote! { {
|
||||
const MODIFIERS: [&str; #names_len] = [#(#names),*];
|
||||
ParsedIns { mnemonic: MODIFIERS[#bitset], args: #arguments }
|
||||
} })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue