aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-05 04:17:44 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-05 04:17:44 +0000
commit8427fca49bd85205f5a8766292dd893f003c0e48 (patch)
treef0047daa0f9466ac447f5ced1f231438f526992b /mjit.c
parent779c18bf238aba630e40c26e10ce8aa278c45d61 (diff)
downloadruby-8427fca49bd85205f5a8766292dd893f003c0e48.tar.gz
assigning void* to a function pointer is a POSIXism
No implicit cast is defined between these types. Should be explicit. Also, NULL is defined to be ((void*)0) so not usable as a function pointer value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/mjit.c b/mjit.c
index c766371860..62c876a825 100644
--- a/mjit.c
+++ b/mjit.c
@@ -440,7 +440,7 @@ static void
free_unit(struct rb_mjit_unit *unit)
{
if (unit->iseq) /* ISeq is not GCed */
- unit->iseq->body->jit_func = NULL;
+ unit->iseq->body->jit_func = 0;
if (unit->handle) /* handle is NULL if it's in queue */
dlclose(unit->handle);
xfree(unit);
@@ -682,7 +682,7 @@ load_func_from_so(const char *so_file, const char *funcname, struct rb_mjit_unit
/* Compile ISeq in UNIT and return function pointer of JIT-ed code.
It may return NOT_COMPILABLE_JIT_ISEQ_FUNC if something went wrong. */
-static void *
+static mjit_func_t
convert_unit_to_func(struct rb_mjit_unit *unit)
{
char c_file[70], so_file[70], funcname[35];
@@ -744,7 +744,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
if (!success) {
if (!mjit_opts.save_temps)
remove(c_file);
- return (void *)NOT_COMPILABLE_JIT_ISEQ_FUNC;
+ return (mjit_func_t)NOT_COMPILABLE_JIT_ISEQ_FUNC;
}
start_time = real_ms_time();
@@ -755,7 +755,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
remove(c_file);
if (!success) {
verbose(2, "Failed to generate so: %s", so_file);
- return (void *)NOT_COMPILABLE_JIT_ISEQ_FUNC;
+ return (mjit_func_t)NOT_COMPILABLE_JIT_ISEQ_FUNC;
}
func = load_func_from_so(so_file, funcname, unit);
@@ -771,7 +771,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
RSTRING_PTR(rb_iseq_path(unit->iseq)), FIX2INT(unit->iseq->body->location.first_lineno), c_file);
CRITICAL_SECTION_FINISH(3, "end of jit");
}
- return func;
+ return (mjit_func_t)func;
}
/* Set to TRUE to finish worker. */
@@ -810,7 +810,7 @@ worker(void)
CRITICAL_SECTION_FINISH(3, "in worker dequeue");
if (node) {
- void *func = convert_unit_to_func(node->unit);
+ mjit_func_t func = convert_unit_to_func(node->unit);
CRITICAL_SECTION_START(3, "in jit func replace");
if (node->unit->iseq) { /* Check whether GCed or not */
@@ -985,7 +985,7 @@ unload_units(void)
/* Unload the worst node. */
verbose(2, "Unloading unit %d (calls=%lu)", worst_node->unit->id, worst_node->unit->iseq->body->total_calls);
unit = worst_node->unit;
- unit->iseq->body->jit_func = (void *)NOT_READY_JIT_ISEQ_FUNC;
+ unit->iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC;
remove_from_list(worst_node, &active_units);
assert(unit->handle != NULL);
@@ -1005,7 +1005,7 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq)
if (!mjit_init_p)
return;
- iseq->body->jit_func = (void *)NOT_READY_JIT_ISEQ_FUNC;
+ iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC;
create_unit(iseq);
if (iseq->body->jit_unit == NULL)
/* Failure in creating the unit. */
@@ -1177,7 +1177,7 @@ mjit_init(struct mjit_options *opts)
/* Initialize worker thread */
finish_worker_p = FALSE;
worker_finished = FALSE;
- if (rb_thread_create_mjit_thread(child_after_fork, worker) == FALSE) {
+ if (rb_thread_create_mjit_thread(child_after_fork, (void *)worker) == FALSE) {
mjit_init_p = FALSE;
rb_native_mutex_destroy(&mjit_engine_mutex);
rb_native_cond_destroy(&mjit_pch_wakeup);