ruby-changes:55094
From: k0kubun <ko1@a...>
Date: Tue, 19 Mar 2019 02:28:27 +0900 (JST)
Subject: [ruby-changes:55094] k0kubun:r67301 (trunk): Use alloca for stack_size_for_pos as well
k0kubun 2019-03-19 02:28:23 +0900 (Tue, 19 Mar 2019) New Revision: 67301 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67301 Log: Use alloca for stack_size_for_pos as well to eliminate necessity of error check and `free` Modified files: trunk/mjit_compile.c Index: mjit_compile.c =================================================================== --- mjit_compile.c (revision 67300) +++ mjit_compile.c (revision 67301) @@ -207,9 +207,7 @@ mjit_compile(FILE *f, const rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L207 struct compile_status status; status.success = true; status.local_stack_p = !body->catch_except_p; - status.stack_size_for_pos = (int *)malloc(sizeof(int) * body->iseq_size); - if (status.stack_size_for_pos == NULL) - return false; + status.stack_size_for_pos = (int *)alloca(sizeof(int) * body->iseq_size); memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size); status.cc_entries = NULL; @@ -260,8 +258,6 @@ mjit_compile(FILE *f, const rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L258 compile_insns(f, body, 0, 0, &status); compile_cancel_handler(f, body, &status); fprintf(f, "\n} /* end of %s */\n", funcname); - - free(status.stack_size_for_pos); return status.success; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/