Commit Graph

774 Commits

Author SHA1 Message Date
Brent Royal-Gordon
fb20b503ba Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/ClangImporter/ClangImporter.cpp
#	test/IRGen/builtins.swift
#	test/IRGen/enum.sil
#	tools/driver/autolink_extract_main.cpp
#	utils/build-presets.ini
2019-08-08 17:07:59 -07:00
sameerasal
fa13be22ec Remove .swift1_autolink_entries from ther final linked binary
Mark the section .swift1_autolink_entries as SHF_EXCLUDE
  so the section will get dropped by the linker after linking the final
  binary.

  This section is used to save the flags needed for auto link and there
  is no reason it should stay in the final linked binary.Mark the
  section .swift1_autolink_entries as SHF_EXCLUDE
  so the section will get dropped by the linker after linking the final
  binary.

  This section is used to save the flags needed for auto link and there
  is no reason it should stay in the final linked binary.

  This solves issue SR-11247
2019-08-08 14:38:46 -07:00
Joe Groff
3e2965f452 IRGen: Omit frame pointers from metadata accessors. 2019-08-07 14:16:41 -07:00
Joe Groff
f0e5e1911d IRGen: Access concrete type metadata by mangled name.
When we generate code that asks for complete metadata for a fully concrete specific type that
doesn't have trivial metadata access, like `(Int, String)` or `[String: [Any]]`,
generate a cache variable that points to a mangled name, and use a common accessor function
that turns that cache variable into a pointer to the instantiated metadata. This saves a bunch
of code size, and should have minimal runtime impact, since the demangling of any string only
has to happen once.

This mostly just works, though it exposed a couple of issues:

- Mangling a type ref including objc protocols didn't cause the objc protocol record to get
  instantiated. Fixed as part of this patch.
- The runtime type demangler doesn't correctly handle retroactive conformances. If there are
  multiple retroactive conformances in a process at runtime, then even though the mangled string
  refers to a specific conformance, the runtime still just picks one without listening to the
  mangler. This is left to fix later, rdar://problem/53828345.

There is some more follow-up work that we can do to further improve the gains:

- We could improve the runtime-provided entry points, adding versions that don't require size
  to be cached, and which can handle arbitrary metadata requests. This would allow for mangled
  names to also be used for incomplete metadata accesses and improve code size of some generic
  type accessors. However, we'd only be able to take advantage of the new entry points in
  OSes that ship a new runtime.
- We could choose to always symbolic reference all type references, which would generally reduce
  the size of mangled strings, as well as make runtime demangling more efficient, since it wouldn't
  need to hit the runtime caches. This would however require that we be able to handle symbolic
  references across files in the MetadataReader in order to avoid regressing remote mirror
  functionality.
2019-08-02 14:28:53 -07:00
Jim Ingham
148e5367ca Fix the valance of the DebuggerSupport test.
I was moving this around per Jordan's request and didn't change
the valance of the if test.
2019-07-08 16:52:58 -07:00
Jim Ingham
25c1b05a8e Fix the comment to be more concise. 2019-07-08 12:12:07 -07:00
Jim Ingham
be4da4680d We don't need the metadata for the auto linking when debugging either.
So it is simpler to just early return when we are running on the
debugger's behalf.
2019-07-03 19:02:39 -07:00
Jim Ingham
abc35e5366 Don't emit the FORCE_LOAD symbols when the compiler is running
on behalf of the debugger.  The debugger will read the LinkLibrary's
from all the modules it sees, and hand load all the required dependencies,
and since the symbol is weak it doesn't even tell us whether a
required dependency is missing. So it serves no purpose in this case.

