diff options
author | Noah Gibbs <noah.gibbs@shopify.com> | 2022-05-11 16:20:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 11:20:21 -0400 |
commit | e88ada469976e1dad653748bd2c0bedca9e30981 (patch) | |
tree | aab2347018b139a0f48fc99390f43df7f72e61e5 /yjit.c | |
parent | c00feffb46ac646605adc277b5454e6b067e2d8a (diff) |
Ruby shovel operator (<<) speedup. (#5896)
For string concat, see if compile-time encoding of strings matches.
If so, use simple buffer string concat at runtime. Otherwise, use
encoding-checking string concat.
Notes
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'yjit.c')
-rw-r--r-- | yjit.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -557,6 +557,12 @@ rb_leaf_builtin_function(const rb_iseq_t *iseq) return (const struct rb_builtin_function *)iseq->body->iseq_encoded[1]; } +VALUE +rb_yjit_str_simple_append(VALUE str1, VALUE str2) +{ + return rb_str_cat(str1, RSTRING_PTR(str2), RSTRING_LEN(str2)); +} + struct rb_control_frame_struct * rb_get_ec_cfp(rb_execution_context_t *ec) { @@ -692,6 +698,13 @@ rb_RCLASS_ORIGIN(VALUE c) return RCLASS_ORIGIN(c); } +// Return the string encoding index +int +rb_ENCODING_GET(VALUE obj) +{ + return RB_ENCODING_GET(obj); +} + bool rb_yjit_multi_ractor_p(void) { |