Branch: refs/heads/main
Revision: 66dfbaa
Author: bradcray
Link: inline all _getIterator calls by bradcray · Pull Request #19429 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19429 from bradcray/inlineGetIterator
inline all _getIterator calls over types
[reviewed by @ronawho]
In a thread starting at Fix bugs stemming from enums with duplicate values by bradcray · Pull Request #18708 · chapel-lang/chapel · GitHub,
@ronawho found that by not having the inline
keyword on this
_getIterator()
call, we generated some extra/dead code
unnecessarily. This adds the keyword to remove that.
Specifically, given a loop like:
enum color { red, green, blue };
for c in color do
writeln(c);
Prior to this PR, the generated loop in C looks has an extra
allocation and free like this:
_ic_these_color_chpl _iterator_chpl = NULL;
...
_iterator_chpl = _getIterator_chpl(INT64(6), INT32(64));
...
call_tmp_chpl37 = ((void*)(_iterator_chpl));
chpl_here_free(call_tmp_chpl37, INT64(6), INT32(64));
whereas these lines disappear with the inline
keyword
added.
Modified Files:
A test/types/enum/enumIterMemCheck.chpl
A test/types/enum/enumIterMemCheck.good
M modules/internal/ChapelIteratorSupport.chpl
Compare: https://github.com/chapel-lang/chapel/compare/878f167511c8...66dfbaa791ea