Commit Graph

4421 Commits

Author SHA1 Message Date
Joe Groff
6a67ad7e12 SIL: Add ElementAddrInst.
Derives the address of a member from the address of a fragile value type. SIL extract : SIL element_addr :: LLVM extractvalue : LLVM getelementptr. Also add SILVerifier checks for ExtractInst and ElementAddrInst that they deal only in values and addresses, respectively.

Swift SVN r3391
2012-12-07 00:37:29 +00:00
Joe Groff
beaed00bea SIL.rst: Note insns that are unimplemented.
Also clarify the language for `string_literal`.

Swift SVN r3379
2012-12-06 17:24:23 +00:00
Joe Groff
9d4806a8f0 SIL.rst: More precisely list address-only types.
Instead of speaking vaguely about "concrete representation", list the categories of type that are loadable and that are address-only.

Swift SVN r3378
2012-12-06 17:12:33 +00:00
Chris Lattner
0702436789 describe some goals in error handling.
Swift SVN r3351
2012-12-04 19:47:05 +00:00
Chris Lattner
c4a573f78b add SIL.rst and Error Handling to the TOC, several other dox are dangling references still though.
Swift SVN r3350
2012-12-04 19:46:52 +00:00
Joe Groff
b949713c89 SIL.rst: "existential" -> "protocol"
Swift SVN r3349
2012-12-04 19:06:31 +00:00
Joe Groff
70482aa51d SIL.rst: Describe instructions for existentials.
We'll need some additional instructions to describe initialization of existentials and existential method calls: `alloc_existential` to initialize an existential's witness and substitution table(s) and provide access to its storage, and `existential_method_ref`/`project_existential` to obtain a method handle from an existential and the opaque reference to hand down to the method.

Swift SVN r3348
2012-12-04 18:45:46 +00:00
Chris Lattner
aaf68c3723 start hacking out a stance on error handling. Kill the old doc that was
poorly and confusingly written and conflates gc vs arc into the 
discussion on error handling.


Swift SVN r3345
2012-12-04 01:01:25 +00:00
Jordan Rose
273642d0ce Document the [objc], [IBOutlet], and [IBAction] attributes.
IBOutlet and IBAction are used by Xcode to support XIB editing, but moreover
there is not an /inherent/ requirement that they imply [objc]. For [IBAction],
it seems unlikely that this will ever change, but [IBOutlet] already tries
several different ways to make its connection, and moreover with outlets for
which we can see the declaration, *the type of the object is known,*, and IB
could in theory know to use the Swift entry points.

IBOutlet and IBAction are currently recognized; my plan is to make them both
alias [objc] internally for now.

Swift SVN r3317
2012-11-30 20:04:28 +00:00
Joe Groff
0453f5dbb2 SIL.rst: "dealloc_ref" shouldn't clean up values.
After discussion with John, we decided that we need to be able to deallocate a partially-initialized box during initializer execution, in case an initializer expression ends up unwinding before a value is fully initialized. When optimizing reference type allocations, it would also better to expose the destructor call and release operations directly instead of hiding them inside an instruction.

Swift SVN r3291
2012-11-29 19:29:43 +00:00
Joe Groff
e9849d725b SIL.rst: remove "destroy" instruction
Value types should not require destruction beyond `release`-ing their reference type members. `release` for reference types and `destroy_addr` for address-only types should cover all cleanup needs.

Swift SVN r3264
2012-11-27 22:20:45 +00:00
Chris Lattner
f59185141c Change integer_literal and friends to take a comma for consistency with other operations. Make a few more tweaks to the printer to match SIL.rst.
Swift SVN r3259
2012-11-27 18:48:30 +00:00
Joe Groff
ce3dc11614 SIL.rst: proofread
Swift SVN r3241
2012-11-26 17:48:35 +00:00
Chris Lattner
0e02c3cd12 80 columns
Swift SVN r3225
2012-11-17 01:16:49 +00:00
Joe Groff
ade9e3395a SIL.rst: Update per discussion with Chris and John
- Tighten up terminology, for instance, define what a "box" actually is
- Describe how operands can have zero, one, or many values
- Describe that only %operands are valid operands and loading constants, ints, and other literals requires distinct insns
- Make releasing a reftype and destroying a value distinct
- Describe how stack allocation of boxes and reftypes work
- Name address-only type operations `destroy_addr` and `copy_addr` to avoid confusion with rvalue operations
- Describe the full set of aggregate manipulation functions
- Clean up instruction notation to avoid ambiguities
- Throw in notes about things we need to design at some point

