Commit Graph

1960 Commits

Author SHA1 Message Date
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
b253b21014 [gardening] Make sure argument names in comments match the actual parameter names 2016-12-21 22:56:01 +01:00
Saleem Abdulrasool
75533d9dac Merge pull request #6385 from hughbe/runtime
Fix building the runtime from Windows
2016-12-21 10:02:22 -08:00
Joe Groff
2e0cb9c0a2 Runtime: getDynamicType can't drill into existentials when producing a concrete metatype.
For a value of an opaque generic type `<T> x: T`, the language currently defines `type(of: x)` and `T.self` as both producing a type `T.Type`, and the result of substituting an existential type by `T == P` gives `P.Protocol`, so the `type(of:)` operation on `x` can only give the concrete protocol metatype when `x` is an existential in this case. The optimizer understood this rule, but the runtime did not, causing SR-3304.
2016-12-19 11:03:52 -08:00
Hugh Bellamy
7b66b579b1 Add various unreachable annotations to the runtime 2016-12-19 15:54:50 +00:00
Hugh Bellamy
f9671180da Fix build errors compiling ImageInspectionWin32.cpp 2016-12-19 15:54:49 +00:00
Hugh Bellamy
61c83ab5eb Change _MSC_VER conditions to _WIN32 in runtime 2016-12-19 15:54:49 +00:00
practicalswift
9d0b2abfc2 [gardening] Normalize end-of-namespace comments 2016-12-17 22:29:07 +01:00
swift-ci
268c2b668d Merge pull request #6325 from practicalswift/gardening-20161216 2016-12-17 09:19:24 -08:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
practicalswift
16d6dce62e [gardening] Fix recently introduced typos. 2016-12-16 21:42:09 +01:00
swift-ci
55bdf5954c Merge pull request #6285 from eeckstein/more-mangling 2016-12-14 17:21:43 -08:00
Greg Parker
8734f21bd9 [runtime] Improve thread-safety of swift_conformsToProtocol(). (#5719) 2016-12-14 16:54:25 -08:00
Erik Eckstein
c34c0e4bbc Mangling: Don’t hardcode the mangling prefixes in symbols selected by SELECT_MANGLING 2016-12-14 16:39:00 -08:00
Erik Eckstein
c73ac007d1 Mangling: support new mangled symbols in ErrorObject.mm 2016-12-13 11:01:58 -08:00
Saleem Abdulrasool
5217db0d73 runtime: clean up unused variable warning
classType is unused without ObjC interop.  Simplify the code a bit by increasing
the scope covered by the SWIFT_OBJC_INTEROP.  It also silences the warning.
2016-12-11 21:42:23 -08:00
practicalswift
76f0fdd670 [gardening] NULL → nullptr 2016-12-09 23:17:54 +01:00
Saleem Abdulrasool
3328592c20 Merge pull request #5942 from compnerd/windows-target-sdks
build: remove `TARGET_SDKS` from the runtime
2016-12-06 08:02:37 -08:00
Erik Eckstein
d93a9fd103 Mangling: use mangling macros for some more symbols in the runtime library 2016-12-05 12:34:25 -08:00
Saleem Abdulrasool
c67a33fbc7 build: remove TARGET_SDKS from the runtime
The runtime and stubs are built for ALL targets, not specific ones.  This allows
us to configure when cross-compiling to Windows again.  Collapse the dual
addition of the swiftRuntime into a single build.  This unifies the runtime
build for the apple and non-Apple SDKs.  The difference here was the ObjC
interop sources.  In order to deal with that unification add a CPP macro to
indicate whether the interop sources should be included or not.
2016-12-03 17:02:44 -08:00
Erik Eckstein
5e6c5a70d7 Mangling: Let the demangler handle the new mangling scheme 2016-12-02 15:55:30 -08:00
Erik Eckstein
9f8b68ae11 Mangling: use macros instead of hard-coded swift symbol names.
This makes it easier to switch between the old and new mangling scheme.
2016-12-02 15:55:30 -08:00
practicalswift
568a3e46ba [gardening] Improve header consistency. 2016-12-02 01:47:38 +01:00
Simon Evans
707588c962 [SR-648] ELF static binary fixes
- Revert the use of SWIFT_RUNTIME_EXPORT in ImageInspectionELF.cpp and
  fix the unittests by explicitly adding the file to the list

- Revert the change of section data names
2016-11-30 18:39:16 +00:00
Simon Evans
1daa3ee1f8 [SR-648] Add option to create statically linked binaries
- Add ImageInspectionStatic.cpp to lookup protocol conformance
  and metadata sections in static binaries

- For Linux, build libswiftImageInspectionShared.a and
  libswiftImageInspectionStatic.a for linking with libswiftCore.a.
  This allows static binaries to be built without linking to
  libdl. libswiftImageInspectionShared (ImageInspectionELF.cpp) is
  automatically compiled into libswiftCore.so

- Adds -static-executable option to swiftc to use along with
  -emit-executable that uses linker arguments in
  static-executable-args.lnk. This also requires a libicu
  to be compiled using the --libicu which has configure options
  that dont require libdl for accessing ICU datafiles

- Static binaries only work on Linux at this time
2016-11-29 13:36:19 +00:00
practicalswift
0b34f20318 Merge pull request #5962 from practicalswift/add-missing-license-headers
[gardening] Add missing licensing headers.
2016-11-29 09:40:39 +01:00
Simon Evans
c17ca759aa [runtime] Add platform independent version of dladdr() / Dl_info
- Win32 does not support dlfcn.h, Dl_info or dladdr() so add
  lookupSymbol() as a wrapper for ELF/MachO/Win32

- Win32 version needs an implementation, currently it just returns
  an error for `cannot lookup address'
2016-11-29 00:05:11 +00:00
practicalswift
5bc293cc09 [gardening] Add missing licensing headers. 2016-11-28 21:40:06 +01:00
Saleem Abdulrasool
44fbfd6e93 runtime: repair windows build
The header `dlfcn.h` does not exist for windows targets, guard the including.
Correct the structure initializers which had the members inverted.  Finally,
include the required `vector` header.
2016-11-27 17:05:19 -08:00
practicalswift
2fe4254cb7 Merge pull request #5878 from practicalswift/https-swift-org
[gardening] Use the correct base URL (https://swift.org) in references to the Swift website
2016-11-22 09:17:57 +01:00
practicalswift
02d88d73ed [gardening] Fix inconsistent headers. 2016-11-20 19:30:20 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Slava Pestov
b3bc749d35 stdlib: Linux build fix 2016-11-18 01:13:54 -08:00
Slava Pestov
4e4d281aa7 stdlib: Rework swift_typeName() to use _swift_buildDemanglingForMetadata()
Previously we had two separate mechanisms to turn a metatype
into a string. The swift_typeName() function was used to print
the metatype in a human-readable fashion, whereas the
_swift_buildDemanglingForMetadata() was used when naming
generated generic Objective-C classes.

Unify them, since what swift_typeName() does is redundant;
instead of going directly from the metatype to a human-readable
string, we can get the mangling, and print that using the
demangler.

This fixes some issues with unnecessary parenthesis when
printing function types, and also allows Objective-C classes
to be instantiated with nested generic types as parameters.
2016-11-18 00:39:14 -08:00
Joe Groff
e9ce682a75 Merge pull request #5846 from jckarter/refactor-section-registration
Runtime: Refactor platform-dependent image inspection code.
2016-11-17 18:33:22 -08:00
Joe Groff
87b27c6451 Runtime: Refactor platform-dependent image inspection code.
The code we use to interface with the platform dynamic linker is turning into a rat's nest of conditionals that's hard to maintain and extend. Since ELF, Mach-O, and PE platforms have pretty fundamentally different dynamic linker interfaces and capabilities, it makes sense to factor that code into a separate file per-platform, instead of trying to conditionalize the logic in-line. This patch factors out a much simpler portable interface for lazily kicking off the protocol conformance and type metadata lookup caches, and factors the guts out into separate MachO, ELF, and Win32 backends. This should also be a much cleaner interface to interface static binary behavior into, assisting #5349.
2016-11-17 16:50:04 -08:00
Slava Pestov
7c1adfe31d Runtime: Use metadata accessor functions in Reflection.mm and make sure they're public
Correct behavior with resilience requires calling accessors instead
of using the metadata symbols directly.

For some reason this file gets linked in with SwiftRuntimeTests too,
so make the types @_versioned in the stdlib.

Fixes <rdar://problem/29213794>.
2016-11-14 16:25:23 -08:00
practicalswift
f44686d825 [gardening] Fix trailing whitespace in *.cfg.in, *.html, *.mm and *.sil files 2016-10-29 14:06:43 +02:00
Joe Groff
2b4cba8499 Runtime: Call Set/Dictionary casting hooks in the stdlib with the correct calling convention.
We neglected to pass down the Hashable witness table parameters, leading to Heisenbugs because we would call into invalid witness pointers occasionally when loading the Hashable conformance from corrupted metadata. Fixes rdar://problem/28022201.
2016-10-12 12:16:40 -07:00
swift-ci
a989e998e5 Merge pull request #4949 from Concoction/master 2016-10-07 22:03:23 -07:00
Slava Pestov
53b3a69a9a Runtime: Fix dynamic casts to support resilient protocols
If a protocol witness table requires instantiation, the runtime
needs to call the witness table accessor when looking up the
conformance in swift_conformsToProtocol().

We had a bit of code for this already, but it wasn't fully
hooked up. Change IRGen to emit a reference to the witness table
accessor rather than the witness table itself if the witness
table needs instantiation, and add support to the runtime for
calling the accessor.
2016-09-30 18:28:11 -07:00
Michael Gottesman
581f1b0141 Merge pull request #5003 from modocache/stdlib-runtime-cmake-target-sdks
[runtime] Update CMake to use TARGET_SDKS (NFC)
2016-09-29 20:08:27 -07:00
Arnold Schwaighofer
d3ef6f70f2 Runtime: Make swift_getObjCClassMetadata resilient against weakly linked classes
rdar://28203571
2016-09-28 14:45:39 -07:00
Brian Gesiak
341d022ba7 [runtime] Update CMake to use TARGET_SDKS (NFC)
The `add_swift_library` CMake function takes an optional `TARGET_SDKS`
parameter. When used, only CMake targets for the specified SDKs are added.

Refactor `stdlib/public/runtime` to use this parameter. This also eliminates
logic that determines additional flags or source files to include based on
`SWIFT_HOST_VARIANT`, which makes it easier for hosts to add targets for
different platforms.
2016-09-24 22:40:57 -04:00
John Holdsworth
a430c40303 Bug in Windows swift_vasprintf() 2016-09-23 06:50:22 +01:00
Doug Gregor
f1a4dd7631 Merge pull request #4479 from gmilos/SR-755-linux-fatal-stacktrace-symbolication
[SR-755] Tool for re-symbolicating fatal stacktraces on Linux.
2016-09-21 10:13:21 -07:00
Doug Gregor
2942b850ad Merge pull request #4898 from DougGregor/tuple-casting
Runtime/standard library: fix tuple printing, reflection, and casting
2016-09-21 10:09:03 -07:00
Doug Gregor
c9ebcc592e [Runtime] Generalize dynamic casting between tuple types.
This allows dynamic casting to succeed between tuple types with
different element types, converting each element in turn. Fixes
rdar://problem/19892202.
2016-09-21 09:00:23 -07:00
Doug Gregor
fcacd089d6 [Mirrors] Use tuple labels when forming a mirror for a tuple type.
Fixes rdar://problem/22191852.
2016-09-21 09:00:22 -07:00
swift-ci
81ee414f7a Merge pull request #4894 from DougGregor/tuple-casting 2016-09-20 21:04:34 -07:00