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: 00938d2f71b3
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 493387b9b41d
Choose a head ref
  • 8 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 28, 2016

  1. [Truffle] Style fix.

    chrisseaton committed Nov 28, 2016
    Copy the full SHA
    46c2827 View commit details
  2. Copy the full SHA
    e5105db View commit details
  3. [Truffle] rb_str_cat

    chrisseaton committed Nov 28, 2016
    Copy the full SHA
    b8f6300 View commit details
  4. Copy the full SHA
    210a8af View commit details
  5. Copy the full SHA
    d53f785 View commit details
  6. Copy the full SHA
    78abdb7 View commit details
  7. [Truffle] Actually use C extensions for the C extension benchmarks, b…

    …ut disable compilation for now.
    chrisseaton committed Nov 28, 2016
    Copy the full SHA
    b5efc52 View commit details
  8. 1
    Copy the full SHA
    493387b View commit details
7 changes: 4 additions & 3 deletions ci.hocon
Original file line number Diff line number Diff line change
@@ -357,7 +357,8 @@ server-benchmarks: {

cext-benchmarks: ${sulong} {
environment: {
JRUBY_OPTS: "-Xtruffle.cexts.log.load=true"
JRUBY_OPTS: "-Xtruffle.cexts.log.load=true -Dgraal.TruffleCompileOnly=nothing",
USE_CEXTS: "true"
}

setup: ${sulong.setup} ${gem-test-pack.setup} ${bench.setup} [
@@ -414,7 +415,7 @@ test-compilation-flags: {
}
}

deployBinaries: {
deploy-binaries: {
run: [
[mx, deploy-binary-if-truffle-head, jruby-binary-snapshots]
]
@@ -517,5 +518,5 @@ builds: [

{name: ruby-benchmarks-cext} ${common} ${daily-bench-caps} ${jruby-truffle-cexts} ${cext-benchmarks},

{name: ruby-deploy-binaries} ${common} ${gate-caps} ${deployBinaries}
{name: ruby-deploy-binaries} ${common} ${gate-caps} ${deploy-binaries}
]
19 changes: 19 additions & 0 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -45,6 +45,14 @@ extern "C" {

#define HAVE_RB_IO_T

// Overrides

#ifdef memcpy
#undef memcpy
#endif

#define memcpy truffle_managed_memcpy

// Macros

#define NORETURN(X) __attribute__((__noreturn__)) X
@@ -491,6 +499,17 @@ MUST_INLINE int rb_jt_scan_args_11(int argc, VALUE *argv, const char *format, VA
return argc - 1;
}

MUST_INLINE int rb_jt_scan_args_12(int argc, VALUE *argv, const char *format, VALUE *v1, VALUE *v2, VALUE *v3) {
if (argc < 1) {
rb_jt_error("rb_jt_scan_args_12 error case not implemented");
abort();
}
*v1 = argv[0];
if (argc >= 2) *v2 = argv[1];
if (argc >= 3) *v3 = argv[2];
return argc - 1;
}

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

// Calls
3 changes: 1 addition & 2 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -374,7 +374,7 @@ VALUE rb_intern_str(VALUE string) {
}

VALUE rb_str_cat(VALUE string, const char *to_concat, long length) {
truffle_invoke(RUBY_CEXT, "rb_str_cat", string, rb_str_new_cstr(to_concat), length);
truffle_invoke((void *)string, "concat", rb_str_new(to_concat, length));
return string;
}

@@ -456,7 +456,6 @@ int RARRAY_LENINT(VALUE array) {
}

VALUE *RARRAY_PTR(VALUE array) {
// Needs to return a fake VALUE* which actually calls back into Ruby when read or written
return (VALUE*) truffle_invoke(RUBY_CEXT, "RARRAY_PTR", array);
}

Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
)
public class StringCharPointerMessageResolution {

// TODO 28-Nov-16 could this be a Ruby class?

@CanResolve
public abstract static class CharPointerCheckNode extends Node {

36 changes: 27 additions & 9 deletions truffle/src/main/ruby/core/truffle/cext.rb
Original file line number Diff line number Diff line change
@@ -306,10 +306,6 @@ def rb_intern_str(string)
string.intern
end

def rb_str_cat(string, to_concat, length)
raise 'not implemented'
end

def rb_string_value_cstr_check(string)
!string.include?("\0")
end
@@ -319,7 +315,33 @@ def rb_String(value)
end

def RARRAY_PTR(array)
array
ArrayPointer.new(array)
end

class ArrayPointer

attr_reader :array

def initialize(array)
@array = array
end

def size
array.size
end

def [](offset)
array[index_from_offset(offset)]
end

def []=(offset, value)
array[index_from_offset(offset)] = value
end

def index_from_offset(offset)
offset / 8
end

end

def rb_Array(value)
@@ -508,10 +530,6 @@ def rb_rational_new(num, den)
Rational(num, den)
end

def rb_complex_new(real, imag)
Complex.new(real, imag)
end

def rb_Complex(real, imag)
Complex.new(real, imag)
end