зеркало из https://github.com/github/ruby.git
Carve out mjit_compile_body
This refactoring is needed for implementing inlining later. I've had this since long ago and it has conflicted sometimes. So let me just commit this now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
246723a34c
Коммит
e68495e5f4
|
@ -215,9 +215,8 @@ compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct
|
|||
|
||||
extern bool mjit_copy_cache_from_main_thread(const rb_iseq_t *iseq, struct rb_call_cache *cc_entries, union iseq_inline_storage_entry *is_entries);
|
||||
|
||||
// Compile ISeq to C code in `f`. It returns true if it succeeds to compile.
|
||||
bool
|
||||
mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname)
|
||||
static bool
|
||||
mjit_compile_body(FILE *f, const rb_iseq_t *iseq)
|
||||
{
|
||||
const struct rb_iseq_constant_body *body = iseq->body;
|
||||
struct compile_status status = {
|
||||
|
@ -235,16 +234,6 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname)
|
|||
&& !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) {
|
||||
fprintf(f, "#undef OPT_CHECKED_RUN\n");
|
||||
fprintf(f, "#define OPT_CHECKED_RUN 0\n\n");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
fprintf(f, "__declspec(dllexport)\n");
|
||||
#endif
|
||||
fprintf(f, "VALUE\n%s(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)\n{\n", funcname);
|
||||
if (status.local_stack_p) {
|
||||
fprintf(f, " VALUE stack[%d];\n", body->stack_max);
|
||||
}
|
||||
|
@ -271,8 +260,26 @@ 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);
|
||||
return status.success;
|
||||
}
|
||||
|
||||
// Compile ISeq to C code in `f`. It returns true if it succeeds to compile.
|
||||
bool
|
||||
mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname)
|
||||
{
|
||||
// For performance, we verify stack size only on compilation time (mjit_compile.inc.erb) without --jit-debug
|
||||
if (!mjit_opts.debug) {
|
||||
fprintf(f, "#undef OPT_CHECKED_RUN\n");
|
||||
fprintf(f, "#define OPT_CHECKED_RUN 0\n\n");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
fprintf(f, "__declspec(dllexport)\n");
|
||||
#endif
|
||||
fprintf(f, "VALUE\n%s(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)\n{\n", funcname);
|
||||
bool result = mjit_compile_body(f, iseq);
|
||||
fprintf(f, "\n} // end of %s\n", funcname);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_MJIT
|
||||
|
|
Загрузка…
Ссылка в новой задаче