Skip to content

Use write barriers for Backtrace objects#7253

Merged
jhawthorn merged 1 commit into
ruby:masterfrom
jhawthorn:backtrace_wb
Feb 7, 2023
Merged

Use write barriers for Backtrace objects#7253
jhawthorn merged 1 commit into
ruby:masterfrom
jhawthorn:backtrace_wb

Conversation

@jhawthorn

@jhawthorn jhawthorn commented Feb 6, 2023

Copy link
Copy Markdown
Member

Follow up to #7240, which enabled WB for Backtrace::Location. cc @casperisfine @peterzhu2118

Backtrace objects hold references to:

  • iseqs - via the captured rb_backtrace_location_t
  • strary - a lazily allocated array of strings
  • locary - a lazily allocated array of backtrace locations

Co-authored-by: Adam Hess [email protected]

Backtrace objects hold references to:
* iseqs - via the captured locations
* strary - a lazily allocated array of strings
* locary - a lazily allocated array of backtrace locations

Co-authored-by: Adam Hess <[email protected]>

@peterzhu2118 peterzhu2118 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like bt_update_cfunc_loc updates the iseq on the backtrace buffer, we might need a write barrier there.

@casperisfine

Copy link
Copy Markdown
Contributor

I assume the backtrace_update (compact function), doesn't need to fire write barriers?

@peterzhu2118

peterzhu2118 commented Feb 6, 2023

Copy link
Copy Markdown
Member

I assume the backtrace_update (compact function), doesn't need to fire write barriers?

The compact function doesn't need to fire write barriers since it's not writing a new object.

@jhawthorn

Copy link
Copy Markdown
Member Author

It looks like bt_update_cfunc_loc updates the iseq on the backtrace buffer, we might need a write barrier there.

I think (?) those are covered. It's called from two locations in rb_ec_partial_backtrace_object, for the first it's assigning an iseq right after we RB_OBJ_WRITE just into other locations, and in the second we call RB_OBJ_WRITTEN(btobj, Qundef, cfp->iseq); afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants