Commit Graph

20516 Commits

Author SHA1 Message Date
David Zarzycki
099743894b [AST] NFC: Improve non-generic nominal type memory efficiency
The non-generic nominal type nodes do not actually need to use LLVM's
FoldingSetNode, and on my workstation the release build of the standard
library completes about 1/3 of a second faster after switching to LLVM
DenseMap. This is perhaps not surprising, because Decl to Type mappings
are only needed during early compiler stages, but the intrusive
FoldingSetNode data decreases CPU cache efficiency during all compiler
stages. As a bonus, the resulting code is simpler.
2019-03-01 09:44:40 -05:00
Slava Pestov
7b0d10e2c7 Merge pull request #23004 from slavapestov/sil-resilience-expansion-plumbing
Continue plumbing resilience expansion through SIL type lowering
2019-03-01 07:32:01 -05:00
David Zarzycki
4dc48797d4 Merge pull request #23003 from davezarzycki/fix_always_loadable_ref_stor_types
[AST] Reference ownership macro fixes and cleanup
2019-03-01 06:41:39 -05:00
Slava Pestov
a9841e844f SIL: Add resilience expansion parameter to SILModule::isTypeABIAccessible() 2019-03-01 02:07:16 -05:00
Slava Pestov
903721cdc5 SIL: Remove SILType::getMetatypeInstanceType() 2019-03-01 02:07:16 -05:00
Slava Pestov
2970334e80 SIL: Remove SILType::getReferentType() 2019-03-01 02:07:16 -05:00
Slava Pestov
d1cf8c9cf6 SIL: Add type lowering APIs to SILFunction
For now these just forward to methods on the module's TypeLowering,
but soon they will use the SILFunction's resilience expansion.
2019-02-28 23:12:08 -05:00
Slava Pestov
c5cf5c2c4b SILOptimizer: Remove isSimpleType()
This was checking if the type is a trivial type that is not a
class. However this was redundant because class types are not
trivial anyway.
2019-02-28 22:56:03 -05:00
Slava Pestov
112d1bd561 SILOptimizer: Small cleanups for devirtualizer
Where possible, pass around a ClassDecl or a CanType instead of a
SILType that might wrap a metatype; the unwrapping logic was
repeated in several places.

Also add a FIXME for a bug I found by inspection.
2019-02-28 22:40:54 -05:00
swift-ci
3968b99fbe Merge pull request #22999 from mikeash/handle-no-ext-tagged-pointers 2019-02-28 18:41:53 -08:00
Slava Pestov
c970caedd5 SIL: Optimization remarks can take SILType by value
No need to pass a pointer to SILType; it is a pointer-sized value itself.
2019-02-28 21:28:16 -05:00
swift-ci
bd8890aca5 Merge pull request #22954 from adrian-prantl/48259889 2019-02-28 18:20:11 -08:00
David Zarzycki
b6b5ea5faa [AST] Reference ownership macro fixes and cleanup
This simplifies some boilerplate, and in particular, some SIL verifier
logic; and fixes a couple bugs related to always loadable reference
storage types.
2019-02-28 20:52:19 -05:00
David Ungar
2ce6867c7b Merge pull request #22578 from davidungar/A-2-12
[NameLookup ] UnqualifiedLookup refactoring
2019-02-28 17:30:37 -08:00
Brent Royal-Gordon
f1d1df3b30 Merge pull request #22842 from brentdax/target-practice
Name platform-specific module files using a normalized target triple
2019-02-28 16:07:37 -08:00
Mike Ash
78e7106c57 [Reflection] Gracefully handle the absence of objc_debug_taggedpointer_ext_* variables.
rdar://problem/48483373
2019-02-28 17:51:54 -05:00
Adrian Prantl
b36c646914 Allow for passing a custom Archetype naming schema to the demangler.
LLDB would like to substitute the original Archetype names from the
source code when demangling symbols instead of the confusing generic
'A', 'B', ...

