Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
同上一次commit
  • Loading branch information
lsyel committed Sep 24, 2024
commit 303e6ff0ef64780e93def0c99b52eda87d16776b
10 changes: 9 additions & 1 deletion src/rose/rose_build_bytecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3605,6 +3605,13 @@ map<left_id, u32> makeLeftQueueMap(const RoseGraph &g,

return lqm;
}
static void allocHitLog(RoseEngine &proto){
proto.hit_log = (struct hitOffset **)malloc(sizeof(struct hitOffset *) * proto.lkeyCount);
for (u32 i = 0; i < proto.lkeyCount; i++) {
proto.hit_log[i] = (struct hitOffset *)malloc(sizeof(struct hitOffset));
memset(proto.hit_log[i], 0, sizeof(struct hitOffset) );
}
}

bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
// We keep all our offsets, counts etc. in a prototype RoseEngine which we
Expand Down Expand Up @@ -3868,7 +3875,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
proto.ematcherRegionSize = ematcher_region_size;

proto.size = currOffset;

allocHitLog(proto);
// Time to allocate the real RoseEngine structure, at cacheline alignment.
auto engine = make_zeroed_bytecode_ptr<RoseEngine>(currOffset, 64);
assert(engine); // will have thrown bad_alloc otherwise.
Expand All @@ -3893,4 +3900,5 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
return engine;
}


} // namespace ue2