Skip to content

Commit 76e8033

Browse files
st0012k0kubun
andauthored
ZJIT: Improve Ractor mode patch point comments
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
1 parent c8f68cf commit 76e8033

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

zjit/src/hir.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,8 @@ impl Function {
16721672
}
16731673
let id = unsafe { get_cme_def_body_attr_id(cme) };
16741674

1675-
// Check if we're accessing ivars of a Class or Module object as they require single-ractor mode
1675+
// Check if we're accessing ivars of a Class or Module object as they require single-ractor mode.
1676+
// We omit gen_prepare_non_leaf_call on gen_getivar, so it's unsafe to raise for multi-ractor mode.
16761677
if unsafe { rb_zjit_singleton_class_p(klass) } {
16771678
let attached = unsafe { rb_class_attached_object(klass) };
16781679
if unsafe { RB_TYPE_P(attached, RUBY_T_CLASS) || RB_TYPE_P(attached, RUBY_T_MODULE) } {
@@ -3333,6 +3334,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
33333334
let id = ID(get_arg(pc, 0).as_u64());
33343335
// ic is in arg 1
33353336
let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state });
3337+
// Assume single-Ractor mode to omit gen_prepare_non_leaf_call on gen_getivar
33363338
// TODO: We only really need this if self_val is a class/module
33373339
fun.push_insn(block, Insn::PatchPoint { invariant: Invariant::SingleRactorMode, state: exit_id });
33383340
let result = fun.push_insn(block, Insn::GetIvar { self_val: self_param, id, state: exit_id });
@@ -3342,6 +3344,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
33423344
let id = ID(get_arg(pc, 0).as_u64());
33433345
// ic is in arg 1
33443346
let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state });
3347+
// Assume single-Ractor mode to omit gen_prepare_non_leaf_call on gen_setivar
33453348
// TODO: We only really need this if self_val is a class/module
33463349
fun.push_insn(block, Insn::PatchPoint { invariant: Invariant::SingleRactorMode, state: exit_id });
33473350
let val = state.stack_pop()?;

0 commit comments

Comments
 (0)