<rdar://problem/51463642>
2019-07-03 15:27:21 -07:00
Michael Munday
a8ea69e757 Merge pull request #25467 from linux-on-ibm-z/s390x-keypath-tuple-fix
Fix KeyPath failure on s390x
2019-07-01 12:36:12 +01:00
Lei Zhang
e08359c201 Fix KeyPath failure on s390x 2019-06-28 15:01:12 -04:00
Arnold Schwaighofer
27bfcd53dc Rework getRuntimeFn runtime availability
NFC.
2019-06-18 11:09:07 -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
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
e51820b17c Merge remote-tracking branch 'origin/master' into master-next 2019-05-16 07:09:56 -07:00
Joe Groff
2ade303387 IRGen: Weak-link opaque type entry points.
When backward deploying to an OS that may not have these entry points, weak-link them so that they
can be used conditionally in availability contexts that check for them.

rdar://problem/50731151
2019-05-15 20:40:54 -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
Arnold Schwaighofer
e2d3f533d6 IRGen: Intialize single case enum extrainhabitant value witness in generated code
Older Swift runtimes miss this initialization in the swift_initEnumMetadataSingleCase runtime call.

rdar://49786768
2019-04-25 14:19:56 -07:00
Saleem Abdulrasool
68ca11bb2a IRGen: do not use WeakImport on PE/COFF
PE/COFF does not provide weak import semantics.  Fallback to strong
import semantics on PE/COFF.
2019-04-24 20:55:42 -07:00
Bob Wilson
dd94a9f90f References to _swift_FORCE_LOAD* symbols should be weak
When Swift always copied the overlay dylibs into app bundles, it was OK
for these symbol references to be non-weak, but with the overlays now
part of the OS on Apple platforms, we need to handle backward deployment
scenarios where a new overlay does not exist on an old OS version.
A weak reference will serve to pull in the overlay dylib if it exists,
without causing a fatal error if it does not. rdar://problem/50110036
2019-04-24 09:45:07 -07:00
swift-ci
89372f876a Merge remote-tracking branch 'origin/master' into master-next 2019-04-18 15:10: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
swift-ci
707344affa Merge remote-tracking branch 'origin/master' into master-next 2019-04-12 07:29:33 -07:00
Slava Pestov
4ec1e83385 IRGen: Assert if its too late to queue up lazy emission 2019-04-12 01:46:22 -04:00
swift-ci
36d8c65f53 Merge remote-tracking branch 'origin/master' into master-next 2019-03-27 05:29:27 -07:00
Slava Pestov
4207738e17 Add mangling and IRGen LinkEntity for Objective-C resilient class stubs 2019-03-26 18:44:44 -04:00
Mishal Shah
345e9881d1 Merge pull request #22699 from apple/stable-update-5.1
Update Swift:master to work with new stable re-branch from swift-5.1-branch
2019-02-20 12:22:00 -08:00
swift-ci
0d0210249f Merge remote-tracking branch 'origin/master' into master-next 2019-02-19 20:49:46 -08:00
Slava Pestov
69d1cafd1c AST: Add AvailabilityContext parameter to Decl::isWeakImported()
For now, it's not used, but we do try to pass the right value down from
our various call sites.

