Commit Graph

4421 Commits

Author SHA1 Message Date
Dave Abrahams
27f1b0917d [styleguide] Commit last draft seen outside DevPubs
We don't know when we're going to get edits from DevPubs; this
represents the last draft that Dave Addey and I discussed.

Swift SVN r14101
2014-02-19 21:41:19 +00:00
Doug Gregor
3182cd3910 Introduce thick/Objective-C metatype conversion instructions.
Introduce the SIL instructions thick_to_objc_metatype and
objc_to_thick_metatype to convert between the 'thick' and
'Objective-C' representations of a metatype. Most of this code is
trivial support code for these conversions: printing, parsing,
(de-)serialization, etc., for which testing will come online in
subsequent patches or is incidental in other tests.

Lower Objective-C metatype values down to objc_class* at the IR level
and implement IRGen support for these SIL instructions. SIL-only test
case at the moment because SILGen never creates these instructions.



Swift SVN r14087
2014-02-19 18:20:21 +00:00
Mark Lacey
ada5a4a47c Update SIL.rst for mark_uninitialized.
Bring the documentation up-to-date with respect to the code.

Swift SVN r14045
2014-02-18 17:49:06 +00:00
Jordan Rose
0b2541b58f Rename the standard library to "Swift" (instead of "swift")
This is more in line with all other modules currently on our system.
If/when we get our final name for the language, we're at least now set
up to rename the library without /too/ much trouble. (This is mostly just
a lot of searching for "import swift", "swift.", "'swift'", and '"swift"'.
The compiler itself is pretty much just using STDLIB_NAME consistently now,
per r13758.)

<rdar://problem/15972383>

Swift SVN r14001
2014-02-17 19:30:47 +00:00
Chris Lattner
66f0ad61f8 fix a few let's I missed.
Swift SVN r13997
2014-02-17 17:02:41 +00:00
Chris Lattner
5da297689a update this for @inout -> mutating, @inout -> inout, and let -> val.
Swift SVN r13993
2014-02-17 16:51:25 +00:00
Chris Lattner
28903887e7 Rename the internal compiler lexicon from let -> val.
Swift SVN r13992
2014-02-17 16:48:21 +00:00
Dmitri Hrybenko
0b97b32f92 Start converting LangRef to ReST
Swift SVN r13972
2014-02-17 00:29:19 +00:00
Dmitri Hrybenko
571c9b3c5e Split 'type' keyword into 'static' and 'class'
rdar://15911697


Swift SVN r13908
2014-02-14 14:50:32 +00:00
Joe Groff
2bb67f24ac Preserve some notes about inout COW optimization for later elaboration.
Swift SVN r13899
2014-02-14 05:15:23 +00:00
Dave Abrahams
5063c33cbb Rename "Stream" protocol back to "Generator"
The name Stream didn't seem to be working out as intended; we kept
gravitating back to calling it Generator, which is precedented in other
languages.  Also, Stream seems to beg for qualification as Input or
Output.  I think we'd like to reserve Stream for things that are more
bulk-character-API-ish.

Swift SVN r13893
2014-02-14 01:48:52 +00:00
Doug Gregor
23c7c2b056 Document open_existential[_ref]
Swift SVN r13882
2014-02-14 00:22:21 +00:00
Joe Groff
1bbbcaaf98 Consider @auto_closure when mangling types.
We allow overloads on foo(() -> T) and foo(@auto_closure () -> T) in Sema, so they need distinct manglings. Fixes <rdar://problem/16045566>.

Swift SVN r13856
2014-02-13 03:02:22 +00:00
Joe Groff
30a3a9a0a0 SILGen: Hand down context generic params for reabstraction thunks independent from their type.
Pass the context generic params for a reabstraction thunk down to getOrCreateReabstractionThunk from the enclosing function, where it can either use them to define a new thunk or ignore them if it has an equivalent thunk already. Tweak the mangling of reabstraction thunks to use the generic signature with decontextualized "from" and "to" types instead of the generic param list.

Swift SVN r13763
2014-02-10 23:37:11 +00:00
Dave Abrahams
e6c09b3f6c ArrayBridge.rst: minor tweaks and ReST cleanups
Swift SVN r13745
2014-02-10 14:23:30 +00:00
Dave Abrahams
9a2a3599c9 InoutCOWOptimization.rst: restore a dropped bullet
Swift SVN r13744
2014-02-10 13:56:00 +00:00
Chris Lattner
dbfa9cf97b rename builtin for clarity.
Swift SVN r13738
2014-02-10 05:49:20 +00:00
Chris Lattner
55e8182880 expand on the Optimization section, at DaveA's request.
Swift SVN r13737
2014-02-10 05:47:04 +00:00
Chris Lattner
c11047c19a various tweaks, no substantitive change.
Swift SVN r13732
2014-02-10 04:26:17 +00:00
Chris Lattner
7e16637994 fit in 80 columns and convert awesome quotes to ascii quotes.
Swift SVN r13731
2014-02-10 04:17:05 +00:00
Dave Abrahams
e32adda71f [proposals] Array Bridging: first draft
This draft needs to be reviewed by Chris and Joe, who both did much of
the design work but haven't seen the text.  In particular, the
"Optimization" section is a bit hand-wavey and might benefit from being
beefed up by a core compiler engineer.

