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

Commits on May 4, 2016

  1. Copy the full SHA
    f923dde View commit details
  2. [Truffle] rb_define_module_function returns void, and use truffle_add…

    …ress_to_function on the callback.
    chrisseaton committed May 4, 2016
    Copy the full SHA
    f3ef202 View commit details
  3. Copy the full SHA
    45eac08 View commit details
  4. 2
    Copy the full SHA
    df26e2c View commit details
1 change: 1 addition & 0 deletions bin/jruby-cext-c
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ LL = []
SRC.each do |src|
ll = File.join(File.dirname(src), File.basename(src, '.*') + '.ll')
mx 'su-clang', "-I#{SULONG_DIR}/include", '-Ilib/ruby/truffle/cext', '-S', '-emit-llvm', src, '-o', ll
mx 'su-opt', '-S', '-mem2reg', ll, '-o', ll
LL.push ll
end

2 changes: 1 addition & 1 deletion lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ VALUE rb_define_module_under(VALUE module, const char *name);

void rb_define_method(VALUE module, const char *name, void *function, int args);
void rb_define_private_method(VALUE module, const char *name, void *function, int args);
int rb_define_module_function(VALUE module, const char *name, void *function, int args);
void rb_define_module_function(VALUE module, const char *name, void *function, int args);

#if defined(__cplusplus)
}
Binary file modified lib/ruby/truffle/cext/ruby.su
Binary file not shown.
4 changes: 2 additions & 2 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -217,6 +217,6 @@ void rb_define_private_method(VALUE module, const char *name, void *function, in
truffle_invoke(RUBY_CEXT, "rb_define_private_method", module, truffle_read_string(name), function, args);
}

int rb_define_module_function(VALUE module, const char *name, void *function, int args) {
return truffle_invoke_i(RUBY_CEXT, "rb_define_module_function", module, truffle_read_string(name), function, args);
void rb_define_module_function(VALUE module, const char *name, void *function, int args) {
truffle_invoke(RUBY_CEXT, "rb_define_module_function", module, truffle_read_string(name), truffle_address_to_function(function), args);
}
22 changes: 11 additions & 11 deletions truffle/src/main/java/org/jruby/truffle/interop/CExtNodes.java
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
@CoreClass(name = "Truffle::CExt")
public class CExtNodes {

@CoreMethod(names = "NUM2INT", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "NUM2INT", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class NUM2INTNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -27,7 +27,7 @@ public int num2int(int num) {

}

@CoreMethod(names = "NUM2UINT", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "NUM2UINT", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class NUM2UINTNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -38,7 +38,7 @@ public int num2uint(int num) {

}

@CoreMethod(names = "NUM2LONG", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "NUM2LONG", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class NUM2LONGNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -48,7 +48,7 @@ public long num2long(int num) {

}

@CoreMethod(names = "FIX2INT", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "FIX2INT", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class FIX2INTNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -58,7 +58,7 @@ public int fix2int(int num) {

}

@CoreMethod(names = "FIX2UINT", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "FIX2UINT", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class FIX2UINTNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -69,7 +69,7 @@ public int fix2uint(int num) {

}

@CoreMethod(names = "FIX2LONG", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "FIX2LONG", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class FIX2LONGNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -79,7 +79,7 @@ public long fix2long(int num) {

}

@CoreMethod(names = "INT2NUM", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "INT2NUM", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class INT2NUMNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -89,7 +89,7 @@ public int int2num(int num) {

}

@CoreMethod(names = "INT2FIX", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "INT2FIX", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class INT2FIXNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -99,7 +99,7 @@ public int int2fix(int num) {

}

@CoreMethod(names = "UINT2NUM", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "UINT2NUM", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class UINT2NUMNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -110,7 +110,7 @@ public int uint2num(int num) {

}

@CoreMethod(names = "LONG2NUM", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "LONG2NUM", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class LONG2NUMNode extends CoreMethodArrayArgumentsNode {

@Specialization
@@ -120,7 +120,7 @@ public int long2num(int num) {

}

@CoreMethod(names = "LONG2FIX", isModuleFunction = true, needsSelf = false)
@CoreMethod(names = "LONG2FIX", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class LONG2FIXNode extends CoreMethodArrayArgumentsNode {

@Specialization
10 changes: 7 additions & 3 deletions truffle/src/main/ruby/core/truffle/cext.rb
Original file line number Diff line number Diff line change
@@ -111,15 +111,19 @@ def rb_define_module_under(mod, name)
end

def rb_define_method(mod, name, function, args)
raise 'not implemented'
y = mod.send(:define_method, name) do |*args|
Truffle::Interop.execute(function, self, *args)
end
end

def rb_define_private_method(mod, name, function, args)
raise 'not implemented'
rb_define_method mod, name, function, args
mod.send :private, name
end

def rb_define_module_function(mod, name, function, args)
raise 'not implemented'
rb_define_method mod, name, function, args
mod.send :module_function, name
end

end