-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
If an object calls rb_gc_mark on a field, it pins the child. Such objects are potential pinning parents that must be handled specially. Reducing such objects can reduce the overhead it imposes on copying GC.
Related higher-level issues are:
- mmtk-core: Handle un-update-able edges mmtk-core#690
- mmtk-ruby: Support copying GC mmtk-ruby#18
This issue keeps a list of built-in types that are PPPs, and why they pin their children.
Some object can pin its children
T_DATA: Some third-party libraries were written before Ruby introduced moving GC.T_IMEMO-
imemo_ifunc:gc_mark_maybe(RANY(obj)->as.imemo.ifunc.data)type:VALUEifuncrepresents a "block written in C",
anddatais the "extra argument" passed to the block in addition to the yielded data.- I guess because the ifunc is written in C,
thedatacan be anything (as long as the C func recognizes),
even though it is supposed to be aVALUEwhich holds a Ruby value.
It could be a compromise due to frequent misuse.
- I guess because the ifunc is written in C,
-
imemo_memo:gc_mark_maybe(RANY(obj)->as.imemo.memo.u3.value)- It looks like a generic "memo" type. The
u3field is an untagged union that can be anything.
-
imemo_iseq(No longer PPP since Make all of the references of iseq movable ruby/ruby#7156):- Union
auxmembersrb_gc_mark(iseq->aux.loader.obj)rb_gc_mark(compile_data->catch_table_ary)rb_hook_list_mark(iseq->aux.exec.local_hooks)which callsrb_gc_mark(hook->data)for each hook.rb_iseq_mark_insn_storage(compile_data->insn.storage_head)which callsrb_gc_mark(op)- The three fields above are parts of a union (
iseq->aux)
Other union variants do not hold reference at the same offset, so it has to be conservative.- It should be possible to test the union tag to know precisely which case it is.
- Actually
rb_iseq_markis testing the union tags!
- Actually
- It should be possible to test the union tag to know precisely which case it is.
- MJIT:
mjit_mark_cc_entries(body)
- Union
imemo_tmpbuf:- fully conservative.
- Calls
rb_gc_mark_locationson all offsets. - It is used to implement
ALLOCV. I think it has to be PPP because of it conservative nature.
- Calls
- fully conservative.
-
imemo_ast:rb_gc_mark(ast->node_buffer->mark_hash)rb_gc_mark(ast->body.compile_option)rb_gc_mark(ast->body.script_lines)rb_ast_update_referencesonly callsupdate_ast_valueon eachNODE, but not the three fields above.- Why? ruby@293c6c8
-
imemo_parser_strterm:rb_gc_mark(heredoc->lastline)- It is part of a union, but
rb_strterm_markalready tested the tag.
-
-
T_HASH: IfHash#compare_by_identityis called, it willpin_key_mark_value.compare_by_identity: Sets self to consider only identity in comparing keys;
two keys are considered the same only if they are the same object; returns self.- Cannot be undone. Good candidate for using remembered set.
- Can be made non-PPP by introducing address-based hashing.
- Any object that has gen_ivtab (No longer PPP since ruby@de72448)
- What's that?
- gen_ivtab = generic instance variable table
- useful for adding custom variables to anything other than
T_OBJECT
- useful for adding custom variables to anything other than
gc_mark_children-> (if EXIVAR)rb_mark_generic_ivar->gen_ivtbl_mark->rb_gc_markgeneric_iv_tbl_: (in variable.c) a globalst_tablemapping obj togen_ivtable.
- gen_ivtab = generic instance variable table
- Seems unnecessary.
- I patched the code to let it move, and it seems to work.
- wks@282148b
- What's that?
Metadata
Metadata
Assignees
Labels
No labels