Skip to content

Commit b8dfbb7

Browse files
authored
Dataset bug fix (#157)
- Remove added constraint. - Add function invocation processing. Now, we can track datasets without explicitly adding a constraint.
1 parent 4c02e7c commit b8dfbb7

File tree

2 files changed

+2
-41
lines changed

2 files changed

+2
-41
lines changed

com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/PythonTensorAnalysisEngine.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ private static Set<PointsToSetVariable> getDataflowSources(
169169
processInstructionInterprocedurally(
170170
propertyRead, objectRef, localPointerKeyNode, src, sources, pointerAnalysis);
171171
} else if (def instanceof EachElementGetInstruction
172-
|| def instanceof PythonPropertyRead) {
172+
|| def instanceof PythonPropertyRead
173+
|| def instanceof PythonInvokeInstruction) {
173174
processInstruction(
174175
def,
175176
du,

com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/ipa/callgraph/PythonSSAPropagationCallGraphBuilder.java

-40
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212

1313
import com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder;
1414
import com.ibm.wala.cast.ipa.callgraph.GlobalObjectKey;
15-
import com.ibm.wala.cast.ir.ssa.AstPropertyRead;
16-
import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction;
1715
import com.ibm.wala.cast.python.ipa.summaries.BuiltinFunctions.BuiltinFunction;
1816
import com.ibm.wala.cast.python.ir.PythonLanguage;
1917
import com.ibm.wala.cast.python.ssa.PythonInstructionVisitor;
2018
import com.ibm.wala.cast.python.ssa.PythonInvokeInstruction;
21-
import com.ibm.wala.cast.python.ssa.PythonPropertyRead;
2219
import com.ibm.wala.cast.python.types.PythonTypes;
2320
import com.ibm.wala.classLoader.IClass;
2421
import com.ibm.wala.classLoader.IField;
@@ -40,7 +37,6 @@
4037
import com.ibm.wala.ssa.SSAArrayStoreInstruction;
4138
import com.ibm.wala.ssa.SSABinaryOpInstruction;
4239
import com.ibm.wala.ssa.SSAGetInstruction;
43-
import com.ibm.wala.ssa.SSAInstruction;
4440
import com.ibm.wala.ssa.SymbolTable;
4541
import com.ibm.wala.types.FieldReference;
4642
import com.ibm.wala.types.TypeReference;
@@ -179,42 +175,6 @@ public String toString() {
179175
super.visitGet(instruction);
180176
}
181177

182-
@Override
183-
public void visitPropertyRead(AstPropertyRead instruction) {
184-
super.visitPropertyRead(instruction);
185-
186-
if (instruction instanceof PythonPropertyRead) {
187-
PythonPropertyRead ppr = (PythonPropertyRead) instruction;
188-
SSAInstruction memberRefDef = du.getDef(ppr.getMemberRef());
189-
190-
if (memberRefDef != null && memberRefDef instanceof EachElementGetInstruction) {
191-
// most likely a for each "property."
192-
final PointerKey memberRefKey = this.getPointerKeyForLocal(ppr.getMemberRef());
193-
194-
// for each def of the property read.
195-
for (int i = 0; i < ppr.getNumberOfDefs(); i++) {
196-
PointerKey defKey = this.getPointerKeyForLocal(ppr.getDef(i));
197-
198-
// add an assignment constraint straight away as the traversal variable won't have a
199-
// non-empty points-to set but still may be used for a dataflow analysis.
200-
if (this.system.newConstraint(defKey, assignOperator, memberRefKey))
201-
logger.fine(
202-
() ->
203-
"Added new system constraint for global read from: "
204-
+ defKey
205-
+ " to: "
206-
+ memberRefKey
207-
+ " for instruction: "
208-
+ instruction
209-
+ ".");
210-
else
211-
logger.fine(
212-
() -> "No constraint added for global read in instruction: " + instruction + ".");
213-
}
214-
}
215-
}
216-
}
217-
218178
@Override
219179
public void visitPythonInvoke(PythonInvokeInstruction inst) {
220180
visitInvokeInternal(inst, new DefaultInvariantComputer());

0 commit comments

Comments
 (0)