Swift SVN r3211
2012-11-16 22:38:37 +00:00
Joe Groff
19c1fddfcc SIL.rst: list convert insn's supported conversions
Swift SVN r3191
2012-11-15 01:41:27 +00:00
Joe Groff
312bd65dfe SIL.rst: resilient type example
Swift SVN r3190
2012-11-15 01:26:39 +00:00
Joe Groff
52e163fa00 SIL.rst: a couple examples
Swift SVN r3188
2012-11-15 00:04:25 +00:00
Joe Groff
85c6508122 SIL.rst: clean up notation
Swift SVN r3185
2012-11-14 19:19:57 +00:00
Joe Groff
a8f18017e1 SIL.rst: 80 columns
Swift SVN r3184
2012-11-14 19:19:55 +00:00
John McCall
7d69b0e3c5 Metatypes of (metatypes of)* class types have a
non-trivial representation.

This is because subtyping extends infinitely meta-wards
in the metatype hierarchy:  the one thing you can do
with a metatype of a metatype is pull the instance
metatype out, but that instance type is still a subtype
of the instance type of the metatype of the base metatype,
so... just trust me on this.

Swift SVN r3178
2012-11-14 08:45:06 +00:00
Joe Groff
048b50f3b9 SIL.rst: Describe the rest of the instructions
Also give some initial description of how functions and basic blocks work.

Swift SVN r3174
2012-11-14 05:12:28 +00:00
Dave Zarzycki
b23db009d2 Comparable implies Equality
((x >= y) && (x <= y)) == (x == y)
((x >  y) || (x <  y)) == (x != y)

Swift SVN r3173
2012-11-14 01:37:00 +00:00
Joe Groff
8639a5d14b SIL.rst: Describe more instructions
Swift SVN r3166
2012-11-13 18:21:47 +00:00
Joe Groff
0c4ab942d4 Sketch out a SIL.rst
Describe type categorizations and memory management operations first because those were the hot topics of discussion today.

Swift SVN r3164
2012-11-13 01:35:35 +00:00
Joe Groff
6449655e21 Implement selector-style function definition syntax.
rdar://12315571
Allow a function to be defined with this syntax:

  func doThing(a:Thing) withItem(b:Item) -> Result { ... }

