14#define ISL_BLK_MAX_MISS 100
26 return block.
size == 0 && block.
data == NULL;
39 return block.
size == -1 && block.
data == NULL;
46 for (i = 0; i < block.
size; ++i)
57 if (block.size >= new_n)
67 for (i = block.size; i < new_n; ++i)
80 if (
n && ctx->n_cached) {
82 for (i = 1; ctx->cache[best].
size !=
n && i < ctx->n_cached; ++i) {
83 if (ctx->cache[best].
size <
n) {
84 if (ctx->cache[i].
size > ctx->cache[best].
size)
86 }
else if (ctx->cache[i].
size >=
n &&
87 ctx->cache[i].
size < ctx->cache[best].
size)
90 if (ctx->cache[best].
size < 2 *
n + 100) {
91 block = ctx->cache[best];
92 if (--ctx->n_cached != best)
93 ctx->cache[best] = ctx->cache[ctx->n_cached];
98 if (--ctx->n_cached != 0)
99 ctx->cache[0] = ctx->cache[ctx->n_cached];
113 return extend(ctx, block, new_n);
#define isl_realloc_array(ctx, ptr, type, n)
static struct isl_blk extend(struct isl_ctx *ctx, struct isl_blk block, size_t new_n)
struct isl_blk isl_blk_extend(struct isl_ctx *ctx, struct isl_blk block, size_t new_n)
int isl_blk_is_error(struct isl_blk block)
void isl_blk_free(struct isl_ctx *ctx, struct isl_blk block)
void isl_blk_clear_cache(struct isl_ctx *ctx)
struct isl_blk isl_blk_alloc(struct isl_ctx *ctx, size_t n)
static void isl_blk_free_force(struct isl_ctx *ctx, struct isl_blk block)
static struct isl_blk isl_blk_error()
static int isl_blk_is_empty(struct isl_blk block)
struct isl_blk isl_blk_empty()
#define ISL_BLK_CACHE_SIZE
struct isl_blk isl_blk_alloc(struct isl_ctx *ctx, size_t n)
struct isl_blk cache[ISL_BLK_CACHE_SIZE]