Moving code in macro arguments out of macros#6432
Merged
Merged
Conversation
Member
|
Recent commit (inlining h_set_without_ib_adjustment) caused conflict. I will merge this once you have resolved the conflict. |
In `src/hash.c`, there are code blocks that are passed as macro arguments. These code blocks are interpreted as part of the macro function, so breakpoints cannot be set in the debugger. Also, the gcov command will aggregate them to the caller, and the code in the block will not be counted. This patch will prevent them from being interpreted as part of a macro, and thus the aforementioned problems will no longer occur.
Contributor
Author
|
The change is to remove the prototype declaration by moving the definition position of The prototype declaration of |
Member
|
Thank you! |
dearblue
added a commit
to dearblue/mruby
that referenced
this pull request
Jan 20, 2025
This is a mruby#6432 supplement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In
src/hash.c, there are code blocks that are passed as macro arguments. These code blocks are interpreted as part of the macro function, so breakpoints cannot be set in the debugger. Also, the gcov command will aggregate them to the caller, and the code in the block will not be counted.This patch will prevent them from being interpreted as part of a macro, and thus the aforementioned problems will no longer occur.
This patch has a performance impact.
Checked with
valgrind --tool=cachegrind,bin/mrbtestincreases the number of instruction cycles by 0.4 %, and the microbenchmark shown at #6414 (comment) 2478972123 increases the number of instruction cycles by about 10 %.