Commit Graph

1572 Commits

Author SHA1 Message Date
Arnold Schwaighofer
fb08153de0 Fix dynamic replacement runtime when generating replacements from multiple object files
The sections with the replacements get merged and we need to consider all replacements.

SR-10947
rdar://51913012
2019-06-19 15:11:33 -07:00
Ben Langmuir
c42b732e26 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/IRGen/IRGenModule.cpp
2019-06-18 09:35:57 -07:00
Arnold Schwaighofer
5d329464d6 Use thread private key to avoid weak linkage
We use one bit of the third reserved swift private tls key.

Also move the functionality into a separate static archive that is
always linked dependent on deployment target.
2019-06-17 15:03:45 -07:00
Arnold Schwaighofer
eb32194e97 Refactor to use RuntimeAvailability 2019-06-14 13:21:35 -07:00
Arnold Schwaighofer
5003c15079 stdlib: Add backward deployment versions for the
dynamic-replacement runtime functions.

The recent change of how we do dynamic replacements added 2 new runtime
functions. This patch adds those functions to the Compatibility50 static
archive.

This will allow backward deployment to a swift 5.0 runtime.

Patch by Erik Eckstein with a modification to call the standard
libraries implementation (marked as weak) when it is available.

This ensures we can change the implementation in the future and are not
ABI locked.

rdar://problem/51601233
2019-06-14 10:53:26 -07:00
swift-ci
ed38fe6251 Merge remote-tracking branch 'origin/master' into master-next 2019-06-04 10:09:06 -07:00
Joe Groff
4ed8de10f9 Revert "Revert "Use autolinking to pull in compatibility libraries."" 2019-06-03 20:10:51 -07:00
swift-ci
fd329da063 Merge remote-tracking branch 'origin/master' into master-next 2019-06-03 14:29:47 -07:00
Joe Groff
a7cc3a38cc Revert "Use autolinking to pull in compatibility libraries." 2019-06-03 14:18:39 -07:00
swift-ci
40c3c8caa5 Merge remote-tracking branch 'origin/master' into master-next 2019-06-03 08:30:09 -07:00
Joe Groff
a740ee55b2 Merge pull request #25148 from jckarter/runtime-compatibility-autolink
Use autolinking to pull in compatibility libraries.
2019-06-03 08:22:49 -07:00
Joe Groff
dffd1b27a1 Use autolinking to pull in compatibility libraries.
Many build systems that support Swift don't use swiftc to drive the linker. To make things
easier for these build systems, also use autolinking to pull in the needed compatibility
libraries. This is less ideal than letting the driver add it at link time, since individual
compile jobs don't know whether they're building an executable or not. Introduce a
`-disable-autolink-runtime-compatibility` flag, which build systems that do drive the linker
with swiftc can pass to avoid autolinking.

rdar://problem/50057445
2019-05-31 13:11:14 -07:00
swift-ci
d4508c5de0 Merge remote-tracking branch 'origin/master' into master-next 2019-05-30 20:09:36 -07:00
Erik Eckstein
4fb4435d12 IRGen: add an option to disable runtime calls for dynamic replacements.
With the option -Xllvm -basic-dynamic-replacement the runtime functions are not called (so it works with an old swift library).
But calling the original of a replaced function is not supported in this case.
2019-05-30 15:28:16 -07:00
Erik Eckstein
2ea531c3b3 IRGen/runtime: change the code generation for dynamically replaceable functions
Instead of a thunk insert the dispatch into the original function.
If the original function should be executed the prolog just jumps to the "real" code in the function. Otherwise the replacement function is called.
There is one little complication here: when the replacement function calls the original function, the original function should not dispatch to the replacement again.
To pass this information, we use a flag in thread local storage.
The setting and reading of the flag is done in two new runtime functions.

rdar://problem/51043781
2019-05-30 15:28:16 -07:00
Davide Italiano
433f6bf516 [GenDecl] XCOFF should be treated like COFF.
Fixes a build error:

/Users/local/swift/swift/lib/IRGen/GenDecl.cpp:1323:11: error: enumeration value 'XCOFF' not handled in switch [-Werror,-Wswitch]

All the other functions in this file group XCOFF and COFF together
so I guess this is a reasonable thing to do.
2019-05-23 17:18:50 -07:00
swift-ci
eeba41345d Merge remote-tracking branch 'origin/master' into master-next 2019-05-23 16:49:10 -07:00
Arnold Schwaighofer
b127aac1ce Merge pull request #24781 from aschwaighofer/fix_some_type_dynamic_replacement
Fix dynamic replacement of some type when used with associated types
2019-05-23 16:36:32 -07:00
swift-ci
5db4e8dba9 Merge remote-tracking branch 'origin/master' into master-next 2019-05-21 19:29:13 -07:00
Joe Groff
81c7f84ec9 IRGen: Work around JIT bug with GOT equivalents.
SR-10590 | rdar://problem/50968433 appears to be caused by an LLVM JIT bug where GOT-equivalent
globals get emitted with incorrect alignment. Not marking the GOT equivalent as unnamed_addr
(which prevents it from getting folded into the GOT, or other equivalent constants) appears
to work around the issue.
2019-05-21 14:17:07 -07:00
Arnold Schwaighofer
5c3a4d329b Fix dynamic replacement of some type when used with associated types
rdar://50638228
2019-05-18 10:34:52 -07:00
swift-ci
7714b5e862 Merge remote-tracking branch 'origin/master' into master-next 2019-05-03 23:09:28 -07:00
Joe Groff
22793b4567 Fixes for opaque return types on local functions.
- In Sema, don't traverse nested declarations while deducing the opaque return type. This would
  cause returns inside nested functions to clobber the return type of the outer function.
