diff options
author | Noah Gibbs <noah.gibbs@shopify.com> | 2022-05-21 00:39:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 19:39:37 -0400 |
commit | 50bad7159a8e1f9846f37421c941f6fa8f087591 (patch) | |
tree | a4dce74f53c7e909733f01ebc90d770506365d1f /yjit/src/cruby.rs | |
parent | a97fbc108bd23e669a27356be83c1a515d469af0 (diff) |
Special-case jit_guard_known_class for strings. This can remove (#5920)
runtime guard-checks for String#to_s, making some blocks too
short to invalidate later. Add NOPs in those cases to reserve space.
Notes
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'yjit/src/cruby.rs')
-rw-r--r-- | yjit/src/cruby.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/yjit/src/cruby.rs b/yjit/src/cruby.rs index 0afbd6451b..20091bf77a 100644 --- a/yjit/src/cruby.rs +++ b/yjit/src/cruby.rs @@ -461,6 +461,11 @@ impl VALUE { self == Qnil } + /// Returns true or false depending whether the value is a string + pub fn string_p(self) -> bool { + unsafe { CLASS_OF(self) == rb_cString } + } + /// Read the flags bits from the RBasic object, then return a Ruby type enum (e.g. RUBY_T_ARRAY) pub fn builtin_type(self) -> ruby_value_type { assert!(!self.special_const_p()); |