Add comments about special runtime routines YJIT calls

When YJIT make calls to routines without reconstructing interpreter
state through jit_prepare_routine_call(), it relies on the routine to
never allocate, raise, and push/pop control frames. Comment about this
on the routines that YJTI calls.

This is probably something we should dynamically verify on debug builds.
It's hard to statically verify this as it requires verifying all
functions in the call tree. Maybe something to look at in the future.
This commit is contained in:
Alan Wu 2021-10-18 11:30:18 -04:00
parent 1e23b1a6c2
commit 5906a5a732
5 changed files with 7 additions and 0 deletions

View file

@ -790,6 +790,8 @@ rb_obj_is_kind_of(VALUE obj, VALUE c)
{
VALUE cl = CLASS_OF(obj);
// Note: YJIT needs this function to never allocate and never raise when
// `c` is a class or a module.
c = class_or_module_required(c);
return RBOOL(class_search_ancestor(cl, RCLASS_ORIGIN(c)));
}