Skip to content

Commit

Permalink
Fix bug that caused missing facts in var_blockvalue for the inliner
Browse files Browse the repository at this point in the history
  • Loading branch information
sifislag committed Nov 27, 2023
1 parent ddff205 commit 1d2775b
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions clientlib/tac-transformers/abstract_function_inliner.dl
Original file line number Diff line number Diff line change
Expand Up @@ -422,21 +422,29 @@
In_Statement_Uses(retJump, jumpTargetVar, 0),
InStatement_OutStatement(retJump, callerBlock, outRetJump),
InVar_OutVar(jumpTargetVar, callerBlock, outJumpTargetVar).
Out_Variable_BlockValue(outVar, outVal):-
In_Variable_BlockValue(inVar, inVal),

.decl In_VariableHoldsJumpdest(inVar: Variable)
In_VariableHoldsJumpdest(inVar):-
In_Statement_Uses(inJump, inVar, 0),
In_Statement_Opcode(inJump, opcode),
(opcode = "JUMP" ; opcode = "JUMPI"),
(opcode = "JUMP" ; opcode = "JUMPI").

// The last arg to a private call is the return address
In_VariableHoldsJumpdest(inVar):-
In_Statement_Uses(inCall, inVar, n),
In_Statement_Opcode(inCall, "CALLPRIVATE"),
!In_Statement_Uses(inCall, _, n + 1).

Out_Variable_BlockValue(outVar, outVal):-
In_Variable_BlockValue(inVar, inVal),
In_VariableHoldsJumpdest(inVar),
InVar_OutVar(inVar, callerBlock, outVar),
callerBlock != "",
outVal = cat(cat(inVal, "B"), callerBlock).

Out_Variable_BlockValue(outVar, inVal):-
In_Variable_BlockValue(inVar, inVal),
In_Statement_Uses(inJump, inVar, 0),
In_Statement_Opcode(inJump, opcode),
(opcode = "JUMP" ; opcode = "JUMPI"),
In_VariableHoldsJumpdest(inVar),
InVar_OutVar(inVar, "", outVar).


Expand Down

0 comments on commit 1d2775b

Please sign in to comment.