diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-20 07:43:50 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-20 07:43:50 +0000 |
commit | 8449f4992b9eee9a4948a90a24faa47c59d7f0db (patch) | |
tree | 139326978207a90fdd10f36c044bb410428590a1 /vm_core.h | |
parent | b640b21d9c6698d2246d2e0eb785653b570adcea (diff) |
vm_insnhelper.c: never cache getinstancevariable twice
We have several options to ensure there's no race condition between main
thread and MJIT thead about IC reference:
1) Give up caching ivar for multiple classes (or multiple versions of the
same class) in the same getinstancevariable (This commit's approach)
2) Allocate new inline cache every time
Other ideas we could think of couldn't eliminate possibilities of race
condition.
In 2, it's memory allocation would be slow and it may trigger JIT
cancellation frequently. So 1 would be fast for both VM and JIT
situations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1846,4 +1846,9 @@ void rb_postponed_job_flush(rb_vm_t *vm); RUBY_SYMBOL_EXPORT_END +/* special values for ruby_vm_class_serial */ +#define RUBY_VM_CLASS_SERIAL_UNSET 0 /* Not cached yet. Fields in `is_entries` and `cc_entries` start from 0 due to ZALLOC_N. */ +#define RUBY_VM_CLASS_SERIAL_INVALID 1 /* Cache invalidated and never cached again. */ +#define RUBY_VM_CLASS_SERIAL_MIN_VALID_VALUE 2 /* Actual class serials are larger than this value. */ + #endif /* RUBY_VM_CORE_H */ |