You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actually use AbstractStateManager (drop local helper re-implementations)
The previous sync (deb5cb1) wired stateMgr into AbstractExecution but only
as a placeholder for AbsExtAPI. Reads/writes still went through a separate
postAbsTrace map and the GEP/load/size helpers were ported by hand. That
defeated the point: the C++ side held a stateMgr it never actually called,
and the Python side never even built one.
This commit makes both languages use the stateMgr as the authoritative
post-trace store and routes the GEP helpers through its API.
C++ Assignment-3:
- Drop the standalone Map<const ICFGNode*, AbstractState> postAbsTrace.
Replace with `Map<...>& postAbsTrace() { return svfStateMgr->getTrace(); }`
so existing call sites still read like `postAbsTrace()[node]`.
- getAbsStateFromTrace returns `(*svfStateMgr)[node]`.
- All call sites of `as.getByteOffset(gep)` (now removed upstream) and the
intermediate `bufOverflowHelper.getByteOffset(as, gep)` shim go directly
to `svfStateMgr->getGepByteOffset(gep)`.
- Drop the in-out trace sync that used to wrap `utils->handleExtAPI(...)`.
AbsExtAPI now reads and writes through the same stateMgr that backs the
post trace, so there is nothing to sync.
- Drop the 60-line `AbstractExecutionHelper::getByteOffset` re-implementation;
it has no remaining caller.
Python Assignment-3:
- Construct `self.ander = pysvf.AndersenWaveDiff(svfir)` and
`self.svf_state_mgr = pysvf.AbstractStateManager(svfir, self.ander)` in
`AbstractExecution.__init__`.
- Alias `self.post_abs_trace = self.svf_state_mgr` so every existing
`self.post_abs_trace[node]`, `node in self.post_abs_trace`, and
`self.post_abs_trace[node] = state` call site continues to work --
pysvf.AbstractStateManager's new __getitem__/__setitem__/__contains__
bindings carry the dict protocol.
- Pass the stateMgr into AbstractExecutionHelper.__init__.
- AbstractExecutionHelper.getByteOffset/getGepObjAddrs/getAllocaInstByteSize
shrink to one-liners that delegate to the stateMgr's upstream impl,
matching the C++ shape `svfStateMgr->getGepByteOffset(gep)`.
getPointeeElement keeps a local impl because the upstream signature
takes (ObjVar, ICFGNode) while the existing call sites only have a
NodeID for what is typically a ValVar pointer -- not 1:1 convertible.
Net asymmetry left: 1 local helper on the Python side (getPointeeElement);
everything else now flows through stateMgr on both languages.
Locally: bin/ass3 builds at 100%; Python imports clean; helper methods
visibly delegate to self.svf_state_mgr.
Depends on bjjwwang/SVF-Python sync-llvm-21 head bb03d79 for the new
__setitem__/__contains__ on AbstractStateManager.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments