-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dyno: materialize iterators into arrays where necessary (#26549)
This PR implements saving iterators into arrays, closing #26466. Brad outlines a number of special cases in #26466 (comment). Fortunately, these special cases are all implemented in module code; as a result, rather than making Dyno reason about the shapes / domains of iterators, this PR simply took the route of enabling the resolution of various code in `ChapelArray`. This included: 1. Implementing the `_iteratorRecord` type (which simply accepts any `IterableType`). This is required to select the various `chpl__initCopy` overloads for constructing arrays. 2. Enabling computing `_shape_` on iterators. This has two components: actually computing the shape (which is implemented using a Dyno query), and exposing a `_shape_` field through special casing (like `eltType` in Dyno's `c_ptr`). Crucially, reflection was used to check if `_shape_` was set; this meant ensuring that `name to field num` and other primitives work correctly with "phantom" fields on iterable types. 3. Ensuring that types that are instantiations (including via their parent types) always have an `instantiatedFrom`, since that field is used in many places to quickly check if a type is instantiated. I originally thought it would make more sense to stop relying on that invariant, but have come to a decision that quick checks of `instantiatedFrom` are most elegant. 4. Adjusting various places in the Resolver and InitResolver to support invoking `init` on arrays, and running the arrays' constructors. This was needed because module code calls `new _array`. 5. Fixing a bug in which parenless procedures returning values could not be called on class types due to a mis-use of `toCompositeType` vs `getCompositeType`. 6. Many more fixes, too numerous to be listed here with any value. Many fixes correspond to individual commits; consider reading through the commit list to see if anything jumps out. ## Future work * Move `makeConst` etc to `Qualifier` * Adjust `ArrayType` to lean on `_instance` more (@riftEmber) * Consider using a global `QualifiedType()` to be able to return references and avoid constructing QTs when not needed. # Testing - [x] dyno tests - [x] paratest
- Loading branch information
Showing
29 changed files
with
858 additions
and
115 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.