Closed khatchad closed 9 months ago
Relates to #311.
For testPythonSideEffects8()
, we have:
callees of node f : [g]
IR of node 4, context CallStringContext: [ script A.py.do()LRoot;@98 ]
<Code body of function Lscript A.py/f>
CFG:
BB0[-1..-2]
-> BB1
BB1[0..1]
-> BB2
BB2[-1..-2]
Instructions:
BB0
BB1
0 v4 = lexical:g@Lscript A.py A.py [4:4] -> [4:5]
1 v2 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v4 @1 exception:v5A.py [4:4] -> [4:7]
BB2
But for testPythonSideEffects59()
, we have:
callees of node f : []
IR of node 4, context CallStringContext: [ script A.py.do()LRoot;@97 ]
<Code body of function Lscript A.py/f>
CFG:
BB0[-1..-2]
-> BB1
BB1[0..2]
-> BB2
BB2[-1..-2]
Instructions:
BB0
BB1
0 v5 = lexical:B@Lscript A.py A.py [4:4] -> [4:5]
1 v3 = fieldref v5.v6:#g A.py [4:4] -> [4:7]
2 v2 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v3 @2 exception:v7A.py [4:4] -> [4:9]
BB2
Relevant diff lines:
392,398c392,397
< 90 v17 = global:global script B.py A.py [1:0] -> [7:3] [17=[g]]
< 91 v243 = fieldref v17.v242:#g A.py [1:0] -> [7:3] [243=[g]17=[g]]
< 92 lexical:g@Lscript A.py = v243 A.py [1:0] -> [7:3] [243=[g]]
< 95 v245 = new <PythonLoader,Lscript A.py/f>@95<no information> [245=[f]]
< 96 global:global script A.py/f = v245 <no information> [245=[f]]
< 97 putfield v1.< PythonLoader, LRoot, f, <PythonLoader,LRoot> > = v245<no information> [245=[f]]
< 98 v247 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v245 @98 exception:v248A.py [7:0] -> [7:3] [245=[f]]
---
> 90 v242 = invokestatic < PythonLoader, LB, import()LB; > @90 exception:v243A.py [1:0] -> [1:8] [242=[B]]
> 91 lexical:B@Lscript A.py = v242 A.py [1:0] -> [1:0] [242=[B]]
> 94 v245 = new <PythonLoader,Lscript A.py/f>@94<no information> [245=[f]]
> 95 global:global script A.py/f = v245 <no information> [245=[f]]
> 96 putfield v1.< PythonLoader, LRoot, f, <PythonLoader,LRoot> > = v245<no information> [245=[f]]
> 97 v247 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v245 @97 exception:v248A.py [7:0] -> [7:3] [245=[f]]
511c510
< callees of node f : [g]
---
> callees of node f : []
524,542c523,525
< 0 v4 = lexical:g@Lscript A.py A.py [4:4] -> [4:5]
< 1 v2 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v4 @1 exception:v5A.py [4:4] -> [4:7]
< BB2
<
< callees of node g : []
<
< IR of node 5, context CallStringContext: [ script A.py.f.do()LRoot;@1 ]
< <Code body of function Lscript B.py/g>
< CFG:
< BB0[-1..-2]
< -> BB1
< BB1[0..1]
< -> BB2
< BB2[-1..-2]
< Instructions:
< BB0
< BB1
< 0 v4 = lexical:my_list@Lscript B.py B.py [5:4] -> [5:11]
< 1 fieldref v4.v5:#0 = v2:#1 = v2:#1 B.py [5:4] -> [5:14]
---
> 0 v5 = lexical:B@Lscript A.py A.py [4:4] -> [4:5]
> 1 v3 = fieldref v5.v6:#g A.py [4:4] -> [4:7]
> 2 v2 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v3 @2 exception:v7A.py [4:4] -> [4:9]
558,576c541,556
< [Node: <Code body of function Lscript A.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@2 ], v17] --> [SITE_IN_NODE{synthetic < PythonLoader, Lcom/ibm/wala/FakeRootClass, fakeRootMethod()V >:Lscript B.py in Everywhere}]
< [<field global script B.py>] --> [SITE_IN_NODE{synthetic < PythonLoader, Lcom/ibm/wala/FakeRootClass, fakeRootMethod()V >:Lscript B.py in Everywhere}]
< [Node: <Code body of function Lscript A.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@2 ], v242] --> [[ConstantKey:g:<PythonLoader,Lstring>]]
< [upward:g:Node: <Code body of function Lscript A.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@2 ]] --> [SMIK:SITE_IN_NODE{<Code body of function Lscript B.py>:Lscript B.py/g in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}@creator:Node: <Code body of function Lscript B.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]]
< [Node: <Code body of function Lscript A.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@2 ], v243] --> [SMIK:SITE_IN_NODE{<Code body of function Lscript B.py>:Lscript B.py/g in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}@creator:Node: <Code body of function Lscript B.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]]
---
> [upward:B:Node: <Code body of function Lscript A.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@2 ]] --> []
> [Node: <Code body of function Lscript A.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@2 ], v242] --> []
586,599c566,580
---
> [<field global script B.py>] --> [SITE_IN_NODE{synthetic < PythonLoader, Lcom/ibm/wala/FakeRootClass, fakeRootMethod()V >:Lscript B.py in Everywhere}]
603,605c584,586
< [catalog of SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}] --> [[ConstantKey:0:<PythonLoader,LRoot>], [ConstantKey:0:<PythonLoader,LRoot>]]
< [SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]},<field 0>] --> [[ConstantKey:10:<PythonLoader,LRoot>], [ConstantKey:1:<PythonLoader,LRoot>]]
< [SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}; [Core[Root]]] --> [[ConstantKey:10:<PythonLoader,LRoot>], [ConstantKey:1:<PythonLoader,LRoot>]]
---
> [catalog of SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}] --> [[ConstantKey:0:<PythonLoader,LRoot>]]
> [SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]},<field 0>] --> [[ConstantKey:10:<PythonLoader,LRoot>]]
> [SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}; [Core[Root]]] --> [[ConstantKey:10:<PythonLoader,LRoot>]]
611,619c592,596
< [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@98 ], v4] --> [SMIK:SITE_IN_NODE{<Code body of function Lscript B.py>:Lscript B.py/g in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}@creator:Node: <Code body of function Lscript B.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]]
< [Exc-Ret-V:Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@98 ]] --> [[Core[Exception]]]
< [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@98 ], v5] --> []
< [Node: <Code body of function Lscript B.py/g> Context: CallStringContext: [ script A.py.f.do()LRoot;@1 ], v1] --> [SMIK:SITE_IN_NODE{<Code body of function Lscript B.py>:Lscript B.py/g in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}@creator:Node: <Code body of function Lscript B.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]]
< [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@98 ], v2] --> []
< [Ret-V:Node: <Code body of function Lscript B.py/g> Context: CallStringContext: [ script A.py.f.do()LRoot;@1 ]] --> []
< [Node: <Code body of function Lscript B.py/g> Context: CallStringContext: [ script A.py.f.do()LRoot;@1 ], v4] --> [SITE_IN_NODE{<Code body of function Lscript B.py>:Llist in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}]
< [Node: <Code body of function Lscript B.py/g> Context: CallStringContext: [ script A.py.f.do()LRoot;@1 ], v2] --> [[ConstantKey:1:<PythonLoader,LRoot>]]
< [Node: <Code body of function Lscript B.py/g> Context: CallStringContext: [ script A.py.f.do()LRoot;@1 ], v5] --> [[ConstantKey:0:<PythonLoader,LRoot>]]
---
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v5] --> []
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v6] --> [[ConstantKey:g:<PythonLoader,Lstring>]]
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v3] --> []
> [Exc-Ret-V:Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ]] --> [[Core[Exception]]]
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v7] --> []
The interesting stuff is in the PA.
511c510
< callees of node f : [g]
---
> callees of node f : []
524,542c523,525
< 0 v4 = lexical:g@Lscript A.py A.py [4:4] -> [4:5]
< 1 v2 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v4 @1 exception:v5A.py [4:4] -> [4:7]
< BB2
---
> 0 v5 = lexical:B@Lscript A.py A.py [4:4] -> [4:5]
> 1 v3 = fieldref v5.v6:#g A.py [4:4] -> [4:7]
> 2 v2 = invokeFunction < PythonLoader, LCodeBody, do()LRoot; > v3 @2 exception:v7A.py [4:4] -> [4:9]
In 8, the function invoked is in v4
, while in 59, it is in v3
.
611,619c592,596
< [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@98 ], v4] --> [SMIK:SITE_IN_NODE{<Code body of function Lscript B.py>:Lscript B.py/g in CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]}@creator:Node: <Code body of function Lscript B.py> Context: CallStringContext: [ com.ibm.wala.FakeRootClass.fakeRootMethod()V@4 ]]
---
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v5] --> []
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v6] --> [[ConstantKey:g:<PythonLoader,Lstring>]]
> [Node: <Code body of function Lscript A.py/f> Context: CallStringContext: [ script A.py.do()LRoot;@97 ], v3] --> []
We can see that the points-to set for v3
is empty on the RHS.
But, also interesting is the varying instructions, which makes me believe that the problem is (also?) with the CAst translation.
I can't repro this on 2107422dde0bc40fefe1f918e2bde668f7a3b7b7.
$ diff edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testPythonSideEffects8/in/A.py edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testPythonSideEffects59/in/A.py