This means that even though the guaranteed parameter comes in at +0, we
immediately retain it and add a cleanup handler at the end of the function. Once
+0 self has been turned on, I will add a guaranteed optimization that removes
such retains, releases.
Tests will follow with the commit that enables the actual +0 self parameter.
Swift SVN r23627
variable part of the function prologue by omitting its location.
Fixes <rdar://problem/18989457> Xcode 6.2 6C86C (lldb-320.4.157) : po self returns error: Execution was interrupted, reason: EXC_BAD_ACCESS
Swift SVN r23569
It's not always correct to map a Swift Bool back to ObjCBool in C land, since Bool could have originally been a proper _Bool. Pass the clang::Decl down to type lowering so we can recognize this. We still don't have a great solution for block types, because there's no decl to refer to, and Swift's user-level type system erases the distinction between void(^)(_Bool) and void(^)(BOOL). However, this is enough to let us start using C APIs that traffic in _Bool.
Swift SVN r23546
This allows making global addressors fragile (They use globalinit_{token,func} for initialization of globals).
It has no noticable performance impact on our benchmarks, but it removes an ugly hack which explicitly
prevented addressors from being fragile.
Swift SVN r22812
This allows making global addressors fragile (They use globalinit_{token,func} for initialization of globals).
It has no noticable performance impact on our benchmarks, but it removes an ugly hack which explicitly
prevented addressors from being fragile.
Swift SVN r22795
Stub initializers don't get serialized, so this fixes a vtable layout inconsistency when a method of a subclass of a subclass of NSObject is accessed. Fixes rdar://problem/18498385.
Swift SVN r22480
Those destructors are not referenced anywhere else in the SIL, but are used in the metadata
of a class. If they are private then dead function elimination would remove them.
This fixes <rdar://problem/18431856> unreachable executed at GenDecl.cpp:808
Swift SVN r22261
Now the SILLinkage for functions and global variables is according to the swift visibility (private, internal or public).
In addition, the fact whether a function or global variable is considered as fragile, is kept in a separate flag at SIL level.
Previously the linkage was used for this (e.g. no inlining of less visible functions to more visible functions). But it had no effect,
because everything was public anyway.
For now this isFragile-flag is set for public transparent functions and for everything if a module is compiled with -sil-serialize-all,
i.e. for the stdlib.
For details see <rdar://problem/18201785> Set SILLinkage correctly and better handling of fragile functions.
The benefits of this change are:
*) Enable to eliminate unused private and internal functions
*) It should be possible now to use private in the stdlib
*) The symbol linkage is as one would expect (previously almost all symbols were public).
More details:
Specializations from fragile functions (e.g. from the stdlib) now get linkonce_odr,default
linkage instead of linkonce_odr,hidden, i.e. they have public visibility.
The reason is: if such a function is called from another fragile function (in the same module),
then it has to be visible from a third module, in case the fragile caller is inlined but not
the specialized function.
I had to update lots of test files, because many CHECK-LABEL lines include the linkage, which has changed.
The -sil-serialize-all option is now handled at SILGen and not at the Serializer.
This means that test files in sil format which are compiled with -sil-serialize-all
must have the [fragile] attribute set for all functions and globals.
The -disable-access-control option doesn't help anymore if the accessed module is not compiled
with -sil-serialize-all, because the linker will complain about unresolved symbols.
A final note: I tried to consider all the implications of this change, but it's not a low-risk change.
If you have any comments, please let me know.
Swift SVN r22215
materializeForSet accessors for stored properties.
Also, reliably place materializeForSet after the
setter, no matter when we generate it.
Swift SVN r22014
Update SILGen to create SILGlobalVariable and SILGlobalAddrInst instead of
GlobalAddrInst. When we see a definition for a global variable, we create
the corrsponding SILGlobalVariable definition.
When creating SILGlobalVariable from a global VarDecl, we mangle the global
VarDecl in the same way as we mangle it at IRGen. The SILLinkage is also
set in the same way as we set it at IRGen.
At IRGen, we use the associated VarDecl for SILGlobalVariable if it exists,
to have better debugging information.
We set the initializer for SILGlobalVariable definition only.
We also handle SILGlobalAddrInst in various SILPasses, in the similar way
as we handle GlobalAddrInst.
rdar://15493694
Swift SVN r21887
Redefine the RawRepresentable protocol to use an 'init?' method instead of 'fromRaw(Raw)', and a 'raw' get-only property instead of 'toRaw()'. Update the compiler to support deriving conformances for enums and option sets with the new protocol. rdar://problem/18216832
Swift SVN r21762
Fixes rdar://problem/17619178. I can't make a SILGen test case because of rdar://problem/18182969 -- under normal circumstances we appear to produce new conformances for base protocols even when there are conformances in the stdlib we should reuse instead.
Swift SVN r21594
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