summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorStan Lo <stan.lo@shopify.com>2025-10-02 17:03:25 +0100
committerGitHub <noreply@github.com>2025-10-02 09:03:25 -0700
commit2ed5a02fcca4da4acf4c8c3d7ee4c392fc18d948 (patch)
tree834a2702d97afc92dcd2c905cace45cff46be5e2 /class.c
parent81f253577a77a934bfa02a33d80ca2a7c6af9a04 (diff)
ZJIT: Add `NoSingletonClass` patch point (#14680)
* ZJIT: Add NoSingletonClass patch point This patch point makes sure that when the object has a singleton class, the JIT code is invalidated. As of now, this is only needed for C call optimization. In YJIT, the singleton class guard only applies to Array, Hash, and String. But in ZJIT, we may optimize C calls from gems (e.g. `sqlite3`). So the patch point needs to be applied to a broader range of classes. * ZJIT: Only generate NoSingletonClass guard when the type can have singleton class * ZJIT: Update or forget NoSingletonClass patch point when needed
Diffstat (limited to 'class.c')
-rw-r--r--class.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/class.c b/class.c
index 68a56a129d..7baaa5e715 100644
--- a/class.c
+++ b/class.c
@@ -31,6 +31,7 @@
#include "ruby/st.h"
#include "vm_core.h"
#include "yjit.h"
+#include "zjit.h"
/* Flags of T_CLASS
*
@@ -1309,6 +1310,7 @@ make_singleton_class(VALUE obj)
RBASIC_SET_CLASS(obj, klass);
rb_singleton_class_attached(klass, obj);
rb_yjit_invalidate_no_singleton_class(orig_class);
+ rb_zjit_invalidate_no_singleton_class(orig_class);
SET_METACLASS_OF(klass, METACLASS_OF(rb_class_real(orig_class)));
return klass;