From 92b0331bcf33d1c4d3396c1ad85919934198aa28 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Mon, 18 Mar 2019 17:45:10 +0000 Subject: [PATCH] Use designated initializers for compile_status to make it easier to understand what values are grouped. Just cosmetic changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit_compile.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/mjit_compile.c b/mjit_compile.c index a62eb17238..39609cdf90 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -203,24 +203,19 @@ bool mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname) { const struct rb_iseq_constant_body *body = iseq->body; - - struct compile_status status; - status.success = true; - status.local_stack_p = !body->catch_except_p; - status.stack_size_for_pos = (int *)alloca(sizeof(int) * body->iseq_size); + struct compile_status status = { + .success = true, + .local_stack_p = !body->catch_except_p, + .stack_size_for_pos = (int *)alloca(sizeof(int) * body->iseq_size), + .cc_entries = (body->ci_size + body->ci_kw_size) > 0 ? + alloca(sizeof(struct rb_call_cache) * (body->ci_size + body->ci_kw_size)) : NULL, + .is_entries = (body->is_size > 0) ? + alloca(sizeof(union iseq_inline_storage_entry) * body->is_size) : NULL, + }; memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size); - - status.cc_entries = NULL; - if ((body->ci_size + body->ci_kw_size) > 0) - status.cc_entries = alloca(sizeof(struct rb_call_cache) * (body->ci_size + body->ci_kw_size)); - status.is_entries = NULL; - if (body->is_size > 0) - status.is_entries = alloca(sizeof(union iseq_inline_storage_entry) * body->is_size); - if ((status.cc_entries != NULL || status.is_entries != NULL) - && !mjit_copy_cache_from_main_thread(iseq, status.cc_entries, status.is_entries)) { + && !mjit_copy_cache_from_main_thread(iseq, status.cc_entries, status.is_entries)) return false; - } /* For performance, we verify stack size only on compilation time (mjit_compile.inc.erb) without --jit-debug */ if (!mjit_opts.debug) {