aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_compile.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 13:21:28 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 13:21:28 +0000
commit1b5aa4f5161972d3598b738312e771c6706a7af6 (patch)
tree0960e925b2bb2d8fda66845e56d8d36da599eb1f /mjit_compile.c
parente01c9c743f467b7ba9b4a4416f04f967f3e9a6ea (diff)
downloadruby-1b5aa4f5161972d3598b738312e771c6706a7af6.tar.gz
mjit.c: copy inline cache values to MJIT worker
on VM_CHECK_INTS. Letting MJIT worker directly see inline cache which may be being updated could result in inconsistent IC index and serial. mjit_worker.c: request the copy job after dequeue, and receive the result synchronously. tool/ruby_vm/views/_mjit_compile_ivar.erb: use the copied IC mjit_compile.c: change the interface to pass is_entries mjit.h: ditto === Optcarrot Benchmark === Thankfully this didn't have major performance regression. $ benchmark-driver benchmark.yml --rbenv 'before::before --disable-gems --jit;after::after --disable-gems --jit' -v --repeat-count 24 before: ruby 2.6.0dev (2018-10-21 trunk 65263) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-10-21 trunk 65263) +JIT [x86_64-linux] last_commit=mjit.c: copy inline cache values to MJIT worker Calculating ------------------------------------- before after Optcarrot Lan_Master.nes 85.421 85.454 fps Comparison: Optcarrot Lan_Master.nes after: 85.5 fps before: 85.4 fps - 1.00x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_compile.c')
-rw-r--r--mjit_compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mjit_compile.c b/mjit_compile.c
index f082d1ce72..7cf3a47267 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -34,6 +34,8 @@ struct compile_status {
/* If TRUE, JIT-ed code will use local variables to store pushed values instead of
using VM's stack and moving stack pointer. */
int local_stack_p;
+ /* Safely-accessible is_entries copied from main thread. */
+ union iseq_inline_storage_entry *is_entries;
};
/* Storage to keep data which is consistent in each conditional branch.
@@ -195,7 +197,7 @@ compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct
/* Compile ISeq to C code in F. It returns 1 if it succeeds to compile. */
int
-mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *funcname)
+mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *funcname, union iseq_inline_storage_entry *is_entries)
{
struct compile_status status;
status.success = TRUE;
@@ -204,6 +206,7 @@ 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.is_entries = is_entries;
/* For performance, we verify stack size only on compilation time (mjit_compile.inc.erb) without --jit-debug */
if (!mjit_opts.debug) {