aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_compile.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-17 18:29:30 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-17 18:29:30 +0000
commit4161674b2fbea6bdd01783ac5d3b39d88db22972 (patch)
tree91937f5c5ceb0660e8dd896cc989ea0908be68f3 /mjit_compile.c
parentd86a1aa045959dfbf5cd472eae0d043180259727 (diff)
downloadruby-4161674b2fbea6bdd01783ac5d3b39d88db22972.tar.gz
Request inline cache values from mjit_compile
rather than preparing beforehand. By having this change, implementing inlining by calling `mjit_copy_cache_from_main_thread` for inlined methods was made possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_compile.c')
-rw-r--r--mjit_compile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mjit_compile.c b/mjit_compile.c
index c551ea89c3..81367f6f7f 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -196,10 +196,14 @@ compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct
fprintf(f, " return Qundef;\n");
}
+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 struct rb_iseq_constant_body *body, const char *funcname, struct rb_call_cache *cc_entries, union iseq_inline_storage_entry *is_entries)
+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;
@@ -207,8 +211,8 @@ mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *func
if (status.stack_size_for_pos == NULL)
return false;
memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size);
- status.cc_entries = cc_entries;
- status.is_entries = is_entries;
+ if (mjit_copy_cache_from_main_thread(iseq, &status.cc_entries, &status.is_entries) == false)
+ return false;
/* For performance, we verify stack size only on compilation time (mjit_compile.inc.erb) without --jit-debug */
if (!mjit_opts.debug) {