- Split getSelfTypeForDynamicLookup into two pieces, and generalize it
to work on non-loadable protocols.
- Change dynamic_method_branch to take its argument as a protocol of any
protocol type, instead of as something of UnownObject type.
- Teach emitForcedDynamicMemberRef to only do its peephole optimization for
@objc cases, since it is special behavior of objc_msgSend.
- enhance emitDynamicPartialApply & emitDynamicMemberRefExpr to emit the
proper project_existential instruction (not a _ref) when dealing with a
non-classbound protocol.
Change the verifier to allow DynamicMethodBranchInst to work on non-@objc
protocol members.
This eliminates a bunch of pointless unchecked_ref_cast's in the generated
SIL for existing code, but this got squashed at IRGen time anyway, so no
real change for anything that sema permits.
Swift SVN r21519
Fixes an attempt to perform vtable dispatch to an initializer that was
defined in an extension and is not @objc, which means it had no vtable
entry <rdar://problem/17909833>.
Swift SVN r21352
Replace the true/maybe state that Builtin.canBeClass was returning by a
tri-state (yes, no, maybe) allowing the optimizer to use the definite no
answer. This removes the need of the sizeof check that we had in
isClassOrObjCExistential. It also removes the need to CSE this function since
in most cases we will be able to instantiate canBeClass to yes or no (vs maybe)
at compile time.
benchmark``````````````,``baserun0``,``optrun2``,``delta,``speedup
ClassArrayGetter```````,``988.00````,``337.00```,``644.00``,````````191.7%
DeltaBlue``````````````,``2429.00```,``1927.00``,``460.00``,````````23.9%
Dictionary`````````````,``1374.00```,``1231.00``,``129.00``,````````10.9%
Havlak`````````````````,``1079.00```,``911.00```,``124.00``,````````13.7%
Rectangles`````````````,``924.00````,``541.00```,``379.00``,````````70.1%
radar://16823238
Swift SVN r21331
"self" for class-constrained witnesses is still passed at +1, so we can't load it using AllowPlusZero. Fixes <rdar://problem/17852846>.
Swift SVN r20868
a concrete SILValue when emitting the Callee object so we can look things up
in method tables etc. Without reengineering all of Callee, that isn't going
to work.
Swift SVN r20727
t2.swift:4:11: error: inout arguments are not allowed to alias each other
swap(&x, &x)
^~
t2.swift:4:7: note: previous aliasing argument
swap(&x, &x)
^~
This can (and arguably should) also be handled with a later diagnostic pass, but
handling it in SILGen gives us full range emission capability.
Swift SVN r20469
Expose Substitution's archetype, replacement, and conformances only through getters so we can actually assert invariants about them. To start, require replacement types to be materializable in order to catch cases where the type-checker tries to bind type variables to lvalue or inout types, and require the conformance array to match the number of protocol conformances required by the archetype. This exposes some latent bugs in the test suite I've marked as failures for now:
- test/Constraints/overload.swift was quietly suffering from <rdar://problem/17507421>, but we didn't notice because we never tried to codegen it.
- test/SIL/Parser/array_roundtrip.swift doesn't correctly roundtrip substitutions, which I filed as <rdar://problem/17781140>.
Swift SVN r20418
When 'dynamic' is honored, extension methods can only be dynamically dispatched if they'll be objc-dispatched, since they don't have native vtable entries.
Swift SVN r19999
We were getting this wrong for properties introduced in class extensions, for which we currently do not emit vtable entries and so are statically dispatched. Fixes <rdar://problem/17577579>. This also incidentally fixes references to properties of generic classes, which should be dynamically dispatched, but weren't because of getDeclaredTypeOf/InContext confusion.
Swift SVN r19641
We need to be able to ask whether a method requires dynamic dispatch in other places in SILGen. NFC yet, but a step on the way to fixing <rdar://problem/17577579>.
Swift SVN r19636
- Change the parser to accept "objc" without an @ sign as a contextual
keyword, including the dance to handle the general parenthesized case.
- Update all comments to refer to "objc" instead of "@objc".
- Update all diagnostics accordingly.
- Update all tests that fail due to the diagnostics change.
- Switch the stdlib to use the new syntax.
This does not switch all tests to use the new syntax, nor does it warn about
the old syntax yet. That will be forthcoming. Also, this needs a bit of
refactoring, which will be coming up.
Swift SVN r19555
SILGen lowers this to unchecked_trivial_bit_cast or unchecked_ref_bit_cast based on the semantics of the input and output types, raising an unsupported error if one of the types are address-only.
Swift SVN r19058
Tweak the AST representation and type-checking of default arguments to preserve a full ConcreteDeclRef with substitutions to the owner of the default arguments. In SILGen, emit default argument generators with the same genericity as the original function.
Swift SVN r18760
This makes imported factory initializers (barely) usable from
Swift-defined convenience initializers, which is needed for
<rdar://problem/16509024>.
This is all an egregious hack, because factory initializers should
really be expressible in Swift and should only emit allocating
constructors. Doing this correctly is tracked by <rdar://problem/16884348>.
Swift SVN r17946
This looks like this may always be initialized, but the logic is
a bit harder to follow and this simple extra checking doesn't
really cost us.
Swift SVN r17615
When we partially apply an inner-pointer method or property, the thunk or partial_apply that applies "self" needs to be the one that handles lifetime-extending "self". Verify that a partial_apply-ed inner pointer method is not inner pointer and implement lifetime extension in the partial apply thunk. Fixes <rdar://problem/16803701>.
Swift SVN r17321
There were a bunch of things broken here--it's amazing this ever appeared to work.
- Retain 'self' before partial_applying it to the method, so we don't overrelease it.
- Correctly lower the ownership conventions of the dynamic method against the SILDeclRef, so we don't overrelease arguments or over-over-release self, and we handle ObjC methods with weird conventions correctly.
- Thunk when there are bridging type differences between the partially-applied ObjC method and a Swift method, so we don't crash if the method takes NSStrings or other bridged types.
Add verifier checks that the result of 'dynamic_method' and BB arg of 'dynamic_method_br' actually match the method they're dispatching.
Swift SVN r17198
a net +1 to being a net -1.
I'm pretty sure I just copy-and-pasted this and then
forgot to actually implement it. Oops. In my defense,
I was planning to actually audit/test correctness when
I actually started doing CF management.
Swift SVN r16924
- Change the parser to unconditionally reject @mutating and @!mutating with a fixit and
specific diagnostic to rewrite them into the [non]mutating keyword.
- Update tests.
This resolves <rdar://problem/16735619> introduce nonmutating CS keyword and remove the attribute form of mutating all together
Swift SVN r16892
An unsafe cast from a base to a derived class isn't really all that different from one from Builtin.NativeObject to an arbitrary class, so relax this pair of instructions to allow an arbitrary bitcast. This only combines the instructions; it doesn't attempt to simplify any codegen that was emitting round-trip casts before yet.
Swift SVN r16736
Do this the lazy way, just autoreleasing "self" after the call. A future optimization pass may be able to eliminate this autorelease when it recognizes the lifetime of the derived value, but that's not immediately necessary.
Swift SVN r16635
This will represent the return convention of imported __attribute__((objc_returns_inner_pointer)) methods. Leave it unimplemented for now until we can autorelease things sanely.
Swift SVN r16628
Introduce CtorInitializerKind to describe the kind of an enum, rather
than a bool, to make way for more initializer kinds in the future.
Swift SVN r16525
This means that we now synthesize getters and setters a lot more than we used to, so the
implementation work on this shook out a ton of bugs with them.
There is still one failure that I don't understand at all (test/stdlib/NewArray.swift.gyb),
nor do I understand how to diagnose the problem, so I XFAILed it and filed rdar://16604980 to
track fixing it.
Swift SVN r16299
These bits are orthogonal to each other, so combine them into one, and diagnose attempts to produce a type that's both. Spot-fix a bunch of places this revealed by inspection that we would have crashed in SILGen or IRGen if blocks were be handled.
Swift SVN r16088
This is missing almost all semantic analysis and is missing various
optimization opportunities (e.g. final methods that are not overrides
don't need vtable entries), but this is enough to devirtualize class
stuff, which is important for our performance efforts. I'll add this
to release notes when it is more fully fleshed out.
Swift SVN r15885