All pastes #282458 Raw Edit

Mine

public text v1 · immutable
#282458 ·published 2006-12-17 16:30 UTC
rendered paste body
/*@
 * @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
}