diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-11 14:25:11 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-11 14:25:12 -0800 |
commit | 94da5f7c360b64e12c55fa0be266d9f48e66e937 (patch) | |
tree | 41926227dc4246a7f5edbe5a4d66bad0038ca263 | |
parent | 0c0c88d383a09fef18d8cf8a1457d1649a2cbd46 (diff) | |
download | ruby-94da5f7c360b64e12c55fa0be266d9f48e66e937.tar.gz |
Rename builtin attr :inline to :leaf
-rw-r--r-- | compile.c | 6 | ||||
-rw-r--r-- | kernel.rb | 4 | ||||
-rw-r--r-- | numeric.rb | 28 | ||||
-rw-r--r-- | tool/mk_builtin_loader.rb | 5 | ||||
-rw-r--r-- | vm_core.h | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 | ||||
-rw-r--r-- | yjit.c | 2 |
7 files changed, 23 insertions, 26 deletions
@@ -8214,7 +8214,7 @@ delegate_call_p(const rb_iseq_t *iseq, unsigned int argc, const LINK_ANCHOR *arg } } -// Compile Primitive.attr! :inline, ... +// Compile Primitive.attr! :leaf, ... static int compile_builtin_attr(rb_iseq_t *iseq, const NODE *node) { @@ -8233,8 +8233,8 @@ compile_builtin_attr(rb_iseq_t *iseq, const NODE *node) if (!SYMBOL_P(symbol)) goto non_symbol_arg; string = rb_sym_to_s(symbol); - if (strcmp(RSTRING_PTR(string), "inline") == 0) { - ISEQ_BODY(iseq)->builtin_attrs |= BUILTIN_ATTR_INLINE; + if (strcmp(RSTRING_PTR(string), "leaf") == 0) { + ISEQ_BODY(iseq)->builtin_attrs |= BUILTIN_ATTR_LEAF; } else { goto unknown_arg; @@ -16,7 +16,7 @@ module Kernel #++ # def class - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_obj_class(self)' end @@ -65,7 +65,7 @@ module Kernel #++ # def frozen? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_obj_frozen_p(self)' end diff --git a/numeric.rb b/numeric.rb index 23063aefad..c7ff585db8 100644 --- a/numeric.rb +++ b/numeric.rb @@ -86,7 +86,7 @@ class Integer # # Returns +int+, negated. def -@ - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_uminus(self)' end @@ -102,7 +102,7 @@ class Integer # # sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA" def ~ - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_comp(self)' end @@ -117,7 +117,7 @@ class Integer # 12345.abs #=> 12345 # def abs - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_abs(self)' end @@ -163,7 +163,7 @@ class Integer # raise "overflow" # end def bit_length - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_bit_length(self)' end @@ -172,7 +172,7 @@ class Integer # # Returns +true+ if +int+ is an even number. def even? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_even_p(self)' end @@ -191,7 +191,7 @@ class Integer # # Returns +true+ if +int+ is an odd number. def odd? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_odd_p(self)' end @@ -226,7 +226,7 @@ class Integer # (256**40 - 1).size #=> 40 # def size - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_size(self)' end @@ -251,7 +251,7 @@ class Integer # # Returns +true+ if +int+ has a zero value. def zero? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_int_zero_p(self)' end @@ -316,12 +316,12 @@ class Float # 34.56.abs #=> 34.56 # def abs - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_float_abs(self)' end def magnitude - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_float_abs(self)' end @@ -332,7 +332,7 @@ class Float # Returns +float+, negated. # def -@ - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'rb_float_uminus(self)' end @@ -343,7 +343,7 @@ class Float # Returns +true+ if +float+ is 0.0. # def zero? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'RBOOL(FLOAT_ZERO_P(self))' end @@ -354,7 +354,7 @@ class Float # Returns +true+ if +float+ is greater than 0. # def positive? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'RBOOL(RFLOAT_VALUE(self) > 0.0)' end @@ -365,7 +365,7 @@ class Float # Returns +true+ if +float+ is less than 0. # def negative? - Primitive.attr! :inline + Primitive.attr! :leaf Primitive.cexpr! 'RBOOL(RFLOAT_VALUE(self) < 0.0)' end diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index d6cd32e97c..fc6900808f 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -6,7 +6,7 @@ require_relative 'ruby_vm/helpers/c_escape' SUBLIBS = {} REQUIRED = {} -BUILTIN_ATTRS = %w[inline] +BUILTIN_ATTRS = %w[leaf] def string_literal(lit, str = []) while lit @@ -46,15 +46,12 @@ end def inline_attrs(args) raise "args was empty" if args.empty? - attrs = [] args.each do |arg| attr = symbol_literal(arg) unless BUILTIN_ATTRS.include?(attr) raise "attr (#{attr}) was not in: #{BUILTIN_ATTRS.join(', ')}" end - attrs << attr end - attrs end def make_cfunc_name inlines, name, lineno @@ -368,7 +368,7 @@ enum rb_iseq_type { // Attributes specified by Primitive.attr! enum rb_builtin_attr { // If true, this ISeq does not call methods. - BUILTIN_ATTR_INLINE = 0x01, + BUILTIN_ATTR_LEAF = 0x01, }; struct rb_iseq_constant_body { diff --git a/vm_insnhelper.c b/vm_insnhelper.c index b3e732d26a..f513a9be09 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -6395,7 +6395,7 @@ lookup_builtin_invoker(int argc) static inline VALUE invoke_bf(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const struct rb_builtin_function* bf, const VALUE *argv) { - const bool canary_p = ISEQ_BODY(reg_cfp->iseq)->builtin_attrs & BUILTIN_ATTR_INLINE; // Verify an assumption of `Primitive.attr! :inline` + const bool canary_p = ISEQ_BODY(reg_cfp->iseq)->builtin_attrs & BUILTIN_ATTR_LEAF; // Verify an assumption of `Primitive.attr! :leaf` SETUP_CANARY(canary_p); VALUE ret = (*lookup_builtin_invoker(bf->argc))(ec, reg_cfp->self, argv, (rb_insn_func_t)bf->func_ptr); CHECK_CANARY(canary_p, BIN(invokebuiltin)); @@ -735,7 +735,7 @@ rb_leaf_invokebuiltin_iseq_p(const rb_iseq_t *iseq) return (iseq->body->iseq_size == (invokebuiltin_len + leave_len) && rb_vm_insn_addr2opcode((void *)iseq->body->iseq_encoded[0]) == BIN(opt_invokebuiltin_delegate_leave) && rb_vm_insn_addr2opcode((void *)iseq->body->iseq_encoded[invokebuiltin_len]) == BIN(leave) && - (iseq->body->builtin_attrs & BUILTIN_ATTR_INLINE) != 0 + (iseq->body->builtin_attrs & BUILTIN_ATTR_LEAF) != 0 ); } |