Skip to content

Commit 2e0d566

Browse files
bjjwwangclaude
andcommitted
Port Assignment-3/Python helper to AbstractInterpretation as well
Mirror the C++ port: AbstractStateManager was folded into AbstractInterpretation upstream and removed; the Python helper similarly switches from 'pysvf.AbstractStateManager(svfir, ander)' to 'pysvf.AbstractInterpretation.getAEInstance()'. That requires the matching SVF-Python change (PR on bjjwwang/SVF-Python2: fix/port-AE-bindings-to-AbstractInterpretation) to land first so a fresh pysvf wheel actually exposes 'AbstractInterpretation.getAEInstance()'. The Andersen instance is no longer needed: the AI singleton pulls SVFIR from PAG::getPAG() and runs its own pointer analysis when needed. Drop the explicit 'self.ander = pysvf.AndersenWaveDiff(...)' line. Verified end-to-end: - 'python3 -c "import ast; ast.parse(open(...))"' on the patched helper -> syntax OK. - Built the matching SVF-Python wheel in 'docker run --rm ubuntu:24.04', installed it, and 'import Assignment_3_Helper' succeeds — both AbstractExecutionHelper and AbstractExecution classes resolve. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 862e370 commit 2e0d566

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Assignment-3/Python/Assignment_3_Helper.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class AbstractExecutionHelper:
204204
managing GEP object offsets, and other utilities.
205205
"""
206206

207-
def __init__(self, svfir: pysvf.SVFIR, svf_state_mgr: pysvf.AbstractStateManager = None):
207+
def __init__(self, svfir: pysvf.SVFIR, svf_state_mgr: 'pysvf.AbstractInterpretation' = None):
208208
"""
209209
Initialize member variables.
210210
"""
@@ -222,7 +222,8 @@ def __init__(self, svfir: pysvf.SVFIR, svf_state_mgr: pysvf.AbstractStateManager
222222

223223
# ------------------------------------------------------------------
224224
# Helpers that used to live as instance methods on `pysvf.AbstractState`.
225-
# Upstream (Semi-Sparse refactor) moved them to `AbstractStateManager`,
225+
# Upstream (Semi-Sparse refactor) moved them to `AbstractInterpretation`
226+
# (formerly `AbstractStateManager`, whose public header was removed),
226227
# which requires a sparsity-aware trace we don't keep here. We re-implement
227228
# the dense-mode behavior using only public AbstractState surface so the
228229
# Python side mirrors the C++ side (`AbstractExecutionHelper::getByteOffset`).
@@ -446,8 +447,11 @@ def __init__(self, pag: pysvf.SVFIR):
446447
# as the GEP/load/store helpers (getGepByteOffset etc.). Replaces
447448
# the old `self.post_abs_trace` dict so reads/writes on
448449
# `self.post_abs_trace[node]` go through the mgr's trace.
449-
self.ander = pysvf.AndersenWaveDiff(self.svfir)
450-
self.svf_state_mgr = pysvf.AbstractStateManager(self.svfir, self.ander)
450+
# AbstractStateManager was folded into AbstractInterpretation upstream
451+
# (the AbstractStateManager.h header was removed). Use the
452+
# AbstractInterpretation singleton; it pulls SVFIR from PAG::getPAG()
453+
# internally and does not need an explicit Andersen instance.
454+
self.svf_state_mgr = pysvf.AbstractInterpretation.getAEInstance()
451455
# Alias preserved so existing call-sites `self.post_abs_trace[node]`
452456
# keep working. The mgr supports __getitem__/__setitem__/__contains__.
453457
self.post_abs_trace = self.svf_state_mgr

0 commit comments

Comments
 (0)