8000 Use alloca for stack_size_for_pos as well · jruby/ruby@8b1241d · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b1241d

Browse files
committed
Use alloca for stack_size_for_pos as well
to eliminate necessity of error check and `free` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent a75ae6f commit 8b1241d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

mjit_compile.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,7 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname)
207207
struct compile_status status;
208208
status.success = true;
209209
status.local_stack_p = !body->catch_except_p;
210-
status.stack_size_for_pos = (int *)malloc(sizeof(int) * body->iseq_size);
211-
if (status.stack_size_for_pos == NULL)
212-
return false;
210+
status.stack_size_for_pos = (int *)alloca(sizeof(int) * body->iseq_size);
213211
memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size);
214212

215213
status.cc_entries = NULL;
@@ -260,8 +258,6 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname)
260258
compile_insns(f, body, 0, 0, &status);
261259
compile_cancel_handler(f, body, &status);
262260
fprintf(f, "\n} /* end of %s */\n", funcname);
263-
264-
free(status.stack_size_for_pos);
265261
return status.success;
266262
}
267263

0 commit comments

Comments
 (0)
0