The fix for #21441 (e3ec101cc2) sets `ec->cfp = NULL` before `rb_ec_set_vm_stack(ec, NULL, 0)` in `rb_ec_clear_vm_stack()`. That way, `thread_profile_frames()` called from a signal handler returns early instead of walking a stack that i...Eregon (Benoit Daloze)
Sampling profilers (like StackProf, Vernier, Datadog) call `rb_profile_frames()` from a signal handler. Datadog uses a slight variant of `rb_profile_frames()` but it does not matter, it reproduces either way. `rb_profile_frames()` segf...Eregon (Benoit Daloze)
I can see that point of view and I would agree for most functions, but not for `ruby_thread_has_gvl_p()` and not for `ruby_native_thread_p()`. Both of these functions, unlike almost all others, can be called without the GVL. If they cou...Eregon (Benoit Daloze)
alanwu (Alan Wu) wrote in #note-5: > interrupt checking is also used for thread switching internally Interesting. I could reproduce a very similar issue but with no profiler or postponed job at all: ``` $ ruby -v --yjit --yjit-c...Eregon (Benoit Daloze)
And BTW the base `Data#initialize` needs to be kept because `Psych` relies on that to create Data instances (https://github.com/ruby/psych/pull/765). That one would remain rather slow, but is used more rarely so matters less.Eregon (Benoit Daloze)
I think the approach to define an `initialize` per subclass is the most promising, and where there is the most performance to gain. TruffleRuby already generates an `initialize` per Struct subclass (with Ruby code) in some cases: https:...Eregon (Benoit Daloze)