-
Notifications
You must be signed in to change notification settings - Fork 24
Dev shadow #39
base: execution
Are you sure you want to change the base?
Dev shadow #39
Conversation
两种设计思路的对比上次会议讨论了两条思路:1)模拟运行;2)代码回放。 ”模拟运行“简要思路
”随行记录“简要思路
二者的主要差异
|
运行结果示例
上述两个PyCodeObject是因为那个单测继承自DoubleTestCase,该测试方法会对给定函数执行两次。我们从中可以看到第一次执行过程中使用了第二份PyCodeObject,而第二次执行过程中使用了第三份PyCodeObject。 |
instruction = self.instructions[instruction_index] | ||
opname = instruction.opname | ||
method_name = f"pre_{opname}" | ||
if not hasattr(SymbolicExecutor, method_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre_action 和 post_action 是互斥的么?我看这里判断条件是互斥的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前我的理解是最好是互斥的。当然这个可以讨论。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对于CALL_FUNCTION一族的指令而言,pre_action和post_action应该是都需要的。
def pre_action(self, instruction_index): | ||
instruction = self.frame.instructions[instruction_index] | ||
method_name = f"pre_{instruction.opname}" | ||
assert hasattr(self, method_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里实现了pre_RETURN_VALUE,是否所有的opcode类型都需要实现 pre_XXX 函数逻辑?还是按需的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有的控制类包括跳转指令、RETURN_VALUE、YIELD_VALUE等都需要实现pre_XXX。其他实现post action就行。
Tian Chao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
本pr验证了方案三(即”随行记录“方案)的可行性