summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compile.c6
-rw-r--r--kernel.rb4
-rw-r--r--numeric.rb28
-rw-r--r--tool/mk_builtin_loader.rb5
-rw-r--r--vm_core.h2
-rw-r--r--vm_insnhelper.c2
-rw-r--r--yjit.c2
7 files changed, 23 insertions, 26 deletions
diff --git a/compile.c b/compile.c
index 76658fc153..572e727085 100644
--- a/compile.c
+++ b/compile.c
@@ -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;
diff --git a/kernel.rb b/kernel.rb
index 24a51310f5..c8cbc99175 100644
--- a/kernel.rb
+++ b/kernel.rb
@@ -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
diff --git a/vm_core.h b/vm_core.h
index 53019b08a3..c6af487075 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -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));
diff --git a/yjit.c b/yjit.c
index 50e5818c13..637941ea48 100644
--- a/yjit.c
+++ b/yjit.c
@@ -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
);
}