[PROF-11809] Fix profiler compatibility with ruby-head (3.5)#4656
Conversation
**What does this PR do?** This PR fixes three issues in the profiler when used with latest ruby-head: 1. It's no longer possible to ask the object_id from a T_IMEMO object. This showed up as a Ruby VM crash with an error message "T_IMEMO can't have an object_id". (See ruby/ruby#13347 for the upstream change) 2. Creating new instances of a class is now inlined into the caller, and there is no longer a frame to represent the new. This broke some of our tests that expected the stack from allocating an object to have the `new` at the top. (See ruby/ruby#13080 for the upstream change) 3. Object ids now count towards the size of objects. This broke some of our tests that asserted on size of profiled objects. (See ruby/ruby#13159 for the upstream change) **Motivation:** Fix support for Ruby 3.5. **Additional Notes:** N/A **How to test the change?** I've updated our specs to cover these changes. Unfortunately, we don't yet test with Ruby 3.5 in CI, so you'll have to test manually if you want to see the fixes working with 3.5. (Note that these changes showed up after 3.5.0-preview1, so testing on -preview1 is not enough)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4656 +/- ##
==========================================
- Coverage 97.77% 97.76% -0.02%
==========================================
Files 1422 1422
Lines 86712 86718 +6
Branches 4403 4405 +2
==========================================
- Hits 84783 84778 -5
- Misses 1929 1940 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Datadog ReportBranch report: ✅ 0 Failed, 21049 Passed, 1372 Skipped, 3m 52.67s Total Time |
BenchmarksBenchmark execution time: 2025-05-16 09:51:43 Comparing candidate commit 5a10acb in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 31 metrics, 2 unstable metrics. |
What does this PR do?
This PR fixes three issues in the profiler when used with latest ruby-head:
It's no longer possible to ask the object_id from a T_IMEMO object. This showed up as a Ruby VM crash with an error message "T_IMEMO can't have an object_id". (See Ensure shape_id is never used on T_IMEMO ruby/ruby#13347 for the upstream change)
Creating new instances of a class is now inlined into the caller, and there is no longer a frame to represent the new. This broke some of our tests that expected the stack from allocating an object to have the
newat the top. (See Inline Class#new. ruby/ruby#13080 for the upstream change)Object ids now count towards the size of objects. This broke some of our tests that asserted on size of profiled objects. (See Move
object_idin attributes ruby/ruby#13159 for the upstream change)Motivation:
Fix support for Ruby 3.5.
Change log entry
Yes. Fix profiler compatibility with ruby-head (3.5)
Additional Notes:
N/A
How to test the change?
I've updated our specs to cover these changes. Unfortunately, we don't yet test with Ruby 3.5 in CI, so you'll have to test manually if you want to see the fixes working with 3.5.
(Note that these changes showed up after 3.5.0-preview1, so testing on -preview1 is not enough)