Skip to content

Commit

Permalink
comment new instructions for dependences
Browse files Browse the repository at this point in the history
  • Loading branch information
tutugordillo committed Sep 11, 2024
1 parent 1a5e3c7 commit 17cf34e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/parser/cfg_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def _compute_storage_dependences(self,instructions):
v = ins.get_in_args()[0]
input_val = get_expression(v, instructions[:i])
sto_ins.append([i,input_val,ins.get_type_mem_op()])
elif ins.get_op_name() in ["call","delegatecall","staticcall","callcode"]:
sto_ins.append([i,["inf"],"write"])
#elif ins.get_op_name() in ["call","delegatecall","staticcall","callcode"]:
# sto_ins.append([i,["inf"],"write"])

deps = [[sto_ins[i][0],j[0]] for i in range(len(sto_ins)) for j in sto_ins[i+1:] if are_dependent_accesses(sto_ins[i][1],j[1]) and generate_dep(sto_ins[i][2], j[2])]
# print("DEPS: "+str(deps))
Expand All @@ -189,7 +189,7 @@ def _compute_memory_dependences(self, instructions):
mem_ins = []

mem_instrs_access = ["mload", "mstore", "mstore8"]
mem_instrs_offset = ["keccak256", "codecopy","extcodecopy","calldatacopy","returndatacopy","mcopy","log0","log1","log2","log3","log4","create","create2","call","delegatecall","staticcall","callcode"]
mem_instrs_offset = ["keccak256"]#, "codecopy","extcodecopy","calldatacopy","returndatacopy","mcopy","log0","log1","log2","log3","log4","create","create2","call","delegatecall","staticcall","callcode"]

for i in range(len(instructions)):
ins = instructions[i]
Expand All @@ -209,15 +209,15 @@ def _compute_memory_dependences(self, instructions):
interval = [input_vals[0],input_vals[1]]
mem_ins.append([i,interval,ins.get_type_mem_op()])

else:
# else:

input_vals = list(map(lambda x: get_expression(x, instructions[:i]), interval_args[0]))
interval = [input_vals[0],input_vals[1]]
mem_ins.append([i,interval,"read"])
# input_vals = list(map(lambda x: get_expression(x, instructions[:i]), interval_args[0]))
# interval = [input_vals[0],input_vals[1]]
# mem_ins.append([i,interval,"read"])

input_vals = list(map(lambda x: get_expression(x, instructions[:i]), interval_args[1]))
interval = [input_vals[0],input_vals[1]]
mem_ins.append([i,interval, "write"])
# input_vals = list(map(lambda x: get_expression(x, instructions[:i]), interval_args[1]))
# interval = [input_vals[0],input_vals[1]]
# mem_ins.append([i,interval, "write"])

deps = [[mem_ins[i][0],j[0]] for i in range(len(mem_ins)) for j in mem_ins[i+1:] if are_dependent_interval(mem_ins[i][1],j[1]) and generate_dep(mem_ins[i][2], j[2])]
# print("DEPS: "+str(deps))
Expand Down
6 changes: 3 additions & 3 deletions src/parser/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# split_block = {"LOG0","LOG1","LOG2","LOG3","LOG4","CALLDATACOPY","CODECOPY","EXTCODECOPY","RETURNDATACOPY",
# "CALL","STATICCALL","DELEGATECALL","CREATE","CREATE2","ASSIGNIMMUTABLE", "GAS", "MEMORYGUARD", "DATACOPY"}
split_block = {"LOG0","LOG1","LOG2","LOG3","LOG4","CALLDATACOPY","CODECOPY","EXTCODECOPY","RETURNDATACOPY",
"CALL","STATICCALL","DELEGATECALL","CREATE","CREATE2","ASSIGNIMMUTABLE", "GAS", "MEMORYGUARD", "DATACOPY"}

split_block = {"ASSIGNIMMUTABLE", "GAS", "MEMORYGUARD", "DATACOPY"}
# split_block = {"ASSIGNIMMUTABLE", "GAS", "MEMORYGUARD", "DATACOPY"}

0 comments on commit 17cf34e

Please sign in to comment.