Commit Graph

691 Commits

Author SHA1 Message Date
Joe Groff
801efc55e7 SIL.rst: ReST typo.
Swift SVN r8577
2013-09-24 00:17:56 +00:00
Joe Groff
014f270516 SIL: Have project_existential_ref project to a protocol Self archetype.
This mirrors the behavior of project_existential and simplifies some special cases in SILGen. It unfortunately makes dynamic_lookup sequences a bit noisier because of the need to explicitly cast the projection from DynamicLookup.Self to Builtin.ObjCPointer, but I think this modeling is more solid and will fit better with my planned redesign of archetype_method/protocol_method.

Swift SVN r8572
2013-09-23 21:57:12 +00:00
Joe Groff
14f1b9da42 SIL.rst: Update for 'This' -> 'Self' sea change.
Swift SVN r8571
2013-09-23 21:57:05 +00:00
Joe Groff
9e54a69016 SIL: Allow RefToObjectPointer and ObjectPointerToRef to cast to/from Builtin.ObjCPointer.
Swift SVN r8558
2013-09-23 16:20:29 +00:00
Joe Groff
8d0d6ff1be LangRef: Demonstrate comma-separated case syntax.
The grammar already until-now-incorrectly claimed that 'case A, B' worked, but insert an example now that it actually works.

Swift SVN r8515
2013-09-20 20:44:11 +00:00
Joe Groff
26125d050b Update 'union' references in other docs.
Swift SVN r8483
2013-09-20 04:41:49 +00:00
Joe Groff
5106cd5e7c Capture the current enum game plan in a proposal doc.
Swift SVN r8481
2013-09-20 04:20:33 +00:00
Joe Groff
e109124186 Replace 'union' keyword with 'enum'.
This only touches the compiler and tests. Doc updates to follow.

Swift SVN r8478
2013-09-20 01:33:14 +00:00
John McCall
7954960797 Add 'copy_value' and 'destroy_value' operations to destroy
entire aggregates at once.

This has three worth effects:
  - It significantly decreases the amount of SIL required
    for these operations.
  - It makes it far easier for IR-gen to choose efficient
    patterns of destruction, e.g. calling a single entrypoint
    or recognizing that it can just use the runtime 'release'
    entrypoints.
  - It makes it easier to recognize and optimize aggregate
    copy/destroy operations.
It does make SROA-like tasks a bit more challenging.  The
intent is to give TypeLowering a way to expand these into
their primitive behavior.

Swift SVN r8465
2013-09-19 22:14:55 +00:00
Dave Abrahams
36db63b0d8 [stdlib] StringDesign.rst: remove "Extended with Restraint" section per Chris Kane's advice
Swift SVN r8449
2013-09-19 17:15:45 +00:00
Dave Abrahams
15673a1601 [stdlib] StringDesign.rst: add "Goals" and "Non-Goals" to introduction
Swift SVN r8429
2013-09-18 23:46:39 +00:00
Chris Lattner
1928361a5a Change the list of usecases for structs.
Swift SVN r8402
2013-09-18 16:12:14 +00:00
Howard Hinnant
810d2db1c6 Fix some minor type-o's and grammar mistakes.
Swift SVN r8401
2013-09-18 16:07:24 +00:00
Dave Zarzycki
fa8792d8a8 LangRef: Discuss why structs do not support inheritance
Swift SVN r8399
2013-09-18 15:18:48 +00:00
Doug Gregor
a14ddd41ba Minimally update LangRef for "constructor" -> "init" changes.
Swift SVN r8396
2013-09-18 05:49:34 +00:00
Dave Abrahams
e1a48abb0e [stdlib] StringDesign.rst: finalize first installment
Swift SVN r8365
2013-09-17 23:29:36 +00:00
Doug Gregor
90b8b3e499 Constructor selectors always start with 'init'.
Implement the new rules for mapping between selector names and
constructors. The selector for a given constructor is formed by
looking at the names of the constructor parameters:
  * For the first parameter, prepend "init" to the parameter name and
  uppercase the first letter of the parameter name. Append ':' if
  there are > 1 parameters or the parameter has non-empty-tuple type.
  * For the remaining parameters, the name of each parameter followed
  by ':'.

