summaryrefslogtreecommitdiff
path: root/mjit_compile.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-18 17:45:10 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-18 17:45:10 +0000
commit92b0331bcf33d1c4d3396c1ad85919934198aa28 (patch)
tree4484e3359e3db280c399e191153137beebae10b3 /mjit_compile.c
parent8b1241d87756b59b6e2f033f7a978130b896bbaf (diff)
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
Diffstat (limited to 'mjit_compile.c')
-rw-r--r--mjit_compile.c25
1 files 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) {