-
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.
Simplify convert-uast's handling of SymExprs and similar (#25946)
This PR makes incremental progress towards having convert-uast handle more of the fully resolved data. It does the following: * instead of using various global variables, use a single `Converter` for all modules and do fixups at the end. To accomplish this, added a wrapper class `UastConverter`, which contains a pointer to the real `Converter` in a way that allows the implementation details of `Converter` to be private to `convert-uast.cpp`. This involved adjusting `parseAndConvert.cpp` which calls the functionality in `convert-uast.cpp`; now it creates a `UastConverter` and passes it to a few functions, calling methods on it to convert uAst to AST. * Remove the complicated handling of fixups in `ConvertedSymbolsMap`. A fixup is needed when the process of converting uAST to AST encounters something that refers to some uAST that is not converted yet. Previous to this PR, fixups were processed at the end of whatever syntactic construct contains both the SymExpr and the target Symbol, but since this could not be relied on in all cases, there was also a global fixups table. The problems with this approach are 1) it makes this code significantly more complicated 2) it can't apply to Types or handle point-of-instantiation in any reasonable way and 3) it does not offer significant performance improvement (as measured with `--dyno-scope-bundled`). So, this PR removes `ConvertedSymbolsMap` and folds the relevant structures into `Converter` so that there is only one mapping of how a symbol/type was converted and only one list of fixups. (There are different fixups lists for different types of things as they are processed differently; but there is no longer a chain of `ConvertedSymbolsMap` each containing fixups lists). * Prepares for type fixups by adding `TemporaryConversionType` which can be used when a type is known but the type has not yet been converted. This is similar to `TemporaryConversionSymbol` but for types. * Adjust `wellknown.cpp` / `wellknown.h` to consider `dtCPointer` and `dtCPointerConst` to be well-known types that need to be handled in a manner similar to `string` and `bytes` records. These will have a dummy `AggregateType` created early in compilation and the details will be filled in when processing the relevant declarations from the module code. `dtCPointer` and `dtCPointerConst` are used in `convert-uast.cpp` when converting C pointer types because the type system in `frontend/` has its own representation for these apart from these classes in the modules. For Cray/chapel-private#6261 Reviewed by @DanilaFe - thanks! - [x] full comm=none testing
- Loading branch information
Showing
11 changed files
with
493 additions
and
457 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
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.