Commit Graph

1537 Commits

Author SHA1 Message Date
Arnold Schwaighofer
3c125a74f0 arm64e: Workaround ptrauth-returns failure for swifttailcc
The current code generation will emit an autibsp after adjusting the
stack pointe for the tail call. If callee and caller argument area does
not match this would fail.
2021-03-17 07:41:10 -07:00
John McCall
2012195cd5 Alter the runtime interface for awaiting futures and task groups.
First, just call an async -> T function instead of forcing the caller
to piece together which case we're in and perform its own copy.  This
ensures that the task is actually kept alive properly.

Second, now that we no longer implicitly depend on the waiting tasks
being run synchronously, go ahead and schedule them to run on the
global executor.

This solves some problems which were blocking the work on TLS-ifying
the task/executor state.
2021-02-21 23:48:13 -05:00
Erik Eckstein
f45855d2aa IRGen: always ensure that a function has a IRGenModule for emission
In case a function is only referenced from a global without a declaration (e.g. an outlined global), we could end up with a null IRGenModule for the function (with multithreaded compilation). In this case, just use the primary IGM.
This fixes a IRGen crash, introduced with https://github.com/apple/swift/pull/35780

rdar://74358251
2021-02-16 22:27:39 +01:00
Zoe Carver
74b7341b2d Merge pull request #32378 from zoecarver/cxx/copy-const
[cxx-interop] Use user defined copy constructor to copy C++ objects.
2021-02-03 22:39:57 -08:00
zoecarver
b2b7f7b853 [cxx-interop] Use user defined copy constructor to copy C++ objects.
If a user-defined copy constructor exists, use that to copy imported C++
types.
2021-02-03 14:34:07 -08:00
swift-ci
601af1352a Merge remote-tracking branch 'origin/main' into rebranch 2021-01-27 15:32:37 -08:00
Nate Chandler
e21550ad90 [SILGen] Enable alternative entry point name.
Previously, the name of the entry point function was always main.  Here,
a new frontend flag is added to enable an arbitrary name to be
specified.

rdar://58275758
2021-01-26 10:43:33 -08:00
swift-ci
b19211a83f Merge remote-tracking branch 'origin/main' into rebranch 2021-01-15 10:52:36 -08:00
Nate Chandler
130c5185d3 [Async CC] Handle dynamic functions.
Ensure that the FunctionPointer we pass to CreateCall has the Function
type.

rdar://problem/73026036
2021-01-14 17:20:07 -08:00
swift_jenkins
c6da2fb887 Merge remote-tracking branch 'origin/main' into next 2020-12-07 14:31:04 -08:00
Saleem Abdulrasool
5bd27db2ee IRGen: correct decoration handling for x86
When building the label for the IAT synthetic, we need to pre-decorate
the symbol before we apply the synthetic symbol prefix lest we end up
placing the user-label prefix over the synthetic symbol rather than the
actual symbol.  This is required to correctly resolve symbols when
building the standard library for x86.
2020-12-06 21:35:23 -08:00
swift_jenkins
c3c8e6dd18 Merge remote-tracking branch 'origin/main' into next 2020-11-13 09:58:56 -08:00
Nate Chandler
2d21932672 [Async CC] Add constant "pointer" for async func.
An AsyncFunctionPointer, defined in Task.h, is a struct consisting of
two i32s: (1) the relative address of the async function and (2) the
size of the async context to be allocated when calling that function.

