Skip to content

Commit 184db4e

Browse files
committed
Move rb_tr_readable and rb_tr_writable entirely to C.
1 parent b3aacb2 commit 184db4e

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,14 +1697,6 @@ def rb_class_inherited_p(ruby_module, object)
16971697
end
16981698
end
16991699

1700-
def rb_tr_readable(mode)
1701-
mode & File::Constants::FMODE_READABLE != 0
1702-
end
1703-
1704-
def rb_tr_writable(mode)
1705-
mode & File::Constants::FMODE_WRITABLE != 0
1706-
end
1707-
17081700
def rb_backref_get
17091701
Primitive.regexp_last_match_get(Truffle::ThreadOperations.ruby_caller_special_variables([Truffle::CExt, Truffle::Interop.singleton_class]))
17101702
end

src/main/c/cext/io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ VALUE rb_get_path(VALUE object) {
153153
}
154154

155155
int rb_tr_readable(int mode) {
156-
return polyglot_as_boolean(polyglot_invoke(RUBY_CEXT, "rb_tr_readable", mode));
156+
return mode & FMODE_READABLE;
157157
}
158158

159159
int rb_tr_writable(int mode) {
160-
return polyglot_as_boolean(polyglot_invoke(RUBY_CEXT, "rb_tr_writable", mode));
160+
return mode & FMODE_WRITABLE;
161161
}
162162

163163
int rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding **enc2_p, int *fmode_p) {

0 commit comments

Comments
 (0)