Skip to content

Commit

Permalink
DFA state compression: 16-bit wide and sherman co-exist
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyang7 authored and fatchanghao committed Jan 21, 2019
1 parent c7c4119 commit c06d5e1
Show file tree
Hide file tree
Showing 10 changed files with 894 additions and 72 deletions.
4 changes: 3 additions & 1 deletion src/grey.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2017, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -82,6 +82,7 @@ Grey::Grey(void) :
onlyOneOutfix(false),
allowShermanStates(true),
allowMcClellan8(true),
allowWideStates(true), // enable wide state for McClellan8
highlanderPruneDFA(true),
minimizeDFA(true),
accelerateDFA(true),
Expand Down Expand Up @@ -251,6 +252,7 @@ void applyGreyOverrides(Grey *g, const string &s) {
G_UPDATE(onlyOneOutfix);
G_UPDATE(allowShermanStates);
G_UPDATE(allowMcClellan8);
G_UPDATE(allowWideStates);
G_UPDATE(highlanderPruneDFA);
G_UPDATE(minimizeDFA);
G_UPDATE(accelerateDFA);
Expand Down
3 changes: 2 additions & 1 deletion src/grey.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2017, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -87,6 +87,7 @@ struct Grey {

bool allowShermanStates;
bool allowMcClellan8;
bool allowWideStates; // enable wide state for McClellan8
bool highlanderPruneDFA;
bool minimizeDFA;

Expand Down
9 changes: 8 additions & 1 deletion src/nfa/accel_dfa_build_strat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2017, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -40,6 +40,11 @@ namespace ue2 {

class ReportManager;
struct Grey;
enum DfaType {
McClellan,
Sheng,
Gough
};

class accel_dfa_build_strat : public dfa_build_strat {
public:
Expand All @@ -53,6 +58,8 @@ class accel_dfa_build_strat : public dfa_build_strat {
virtual void buildAccel(dstate_id_t this_idx, const AccelScheme &info,
void *accel_out);
virtual std::map<dstate_id_t, AccelScheme> getAccelInfo(const Grey &grey);
virtual DfaType getType() const = 0;

private:
bool only_accel_init;
};
Expand Down
1 change: 1 addition & 0 deletions src/nfa/goughcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class gough_build_strat : public mcclellan_build_strat {
void buildAccel(dstate_id_t this_idx, const AccelScheme &info,
void *accel_out) override;
u32 max_allowed_offset_accel() const override { return 0; }
DfaType getType() const override { return Gough; }

raw_som_dfa &rdfa;
const GoughGraph &gg;
Expand Down
Loading

0 comments on commit c06d5e1

Please sign in to comment.