<rdar://problem/48259889>
2019-02-28 14:01:38 -08:00
Slava Pestov
c8343525c9 Merge pull request #22975 from slavapestov/remoteast-error-existential-linux
RemoteAST: Fix Error existential introspection on Linux
2019-02-28 15:04:55 -05:00
Saleem Abdulrasool
0cf91f343e Reflection: add PE/COFF magic checking for inspection
When we inspect a binary, verify that it is a PE/COFF binary before
trying to interpret it as a PE/COFF binary.  This prepares the code
for extraction of the file inspection and will permit cross-platform
builds to introspect foreign binaries.
2019-02-28 09:03:04 -08:00
Slava Pestov
31992143ee RemoteAST: Fix Error existential introspection on Linux
We don't have tests that look at the instance address
on the Swift side, but lldb is going to use this API
shortly.
2019-02-28 00:00:36 -05:00
David Smith
22c61e4b94 Merge pull request #22956 from mikeash/dont-require-taggedpointer-obfuscator
[Reflection] Fail gracefully when objc_debug_taggedpointer_obfuscator isn't present.
2019-02-27 13:58:20 -08:00
Brent Royal-Gordon
64760981d0 [NFC] Restyle getTargetSpecificModuleTriple()
* Adds documentation comments.
* Turns redundant cases into comments.
* Removes the else branch in a couple “if (…) return …; else return …;” patterns.
2019-02-27 11:44:10 -08:00
Brent Royal-Gordon
3f58a79174 Import error now mentions the target, not the arch 2019-02-27 11:43:12 -08:00
Brent Royal-Gordon
c1cc51d1f3 Use target triple for “universal” modules
When loading a module supporting multiple targets, the module loader now looks for a file named with a normalized version of the target triple first, and only falls back to the architecture name if the normalized triple is not found.
2019-02-27 11:43:12 -08:00
Mike Ash
f85d87f764 [Reflection] Fail gracefully when objc_debug_taggedpointer_obfuscator isn't present.
Older OSes don't have this variable. We can treat it as 0 when it's not present.

rdar://problem/48411483
2019-02-27 14:37:18 -05:00
Daniel Rodríguez Troitiño
3f76e63b6e Merge pull request #22899 from drodriguez/reflection-context-fix-2
Reflection: try holding 32/64 address offset in target machine pointers.
2019-02-27 11:34:36 -08:00
Pavel Yaskevich
e9817b027f Merge pull request #22926 from xedin/diag-missing-clj-params
[Diagnostics] Diagnose missing arguments in closures via fixes
2019-02-27 00:29:40 -08:00
Saleem Abdulrasool
969b90daac Merge pull request #22933 from alexshap/reflection_on_windows
[Reflection] Add first bits to support COFF
2019-02-26 23:40:05 -08:00
Jordan Rose
5dc6e22aa2 Merge pull request #22666 from jrose-apple/TypeDeserializer
[Serialization] Clean up type deserialization in the same way as decl deserialization

No functionality change.
2019-02-26 19:10:40 -08:00
Alexander Shaposhnikov
848b8efd34 [Reflection] Add first bits to support COFF
In this diff we add first bits to make reflection work on Windows,
in particular, properly extract the metadata from the corresponding sections.
With this diff box_descriptors.sil and capture_descriptors.sil start passing on Windows
after some minor tweaks to the lit testing infrastructure.
2019-02-26 17:12:53 -08:00
swift-ci
29fcb2e290 Merge pull request #22927 from gottesmm/pr-476ad464db62e88edd7927623bac98b8e266587c 2019-02-26 14:48:00 -08:00
Daniel Rodríguez Troitiño
8bee95d232 Reflection: try holding 32/64 address offset in type big enough for all architectures.
When compiling for a 32 bit machine, uintptr_t from ReflectionInfo will
be the integer sized to hold a 32 bit pointer, so a 64 bit pointer might
not fit.

This commit removes the solution in
0f20c486e0 and does a runtime check that
the calculated offset will fit into the target machine uintptr_t, which
might not be true for 32 bits machines trying to read 64 bits images,
which should not be that common (and those images have to have offsets
bigger than what a 32 bits number can hold).
2019-02-26 13:31:35 -08:00
Michael Gottesman
98ed241ce5 [cast-optimizer] Add an "ApplySite" like data structure "SILDynamicCastInst" that abstracts over all dynamic cast instructions.
I am going to use this to refactor a bunch of the goop in the cast optimizer. At
a high level, we are really just performing a giant switch over the casts to
grab different state. We then take that state and we pass it into the bridge
cast optimizer.

