[PROF-15559] Drop usage of MJIT headers for Ruby 2.6 to 3.1 - #6135
Conversation
|
8855b53 to
e6e40be
Compare
|
I've queued up a few more cleanups in the branch. My plan is to:
|
edc67c7 to
545410b
Compare
This is the first version that re-adds headers for Ruby 2.6, 2.7, 3.0, 3.1 and 3.2, allowing us to drop MJIT header usage.
I've checked all versions between 2.6.0 and 2.6.10 and all of them pass the profiler test suite without the mjit headers.
I've checked all versions between 2.7.0 and 2.7.8 and all of them pass the profiler test suite without the mjit headers.
I've checked all versions between 3.0.0 and 3.0.7 and all of them pass the profiler test suite without the mjit headers.
I've checked all versions between 3.1.0 and 3.1.7 and all of them pass the profiler test suite without the mjit headers.
I've checked all versions between 3.2.0 and 3.2.9 and all of them pass the profiler test suite without the mjit headers.
545410b to
5009d55
Compare
BenchmarksBenchmark execution time: 2026-08-18 15:59:47 Comparing candidate commit 1127056 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 49 metrics, 0 unstable metrics.
|
|
I've cleaned up the branch -- this is ready for review now! |
| // The private_vm_api_access.c includes private VM headers (via datadog-ruby_core_source) which replace and conflict | ||
| // with any other Ruby headers; so we use PRIVATE_VM_API_ACCESS_SKIP_RUBY_INCLUDES to be able to include | ||
| // private_vm_api_access.h on that file without also dragging the incompatible includes | ||
| #ifndef PRIVATE_VM_API_ACCESS_SKIP_RUBY_INCLUDES |
There was a problem hiding this comment.
I wonder why they conflict, I'll try.
There was a problem hiding this comment.
On 4.0.6 the only conflicts seems the typedefs, i.e. this compiles on Ruby 4.0.6:
#include <ruby/thread_native.h>
#include <ruby/vm.h>
#ifndef PRIVATE_VM_API_ACCESS_SKIP_RUBY_INCLUDES
typedef struct RubyCME rb_callable_method_entry_t;
typedef struct RubyISEQ rb_iseq_t;
#endifAlso works on 2.6.10
There was a problem hiding this comment.
No need to change this in this PR, but maybe something we can try in another PR?
There was a problem hiding this comment.
This might be a remnant of the mjit header days so do share what you learned! (I'll open up a follow-up PR with any improvements, rather than waiting on this one)
There was a problem hiding this comment.
Ah I pushed my comment without seeing yours; ack I'll try in a follow-up PR to remove this.
There was a problem hiding this comment.
(I'm going to mark this as resolved to merge, and then I'll unresolve :P)
What does this PR do?
This PR pairs with DataDog/datadog-ruby_core_source#29 and switches Ruby 2.6 to 3.1 over to using vendored headers instead of the MJIT header.
Motivation:
We've been considering dropping our use of the MJIT headers, and just use the "vendored headers" approach for all Rubies.
There's a few advantages to doing so:
We remove a legacy code path -- modern Rubies don't have MJIT so having everyone using vendored headers helps make sure that changes work similarly to all Rubies.
It opens the door for SSI (single step instrumentation) for the Ruby profiler. By not needing to rely on something from the target Ruby (the MJIT header), we should be able in the future to produce precompiled builds of the profiler extension. (To be clear, that's out of scope for this PR)
One less corner case setting up the profiler -- the profiler now works even on Rubies where MJIT was disabled.
Change log entry
Yes. Profiling: Drop usage of MJIT headers for Ruby 2.6 to 3.1
(It's unlikely that this will break anyone, yet I think it's worthy of a changelog entry in case customers see compilation issues and check the changelog for probable causes for it)
Additional Notes:
I've tested this change will all stable releases from Ruby 2. to 3.2.9.
How to test the change?
Green CI is good!