Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-context.c view on Meta::CPAN
context->memory_manager = manager;
}
else
{
context->memory_manager = jit_default_memory_manager();
}
}
/*@
* @deftypefun int jit_context_set_meta (jit_context_t @var{context}, int @var{type}, void *@var{data}, jit_meta_free_func @var{free_data})
* Tag a context with some metadata. Returns zero if out of memory.
*
* Metadata may be used to store dependency graphs, branch prediction
* information, or any other information that is useful to optimizers
* or code generators. It can also be used by higher level user code
* to store information about the context that is specific to the
* virtual machine or language.
*
* If the @var{type} already has some metadata associated with it, then
* the previous value will be freed.
* @end deftypefun
@*/
int
jit_context_set_meta(jit_context_t context, int type, void *data, jit_meta_free_func free_data)
{
return jit_meta_set(&(context->meta), type, data, free_data, 0);
}
/*@
* @deftypefun int jit_context_set_meta_numeric (jit_context_t @var{context}, int @var{type}, jit_nuint @var{data})
* Tag a context with numeric metadata. Returns zero if out of memory.
* This function is more convenient for accessing the context's
* special option values:
*
* @table @code
* @vindex JIT_OPTION_CACHE_LIMIT
* @item JIT_OPTION_CACHE_LIMIT
* A numeric option that indicates the maximum size in bytes of the function
* cache. If set to zero (the default), the function cache is unlimited
* in size.
*
* @vindex JIT_OPTION_CACHE_PAGE_SIZE
* @item JIT_OPTION_CACHE_PAGE_SIZE
* A numeric option that indicates the size in bytes of a single page in the
* function cache. Memory is allocated for the cache in chunks of
* this size. If set to zero, the cache page size is set to an
* internally-determined default (usually 128k). The cache page size
* also determines the maximum size of a single compiled function.
*
* @vindex JIT_OPTION_PRE_COMPILE
* @item JIT_OPTION_PRE_COMPILE
* A numeric option that indicates that this context is being used
* for pre-compilation if it is set to a non-zero value. Code within
* pre-compiled contexts cannot be executed directly. Instead, they
* can be written out to disk in ELF format to be reloaded at
* some future time.
*
* @vindex JIT_OPTION_DONT_FOLD
* @item JIT_OPTION_DONT_FOLD
* A numeric option that disables constant folding when it is set to a
* non-zero value. This is useful for debugging, as it forces @code{libjit} to
* always execute constant expressions at run time, instead of at compile time.
*
* @vindex JIT_OPTION_POSITION_INDEPENDENT
* @item JIT_OPTION_POSITION_INDEPENDENT
* A numeric option that forces generation of position-independent code (PIC)
* if it is set to a non-zero value. This may be mainly useful for pre-compiled
* contexts.
* @end table
*
* Metadata type values of 10000 or greater are reserved for internal use.
* @end deftypefun
@*/
int
jit_context_set_meta_numeric(jit_context_t context, int type, jit_nuint data)
{
return jit_meta_set(&(context->meta), type, (void *)data, 0, 0);
}
/*@
* @deftypefun {void *} jit_context_get_meta (jit_context_t @var{context}, int @var{type})
* Get the metadata associated with a particular tag. Returns NULL
* if @var{type} does not have any metadata associated with it.
* @end deftypefun
@*/
void *
jit_context_get_meta(jit_context_t context, int type)
{
return jit_meta_get(context->meta, type);
}
/*@
* @deftypefun jit_nuint jit_context_get_meta_numeric (jit_context_t @var{context}, int @var{type})
* Get the metadata associated with a particular tag. Returns zero
* if @var{type} does not have any metadata associated with it.
* This version is more convenient for the pre-defined numeric option values.
* @end deftypefun
@*/
jit_nuint
jit_context_get_meta_numeric(jit_context_t context, int type)
{
return (jit_nuint)jit_meta_get(context->meta, type);
}
/*@
* @deftypefun void jit_context_free_meta (jit_context_t @var{context}, int @var{type})
* Free metadata of a specific type on a context. Does nothing if
* the @var{type} does not have any metadata associated with it.
* @end deftypefun
@*/
void
jit_context_free_meta(jit_context_t context, int type)
{
jit_meta_free(&(context->meta), type);
}
( run in 0.426 second using v1.01-cache-2.11-cpan-02777c243ea )