To make such code more compact/easier to understand, I am adding in this commit
a type erased dynamic cast instruction type called "SILDynamicCastInst". In
subsequent commits, I wire up each of the individual instructions to it one at a
time.

As an additional advantage it will enable us to take advantage of covered
switches when ever in the future we introduce new casts.
2019-02-26 13:23:54 -08:00
Rintaro Ishizaki
6872f6c0cb Merge pull request #19742 from AnthonyLatsis/class-var-override-compl
[CodeCompletion][Parser] Completions for overridable static members
2019-02-26 09:52:37 -08:00
swift-ci
aea757a6e9 Merge pull request #22910 from DougGregor/objc-renamed-protocol-metadata 2019-02-25 23:41:50 -08:00
Doug Gregor
b5f45f8f72 [IRGen] Mangle Swift @objc(renamed) protocols as Objective-C in metadata.
When emitting metadata for a Swift-defined @objc protocol that has
provided a specific Objective-C name (e.g., via @objc(renamed)),
mangle such protocols using their Objective-C names so they can be
found at runtime.

Only do this for metadata, because doing it anywhere else would cause
an ABI break. Fixes rdar://problem/47877748.
2019-02-25 17:31:08 -08:00
Pavel Yaskevich
0b12c664b0 [ConstraintSystem] Fix missing arguments
While trying to match function types, detect and fix any missing
arguments (by introducing type variables), such arguments would
get type information from corresponding parameters and aid in
producing solutions which are much easier to diagnose.
2019-02-25 17:07:26 -08:00
Saleem Abdulrasool
ed871d508b Merge pull request #22884 from compnerd/weak_cast
Remote: loosen a cast
2019-02-25 15:46:22 -08:00
Saleem Abdulrasool
b37d640c5d Merge pull request #22886 from compnerd/c++-from-c-is-sadness
Runtime: remove keypath functions in the compiler build
2019-02-25 15:45:46 -08:00
Rintaro Ishizaki
3c970418c3 [Gardening][AST] Eliminate 'numParameterLists'. (#22824)
Leftover from bfc4121971
2019-02-25 13:33:26 -08:00
Joe Groff
bb67cf815c Merge pull request #21355 from technicated/tuple-keypaths-2
Tuple KeyPaths
2019-02-25 12:56:05 -08:00
Saleem Abdulrasool
5066729677 Runtime: remove keypath functions in the compiler build
The host tools may be built with the host compiler.  cl objects to the
"extern C" function returning a C++ type which the keypath functions do.
However, these declarations are needed only in the runtime, which is
always built with clang.  Preprocess away the declarations during the
build of the compiler.  This allows us to build with cl once more.
2019-02-25 11:21:28 -08:00
Saleem Abdulrasool
40c3655838 Remote: loosen a cast
cl objects to the use of the reinterpret_cast for the casting between
integral types.  Loosen to a static_cast.
2019-02-25 11:19:47 -08:00
swift-ci
0e4f95ebbf Merge pull request #22870 from compnerd/old-school-cool 2019-02-24 19:50:11 -08:00
swift-ci
f166af1150 Merge pull request #22866 from compnerd/a-narrow-path 2019-02-24 18:44:50 -08:00
Saleem Abdulrasool
650ebeb14b ABI: use a c-style cast in the header (NFC)
Use a C-style cast to appease cl depending on the template type
parameters used.  It does not like a reinterpret_cast between integral
types.
2019-02-24 16:47:30 -08:00
Saleem Abdulrasool
0f20c486e0 Reflection: prevent address truncation on ELF64
Ensure that we use the address type as specified by ELF rather than
truncate to a 32-bit value.
2019-02-24 15:40:48 -08:00
Slava Pestov
84fbd0271a Merge pull request #22825 from slavapestov/remove-old-type-reconstruction
Remove TypeReconstruction.cpp
2019-02-23 01:26:54 -05:00
Slava Pestov
88bc29a511 Merge pull request #22775 from slavapestov/resilient-witness-table-cleanup
Resilient witness table emission cleanup
2019-02-22 21:55:52 -05:00
Suyash Srijan
f2804fcd15 [typechecker] add warning for unrelated downcast from function type to protocol type/archetype type 2019-02-22 22:01:36 +00:00