From 25213a836b1423cbc1aeef1f23aebc2167154e56 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Wed, 25 Feb 2026 19:45:00 -0800 Subject: Represent operand lists and label maps more efficiently within IL instructions Rather than using chains of `UNDEF` instructions, the contents of these lists are in a vector alongside the instructions. The instruction itself stores the entry count and offset into this second vector at which the associated items can be found. This improves analysis performance by around 2% and decreases memory usage by around 5%. --- mediumlevelilinstruction.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'mediumlevelilinstruction.h') diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h index 2b495010..bbc8f432 100644 --- a/mediumlevelilinstruction.h +++ b/mediumlevelilinstruction.h @@ -247,8 +247,8 @@ namespace BinaryNinja #else Ref function; #endif - BNMediumLevelILInstruction instr; - size_t operand, count; + const uint64_t* cur; + size_t count; bool operator==(const ListIterator& a) const; bool operator!=(const ListIterator& a) const; @@ -263,7 +263,7 @@ namespace BinaryNinja public: typedef ListIterator const_iterator; - MediumLevelILIntegerList(MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count); + MediumLevelILIntegerList(MediumLevelILFunction* func, size_t offset, size_t count); const_iterator begin() const; const_iterator end() const; @@ -303,7 +303,7 @@ namespace BinaryNinja public: typedef ListIterator const_iterator; - MediumLevelILIndexList(MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count); + MediumLevelILIndexList(MediumLevelILFunction* func, size_t offset, size_t count); const_iterator begin() const; const_iterator end() const; @@ -344,7 +344,7 @@ namespace BinaryNinja public: typedef ListIterator const_iterator; - MediumLevelILIndexMap(MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count); + MediumLevelILIndexMap(MediumLevelILFunction* func, size_t offset, size_t count); const_iterator begin() const; const_iterator end() const; @@ -384,7 +384,7 @@ namespace BinaryNinja public: typedef ListIterator const_iterator; - MediumLevelILVariableList(MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count); + MediumLevelILVariableList(MediumLevelILFunction* func, size_t offset, size_t count); const_iterator begin() const; const_iterator end() const; @@ -426,7 +426,7 @@ namespace BinaryNinja typedef ListIterator const_iterator; MediumLevelILSSAVariableList( - MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count); + MediumLevelILFunction* func, size_t offset, size_t count); const_iterator begin() const; const_iterator end() const; @@ -468,7 +468,7 @@ namespace BinaryNinja public: typedef ListIterator const_iterator; - MediumLevelILInstructionList(MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t count, + MediumLevelILInstructionList(MediumLevelILFunction* func, size_t offset, size_t count, size_t instructionIndex); const_iterator begin() const; -- cgit v1.3.1