Branch: refs/heads/main
Revision: 9aaabc7
Author: aconsroe-hpe
Link: Begin cleanup of overloaded collecting and iterating by aconsroe-hpe · Pull Request #19240 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19240 from aconsroe-hpe/marking-expanding-and-preorder
Begin cleanup of overloaded collecting and iterating
reviewed by @dlongnecke-cray
This begins an effort to refactor the collect_asts and forv_Vec functions/macros. Specifically:
- informally deprecates
collect_astsin favor of an explicit use of
collect_{pre,post,un}order
- This is to make it explicit at the call site what the consumer
needs so that in the future, we have more flexibility for the case
where the consumer doesn't care about iteration order - There is only one known callsite that depends on the implicit
preorder, which has been moved tocollect_preorder. All other
sites are left indeterminate and are part of future work
- adds a companion macro
forv_expanding_Vecwhich makes the old
implicit behavior that allforv_Vecwould continue iteration while
the vector was resized during iteration.
- Most callsites did not depend on this behavior, and marking the
callsite that do will help in future work when working on those
parts - for
std::vector, you should useexpandingIteratoriterator
adapter with a range-for
- Switches the
for_vectormacros to use a range-for with an
uptoNullptrIterator
- these previously did not support expanding iteration, so the
nullptr iterator is the only adapter we need
The motivation behind these changes is to make it easier to reason
about code, specifically to support refactorings to use a PassManager,
which ties deeply into collecting and iterating. Many things in this
PR are left as future work, where they will be addressed
incrementally, since the programmer will be able to revisit the
assumptions each use of collection or iteration.
-
[x] paratest pass
-
[x] paratest with comm
Modified Files:
A compiler/dyno/test/util/testIteratorAdapters.cpp
R compiler/include/oldCollectors.h
M compiler/AST/AstDumpToNode.cpp
M compiler/AST/astutil.cpp
M compiler/AST/iterator.cpp
M compiler/codegen/codegen.cpp
M compiler/dyno/include/chpl/util/iteration.h
M compiler/dyno/test/util/CMakeLists.txt
M compiler/include/astutil.h
M compiler/include/baseAST.h
M compiler/include/iterator.h
M compiler/include/stlUtil.h
M compiler/include/vec.h
M compiler/optimizations/forallOptimizations.cpp
M compiler/optimizations/optimizeForallUnorderedOps.cpp
M compiler/parser/parser.cpp
M compiler/passes/createTaskFunctions.cpp
M compiler/passes/errorHandling.cpp
M compiler/passes/externCResolve.cpp
M compiler/passes/insertLineNumbers.cpp
M compiler/passes/insertWideReferences.cpp
M compiler/passes/normalize.cpp
M compiler/passes/parallel.cpp
M compiler/passes/scopeResolve.cpp
M compiler/resolution/callDestructors.cpp
M compiler/resolution/cleanups.cpp
M compiler/resolution/functionResolution.cpp
M compiler/resolution/lowerForalls.cpp
M compiler/resolution/lowerIterators.cpp
M compiler/resolution/virtualDispatch.cpp
M compiler/util/exprAnalysis.cppCompare: Comparing a968e23899f3...9aaabc79cbe7 · chapel-lang/chapel · GitHub