MJIT: Get rid of is_entries copy
MJIT worker no longer exists, so we don't need this safeguard anymore.
This commit is contained in:
parent
9c13fc614c
commit
bb6f933d51
@ -330,10 +330,10 @@ class RubyVM::MJIT::Compiler
|
||||
end
|
||||
|
||||
def compile_ivar(insn_name, stack_size, pos, status, operands, body)
|
||||
ic_copy = (status.is_entries + (C.iseq_inline_storage_entry.new(operands[1]) - body.is_entries)).iv_cache
|
||||
dest_shape_id = ic_copy.value >> C.SHAPE_FLAG_SHIFT
|
||||
iv_cache = C.iseq_inline_storage_entry.new(operands[1]).iv_cache
|
||||
dest_shape_id = iv_cache.value >> C.SHAPE_FLAG_SHIFT
|
||||
source_shape_id = parent_shape_id(dest_shape_id)
|
||||
attr_index = ic_copy.value & ((1 << C.SHAPE_FLAG_SHIFT) - 1)
|
||||
attr_index = iv_cache.value & ((1 << C.SHAPE_FLAG_SHIFT) - 1)
|
||||
|
||||
src = +''
|
||||
if !status.compile_info.disable_ivar_cache && source_shape_id != C.INVALID_SHAPE_ID
|
||||
@ -769,9 +769,6 @@ class RubyVM::MJIT::Compiler
|
||||
status.inlined_iseqs[i] = nil
|
||||
end
|
||||
end
|
||||
if ISEQ_IS_SIZE(body) > 0
|
||||
status.is_entries = Fiddle.malloc(C.iseq_inline_storage_entry.sizeof * ISEQ_IS_SIZE(body))
|
||||
end
|
||||
if body.ci_size > 0
|
||||
status.cc_entries_index = C.mjit_capture_cc_entries(status.compiled_iseq, body)
|
||||
else
|
||||
@ -790,8 +787,6 @@ class RubyVM::MJIT::Compiler
|
||||
end
|
||||
|
||||
def init_ivar_compile_status(body, status)
|
||||
C.mjit_capture_is_entries(body, status.is_entries)
|
||||
|
||||
pos = 0
|
||||
|
||||
while pos < body.iseq_size
|
||||
|
2
mjit_c.h
2
mjit_c.h
@ -39,8 +39,6 @@ struct compile_status {
|
||||
// If true, JIT-ed code will use local variables to store pushed values instead of
|
||||
// using VM's stack and moving stack pointer.
|
||||
bool local_stack_p;
|
||||
// Safely-accessible ivar cache entries copied from main thread.
|
||||
union iseq_inline_storage_entry *is_entries;
|
||||
// Index of call cache entries captured to compiled_iseq to be marked on GC
|
||||
int cc_entries_index;
|
||||
// A pointer to root (i.e. not inlined) iseq being compiled.
|
||||
|
11
mjit_c.rb
11
mjit_c.rb
@ -77,16 +77,6 @@ module RubyVM::MJIT
|
||||
Primitive.cexpr! 'INT2NUM(mjit_capture_cc_entries((struct rb_iseq_constant_body *)NUM2PTR(_compiled_body_addr), (struct rb_iseq_constant_body *)NUM2PTR(_captured_body_addr)))'
|
||||
end
|
||||
|
||||
#const struct rb_iseq_constant_body *body, union iseq_inline_storage_entry *is_entries
|
||||
def mjit_capture_is_entries(body, is_entries)
|
||||
_body_addr = body.to_i
|
||||
_is_entries_addr = is_entries.to_i
|
||||
Primitive.cstmt! %{
|
||||
mjit_capture_is_entries((struct rb_iseq_constant_body *)NUM2PTR(_body_addr), (union iseq_inline_storage_entry *)NUM2PTR(_is_entries_addr));
|
||||
return Qnil;
|
||||
}
|
||||
end
|
||||
|
||||
# Convert encoded VM pointers to insn BINs.
|
||||
def rb_vm_insn_decode(encoded)
|
||||
Primitive.cexpr! 'INT2NUM(rb_vm_insn_decode(NUM2PTR(encoded)))'
|
||||
@ -246,7 +236,6 @@ module RubyVM::MJIT
|
||||
success: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), success)")],
|
||||
stack_size_for_pos: [CType::Pointer.new { CType::Immediate.parse("int") }, Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), stack_size_for_pos)")],
|
||||
local_stack_p: [self._Bool, Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), local_stack_p)")],
|
||||
is_entries: [CType::Pointer.new { self.iseq_inline_storage_entry }, Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), is_entries)")],
|
||||
cc_entries_index: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), cc_entries_index)")],
|
||||
compiled_iseq: [CType::Pointer.new { self.rb_iseq_constant_body }, Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), compiled_iseq)")],
|
||||
compiled_id: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF((*((struct compile_status *)NULL)), compiled_id)")],
|
||||
|
@ -104,17 +104,6 @@ cdhash_each(VALUE key, VALUE value, VALUE hash)
|
||||
extern int
|
||||
mjit_capture_cc_entries(const struct rb_iseq_constant_body *compiled_iseq, const struct rb_iseq_constant_body *captured_iseq);
|
||||
|
||||
// Copy current is_entries and use it throughout the current compilation consistently.
|
||||
// While ic->entry has been immutable since https://github.com/ruby/ruby/pull/3662,
|
||||
// we still need this to avoid a race condition between entries and ivar_serial/max_ivar_index.
|
||||
static void
|
||||
mjit_capture_is_entries(const struct rb_iseq_constant_body *body, union iseq_inline_storage_entry *is_entries)
|
||||
{
|
||||
if (is_entries == NULL)
|
||||
return;
|
||||
memcpy(is_entries, body->is_entries, sizeof(union iseq_inline_storage_entry) * ISEQ_IS_SIZE(body));
|
||||
}
|
||||
|
||||
// Compile ISeq to C code in `f`. It returns true if it succeeds to compile.
|
||||
bool
|
||||
mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user