Swift SVN r13730
2014-02-10 03:50:51 +00:00
Dave Abrahams
965af3cddf [proposals] How now inout COW?
Re-title/rewrite my part of the Efficient Slice Mutation proposal, since
Joe and I have realized that it's a more general problem.  Also remove
our previous bogus solution and replace with a solution that works.

Swift SVN r13717
2014-02-09 21:19:31 +00:00
Dave Zarzycki
89cfcbfbae Misc LangRef updates
1) Document that a series of '.' are operators.
2) '@' was dropped as an operator in r5019.
3) Move some commentary into the main documentation.
4) Better cross-referencing.
5) Tuple dot expressions use integer literals, not $identifiers.

Swift SVN r13694
2014-02-09 04:39:47 +00:00
Dave Abrahams
6f03d836eb [stdlib] Half-open ranges are now spelled x...y
Fully-closed ranges are coming soon.  See the release notes for details.
Implements the "hard" part of <rdar://problem/14586400>

Swift SVN r13674
2014-02-08 05:37:57 +00:00
Dave Zarzycki
1e3fd1a5b1 Parser: allow '...' to be an operator for ranges
<rdar://problem/16018151> Allow me to declare an operator spelled "..."

Swift SVN r13670
2014-02-08 02:10:37 +00:00
Dave Abrahams
828bc90581 [docs] Miscellaneous ReST fixups
I don't know why my machine at home is suddenly being stricter than the
one at work, but it found these legitimate formatting mistakes.

Swift SVN r13635
2014-02-07 08:33:40 +00:00
Dave Abrahams
6886655e83 [proposals] EfficientSliceMutation.rst: ReST fixup
Swift SVN r13633
2014-02-07 07:48:50 +00:00
Chris Lattner
827acad533 Various inout improvements:
- purge @inout from comments in the compiler except for places talking about
   the SIL argument convention.
 - change diagnostics to not refer to @inout
 - Change the astprinter to print InoutType without the @, so it doesn't show
   up in diagnostics or in closure argument types in code completion.
 - Implement type parsing support for the new inout syntax (before we just 
   handled patterns).
 - Switch the last couple of uses in the stdlib (in types) to inout.
 - Various testcase updates (more to come).



Swift SVN r13564
2014-02-06 06:22:27 +00:00
Joe Groff
ab82fa1207 Mangle SILFunctionTypes from their interface types.
Make up manglings for generic signatures and their dependent GenericTypeParamTypes and DependentMemberTypes, as well as the generic signature of a GenericFunctionType or SILFunctionType. Use these to build the mangling for a SILFunctionType from its interface types.

Swift SVN r13537
2014-02-06 01:36:49 +00:00
Joe Groff
445973ec09 Proposal for bridging NSArray to the Collection protocol.
Swift SVN r13371
2014-02-03 21:40:16 +00:00
Chris Lattner
7532213f4a simplify the SIL string_literal instruction to only produce a single value,
which is the address of the string data.  Have SILGen compute and produce the
isASCII bit as an integer literal, and remove the logic from IRGen.

This overall approach is simpler and enables better SIL-level optimizations.


Swift SVN r13363
2014-02-03 19:10:37 +00:00
Doug Gregor
9f72215bba Basic SIL- and IR-generation support for trivial uses of DynamicSelf.
Introduce a new AST node to capture the covariant function type
conversion for DynamicSelf. This conversion differs from the normal
function-conversion expressions because it isn't inherently type-safe;
type safety is assured through DynamicSelf.  

On the SIL side, map DynamicSelf down to the type of the declaring
class to keep the SIL type system consistent. Map the new
CovariantFunctionConversionExpr down to a convert_function
instruction, slightly loosening the constraints on convert_function to
allow for this (it's always been ABI-compatible-only conversions
anyway).

We currently generate awful SIL when calling a DynamicSelf method,
because SILGenApply doesn't know how to deal with the implicit return
type adjustment associated with the covariant function
conversion. That optimization will follow; at least what we have here
is (barely) functional.


Swift SVN r13286
2014-02-01 04:09:00 +00:00
Joe Groff
c9a049f454 Specializer: Give specializations unique symbols and shared linkage.
Make up a mangling involving the substitutions and conformances used to perform a specialization, and use it to build a globally unique symbol name for that specialization that will be common across TUs. <rdar://problem/15658321>

Swift SVN r13284
2014-02-01 03:58:15 +00:00
Michael Gottesman
74165eef2b Revert "Basic SIL- and IR-generation support for trivial uses of DynamicSelf."
This reverts commit r13269. It broke the build.

