Commit Graph

4421 Commits

Author SHA1 Message Date
Jordan Rose
2913abdfb3 Commit v1 access control proposal, as proposed on 2014-06-13.
This overwrites the very old access control proposal from last year.
It can be recovered from version control if needed.

Swift SVN r18964
2014-06-17 23:23:41 +00:00
Joe Groff
f6ef7808a7 Add note to interop model proposal about interop with String.
Swift SVN r18854
2014-06-13 04:20:34 +00:00
Chris Lattner
2dc1df52d1 Implement <rdar://problem/16954464> Cannot make a strong IBOutlet
This adds support for the "strong" ownership modifier, and specifically 
make it override the "implicit weak" behavior of @IBOutlet.



Swift SVN r18737
2014-06-08 20:49:21 +00:00
Chris Lattner
2fb6a4494e update the SIL dox to reflect that load_weak and store_weak now traffic in optionals
directly instead of them taking non-nullable types that sometimes had a nil bit pattern.


Swift SVN r18314
2014-05-18 04:56:42 +00:00
Dave Abrahams
5e9c2b40f0 [docs] ReST fixup
Swift SVN r18246
2014-05-17 06:39:31 +00:00
Dave Abrahams
3fbfd0ab4b [docs] Revise the Array bridge/cast story
This change makes the story more coherent and consistent, and most
importantly, verifiable.  I've pushed ContiguousArray and Slice out of
the bridge/cast picture in order to simplify the description of Array.
Writing the story for those other array types (someday) in terms of this
one should be straightforward.

Swift SVN r18229
2014-05-17 00:17:16 +00:00
Dave Abrahams
c7308ae2eb [docs] Line wrapping fix in diagram
Swift SVN r18142
2014-05-15 23:39:04 +00:00
Dave Abrahams
cff11a4cad [docs] Rename NativeArray => ContiguousArray
Per API review feedback.  Code changes are to come.

Swift SVN r18138
2014-05-15 23:24:01 +00:00
Dave Abrahams
88ef28ad2a [docs] clarify downcast semantics
I was previously reading this as, "if you don't have an ArrayBuffer<U>,
downcast fails in O(1)."  We actually want it to fall through to
deferred in that case.

Swift SVN r18137
2014-05-15 23:24:00 +00:00
Dave Abrahams
1601b19b81 [docs] Arrays.rst - clarify deferred bridging
Also turn italic terminology references into links.

Swift SVN r18095
2014-05-15 02:13:42 +00:00
Dave Abrahams
897a11fda4 [stdlib] Update Arrays doc
Removed a meaningless bullet and call out an O(N) where it appears

Swift SVN r18074
2014-05-14 16:44:49 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Groff
4caeb49449 Missed a heading.
Swift SVN r17733
2014-05-08 23:27:42 +00:00
Joe Groff
fa74bfc367 Add a proposal for the C pointer language model.
Swift SVN r17732
2014-05-08 23:26:26 +00:00
Dave Abrahams
47eea01ab8 [stdlib] Eager non-verbatim bridging
Trying to lazily compute bridge results and cache them isn't going to
work, because there's no place to efficiently invalidate the cache in
cases like this:

  func f(a: NSArray) {
    for i in 0...a.count {
      println(a.objectAtIndex(i)) // Fills up the cache
    }
  }

  var message = ["hello", "world"]
  f(message)
  message[0] = "goodbye, cruel" // need a cache invalidation or else
  f(message)                    // ...this prints "hello\nworld\n"

Since we need C performance for subscript assignment, we just can't
afford to do anything extra there.

Instead, when the element type isn't "Bridged Verbatim," just eagerly
convert it to an NSArray.

Swift SVN r17722
2014-05-08 23:02:08 +00:00
Dave Abrahams
dea14570b9 [stdlib] Array doc adjustment
We were wishfully thinking that we could convert all NSArrays lazily.
However, since non-class/existential types are supposed to have a
statically-knowable efficient representation we need an eager conversion
in those cases.

