Commit Graph

3149 Commits

Author SHA1 Message Date
swift-ci
6f31afb7a3 Merge pull request #64427 from al45tair/eng/PR-106813646
[Backtracing] Disable the warning about not finding swift-backtrace.
2023-03-16 12:32:09 -07:00
Alastair Houghton
725d2e1d1b [Backtracing] Disable the warning about not finding swift-backtrace.
This needs to be disabled for now.  We'll re-enable it later.

rdar://106813646
2023-03-16 17:13:10 +00:00
Kuba (Brecka) Mracek
78a406a75d In Metadata.h/.cpp, start building the relative wtable support even on platforms that don't use it yet (#64354) 2023-03-15 09:41:40 -07:00
Konrad `ktoso` Malawski
41f99fc2ae [Executors][Distributed] custom executors for distributed actor (#64237)
* [Executors][Distributed] custom executors for distributed actor

* harden ordering guarantees of synthesised fields

* the issue was that a non-default actor must implement the is remote check differently

* NonDefaultDistributedActor to complete support and remote flag handling

* invoke nonDefaultDistributedActorInitialize when necessary in SILGen

* refactor inline assertion into method

* cleanup

* [Executors][Distributed] Update module version for NonDefaultDistributedActor

* Minor docs cleanup

* we solved those fixme's

* add mangling test for non-def-dist-actor
2023-03-15 23:42:55 +09:00
Arnold Schwaighofer
7afab4735d Runtime: Fix swift_getAssociatedTypeWitnessRelativeSlowImpl for MetadataOrPack change 2023-03-14 07:58:12 -07:00
Mike Ash
1dfd1ede9e Merge pull request #64327 from mikeash/fewer-news
[Runtime] Remove a few uses of operator new/delete.
2023-03-14 08:57:44 -04:00
Joe Groff
730c5cf632 Merge pull request #64295 from jckarter/noncopyable-hide-field-types
Don't let reflection handle noncopyable types yet.
2023-03-13 17:01:25 -07:00
Mike Ash
69d0905e80 [Runtime] Remove a few uses of operator new/delete.
Replace them with swift_cxx_newObject/swift_cxx_deleteObject to avoid calling overridden global operators. Overridden global operators can sometimes fail when called from places the authors didn't expect.

The particular uses being changed here are:

1. Creation of new SingletonMetadataCacheEntry objects.
2. Allocation of the _globalIvarOffsets array in initGenericObjCClass.
3. Creation/destruction of SwiftTLSContext objects.

rdar://106238547
2023-03-13 16:05:37 -04:00
Joe Groff
4d6d7657fa Don't let reflection handle noncopyable types yet.
We don't have any language or runtime support for noncopyable types as generic
or dynamic types yet, and existing reflection code almost certainly assumes it
can copy the values it's working with, and will trap or corrupt state if it does
so with noncopyable types. But a class can have noncopyable fields while the
type itself is copyable, and existing code assumes that it can use `Mirror` or
other reflection mechanisms to safely traverse the contents of an arbitrary
class.

Allow this sort of code to continue working, while still preparing for forward
compatibility with future runtimes that do support noncopyable generics, by
emitting the type references for fields using a function that probes the
address of a new symbol in the Swift runtime. The symbol will either be missing
or defined with an absolute address of zero in current or previous runtime
versions, but can be changed to a non-null address in the future.
2023-03-13 11:50:24 -07:00
Joe Groff
e4d3d6d838 Merge pull request #64215 from jckarter/noncopyable-hide-type-metadata-records
IRGen: Hide type metadata records for noncopyable types from discovery by existing runtimes.
2023-03-09 11:08:28 -08:00
Slava Pestov
d776f71b4f Runtime: Teach checkGenericRequirements() to check same-shape and conformance pack requirements 2023-03-09 09:42:00 -05:00
Slava Pestov
2cf1241a7c Runtime: Extract checkGenericRequirement() from checkGenericRequirements() 2023-03-09 01:54:51 -05:00
Slava Pestov
17086962c3 Runtime: Add swift_getTypePackByMangledName() entry point
For now this has SWIFT_RUNTIME_LIBRARY_VISIBILITY, but in the
future we might want to make it public so that IRGen can use it
to build packs out of concrete types.
2023-03-09 01:54:51 -05:00
Slava Pestov
cdd1c6da57 Runtime: Move MetadataOrPack to Private.h 2023-03-09 01:54:51 -05:00
Slava Pestov
ae2c3a5820 Runtime: Fix silly bug in MetadataCacheKey::operator== 2023-03-09 01:54:51 -05:00
Slava Pestov
2b68ee1065 Runtime: Teach _gatherWrittenGenericArgs() about metadata packs 2023-03-09 01:54:51 -05:00
Slava Pestov
bcf6f26579 Runtime: Make SubstGenericParametersFromWrittenArgs and _gatherWrittenGenericArgs() completely private to MetadataLoookup.cpp 2023-03-09 01:54:51 -05:00
Slava Pestov
39aa4d4001 Runtime: Preliminary refactoring for demangling variadic generic types to metadata 2023-03-09 01:54:51 -05:00
Slava Pestov
affd1bf8fd AST: Fold RequirementBase into it's three subclasses
It's a very simple algebraic data type, and factoring it out into
a template doesn't carry its weight.
2023-03-09 01:54:51 -05:00
Slava Pestov
8731eb4394 Runtime: On-heap packs know their own length 2023-03-09 01:54:51 -05:00
Joe Groff
df3f332f9d IRGen: Hide type metadata records for noncopyable types from discovery by existing runtimes.
We'd still like to try to be forwardly compatible with future runtimes
that do properly handle noncopyable types, so emit them in a separate section from
copyable type records for now. This should prevent `_typeByName` from letting
someone get a hold of a noncopyable type's metatype as a (copyable) `Any.Type` and
then trying to use it to copy uncopyable values.
2023-03-08 13:18:56 -08:00
Slava Pestov
1fe96205b1 Runtime: Put DecodedMetadataBuilder in anonymous namespace 2023-03-08 14:42:37 -05:00
Slava Pestov
e7ef0d3a97 Runtime: Also unique witness table packs
While we can't assume that pointer equality implies semantic equality
with witness table packs, it still makes sense to unique their storage
opportunistically.
2023-03-08 14:37:17 -05:00
Slava Pestov
5a52fdba10 Runtime: Fix SWIFT_STDLIB_USE_RELATIVE_PROTOCOL_WITNESS_TABLES build
Fixes rdar://106433355.
2023-03-08 14:10:34 -05:00
Alastair Houghton
b9800fda43 Merge pull request #64102 from al45tair/backtracing/full-extra-shims
[Backtracing] Build work.
2023-03-06 20:54:27 +00:00
Dario Rexin
5fe716577b [IRGen] Add layout strings for generic and resilient types (#64023)
* [IRGen] Add layout strings for generic and resilient types

rdar://105837048

* Add some corner cases

* Add flag to enable generic instantiation and some fixes

* Fix resilient types

* Fix metadata accessor function pointers in combined layout strings
2023-03-05 15:26:45 -08:00
Slava Pestov
7324307ac0 Merge pull request #64073 from slavapestov/irgen-variadic-generic-types
Preliminary IRGen support for variadic generic types
2023-03-04 17:55:26 -05:00
Alastair Houghton
1258d45152 [Backtracing] Build work.
Additional shimming required for some builds, as well as a few other build
related tweaks.

rdar://106234311
2023-03-04 15:46:30 +00:00
Alastair Houghton
43ac069ad0 [Backtracing] Add control over symbol caching.
Some symbolication frameworks have a symbol cache; we probably don't want
to use that for test cases, to avoid running into problems where the cache
holds stale information.

rdar://105409147
2023-03-04 08:00:09 +00:00
Alastair Houghton
4edfacb16b [Backtracing][Runtime] Fix a copy/paste blunder.
Accidentally wrote `thread_resume()` instead of `thread_suspend()`.

rdar://105391747
2023-03-04 07:56:03 +00:00
Alastair Houghton
0c5aedaaf2 [Backtracing][Runtime] Fix Linux build to use getauxval(AT_SECURE).
Linux doesn't have `issetugid()`, so use `getauxval(AT_SECURE)` there
instead.

rdar://105391747
2023-03-04 07:56:03 +00:00
Alastair Houghton
b63a227a2e [Backtracing][Runtime] Renamed getAuxiliaryExecutablePath upstream.
Need to change this to `swift_copyAuxiliaryExecutablePath()`.

rdar://105391747
2023-03-04 07:56:03 +00:00
Alastair Houghton
b9e79c431f [Backtracing][Runtime] Don't replace existing signal handlers.
If we find signal handlers already installed, leave them alone.

rdar://105391747
2023-03-04 07:56:03 +00:00
Alastair Houghton
44be8cfc21 [Backtracing][Runtime] Disable backtraces for setuid binaries.
We really, really shouldn't be running the external backtracer for setuid
binaries.  It's just too dangerous.

So don't do that.  And if someone tries to force us, emit a warning.

rdar://105391747
2023-03-04 07:56:03 +00:00
Alastair Houghton
8a29657f4c [Runtime] [Darwin] Add code to trigger the external backtracer.
When a Swift program crashes, we should catch the crash and execute the
external backtracer.

rdar://105391747
2023-03-04 07:56:02 +00:00
Slava Pestov
b3cb845ea3 Runtime: support metadata packs in _buildDemanglingForNominalType()
This adds a bunch of new code but once I finish refactoring the other
demangling stuff, I should be able to remove

- gatherWrittenGenericArgs()
- _gatherGenericParameters()
- SubstGenericParametersFromWrittenArgs
2023-03-03 14:16:53 -05:00
Mishal Shah
aced44a84b Merge pull request #63187 from apple/rebranch
Merge `rebranch` into `main` to support `stable/20221013` llvm-project branch
2023-03-03 11:01:34 -08:00
Slava Pestov
1834469d72 Merge pull request #64063 from slavapestov/more-variadic-generic-types-runtime-work
More variadic generic types runtime work
2023-03-03 08:44:34 -05:00
Alastair Houghton
b05f609e4c [Runtime] Remove spurious include of <filesystem>.
This was added when Saleem suggested using <filesystem> to avoid having
to do lots of string manipulation, but it turns out we can't use it on
macOS because of minimum deployment versions, and we also can't use it
on Ubuntu 18.04 because it doesn't exist there.

The code related to it was backed out already, but I missed the include.

rdar://106183273
2023-03-03 07:32:51 +00:00
Slava Pestov
66ed09e72b Runtime: Variadic generic type fixes 2023-03-03 02:24:01 -05:00
Slava Pestov
32caa17b11 Runtime: Finish removing the 'extra argument' notion 2023-03-03 02:21:08 -05:00
Mishal Shah
e256b56545 Merge branch 'main' into rebranch 2023-03-02 18:25:09 -08:00
Alastair Houghton
95b8a4877b Merge pull request #63964 from al45tair/backtracing/path-lookup
[Backtracing] Add support for looking up paths for auxiliary executables
2023-03-03 00:09:14 +00:00
Slava Pestov
68378b8feb Merge pull request #64031 from slavapestov/remove-obsolete-concurrent-map
Remove obsolete ConcurrentMap and friends
2023-03-02 15:07:16 -05:00
Mike Ash
360c6d1570 Merge pull request #64003 from mikeash/getsectiondata-spi
[Runtime] Use dyld SPI for getting macho sections when available.
2023-03-02 10:50:59 -05:00
Slava Pestov
01acda7730 Runtime: Remove linear order on metadata cache keys 2023-03-02 10:22:11 -05:00
Alastair Houghton
14a0ec38a2 [Backtracing] A couple more const fixes.
rdar://103071801
2023-03-02 09:42:00 +00:00
Alastair Houghton
81a8a7e9e2 [Backtracing] Fix some const problems as a result of the previous change.
rdar://103071801
2023-03-02 08:48:36 +00:00
Mike Ash
19d86e8d3e [Runtime] Use dyld SPI for getting macho sections when available.
When available, use objc_addLoadImageFunc2 and _dyld_register_func_for_add_image to look up mach-o sections instead of using getsectiondata. When not available, we fall back to objc_addLoadImageFunc or _dyld_register_func_for_add_image and getsectiondata as before.

rdar://51760462
2023-03-01 16:06:15 -05:00
Slava Pestov
ac199ac7c6 Runtime: Metadata cache key support for packs 2023-03-01 15:48:01 -05:00