mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
assignDkeys: use flat_set<ReportID>, not set
This commit is contained in:
parent
8dac64d1dc
commit
da23e8306a
@ -894,7 +894,8 @@ bool is_equal(const CastleProto &c1, const CastleProto &c2) {
|
|||||||
return c1.repeats == c2.repeats;
|
return c1.repeats == c2.repeats;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool requiresDedupe(const CastleProto &proto, const set<ReportID> &reports) {
|
bool requiresDedupe(const CastleProto &proto,
|
||||||
|
const ue2::flat_set<ReportID> &reports) {
|
||||||
ue2::unordered_set<ReportID> seen;
|
ue2::unordered_set<ReportID> seen;
|
||||||
for (const PureRepeat &pr : proto.repeats | map_values) {
|
for (const PureRepeat &pr : proto.repeats | map_values) {
|
||||||
for (const ReportID &report : pr.reports) {
|
for (const ReportID &report : pr.reports) {
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "nfagraph/ng_repeat.h"
|
#include "nfagraph/ng_repeat.h"
|
||||||
#include "util/alloc.h"
|
#include "util/alloc.h"
|
||||||
#include "util/depth.h"
|
#include "util/depth.h"
|
||||||
|
#include "util/ue2_containers.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -135,7 +136,8 @@ bool is_equal(const CastleProto &c1, const CastleProto &c2);
|
|||||||
* \brief True if the given castle contains more than a single instance of any
|
* \brief True if the given castle contains more than a single instance of any
|
||||||
* of the reports in the given set.
|
* of the reports in the given set.
|
||||||
*/
|
*/
|
||||||
bool requiresDedupe(const CastleProto &proto, const std::set<ReportID> &reports);
|
bool requiresDedupe(const CastleProto &proto,
|
||||||
|
const ue2::flat_set<ReportID> &reports);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Build an NGHolder from a CastleProto.
|
* \brief Build an NGHolder from a CastleProto.
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "rose_in_graph.h"
|
#include "rose_in_graph.h"
|
||||||
#include "util/alloc.h"
|
#include "util/alloc.h"
|
||||||
#include "util/charreach.h"
|
#include "util/charreach.h"
|
||||||
|
#include "util/ue2_containers.h"
|
||||||
#include "util/ue2string.h"
|
#include "util/ue2string.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -72,8 +73,8 @@ public:
|
|||||||
|
|
||||||
/** \brief True if we can not establish that at most a single callback will
|
/** \brief True if we can not establish that at most a single callback will
|
||||||
* be generated at a given offset from this set of reports. */
|
* be generated at a given offset from this set of reports. */
|
||||||
virtual bool requiresDedupeSupport(const std::set<ReportID> &reports) const
|
virtual bool requiresDedupeSupport(const ue2::flat_set<ReportID> &reports)
|
||||||
= 0;
|
const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Abstract interface intended for callers from elsewhere in the tree,
|
/** \brief Abstract interface intended for callers from elsewhere in the tree,
|
||||||
|
@ -538,7 +538,7 @@ u32 RoseBuildImpl::getNewLiteralId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
bool requiresDedupe(const NGHolder &h, const set<ReportID> &reports,
|
bool requiresDedupe(const NGHolder &h, const ue2::flat_set<ReportID> &reports,
|
||||||
const Grey &grey) {
|
const Grey &grey) {
|
||||||
/* TODO: tighten */
|
/* TODO: tighten */
|
||||||
NFAVertex seen_vert = NFAGraph::null_vertex();
|
NFAVertex seen_vert = NFAGraph::null_vertex();
|
||||||
@ -581,7 +581,8 @@ bool requiresDedupe(const NGHolder &h, const set<ReportID> &reports,
|
|||||||
class RoseDedupeAuxImpl : public RoseDedupeAux {
|
class RoseDedupeAuxImpl : public RoseDedupeAux {
|
||||||
public:
|
public:
|
||||||
explicit RoseDedupeAuxImpl(const RoseBuildImpl &tbi_in);
|
explicit RoseDedupeAuxImpl(const RoseBuildImpl &tbi_in);
|
||||||
bool requiresDedupeSupport(const set<ReportID> &reports) const override;
|
bool requiresDedupeSupport(
|
||||||
|
const ue2::flat_set<ReportID> &reports) const override;
|
||||||
|
|
||||||
const RoseBuildImpl &tbi;
|
const RoseBuildImpl &tbi;
|
||||||
map<ReportID, set<RoseVertex>> vert_map;
|
map<ReportID, set<RoseVertex>> vert_map;
|
||||||
@ -644,8 +645,8 @@ RoseDedupeAuxImpl::RoseDedupeAuxImpl(const RoseBuildImpl &tbi_in)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RoseDedupeAuxImpl::requiresDedupeSupport(const set<ReportID> &reports)
|
bool RoseDedupeAuxImpl::requiresDedupeSupport(
|
||||||
const {
|
const ue2::flat_set<ReportID> &reports) const {
|
||||||
/* TODO: this could be expanded to check for offset or character
|
/* TODO: this could be expanded to check for offset or character
|
||||||
constraints */
|
constraints */
|
||||||
|
|
||||||
|
@ -128,11 +128,9 @@ vector<ReportID> ReportManager::getDkeyToReportTable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ReportManager::assignDkeys(const RoseBuild *rose) {
|
void ReportManager::assignDkeys(const RoseBuild *rose) {
|
||||||
unique_ptr<RoseDedupeAux> dedupe = rose->generateDedupeAux();
|
|
||||||
|
|
||||||
DEBUG_PRINTF("assigning...\n");
|
DEBUG_PRINTF("assigning...\n");
|
||||||
|
|
||||||
map<u32, set<ReportID>> ext_to_int;
|
map<u32, ue2::flat_set<ReportID>> ext_to_int;
|
||||||
|
|
||||||
for (u32 i = 0; i < reportIds.size(); i++) {
|
for (u32 i = 0; i < reportIds.size(); i++) {
|
||||||
const Report &ir = reportIds[i];
|
const Report &ir = reportIds[i];
|
||||||
@ -143,6 +141,8 @@ void ReportManager::assignDkeys(const RoseBuild *rose) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto dedupe = rose->generateDedupeAux();
|
||||||
|
|
||||||
for (const auto &m : ext_to_int) {
|
for (const auto &m : ext_to_int) {
|
||||||
u32 ext = m.first;
|
u32 ext = m.first;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user