Skip to content

Commit 58d9949

Browse files
authored
Merge pull request #62 from bjjwwang/fix/port-Assignment3-to-AbstractInterpretation
Fix/port assignment3 to abstract interpretation
2 parents defba7a + 2e0d566 commit 58d9949

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

Assignment-3/CPP/Assignment_3.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
#include "Assignment_3_Helper.h"
2828
#include "AE/Svfexe/AbsExtAPI.h"
29-
#include "AE/Svfexe/AbstractStateManager.h"
29+
#include "AE/Svfexe/AbstractInterpretation.h"
3030
#include "SVFIR/SVFIR.h"
3131

3232
namespace SVF {
@@ -122,7 +122,7 @@ namespace SVF {
122122

123123
/// Destructor
124124
virtual ~AbstractExecution() {
125-
delete svfStateMgr;
125+
// svfStateMgr is the AbstractInterpretation singleton; SVF owns its lifetime.
126126
}
127127

128128
protected:
@@ -133,7 +133,7 @@ namespace SVF {
133133
/// AbsExtAPI and the GEP/load/store helpers (getGepByteOffset etc.)
134134
/// read and write through this manager; we don't keep a separate
135135
/// postAbsTrace map any more.
136-
AbstractStateManager* svfStateMgr = nullptr;
136+
AbstractInterpretation* svfStateMgr = nullptr;
137137

138138
/// Map a function to its corresponding WTO
139139
Map<const FunObjVar*, ICFGWTO*> funcToWTO;

Assignment-3/CPP/Assignment_3_Helper.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,11 @@ void AbstractExecution::ensureAllAssertsValidated() {
543543
void AbstractExecution::analyse() {
544544
// Init WTOs for all functions, and handle Global ICFGNode of SVFModule
545545
initWTO();
546-
AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(svfir);
547-
svfStateMgr = new AbstractStateManager(svfir, ander);
546+
// AbstractStateManager was folded into AbstractInterpretation upstream; the
547+
// header AE/Svfexe/AbstractStateManager.h was removed. Use the singleton
548+
// AbstractInterpretation; it pulls SVFIR from PAG::getPAG() internally and
549+
// does not need an explicit Andersen analysis to be passed in.
550+
svfStateMgr = &AbstractInterpretation::getAEInstance();
548551
utils = new AbsExtAPI(svfStateMgr);
549552

550553
// Handle the global node

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)