We were attempting to find the vtable slot for the allocating
initializer in the superclass, but of course it doesn't have one. Part
of <rdar://problem/17408284>.
Swift SVN r20429
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
They don't get dispatched, but we should go through their native entry point instead of the ObjC thunk. Fixes <rdar://problem/17606834>.
Swift SVN r20105
If a dynamic definition overrides a non-dynamic one, then we need to go through objc_msgSend even if we try vtable dispatch on the non-dynamic superclass definition. Also, if we have a dynamic definition that doesn't override, we don't need a vtable entry for it at all.
Swift SVN r19944
- 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
Mandatory-inlined (aka transparent functions) are still treated as if they
had the location and scope of the call site. <rdar://problem/14845844>
Support inline scopes once we have an optimizing SIL-based inliner
Patch by Adrian Prantl.
Swift SVN r18835
insert the values for variables into the SIL for
expressions correctly.
Instead of hijacking emitLValueForDecl() in
SILGenFunction, we now hook into
emitInitializationForVarDecl. That way we can
emit the proper value and just stick it into
VarLocs.
To support this, we also make two other changes:
- We suppress marking the variable uninitialized
in MarkPatternUninitialized::visitNamedPattern.
- We override DeclChecker in the type checker to
allow LLDB to construct let statements without
initializers.
Swift SVN r18676
'unowned let' initializations don't drop their ReferenceStorageInitialization
transformation. This defines away another class of problems related to weak and
unowned pointers, and allows us to remove a hack added to paper over rdar://16681656.
Swift SVN r17846
Eliminate the duplicate half-broken bridging logic in emitClassConstructorAllocator by referencing foreign initializers through their foreign-to-native thunks, which SILGen knows how to emit already. Do the same thing for factory initializers by suppressing their normal allocating initializer codegen and just referencing the usual foreign-to-native thunk for them. This fixes <rdar://problem/16853205> because we get the ownership thunking right now.
Swift SVN r17840
We now enforce via an assert that each witness table is unique and that
every protocol conformance that is referenceable from SIL must have a
witness table matched to it.
Also, I taught the linker that it should deserialize witness tables for
InitExistentialRefInst instructions, something that was missed before.
Swift SVN r17283
- 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
Given base class A and dervied class B, both with member functions f(),
to look for A.f in B's vtable, we should return SILFunction for B.f.
Before this commit, B's vtable will have entry for B.f, A's vtable will
have entry for A.f. When looking for A.f in B's vtable, it returns null.
And devirtualizer will look for A.f in A's vtable and resolve it to
SILFunction for A.f.
When replacing a class_method %1 : $A, #A.f!1 with a function ref to B.f,
we will have type checking issues for the apply instructions. So devirtualizer
will replace the argument of the apply instructions when necessary.
rdar://16681983
Swift SVN r16854
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
Use this node to capture the argument name and its source location in
the AST. We're only building these in one place at the moment; the
rest will be updated soon.
Swift SVN r16581
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
Emit Swift thunk functions to bridge blocks into native function values. On entry into @objc thunks, copy_block blocks to ensure they've been lifted off the stack.
Swift SVN r16177
We want to generally treat blocks as heap objects until proven stack-able by escape analysis, like we do generally with other heap entities. The only place we should be exposed to stack blocks is when they're passed as arguments, so handle this by copy_block'ing any block arguments we get in the function prolog. Optimization can eliminate them when analysis shows the block doesn't escape or is already on the heap.
Swift SVN r16096
We won't have any types where copying has an effect on the bit pattern (except for blocks, which need special handling anyway), and copy_value having a result makes optimizations more complex, so remove it.
Swift SVN r15640
If an extension introduces an @objc protocol conformance using existing methods that are already @objc, then we shouldn't emit @objc thunks for them again, and indeed, we can't for native ObjC classes. Fixes <rdar://problem/16330856>.
Swift SVN r15087
Allows @objc protocol property requirements to work with existing properties of a class, fixing the immediate problem in <rdar://problem/16284654> and <rdar://problem/16284574> (though there's a still a problem adopting methods of natively ObjC classes as protocol conformances, <rdar://problem/16330856>).
Swift SVN r15078
We can't assume that ObjC types aren't generic anymore because container bridging requires generic subclasses of ObjC types, so remove the assertions that ObjC entry points are never generic and properly handle interface type substitution when emitting thunks.
Swift SVN r15073
and properties, allowing us to set up vtables properly. Before
this patch, we'd get new entries in the derived class vtable for
overridden property accessors, which didn't help things.
This is progress along the way towards fixing:
<rdar://problem/16310561> Property vtables not set up correctly
but isn't the full story. Dispatch is still not going through the vtable,
so we get the wrong behavior still.
This patch also exposes a totally mystifying (to me) problem with the deserializer.
A test is temporarily disabled because of this.
Swift SVN r15051
Teach IRGen to honor the linkage of SILWitnessTables, and teach SILGen to emit witness tables and protocol witness thunks for external definitions with shared linkage. Fixes <rdar://problem/16264703>.
Swift SVN r14908
In the short term, we need to be able to emit shared symbols for SILWitnessTables corresponding to Clang-imported modules, and soon, the generic specializer will need to be able to reference *_external witness tables deserialized from library modules.
Swift SVN r14887
In Sema, give derived '==' definitions the module's DerivedFileUnit as their decl context instead of the more general Module, and give it a backreference to the nominal type for which it was derived.
In SILGen, visit the derived global decls associated with Clang-imported enums, and give them shared linkage. Part of fixing <rdar://problem/16264703>.
Swift SVN r14875