}
jit_cache_t
-_jit_cache_create(long limit, long cache_page_size, int max_page_factor)
+_jit_cache_create(jit_context_t context)
{
jit_cache_t cache;
+ long limit, cache_page_size;
+ int max_page_factor;
unsigned long exec_page_size;
+ limit = (long)
+ jit_context_get_meta_numeric(context, JIT_OPTION_CACHE_LIMIT);
+ cache_page_size = (long)
+ jit_context_get_meta_numeric(context, JIT_OPTION_CACHE_PAGE_SIZE);
+ max_page_factor = (int)
+ jit_context_get_meta_numeric(context, JIT_OPTION_CACHE_MAX_PAGE_FACTOR);
+
/* Allocate space for the cache control structure */
if((cache = (jit_cache_t )jit_malloc(sizeof(struct jit_cache))) == 0)
{
* indicates the maximum cache page size as multiple of
* "max_page_factor" and "cache_page_size".
*/
-jit_cache_t _jit_cache_create(long limit,
- long cache_page_size,
- int max_page_factor);
+jit_cache_t _jit_cache_create(jit_context_t context);
/*
* Destroy a code cache.
jit_meta_free(&(context->meta), type);
}
-struct jit_cache *_jit_context_get_cache(jit_context_t context)
+struct jit_cache *
+_jit_context_get_cache(jit_context_t context)
{
- if(!(context->cache))
+ if(!context->cache)
{
- context->cache = _jit_cache_create
- ((long)jit_context_get_meta_numeric
- (context, JIT_OPTION_CACHE_LIMIT),
- (long)jit_context_get_meta_numeric
- (context, JIT_OPTION_CACHE_PAGE_SIZE),
- (int)jit_context_get_meta_numeric
- (context, JIT_OPTION_CACHE_MAX_PAGE_FACTOR));
+ context->cache = _jit_cache_create(context);
}
return context->cache;
}