Drop obsoleted BUILTIN_ATTR_NO_GC attribute

The thing that has used this in the past was very buggy, and we've never
revisied it. Let's remove it until we need it again.
This commit is contained in:
Takashi Kokubun 2024-01-16 17:23:46 -08:00
parent 1addb3955c
commit e37a37e696
8 changed files with 11 additions and 25 deletions

View File

@ -8636,9 +8636,6 @@ compile_builtin_attr(rb_iseq_t *iseq, const NODE *node)
if (strcmp(RSTRING_PTR(string), "leaf") == 0) {
ISEQ_BODY(iseq)->builtin_attrs |= BUILTIN_ATTR_LEAF;
}
else if (strcmp(RSTRING_PTR(string), "no_gc") == 0) {
ISEQ_BODY(iseq)->builtin_attrs |= BUILTIN_ATTR_NO_GC;
}
else {
goto unknown_arg;
}

View File

@ -4924,13 +4924,10 @@ module RubyVM::RJIT
asm.comment('inlined leaf builtin')
# Skip this if it doesn't trigger GC
if iseq.body.builtin_attrs & C::BUILTIN_ATTR_NO_GC == 0
# The callee may allocate, e.g. Integer#abs on a Bignum.
# Save SP for GC, save PC for allocation tracing, and prepare
# for global invalidation after GC's VM lock contention.
jit_prepare_routine_call(jit, ctx, asm)
end
# The callee may allocate, e.g. Integer#abs on a Bignum.
# Save SP for GC, save PC for allocation tracing, and prepare
# for global invalidation after GC's VM lock contention.
jit_prepare_routine_call(jit, ctx, asm)
# Call the builtin func (ec, recv, arg1, arg2, ...)
asm.mov(C_ARGS[0], EC)

View File

@ -364,7 +364,6 @@ module RubyVM::RJIT # :nodoc: all
C::BOP_OR = Primitive.cexpr! %q{ SIZET2NUM(BOP_OR) }
C::BOP_PLUS = Primitive.cexpr! %q{ SIZET2NUM(BOP_PLUS) }
C::BUILTIN_ATTR_LEAF = Primitive.cexpr! %q{ SIZET2NUM(BUILTIN_ATTR_LEAF) }
C::BUILTIN_ATTR_NO_GC = Primitive.cexpr! %q{ SIZET2NUM(BUILTIN_ATTR_NO_GC) }
C::HASH_REDEFINED_OP_FLAG = Primitive.cexpr! %q{ SIZET2NUM(HASH_REDEFINED_OP_FLAG) }
C::INTEGER_REDEFINED_OP_FLAG = Primitive.cexpr! %q{ SIZET2NUM(INTEGER_REDEFINED_OP_FLAG) }
C::INVALID_SHAPE_ID = Primitive.cexpr! %q{ SIZET2NUM(INVALID_SHAPE_ID) }

View File

@ -6,7 +6,7 @@ require_relative 'ruby_vm/helpers/c_escape'
SUBLIBS = {}
REQUIRED = {}
BUILTIN_ATTRS = %w[leaf no_gc]
BUILTIN_ATTRS = %w[leaf]
def string_literal(lit, str = [])
while lit

View File

@ -396,7 +396,6 @@ generator = BindingGenerator.new(
BOP_OR
BOP_PLUS
BUILTIN_ATTR_LEAF
BUILTIN_ATTR_NO_GC
HASH_REDEFINED_OP_FLAG
INTEGER_REDEFINED_OP_FLAG
INVALID_SHAPE_ID

View File

@ -365,10 +365,8 @@ enum rb_iseq_type {
enum rb_builtin_attr {
// The iseq does not call methods.
BUILTIN_ATTR_LEAF = 0x01,
// The iseq does not allocate objects.
BUILTIN_ATTR_NO_GC = 0x02,
// This iseq only contains single `opt_invokebuiltin_delegate_leave` instruction with 0 arguments.
BUILTIN_ATTR_SINGLE_NOARG_INLINE = 0x04,
BUILTIN_ATTR_SINGLE_NOARG_INLINE = 0x02,
};
typedef VALUE (*rb_jit_func_t)(struct rb_execution_context_struct *, struct rb_control_frame_struct *);

View File

@ -6294,13 +6294,10 @@ fn gen_send_iseq(
asm_comment!(asm, "inlined leaf builtin");
gen_counter_incr(asm, Counter::num_send_leaf_builtin);
// Skip this if it doesn't trigger GC
if builtin_attrs & BUILTIN_ATTR_NO_GC == 0 {
// The callee may allocate, e.g. Integer#abs on a Bignum.
// Save SP for GC, save PC for allocation tracing, and prepare
// for global invalidation after GC's VM lock contention.
jit_prepare_routine_call(jit, asm);
}
// The callee may allocate, e.g. Integer#abs on a Bignum.
// Save SP for GC, save PC for allocation tracing, and prepare
// for global invalidation after GC's VM lock contention.
jit_prepare_routine_call(jit, asm);
// Call the builtin func (ec, recv, arg1, arg2, ...)
let mut args = vec![EC];

View File

@ -448,8 +448,7 @@ pub struct iseq_inline_cvar_cache_entry {
pub entry: *mut rb_cvar_class_tbl_entry,
}
pub const BUILTIN_ATTR_LEAF: rb_builtin_attr = 1;
pub const BUILTIN_ATTR_NO_GC: rb_builtin_attr = 2;
pub const BUILTIN_ATTR_SINGLE_NOARG_INLINE: rb_builtin_attr = 4;
pub const BUILTIN_ATTR_SINGLE_NOARG_INLINE: rb_builtin_attr = 2;
pub type rb_builtin_attr = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]