From 69f377a3d62b29bc927da7fdae99bcb5e7d096fe Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 26 Feb 2020 00:27:28 -0800 Subject: Internalize rb_mjit_unit definition again Fixed a TODO in b9007b6c548f91e88fd3f2ffa23de740431fa969 --- mjit_worker.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'mjit_worker.c') diff --git a/mjit_worker.c b/mjit_worker.c index 40debd10f4..09f07d8e1f 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -135,6 +135,34 @@ typedef intptr_t pid_t; #define MJIT_TMP_PREFIX "_ruby_mjit_" +// The unit structure that holds metadata of ISeq for MJIT. +struct rb_mjit_unit { + // Unique order number of unit. + int id; + // Dlopen handle of the loaded object file. + void *handle; + rb_iseq_t *iseq; +#ifndef _MSC_VER + // This value is always set for `compact_all_jit_code`. Also used for lazy deletion. + char *o_file; + // true if it's inherited from parent Ruby process and lazy deletion should be skipped. + // `o_file = NULL` can't be used to skip lazy deletion because `o_file` could be used + // by child for `compact_all_jit_code`. + bool o_file_inherited_p; +#endif +#if defined(_WIN32) + // DLL cannot be removed while loaded on Windows. If this is set, it'll be lazily deleted. + char *so_file; +#endif + // Only used by unload_units. Flag to check this unit is currently on stack or not. + char used_code_p; + struct list_node unode; + // mjit_compile's optimization switches + struct rb_mjit_compile_info compile_info; + // captured CC values, they should be marked with iseq. + const struct rb_callcache **cc_entries; // size: iseq->body->ci_size +}; + // Linked list of struct rb_mjit_unit. struct rb_mjit_unit_list { struct list_head head; @@ -1184,7 +1212,7 @@ mjit_copy_cache_from_main_thread(const rb_iseq_t *iseq, union iseq_inline_storag job->finish_p = true; in_jit = true; // Prohibit GC during JIT compilation - if (job->iseq == NULL) // ISeq GC is notified in mjit_mark_iseq + if (job->iseq == NULL) // ISeq GC is notified in mjit_free_iseq success_p = false; job->iseq = NULL; // Allow future GC of this ISeq from here CRITICAL_SECTION_FINISH(3, "in mjit_copy_cache_from_main_thread"); -- cgit v1.2.3