github-actions[bot] commented on issue #4561:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
- cfallin: isle
- fitzgen: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
elliottt commented on issue #4561:
I realized that #4484 hadn't merged yet and I had forgotten to do a review (and now it needs a rebase to merge) but once it merges, we should update this PR to use that
trace!
macro (which can be conditionally compiled out) rather than explicitly uselog::trace!
. (I realize you were trying to do something similar earlier but I think it makes sense to have both: the ISLE-level option to exclude from codegen completely, and the Cranelift-level custom trace macro. Probably we should make the codegen option a string option naming the trace macro...)I like that idea a lot! Being able to control the name of the macro called would also make it easier to use this to instrument the generated rust, which we might be able to take advantage of during testing.
jameysharp commented on issue #4561:
Is it important to have a build-time flag for whether to generate this code? Or would it be okay to just always generate the
trace!
call? I assume this is a code path that's not supposed to happen, because we're supposed to have ISLE rules covering all of CLIF. If that's true then there shouldn't be any runtime cost to including the logging calls, and actually I wonder if it should be a "warn" level log message or something. Anyway, is the flag just to avoid clutter in the generated code or something?
elliottt commented on issue #4561:
Is it important to have a build-time flag for whether to generate this code? Or would it be okay to just always generate the
trace!
call? I assume this is a code path that's not supposed to happen, because we're supposed to have ISLE rules covering all of CLIF. If that's true then there shouldn't be any runtime cost to including the logging calls, and actually I wonder if it should be a "warn" level log message or something. Anyway, is the flag just to avoid clutter in the generated code or something?The reason for the flag was mostly that the tests aren't compiled in a context that has access to the
trace!
macro.
jameysharp commented on issue #4561:
The reason for the flag was mostly that the tests aren't compiled in a context that has access to the
trace!
macro.Huh, I don't understand that answer. It's okay to call
log::trace
and the like without having any logging backend initialized; they just don't do anything in that case. What do you mean by "has access to" here?
elliottt commented on issue #4561:
The reason for the flag was mostly that the tests aren't compiled in a context that has access to the
trace!
macro.Huh, I don't understand that answer. It's okay to call
log::trace
and the like without having any logging backend initialized; they just don't do anything in that case. What do you mean by "has access to" here?The tests compile the output of islec with
rustc
directly, and it's difficult to get the appropriate crate dependencies resolved to run the compiler withoutcargo
.
jameysharp commented on issue #4561:
Ahhh, that's what I was missing (
cranelift/isle/isle/tests/run_tests.rs
in particular).I'm not sure I like relying on the enclosing crate having a
trace
macro at top-level. From offline discussion with you, I like your idea of making the config option be the name of the macro, if any, so ISLE's caller can useprintln
orlog::warn
or whatever they want.Instead of threading the config options through all the method calls, I think you should put them in
self
(theCodegen
struct) so they're available everywhere without all that noise. I'd have a much easier time reviewing this PR then.
elliottt commented on issue #4561:
After playing around with this a bit, it's not actually that useful: the log message printed tells you that the top-level function you applied failed, which you already knew :)
Last updated: Nov 22 2024 at 16:03 UTC