When a parameter doesn't exist, assume that the parameter name is the
empty string.

And, because I failed to commit it separately, support selector-style
declarations of constructor parameters so that we can actually write
constructors nicely, e.g.:

  // selector is initWithFoo:bar:
  constructor withFoo(foo : Foo) bar(bar : Bar) { ... }



Swift SVN r8361
2013-09-17 22:49:05 +00:00
Howard Hinnant
0a16b96587 Swift containers and value types
Swift SVN r8353
2013-09-17 21:20:35 +00:00
Doug Gregor
64ae92c4b4 Destruction of partially-constructed objects is required for any replacement of 'self'.
Thanks, Greg.


Swift SVN r8291
2013-09-16 20:29:45 +00:00
Doug Gregor
25bec36f9e Allow dynamic lookup through DynamicLookup.metatype.
Given an object of type DynamicLookup.metatype, allow us to find both
static and instance methods. 

Sema only; SILGen and IRGen changes to come.


Swift SVN r8290
2013-09-16 20:26:02 +00:00
Doug Gregor
918cf5fb7a Constructors and initialization proposal, first draft.
Swift SVN r8286
2013-09-16 18:57:19 +00:00
Doug Gregor
ca31b28e0f LangRef: add some basic documentation for generics.
Swift SVN r8240
2013-09-14 03:22:56 +00:00
Joe Groff
04b9685d84 SIL.rst: Remove currently irrelevant and potentially confusing caveat.
Swift SVN r8219
2013-09-13 22:25:18 +00:00
Joe Groff
7b37f2d445 SIL.rst: Clarify class subtyping rules wrt generic instances.
Swift SVN r8216
2013-09-13 22:12:07 +00:00
Joe Groff
6e56a4206c SIL.rst: Describe aliasing rules for heap object references.
Clarify that, unlike SIL addresses, class values and other heap object references can alias and be captured. Class value aliasing is controlled by the type system.

Swift SVN r8210
2013-09-13 21:01:58 +00:00
Doug Gregor
97e772bb43 Generics manifesto: Rename "requires" to "where" and update syntax.
Swift SVN r8182
2013-09-13 02:19:35 +00:00
Joe Groff
c65f4c3f43 Rework archetype mangling to follow parent hierarchy.
Use the ordinal archetype manglings only for the primary archetypes of a generic context, and define a mangling for associated types relative to their parent archetype. This will make the archetype mangling resilient in the face of our planned improvements to associated type and protocol conformance ABI. It also correctly mangles self and associated types of protocols, which my previous attempt utterly failed to accomplish.

Swift SVN r8174
2013-09-13 01:16:27 +00:00
Chris Lattner
7c8ae9352a Add a new "mark_function_escape" instruction that will be used to mark the
escape point of function definitions that "close" over global variables.



Swift SVN r8152
2013-09-12 18:31:00 +00:00
Joe Groff
6dbc1a8835 Add manglings for associated types.
This should allow declarations inside protocols to mangle successfully, which is needed by SourceKit to be able to use mangled names as unique decl identifiers. I'm also planning to use mangled protocol decls to name generic curry thunk symbols.

This only introduces a mangling for independent associated types. I think we will eventually want to mangle dependent associated types (such as T.AssocType for an archetype T : SomeProtocol) with a non-indexed mangling too, but this doesn't do that yet.

Swift SVN r8148
2013-09-12 15:29:08 +00:00
Chris Lattner
3c0c9a5da7 introduce a new mark_uninitialized SIL instruction which will be used by
definitive initialization of top-level code.


Swift SVN r8144
2013-09-12 04:30:48 +00:00
Joe Groff
f58d65a903 SIL.rst: Update description of 'thunk' linkage for its broader role.
Swift SVN r8124
2013-09-11 23:51:16 +00:00
Joe Groff
705102b544 SIL: Rename 'ClangThunk' specifier to 'Thunk'.
Lazily-generated currying thunks will require the same IR-level linkonce_odr linkage as clang thunks currently do, so generalize the name of the existing SIL-level linkage specifier 'clang_thunk'.

