Commit Graph

13406 Commits

Author SHA1 Message Date
David Smith
ed1f9b30ef Implement both -isEqual: and -isEqualToString: to directly call the internal _isEqual, to avoid a redundant ObjC message send + type check 2019-10-28 16:36:13 -07:00
Mike Ash
b8f5e841e2 [Runtime] Add a function pointer for intercepting swift_willThrow calls.
rdar://problem/53400364
2019-10-24 14:06:14 -04:00
David Smith
637af2f9fe Merge pull request #27709 from Catfish-Man/bridge-to-the-future
Optimize accessing Swift arrays via ObjC
2019-10-23 00:19:06 -07:00
David Smith
d9cef0afef Optimize accessing Swift Arrays from ObjC 2019-10-22 20:57:36 -07:00
Julian Lettner
e819acdc29 Merge pull request #27808 from apple/tsan-empty-array-storage
[TSan] Do not report benign race on `_swiftEmptyArrayStorage`
2019-10-21 18:39:36 -07:00
David Smith
282e0c858b Merge pull request #27826 from Catfish-Man/last-object-standing
Bridging fidelity: allow removeLastObject() on empty NSMutableArrays
2019-10-21 18:32:24 -07:00
David Smith
da6adc8ba2 Bridging fidelity: allow removeLastObject() on empty NSMutableArrays 2019-10-21 17:20:32 -07:00
Julian Lettner
381dcc24fc [TSan] Do not report benign race on _swiftEmptyArrayStorage
A previous commit [1] identified and fixed a benign race on
`_swiftEmptyArrayStorage`.  Unfortunately, we have some code duplication
and the fix was not applied to all the necessary places.  Essentially,
we need to ensure that the "empty array storage" object that backs many
"array like types" is never written to.

I tried to improve the test to capture this, however, it is very
finicky.  Currently, it does not go red on my system even when I remove
the check to avoid the benign race in Release mode.

Relevant classes: Array, ArraySlice, ContiguousArray, ArrayBuffer,
ContiguousArrayBuffer, SliceBuffer.

[1] b9b4c789f3

rdar://55161564
2019-10-21 11:22:25 -07:00
David Smith
948f548247 Merge pull request #27779 from Catfish-Man/the-stars-are-aligned
Guard against passing endIndex to foreignScalarAlign when back-deploying to 5.0 stdlibs
2019-10-18 16:48:10 -07:00
David Smith
a1c1779c9f Guard against passing endIndex to foreignScalarAlign when back-deploying to 5.0 stdlibs 2019-10-18 14:24:23 -07:00
Jordan Rose
ac21ee486f [reflection] Go back to 0/1 for bitwise_takable instead of false/true
I wanted to make the output nicer, but it makes it harder to write
tests that work across OS versions, so never mind.

rdar://problem/56350587
2019-10-16 16:17:39 -07:00
Jordan Rose
52035c1cb9 Merge pull request #27081 from ismetanin/SR-7165
SR-7165. Excise <iostream> from reflection
2019-10-16 13:34:02 -07:00
Mike Ash
8dc43e6cea Merge pull request #27572 from mikeash/protocol-existential-crisis
[Runtime] Handle existential target types in swift_dynamicCastMetatypeImpl
2019-10-16 09:14:41 -04:00
swift-ci
a91d4aaa52 Merge pull request #27670 from Catfish-Man/fastscii-2 2019-10-15 18:39:45 -07:00
David Smith
007ff00617 Add fast paths for String(decoding:…, as: Unicode.ASCII.self) 2019-10-15 17:26:23 -07:00
Ivan Smetanin
8036eddc42 [stdlib] [reflection] Fix print in dumpFieldSection 2019-10-15 08:45:09 +03:00
Dan Zheng
2bd55f6755 [Autodiff upstream] Add build-script flag for differentiable programming. (#27595)
Add `--enable-experimental-differentiable-programming` build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
https://github.com/apple/swift/pull/27446
2019-10-14 14:34:48 -07:00
Ivan Smetanin
0d27475be4 [stdlib] [reflection] Fix printing, remove & from 2019-10-14 22:17:48 +03:00
Ivan Smetanin
dd7d173c97 [stdlib] [reflection] Excise iostream from reflection 2019-10-14 20:28:20 +03:00
Jordan Rose
171ff440fc Remove swift::reversed in favor of llvm::reverse (#27610)
The former predates the latter, but we don't need it anymore! The
latter has more features anyway.

No functionality change.
2019-10-10 17:16:09 -07:00
Mike Ash
1cb3d7c1f7 Merge pull request #27542 from mikeash/retain-release-refactor
[Runtime] Refactor HeapObject override checks to use a macro.
2019-10-10 15:35:36 -04:00
Mike Ash
3ff277d31d [Runtime] Use _conformsToProtocols instead of manually checking protocol conformance.
This is cleaner and it fixes a bunch of cases the old code didn't handle: @objc protocols, class bounds, and superclass constraints.

rdar://problem/56044443
2019-10-10 14:14:41 -04:00
Mike Ash
c9f9350e74 [Compatibility50] Look up swift_getObjCClassMetadata at runtime.
This is the only dependency it has on libswiftCore. Looking this up at runtime allows its use in programs that don't link libswiftCore but might eventually load and run Swift code, such as xctest.

While we're in there, enable tests in files ending with `.c`.

rdar://problem/55274114
2019-10-10 12:10:39 -04:00
Mike Ash
d56173eb14 [Runtime] Handle existential target types in swift_dynamicCastMetatypeImpl.
This fixes cases like `type is T.Type` when T is generic specialized to a protocol type.

Note: the compiler can still optimize these checks away and will optimize this check down to `false` in some cases. We'll want to fix that as well.

rdar://problem/56044443
2019-10-08 11:37:39 -04:00
Mike Ash
922b71f900 [Runtime] Refactor HeapObject override checks to use a macro.
This gives us a one-stop shop for making changes to the override mechanism.

rdar://problem/54752086
2019-10-04 16:43:16 -04:00
David Smith
3d321c1905 Fix the new Swift NSMutableArray subclass to match edge case behavior in two more cases 2019-10-02 15:47:51 -07:00
own2pwn
3ec5e76ee3 Update FloatingPointTypes.swift.gyb (#27461)
Corrects intent that this type seems to be available only on MacOS targets.
2019-10-02 15:41:42 -04:00
swift-ci
5ef7e5043f Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-28 21:04:01 -07:00
swift-ci
d1c87f3c93 Merge pull request #24270 from natecook1000/nc_lazyscan_fix 2019-09-28 20:53:45 -07:00
Joe Groff
6f8b2bf698 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-27 14:37:21 -07:00
Joe Groff
12bf25e75d Merge pull request #27388 from jckarter/reflection-remove-start-addresses
swift-reflection-dump: Virtualize logical-to-physical address mapping.
2019-09-27 14:09:22 -07:00
Saleem Abdulrasool
8db900634d Revert "Fix parsing of ELF images"
This reverts commit e2b6a3d982.  This
broke on the handling of x86_64 relocation as well as the Windows build
process.
2019-09-27 08:14:32 -07:00
Harlan Haskins
e349b7b123 Merge branch 'master' into master-rebranch 2019-09-26 20:16:05 -07:00
Jordan Rose
a6dd630ca3 Eliminate Builtin.UnknownObject as an AST type (#27378)
This removes it from the AST and largely replaces it with AnyObject
at the SIL and IRGen layers. Some notes:

- Reflection still uses the notion of "unknown object" to mean an
  object with unknown refcounting. There's no real reason to make
  this different from AnyObject (an existential containing a
  single object with unknown refcounting), but this way nothing
  changes for clients of Reflection, and it's consistent with how
  native objects are represented.

- The value witness table and reflection descriptor for AnyObject
  use the mangling "BO" instead of "yXl".

- The demangler and remangler continue to support "BO" because it's
  still in use as a type encoding, even if it's not an AST-level
  Type anymore.

- Type-based alias analysis for Builtin.UnknownObject was incorrect,
  so it's a good thing we weren't using it.

- Same with enum layout. (This one assumed UnknownObject never
  referred to an Objective-C tagged pointer. That certainly wasn't how
  we were using it!)
2019-09-26 17:48:04 -07:00
swift-ci
bba456904a Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 17:43:09 -07:00
Joe Groff
777d557d39 Merge pull request #26419 from alexshap/fix_elf_image_parsing
Fix parsing of ELF images
2019-09-26 17:40:29 -07:00
swift-ci
79f69096bc Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 16:23:10 -07:00
David Smith
0967783170 Merge pull request #27341 from Catfish-Man/mutant-arrays
Add an Array-based NSMutableArray subclass
2019-09-26 15:20:45 -07:00
Alexander Shaposhnikov
e2b6a3d982 Fix parsing of ELF images 2019-09-26 14:37:36 -07:00
swift-ci
f2c773756a Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 14:04:17 -07:00
Joe Groff
e5b31c4e1e Merge pull request #27383 from jckarter/type-ref-builder-remote-metadata-reader
Reflection: Share demangler with MetadataReader.
2019-09-26 13:58:16 -07:00
Joe Groff
14453147d6 Reflection: Remove StartAddress from ReflectionInfo.
We now get the local/remote mapping from RemoteRef when we need it.
2019-09-26 12:09:52 -07:00
Joe Groff
633471c092 Reflection: Share demangler with MetadataReader.
TypeRefBuilder and MetadataReader had nearly identical symbolic reference resolvers,
but diverged because TypeRefBuilder had its own local/remote address management mechanism,
and because TypeRefBuilder tries to resolve opaque types to their underlying types, whereas
other MetadataReader clients want to preserve them as written in source. The first problem
has been addressed by making TypeRefBuilder use `RemoteRef` everywhere, and the second
can be handled with a flag (and might be able to be handled more elegantly with some more
refactoring of general opaque type handling in MetadataReader).
2019-09-26 11:28:00 -07:00
Nate Cook
f6547cc828 Address feedback from @amartini51. 2019-09-26 13:25:15 -05:00
swift-ci
f809a8790c Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 09:25:07 -07:00
Joe Groff
02b5e56327 Merge pull request #27369 from jckarter/type-ref-builder-remote-ref
Reflection: Traffic in RemoteRefs.
2019-09-26 09:22:57 -07:00
Joe Groff
8c4df3b4c2 Reflection: Traffic in RemoteRefs.
Instead of passing around raw local pointers and references, and spreading
tricky offset arithmetic around with the Local/RemoteAddress fields in
ReflectionInfo, have the TypeRefBuilder code use RemoteRefs everywhere,
which keep the remote/local mapping together in one unit and provide
centralized API for this logic.

This doesn't yet change how code uses the RemoteRef address data to
follow pointers across objects, for things like reading type refs, but
that should be much easier to do after this lands.
2019-09-25 20:28:03 -07:00
swift-ci
d30d3334db Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-25 20:04:18 -07:00
Ravi Kandhadai
7dabec4db2 [oslog][stdlib-private] Modify the implementation of the new OSLog
library so that the type: OSLogByteBufferBuilder is no longer needed.
This would make backward deployment of code using the new log APIs
easier, besides other minor benefits.
2019-09-25 17:47:27 -07:00
Brent Royal-Gordon
97febd42a9 Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/TBDGen/TBDGen.cpp
2019-09-24 18:52:04 -07:00