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

Commits on Sep 26, 2016

  1. Copy the full SHA
    e35040f View commit details
  2. Copy the full SHA
    cc9cbc5 View commit details
Showing with 11 additions and 20 deletions.
  1. +7 −16 truffle/src/main/c/cext/ruby.c
  2. +4 −4 truffle/src/main/ruby/core/truffle/cext.rb
23 changes: 7 additions & 16 deletions truffle/src/main/c/cext/ruby.c
Original file line number Diff line number Diff line change
@@ -678,33 +678,24 @@ VALUE rb_yield(VALUE value) {

// Instance variables

VALUE rb_iv_set(VALUE object, const char *name, VALUE value) {
if (name[0] == '@') {
truffle_write(object, name, value);
} else {
truffle_invoke(RUBY_CEXT, "rb_iv_set_hidden", object, rb_str_new_cstr(name), value);
}
VALUE rb_iv_get(VALUE object, const char *name) {
return truffle_invoke(RUBY_CEXT, "rb_iv_get", object, rb_str_new_cstr(name));
}

VALUE rb_iv_set(VALUE object, const char *name, VALUE value) {
truffle_invoke(RUBY_CEXT, "rb_iv_set", object, rb_str_new_cstr(name), value);
return value;
}

VALUE rb_iv_get(VALUE object, const char *name) {
if (name[0] == '@') {
return truffle_read(object, name);
} else {
return truffle_invoke(RUBY_CEXT, "rb_iv_get_hidden", object, rb_str_new_cstr(name));
}
VALUE rb_ivar_get(VALUE object, ID name) {
return truffle_read(object, name);
}

VALUE rb_ivar_set(VALUE object, ID name, VALUE value) {
truffle_write(object, name, value);
return value;
}

VALUE rb_ivar_get(VALUE object, ID name) {
return truffle_read(object, name);
}

VALUE rb_ivar_lookup(VALUE object, const char *name, VALUE default_value) {
return (VALUE) truffle_invoke(RUBY_CEXT, "rb_ivar_lookup", name, default_value);
}
8 changes: 4 additions & 4 deletions truffle/src/main/ruby/core/truffle/cext.rb
Original file line number Diff line number Diff line change
@@ -380,12 +380,12 @@ def rb_raise(object, name)
raise 'not implemented'
end

def rb_iv_set_hidden(object, name, value)
object.instance_variable_set :"@__#{name}", value
def rb_iv_get(object, name)
Truffle.invoke_primitive :object_ivar_get, name.to_sym
end

def rb_iv_get_hidden(object, name)
object.instance_variable_get(:"@__#{name}")
def rb_iv_set(object, name, value)
Truffle.invoke_primitive :object_ivar_set, name.to_sym, value
end

def rb_define_class_under(mod, name, superclass)