Swift SVN r8122
2013-09-11 23:47:15 +00:00
Joe Groff
4a4c70ab36 IRGen: Implement partial_apply lowering for objc dynamic method values.
To do this right, we need to emit the objc_msgSend on the 'self' argument inside the forwarding stub, so handle them in a different code path in IRGenSIL::visitPartialApplyInst.

Swift SVN r8112
2013-09-11 21:07:28 +00:00
Joe Groff
7eb02647f5 Update SIL.rst discussion of objc calling convention.
Swift SVN r8111
2013-09-11 21:07:22 +00:00
Dave Abrahams
642ef3682b [stdlib] StringDesign.rst: Finalize the Overview section
Swift SVN r8087
2013-09-10 23:57:39 +00:00
Doug Gregor
ad9a958e2d Document SIL dynamic_method_br instruction
Swift SVN r8086
2013-09-10 22:58:53 +00:00
Dave Abrahams
cea6cb0828 [stdlib] StringDesign.rst: Remove needless level of document structure, simplify the description of indexing
Swift SVN r8078
2013-09-10 20:01:14 +00:00
Dave Abrahams
b400879485 [stdlib] StringDesign.rst WIP
Swift SVN r8069
2013-09-10 17:03:49 +00:00
Anna Zaks
89fff39153 [SIL.rst] Update the guaranteed passes section.
Swift SVN r8058
2013-09-09 22:37:10 +00:00
Joe Groff
387946298e Describe calling convention for [byref] arguments in SIL.rst.
Swift SVN r8052
2013-09-09 20:17:37 +00:00
Doug Gregor
c5557a624c SIL: Introduce the 'dynamic_method' instruction for dynamic method dispatch.
The dynamic_method instruction handles method lookup on an existential
of type DynamicLookup based on the selector of an [objc] method of a
class or protocol. It is only introduced in the narrow case where we
are forcing a use of the method with '!', e.g.,

class X {
  func [objc] f() { println("Dynamic lookup") }
}

var x : DynamicLookup = X()
x.f!()



Swift SVN r8037
2013-09-09 16:12:50 +00:00
Dave Abrahams
d718c8a7f9 [stdlib] StringDesign.rst: WIP with a new "introduction by example" approach
Swift SVN r8027
2013-09-07 02:57:07 +00:00
Dave Abrahams
be2152494e [docs] Silence warnings by removing non-existent documents from the toctree
Swift SVN r8026
2013-09-07 02:57:05 +00:00
Dave Abrahams
8da6fdfba8 [stdlib] StringDesign.rst: note that we have to cover YAGNI
Swift SVN r8025
2013-09-07 02:57:02 +00:00
Joe Groff
d10491ae18 SIL.rst: Add a note that 'apply' currently consumes thick callees.
Swift SVN r7995
2013-09-06 20:33:32 +00:00
John McCall
7a909b64c2 Update the description of 'assign'.
I also removed a restriction about the form of the operand that
doesn't seem to be enforced by SIL-gen at all.

Swift SVN r7951
2013-09-05 18:08:11 +00:00
Michael Gottesman
743e99fb96 Fixed typo in SIL documentation.
Swift SVN r7944
2013-09-05 07:03:44 +00:00
Dave Abrahams
3d62ae4acf [stdlib] StringDesign.rst: More Work In Progress (WIP)
Beginning to move all ObjC/Cocoa references out of the first part of
the document, so the high-level string design stands on its own.  It's
becoming clear that rationales need to be moved out of the sidebar and
back into the main body of the text, so checkpointing before
restructuring.

Swift SVN r7899
2013-09-04 16:19:03 +00:00
Doug Gregor
1dea838517 Remove the "x as T" syntax from the language.
Swift SVN r7874
2013-09-03 22:47:33 +00:00
Dave Abrahams
9dd70537f8 [stdlib] StringDesign.rst: Work In Progress (WIP)
Swift SVN r7862
2013-09-03 21:00:21 +00:00