Commit Graph

26 Commits

Author SHA1 Message Date
Evan Wilde
700aa8aa70 Merge remote-tracking branch 'upstream/main' into rebranch
Merge conflict while removing `nocapture` from
`s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF`. Resolution
was to remove nocapture from the expected output in both cases:
```
// CHECK-LABEL: define swiftcc void @"$s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF"(ptr noalias[-nocapture-] %0, ptr %T, ptr %T.P)
```

Conflict cause: 4858cb6225
This is the same as the original change to this file. The conflict seems
to be due to the next line changing, when moving from llvm.dbg.addr to
llvm.dbg.value.

Conflicts:
  test/DebugInfo/move_function_dbginfo.swift
2023-09-26 13:36:57 -07:00
Alex Lorenz
4858cb6225 [IRGen][interop] do not add 'nocapture' to not bitwise takable types
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++)

rdar://115062687
2023-09-25 17:43:34 -07:00
Nate Chandler
86d4b54805 [🌲] [Test] Fixed some memory(none) spellings.
`readnone` is now spelled `memory(none)`.
2023-08-07 12:55:53 -07:00
Nate Chandler
ec09cb5e4d Overhauled prespecialized-metadata/*.
Made the following changes:
- migrated to opaque pointers
- replaced some long lines with CHECK-SAME lines
- replaced direct hard references like @"foo" with foo, making arm64e
  matching easier
2023-06-23 07:00:57 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Dario Rexin
a8d4d57f11 [IRGen] Generate compressed representation of value witnesses (#63813)
rdar://105837040

* WIP: Store layout string in type metadata

* WIP: More cases working

* WIP: Layout strings almost working

* Add layout string pointer to struct metadata

* Fetch bytecode layout strings from metadata in runtime

* More efficient bytecode layout

* Add support for interpreted generics in layout strings

* Layout string instantiation, take and more

* Remove duplicate information from layout strings

* Include size of previous object in next objects offset to reduce number of increments at runtime

* Add support for existentials

* Build type layout strings with StructBuilder to support target sizes and metadata pointers

* Add support for resilient types

* Properly cache layout strings in compiler

* Generic resilient types working

* Non-generic resilient types working

* Instantiate resilient type in layout when possible

* Fix a few issues around alignment and signing

* Disable generics, fix static alignment

* Fix MultiPayloadEnum size when no extra tag is necessary

* Fixes after rebase

* Cleanup

* Fix most tests

* Fix objcImplementattion and non-Darwin builds

* Fix BytecodeLayouts on non-Darwin

* Fix Linux build

* Fix sizes in linux tests

* Sign layout string pointers

* Use nullptr instead of debug value
2023-02-24 15:40:28 -08:00
Arnold Schwaighofer
39e5e3990d IRGen: Co-locate metadata instatiation/completions/accessor functions in a special section
For spatial locality on startup.

Hide collocating metadata functions in a separate section behind a flag.
The default is not to collocate functions.

rdar://101593202
2022-12-05 09:52:04 -08:00
Arnold Schwaighofer
bb80f10ecc Revert "Merge pull request #62275 from aschwaighofer/rdar102481054"
This reverts commit 3617b7603c, reversing
changes made to 58a519a5c1.

This causes issues for the linker and branches accross sections if
addresses are too far apart.
2022-12-01 11:36:04 -08:00
Arnold Schwaighofer
082349ebc7 Revert "Merge pull request #62203 from apple/revert-61984-colocate_instantiation"
This reverts commit 1f3e159cfe, reversing
changes made to 103b4a89c2.

Re-applies "IRGen: Co-locate metadata instatiation/completions/accessor
functions in a special section" for MachO only. The original change broke lldb
on aarch64 linux.

rdar://102481054
2022-11-28 06:27:12 -08:00
Mishal Shah
a0a8881012 Revert "IRGen: Co-locate metadata instatiation/completions/accessor functions in a special section" 2022-11-18 21:04:21 -08:00
Arnold Schwaighofer
4718c23da3 Fix tests 2022-11-14 10:55:48 -08: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
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
Robert Widmann
50159d15b7 [Gardening] Use Vendor=apple Where Possible
This simplifies the usual bundle of OS checks

OS=macosx || OS=ios || OS=tvos || OS=watchos

into

VENDOR=apple

which was added in apple/swift#27307
2020-06-30 23:03:01 -07:00
Kuba Mracek
1bd425da67 [arm64e] Test changes to support arm64e 2020-02-27 16:10:48 -08:00
nate-chandler
de660ceea4 Merge pull request #29885 from nate-chandler/generic-metadata-prespecialization-components/stdlib-on
[metadata prespecialization] Always on for stdlib.
2020-02-17 15:04:59 -08:00
Nate Chandler
4475f43ba0 [metadata prespecialization] Always on for stdlib.
Regardless of any flags, the stdlib will have its generic metadata
prespecialized.

Temporarily reintroduced the flag to enable the feature flag while
preserving the flag to disable it and changed the default back to off
for the moment.
2020-02-17 11:53:27 -08:00
Nate Chandler
d44247a0ed [metadata prespecialization] Specify linkage to be shared.
Prespecialized metadata may be requested in multiple modules and those
definitions must be deduplicated when statically linking those modules
together.

Here, the SILLinkage for prespecialized metadata is specified to be
Shared.  Consequently, the IRLinkage's Linkage for this record is made
to be LinkOnceODRLinkage.

rdar://problem/56997414
2020-02-14 09:29:53 -08:00
Nate Chandler
40e17d9c6f [metadata prespecialization] Direct refs to enums.
When a specialized usage of a generic enum occurs in the same module
where the enum was defined, directly reference the prespecialized
metadata.

rdar://problem/56994321
2020-02-12 10:08:33 -08:00
swift-ci
1a6ffc8b0e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 09:24:55 -08:00
Nate Chandler
ae1f41e1b2 [metadata prespecialization] Only Apple or linux.
Temporarily disable metadata prespecialization on platforms other than
MacOS, iOS, tvOS, watchOS, or Linux.  At the moment, tests are failing
on Windows with linker errors such as

  demangleToMetadata-558ea9.o : error LNK2001: unresolved external symbol $ss5Int64VN
  demangleToMetadata-558ea9.o : error LNK2001: unresolved external symbol $sSSSHsWP

Once the issue leading to those linker errors has been resolved, the
feature will be enabled on Windows.
2020-02-05 18:06:27 -08:00
Nate Chandler
0ae9e68607 [metadata prespecialization] On by default.
Previously, -Xfrontend -prespecialize-generic-metadata had to be passed
in order for generic metadata to be prespecialized.  Now it is
prespecialized unless -Xfrontend
-disable-generic-metadata-prespecialization is passed.
2020-02-05 17:53:09 -08:00
Nate Chandler
6919aef359 [prespecialized metadata] Adapted to new llvm ir. 2020-01-13 13:38:57 -08:00
Saleem Abdulrasool
94c11ee9c2 test: fix the prespecialized metadata tests
This loosens the overly fitted patterns and makes them much more
legible.  Unfortunately, the parent VWT is referenced differently and
has been dropped here to actually allow the test to pass on all targets.
2020-01-11 12:31:50 -08:00
Nate Chandler
d78dc038c4 [metadata prespecialization] Specialize VWTs.
Prespecialized metadata records must refer to value witness tables that
have correct values for size and stride.  In order to do that, a
prespecialized value witness table must emitted and referred to.  Here,
a fully specialized value witness table is emitted.

For the moment, the value witness table is fully specialized.  Having it
be specialized, though, will likely cause serious code size problems,
since it results in specialized value witness functions being generated.

rdar://problem/58088270
2020-01-09 17:25:34 -08:00
Nate Chandler
c4d13e4b4b [IRGen] Directly reference prespecializations.
When possible, directly reference metadata prespecializations.  Doing so
is possible when the type is defined in the same module, because in
those cases the metadata accessor can be modified to ensure that the
prespecialized metadata is canonical.

rdar://problem/56994171
2020-01-09 17:25:33 -08:00