Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 56b8b9300f05
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 44e9778ef649
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jul 22, 2016

  1. [Truffle] Implement rb_str_new

    lxp committed Jul 22, 2016
    Copy the full SHA
    126bf9b View commit details
  2. Merge pull request #4026 from lxp/implement-rb-str-new

    [Truffle] Implement rb_str_new
    eregon authored Jul 22, 2016
    Copy the full SHA
    44e9778 View commit details
Showing with 5 additions and 0 deletions.
  1. +1 −0 lib/ruby/truffle/cext/ruby.h
  2. +4 −0 truffle/src/main/c/cext/ruby.c
1 change: 1 addition & 0 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -109,6 +109,7 @@ double RFLOAT_VALUE(VALUE value);
char *RSTRING_PTR(VALUE string);
int RSTRING_LEN(VALUE string);
VALUE rb_intern_str(VALUE string);
VALUE rb_str_new(const char *string, long length);
VALUE rb_str_new_cstr(const char *string);
#define rb_str_new2 rb_str_new_cstr
void rb_str_cat(VALUE string, const char *to_concat, long length);
4 changes: 4 additions & 0 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -157,6 +157,10 @@ int RSTRING_LEN(VALUE string) {
return truffle_invoke_i(string, "bytesize");
}

VALUE rb_str_new(const char *string, long length) {
return (VALUE) truffle_invoke(RUBY_CEXT, "rb_str_new_cstr", truffle_read_n_string(string, length));
}

VALUE rb_str_new_cstr(const char *string) {
if (truffle_is_truffle_object((VALUE) string)) {
return truffle_invoke(RUBY_CEXT, "to_ruby_string", string);