From 87de704cd392bcac2532329e29754a68654dfa1c Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Wed, 28 Feb 2024 13:11:58 -0500 Subject: [PATCH 1/2] Remove for each processing. We can't add this constraint. It doesn't make any sense. --- .../PythonSSAPropagationCallGraphBuilder.java | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/ipa/callgraph/PythonSSAPropagationCallGraphBuilder.java b/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/ipa/callgraph/PythonSSAPropagationCallGraphBuilder.java index 5c0bf6308..827aa513e 100644 --- a/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/ipa/callgraph/PythonSSAPropagationCallGraphBuilder.java +++ b/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/ipa/callgraph/PythonSSAPropagationCallGraphBuilder.java @@ -12,13 +12,10 @@ import com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder; import com.ibm.wala.cast.ipa.callgraph.GlobalObjectKey; -import com.ibm.wala.cast.ir.ssa.AstPropertyRead; -import com.ibm.wala.cast.ir.ssa.EachElementGetInstruction; import com.ibm.wala.cast.python.ipa.summaries.BuiltinFunctions.BuiltinFunction; import com.ibm.wala.cast.python.ir.PythonLanguage; import com.ibm.wala.cast.python.ssa.PythonInstructionVisitor; import com.ibm.wala.cast.python.ssa.PythonInvokeInstruction; -import com.ibm.wala.cast.python.ssa.PythonPropertyRead; import com.ibm.wala.cast.python.types.PythonTypes; import com.ibm.wala.classLoader.IClass; import com.ibm.wala.classLoader.IField; @@ -40,7 +37,6 @@ import com.ibm.wala.ssa.SSAArrayStoreInstruction; import com.ibm.wala.ssa.SSABinaryOpInstruction; import com.ibm.wala.ssa.SSAGetInstruction; -import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SymbolTable; import com.ibm.wala.types.FieldReference; import com.ibm.wala.types.TypeReference; @@ -179,42 +175,6 @@ public String toString() { super.visitGet(instruction); } - @Override - public void visitPropertyRead(AstPropertyRead instruction) { - super.visitPropertyRead(instruction); - - if (instruction instanceof PythonPropertyRead) { - PythonPropertyRead ppr = (PythonPropertyRead) instruction; - SSAInstruction memberRefDef = du.getDef(ppr.getMemberRef()); - - if (memberRefDef != null && memberRefDef instanceof EachElementGetInstruction) { - // most likely a for each "property." - final PointerKey memberRefKey = this.getPointerKeyForLocal(ppr.getMemberRef()); - - // for each def of the property read. - for (int i = 0; i < ppr.getNumberOfDefs(); i++) { - PointerKey defKey = this.getPointerKeyForLocal(ppr.getDef(i)); - - // add an assignment constraint straight away as the traversal variable won't have a - // non-empty points-to set but still may be used for a dataflow analysis. - if (this.system.newConstraint(defKey, assignOperator, memberRefKey)) - logger.fine( - () -> - "Added new system constraint for global read from: " - + defKey - + " to: " - + memberRefKey - + " for instruction: " - + instruction - + "."); - else - logger.fine( - () -> "No constraint added for global read in instruction: " + instruction + "."); - } - } - } - } - @Override public void visitPythonInvoke(PythonInvokeInstruction inst) { visitInvokeInternal(inst, new DefaultInvariantComputer()); From cf9e6caa61c893f1c438c483f406bd596e929d4f Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Thu, 29 Feb 2024 17:08:05 -0500 Subject: [PATCH 2/2] Alternative fix for datasets. Alternative fix for the code removed in 87de704cd392bcac2532329e29754a68654dfa1c. --- .../wala/cast/python/ml/client/PythonTensorAnalysisEngine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/PythonTensorAnalysisEngine.java b/com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/PythonTensorAnalysisEngine.java index 702126a7f..048a395b8 100644 --- a/com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/PythonTensorAnalysisEngine.java +++ b/com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/PythonTensorAnalysisEngine.java @@ -169,7 +169,8 @@ private static Set getDataflowSources( processInstructionInterprocedurally( propertyRead, objectRef, localPointerKeyNode, src, sources, pointerAnalysis); } else if (def instanceof EachElementGetInstruction - || def instanceof PythonPropertyRead) { + || def instanceof PythonPropertyRead + || def instanceof PythonInvokeInstruction) { processInstruction( def, du,