-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have the frontend library drive the process of parsing #25125
Conversation
6a02083
to
ae655bc
Compare
b87ea4c
to
717440f
Compare
@@ -1 +0,0 @@ | |||
require "c-ray.chpl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain why you switched this to symlinks over require
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require
alone does not cause the modules brought in to not be dead (per the discussion in #25112). So, the old version would be equivalent to an empty source file (and do nothing useful).
Since c-ray.chpl
creates the implicit module module c-ray
which has a name that is not a valid identifier, I can't use c-ray;
. Changing it to a symlink was the smallest change I could think of to get it working.
I don't think require
is particularly relevant for what this test is doing. I think it was just a way to not use
c-ray.chpl since it has an unfriendly name.
test/library/packages/SortedSet/general/types/testWithRecord.good
Outdated
Show resolved
Hide resolved
6544ac2
to
c282654
Compare
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
And include dtTuple in the process This is to fix internal errors with test/types/tuple/bradc/tupleOfArray.chpl caused by using dtTuple in build.cpp before it is initialized --- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
By putting the work of checkBuilderResult into a query --- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
This comes up with e.g. optimizations/sungeun/RADOpt/access2d --- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
For startsWith and replacePrefix --- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
So that these tests can pass: performance/sungeun/multilocale/locale runtime/configMatters/comm/cache-remote/atomic --- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
It should be OK for scopeForIdQuery to handle include statements because it should use constructScopeQuery so as to avoid ending up with two Scopes for the same ID --- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
c282654
to
cb464a2
Compare
Follow-up to PR #25125 to remove an unused variable that causes problems when building the compiler with `clang`. Reviewed by @riftEmber - thanks!
Follow-up to PR #25125. Adjusts getExistingFileInModuleSearchPath to avoid issuing an ambiguity warning for CHPL_LOCALE_MODEL=gpu where it is intentional that modules/internal/localeModels/gpu/ChapelGpuSupport.chpl is used instead of the fallback modules/internal/ChapelGpuSupport.chpl It does that by fixing getExistingFileInModuleSearchPath to avoid the warning if both are bundled modules. However, for this to work in a straightforward manner, I needed also to improve some of the related code, which was not handling cases such as "." being a module search path (because it was using prefix checks rather than something file-path aware). Reviewed by @dlongnecke-cray - thanks! - [x] ambiguity warning no longer issued when compiling with CHPL_LOCALE_MODEL=gpu - [x] full comm=none testing
Follow-up to PR #25125. Resolves #23100. Resolves #23129. This PR adjusts `use` and `import` processing to make it case sensitive even on non-case-sensitive filesystems. `use M` or `import M` directs the compiler to go find `M.chpl` in the module search path (assuming there is not already an `M` in scope). One case-insensitive filesystems this presents a problem. On such filesystems, file names have case, so `Foo.chpl` is different from `foo.chpl`. However, you can open such a file with any case, so you could open `Foo.chpl` with `FOO.CHPL` or `foo.chpl` or anything in-between. This causes problems for the module search process: * failures on some platforms when there is another file in a different directory with different casing (see issue #23100) * tests are more sensitive to platform than we would like (see #23129) * `import Library` can load `library.chpl` even though Chapel is case-sensitive (see the test `test-import-wrong-case.chpl` added in this PR). This can cause a confusing situation since Chapel can implicitly create a module based on the file name, and this would be `Library` for `import Library` but `library` for `import library` even though it uses the same file. This PR implements the case-sensitive handling for use/import by matching file names against a directory listing of the containing directory. This PR also includes minor changes to address problems from PR #25125 when compiling with LLVM 11. Reviewed by @dlongnecke-cray - thanks! - [x] resolves ambiguity warning for primers tests on Mac OS X - [x] `make && make check` works when using LLVM 11 - [x] full local comm=none testing
Follow-up to PR #25125 to avoid a valid warning about surprising shadowing. Trivial and not reviewed.
This PR adjusts the integration between the frontend library and the rest of the compiler. It changes it so that only live modules are converted from uAST to AST and so that this process occurs in the module initialization order. This is expected to reduce the number of fixups required.
There are a few user-facing changes in various edge cases:
require "something.chpl";
interacts with the process of determining the main module & live modules.require
statements no longer impact the determination of the main module & a module brought in byrequire
will actually be dead-code-eliminated if it is notuse
orimport
ed. See also issue How should 'require something.chpl' interact with finding the main module? #25112 for discussion of these changes.test/modules/bradc/userInsteadOfStandard
which is meant to show what happens if a user inadvertently creates a module with the same name as a standard module. This PR changes the ambiguous module chosen from./ChapelIO.chpl
to the standard library one and adds an unstable warning for such ambiguous module situations. See issue module search path ordering and name conflicts with bundled modules #25306 for discussion about what should happen in these cases.use
statement.use
orimport
ed are no longer emitted. The reason for this is that these modules are eliminated earlier in compilation.More detail about implementation changes in this PR:
module M { M; }
-- hereM
can refer to the enclosing module name even withoutuse
orimport
. This case was previously being handled by the production scope resolver._tuple
to the list of things that are processed in this way. Note that this involved moving several global variables for well-known types to wellknown.h / wellknown.cpp from various other locations.currentModuleType
, pass the current module tag tobuildManageStmt
.nestedName
warning fromcheckUast.cpp
topost-parse-checks.cpp
(note thatcheckUast.cpp
checks the production AST just after it was created by converting the uAST to it & shoul[d be renamed tocheck-generated-ast.cpp
). Since this warning works with theImplicitFileModule
warning, I adjustedparseAndConvert.cpp
to delay them both, so they can be issued together.gConvertFilterModuleIds
for the live module analysis to communicate toconvert-uast.cpp
which modules should be converted. Using a global variable in this way is not ideally and ideally this would be managed by having convert-uast.cpp only convert one module at a time.parseAndConvert.cpp
. Now the dyno code / frontend is in charge of deciding what to parse and convert and that process works withchpl::parsing::findMainAndCommandLineModules
andchpl::resolution::moduleInitializationOrder
to decide the order in which modules should be converted. I ran into some challenges where other parts of the compiler assume that certain modules appear early inallModules
or that their DefExprs appear early in a traversal overtheProgram
.processInternalModules
works around these issues by rearranging the key modules to appear in an order that matches what the rest of the compiler is used to.startsWith
andreplacePrefix
) in a newstring-utils.h
/string-utils.cpp
in the frontend library.Context::error
& related methods to various Error handling classes to accept anIdOrLocation
in order to wire up errors that indicate<command line>
as the location for the error.libraryMode
tofindMainAndCommandLineModules
to hide errors about the main module when creating a library. I also added some helper functionscheckFileExists
getExistingFileInDirectory
getExistingFileInModuleSearchPath
to support some operations using the module search path.Scope
to track if it contains arequire
statement. This allowsresolveVisibilityStmts
to more accurately filter on whichScope
s have meaningful work to do in order to resolve use/import/require.deduplicateSamePaths
tofilesystem.h
/filesystem.cpp
that uses LLVM Support library functions to detect and remove paths that are redundant because they refer to the same filesystem element.findMainModuleImpl
to consult the modules loaded as library files as a potential source for the main module. I also improved the error messages from this function.addCommandLineFileDirectories
& adjusted it to put the command line file directories and-M
paths before the paths fromCHPL_MODULE_PATH
.doLookupEnclosingModuleName
to implement lookup for cases likemodule M { M; }
. I ran into problems with certain files named a keyword, so this usesisReservedIdentifier
to ignore module name lookups for implicit modules with those names. It would be nice to adjust the lookup process to be more robust in this way, but this is the simple solution. See also some reserved words can't be used as a file name #19197 which tracks problems in this area.resolveVisibilityStmts
processrequire
with the module search directory if there are no/
s in the path. I also adjusted it to process modules loaded byrequire
. This addresses a pattern currently used intest/parsing/errors/nameLength
where the main filerequire
s another, whichrequire
s a third file; and then the main fileuse
s a module expected to be made available by this nestedrequire
.Reviewed by @DanilaFe - thanks!
CHPL_COMM=gasnet
testing