Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove raw pointers from bridge port address creation #1309

Merged
merged 1 commit into from Nov 30, 2022

Conversation

nandor
Copy link
Contributor

@nandor nandor commented Nov 23, 2022

Minor cleanup to help fix memory leaks and avoid raw pointers.

Macros instantiating bridge parameters are removed in favour of a single macro creating a structure as a value, which is then passed on to constructor and saved in the bridges themselves. With this method, ownership is clear and missing calls to free no longer lead to leaks.

Related PRs / Issues

N/A

UI / API Impact

Changed the *_substruct_create macro to directly instantiate an value containing all ports.

Verilog / AGFI Compatibility

N/A

Contributor Checklist

  • Is this PR's title suitable for inclusion in the changelog and have you added a changelog:<topic> label?
  • Did you add Scaladoc/docstring/doxygen to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous prints/debugging code?
  • Did you state the UI / API impact?
  • Did you specify the Verilog / AGFI compatibility impact?
  • If applicable, did you regenerate and publicly share default AGFIs?
  • If applicable, did you apply the ci:fpga-deploy label?
  • If applicable, did you apply the Please Backport label?

Reviewer Checklist (only modified by reviewer)

Note: to run CI on PRs from forks, comment @Mergifyio copy main and manage the change from the new PR.

  • Is the title suitable for inclusion in the changelog and does the PR have a changelog:<topic> label?
  • Did you mark the proper release milestone?
  • Did you check whether all relevant Contributor checkboxes have been checked?

@nandor nandor added the changelog:changed Put PR title in 'Changed' section of changelog label Nov 23, 2022
@fabianschuiki
Copy link
Contributor

One of the tests seems to break 🤔

I like the sweeping cleanup this does. If we aren't disturbing anyone else's ongoing and uncommitted work on these files, this might be a good thing to land at some point to make everybody's life easier in the future (even if we plan to do some cleanup on the driver side at some point anyway).

@nandor
Copy link
Contributor Author

nandor commented Nov 23, 2022

A new test was added in the meantime, causing the tests to fail - I'll address it alongside other comments.

Copy link
Contributor

@davidbiancolin davidbiancolin left a comment

Choose a reason for hiding this comment

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

LGTM. Beyond the memory leak change, I think the constness of mmio_addrs is a really positive one.

@davidbiancolin
Copy link
Contributor

In light of CI being disabled, I'm OK force merging this once you manually confirm groupA, B, and chipyard scala tests pass.

@nandor
Copy link
Contributor Author

nandor commented Nov 30, 2022

The tests mentioned all pass with this change.

@davidbiancolin davidbiancolin enabled auto-merge (squash) November 30, 2022 20:36
@davidbiancolin davidbiancolin merged commit 06c30ea into main Nov 30, 2022
@davidbiancolin davidbiancolin deleted the remove-pointers branch November 30, 2022 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:changed Put PR title in 'Changed' section of changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants