Commit Graph

10155 Commits

Author SHA1 Message Date
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
d1c87f3c93 Merge pull request #24270 from natecook1000/nc_lazyscan_fix 2019-09-28 20:53:45 -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
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
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
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
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
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
David Smith
1cce12f20c Add an Array-based NSMutableArray subclass 2019-09-24 18:15:33 -07:00
David Smith
698bcade38 Merge pull request #27266 from Catfish-Man/the-deep-blue-c
Add C calling convention shims for creating arrays and strings from buffers
2019-09-24 17:46:02 -07:00
David Smith
90037745ad Add C calling convention shims for creating arrays and strings from buffers 2019-09-24 13:06:54 -07:00
Joe Groff
83b34ab8d3 Merge pull request #27306 from jckarter/remove-reflection-offsets
Reflection: Remove vestigial Offset fields from ReflectionInfo
2019-09-24 10:04:20 -07:00
Joe Groff
bc3795eb53 Reflection: Remove vestigial Offset fields from ReflectionInfo
These are now always zero, because memory readers handle virtual address mapping.
The `swift_reflection_info_t` structure used by the C RemoteMirror API keeps
its offset fields because it's supposed to be a stable API, but we now assert that
the values are always zero.
2019-09-23 14:32:26 -07:00
Saleem Abdulrasool
64ed0a4077 stdlib: silence a unused function warning (NFC)
Pre-process away the unused function on Darwin.  NFC.
2019-09-20 17:34:17 -07:00
Saleem Abdulrasool
c4f448578e Revert "runtime: add a workaround for Windows build"
This reverts commit efaf1fbefa.
Add a much more palatable workaround for the unit tests.  Rather than
adding the dllimport for the symbols, locally define the required
symbols.  This list is sufficient to restore the ability to build tests
for Windows.
2019-09-16 15:31:01 -07:00
Saleem Abdulrasool
efaf1fbefa runtime: add a workaround for Windows build
The runtime tests will statically link the runtime and dynamically link
to the standard library.  This fails to build on Windows.  This is a
horrible workaround for the time being.
2019-09-16 09:20:49 -07:00
Joe Groff
4c3f044a46 Merge pull request #27185 from jckarter/fast-path-short-mangling-lookups
Runtime: Fast path lookup for short manglings.
2019-09-14 07:34:33 -07:00
Joe Groff
78ed70cbb8 Runtime: Fast path lookup for short manglings.
Mangling these common types takes only two bytes, which is shorter than a symbolic reference. We
know where their metadata is in the standard library, too, so we don't need to search the lookup
tables for them.
2019-09-13 18:40:25 -07:00
Joe Groff
413100be33 Merge pull request #27181 from jckarter/demangler-symbolic-reference-api-refactor
Demangler: Make symbolic reference resolver part of `demangle(Symbol|Type)` calls.
2019-09-13 18:12:04 -07:00
Joe Groff
f1e84994ed Demangler: Make symbolic reference resolver part of demangle(Symbol|Type) calls.
This makes for a cleaner and less implicit-context-heavy API, and makes it easier for symbolic
reference resolvers to do context-dependent things (like map the in-memory base address back to a
remote address in MetadataReader).
2019-09-13 15:47:08 -07:00
David Smith
b8fb2e5eae Merge pull request #27155 from Catfish-Man/shim-shim-sher-ee-2
Remove stdlib and runtime dependencies on Foundation and CF
2019-09-13 09:43:38 -07:00
Doug Gregor
5285afdbe6 [SIMD] Use @_alwaysEmitIntoClient rather than @_transparent 2019-09-12 21:31:36 -07:00
David Smith
1efa946caf Remove stdlib and runtime dependencies on Foundation and CF 2019-09-12 18:03:14 -07:00
Doug Gregor
87516934cd [SIMD] Add disambiguating += and -= operators.
The introduction of += and -= default implementations on
AdditiveArithmetic introduces an ambiguity with the += and -=
implementations on SIMD (where Scalar: FloatingPoint). Break the
ambiguity by adding another set of definitions of += and -= on
AdditiveArithmetic & SIMD where Self.Scalar: FloatingPoint.

Fixes rdar://problem/55278156.
2019-09-12 17:54:46 -07:00
Nate Cook
06102a9ffa Minor additional revisions 2019-09-11 10:09:55 -05:00
Karoy Lorentey
9638e9167c [doc] ManagedBuffer: Fix cross-reference to isKnownUniquelyReferenced 2019-09-10 18:52:26 -07:00
Karoy Lorentey
6bc4c85005 [doc] Avoid use of “iff” in public API documentation 2019-09-10 18:52:01 -07:00
Nate Cook
ce28cdee93 Update the error message when subscripting String with Int. (#27069)
Instead of referring to a doc comment that isn't really accessible to the
developer, let's be accurate about what type they should be using here.
2019-09-10 12:23:09 -05:00
swift-ci
656fe89752 Merge pull request #26936 from mikeash/null-was-a-mistake 2019-09-09 10:27:17 -07:00
Mike Ash
5decec24e7 [Runtime] Fix gatherWrittenGenericArgs crashing when description is NULL.
rdar://problem/54775582
SR-11374
2019-09-09 10:58:22 -04:00
Alex Langford
d57c841445 [CMake] Correct dependencies for clang headers components
When building swift as a part of LLVM (as opposed to standalone) the components
related to swift headers should explicitly depend on the clang target to produce
those. On LLVM 9 and up, that would be `clang-resource-headers` and on lower
versions it would be `clang-headers`. It is important that we check for
`clang-resource-headers` first because `clang-headers` refers to something
different in LLVM 9 and up.
2019-09-03 09:15:38 -07:00
swift-ci
b8f42d6165 Merge pull request #26466 from nvzqz/is_concrete_builtin 2019-08-28 19:10:37 -07:00
Joe Groff
5354f9f921 Merge pull request #26911 from jckarter/objc_getClass-untrusted-demangler
Runtime: Hook the ObjC runtime with an untrusted demangler.
2019-08-28 14:22:01 -07:00
swift-ci
7039277e4d Merge pull request #26906 from amartini51/master 2019-08-28 13:44:31 -07:00
swift-ci
f804efd5af Merge pull request #25430 from natecook1000/nc-prefixwhile-degyb 2019-08-28 13:21:05 -07:00
Joe Groff
a49e0d5a2e Runtime: Hook the ObjC runtime with an untrusted demangler.
We don't want objc_getClass and NSClassFromString to be able to feed arbitrary symbolic reference
pointers into the Swift runtime. Fixes rdar://problem/54724618.
2019-08-28 11:56:45 -07:00
Nate Cook
55f9be3291 Switch "may" to "might" per comments from @amartini51. 2019-08-28 13:37:00 -05:00
Alex Martini
64c32f3331 Add missing ) and code voice.
rdar://problem/46680213
2019-08-28 10:36:34 -07:00
Mike Ash
9e61d532ed Merge pull request #26516 from mikeash/retain-release-avoid-function-pointer-indirection
[Runtime] Avoid function pointer indirection in refcounting functions.
2019-08-28 10:37:34 -04:00
Michael Gottesman
447f00892a [ownership] Enable ownership lowering on overlays. I still need to flip the switch to enable this on the tests/rest of the world. 2019-08-27 18:26:15 -07:00
Nikolai Vazquez
6e542bf22a Annotate Swift._isConcrete with @_transparent
Returns `false` otherwise in Debug builds because it is generic.
2019-08-27 16:51:09 -07:00
Nikolai Vazquez
890409effd Elaborate in docs for Swift._isConcrete 2019-08-27 16:51:09 -07:00
Nikolai Vazquez
ba0612f2e9 Add Builtin.isConcrete<T>(T.Type) -> Int1
Returns `true` if `T.Type` is known to refer to a concrete type. The
implementation allows for the optimizer to specialize this at -O and
eliminate conditional code.

Includes `Swift._isConcrete<T>(T.Type) -> Bool` wrapper function.
2019-08-27 16:51:09 -07:00
Karoy Lorentey
9a663b6ae3 Merge pull request #26853 from rudedogg/master
[AppKit] Fix incorrect rawValue for NSEvent.SpecialKey.deleteForward
2019-08-27 13:55:12 -07:00