Progress on <rdar://problem/46674512>.
2019-02-19 18:58:44 -05:00
Saleem Abdulrasool
437cfa7fa2 IRGen: adjust for SVN r348827
CodeGenOptions.h was moved from Frontend to Basic.
2019-02-08 14:22:57 -08:00
Saleem Abdulrasool
6a1072d825 Adjust for SVN r352827
Update for `getOrInsertFunction` API in LLVM.
2019-02-04 12:48:46 -08:00
swift-ci
535b711531 Merge remote-tracking branch 'origin/master' into master-next 2019-01-04 15:29:24 -08:00
Saleem Abdulrasool
7f005414dd Merge pull request #21639 from compnerd/tinkering-linkering
ApplyIRLinkage cleanups
2019-01-04 15:26:11 -08:00
Saleem Abdulrasool
d3efed2943 IRGen: use ApplyIRLinkage more aggressively (NFC)
Use `ApplyIRLinkage` rather than manually applying the DLLStorage.  This
makes it much more apparent as to the desired semantic linkage desired.
2019-01-04 10:39:03 -08:00
Saleem Abdulrasool
02dfb509ba IRGen: create new External{Im,Ex}port named linkages
Create two new semantic names: `ExternalImport` and `ExternalExport`.
These are for symbols which are either imported from an external module
or exported for consumption by external modules.
2019-01-04 10:39:03 -08:00
Saleem Abdulrasool
9546cc2413 IRGen: always provide DLLStorage
Now that DLLStorage is only applied when needed, always pass the correct
DLLStorage.  The IRLinkage applicator will determine if the DLLStorage
should be applied or not.
2019-01-04 10:39:03 -08:00
Saleem Abdulrasool
a6df0469cf IRGen: create InternalWeakODR named IRLinkage (NFC)
Create a new named IRLinkage type: `InternalWeakODR`.  This just gives
the IRLinkage a semantic name rather than the computed value.  NFC.
2019-01-04 10:39:03 -08:00
swift-ci
c2e98d3097 Merge remote-tracking branch 'origin/master' into master-next 2019-01-04 08:50:02 -08:00
Daniel Dunbar
8980213f7c Merge pull request #20687 from ddunbar/swasm-allow-wasm-object-format
[Swift+WASM] Allow Wasm object format.
2019-01-04 08:34:43 -08:00
swift-ci
247d0fb84e Merge remote-tracking branch 'origin/master' into master-next 2019-01-02 21:50:10 -08:00
Saleem Abdulrasool
e6354fe206 IRGen: COMDAT the force load thunks
Use `ApplyIRLinkage` to the force load thunks to permit multiple
emissions to be COMDATed on Windows.  The multi-module tests would emit
the symbols multiply and would fail to link.
2018-12-27 18:43:28 -08:00
swift-ci
bd421dcd97 Merge remote-tracking branch 'origin/master' into master-next 2018-12-20 18:15:07 -08:00
Slava Pestov
0c6ac60688 IRGen: Don't deserialize witness tables accidentally
This is actually NFC: We should have already deserialized everything
we need at this point, and because of large loadable types and
address lowering, deserializing more stuff in IRGen is not valid,
and in fact we check for this and refuse to deserialize.
2018-12-20 17:36:38 -05:00
swift-ci
8561c0367b Merge remote-tracking branch 'origin/master' into master-next 2018-12-11 22:49:14 -08:00
Saleem Abdulrasool
49b9449d8b IRGen: adjust for SVN r348827
CodeGenOptions.h was moved from Frontend to Basic.
2018-12-11 21:40:04 -08:00
John McCall
2ba7090fe8 Remove the extra-inhabitant value witness functions.
This is essentially a long-belated follow-up to Arnold's #12606.
The key observation here is that the enum-tag-single-payload witnesses
are strictly more powerful than the XI witnesses: you can simulate
the XI witnesses by using an extra case count that's <= the XI count.
Of course the result is less efficient than the XI witnesses, but
that's less important than overall code size, and we can work on
fast-paths for that.

The extra inhabitant count is stored in a 32-bit field (always present)
following the ValueWitnessFlags, which now occupy a fixed 32 bits.
This inflates non-XI VWTs on 32-bit targets by a word, but the net effect
on XI VWTs is to shrink them by two words, which is likely to be the
more important change.  Also, being able to access the XI count directly
should be a nice win.
2018-12-11 22:18:44 -05:00
Carl Peto
3d61e9fd5a Fix incompatibilities with 16 bit pointers
- fix code generation for enum types to zext or trunc 32 bit data as appropriate for the platform
- fix IR generation code to use a relative address type of 16 bit width on that platform

- correct order of statements and line up comments
2018-11-29 22:15:54 +00:00
Daniel Dunbar
1efee0c27a [Swift+WASM] Allow Wasm object format.
- This currently does nothing more than adopt the ELF conventions, but for the
   Wasm object file format.
2018-11-20 15:22:26 -07:00