diff --git a/src/parser/cfg_block.py b/src/parser/cfg_block.py index 4a13803..4b42a95 100644 --- a/src/parser/cfg_block.py +++ b/src/parser/cfg_block.py @@ -123,6 +123,7 @@ def remove_instruction(self, instr_idx: int) -> None: Removes the instruction at position instr_index, updating the last split instruction if it affects the last instruction """ + instr_idx = (len(self._instructions) + instr_idx) % len(self._instructions) if instr_idx >= len(self._instructions): raise ValueError("Attempting to remove an instruction index out of bounds") @@ -234,7 +235,7 @@ def process_function_calls(self, function_ids): # Finally, we identify the possible split instruction using the now generated information if len(self._instructions) > 0 and \ - self._instructions[-1].get_op_name() in itertools.chain(split_block, self.function_calls, "JUMP", "JUMPI"): + self._instructions[-1].get_op_name() in itertools.chain(split_block, self.function_calls, ["JUMP","JUMPI"]): self._split_instruction = self._instructions[-1] @property @@ -412,7 +413,7 @@ def _build_spec_for_sequence(self, instructions, map_instructions: Dict, out_idx Builds the specification for a sequence of instructions. "map_instructions" is passed as an argument to reuse declarations from other blocks, as we might have split the corresponding basic block """ - + spec = {} uninter_functions = [] @@ -644,7 +645,7 @@ def _include_jump_tag(self, block_spec: Dict, out_idx: int, block_tags_dict: Dic def build_spec(self, block_tags_dict: Dict, block_tag_idx: int, initial_stack: List[str], final_stack: List[str]) -> Tuple[Dict[str, Any], int, int]: - + map_instructions = {} out_idx = 0