/*@
* @deftypefun jit_function_t jit_function_from_vtable_pointer (jit_context_t context, {void *} vtable_pointer)
* Convert a vtable_pointer back into a function. Returns NULL if the
* vtable_pointer does not correspond to a function in the specified context.
* @end deftypefun
@*/
jit_function_t jit_function_from_vtable_pointer(jit_context_t context, void *vtable_pointer)
{
#ifdef JIT_BACKEND_INTERP
/* In the interpreted version, the function pointer is used in vtables */
jit_function_t func = (jit_function_t)vtable_pinter;
if(func && func->context == context)
{
return func;
}
return 0;
#else
void *cookie;
if(!context || !(context->cache))
{
return 0;
}
return (jit_function_t)_jit_cache_get_method
(context->cache, vtable_pointer, &cookie);
#endif
}