Commit Graph

4421 Commits

Author SHA1 Message Date
Dave Zarzycki
c48fd6160e Docs: Add notes about subtle runtime differences
This is useful as a reference for WWDC and forward.

Swift SVN r16625
2014-04-21 21:35:31 +00:00
Joe Groff
85ab7ed9e1 Remove mangling and demangling for block shims.
Swift SVN r16488
2014-04-18 02:36:54 +00:00
Joe Groff
eaa6088102 SIL: Remove the now-obsolete bridge_to_block instruction.
Swift SVN r16487
2014-04-18 02:26:10 +00:00
Arnold Schwaighofer
989d554a45 Add support for an assert_configuration builtin function
This patch adds support for a builtin function assert_configuration that is
replaced by constant progpagation by an appropriate value dependent on a compile
time setting. This replacement can also be disabled when serializing sil for a
library.

Using this mechanism we implement assertions that can  be disabled (or whose
behavior changes) depending on compile time build settings (Debug, Release,
DisableReplacement).

In the standard library we can now write one assert function that uses this
builtin function to provide different compile time selectable runtime behavior.

Example

Assert.swift:

@transparent
func assert<T : LogicValue>(
  condition: @auto_closure () -> T, message: StaticString = StaticString(),

  // Do not supply these parameters explicitly; they will be filled in
  // by the compiler and aren't even present when asserts are disabled
  file: StaticString = __FILE__, line: UWord = __LINE__
) {
  // Only in debug mode.
  if _isDebug() {
    assert(condition().getLogicValue(), message, file, line)
  }
}

AssertCommon.swift:

@transparent
func _isDebug() -> Bool {
  return Int32(Builtin.assert_configuration()) == 0;
}

rdar://16458612

Swift SVN r16472
2014-04-17 22:05:42 +00:00
Michael Gottesman
7f7e256f73 [SIL.rst] Begin filling out the section in SIL.rst describing the general optimization passes.
Swift SVN r16196
2014-04-11 02:59:38 +00:00
Dave Abrahams
06e720257e [stdlib] Array docs: use normal bullets
The funny bullets used by our stylesheet don't paste well into emails.
Also, clean up an editorial comment

Swift SVN r16185
2014-04-10 23:37:24 +00:00
Dave Abrahams
2da97e2736 [stdlib] Array docs: correctness fix
Optional<T>.map doesn't unwrap inner optionals, so have to rephrase.

Swift SVN r16184
2014-04-10 23:18:26 +00:00
Dave Abrahams
ecda8ab966 [stdlib] Array docs: typo fix
Swift SVN r16182
2014-04-10 23:13:15 +00:00
Dave Abrahams
38d73b2b96 [stdlib] Initial docs for the new Array design
Swift SVN r16181
2014-04-10 23:10:33 +00:00
Dmitri Hrybenko
f90e0c153b Make 'override' a keyword
rdar://16462192

Swift SVN r16115
2014-04-09 14:19:50 +00:00
Dmitri Hrybenko
a8f85d72bc Allow semicolon can be used as a single no-op statement in otherwise empty cases in
switch statements.

rdar://16381532


Swift SVN r16112
2014-04-09 10:40:48 +00:00
Joe Groff
e9d2e122ee SIL.rst: Document copy_block.
Swift SVN r16087
2014-04-09 00:37:24 +00:00
Chris Lattner
afea47b621 rename "destroy_value" to "release_value", part of rdar://15889208.
Swift SVN r15777
2014-04-02 05:33:52 +00:00
Chris Lattner
6540423613 rename CopyValueInst -> RetainValueInst. The .sil syntax
isn't changed yet.


Swift SVN r15775
2014-04-02 05:11:31 +00:00
Chris Lattner
61de944e51 typographical changes.
Swift SVN r15721
2014-04-01 05:00:37 +00:00
John McCall
f1180f5e6d in order to work correctly for non-@objc protocols.
Language features like erasing concrete metatype
values are also left for the future.  Still, baby steps.

The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.

I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.

An existential metatype is the formal type
 \exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
 (\exists t:P . t).Type
which is singleton.  Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.

This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation.  Eventually, we will
need them to be able to carry protocol witness tables

Swift SVN r15716
2014-04-01 00:38:28 +00:00
Joe Groff
2c804dabe2 Update failable initializers proposal.
Use the ``init() -> T?`` return type syntax we introduced for whole-object initializers, and limit the scope of initializer failure to @objc initializers; we don't need to be able to initiate initializer failure from Swift for 1.0.

Swift SVN r15703
2014-03-31 23:06:48 +00:00
Joe Groff
584009d27e SIL: Remove copy_value's result.
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
2014-03-30 03:40:45 +00:00
Joe Groff
ad1297a094 [sooner] Save some thoughts about generators.
Swift SVN r15624
2014-03-29 17:30:04 +00:00
Joe Groff
afd59130f0 SIL: Add a FixLifetime instruction.
This will be a signal to ARC optimization, RVO, and other lifetime-affecting optimizations that they should not shorten the lifetime of a value past a certain point. We need this for C pointer bridging. This adds the instruction, but does not add any knowledge of it to the ARC optimizers.

