diff options
author | Kevin Newton <kddnewton@gmail.com> | 2022-03-31 11:04:25 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2022-04-01 14:48:22 -0400 |
commit | 6068da8937d7e4358943f95e7450dae7179a7763 (patch) | |
tree | 68ad7d95ec12f1dec4b1b745725c9579ab2f10ec /yjit_codegen.c | |
parent | 20c190f95a28dd4e57cb96f939ff314dfb88b1f4 (diff) |
Finer-grained constant cache invalidation (take 2)
This commit reintroduces finer-grained constant cache invalidation.
After 8008fb7 got merged, it was causing issues on token-threaded
builds (such as on Windows).
The issue was that when you're iterating through instruction sequences
and using the translator functions to get back the instruction structs,
you're either using `rb_vm_insn_null_translator` or
`rb_vm_insn_addr2insn2` depending if it's a direct-threading build.
`rb_vm_insn_addr2insn2` does some normalization to always return to
you the non-trace version of whatever instruction you're looking at.
`rb_vm_insn_null_translator` does not do that normalization.
This means that when you're looping through the instructions if you're
trying to do an opcode comparison, it can change depending on the type
of threading that you're using. This can be very confusing. So, this
commit creates a new translator function
`rb_vm_insn_normalizing_translator` to always return the non-trace
version so that opcode comparisons don't have to worry about different
configurations.
[Feature #18589]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5716
Diffstat (limited to 'yjit_codegen.c')
-rw-r--r-- | yjit_codegen.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/yjit_codegen.c b/yjit_codegen.c index 4b53b737a0..aef5c0790d 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -4438,8 +4438,6 @@ gen_leave(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) return YJIT_END_BLOCK; } -RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state; - static codegen_status_t gen_getglobal(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) { @@ -4707,8 +4705,7 @@ gen_opt_getinlinecache(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) // See vm_ic_hit_p(). The same conditions are checked in yjit_constant_ic_update(). struct iseq_inline_constant_cache_entry *ice = ic->entry; - if (!ice || // cache not filled - GET_IC_SERIAL(ice) != ruby_vm_global_constant_state /* cache out of date */) { + if (!ice) { // In these cases, leave a block that unconditionally side exits // for the interpreter to invalidate. return YJIT_CANT_COMPILE; |