Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Jul 10, 2024
1 parent ab68709 commit 48a8855
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/parser/cfg_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def set_instructions(self, new_instructions: List[CFGInstruction]) -> None:
#self.source_stack = utils.compute_stack_size(map(lambda x: x.disasm, self.instructions_to_optimize_bytecode()))

def add_instruction(self, new_instr: CFGInstruction) -> None:
self._instructions.add(new_instr)
self._instructions.append(new_instr)
# TODO
#self.source_stack = utils.compute_stack_size(map(lambda x: x.disasm, self.instructions_to_optimize_bytecode()))

Expand Down Expand Up @@ -103,31 +103,28 @@ def get_as_json(self):
block_json["exit"] = self.block_id+"Exit"
block_json["type"] = "BasicBlock"

jump_block = {}

if self._jump_type == "conditional":
jump_block = {}
jump_block["id"] = self.block_id+"Exit"
jump_block["instructions"] = []
jump_block["type"] = "ConditionalJump"
jump_block["exit"] = [self._falls_to, self._jump_to]
jump_block["cond"] = self._instructions[-1].get_out_args()

elif self._jump_type == "unconditional":
jump_block = {}
jump_block["id"] = self.block_id+"Exit"
jump_block["instructions"] = []
jump_block["type"] = "Jump"
jump_block["exit"] = [self._jump_to]

elif self._jump_type == "mainExit":
jump_block = {}
jump_block["id"] = self.block_id+"Exit"
jump_block["instructions"] = []
jump_block["type"] = "MainExit"
jump_block["exit"] = [self._jump_to]

return block_json, jump_block



def _get_vars_spec(self, uninter_instructions):
vars_spec = set()
Expand Down

0 comments on commit 48a8855

Please sign in to comment.