Commit Graph

298 Commits

Author SHA1 Message Date
Zak Kent
6aafeec181 [Immediate] [SILGen] Implement on-demand compilation of globals 2023-08-17 11:03:11 -07:00
Zak Kent
e276c79939 [SIL] [Immediate] Promote linkage of SILFunctions defining requested symbols
Promotes the linkage of `SILFunction`s defining requested symbols,
ensuring they are emitted during IRGen.
2023-08-17 10:11:29 -07:00
Zak Kent
f82fa91de9 [Immediate] Promote linkage of lazily discovered internal symbols 2023-08-17 09:56:40 -07:00
Zak Kent
a6eb4b44c7 [TBD] Refactored SymbolSourceMap to be a typedef 2023-08-17 09:55:49 -07:00
Zak Kent
c0a16d06ed [Immediate] Drop back to RuntimeDyld on Linux 2023-08-14 13:28:23 -07:00
Zak Kent
4616e03f61 [Immediate] Only add renamer plugin on macOS 2023-08-14 13:28:23 -07:00
Zak Kent
514fc1e55f [Immediate] Explicitly move error when returning 2023-08-14 13:28:23 -07:00
Zak Kent
03b539d06e [TBD] [Immediate] Revert implementation of SymbolSourceMap 2023-08-14 13:28:23 -07:00
Zak Kent
5181270a87 [Immediate] Remove unused functions in SwiftJIT 2023-08-14 13:28:22 -07:00
Zak Kent
0b618fe9bf [Immediate] Replace uses of SILMaterializationUnit with EagerSwiftMaterializationUnit 2023-08-14 13:28:22 -07:00
Zak Kent
473a18d2ce [Immediate] Implement EagerSwiftMaterializationUnit 2023-08-14 13:28:22 -07:00
Zak Kent
6abc5c5d39 [Immediate] Re-introduce lazy reexports 2023-08-14 13:28:22 -07:00
Zak Kent
48c36c956d [Immediate] Move SwiftMaterializationUnit to public library 2023-08-14 13:28:22 -07:00
Zak Kent
148cd6acc4 [Immediate] [Sema] Implemented Lazy Type Checking
Implements lazy type checking in Swift Immediate mode,
allowing functions to be type-checked as they are
executed.
2023-08-14 13:28:22 -07:00
Zak Kent
17fedabb5e [Immediate] Implemented SwiftMaterializationUnit
Implemented SwiftMaterializationUnit, supporting
lazy compilation of individual Swift functions.
2023-08-14 13:28:22 -07:00
Zak Kent
94530c7584 [NFC] [Immediate] Lazily materialize global values 2023-08-14 13:28:22 -07:00
Zak Kent
c2c41f8afd [Immediate] Only lazily compile on Darwin
Fallback to eager compilation on Linux
and Windows due to issues with older
versions of JITLink on those platforms.
2023-07-13 10:30:38 -07:00
Zak Kent
e96f1d8d59 [Immediate] Implement whole-module lazy compilation
Establishes the framework for implementing function
at-a-time lazy compilation by adding lazy re-exports.
2023-07-11 15:35:51 -07:00
Zak Kent
a12a6f13ad [Immediate] Refactor Immediate Mode to use Materialization Unit
Refactor Immediate Mode to use the Materialization Unit API,
materializing the entire `SILModule` corresponding to the script
when the `main` symbol is looked up.
2023-07-07 12:23:37 -07:00
Ben Langmuir
e759007256 [Immediate] Workaround for loading merged frameworks in immediate mode
Some frameworks that previously had a separate swift overlay have been
merged in macOS 14. This is causing symbols to not resolve if using the
new SDK but running on an older OS in immediate mode. Ideally we would
handle this automatically in JITLink as is done by the system linker,
but in the meantime add a workaround to load the correct libraries
manually.

