Commit Graph

752 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
d046f3f959 Set _swift_reportFatalErrorsToDebugger to true by default and remove all the staging parts (frontend flag, irgen changes). (#11329) 2017-08-03 15:23:23 -07:00
Chris Bieneman
9c35042ae6 Merge remote-tracking branch 'origin/master' into master-next 2017-07-28 09:51:36 -07:00
Arnold Schwaighofer
3ba3bf4f6c Remove fixme comment 2017-07-26 15:11:47 -07:00
Arnold Schwaighofer
ee17bab396 IRGen: Enable usage of attributes from RuntimeFunctions.def
* Add some ZExt function attributes on functions returning bool
* swift_dynamicCast is not readonly as it writes to the 'dest' buffer
* Fix tail_alloc.sil test

rdar://20802330
2017-07-26 14:39:28 -07:00
swift-ci
e98182387b Merge remote-tracking branch 'origin/master' into master-next 2017-07-11 12:23:35 -07:00
Joe Groff
101788dbd4 IRGen: Support for computed properties with dependent generic context.
Use the KeyPath implementation's new support for instantiating and dealing with captures to lower the generic context required to dispatch computed accessors with dependent generics.
2017-07-06 20:07:41 -07:00
Michael Gottesman
78713ce07f Merge pull request #10519 from jrose-apple/ModuleMacro-master-next
WIP getting master-next up and running with clang::ModuleMacro
2017-06-30 14:52:09 -07:00
swift-ci
8612ba5c3a Merge remote-tracking branch 'origin/master' into master-next 2017-06-30 13:09:12 -07:00
Arnold Schwaighofer
8b2d85fee1 Make a copy of the string before mutation 2017-06-30 11:20:11 -07:00
Arnold Schwaighofer
1e794cdebf IRGen: Sort the target-features string
Function merging will not identify two otherwise equivalent if the order of the target-features list differs.

rdar://33057710
2017-06-30 10:25:53 -07:00
swift-ci
052653d9c7 Merge remote-tracking branch 'origin/master' into master-next 2017-06-29 09:29:03 -07:00
Kuba (Brecka) Mracek
4b88da2a2c Use the debugger hook, reportToDebugger, for all calls to _swift_stdlib_reportFatalError[InFile]. Only do this when a hidden frontend flag, -report-errors-to-debugger, is used. (#10617) 2017-06-29 09:12:26 -07:00
Jordan Rose
90ca8f119a WIP: [IRGen] Update for changes to how autolinking works in LLVM.
The tests still need to be updated.
2017-06-23 12:49:49 -07:00
swift-ci
4d37cd89e4 Merge remote-tracking branch 'origin/master' into master-next 2017-06-13 16:28:44 -07:00
Arnold Schwaighofer
2e3522fafc Use clang's effective llvm triple for IR generation (#10211)
* Use clang's effective llvm triple for IR generation

Instead of using the target that was passed to the driver. Use the target from
the clang importer that might have been changed by clang (i.e armv7 to thumbv7
on darwin)

rdar://32599805

* Address review comments

* Fix test case osx-targets.swift

* Fix pic.swift test case

* Fix test abi_v7k.swift

* Address review comment for test osx-targets.swift
2017-06-13 16:26:14 -07:00
swift-ci
9a1c2f49ca Merge remote-tracking branch 'origin/master' into master-next 2017-06-05 20:08:35 -07:00
Jordan Rose
f0aca936c7 Allow '@objc(RuntimeName)' on classes with generic ancestry.
This is accomplished by recognizing this specific situation and
replacing the 'objc' attribute with a hidden '_objcRuntimeName'
attribute. This /only/ applies to classes that are themselves
non-generic (including any enclosing generic context) but that have
generic ancestry, and thus cannot be exposed directly to Objective-C.

This commit also eliminates '@NSKeyedArchiverClassName'. It was
decided that the distinction between '@NSKeyedArchiverClassName' and
'@objc' was too subtle to be worth explaining to developers, and that
any case where you'd use '@NSKeyedArchiverClassName' was already a
place where the ObjC name wasn't visible at compile time.

This commit does not update diagnostics to reflect this change; we're
going to change them anyway.

rdar://problem/32414557
2017-06-05 17:32:25 -07:00
swift-ci
27424b37b0 Merge remote-tracking branch 'origin/master' into master-next 2017-05-17 13:08:40 -07:00
Joe Groff
80c6671c39 Runtime: Only complain about a deprecated ObjC entry point once.
We only need to alert the user once. rdar://problem/32229417
2017-05-17 12:05:53 -07:00
Bob Wilson
7bfd58e6f0 Merge pull request #9617 from bob-wilson/comment-out-runtime-attributes
Temporarily comment out code to set runtime function attributes.
2017-05-15 14:08:29 -07:00
swift-ci
dc6e1cf329 Merge remote-tracking branch 'origin/master' into master-next 2017-05-15 12:29:07 -07:00
Bob Wilson
4890a43e8b Temporarily comment out code to set runtime function attributes.
Before my change in e24a6f1d30, the previous code did nothing. I saw the
comment but did not think it really meant what it says. My change
caused the function attributes to be set and that led to all sorts of
mayhem. E.G., I know for sure that the “swift_dynamicCast” entry should
not be ReadOnly because it returns its result by assigning through one
of its arguments. We need to audit the attributes for those runtime
functions before we can turn this on (tracked in rdar://problem/20802330)
2017-05-15 11:54:02 -07:00
Doug Gregor
7955aa13e6 Rename @NSKeyedArchive* attributes.
@NSKeyedArchiveLegacy -> @NSKeyedArchiverClassName
@NSKeyedArchiveSubclassesOnly -> @NSKeyedArchiverEncodeNonGenericSubclassesOnly

Fixes rdar://problem/32178796.
2017-05-15 11:02:31 -07:00
Bob Wilson
45317fc03e Merge branch 'master' into master-next 2017-05-08 23:44:23 -07:00
Erik Eckstein
b1d5c77cec Runtime support for the NSArchiver class attributes.
Register class names for NSKeyedArchiver and NSKeyedUnarchiver based on the @NSKeyedArchiveLegacy and @_staticInitializeObjCMetadata class attributes.

@NSKeyedArchiveLegacy registers a class name translation.
@_staticInitializeObjCMetadata just makes sure that the metadata of a class is instantiated.

This registration code is executed as a static initializer, like a C++ global constructor.
2017-05-08 14:00:03 -07:00
Bob Wilson
e24a6f1d30 Adjust addAttributes calls for LLVM r301981
These now take an AttrBuilder argument instead of an AttributeList.
2017-05-06 21:37:22 -07:00
swift-ci
d435c194ba Merge remote-tracking branch 'origin/master' into master-next 2017-05-04 09:28:57 -07:00
Adrian Prantl
0cb4a2865d Refactor/Cleanup IRGenDebugInfo to use a private implementation (NFC) 2017-05-03 08:34:06 -07:00
Adrian Prantl
c2b14dccd3 Debug info: Represent clang-imported submodules.
Previously an import of a submodule would emit debug info for
importing the root module.

<rdar://problem/17260802>
2017-05-03 08:33:55 -07:00
swift-ci
5ba89103a7 Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 09:28:31 -07:00
Arnold Schwaighofer
b167b4475d Add SIL and IRGen support for a ConstantStringLiteral instruction
This supports a utf8 or utf16 encoding.

rdar://30545013
2017-04-11 08:43:47 -07:00
Bob Wilson
0cb50e1031 Merge remote-tracking branch 'origin/master' into master-next 2017-04-07 16:35:57 -07:00
Huon Wilson
ac0c76be12 [IRGen] Allow constructing UniversalLinkageInfo without an IRGenModule. 2017-04-06 17:31:45 -07:00
Bob Wilson
c6e37c1f0a Merge remote-tracking branch 'origin/master' into master-next 2017-04-05 17:26:52 -07:00
Huon Wilson
3105c6ed00 [IRGen] Expose LinkInfo publicly, like LinkEntity. 2017-04-05 09:54:19 -07:00
Saleem Abdulrasool
15565c116a Adjust for SVN r298393 2017-03-22 07:44:03 -07:00
Saleem Abdulrasool
70771a8975 IRGen: fix construction of ArrayRef
The type deduction may fail due to no explicit conversion to the
ArrayRef data type.  Add explicit casts.  Use the sizeof operator on the
value being constructed rather than the explicit type of the value to
allow the size to be deduced from the value.
2017-03-21 14:59:07 -07:00
Erik Eckstein
a16beaea3c Remove the now usused ConformanceCollector utility.
It was used for dead witness table elimination. But this is done now by lazy emission in IRGen.
Also update DeadFunctionElimination.
NFC.
2017-03-15 10:18:18 -07:00
Erik Eckstein
1e2945d63c IRGen: Consider the conforming type’s accessibility for lazy witness table emission.
...instead of the witness table’s linkage.
The WT linkage is derived from the minimum of the type’s and protocol’s visibility.
So if there is a public type conforming to a private protocol, we might not see the type’s metadata escaping (because it could be in another module).
2017-03-14 17:36:27 -07:00
Erik Eckstein
41c17a5b0c IRGen: emit type metadata and (value) witness tables lazily.
This gives big code size wins for unused types and also for types, which are never used in a generic context.
Also it reduces the amount of symbols in the symbol table.
The size wins heavily depend on the project. I have seen binary size reductions from 0 to 20% on real world projects.

rdar://problem/30119960
2017-03-10 12:50:43 -08:00
Arnold Schwaighofer
80732ead34 Non-witness implementations of init_existential_addr, deinit_existential_addr, open_existential_addr, copy_addr, destory_addr
For the boxed existential variant.
2017-03-09 17:22:35 -08:00
Erik Eckstein
5e80555c9b demangler: put the demangler into a separate library
Previously it was part of swiftBasic.

The demangler library does not depend on llvm (except some header-only utilities like StringRef). Putting it into its own library makes sure that no llvm stuff will be linked into clients which use the demangler library.

This change also contains other refactoring, like moving demangler code into different files. This makes it easier to remove the old demangler from the runtime library when we switch to the new symbol mangling.

Also in this commit: remove some unused API functions from the demangler Context.

fixes rdar://problem/30503344
2017-03-09 13:42:43 -08:00
John McCall
d61d966451 Use ConstantInitBuilder in most kinds of metadata emission.
This is NFC in intent, but I had to restructure the code to emit more
of the lists "inline", which means I inevitably altered some IRGen
emission patterns in ways that are visible to tests:

- GenClass emits property/ivar/whatever descriptors in a somewhat
  different order.

- An ext method type list is now emitted as just an array, not a struct
  containing only that array.

- Protocol descriptors are no longer emitted as packed structs.

I was sorely tempted to stop using packed structs for all the metadata
emission, but didn't really want to update that many tests in one go.
2017-03-06 14:18:47 -05:00
John McCall
ec667cae55 Adopt ConstantInitBuilder in a few places. 2017-03-06 14:18:47 -05:00
Slava Pestov
18550b171d IRGen: witness_method function values no longer carry witness table
This was an unnecessary complication and didn't make a lot of
logical sense, because we can recover the witness table from
substitutions when we call a @convention(witness_method) anyway.

Also, to fix materializeForSet for generic subscripts, I want the
materializeForSet *callback* of a protocol witness to have
@convention(witness_method), which requires representing such
functions as a single function pointer in IRGen.
2017-02-25 16:42:51 -08:00
Arnold Schwaighofer
6c35202565 Conditionalize usage of llvm::CallingConv::Swift on SWIFT_USE_SWIFTCALL macro 2017-02-14 12:17:57 -08:00
Arnold Schwaighofer
39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00
Andrew Trick
1abeddcc5d [SILType] SILFunctionConventions API.
Separate formal lowered types from SIL types.
The SIL type of an argument will depend on the SIL module's conventions.
The module conventions are determined by the SIL stage and LangOpts.

Almost NFC, but specialized manglings are broken incidentally as a result of
fixes to the way passes handle book-keeping of aruments. The mangler is fixed in
the subsequent commit.

Otherwise, NFC is intended, but quite possible do to rewriting the logic in many
places.
2017-01-26 15:35:48 -08:00
Slava Pestov
7b5cf4ab7d Merge pull request #3841 from tinysun212/pr-swiftc-cygwin-2
[swiftc] Fixed for Cygwin
2017-01-19 20:17:47 -08:00
Erik Eckstein
89c9ff5ca0 SIL: ConformanceCollector utility for collecting all conformances which are used by a SIL instruction.
Also verify the correctness of ConformanceCollector in IRGen by checking if IRGen does not use a conformance which is not collected by the utility.
2017-01-19 09:41:09 -08:00