rose: move dkey info to engine blob

This commit is contained in:
Justin Viiret 2017-02-28 13:46:07 +11:00 committed by Matthew Barr
parent e3d2d67833
commit 395d6ae650

View File

@ -2709,6 +2709,15 @@ void writeLookaroundTables(build_context &bc, RoseEngine &proto) {
bc.engine_blob.add(begin(reach_table), end(reach_table)); bc.engine_blob.add(begin(reach_table), end(reach_table));
} }
static
void writeDkeyInfo(const ReportManager &rm, build_context &bc,
RoseEngine &proto) {
const auto inv_dkeys = rm.getDkeyToReportTable();
proto.invDkeyOffset = bc.engine_blob.add(begin(inv_dkeys), end(inv_dkeys));
proto.dkeyCount = rm.numDkeys();
proto.dkeyLogSize = fatbit_size(proto.dkeyCount);
}
static static
bool hasBoundaryReports(const BoundaryReports &boundary) { bool hasBoundaryReports(const BoundaryReports &boundary) {
if (!boundary.report_at_0.empty()) { if (!boundary.report_at_0.empty()) {
@ -5384,6 +5393,7 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
addSomRevNfas(bc, proto, ssm); addSomRevNfas(bc, proto, ssm);
writeLookaroundTables(bc, proto); writeLookaroundTables(bc, proto);
writeDkeyInfo(rm, bc, proto);
// Enforce role table resource limit. // Enforce role table resource limit.
if (num_vertices(g) > cc.grey.limitRoseRoleCount) { if (num_vertices(g) > cc.grey.limitRoseRoleCount) {
@ -5488,14 +5498,8 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
u32 state_scatter_aux_offset = currOffset; u32 state_scatter_aux_offset = currOffset;
currOffset += aux_size(state_scatter); currOffset += aux_size(state_scatter);
currOffset = ROUNDUP_N(currOffset, alignof(ReportID));
proto.invDkeyOffset = currOffset;
currOffset += rm.numDkeys() * sizeof(ReportID);
proto.historyRequired = verify_u32(historyRequired); proto.historyRequired = verify_u32(historyRequired);
proto.ekeyCount = rm.numEkeys(); proto.ekeyCount = rm.numEkeys();
proto.dkeyCount = rm.numDkeys();
proto.dkeyLogSize = fatbit_size(proto.dkeyCount);
proto.somHorizon = ssm.somPrecision(); proto.somHorizon = ssm.somPrecision();
proto.somLocationCount = ssm.numSomSlots(); proto.somLocationCount = ssm.numSomSlots();
@ -5584,8 +5588,6 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
memcpy(ptr + proto.sbmatcherOffset, sbtable.get(), sbsize); memcpy(ptr + proto.sbmatcherOffset, sbtable.get(), sbsize);
} }
copy_bytes(ptr + proto.invDkeyOffset, rm.getDkeyToReportTable());
write_out(&engine->state_init, (char *)engine.get(), state_scatter, write_out(&engine->state_init, (char *)engine.get(), state_scatter,
state_scatter_aux_offset); state_scatter_aux_offset);