diff options
author | John Hawthorn <[email protected]> | 2025-05-26 11:48:41 -0700 |
---|---|---|
committer | John Hawthorn <[email protected]> | 2025-05-28 11:44:07 -0400 |
commit | d1343e12d253cef9c8af22ff58275d28c484d6f2 (patch) | |
tree | 82b03d79298f8fdf55032fe90ec8a66dfc51761d /include/ruby | |
parent | 3935b1c401d00f52b9ee0ce0b58767cc32e280fc (diff) |
Use flag for RCLASS_IS_INITIALIZED
Previously we used a flag to set whether a module was uninitialized.
When checked whether a class was initialized, we first had to check that
it had a non-zero superclass, as well as that it wasn't BasicObject.
With the advent of namespaces, RCLASS_SUPER is now an expensive
operation, and though we could just check for the prime superclass, we
might as well take this opportunity to use a flag so that we can perform
the initialized check with as few instructions as possible.
It's possible in the future that we could prevent uninitialized classes
from being available to the user, but currently there are a few ways to
do that.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13443
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/internal/core/rclass.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/ruby/internal/core/rclass.h b/include/ruby/internal/core/rclass.h index b0b6bfc80c..6f78cc569b 100644 --- a/include/ruby/internal/core/rclass.h +++ b/include/ruby/internal/core/rclass.h @@ -58,7 +58,7 @@ enum ruby_rmodule_flags { * rb_mod_refine() has this flag set. This is the bit which controls * difference between normal inclusion versus refinements. */ - RMODULE_IS_REFINEMENT = RUBY_FL_USER3 + RMODULE_IS_REFINEMENT = RUBY_FL_USER1 }; struct RClass; /* Opaque, declared here for RCLASS() macro. */ |