Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add
Vm
trace functionality and add trace toboa_wasm
#3227base: main
Are you sure you want to change the base?
Add
Vm
trace functionality and add trace toboa_wasm
#3227Changes from 10 commits
0baa009
a1900c8
2ae0204
e0e64d2
a07ba2a
8099c04
39f973e
ed1cf6c
b20bb5b
1b95f81
94045e1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thought that I've had over the last day or so is whether it would be worthwhile redesigning so that the
Trace
is a trait onVm
.The only issue with this that I haven't totally thought through is that I'm not sure we'd be able to feature flag the fields (all though we could probably still feature flag the method calls)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current design is fine. What would be the benefit of having it as a trait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly I'm not sure if I'm totally in love with the
Vec<Box<dyn Tracer>>
onVmTrace
. It works and improves the current functionality, but I'm mostly just thinking whether there may be a bit of a better design 😕 That being said, I'm not sure a theoretically better design out weighs the functionality here.Edit: Using a trait would allow the trace to be defined at compile time essentially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo the
Vec<Box<dyn Tracer>>
is totally fine for this use case.I'm not sure if that is a benefit. The upside would be reducing dynamic dispatch, but if you enable tracing, you probably do not care about that last bit of performance.
Being able to change the tracing at runtime also seems like a nice feature right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a nice feature! And you're right, if someone enables tracing then they are probably not concerned about performance. But if it's switched to a trait that doesn't mean that there couldn't be an implementation of the trait that can be updated at runtime. And if we were to update this to something without dynamic dispatching, then we even provide an impl of the trait that could be updated at runtime.
The primary difference would be that it would be a user deciding to use dynamic dispatching over Boa locking the user into using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say the current implementation is good engough. If there are shortcomings we could change it. I would prefer that to adding a generic to the
Vm
struct. But if you think it is significantly better, go for it :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we could offer "combinators" for tracers. Instead of having
Vec<Box<dyn Tracer>>
, why not something likeBox<dyn Tracer>
, where weimpl<T: Tracer, U: Tracer> Tracer for (T, U)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😕 Maybe.
There's probably a better option with how
Tracer
is defined too. I was playing around with a new design and have something like:Where
TraceEvent
is something like:But that design still has
VmTrace
using aVec
.