Swift SVN r17538
2014-05-06 07:52:58 +00:00
Dave Abrahams
555674633a [stdlib] Array bridging specification tweaks
Chris suggested that we should lazily typecheck each element when an
NSArray is downcast to Array<T>.  That sounded like a good idea, and
along the way we decided to simplify the implementation and spec by not
bending over backwards to allow broken duck-typing to work for pure ObjC
classes.

Swift SVN r17468
2014-05-05 17:52:58 +00:00
Michael Gottesman
1e7d7fb85f Revert "[stdlib] Array bridging specification tweaks"
This reverts commit r17408.

Swift SVN r17417
2014-05-05 04:05:36 +00:00
Dave Abrahams
a86aecd6fe [stdlib] Array bridging specification tweaks
Chris suggested that we should lazily typecheck each element when an
NSArray is downcast to Array<T>.  That sounded like a good idea, and
along the way we decided to simplify the implementation and spec by not
bending over backwards to allow broken duck-typing to work for pure ObjC
classes.

Swift SVN r17408
2014-05-04 23:16:06 +00:00
Dave Abrahams
dd6b0f7144 [stdlib] More Array doc updates
There's little point in allowing Array<T> to have both direct and
indirect representations when T can be a class type.  Let's drop the
branch cost and generate less code.

Swift SVN r17353
2014-05-04 01:32:54 +00:00
Dave Abrahams
18d12fa234 [stdlib] One more note about Array casting
Swift SVN r17324
2014-05-03 19:51:52 +00:00
Dave Abrahams
5e045b4453 [stdlib] Limit array casts to Array<T>
There's no need to support up- or down-casts for NativeArray<T> or
Slice<T>.  Slice might turn out to be easy, but we don't have time right
now.  Doing it for NativeArray<T> would have efficiency costs that we
don't want to pay.

Swift SVN r17323
2014-05-03 19:49:53 +00:00
Dave Abrahams
9cf3eefb8c [stdlib] Array bridging doc update
This thing is freakin' complicated!  We're going to have to find a
reasonable subset to implement for WWDC.

Swift SVN r17308
2014-05-03 03:53:55 +00:00
Dave Abrahams
2c0a803afe [docs] Updated information on Array casts
Swift SVN r17303
2014-05-03 02:07:14 +00:00
Dave Abrahams
a3bc9b6cb0 [stdlib] Array doc update
Swift SVN r17302
2014-05-03 02:07:14 +00:00
Dave Abrahams
98274bd5d3 [docs] Update Arrays.rst
This is a partial update.  We need to decide how to rework array
up-/down-casting to account for value semantics changes.  Will post to
the list.

Swift SVN r17254
2014-05-02 16:30:14 +00:00
Ted Kremenek
4e70269c53 More renaming 'unchecked optional' to 'implicitly unwrapped optional'.
Swift SVN r17236
2014-05-02 06:22:01 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Dave Abrahams
8e2e7e9bfc [stdlib] Hide all BuiltinXXXConvertible's
During String API review we decided these weren't for user consumption.

Swift SVN r17167
2014-05-01 19:35:50 +00:00
Doug Gregor
ca62675c64 Rip out the parsing code for default values in patterns.
This code was already unused.


Swift SVN r17091
2014-04-30 13:59:44 +00:00
Dmitri Hrybenko
853b63e15c Update LangRef with commit message of r17056
Swift SVN r17081
2014-04-30 09:04:41 +00:00
Chris Lattner
a7012f23ef Remove swift::ArrayType. It is dead and vestigial code for supporting fixed size
arrays, which never got baked.  Remove it until we have time to do things right.


Swift SVN r16995
2014-04-28 21:18:27 +00:00
Ted Kremenek
6caf910d32 Implement new syntactic sugar for UncheckedOptional<T>.
This leaves in the existing syntax for @unchecked T?.  That will
be addressed in later patches.

There's still a mysterious case where some of the SIL output
includes UncheckedOptional<T> and some places T!.

Moreover, this doesn't handle SourceKit's behavior for printing
for overrides.  This just handles parsing the 'T!' syntax.

