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: a5e393fc562e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 37d2e7128e13
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 3, 2016

  1. Copy the full SHA
    051a286 View commit details
  2. Copy the full SHA
    a39b92a View commit details
  3. Copy the full SHA
    37d2e71 View commit details
Showing with 9 additions and 3 deletions.
  1. +1 −1 bin/jruby-cext-c
  2. +3 −1 lib/ruby/truffle/cext/ruby.h
  3. +1 −1 tool/jt.rb
  4. +4 −0 truffle/src/main/ruby/core/truffle/cext.rb
2 changes: 1 addition & 1 deletion bin/jruby-cext-c
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ lls = []

src.each do |src|
ll = File.join(File.dirname(out), File.basename(src, '.*') + '.ll')
mx 'su-clang', "-I#{SULONG_DIR}/include", '-Ilib/ruby/truffle/cext', '-S', '-emit-llvm', src, '-o', ll
mx 'su-clang', "-I#{SULONG_DIR}/include", '-Ilib/ruby/truffle/cext', '-S', '-emit-llvm', *ARGV.drop(1), src, '-o', ll
mx 'su-opt', '-S', '-mem2reg', ll, '-o', ll
lls.push ll
end
4 changes: 3 additions & 1 deletion lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -25,6 +25,8 @@ extern "C" {

#include <truffle.h>

#define RUBY_CEXT truffle_import_cached("ruby_cext")

#define xmalloc malloc
#define xfree free
#define ALLOC_N(type, n) malloc(sizeof(type) * n)
@@ -149,7 +151,7 @@ int rb_scan_args(int argc, VALUE *argv, const char *format, ...);

// Calls

#define rb_funcall(object, name, argc, ...) truffle_invoke(object, "__send__", name, ##__VA_ARGS__)
#define rb_funcall(object, name, ...) truffle_invoke(RUBY_CEXT, "rb_funcall", object, name, __VA_ARGS__)

VALUE rb_yield(VALUE value);

2 changes: 1 addition & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -618,7 +618,7 @@ def test_cexts(*args)
end
['oily_png', 'psd_native'].each do |gem_name|
config = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
sh Utilities.find_jruby, "#{JRUBY_DIR}/bin/jruby-cext-c", config
sh Utilities.find_jruby, "#{JRUBY_DIR}/bin/jruby-cext-c", config, '-Werror=implicit-function-declaration'
end
end
private :test_cexts
4 changes: 4 additions & 0 deletions truffle/src/main/ruby/core/truffle/cext.rb
Original file line number Diff line number Diff line change
@@ -186,6 +186,10 @@ def rb_undef(mod, name)
mod.send(:undef_method, name)
end
end

def rb_funcall(object, name, argc, args)
object.__send__(name, *args)
end
end

Truffle::Interop.export(:ruby_cext, Truffle::CExt)