Skip to content

Commit 31b10eb

Browse files
committed
Call the :vm_set_class primitive in IO#reopen directly
* There are no other usages anymore.
1 parent ef0022e commit 31b10eb

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/main/ruby/core/io.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,8 @@ def reopen(other, mode=undefined)
22072207

22082208
Truffle::IOOperations.dup2_with_cloexec(io.fileno, @descriptor)
22092209

2210-
Truffle::Internal::Unsafe.set_class self, io.class
2210+
Truffle.invoke_primitive :vm_set_class, self, io.class
2211+
22112212
if io.respond_to?(:path)
22122213
@path = io.path
22132214
end

src/main/ruby/core/truffle/internal.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@
3535
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636

3737
module Truffle::Internal
38-
39-
module Unsafe
40-
def self.set_class(obj, cls)
41-
Truffle.primitive :vm_set_class
42-
43-
if obj.kind_of? ImmediateValue
44-
raise TypeError, 'Can not change the class of an immediate'
45-
end
46-
47-
raise ArgumentError, "Class #{cls} is not compatible with #{obj.inspect}"
48-
end
49-
end
50-
5138
def self.get_data(path, offset)
5239
file = File.open(path)
5340
file.seek(offset)

0 commit comments

Comments
 (0)