Commit Graph

9262 Commits

Author SHA1 Message Date
Michael Gottesman
68e2e708d0 [runtime] Add a dumping method to HeapObject when asserts are enabled.
Given any heap object, this method dumps:

* The pointer address of the heap object.
* The pointer address of the heap metadata of the object.
* The strong reference count.
* The unowned reference count.
* The weak reference count.
* Whether or not the value is in the deinit state.
* Whether or not the heap object uses swift_retain or objc_retain.
* The address of the object's side table if one exists.

This makes it really easy when debugging quickly to get all of the information
that you could possibly need from a HeapObject.
2018-02-07 11:54:48 -08:00
Pavel Yaskevich
6cf1aa3083 Merge pull request #14399 from xedin/field-desc-for-imported-structs-2.0
[Reflection] Add support for imported structs with recorded fields (attempt #2)
2018-02-07 01:57:03 -08:00
Xiaodi Wu
26dac8f5e0 Address reviewer comments for consolidated integer-to-string conversion 2018-02-06 21:40:49 -06:00
Xiaodi Wu
22da6ddaf2 Merge pull request #14401 from xwu/itoa
[WIP] [stdlib] Consolidate integer-to-string implementations
2018-02-06 21:35:50 -06:00
Xiaodi Wu
09f77ff58d Merge pull request #14361 from xwu/less-miscellany
[stdlib] Remove outdated miscellaneous functions
2018-02-06 19:49:56 -06:00
Michael Ilseman
b1f1e98a63 [string] Clean up StringObject; Clarify its tagged BridgeObjects. (#14425)
[string] Clean up StringObject; Clarify its tagged BridgeObjects.

Bifurcate StringObjects raw bit-pattern initializers to expose whether
the caller is passing a value rather than a reference. This way,
StringObject can call the approprite BridgeObject helper and
participate in upcoming peephole optimizations like retains of
known-values. This is all meant to be a NOP.

Additionally, do some cleanup while we're at it.
2018-02-06 17:36:32 -08:00
Pavel Yaskevich
8f05d64770 [Reflection] Add support for imported structs with recorded fields
Update IRGen to trigger generation of type metadata for foreign
struct types found in fields. And fix TypeRefBuilder to handle
the case where struct has fields but at the same time has opaque
metadata.
2018-02-06 15:50:52 -08:00
Greg Parker
3df5928122 Merge pull request #14417 from dcci/wallruntime
[Runtime] Enable -Wall for the builds.
2018-02-06 15:27:11 -08:00
Arnold Schwaighofer
d981bb1d96 Mangling: noescape functions will be trivial and no longer compatible with escape function types.
Mangle escapeness as part of the type.

Part of:
SR-5441
rdar://36116691
2018-02-06 08:51:43 -08:00
Pavel Yaskevich
caf73113ea [Runtime/Metadata] Add ownership information to _getTypeByMangledName
`_typeByMangledName` could encounter types which have ownership attributes
associated with them which are not representable by the metadata object
but nevertheless are important, so such ownership information should be
returned along with metadata itself from the call.
2018-02-05 15:26:11 -08:00
Davide Italiano
d0d1a33690 [Runtime] Enable -Wall for the builds.
This helps catching trivial mistakes & UB, e.g. uninitialized
booleans, see, e.g. https://github.com/apple/swift/pull/14400
2018-02-05 14:18:15 -08:00
Xiaodi Wu
5b4e3f2338 Merge pull request #14386 from xwu/no-mixing
[stdlib/Sema] Minor improvements to synthesized hashValue
2018-02-05 09:17:53 -06:00
Ben Cohen
77e417f1d0 [stdlib] Hoist Array.popLast to RangeReplaceableCollection (#14392)
* Move Array.popLast to RangeReplaceableCollection

* Remove popLast from Array completion tests
2018-02-04 20:11:51 -08:00
Saleem Abdulrasool
83c4df8045 Merge pull request #14358 from compnerd/remove-SWIFT_USE_SWIFTCALL
stdlib: remove vestigial SWIFT_USE_SWIFTCALL
2018-02-04 09:53:27 -08:00
Xiaodi Wu
76e23368ad Consolidate integer-to-string implementations 2018-02-03 19:17:48 -06:00
Mark Lacey
8667eb6f91 Revert "[WIP][IRGen] Emit type field descriptors for imported structs" 2018-02-03 10:27:34 -08:00
Xiaodi Wu
8014793cf1 Remove final _mixInt in synthesized hashValue and improve the _combineHashValues magic number 2018-02-03 00:06:48 -06:00
Pavel Yaskevich
b2f1260ead Merge pull request #14185 from xedin/field-desc-for-imported-structs
[WIP][IRGen] Emit type field descriptors for imported structs
2018-02-02 19:23:46 -08:00
Mark Lacey
393eae2fb4 Merge pull request #14364 from rudkx/typealias-for-iuo
Make ImplicitlyUnwrappedOptional<T> an unavailable typealias.
2018-02-02 17:46:49 -08:00
swift-ci
87f7b4e5fb Merge pull request #14368 from DougGregor/se-0143-runtime-conditional-conformances 2018-02-02 17:29:26 -08:00
swift-ci
5663b4487d Merge pull request #14378 from compnerd/windows-runtime-initializer 2018-02-02 17:17:13 -08:00
Doug Gregor
81f15746b6 [Runtime] Always cache conformance results based on the type metadata. 2018-02-02 16:41:28 -08:00
Doug Gregor
93442cf11f [Runtime] SE-0143: Evaluate conditional conformances at runtime.
When evaluating whether a given type conforms to a protocol, evaluate the
conditional requirements and pass the results to the witness table
accessor function. This provides the ability to query conditional
conformances at runtime, and is the last major part of implementing
SE-0143.

The newly-added unlock/lock dance in the conformance lookup code is a
temporary stub. We have some ideas to do this better.

Fixes rdar://problem/34944655.
2018-02-02 16:41:27 -08:00
Greg Parker
4501e08cee Merge pull request #14373 from troughton/twowordpair-removal
[runtime] Remove TwoWordPair and use the Swift calling convention instead.
2018-02-02 16:27:25 -08:00
swift-ci
54355aedec Merge pull request #14363 from ArtSabintsev/master 2018-02-02 15:56:50 -08:00
Pavel Yaskevich
9e08ea4c56 [Reflection] Add support for imported structs with recorded fields
Update IRGen to trigger generation of type metadata for foreign
struct types found in fields. And fix TypeRefBuilder to handle
the case where struct has fields but at the same time has opaque
metadata.
2018-02-02 15:54:12 -08:00
Saleem Abdulrasool
76d7bfd8ed runtime: ensure that the module constructor element is RO
The default attribute on the section is read/write.  This would cause
the section to have different attributes when compiled.  The linker
would then preserve the section rather than merge it into the right
location.  This was noticed when linking with `link.exe`.
2018-02-02 15:01:44 -08:00
Saleem Abdulrasool
bb55044f38 runtime: add missing sw5prt to the section list
The Windows constructor was not populated properly, with the protocol
list being dropped.  Ensure that all the fields are initialised
properly.  Thanks to clang's `-Wmissing-field-initializers` warning to
help catch this.
2018-02-02 15:00:34 -08:00
Saleem Abdulrasool
bc950fd41a runtime: mark the section markers with the correct attributes
On windows, we create synthetic markers with grouping identifiers to
ensure that the markers are sorted properly and merged.  We would
previously mark the section as read/write rather than read-only causing
warnings when linking.  Correct the attributes.  This ensures the proper
linking of the modules.
2018-02-02 14:56:23 -08:00
troughton
e156826984 Remove _swift_allocBox_ function pointers. 2018-02-03 10:20:57 +13:00
troughton
cf28ff448c Remove TwoWordPair and use SwiftCC instead. 2018-02-03 09:43:00 +13:00
Ben Cohen
cfaff1dc7d [stdlib] Move _copyBuffer to be an init on _ArrayBufferProtocol (#14222)
* Move _copyBuffer to be an init on _ArrayBufferProtocol

* Make init(copying:) inlineable, even though its inline(never), to allow specialization.

* Delete old array swap test, as swap on arrays is no longer valid.

* Delete the old static method
2018-02-02 10:42:45 -08:00
Mark Lacey
2008674495 Make ImplicitlyUnwrappedOptional<T> an unavailable typealias.
Also remove the decl from the known decls and remove a
bunch of code referencing that decl as well as a bunch of other
random things including deserialization support.

This includes removing some specialized diagnostics code that
matched the identifier ImplicitlyUnwrappedOptional, and tweaking
diagnostics for various modes and various issues.

Fixes most of rdar://problem/37121121, among other things.
2018-02-02 08:35:53 -08:00
Arthur Ariel Sabintsev
fe89d4d333 Fixed comment on Calendar's compare method 2018-02-02 11:20:53 -05:00
Xiaodi Wu
c1f3176fe7 Remove sole use of _floorLog2 2018-02-02 10:07:18 -06:00
Xiaodi Wu
f4a3947632 Remove _countLeadingZeros and _floorLog2 2018-02-02 09:58:00 -06:00
Michael Ilseman
2785bee6e0 Merge pull request #14356 from milseman/what_a_character
[string] Minor cleanup on Character
2018-02-02 07:54:34 -08:00
Saleem Abdulrasool
0fa8ac062c stdlib: remove vestigial SWIFT_USE_SWIFTCALL
Remove the last vestiges of `SWIFT_USE_SWIFTCALL`.  Building without
SwiftCC is no longer supported.
2018-02-01 22:52:17 -08:00
Mark Lacey
e43ff7164c Merge pull request #14299 from rudkx/iuo-remove-the-type
IUO: Generate Optional<T> rather than ImplicitlyUnwrappedOptional<T>
2018-02-01 21:58:37 -08:00
Ben Cohen
9ee856f386 [stdlib][WIP] Eliminate (Closed)CountableRange using conditional conformance (#13342)
* Make Range conditionally a Collection

* Convert ClosedRange to conditionally a collection

* De-gyb Range/ClosedRange, refactoring some methods.

* Remove use of Countable{Closed}Range from stdlib

* Remove Countable use from Foundation

* Fix test errors and warnings resulting from Range/CountableRange collapse

* fix prespecialize test for new mangling

* Update CoreAudio use of CountableRange

* Update SwiftSyntax use of CountableRange

* Restore ClosedRange.Index: Hashable conformance

* Move fixed typechecker slowness test for array-of-ranges from slow to fast, yay

* Apply Doug's patch to loosen test to just check for error
2018-02-01 20:59:28 -08:00
Ben Cohen
ab8e3a7ebc Fix warnings in various benchmarks (#14333) 2018-02-01 19:48:35 -08:00
Ben Cohen
c1d4b60281 [stdlib] Collection compatibility shim fixes (#14342)
* Fix compatibility shims for IndexDistance

* Add a second test for implied IndexDistance, Bidirectional conformance
2018-02-01 19:47:11 -08:00
Michael Ilseman
49a2103a60 [string] Minor simplification to Character init 2018-02-01 19:25:23 -08:00
swift-ci
5dd3572dbf Merge pull request #14351 from DougGregor/demangle-to-metadata-class-constraints 2018-02-01 18:59:56 -08:00
Doug Gregor
ef1dfdfc42 [Runtime] Stub out the same-conformance requirement check.
The compiler doesn't generate these yet, and we don't really have a
good way to use or test them. For now, ignore them.
2018-02-01 17:40:17 -08:00
Doug Gregor
90afecfda8 [Runtime] Dynamically evaluate superclass constraints. 2018-02-01 17:35:47 -08:00
Doug Gregor
9445839208 [Runtime] Evaluate layout constraints at runtime. 2018-02-01 17:20:44 -08:00
Doug Gregor
5c59e81480 [Runtime] Evaluate same-type requirements at runtime.
Extend the runtime's ability for evaluating generic requirements to
handle same-type requirements, demangling/substituting the name from
the generic requirement metadata.
2018-02-01 17:00:51 -08:00
Doug Gregor
6dc429af43 Merge pull request #14327 from DougGregor/demangle-to-metadata-generic-reqs
Check generic requirements in `_typeByMangledName`.
2018-02-01 16:07:29 -08:00
swift-ci
13d6d9b67b Merge pull request #14344 from gottesmm/pr-3795434d15ca181c9da1f232ce9a3f23e936f94c 2018-02-01 15:37:39 -08:00