cog: reset cache instead of returning NULL

Returning NULL makes things crash.  Resetting the cache
makes things run slow.  Still an underlying bug somewhere,
but not critical.
This commit is contained in:
David Schleef 2009-09-25 18:14:28 -07:00
parent 05a1e071b9
commit 3c870a7a6c

View file

@ -139,8 +139,14 @@ cog_virt_frame_get_line (CogFrame * frame, int component, int i)
}
if (i < frame->cache_offset[component]) {
g_warning ("cache failure");
return NULL;
g_warning ("cache failure: %d outside [%d,%d]", i,
frame->cache_offset[component],
frame->cache_offset[component] + COG_FRAME_CACHE_SIZE - 1);
frame->cache_offset[component] = i;
for (j = 0; j < COG_FRAME_CACHE_SIZE; j++) {
frame->cached_lines[component][j] = 0;
}
}
while (i >= frame->cache_offset[component] + COG_FRAME_CACHE_SIZE) {