53 tile.is_cached =
false;
54 tile.is_allocated =
false;
69 tile.is_allocated =
true;
70 tile.do_update =
true;
87 tile.is_cached =
true;
88 tile.is_allocated =
false;
100 tile.cache_index = uint(-1);
101 tile.is_cached =
false;
102 tile.is_allocated =
true;
112 tile.cache_index = new_page_index;
119 void page_cache_update_tile_ref(uint page_index, uint new_tile_index)
124 void find_first_valid(uint &src, uint dst)
126 for (uint i = src; i < dst; i++) {
136 void free_cached_page(uint page_index)
148 bool check_heap_integrity(
int start,
int size,
const uint invalid_val)
152 for (
int i = 0; i < int(
max_page); i++) {
153 if ((i >= start) && (i < (start + size))) {
172 find_first_valid(src, end);
175 if (!check_heap_integrity(0,
pages_infos_buf.page_free_count, uint(-1))) {
176 printf(
"Corrupted heap before defrag.");
182 for (; additional_pages > 0 && src < end; additional_pages--) {
184 find_first_valid(src, end);
188 bool is_empty = (src == end);
192 for (uint dst = end - 1; dst > src; dst--) {
203 find_first_valid(src, dst);
209 for (; additional_pages > 0 && src < end; additional_pages--, src++) {
214 if (!check_heap_integrity(0,
pages_infos_buf.page_free_count, uint(-1))) {
215 printf(
"Corrupted heap after defrag.");
static constexpr uint max_page
void page_cache_remove(ShadowTileData &tile)
void page_cache_update_page_ref(uint page_index, uint new_page_index)
void page_cache_append(ShadowTileData &tile, uint tile_index)
void page_free(ShadowTileData &tile)
uint2(& pages_cached_buf)[]
ShadowPagesInfoData & pages_infos_buf
void page_alloc(ShadowTileData &tile)