Skip to content

Rework the integrated REPL to use separate modules for every line #19485

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

Merged
merged 8 commits into from
Sep 26, 2018

Conversation

jrose-apple
Copy link
Contributor

...like LLDB does, instead of parsing into a single SourceFile. This does break some functionality:

  • no more :dump_ast
  • no redeclaration checking, but no shadowing either—redeclarations just become ambiguous
  • pretty much requires EnableAccessControl to be off, since we don't walk decls to promote them to public like the proper REPL

...but it allows us to remove a bit of longstanding support for type-checking / SILGen-ing / IRGen-ing only part of a SourceFile that was only used by the integrated REPL.

...which, need I remind everyone, is still deprecated...but sometimes convenient. So most of it still works.


Also removes support for -enable-source-import in the JIT. This is the only part of this PR that should affect non-integrated-REPL uses.

Ah, the pre-Swift-1 days... -enable-source-import may come back in
some form some day, but it's not supported now.
It's still not working very well (23 failing tests, 1 UXPASS), but at
least I can run it again. We probably need a bot.
This was full of cruft to begin with, and -enable-source-import has
plenty of other problems. Remove support for IRGen-ing those other
modules.
Useful in the LLDB REPL, and also for what I'm about to do to the
integrated REPL.
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please asan test

@slavapestov
Copy link
Contributor

Cool! We could also pull the “make everything public/open” walker out of lldb and into the frontend if we really wanted to...


SourceFile::ImportOptions ImportOpts;
ImportOpts |= SourceFile::ImportFlags::Exported;
REPLInputFile.addImports({{{{}, MostRecentModule}, {}}});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I should clean up this ridiculous initializer list.

@jrose-apple
Copy link
Contributor Author

I don't really know who should review this, so I'm going to nominate @slavapestov as an all-arounder and already-commenter.

...like LLDB does, instead of parsing into a single SourceFile.
This does break some functionality:

- no more :dump_ast
- no redeclaration checking, but no shadowing either---redeclarations
  just become ambiguous
- pretty much requires EnableAccessControl to be off, since we don't
  walk decls to promote them to 'public'

...but it allows us to remove a bit of longstanding support for
type-checking / SILGen-ing / IRGen-ing only part of a SourceFile that
was only used by the integrated REPL.

...which, need I remind everyone, is still /deprecated/...but sometimes
convenient. So most of it still works.
This was only used by the integrated REPL, and is now a dead option.

The "StartElem" option for performTypeChecking is still used for
reading SIL files, which have AST and SIL blocks alternate.
Parsing additional declarations from a separate buffer into an
existing SourceFile is definitely a hack, but again, the integrated
REPL is deprecated and does not deserve real attention.
No functionality change. Unfortunately we still need the flag in
SILModule itself because of the ability to create an empty SILModule
and parse SIL into it incrementally, which can happen before there's
a FileUnit to use as the associated DeclContext instead of a
CompilerInstance's main module.
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov self-requested a review September 26, 2018 07:29
@jrose-apple jrose-apple merged commit bf5133d into swiftlang:master Sep 26, 2018
@jrose-apple jrose-apple deleted the disintegrated branch September 26, 2018 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants