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

Commits on Jul 26, 2016

  1. Copy the full SHA
    2d09106 View commit details
  2. 1
    Copy the full SHA
    3adcf7a View commit details
Showing with 20 additions and 9 deletions.
  1. +2 −2 lib/ruby/truffle/cext/ruby.h
  2. +15 −1 tool/jt.rb
  3. +3 −6 truffle/src/main/c/cext/ruby.c
4 changes: 2 additions & 2 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ extern "C" {

// Support

#define RUBY_CEXT truffle_import_cached("ruby_cext")
#define RUBY_CEXT (void *)truffle_import_cached("ruby_cext")

// Configuration

@@ -571,7 +571,7 @@ int rb_jt_io_handle(VALUE file);

// Data

#define DATA_PTR(value) *((volatile int*) 0)
#define DATA_PTR(value) *((volatile intptr_t*) 0)

// Typed data

16 changes: 15 additions & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -393,6 +393,11 @@ def mspec(command, *args)

sh env_vars, Utilities.find_ruby, 'spec/mspec/bin/mspec', command, '--config', 'spec/truffle/truffle.mspec', *args
end

def newer?(input, output)
return true unless File.exist? output
File.mtime(input) > File.mtime(output)
end
end

module Commands
@@ -618,14 +623,23 @@ def command_p(*args)
def cextc(cext_dir, *clang_opts)
abort "You need to set SULONG_HOME" unless SULONG_HOME

# Ensure ruby.su is up-to-date
ruby_cext_api = "#{JRUBY_DIR}/truffle/src/main/c/cext"
ruby_c = "#{JRUBY_DIR}/truffle/src/main/c/cext/ruby.c"
ruby_h = "#{JRUBY_DIR}/lib/ruby/truffle/cext/ruby.h"
ruby_su = "#{JRUBY_DIR}/lib/ruby/truffle/cext/ruby.su"
if cext_dir != ruby_cext_api and (newer?(ruby_h, ruby_su) or newer?(ruby_c, ruby_su))
puts "Compiling outdated ruby.su"
cextc ruby_cext_api
end

config_file = File.join(cext_dir, '.jruby-cext-build.yml')

unless File.exist?(config_file)
abort "There is no .jruby-cext-build.yml in #{cext_dir} at the moment - I don't know how to build it"
end

config = YAML.load_file(config_file)

config_src = config['src']

if config_src.start_with?('$GEM_HOME/')
9 changes: 3 additions & 6 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -19,9 +19,6 @@
#include <truffle.h>

#include <ruby.h>

#define RUBY_CEXT (void *)truffle_import_cached("ruby_cext")

// Helpers

VALUE rb_f_notimplement(int args_count, const VALUE *args, VALUE object) {
@@ -61,7 +58,7 @@ void rb_check_type(VALUE value, int type) {
}

VALUE rb_obj_is_instance_of(VALUE object, VALUE ruby_class) {
truffle_invoke(RUBY_CEXT, "rb_obj_is_instance_of", object, ruby_class);
return truffle_invoke(RUBY_CEXT, "rb_obj_is_instance_of", object, ruby_class);
}

VALUE rb_obj_is_kind_of(VALUE object, VALUE ruby_class) {
@@ -991,7 +988,7 @@ void rb_fd_fix_cloexec(int fd) {
}

int rb_jt_io_handle(VALUE io) {
return (VALUE) truffle_invoke(RUBY_CEXT, "rb_jt_io_handle", io);
return truffle_invoke_i(RUBY_CEXT, "rb_jt_io_handle", io);
}

// Data
@@ -1004,7 +1001,7 @@ VALUE rb_data_typed_object_wrap(VALUE ruby_class, void *data, const rb_data_type

VALUE rb_data_typed_object_zalloc(VALUE ruby_class, size_t size, const rb_data_type_t *data_type) {
VALUE obj = rb_data_typed_object_wrap(ruby_class, 0, data_type);
DATA_PTR(obj) = calloc(1, size);
DATA_PTR(obj) = (intptr_t) calloc(1, size);
return obj;
}