Swift SVN r16945
2014-04-27 21:59:29 +00:00
Chris Lattner
f6bc393b52 this -> self.
Swift SVN r16932
2014-04-27 16:46:07 +00:00
Chris Lattner
88471c3455 update this for attribute and inout syntax change.
Swift SVN r16929
2014-04-27 16:24:26 +00:00
Ted Kremenek
5ad769ec0b Rename the BridgedToObjectiveC protocol to _BridgedToObjectiveC or _BridgedToObjC.
For now we're going to keep BridgedToObjectiveC as a private internal
implementation detail.  Adding the "_" prefix marks it as internal.

Implements <rdar://problem/16736672>.

Swift SVN r16921
2014-04-27 06:07:25 +00:00
Dmitri Hrybenko
304c34ee17 Update LangRef for 'nonmutating'
Swift SVN r16895
2014-04-26 21:24:23 +00:00
Manman Ren
480b41c824 [SIL Vtable emission] use the least derived method in sil_vtable.
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
2014-04-25 23:42:12 +00:00
Dave Abrahams
64c7c5cf34 [docs] Array bridging diagram
Swift SVN r16779
2014-04-24 23:25:10 +00:00
Joe Groff
f29a156e83 IRGen/Runtime: Add value witness slots for array witnesses.
Add value witnesses for destroyArray, initializeArrayWithCopy, and initializeArrayWithTake{FrontToBack,BackToFront}, and fill out the runtime value witness table implementations. Stub out the IRGen ones for now.

Swift SVN r16772
2014-04-24 22:25:26 +00:00
Joe Groff
4ea0a2839b SIL.rst: Document unchecked_addr_cast.
Swift SVN r16744
2014-04-24 04:59:56 +00:00
Joe Groff
68f942117a SIL: Squash 'ref_to_native_object' and 'native_object_to_ref' into one 'unchecked_ref_cast' insn.
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
2014-04-24 03:10:53 +00:00
Joe Groff
fe47ddb540 SIL.rst: Note that unchecked_take_enum_data_addr will not actually destroy the enum when applied to the first payloaded case.
At least not in 1.0.

Swift SVN r16735
2014-04-24 02:36:39 +00:00
Joe Groff
5db5acc8fc SIL.rst: Fix up and extend discussion of layout compatible types.
Got the sense of 'layout compatible' reversed for enum payloads, and mixed up "commutative" and "transitive". Add rules to cover RawPointer <-> Word, heap object references, and single-field structs.

Swift SVN r16734
2014-04-24 02:36:37 +00:00
Joe Groff
7bc9bf95cf SIL.rst: Add a note about layout compatibility.
Start trying to formalize when reinterpretCast can actually mean something for the optimizer.

Swift SVN r16731
2014-04-24 01:07:34 +00:00
Joe Groff
285ec1e2dd SIL: Add an unchecked_enum_data instruction.
This allows the payload for a loadable enum to be unsafely projected without branching, enabling more enum optimizations when switch branches can be culled or when indirect enum code can be promoted.

Swift SVN r16729
2014-04-24 00:41:08 +00:00
Joe Groff
55f6b925de SIL: Rename 'take_enum_data_addr' to 'unchecked_take_enum_data_addr'.
In preparation for adding an 'unchecked_enum_data' equivalent for loadable enums.

Swift SVN r16728
2014-04-24 00:40:47 +00:00
John McCall
b38a63950d Implement @unowned(unsafe).
This was part of the original weak design that
there was never any particular reason to rush the
implementation for.  It's convenient to do this now
so that we can use it to implement Unmanaged<T> for
importing CF types.

Swift SVN r16693
2014-04-23 08:51:23 +00:00
Joe Groff
c56458d173 Quiet doc warnings.
Swift SVN r16631
2014-04-21 23:11:36 +00:00
Joe Groff
c73acc67f2 SIL: Add an "UnownedInnerPointer" result convention.
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
2014-04-21 21:57:13 +00:00