This allows the keyword names in the function type (in this case
`(_:Thing, withItem:Item) -> Result`) to differ from the names bound in the
function body (in this case `(a:Thing, b:Item) -> Result`, which allows
for Cocoa-style `verbingNoun` keyword idioms to be used without requiring
those keywords to also be used as awkward variable names. In addition
to modifying the parser, this patch extends the FuncExpr type by replacing
the former `getParamPatterns` accessor with separate `getArgParamPatterns`
and `getBodyParamPatterns`, which retrieve the argument name patterns and
body parameter binding patterns respectively.



Swift SVN r3098
2012-11-01 21:53:15 +00:00
Jordan Rose
5695162bed Record the decisions made at Monday's meeting about ObjC Interoperability.
Most notably, every Swift object will be id-compatible and have an isa.
Swift classes that do not inherit from an Objective-C class will be marked
unavailable in an Objective-C source file, but their instances can be
referred to by protocol ('id <NSApplicationDelegate>') or by plain 'id'.

I've updated some of the "Use Cases" with some "guidelines" that would
eventually make their way into, say, DevPubs articles (a long way down
the line).

Swift SVN r3092
2012-10-30 18:55:18 +00:00
Jordan Rose
57a4f497f6 Docs: add a "Tradeoffs" section to Objective-C Interoperability.
The new section is supposed to discuss the different models for various
pieces of infrastructure (messaging, methods, classes, subclassing, and
overriding) -- basically, how much of Swift is exposed to Objective-C.
I think the big issue right now is actually what I've labeled the
Messaging Model: whether arbitrary Swift-objects are id-compatible. That
basically has repercussions everywhere else.

This doc is kind of a mess right now, I know.

Swift SVN r3072
2012-10-27 00:53:57 +00:00
Jordan Rose
5961515668 Update "use cases" in Objective-C Interoperability
Swift SVN r3071
2012-10-27 00:53:56 +00:00
John McCall
2f8f05615e Rename TypeOfExpr / TypeOfInst to MetatypeExpr / MetatypeInst.
Introduce a '.metatype' form in the syntax and do some basic
type-checking that I probably haven't done right.  Change
IR-generation for that and GetMetatypeExpr to use code that
actually honors the dynamic type of an expression.

Swift SVN r3053
2012-10-24 07:54:23 +00:00
John McCall
a6a2ab92b3 Add a production to the type grammar for writing metatypes.
Swift SVN r3052
2012-10-24 07:54:17 +00:00
Jordan Rose
6e4b614d9a Add very basic use cases to ObjC interop doc.
Swift SVN r3039
2012-10-23 01:42:51 +00:00
Jordan Rose
7c4030beb5 Finish my sentences.
Swift SVN r3030
2012-10-19 22:47:33 +00:00
Jordan Rose
e6b0a86777 Add a doc tracking what we need for Objective-C interoperability.
Swift SVN r3029
2012-10-19 22:46:23 +00:00
Eli Friedman
fd2ae987b0 Add the ObjC selector proposal to the classes docs.
Swift SVN r2958
2012-10-09 03:00:20 +00:00
Eli Friedman
428745e741 Add a bit more to the section on classes in LangRef, with some FIXMEs for
more missing stuff, per Chris's request.



Swift SVN r2957
2012-10-09 02:36:46 +00:00
Doug Gregor
60fca40055 Write a conversion constraint as <c and a construction constraint as
<C, rather than << and <<C.


Swift SVN r2946
2012-10-08 18:20:57 +00:00
Doug Gregor
22453418b6 Finish the first full draft of the design document for the
constraint-based type checker.


Swift SVN r2944
2012-10-06 00:09:57 +00:00
Doug Gregor
472fc4ae6f Add a short paragraph on default literal types
Swift SVN r2942
2012-10-05 01:27:47 +00:00
Doug Gregor
e748c5f09f Start documenting the constraint-based type checker. There is still
quite a bit to right, but there's almost enough here to understand
constraint generation and the simpler parts of constraint solving.


Swift SVN r2941
2012-10-05 01:23:24 +00:00
John McCall
3467e63516 Emit pointers to final overriders of member functions into
the metadata objects for classes.  This is currently only
done for methods defined in the main class body, and it's
(naturally) totally fragile, and it's screwed up in a
couple known ways w.r.t. generic classes:  there's no
thunking when the overrider differs by abstraction from
the overridden method, and methods on classes currently
expect to get all the type arguments passed directly
and thus will disagree in signature from members of
non-generic classes.  Also, of course, we're not using
any of this in the call infrastructure.  But it's progress.

Swift SVN r2901
2012-09-27 06:17:46 +00:00
Eli Friedman
ee6ab43018 Minor formatting fixes.
Swift SVN r2889
2012-09-21 02:16:08 +00:00
John McCall
ab8677cf7f Change the mangling of metadata objects to be more consistent.
Swift SVN r2850
2012-09-13 21:26:02 +00:00
John McCall
647f4d559f Skeletal ABI documentation. Just mangling for now. Might be
inaccurate in places.

Swift SVN r2845
2012-09-13 21:25:55 +00:00
John McCall
fe75cc3660 Update the Pattern Matching whitepaper with some new thoughts.
This isn't quite the design I mentioned on Tuesday;  I keep waffling,
but right now I think ?x is a better match-pattern binder than
var x.  Compare:
  case .cons(?head, ?tail):
  case .cons(var head, var tail):

Swift SVN r2830
2012-09-06 08:23:19 +00:00
Eli Friedman
031eace8a5 Rewrite the overriding resolution algorithm to reflect the actual rules we
want for overriding.



Swift SVN r2708
2012-08-22 00:33:33 +00:00
Eli Friedman
9efa0a1d31 Revised version of classes doc.
Swift SVN r2578
2012-08-07 22:21:53 +00:00
Chris Lattner
691874ba58 a couple typos
Swift SVN r2573
2012-08-07 05:30:20 +00:00
Eli Friedman
e58a7f547d First draft of docs on classes.
Swift SVN r2571
2012-08-07 01:44:45 +00:00
Chris Lattner
9ee5f9022b add a place to dump outcomes of random design discussions.
Swift SVN r2542
2012-08-03 20:41:00 +00:00