rdar://110371405
2023-06-09 16:37:57 -07:00
Steven Wu
09b8af86fb Virtualize swift compiler outputs (#63206)
Using a virutal output backend to capture all the outputs from
swift-frontend invocation. This allows redirecting and/or mirroring
compiler outputs to multiple location using different OutputBackend.

As an example usage for the virtual outputs, teach swift compiler to
check its output determinism by running the compiler invocation
twice and compare the hash of all its outputs.

Virtual output will be used to enable caching in the future.
2023-04-05 23:34:37 +08:00
Erik Eckstein
67a98e9a37 JIT: getAddress -> getValue 2022-11-04 20:44:19 +01:00
Dario Rexin
317a6ab2d4 [Immediate]: Workaround for loading Foundation in immediate mode (#59730)
* [Immediate]: Workaround for loading Foundation in immediate mode

rdar://94645534

* Update Immediate.cpp

* Update Immediate.cpp
2022-06-28 10:03:02 -07:00
swift-ci
da1ab99326 Merge remote-tracking branch 'origin/main' into rebranch 2021-12-22 05:56:01 -08:00
Erik Eckstein
3540c01125 rename initializeLibSwift -> InitializeSwiftModules
and some updates in comments.
2021-12-22 11:31:52 +01:00
swift-ci
41ef4e8c9d Merge remote-tracking branch 'origin/main' into rebranch 2021-12-20 09:15:08 -08:00
Alex Hoppen
fe7878ecce [Serialization] Improve module loading performance
When looking for a Swift module on disk, we were scanning all module search paths if they contain the module we are searching for. In a setup where each module is contained in its own framework search path, this scaled quadratically with the number of modules being imported. E.g. a setup with 100 modules being imported form 100 module search paths could cause on the order of 10,000 checks of `FileSystem::exists`. While these checks are fairly fast (~10µs), they add up to ~100ms.

To improve this, perform a first scan of all module search paths and list the files they contain. From this, create a lookup map that maps filenames to the search paths they can be found in. E.g. for
```
searchPath1/
  Module1.framework

searchPath2/
  Module1.framework
  Module2.swiftmodule
```
we create the following lookup table
```
Module1.framework -> [searchPath1, searchPath2]
Module2.swiftmodule -> [searchPath2]
```
2021-12-14 12:44:13 +01:00
Ben Barham
5343c72d10 [rebranch] Fix missing includes 2021-11-13 17:04:29 +10:00
Evan Wilde
a5f11c4851 Fix the main->next merge conflicts
This cleans up all of the merge conflicts from main into next after the
rebranch merge.
2021-10-15 15:57:55 -07:00
Kuba (Brecka) Mracek
7538949859 Split out CommandLine enum into a separate static library, allow removing it from stdlib (#39591)
This is for the 'freestanding' build to stop assuming the platform has argc/argv.

- Introduce a new sub-library, libswiftCommandLineSupport.a
- Move stubs/CommandLine.cpp into this library
- Conditionally embed it into libswiftCore
- Conditionally embed it into libswiftPrivateLibcExtras if not in libswiftCore to support testing
- Add SWIFT_STDLIB_HAS_COMMANDLINE CMake (and build-script) flag
2021-10-13 07:02:43 -07:00
Arnold Schwaighofer
f958804cdc OrcRPCTargetProcessControl.h -> OrcRPCExecutorProcessControl.h 2021-08-05 12:15:23 -07:00
Evan Wilde
26af94ec2b Fix ExecutionEngine include
LLVM Commit 662c55442f17c changed the name of the header file, causing
some breakage.
2021-07-02 16:45:47 -07:00
swift_jenkins
70b3de8660 Merge remote-tracking branch 'origin/main' into next 2021-06-09 11:40:59 -07:00
Erik Eckstein
809ce72e05 libswift: build support for the initial libswift
* add the (still empty) libswift package
* add build support for libswift in CMake
* add libswift to swift-frontend and sil-opt

The build can be controlled with the LIBSWIFT_BUILD_MODE cmake variable: by default it’s “DISABLE”, which means that libswift is not built. If it’s “HOSTTOOLS”, libswift is built with a pre-installed toolchain on the host system.
2021-06-09 11:25:15 +02:00
swift_jenkins
4cdcfa5991 Merge remote-tracking branch 'origin/main' into next 2021-03-02 08:41:25 -08:00
David Zarzycki
09153bf5af [CMake] NFC: Fix building with LLVM's BUILD_SHARED_LIBS 2021-03-02 09:18:44 -05:00
David Zarzycki
d411b2eda1 Unbreak building against apple/main 2021-01-22 11:48:18 -05:00
David Zarzycki
9df236987c Track upstream LLVM
LLVM 1d0676b54c4e3a517719220def96dfdbc26d8048 moved a function.
2020-11-14 07:34:44 -05:00
Nathan Hawes
ded5512cdc Manually merge remote-tracking branch 'upstream/master' into master-next 2020-08-06 10:42:21 -07:00
Saleem Abdulrasool
8d21750ef3 Frontend: support dumping the JIT state
Add a debugging mechanism that enables the JIT to dump the LLVM IR and
object files to enable debugging the JIT.  This makes it easier to debug
the JIT mode failures.  The idea was from Lang Hames!
2020-08-05 09:13:49 -07:00
swift_jenkins
9192927ebc Merge remote-tracking branch 'origin/master' into master-next 2020-07-16 23:18:54 -07:00
Hamish Knight
c0a2ea7d0e Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.
2020-07-15 17:46:14 -07:00
Hamish Knight
d05bfa09d6 [IRGen] Lift call to performLLVM out of IRGenRequest
Remove the side-effecting call from IRGenRequest,
instead requiring callers to handle the optimization
and emission of the LLVM module.
2020-07-15 16:46:42 -07:00
Hamish Knight
db7fea4665 Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.
2020-07-13 20:42:54 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
swift_jenkins
8069dd1be9 Merge remote-tracking branch 'origin/master' into master-next 2020-05-07 08:20:47 -07:00
swift_jenkins
6af83c13fc Merge remote-tracking branch 'origin/master' into master-next 2020-05-06 20:04:54 -07:00
Slava Pestov
dd0ce1ad13 Remove the integrated REPL 2020-05-06 22:29:05 -04:00
Slava Pestov
60ce308eba Sema: Only run extension binding once
There's no need to walk all imports of all source files, and bind the
extensions defined therein. The only time that a non-main module
contains source files is when using -enable-source-import, and we
can just explicitly call bindExtensions() in the right place.
2020-05-06 19:19:47 -04:00
swift_jenkins
9b6f01b6d9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-30 20:37:34 -07:00