Here, such structs are emitted for every async SILFunction that is
emitted.
2020-11-12 18:20:10 -08:00
swift_jenkins
00d5035939 Merge remote-tracking branch 'origin/main' into next 2020-11-04 19:36:54 -08:00
nate-chandler
5c59babfeb Merge pull request #34490 from nate-chandler/generic-metadata-prespecialization-components/special-entry
[metadata prespecialization] Add canonical records to cache.
2020-11-04 19:35:40 -08:00
Arnold Schwaighofer
97e5e01fe2 Merge remote-tracking branch 'origin/main' into next 2020-11-04 12:20:35 -08:00
Slava Pestov
bfee5fb800 IRGen: Emit list of Objective-C resilient class stubs in __objc_stublist section
Part of <rdar://problem/55000892>.
2020-11-02 17:01:42 -05:00
Nate Chandler
1bbd0f486c [IRGen] Call getCanonicalPrespecializedGenericMetadata.
When emitting the metadata accessor for a generic type for which
canonical prespecialized metadata records have been formed, rather than
calling getGenericMetadata, instead call
getCanonicalPrespecializedGenericMetadata and pass to it the once token
which will guard that the canonical prespecialized metadata records
attached to the nominal type descriptor are only added to the metadata
cache once.
2020-11-01 13:35:04 -08:00
Nate Chandler
a68fcb155b [prespecialized metadata] Add token for caching.
Emit a once token when adding canonical prespecialized metadata records
to a nominal type descriptor and add the token itself as a trailing
object to the type descriptor.  The new token will, in subsequent
commits, enable the canonical prespecialized metadata records attached
to the type descriptor to be added to the metadata cache exactly once.
2020-11-01 13:34:22 -08:00
swift_jenkins
fa32dc6ba7 Merge remote-tracking branch 'origin/main' into next 2020-10-30 00:09:25 -07:00
David Smith
0180aca9fc Merge branch 'main' into david/fix-merge-conflict 2020-10-27 13:05:20 -07:00
Ellis Hoag
3aa081c56e [IRGen] Call objc_direct methods correctly 2020-10-23 11:54:07 -05:00
zoecarver
f04de9f128 [cxx-interop] Skip metatypes when lowering C++ constructor SIL function type.
When lowering a C++ constructor's function type to a SIL function type,
skip over the "self" metatype parameter.
2020-10-09 10:42:54 -07:00
zoecarver
9e2d03e0a8 [cxx-interop] Skip void types in emitCXXConstructorThunkIfNeeded.
emitCXXConstructorThunkIfNeeded receives a SIL function that may contain
metatypes. If so, they will be converted to void and we need to skip
them when emitting the thunk's args.
2020-10-09 10:42:53 -07:00
Martin Boehme
b2c5a3eeed Add a constructor thunk if required to add additional constructor
arguments.

Also add more IR tests and make various other changes.
2020-10-09 10:42:48 -07:00
swift_jenkins
75c4b09f51 Merge remote-tracking branch 'origin/master' into master-next 2020-09-15 15:41:58 -07:00
Hamish Knight
add22194fd [SILGen] Allow lazy type-checking
Remove the type-checking call from
OptimizedIRRequest, and sink it down into SILGen
and IRGen when we come to emit the source files.
2020-09-15 19:20:10 +01:00
swift_jenkins
b37089c76b Merge remote-tracking branch 'origin/master' into master-next 2020-09-10 22:30:58 -07:00
Brent Royal-Gordon
cff4ddf13a [NFC] Adopt new ImportPath types and terminology
# Conflicts:
#	lib/IDE/CodeCompletion.cpp
2020-09-10 19:07:49 -07:00
swift_jenkins
39a0bc2296 Merge remote-tracking branch 'origin/master' into master-next 2020-09-03 21:31:53 -07:00
Slava Pestov
0bedd20ddd IRGen: Emit hoisted declarations at the top level 2020-09-03 16:16:51 -04:00
swift_jenkins
f60f839098 Merge remote-tracking branch 'origin/master' into master-next 2020-08-27 04:10:57 -07:00
swift_jenkins
7bda7aaf2c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-27 04:06:41 -07:00
David Zarzycki
a53f3633c0 [IRGen] NFC: Simplify IRGenModule::defineTypeMetadata
Also make `IRGenModule::getAddrOfTypeMetadata()` more clear that a GEP
is being forced and optional aliasing is involved rather than imply that
full metadata always requires a GEP (which it does not).
2020-08-26 07:03:09 -04:00
Nathan Hawes
c453ddf758 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-17 09:45:56 -07:00
swift_jenkins
6904522d4f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-15 12:54:19 -07:00
Nate Chandler
e23cc54145 [IRGen] Skip reemitting fields referenced by type context descriptor.
When reemitting a type context descriptor, several fields
- method lookup function
- dispatch thunk
- nonoverride method descriptor
were previously being reemitted.

