-
Notifications
You must be signed in to change notification settings - Fork 490
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 function to compile prepared db with debug info #5157
Add function to compile prepared db with debug info #5157
Conversation
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @barabanovro)
crates/cairo-lang-compiler/src/lib.rs
line 104 at r1 (raw file):
compile_prepared_db_with_debug_info(db, main_crate_ids, compiler_config)?; Ok(sierra_program)
.
Suggestion:
Ok(compile_prepared_db_with_debug_info(db, main_crate_ids, compiler_config)?.sierra_program)
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @barabanovro)
a discussion (no related file):
@yuvalsw for 2nd eye.
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @barabanovro)
crates/cairo-lang-compiler/src/lib.rs
line 115 at r2 (raw file):
/// * `Ok(SierraProgramWithDebug)` - The compiled program with debug info. /// * `Err(anyhow::Error)` - Compilation failed. pub fn compile_prepared_db_with_debug_info(
"with debug info" sounds like it gets it as an additional input.
I'd just call it compile_prepared_db_ex
.
Also, please add in the beginning of the comment something like "same as compile_prepared_db
, but returns all the raw debug info".
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yuvalsw)
crates/cairo-lang-compiler/src/lib.rs
line 115 at r2 (raw file):
Previously, yuvalsw wrote…
"with debug info" sounds like it gets it as an additional input.
I'd just call itcompile_prepared_db_ex
.Also, please add in the beginning of the comment something like "same as
compile_prepared_db
, but returns all the raw debug info".
I disagree with the _ex
prefix. Sounds very WinAPI-style and it doesn't convey any meaning IMO.
I think what ultimately would be much better, is simply return debug info from the main function, and let downstream users pick what they need. I know this is a breaking change, but we allow ourselves to do them in our APIs, aren't we?
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mkaput)
crates/cairo-lang-compiler/src/lib.rs
line 115 at r2 (raw file):
Previously, mkaput (Marek Kaput) wrote…
I disagree with the
_ex
prefix. Sounds very WinAPI-style and it doesn't convey any meaning IMO.I think what ultimately would be much better, is simply return debug info from the main function, and let downstream users pick what they need. I know this is a breaking change, but we allow ourselves to do them in our APIs, aren't we?
Calling this function with the original name is ok. I wouldn't worry about the breaking change but if there are many calls to the existing function it would be nice for them to have a wrapper/selector that takes only the program.
I am ok with other names, just "with_debug_info_ sounds like it's another input to the compilation rather than an output.
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yuvalsw)
crates/cairo-lang-compiler/src/lib.rs
line 115 at r2 (raw file):
Previously, yuvalsw wrote…
Calling this function with the original name is ok. I wouldn't worry about the breaking change but if there are many calls to the existing function it would be nice for them to have a wrapper/selector that takes only the program.
I am ok with other names, just "with_debug_info_ sounds like it's another input to the compilation rather than an output.
Perhaps having a impl From<SierraProgramWithDebug> for SierraProgram
could do the job?
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mkaput)
crates/cairo-lang-compiler/src/lib.rs
line 115 at r2 (raw file):
Previously, mkaput (Marek Kaput) wrote…
Perhaps having a
impl From<SierraProgramWithDebug> for SierraProgram
could do the job?
I like it less, but I'll leave you guys to choose the names, I am ok with anything that makes sense.
One suggestion could be calling the original one "compile_prepared_db_program" and this one "compile_prepared_db", if you like it.
Thank you @mkaput and @yuvalsw for your reviews and feedback. Please note @barabanovro is currently off and will get back to this after March 18th. |
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @barabanovro)
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @mkaput, @orizi, and @yuvalsw)
crates/cairo-lang-compiler/src/lib.rs
line 115 at r2 (raw file):
Previously, yuvalsw wrote…
I like it less, but I'll leave you guys to choose the names, I am ok with anything that makes sense.
One suggestion could be calling the original one "compile_prepared_db_program" and this one "compile_prepared_db", if you like it.
I have renamed functions to compile_prepared_db_program
and compile_prepared_db
as @yuvalsw suggested.
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mkaput)
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @barabanovro)
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.
Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @barabanovro, @mkaput, and @yuvalsw)
crates/cairo-lang-compiler/src/lib.rs
line 106 at r4 (raw file):
/// Runs Cairo compiler. /// /// Similar to `compile_prepared_db_program`, but this function returns all the raw debug information.
fmt
Code quote:
/// Similar to `compile_prepared_db_program`, but this function returns all the raw debug information.
Head branch was pushed to by a user without write access
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @mkaput, @orizi, and @yuvalsw)
crates/cairo-lang-compiler/src/lib.rs
line 106 at r4 (raw file):
Previously, orizi wrote…
fmt
Done.
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @barabanovro)
This PR adds the
compile_prepared_db_with_debug_info
function tocairo-lang-compiler
, allowing the compilation of programs and the retrieval of debug information.This PR will enable cairovm.codes to display Cairo function names in a callstack.
This change is