49{
51
52 uint32_t upper_bound = 0;
53 std::map<
ItemID, std::pair<uint32_t , uint32_t >> committed_items;
54
55
56
57
58 for (uint32_t n = 0; n < ctx->
item_count(); ++n)
59 {
61
62 for (auto item_in_conflict : ctx->conflict_with(n))
63 {
64 auto it = committed_items.find(item_in_conflict);
65
66
67 if (it == committed_items.end())
68 {
69 continue;
70 }
71
72 auto const alloc_s = it->second.first;
73 auto const alloc_e = it->second.second;
74 intervals.
insert(mask(alloc_s, alloc_e));
75 }
76
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;
80
81
83
84
85 upper_bound = std::max(upper_bound, item_alloc_e);
86 committed_items[n] = std::make_pair(item_alloc_s, item_alloc_e);
87 }
88
89
91}
virtual void mem_total(const MemorySize &)=0
virtual uint32_t item_count(void) const =0
virtual ItemSize item_size(const ItemID &) const =0
virtual void mem_offset(const ItemID &, const MemoryOffset &)=0
void insert(const IntervalMask &)
uint32_t firstfit(uint32_t len) const