-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove MemObj in SVFIR #1631
remove MemObj in SVFIR #1631
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1631 +/- ##
==========================================
+ Coverage 62.92% 63.25% +0.33%
==========================================
Files 247 247
Lines 27746 27468 -278
Branches 4550 4548 -2
==========================================
- Hits 17459 17376 -83
+ Misses 10287 10092 -195
|
svf/include/SVFIR/SVFIR.h
Outdated
@@ -424,17 +415,17 @@ class SVFIR : public IRGraph | |||
|
|||
inline const MemObj*getObject(const ObjVar* node) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this method?
svf/lib/SABER/SaberSVFGBuilder.cpp
Outdated
isSU = true; | ||
if (!pta->isHeapMemObj(singleton) && !pta->isArrayMemObj(singleton)) { | ||
// ABTest | ||
assert(SVFIR::getPAG()->getBaseObject(singleton)->isFieldInsensitive() == |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove abtest
svf/lib/SVFIR/SVFFileSystem.cpp
Outdated
@@ -335,7 +335,7 @@ cJSON* SVFIRWriter::contentToJson(const ValVar* var) | |||
cJSON* SVFIRWriter::contentToJson(const ObjVar* var) | |||
{ | |||
cJSON* root = contentToJson(static_cast<const SVFVar*>(var)); | |||
JSON_WRITE_FIELD(root, var, mem); | |||
//JSON_WRITE_FIELD(root, var, mem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
svf/lib/SVFIR/SVFFileSystem.cpp
Outdated
@@ -1941,7 +1941,7 @@ void SVFIRReader::fill(const cJSON*& fieldJson, ValVar* var) | |||
void SVFIRReader::fill(const cJSON*& fieldJson, ObjVar* var) | |||
{ | |||
fill(fieldJson, static_cast<SVFVar*>(var)); | |||
JSON_READ_FIELD_FWD(fieldJson, var, mem); | |||
//JSON_READ_FIELD_FWD(fieldJson, var, mem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
svf/include/SVFIR/SVFIR.h
Outdated
@@ -634,7 +618,7 @@ class SVFIR : public IRGraph | |||
const MemObj* mem = getMemObj(val); | |||
assert(mem->getId() == i && "not same object id?"); | |||
memToFieldsMap[i].set(i); | |||
HeapObjVar *node = new HeapObjVar(i, mem, val->getType(), f); | |||
HeapObjVar *node = new HeapObjVar(val, i, mem->getObjTypeInfo(), mem->getGNode(), f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
directly pass typeinfo in the parameters, don't pass memobj
--- SVF/nohup.out 2025-01-15 14:39:59.865910492 +1100 @@ -60,11 +60,11 @@ Memory SSA Statistics****** Persistent Points-To Cache Statistics: flow-sensitive analysis bitvector |
{ | ||
u32_t sz = objvar->getMemObj()->getByteSizeOfObj(); | ||
u32_t sz = PAG::getPAG()->getBaseObject(objvar->getId())->getByteSizeOfObj(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a method getBaseObject() in ObjVar, BaseObjVar and GepObjVar
svf/include/SVFIR/SVFIR.h
Outdated
@@ -741,14 +725,18 @@ class SVFIR : public IRGraph | |||
inline NodeID addBlackholeObjNode() | |||
{ | |||
return addObjNode( | |||
nullptr, new DummyObjVar(getBlackHoleNode(), getBlackHoleObj()), | |||
getBlackHoleNode()); | |||
nullptr, new DummyObjVar(getBlackHoleNode(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce the number of arguments. The first and last arguments are the same.
pass ObjtypeInfo directly.
svf/include/SVFIR/SVFIR.h
Outdated
} | ||
inline NodeID addConstantObjNode() | ||
{ | ||
return addObjNode(nullptr, | ||
new DummyObjVar(getConstantNode(), getConstantObj()), | ||
getConstantNode()); | ||
new DummyObjVar(getConstantNode(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
PNODEK ty = GepObjNode) | ||
: ObjVar(mem->getValue(), i, mem, ty), apOffset(apOffset) | ||
/// Constructorx | ||
BaseObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, PNODEK ty = BaseObjNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SVFValue will be removed later?
virtual const std::string toString() const; | ||
|
||
/// Get the memory object id | ||
inline SymID getId() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SymID => NodeID
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -785,7 +932,7 @@ class StackObjVar: public BaseObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
StackObjVar(NodeID i, const MemObj* mem, const SVFType* svfType, | |||
StackObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -724,7 +871,7 @@ class HeapObjVar: public BaseObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
HeapObjVar(NodeID i, const MemObj* mem, const SVFType* svfType, | |||
HeapObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need "ObjTypeInfo* ti" as the argument? HeapObjVar is a subclass of SVFBaseNode
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -886,7 +1033,7 @@ class FunObjVar : public BaseObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
FunObjVar(NodeID i, const MemObj* mem, const CallGraphNode* cgNode, | |||
FunObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, const CallGraphNode* cgNode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -1221,8 +1368,8 @@ class GlobalObjVar : public BaseObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
GlobalObjVar(const SVFValue* val, NodeID i, const MemObj* mem, | |||
PNODEK ty = GlobalObjNode): BaseObjVar(val, i,mem,ty) | |||
GlobalObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -1270,8 +1417,8 @@ class ConstantDataObjVar: public BaseObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
ConstantDataObjVar(const SVFValue* val, NodeID i, const MemObj* m, PNODEK ty = ConstantDataObjNode) | |||
: BaseObjVar(val, i, m, ty) | |||
ConstantDataObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, PNODEK ty = ConstantDataObjNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -1327,8 +1474,8 @@ class ConstantFPObjVar: public ConstantDataObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
ConstantFPObjVar(const SVFValue* val, NodeID i, double dv, const MemObj* m, PNODEK ty = ConstantFPObjNode) | |||
: ConstantDataObjVar(val, i, m, ty), dval(dv) | |||
ConstantFPObjVar(const SVFValue* val, NodeID i, double dv, ObjTypeInfo* ti, const SVFBaseNode* node, PNODEK ty = ConstantFPObjNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -1402,8 +1549,8 @@ class ConstantIntObjVar: public ConstantDataObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
ConstantIntObjVar(const SVFValue* val, NodeID i, s64_t sv, u64_t zv, const MemObj* m, PNODEK ty = ConstantIntObjNode) | |||
: ConstantDataObjVar(val, i, m, ty), zval(zv), sval(sv) | |||
ConstantIntObjVar(const SVFValue* val, NodeID i, s64_t sv, u64_t zv, ObjTypeInfo* ti, const SVFBaseNode* node, PNODEK ty = ConstantIntObjNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -1457,8 +1604,8 @@ class ConstantNullPtrObjVar: public ConstantDataObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
ConstantNullPtrObjVar(const SVFValue* val, NodeID i, const MemObj* m, PNODEK ty = ConstantNullptrObjNode) | |||
: ConstantDataObjVar(val, i, m, ty) | |||
ConstantNullPtrObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, PNODEK ty = ConstantNullptrObjNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFVariables.h
Outdated
@@ -1655,8 +1802,8 @@ class DummyObjVar: public BaseObjVar | |||
//@} | |||
|
|||
/// Constructor | |||
DummyObjVar(NodeID i, const MemObj* m, PNODEK ty = DummyObjNode) | |||
: BaseObjVar(nullptr, i, m, ty) | |||
DummyObjVar(NodeID i, ObjTypeInfo* ti, const SVFBaseNode* node, PNODEK ty = DummyObjNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/lib/SVFIR/SVFIR.cpp
Outdated
memToFieldsMap[base].set(gepId); | ||
return addObjNode(obj->getValue(), node, gepId); | ||
return addObjNode(baseObj->hasValue()? baseObj->getValue(): nullptr, node, gepId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this line is different from previous version? Why baseObj->hasValue() here?
svf/lib/SVFIR/SVFIR.cpp
Outdated
@@ -468,7 +469,7 @@ NodeID SVFIR::addFIObjNode(const MemObj* obj) | |||
//assert(findPAGNode(i) == false && "this node should not be created before"); | |||
NodeID base = obj->getId(); | |||
memToFieldsMap[base].set(obj->getId()); | |||
BaseObjVar*node = new BaseObjVar(obj->getValue(), obj->getId(), obj); | |||
BaseObjVar* node = new BaseObjVar(obj->getValue(), obj->getId(), obj->getObjTypeInfo(), obj->getGNode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need to pass the parent class object "obj->getGNode()" here to create a subclass object?
svf/lib/SVFIR/SVFIR.cpp
Outdated
@@ -479,14 +480,14 @@ NodeID SVFIR::addFunObjNode(NodeID id, const CallGraphNode* callGraphNode) | |||
//assert(findPAGNode(i) == false && "this node should not be created before"); | |||
NodeID base = mem->getId(); | |||
memToFieldsMap[base].set(mem->getId()); | |||
FunObjVar*node = new FunObjVar(id, mem, callGraphNode); | |||
FunObjVar* node = new FunObjVar(mem->getValue(), id, mem->getObjTypeInfo(), mem->getGNode(), callGraphNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
svf/include/SVFIR/SVFIR.h
Outdated
return addObjNode(nullptr, | ||
new DummyObjVar(getConstantNode(), getConstantObj()), | ||
getConstantNode()); | ||
return addObjNode(nullptr, new DummyObjVar(getConstantNode(), symInfo->getObjTypeInfo(getConstantNode())), getConstantNode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first and last arguments are the same?
svf/include/SVFIR/SVFIR.h
Outdated
inline NodeID addBlackholeObjNode() | ||
{ | ||
return addObjNode( | ||
nullptr, new DummyObjVar(getBlackHoleNode(), getBlackHoleObj()), | ||
getBlackHoleNode()); | ||
nullptr, new DummyObjVar(getBlackHoleNode(), symInfo->getObjTypeInfo(getBlackHoleNode())), getBlackHoleNode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first and last arguments are the same?
svf/include/SVFIR/SVFIR.h
Outdated
inline const MemObj* addDummyMemObj(NodeID i, const SVFType* type) | ||
{ | ||
return getSymbolInfo()->createDummyObj(i,type); | ||
return addObjNode(nullptr, new DummyObjVar(i,symInfo->createObjTypeInfo(type)), i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first and last arguments are the same?
--- SVF/nohup.out 2025-01-17 01:27:29.490423431 +1100 PTACallGraph Stats (Andersen analysis)****** Memory SSA Statistics****** Persistent Points-To Cache Statistics: flow-sensitive analysis bitvector |
* AB Test, pass all ci * AB Test removed, pass all ci * remove MemObj * fix asan err * remove useless NodeID --------- Co-authored-by: bjjwwang <[email protected]>
No description provided.