Swift SVN r15601
2014-03-29 02:50:34 +00:00
Mark Lacey
cae8562ff7 Reformat for 80 columns.
Swift SVN r15515
2014-03-26 19:28:02 +00:00
Mark Lacey
78931ea27b Fix typo: addres -> address
Swift SVN r15514
2014-03-26 19:28:02 +00:00
Dmitri Hrybenko
06175089ca LangRef: add array and dictionary literal syntax
Swift SVN r15507
2014-03-26 12:08:45 +00:00
Doug Gregor
2477afe657 Rework the section on "dropping prepositions" to be more specific
Swift SVN r15464
2014-03-25 20:26:13 +00:00
Doug Gregor
2c94b6a259 Make it clearer that we're planning to drop "with" and "for".
Swift SVN r15463
2014-03-25 16:43:17 +00:00
Doug Gregor
751d5bd0f1 Reword and clarify an awful paragraph.
Swift SVN r15459
2014-03-25 16:28:30 +00:00
Doug Gregor
0e4044041f Take Jordan's suggestion to rename @selector(...) to @objc(...).
Swift SVN r15426
2014-03-24 22:49:55 +00:00
Doug Gregor
c5ffbcacc7 Fix a few typos
Swift SVN r15425
2014-03-24 22:47:51 +00:00
Doug Gregor
059a549e84 Formatting fixes.
Swift SVN r15424
2014-03-24 22:32:49 +00:00
Doug Gregor
ee599c0bdd Objective-C and Smalltalk don't have keyword arguments per se
Swift SVN r15423
2014-03-24 22:32:47 +00:00
Doug Gregor
a586b6d31d Unified function syntax: switch to space-separated API name / parameter name.
Swift SVN r15420
2014-03-24 17:55:22 +00:00
Doug Gregor
c3183aec70 Remove "by" as a dropped preposition (it's still a preposition).
In Cocoa selectors, "by" is often used before an action, i.e.,

  URLByAppendingPathExtension:
  characterRangeByExtendingPosition:inDirection:
  dateByAddingComponents:toDate:options:

Dropping the preposition doesn't make the argument name better.

Swift SVN r15417
2014-03-24 16:38:40 +00:00
Doug Gregor
e4260da123 Remove useless "dropped?" entries from the table.
Swift SVN r15415
2014-03-24 16:06:20 +00:00
Doug Gregor
41ca928cfc Selector splitting: kick "over", "per", and "without" off the island.
These prepositions are used in Cocoa, but result in crummy or useless splits.

Swift SVN r15414
2014-03-24 16:04:35 +00:00
Doug Gregor
e85e10690a Un-fuse two lines
Swift SVN r15409
2014-03-24 15:30:02 +00:00
Doug Gregor
4e0f866a4b Add a section on dropping leading prepositions "by", "for", "with".
Swift SVN r15408
2014-03-24 15:27:16 +00:00
Doug Gregor
b4e859b3c0 Fix typo "migreate"
Swift SVN r15407
2014-03-24 14:36:36 +00:00
Doug Gregor
6895597eba Re-order comment about in-compiler selector->method name mappings.
Swift SVN r15406
2014-03-24 14:35:17 +00:00
Doug Gregor
590aae3f0d Note that we need a mapping in the compiler from selectors to method names.
Swift SVN r15405
2014-03-24 14:31:06 +00:00
Doug Gregor
f78cf35e37 Unified function syntax proposal: reflow to split paragraphs for diff'ability. NFC
Swift SVN r15404
2014-03-24 14:27:43 +00:00
Doug Gregor
c4b0a7daee Unified function syntax: distinguish "argument name" from "parameter name".
Swift SVN r15377
2014-03-23 05:19:11 +00:00
Doug Gregor
bf5bbbfb65 Unified function syntax: address some of DaveA's suggestions.
More to come on this, thanks!


Swift SVN r15376
2014-03-23 05:11:10 +00:00
Doug Gregor
6d082e360e Add ToC
Swift SVN r15374
2014-03-23 01:21:35 +00:00
Doug Gregor
1d4848099b Add a section about @call_arguments(strict).
Swift SVN r15373
2014-03-23 01:15:14 +00:00
Doug Gregor
1ca71f0b14 Proposal: Unified Function Syntax via Selector Splitting
Swift SVN r15371
2014-03-22 20:37:52 +00:00
Greg Parker
3f64d9dcef [docs] Fix an internal link and a grammar error.
Swift SVN r15330
2014-03-21 19:35:01 +00:00
Dmitri Hrybenko
11fea869c1 Change 'switch' not to fall through between empty cases and always require at
least one statement per case

rdar://16301313


Swift SVN r15266
2014-03-20 11:44:59 +00:00
Dmitri Hrybenko
2c717692ac LangRef: convert the section on switch and related sections to ReST, as I plan
to edit these for rdar://16301313


Swift SVN r15232
2014-03-19 09:40:12 +00:00
Doug Gregor
c854d9bb89 Incomplete draft discussion of Swift's object initialization.
Swift SVN r15222
2014-03-19 05:28:30 +00:00
Joe Groff
b8bac9bc12 Save some notes about how container patterns should work for future development.
Waiting for an SDK to install (again)...

Swift SVN r15215
2014-03-19 00:19:58 +00:00