Swift SVN r13281
2014-02-01 02:31:39 +00:00
Doug Gregor
c25b14b1bd Basic SIL- and IR-generation support for trivial uses of DynamicSelf.
Introduce a new AST node to capture the covariant function type
conversion for DynamicSelf. This conversion differs from the normal
function-conversion expressions because it isn't inherently type-safe;
type safety is assured through DynamicSelf.

On the SIL side, map DynamicSelf down to the type of the declaring
class to keep the SIL type system consistent. Map the new
CovariantFunctionConversionExpr down to a convert_function
instruction, slightly loosening the constraints on convert_function to
allow for this (it's always been ABI-compatible-only conversions
anyway).

We currently generate awful SIL when calling a DynamicSelf method,
because SILGenApply doesn't know how to deal with the implicit return
type adjustment associated with the covariant function
conversion. That optimization will follow; at least what we have here
is (barely) functional.

Swift SVN r13269
2014-02-01 01:20:26 +00:00
Michael Gottesman
2604154b40 Make the implications of @owned and @gauranteed explicit in the SIL guide by stating that @owned means passing at +1 and @gauranteed means that any retains/release pairs on the argument can be eliminated without worry.
Swift SVN r13073
2014-01-28 23:23:56 +00:00
Michael Gottesman
8058ee7ff5 Make it clear in the SIL guide that a function's argument with respect to reference counts is not defined by the calling convention, but rather by the argument's 'convention attribute'.
Swift SVN r13069
2014-01-28 23:17:57 +00:00
John McCall
af032e9300 Demangle the new protocol witness thunk mangling.
Remove the documentation and demangling for the old one.

rdar://15842093

Swift SVN r13066
2014-01-28 22:19:01 +00:00
Chris Lattner
d407bc8fc4 Teach the parser to add the didSet/willSet functions to the enclosing
type, so we emit them.  Add mangler (and demangler) support for these.
Enhance our testcase to check to make sure that stores within these
specifiers are direct, they don't cause recursive infinite loops.

John, I picked w/W for the mangling letters, let me know if this is ok.


Swift SVN r13050
2014-01-28 05:15:56 +00:00
Chris Lattner
ca439b1a48 it doesn't make any sense for stores within didSet/willSet to trigger the
accessor functions.  Just say that they are disabled instead (already 
implemented).


Swift SVN r13048
2014-01-28 05:02:10 +00:00
Joe Groff
e7d5afafe2 Commit updated 'Failable Initializers' proposal.
Compared to the proposal sent out to swift-dev, this is updated in concordance with the design decisions we made in the 2014-01-21 meeting:

- "fail" is used as the keyword for construction failure.
- Details of how "self" is discarded on failure have been added. Not-fully-initialized objects are destroyed piecemeal, whereas full initialized objects are *released* rather than directly destroyed in case they have already been captured.

Swift SVN r12989
2014-01-27 07:18:45 +00:00
Doug Gregor
cd8e2ec09d Update and improve the discussion of the type checker.
Swift SVN r12982
2014-01-27 06:09:37 +00:00
Joe Groff
7056b67b98 Fix rst warning.
Swift SVN r12645
2014-01-21 17:20:46 +00:00
Michael Gottesman
7ee945f8b0 Update SIL docs so that the objc_method calling convention is called @cc(objc_method) instead of just @cc(objc).
Swift SVN r12644
2014-01-21 17:12:13 +00:00
Doug Gregor
3a6db8292e Revert "Introduce the self_downcast SIL instruction to downcast the result of super.init."
We need to model the difference between Objective-C- and Swift-rooted
class hierarchies in SIL. IRGen is too late to handle nil returns.

This reverts commit 549db981ea0136a67aee3029aefe18a05d3c8833.

Swift SVN r12400
2014-01-16 06:01:21 +00:00
Michael Gottesman
4e23d230a3 Fix RST formatting for debug_value, debug_value_addr.
Swift SVN r12390
2014-01-16 05:10:05 +00:00
Doug Gregor
d19065048b Introduce the self_downcast SIL instruction to downcast the result of super.init.
No functional difference from the unconditional checked downcast we
had before, but this gives IRGen the chance to specialize the
implementation.

Swift SVN r12382
2014-01-16 04:24:56 +00:00
Dave Abrahams
c8f552921f Updated Access Control Proposal
Swift SVN r12267
2014-01-14 01:32:08 +00:00
Doug Gregor
68e416bb21 SIL: Zap the unused "coerce" instruction.
The coercion doesn't represent anything interesting for SIL.


Swift SVN r12261
2014-01-13 23:50:12 +00:00
John McCall
817e80bde5 Implicit conversions for UncheckedOptional.
rdar://15189000
rdar://15189009

Swift SVN r12260
2014-01-13 23:15:03 +00:00