mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
Split the nodeset used in computing the dfa into two sets, accepting and
non-accepting, and have the proto-state use them. To reduce memory overhead each set gains its own "cache" that make sure there is only a single instance of each NodeSet generated. And since we have a cache abstraction, move relavent stats into it. Also refactor code slightly to make caches and work_queue etc, DFA member variables instead of passing them as parameters. The split + caching results in a small reduction in memory use as the cost of ProtoState + Caching is less than the redundancy that is eliminated. However this results in a small decrease in performance. Sorry I know this really should have been split into multiple patches but the patch evolved and I got lazy and decided to just not bother splitting it. Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
@@ -204,6 +204,7 @@ public:
|
||||
void compute_firstpos() { firstpos.insert(this); }
|
||||
void compute_lastpos() { lastpos.insert(this); }
|
||||
virtual void follow(Cases &cases) = 0;
|
||||
virtual int is_accept(void) = 0;
|
||||
};
|
||||
|
||||
/* common base class for all the different classes that contain
|
||||
@@ -212,6 +213,7 @@ public:
|
||||
class CNode: public ImportantNode {
|
||||
public:
|
||||
CNode(): ImportantNode() { }
|
||||
int is_accept(void) { return false; }
|
||||
};
|
||||
|
||||
/* Match one specific character (/c/). */
|
||||
@@ -363,6 +365,7 @@ public:
|
||||
class AcceptNode: public ImportantNode {
|
||||
public:
|
||||
AcceptNode() { }
|
||||
int is_accept(void) { return true; }
|
||||
void release(void)
|
||||
{
|
||||
/* don't delete AcceptNode via release as they are shared, and
|
||||
|
Reference in New Issue
Block a user