52 uint32_t upper_bound = 0;
53 std::map<
ItemID, std::pair<uint32_t , uint32_t >> committed_items;
58 for (uint32_t n = 0; n < ctx->item_count(); ++n)
62 for (
auto item_in_conflict : ctx->conflict_with(n))
64 auto it = committed_items.find(item_in_conflict);
67 if (it == committed_items.end())
72 auto const alloc_s = it->second.first;
73 auto const alloc_e = it->second.second;
74 intervals.
insert(mask(alloc_s, alloc_e));
77 uint32_t
const item_size = ctx->item_size(n);
78 uint32_t
const item_alloc_s = intervals.
firstfit(item_size);
79 uint32_t
const item_alloc_e = item_alloc_s + item_size;
82 ctx->mem_offset(n, item_alloc_s);
85 upper_bound = std::max(upper_bound, item_alloc_e);
86 committed_items[n] = std::make_pair(item_alloc_s, item_alloc_e);
90 ctx->mem_total(upper_bound);