- In IRGen, walk the list of opaque return types we keep in the SourceFile already for type
  reconstruction, instead of trying to visit them ad-hoc as part of walking the AST, since
  IRGen doesn't normally walk the bodies of function decls directly.

Fixes rdar://problem/50459091
2019-05-03 16:53:21 -07:00
swift-ci
13c61ecb15 Merge remote-tracking branch 'origin/master' into master-next 2019-05-03 08:29:43 -07:00
Joe Groff
898665dee5 Merge pull request #24463 from jckarter/opaque-type-sync
NFC opaque type cleanups
2019-05-03 08:22:40 -07:00
Joe Groff
6c779bb487 Merge pull request #24445 from jckarter/opaque-type-remote
Debugger support for opaque types.
2019-05-03 08:18:59 -07:00
Joe Groff
72aa089130 NFC opaque type cleanups
- Add some assertions, and avoid an unnecessary asserting cast
- Replace a no-op access visitor with UNINTERESTING
2019-05-02 20:28:39 -07:00
swift-ci
32e725208d Merge remote-tracking branch 'origin/master' into master-next 2019-05-01 18:10:37 -07:00
Slava Pestov
3b6ec6c651 IRGen: Move some deployment target checks to LangOptions 2019-05-01 15:13:12 -04:00
Bob Wilson
33d9e52e72 Merge remote-tracking branch 'origin/master' into master-next 2019-05-01 09:33:08 -07:00
Joe Groff
4eb064dc21 IRGen: Emit opaque type descriptors for runtime lookup.
If -enable-anonymous-context-mangled-names is enabled, meaning that we assign names to
anonymous context descriptors for discovery by RemoteAST, then include opaque type descriptors
in the type metadata record table so that they can also be found at runtime by RemoteAST for
debugger support.
2019-04-29 18:11:01 -07:00
Doug Gregor
209e7fcd83 [IRGen] Emit lazy opaque type descriptors.
These were recorded but never emitted. Fixes rdar://problem/50258536.
2019-04-27 09:50:23 -07:00
swift-ci
9da051c4e6 Merge remote-tracking branch 'origin/master' into master-next 2019-04-24 08:09:16 -07:00
Arnold Schwaighofer
59ec94b4ed IRGen: Cleanup through use of IRGenFunction 2019-04-22 14:55:09 -07:00
Arnold Schwaighofer
6184bb6a34 IRGen: Traverse function type to find opaque archetypes 2019-04-22 13:03:10 -07:00
Arnold Schwaighofer
a0387eea40 Opaque result types: Dynamic replacement fixes for computed properties 2019-04-22 08:32:43 -07:00
Arnold Schwaighofer
bd2bee7572 [IRGen/TBDGen] Minor fixes for opaque result types.
Fixes rdar://problem/50001229.
2019-04-22 07:50:25 -07:00
Arnold Schwaighofer
84c7b77d02 Make opaque type descriptors dynamically replaceable
This is to support dynamic function replacement of functions with opaque
result type.

This approach requires that all state is thrown away (that could contain the
old returned type for an opaque type) between replacements.

rdar://48887938
2019-04-22 07:31:07 -07:00
swift-ci
53d5e800c1 Merge remote-tracking branch 'origin/master' into master-next 2019-04-19 16:50:46 -07:00
Slava Pestov
d6868acf8a IRGen: Categories on class stubs should go in a separate list and section 2019-04-19 16:50:29 -04:00
swift-ci
89372f876a Merge remote-tracking branch 'origin/master' into master-next 2019-04-18 15:10:40 -07:00
Joe Groff
a99716bbb8 Visit var/subscript opaque return decls during IRGen/TBDGen. 2019-04-17 14:46:22 -07:00
Joe Groff
c58737fb91 merge fixup 2019-04-17 14:46:22 -07:00
Joe Groff
ffc9fd5e38 IRGen: Emit opaque type descriptors. 2019-04-17 14:44:40 -07:00
Joe Groff
ca537d1e86 opaque descriptor wip 2019-04-17 14:44:40 -07:00
Joe Groff
09ca7a784b IRGen: Emit runtime calls to fetch opaque type metadata.
Introduce code to emit runtime calls to get the type metadata for the underlying type of an opaque type and to get its conformances.
2019-04-17 14:43:32 -07:00
Joe Groff
71912bbfd6 AST: Represent OpaqueTypeDecls.
To represent the abstracted interface of an opaque type, we need a generic signature that refines
the outer context generic signature with an additional generic parameter representing the underlying
type and its exposed constraints. Opaque types also need to be keyed by their originating decl, so
that we can treat values of the same opaque type as the same. When we check a FuncDecl with an
opaque type specified as its return type, create an OpaqueTypeDecl and associate it with the
originating decl. (A representation for *types* derived from the opaque decl will come next.)
2019-04-17 14:43:32 -07:00
swift-ci
707344affa Merge remote-tracking branch 'origin/master' into master-next 2019-04-12 07:29:33 -07:00
Slava Pestov
606e226f6f IRGen: Force field descriptors to be emitted when we emit typerefs
Emission of typerefs used by the runtime would force type metadata;
do the same for remote reflection-only typerefs.
2019-04-12 01:46:23 -04:00
Slava Pestov
af83492a45 IRGen: Lazily emit reflection field descriptors
Previously even if a type's metadata was optimized away, we would still
emit a field descriptor, which in turn could reference nominal type
descriptors for other types via symbolic references, etc.
2019-04-12 01:46:23 -04:00