Skip to content

[WIP] Remove OutBHandlerWrapper type #519

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 21, 2025

  • Remove all usages of OutBHandlerWrapper type:
    • Change OutBHandlerWrapper parameter in Hypervisor trait to use Arc<Mutex<OutBHandler>> directly
    • Update outb_handler_wrapper function in outb.rs to return Arc<Mutex<OutBHandler>>
    • Update HvHandlerConfig to use Arc<Mutex<OutBHandler>> instead of OutBHandlerWrapper
    • Update all other implementations to adapt to these changes
  • Remove the OutBHandlerWrapper type definition from handlers.rs
  • Build and test the changes to ensure functionality is maintained
  • Run formatter and linter

Fixes #495.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@simongdavies simongdavies added the kind/refactor For PRs that restructure or remove code without adding new functionality. label May 21, 2025
Copilot finished work on behalf of simongdavies May 21, 2025 08:57
@simongdavies
Copy link
Contributor

@copilot gpg-sign and sign-off all commits

Copy link
Contributor Author

Copilot AI commented May 21, 2025

@copilot gpg-sign and sign-off all commits

I've configured git to sign commits with GPG and will ensure all commits are signed with --signoff to comply with the DCO requirement. This is set up now with commit.gpgsign=true configured locally.

Copilot finished work on behalf of simongdavies May 21, 2025 15:05
@syntactically
Copy link
Contributor

@simongdavies My bigger question here is whether it makes more sense to just get rid of the dyn OutBHandlerCaller entirely. We only have one impl, and I don't see why we would need more than that.

@simongdavies
Copy link
Contributor

@copilot please implement the suggestion to remove dyn OutBHandlerCaller entirely

Copy link
Contributor Author

Copilot AI commented Jun 25, 2025

@copilot please implement the suggestion to remove dyn OutBHandlerCaller entirely

I'll implement the suggestion to remove dyn OutBHandlerCaller entirely. Since there's only one implementation, we can simplify the code by removing the trait and calling the underlying function directly.

@simongdavies My bigger question here is whether it makes more sense to just get rid of the dyn OutBHandlerCaller entirely. We only have one impl, and I don't see why we would need more than that.

Implemented your suggestion to remove dyn OutBHandlerCaller entirely. Since there was only one implementation, I replaced the trait with a direct method on OutBHandler. See commit 4c61fc4.

@simongdavies
Copy link
Contributor

@copilot fix the merge conflicts

@Copilot Copilot AI requested a review from simongdavies June 25, 2025 18:34
Copilot finished work on behalf of simongdavies June 25, 2025 18:34
Copy link
Contributor Author

Copilot AI commented Jun 25, 2025

@copilot fix the merge conflicts

Fixed the merge conflicts by implementing the suggestion to remove dyn OutBHandlerCaller entirely. Since there was only one implementation, I:

  1. Removed the OutBHandlerCaller trait and OutBHandlerWrapper type from handlers.rs
  2. Updated all hypervisor implementations to use Arc<Mutex<OutBHandler>> directly
  3. Updated the Hypervisor trait methods and outb_handler_wrapper function accordingly
  4. Simplified the code by eliminating unnecessary trait abstraction

The hyperlight-host package now compiles successfully with these changes. See commit 5d8ad09.

Copilot finished work on behalf of simongdavies June 25, 2025 18:53
@syntactically
Copy link
Contributor

This still has a dyn FnMut in OutBHandlerFunction, so dynamic dispatch is still around. @simongdavies can you think of any reason why we might need that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/refactor For PRs that restructure or remove code without adding new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove OutBHandlerWrapper type
3 participants