diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-18 17:28:23 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-18 17:28:23 +0000 |
commit | 8b1241d87756b59b6e2f033f7a978130b896bbaf (patch) | |
tree | 6a424440dfc2ba2d4e1e18f171b4f5e2228b9484 | |
parent | a75ae6faa931e8b9d32c99039a06b950df391a06 (diff) | |
download | ruby-8b1241d87756b59b6e2f033f7a978130b896bbaf.tar.gz |
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
-rw-r--r-- | mjit_compile.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/mjit_compile.c b/mjit_compile.c index 7e3d4913a8..a62eb17238 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -207,9 +207,7 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname) 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 *iseq, const char *funcname) 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; } |