Skip to content

Commit

Permalink
Switch YJIT to using rb_str_buf_append rather than rb_str_append when…
Browse files Browse the repository at this point in the history
… encodings don't match, as discussed with byroot
  • Loading branch information
noahgibbs authored and byroot committed Jul 6, 2022
1 parent 906f7cb commit a2e0815
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion yjit/bindgen/src/main.rs
Expand Up @@ -64,7 +64,7 @@ fn main() {

// From include/ruby/internal/intern/string.h
.allowlist_function("rb_utf8_str_new")
.allowlist_function("rb_str_append")
.allowlist_function("rb_str_buf_append")
.allowlist_function("rb_str_dup")

// This struct is public to Ruby C extensions
Expand Down
2 changes: 1 addition & 1 deletion yjit/src/codegen.rs
Expand Up @@ -3792,7 +3792,7 @@ fn jit_rb_str_concat(

// If encodings are different, use a slower encoding-aware concatenate
cb.write_label(enc_mismatch);
call_ptr(cb, REG0, rb_str_append as *const u8);
call_ptr(cb, REG0, rb_str_buf_append as *const u8);
// Drop through to return

cb.write_label(ret_label);
Expand Down
4 changes: 2 additions & 2 deletions yjit/src/cruby_bindings.inc.rs
Expand Up @@ -224,10 +224,10 @@ extern "C" {
) -> VALUE;
}
extern "C" {
pub fn rb_str_dup(str_: VALUE) -> VALUE;
pub fn rb_str_buf_append(dst: VALUE, src: VALUE) -> VALUE;
}
extern "C" {
pub fn rb_str_append(dst: VALUE, src: VALUE) -> VALUE;
pub fn rb_str_dup(str_: VALUE) -> VALUE;
}
extern "C" {
pub fn rb_str_intern(str_: VALUE) -> VALUE;
Expand Down

0 comments on commit a2e0815

Please sign in to comment.