mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Move code to mark jit_unit's cc_entries to mjit.c
This commit is contained in:
parent
a90117c8c9
commit
8562bfd150
3 changed files with 17 additions and 15 deletions
12
iseq.c
12
iseq.c
|
@ -359,17 +359,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_MJIT
|
#if USE_MJIT
|
||||||
const struct rb_callcache **cc_entries;
|
mjit_mark_cc_entries(body);
|
||||||
if (body->jit_unit && (cc_entries = mjit_iseq_cc_entries(body)) != NULL) {
|
|
||||||
for (unsigned int i=0; i<body->ci_size; i++) {
|
|
||||||
const struct rb_callcache *cc = cc_entries[i];
|
|
||||||
if (cc != NULL) {
|
|
||||||
// Pin `cc` and `cc->cme` against GC.compact as their addresses may be written in JIT-ed code.
|
|
||||||
rb_gc_mark((VALUE)cc);
|
|
||||||
rb_gc_mark((VALUE)vm_cc_cme(cc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
mjit.c
18
mjit.c
|
@ -980,6 +980,7 @@ mjit_finish(bool close_handle_p)
|
||||||
verbose(1, "Successful MJIT finish");
|
verbose(1, "Successful MJIT finish");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called by rb_vm_mark() to mark iseq being JIT-ed and iseqs in the unit queue.
|
||||||
void
|
void
|
||||||
mjit_mark(void)
|
mjit_mark(void)
|
||||||
{
|
{
|
||||||
|
@ -1014,10 +1015,21 @@ mjit_mark(void)
|
||||||
RUBY_MARK_LEAVE("mjit");
|
RUBY_MARK_LEAVE("mjit");
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct rb_callcache **
|
// Called by rb_iseq_mark() to mark cc_entries captured for MJIT
|
||||||
mjit_iseq_cc_entries(const struct rb_iseq_constant_body *const body)
|
void
|
||||||
|
mjit_mark_cc_entries(const struct rb_iseq_constant_body *const body)
|
||||||
{
|
{
|
||||||
return body->jit_unit->cc_entries;
|
const struct rb_callcache **cc_entries;
|
||||||
|
if (body->jit_unit && (cc_entries = body->jit_unit->cc_entries) != NULL) {
|
||||||
|
for (unsigned int i = 0; i < body->ci_size; i++) {
|
||||||
|
const struct rb_callcache *cc = cc_entries[i];
|
||||||
|
if (cc != NULL) {
|
||||||
|
// Pin `cc` and `cc->cme` against GC.compact as their addresses may be written in JIT-ed code.
|
||||||
|
rb_gc_mark((VALUE)cc);
|
||||||
|
rb_gc_mark((VALUE)vm_cc_cme(cc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A hook to update valid_class_serials.
|
// A hook to update valid_class_serials.
|
||||||
|
|
2
mjit.h
2
mjit.h
|
@ -93,7 +93,7 @@ extern struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec);
|
||||||
extern void mjit_cont_free(struct mjit_cont *cont);
|
extern void mjit_cont_free(struct mjit_cont *cont);
|
||||||
extern void mjit_add_class_serial(rb_serial_t class_serial);
|
extern void mjit_add_class_serial(rb_serial_t class_serial);
|
||||||
extern void mjit_remove_class_serial(rb_serial_t class_serial);
|
extern void mjit_remove_class_serial(rb_serial_t class_serial);
|
||||||
const struct rb_callcache ** mjit_iseq_cc_entries(const struct rb_iseq_constant_body *const body);
|
extern void mjit_mark_cc_entries(const struct rb_iseq_constant_body *const body);
|
||||||
|
|
||||||
// A threshold used to reject long iseqs from JITting as such iseqs
|
// A threshold used to reject long iseqs from JITting as such iseqs
|
||||||
// takes too much time to be compiled.
|
// takes too much time to be compiled.
|
||||||
|
|
Loading…
Reference in a new issue