mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-19 02:30:35 +03:00
nfa: switch to using bytecode_ptr<NFA>
This commit is contained in:
committed by
Matthew Barr
parent
905ac78061
commit
a197074c5d
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -26,7 +26,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
/**
|
||||
* \file
|
||||
* \brief Limex NFA construction code.
|
||||
*/
|
||||
|
||||
@@ -35,7 +36,7 @@
|
||||
|
||||
#include "ue2common.h"
|
||||
#include "som/som.h"
|
||||
#include "util/alloc.h"
|
||||
#include "util/bytecode_ptr.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -51,7 +52,8 @@ class NGHolder;
|
||||
class ReportManager;
|
||||
struct CompileContext;
|
||||
|
||||
/** \brief Determine if the given graph is implementable as an NFA.
|
||||
/**
|
||||
* \brief Determine if the given graph is implementable as an NFA.
|
||||
*
|
||||
* Returns zero if the NFA is not implementable (usually because it has too
|
||||
* many states for any of our models). Otherwise returns the number of states.
|
||||
@@ -62,11 +64,14 @@ struct CompileContext;
|
||||
u32 isImplementableNFA(const NGHolder &g, const ReportManager *rm,
|
||||
const CompileContext &cc);
|
||||
|
||||
/** \brief Late-stage graph reductions.
|
||||
/**
|
||||
* \brief Late-stage graph reductions.
|
||||
*
|
||||
* This will call \ref removeRedundancy and apply its changes to the given
|
||||
* holder only if it is implementable afterwards. */
|
||||
void reduceImplementableGraph(NGHolder &g, som_type som, const ReportManager *rm,
|
||||
* holder only if it is implementable afterwards.
|
||||
*/
|
||||
void reduceImplementableGraph(NGHolder &g, som_type som,
|
||||
const ReportManager *rm,
|
||||
const CompileContext &cc);
|
||||
|
||||
/**
|
||||
@@ -79,7 +84,8 @@ void reduceImplementableGraph(NGHolder &g, som_type som, const ReportManager *rm
|
||||
u32 countAccelStates(const NGHolder &g, const ReportManager *rm,
|
||||
const CompileContext &cc);
|
||||
|
||||
/** \brief Construct an NFA from the given NFAGraph.
|
||||
/**
|
||||
* \brief Construct an NFA from the given graph.
|
||||
*
|
||||
* Returns zero if the NFA is not implementable (usually because it has too
|
||||
* many states for any of our models). Otherwise returns the number of states.
|
||||
@@ -90,23 +96,25 @@ u32 countAccelStates(const NGHolder &g, const ReportManager *rm,
|
||||
* Note: this variant of the function allows a model to be specified with the
|
||||
* \a hint parameter.
|
||||
*/
|
||||
aligned_unique_ptr<NFA>
|
||||
bytecode_ptr<NFA>
|
||||
constructNFA(const NGHolder &g, const ReportManager *rm,
|
||||
const std::map<u32, u32> &fixed_depth_tops,
|
||||
const std::map<u32, std::vector<std::vector<CharReach>>> &triggers,
|
||||
bool compress_state, const CompileContext &cc);
|
||||
|
||||
/** \brief Build a reverse NFA from the graph given, which should have already
|
||||
/**
|
||||
* \brief Build a reverse NFA from the graph given, which should have already
|
||||
* been reversed.
|
||||
*
|
||||
* Used for reverse NFAs used in SOM mode.
|
||||
*/
|
||||
aligned_unique_ptr<NFA> constructReversedNFA(const NGHolder &h,
|
||||
const CompileContext &cc);
|
||||
bytecode_ptr<NFA> constructReversedNFA(const NGHolder &h,
|
||||
const CompileContext &cc);
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
|
||||
/** \brief Construct an NFA (with model type hint) from the given NFAGraph.
|
||||
/**
|
||||
* \brief Construct an NFA (with model type hint) from the given graph.
|
||||
*
|
||||
* Returns zero if the NFA is not implementable (usually because it has too
|
||||
* many states for any of our models). Otherwise returns the number of states.
|
||||
@@ -117,19 +125,20 @@ aligned_unique_ptr<NFA> constructReversedNFA(const NGHolder &h,
|
||||
* Note: this variant of the function allows a model to be specified with the
|
||||
* \a hint parameter.
|
||||
*/
|
||||
aligned_unique_ptr<NFA>
|
||||
bytecode_ptr<NFA>
|
||||
constructNFA(const NGHolder &g, const ReportManager *rm,
|
||||
const std::map<u32, u32> &fixed_depth_tops,
|
||||
const std::map<u32, std::vector<std::vector<CharReach>>> &triggers,
|
||||
bool compress_state, u32 hint, const CompileContext &cc);
|
||||
|
||||
/** \brief Build a reverse NFA (with model type hint) from the graph given,
|
||||
/**
|
||||
* \brief Build a reverse NFA (with model type hint) from the graph given,
|
||||
* which should have already been reversed.
|
||||
*
|
||||
* Used for reverse NFAs used in SOM mode.
|
||||
*/
|
||||
aligned_unique_ptr<NFA> constructReversedNFA(const NGHolder &h, u32 hint,
|
||||
const CompileContext &cc);
|
||||
bytecode_ptr<NFA> constructReversedNFA(const NGHolder &h, u32 hint,
|
||||
const CompileContext &cc);
|
||||
|
||||
#endif // RELEASE_BUILD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user