[Chapel Merge] Turn some subpasses in callDestructors into PassMa

Branch: refs/heads/main
Revision: e4efca9
Author: dlongnecke-cray
Link: Turn some subpasses in callDestructors into PassManager passes by dlongnecke-cray · Pull Request #19858 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19858 from dlongnecke-cray/dyno-pass-call-destructors-0

Turn some subpasses in callDestructors into PassManager passes (#19858)

Turn some subpasses within the callDestructors pass into passes
runnable by the new PassManager.

The functions turned into passes are:

  • createIteratorBreakBlocks(): Lowering, creates blocks to
    cleanup local variables in an iterator at each yield point
  • fixupDestructors(): Generate destructor bodies by issuing
    concrete destructor calls for each field
  • insertAutoDestroyPrimsForLoopExprTemps(): Fixes a memory
    leak related to bracket loops being interpreted as types?
    Not entirely sure, but a pass meant to fix a leak.

Additionally, adjust the pass managers to iterate over the Vec
and std::vector types using fixed-length index based iteration
instead of range based for (e.g., for (int i = 0; ...) versus
for (auto x : vec). This is because some passes over e.g.,
CallExpr will also insert additional calls into the global vector,
which causes iterator invalidation if the vector is resized.

Preemptively adjust the convertClassTypes pass so that it does
not take a function pointer argument, and calls convertToCanonical
instead. I think in the future dyno should probably just emit
canonical class types directly, though.

Reviewed by @mppf. Thanks!


  • [x] ALL on linux64, standard

Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com

Modified Files:
M compiler/AST/DecoratedClassType.cpp

M compiler/AST/iterator.cpp
M compiler/include/PassManager.h
M compiler/include/passes.h
M compiler/include/vec.h
M compiler/resolution/callDestructors.cpp

Compare: https://github.com/chapel-lang/chapel/compare/e4b867886f23...e4efca905abd