ruby-changes:62103
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 2 Jul 2020 14:34:53 +0900 (JST)
Subject: [ruby-changes:62103] bf3f03c925 (master): integer.rbinc: do not generate C functions
https://git.ruby-lang.org/ruby.git/commit/?id=bf3f03c925 From bf3f03c9258dab45fee891007c7806f2d095db09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Thu, 2 Jul 2020 09:44:23 +0900 Subject: integer.rbinc: do not generate C functions This changeset changes for instance Integer#integer? from: == disasm: #<ISeq:to_i@<internal:integer>:66 (66,2)-(69,5)> (catch: FALSE) 0000 opt_invokebuiltin_delegate_leave <builtin!_bi7/0>, 0 (68)[LiCa] 0003 leave (69)[Re] to: == disasm: #<ISeq:to_i@<internal:integer>:66 (66,2)-(69,5)> (catch: FALSE) 0000 putself (68)[LiCa] 0001 leave (69)[Re] which is of course faster. diff --git a/integer.rb b/integer.rb index a9e2734..daf11b0 100644 --- a/integer.rb +++ b/integer.rb @@ -23,8 +23,7 @@ class Integer https://github.com/ruby/ruby/blob/trunk/integer.rb#L23 # # Since +int+ is already an Integer, this always returns +true+. def integer? - Primitive.attr! 'inline' - Primitive.cexpr! 'Qtrue' + return true end def magnitude @@ -53,8 +52,7 @@ class Integer https://github.com/ruby/ruby/blob/trunk/integer.rb#L52 # # For example, <code>?a.ord</code> returns 97 both in 1.8 and 1.9. def ord - Primitive.attr! 'inline' - Primitive.cexpr! 'self' + return self end # call-seq: @@ -64,8 +62,7 @@ class Integer https://github.com/ruby/ruby/blob/trunk/integer.rb#L62 # # #to_int is an alias for #to_i. def to_i - Primitive.attr! 'inline' - Primitive.cexpr! 'self' + return self end # call-seq: @@ -73,8 +70,7 @@ class Integer https://github.com/ruby/ruby/blob/trunk/integer.rb#L70 # # Since +int+ is already an Integer, returns +self+. def to_int - Primitive.attr! 'inline' - Primitive.cexpr! 'self' + return self end # call-seq: -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/