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: 22b7ca8a6b26
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 12d6e841c686
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on May 22, 2016

  1. Copy the full SHA
    11114df View commit details
  2. Copy the full SHA
    12d6e84 View commit details
7 changes: 4 additions & 3 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -99,10 +99,11 @@ int RARRAY_LEN(VALUE array);
int RARRAY_LENINT(VALUE array);
VALUE *RARRAY_PTR(VALUE array);
VALUE RARRAY_AREF(VALUE array, long index);
VALUE rb_Array(VALUE value);
VALUE rb_ary_new(void);
VALUE rb_ary_new_capa(long capacity);
#define rb_ary_new2 rb_ary_new_capa
void rb_ary_push(VALUE array, VALUE value);
VALUE rb_ary_push(VALUE array, VALUE value);
VALUE rb_ary_pop(VALUE array);
void rb_ary_store(VALUE array, long index, VALUE value);
VALUE rb_ary_entry(VALUE array, long index);
@@ -112,11 +113,11 @@ VALUE rb_ary_dup(VALUE array);

VALUE rb_hash_new(void);
VALUE rb_hash_aref(VALUE hash, VALUE key);
void rb_hash_aset(VALUE hash, VALUE key, VALUE value);
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE value);

// Utilities

void rb_scan_args(int argc, VALUE *argv, const char *format, ...);
int rb_scan_args(int argc, VALUE *argv, const char *format, ...);

// Calls

Binary file modified lib/ruby/truffle/cext/ruby.su
Binary file not shown.
1 change: 0 additions & 1 deletion spec/ruby/optional/capi/ext/jruby_truffle.h
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
#undef RUBYSPEC_CAPI_JRUBY_TRUFFLE_H

/* Array */
#undef HAVE_RB_ARRAY
#undef HAVE_RARRAY_PTR
#undef HAVE_RB_ARY_AREF
#undef HAVE_RB_ARY_CLEAR
2 changes: 0 additions & 2 deletions spec/truffle/tags/optional/capi/array_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:C-API Array function rb_Array returns obj if it is an array
fails:C-API Array function rb_Array tries to convert obj to an array
fails:C-API Array function rb_Array returns obj wrapped in an array if it cannot be converted to an array
fails:C-API Array function rb_ary_new3 returns an array with the passed cardinality and varargs
fails:C-API Array function rb_ary_new_from_args returns an array with the passed cardinality and varargs
14 changes: 10 additions & 4 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -154,6 +154,10 @@ VALUE RARRAY_AREF(VALUE array, long index) {
return truffle_read_idx(array, (int) index);
}

VALUE rb_Array(VALUE array) {
return truffle_invoke(RUBY_CEXT, "rb_Array", array);
}

VALUE rb_ary_new_capa(long capacity) {
return (VALUE) truffle_invoke(RUBY_CEXT, "rb_ary_new_capa", capacity);
}
@@ -162,8 +166,9 @@ VALUE rb_ary_new() {
return (VALUE) truffle_invoke(RUBY_CEXT, "rb_ary_new");
}

void rb_ary_push(VALUE array, VALUE value) {
VALUE rb_ary_push(VALUE array, VALUE value) {
truffle_invoke(array, "push", value);
return array;
}

VALUE rb_ary_pop(VALUE array) {
@@ -192,14 +197,15 @@ VALUE rb_hash_aref(VALUE hash, VALUE key) {
return truffle_read(hash, key);
}

void rb_hash_aset(VALUE hash, VALUE key, VALUE value) {
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE value) {
truffle_write(hash, key, value);
return value;
}

// Utilities

void rb_scan_args(int argc, VALUE *argv, const char *format, ...) {
truffle_invoke(RUBY_CEXT, "rb_scan_args", argc, argv, format /*, where to get args? */);
int rb_scan_args(int argc, VALUE *argv, const char *format, ...) {
return truffle_invoke_i(RUBY_CEXT, "rb_scan_args", argc, argv, format /*, where to get args? */);
}

// Calls
4 changes: 4 additions & 0 deletions truffle/src/main/ruby/core/truffle/cext.rb
Original file line number Diff line number Diff line change
@@ -78,6 +78,10 @@ def RARRAY_PTR(array)
array
end

def rb_Array(value)
Array(value)
end

def rb_ary_new
[]
end