Teach swift_deallocPartialClassInstance how to deal with classes that
have pure Objective-C classes in their hierarchy. In such cases, we
need to make sure a few things happen:
1) We deallocate via objc_release rather than
swift_deallocClassInstance.
2) We only attempt to find an execute ivar destroyers for
Swift-defined classes in the hierarchy
3) When we hit the most-derived pure Objective-C class, make sure that we
only execute the dealloc of that class and not any of the subclasses
(which would end up trying to destroy ivars again).
Fixes rdar://problem/25023544.
This reverts commit 2262bd579a.
This information isn't necessary for field descriptor lookup,
after all. It's only the fields that need to have generic information,
which is already in the field descriptor.
Previously, the mangling didn't include generics, but these are
needed to key off of the new field descriptor metadata, as well
as to construct type references for the nominal type.
If behaviors are specified after the declaration, something like this:
```swift
var x: Int __behavior foo // __behavior is a stand-in keyword
```
we're thinking this encourages a simpler design for smaller, more composable behaviors. If we think of behavior application as function-like, then parameters to the behavior could be passed with function-like syntax:
```swift
__behavior lazy(@autoclosure initialValue: () -> Value) { ... }
var x: Int __behavior lazy(1738)
__behavior didSet(body: (oldValue: Value) -> Void) { ... }
var x: Int __behavior didSet {
trailingClosure()
}
```
Since behaviors are implementation details, they arguably belong to the right of the declaration as well.
In IRGen, @autoreleased return values are always converted to +1 by
calling objc_retainAutoreleasedReturnValue(), so a partial application
thunk cannot have a result with @autoreleased convention. Just turn
it into @owned instead, since that's what it is, using similar logic
as the @unowned_inner_pointer => @unowned case.
Fixes <rdar://problem/24805609>.
Fixes a crash when property behavior uses are run through the specializer, since they set up associated type conformances that are not recoverable by name lookup.
If a behavior protocol requires an `initialValue` static property, satisfy the requirement using the initial value expression from the property declaration. This lets us implement `lazy` as a property behavior.
Since the feature is incomplete and yet to be accepted or implemented as proposed, hide it behind an -enable-experimental-property-behaviors frontend flag.
The core limit adjustment was added in SVN r17964 (fad87470) by Ted Kremenek.
This is problematic in bash where if a `ulimit -c 0` was invoked prior to the
test running, it would fail due to the failure to set the core limit to
unlimited. Interestingly enough, this will be different across bash and zsh.
This function points the ivar offsets at per-metadata field offsets
before passing off the class to the Objective-C runtime, ensuring
we don't slide the global ivar offsets multiple times.
The swift_initializeSuperclass() function does not do this ivar
cloning, so it cannot be used for generic classes even if they do
not have generically-sized fields.
An alternative would be to refactor the runtime to clone ivar offset
vectors in swift_initializeSuperclass(), but this doesn't seem to be
worth it for now.
This pull request broke the following tests on several build configurations
(eg --preset=buildbot,tools=RA,stdlib=DA)
1_stdlib/Reflection.swift
1_stdlib/ReflectionHashing.swift
1_stdlib/UnsafePointer.swift.gyb
This reverts commit c223a3bf06, reversing
changes made to 5c2bb09b09.
Changes:
- Reverted commit reverting original SR-88 commit
- Removed mirror children helper collections and related code
- Rewrote some tests to keep them working properly
- Wrote two more tests for the three pointer APIs to ensure no crashes if created using a value > Int64.max
This reverts commit 8917eb0e5a.
Autolinking was added to the frontend in 22912bc3b. It was disabled on
Linux in 198402dcf, and further constrained to be disabled on "linux-gnu"
in 83b4384fa. Since then, more flavors of Linux have become supported
by Swift: "linux-gnueabihf" in 4bf81e09d, and "freebsd" in f41b791d4.
Autolinking most likely does not work on any of these platforms, so
mark it as unsupported for now.
Other tests that only mark "linux-gnu" as unsupported do so for similar
reasons. Ensure unsupported tests for "linux-gnu" are also unsupported
on similar platforms.
The following patch introduced a regression where materializeForSet
did not invoke didSet/willSet for stored properties with observers:
<249242b08d>
The old SILGen materializeForSet was only used for witness thunks,
where it used Ordinary access semantics for the storage.
When I switched over to using the new materializeForSet implementation
for static thunks too, I added some logic to use DirectToStorage access
semantics where appropriate, however this was wrong for observable
properties, which need DirectToAccessor semantics.
Fixes <rdar://problem/24315392>.