In a couple of earlier commits, that behavior was altered to delete the
fields before reemitting them.

  3ad2777a68 [IRGen] Erase nonoverride descriptor on emission.
  c25c180c08 [IRGen] Erase thunks before emission.

Here, the behavior is changed to simply exit early when these fields are
being reemitted.  Also an assertion is added that these fields are
redefined only when reemitting the type context descriptor.
2020-08-15 09:54:54 -07:00
swift_jenkins
9ab003bcf9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-14 15:14:01 -07:00
Nate Chandler
a5a7c98be0 [metadata prespecialization] getGenericMetadata finds records.
Previously, the metadata accessor for which canonical prespecializations
had been formed included checks against the passed-in arguments to
determine whether the access matched a prespecialized record or not.

Now that the prespecialized records are attached to the nominal type
descriptor for the type, eliminate this hard-coded generated code and
instead let swift_getGenericMetadata do the work of looking through the
prespecializations.
2020-08-14 11:19:10 -07:00
Nathan Hawes
f0c8b8e571 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-14 11:06:27 -07:00
nate-chandler
6dddf96faf Merge pull request #33442 from nate-chandler/generic-metadata-prespecialization-components/record-canonical-prespecializations
[metadata prespecialization] Add canonical prespecialization to end of type descriptors.
2020-08-14 09:59:26 -07:00
Nate Chandler
5114f22e5e [metadata prespecialization] Reemit dependent values.
The metadata accessor and type context descriptor for a nominal type
both depend on canonical metadata--the former because it returns those
metadata, the latter because it has them as trailing objects.

Here, the work is done to reemit those values when new canonical
prespecialized metadata are encountered.
2020-08-13 17:44:05 -07:00
swift-ci
1d9bad4039 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-13 17:23:10 -07:00
Saleem Abdulrasool
fc164ce098 IRGen: be less aggressive about applying COMDAT
COMDAT can only be applied to definitions, not declarations.  This
manifested in builds of llbuild with SwiftPM on Windows.  The nominal
type descriptor accessor declaration was marked as COMDAT.
2020-08-13 10:42:03 -07:00
Nate Chandler
665100d74f [IRGen] Teach defineAlias to replace useds.
Previously, it was possible to alias an old LinkEntity which was marked
used (i.e. in LLVMUsed) or compiler used (i.e. in LLVMCompilerUsed).
The result of defining such an alias was a failure downstream when
writing out the lists of globals.

Here, the old value is removed from the list before it is invalidated.
2020-08-12 19:18:23 -07:00
David Zarzycki
00f4700496 Handle expanded enums in upstream LLVM (ZOS and GOFF) 2020-08-12 09:05:38 -04:00
swift_jenkins
baf7116b7c Merge remote-tracking branch 'origin/master' into master-next 2020-08-08 18:07:37 -07:00
swift-ci
4dd4a42112 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-08 18:04:04 -07:00
John McCall
03d94b44a6 Add default IR attributes to helper functions and convert
several more places to use getOrCreateHelperFunction.

This means that several of these places are now emitting
shared functions rather than private ones, which I've
verified is okay.  There are some other places where
privacy is still unfortunately necessary.

I've also fixed the name of the store-extra-inhabitants
helper function to say "store" instead of "get", which
is longstanding (but harmless because it's private).

Fixes rdar://66707994.
2020-08-08 16:57:02 -04:00
Nathan Hawes
8435dc7d20 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 14:21:08 -07:00