Commit Graph

4421 Commits

Author SHA1 Message Date
Nadav Rotem
290b587f09 Docs: mention that the new annotation is related to the resilient proposal.
Swift SVN r24448
2015-01-15 19:05:09 +00:00
David Farler
d443f0fd2f Revert "Update ABI.rst for new local decl mangling"
This reverts commit 18bc5f6d8f9828fdadced52bb4148897e357a86d.

Swift SVN r24433
2015-01-15 00:33:12 +00:00
David Farler
f1b35a253d Update ABI.rst for new local decl mangling
Swift SVN r24427
2015-01-14 22:15:23 +00:00
John McCall
cae0f6e3db Add the ability for a owning addressor to return
a non-native owner.  This is required by Slice, which
will use an ObjC immutable array object as the owner
as long as all the elements are contiguous.

As part of this, I decided it was best to encode the
native requirement in the accessor names.  This makes
some of these accessors really long; we can revisit this
if we productize this feature.

Note that pinning addressors still require a native
owner, since pinning as a feature is specific to swift
refcounting.

Swift SVN r24420
2015-01-14 19:14:20 +00:00
Nadav Rotem
c6e77cdc75 Document the new semantics tag to disable copying of code from stdlib
Swift SVN r24401
2015-01-13 23:24:49 +00:00
John McCall
dc4431ebff Split addressors into unsafe, owning, and pinning variants.
Change all the existing addressors to the unsafe variant.

Update the addressor mangling to include the variant.

The addressor and mutable-addressor may be any of the
variants, independent of the choice for the other.

SILGen and code synthesis for the new variants is still
untested.

Swift SVN r24387
2015-01-13 03:09:16 +00:00
John McCall
f3dc58667d Improve the typing of materializeForSet callbacks to
use a thin function type.

We still need thin-function-to-RawPointer conversions
for generic code, but that's fixable with some sort of
partial_apply_thin_recoverable instruction.

Swift SVN r24364
2015-01-11 21:13:35 +00:00
John McCall
6a91f7a172 Various improvements to the function-type ABI.
Teach IRGen and the runtime about the extra inhabitants
of function pointers, and take advantage of that in
thin and thick function types.

Also add runtime entrypoints for thin function type
metadata.

Swift SVN r24346
2015-01-10 01:45:37 +00:00
Chris Lattner
3fb3cd6033 remove gunk
Swift SVN r24227
2015-01-06 23:18:23 +00:00
Chris Lattner
76f60998f0 mention how noescape works in SIL
Swift SVN r24226
2015-01-06 23:17:37 +00:00
Michael Gottesman
01d7f6ca20 [demangle] Teach the demangler how to demangle metatype representations and document the mangling of metatype representations in ABI.rst.
<rdar://problem/19138619>

Swift SVN r24209
2015-01-06 04:51:33 +00:00
Dmitri Hrybenko
94541a5ced Revert "Change select* instructions so that all of them have the same tail allocated"
This reverts commit r24159 because it breaks building the stdandard
library.

Swift SVN r24161
2014-12-28 08:04:45 +00:00
Michael Gottesman
a6bd0cce0f Change select* instructions so that all of them have the same tail allocated
memory layout and add a SelectInst API that allows for one to access select inst
operands when one does not care about what the cases actually are.

Previously select_enum, select_enum_addr had the following memory layout:

  [operands], [cases]

In constrast, select_value had the following layout:

  [operand1, case1, operand2, case 2, ...]

The layout for select_value makes it impossible to just visit operands in a
generic way via a higher level API. This is an important operation for many
analyses such as AA on select insts.

This commit does the following:

1. Adds a new abstract parent class for all select instructions called
SelectInst.
2. Adds a new templated implementation parent class that inherits from
SelectInst called SelectInstBase. This handles the complete implementation of
select for all types by templating on CaseTy.
3. Changes SelectEnumAddrInst, SelectEnumInst, SelectValueInst to be thin
classes that inherit from the appropriately specialized SelectInstBase.

I left in SelectEnumInstBase for now as a subclass of SelectInstBase and parent
class of SelectEnum{,Addr}Inst since it provides specific enum APIs that are
used all over the compiler. All of these methods have equivalent methods on
SelectInstBase. I just want to leave them for a later commit so that this commit
stays small.

Swift SVN r24159
2014-12-27 05:33:18 +00:00
Dmitri Hrybenko
6670bb76ec Rewrite the CMake build system
Swift SVN r24124
2014-12-23 22:15:30 +00:00
Erik Eckstein
31dd17a49f Add array.uninitialized semantics to ArrayCallKind, ArraySemanticsCall and the docs.
For completeness. NFC.



Swift SVN r23955
2014-12-16 13:28:18 +00:00
Dave Abrahams
65a7108ccf [proposal] In-place operations update
Changes from previous version:

* Support classes
* Support protocols and generics
* Make the obvious extensions to cover assignment operator pairs

Swift SVN r23954
2014-12-16 06:51:44 +00:00
Dmitri Hrybenko
b15c4db750 Document stdlib's @testable and SPI(X) comments
Swift SVN r23930
2014-12-15 03:36:00 +00:00
Chris Lattner
74bd5e2b42 fix "title underline too short" build failures.
Swift SVN r23911
2014-12-13 06:27:58 +00:00
John McCall
169e4fe319 Add Builtin.UnsafeValueBuffer, which provides opaque
storage for arbitrary values.

A buffer doesn't provide any way to identify the type of
value it stores, and so it cannot be copied, moved, or
destroyed independently; thus it's not available as a
first-class type in Swift, which is why I've labelled
it Unsafe.  But it does allow an efficient means of
opaquely preserving information between two cooperating
functions.  This will be useful for the adjustments I
need to make to materializeForSet to support safe
addressors.

I considered making this a SIL type category instead,
like $@value_buffer T.  This is an attractive idea because
it's generally better-typed.  The disadvantages are that:
- it would need its own address_to_pointer equivalents and
- alloc_stack doesn't know what type will be stored in
  any particular buffer, so there still needs to be
  something opaque.

This representation is a bit gross, but it'll do.

Swift SVN r23903
2014-12-13 01:27:12 +00:00
Joe Groff
2e5faa7c79 Ramble about KVO2-related stuff
Swift SVN r23891
2014-12-12 19:19:30 +00:00
Chris Lattner
b85e5df770 change the SIL mangling of @in_guaranteed to be 'G' at John's request.
Swift SVN r23870
2014-12-11 22:27:27 +00:00
Chris Lattner
af1ea0b8f1 document @in_guaranteed.
Swift SVN r23868
2014-12-11 21:16:27 +00:00
Erik Eckstein
3b9805b246 Disallow cond_br with identical destinations.
It avoids generation of llvm phi nodes with identical predecessors and differing values.
This change replaces my previous fix of this problem in r23580, where I handled it in IRGen.

There were some discussions about it with the conclusion that it's better to just disallow such cond_br instructions in SIL.
It makes the life easier for some SIL optimizations which can't deal with cond_br with identical destinations.

The original radar is <rdar://problem/18568272> Swift compiler fails with "PHI node has multiple entries for the same basic block with different incoming values!"



Swift SVN r23861
2014-12-11 15:03:49 +00:00
Michael Gottesman
1e63e0e22d [mangle] Add support for mangling dead, owned2guaranteed, and sroa args. Wire up function sig opts.
Now all SIL function specialization passes use the new mangling infrastructure.
Lets keep it that way for future passes as well. = ).

Implements:
<rdar://problem/18831609>

Fixes:
<rdar://problem/19065735>
<rdar://problem/18906781>
<rdar://problem/18956916>

Swift SVN r23859
2014-12-11 05:51:26 +00:00
Michael Gottesman
185d9aaafd [mangle] Add support for mangling constant propagated specializations and wire CapturePropagation to use it.
I also fixed a few bugs in the mangling that this exposed.

Swift SVN r23858
2014-12-11 03:22:07 +00:00
Michael Gottesman
5e11e9aa81 Remove extra '_' that snuck in.
Swift SVN r23818
2014-12-09 23:40:04 +00:00
Michael Gottesman
355f791621 [mangle] Add support for function signature specialization mangling and teach closure specialization how to use it.
Swift SVN r23816
2014-12-09 23:21:08 +00:00
Michael Gottesman
2a119d4e0e [mangle] Update ABI.rst to reflect shortened specialization kind.
I forgot to update this when I changed the specialization kind from _generic => _g.

Swift SVN r23802
2014-12-09 03:00:32 +00:00
Michael Gottesman
4d48d2aaae [mangle] Add initial code for SIL specializations manglings and refactor Generic Specialization mangling code to there from the pass itself.
This is apart of creating the infrastructure for creating special manglings for
all of the passes that we specialize. The main motiviations for this
infrastructure is:

1. Create an easy method with examples on how to create these manglings.
2. Support multiple specializations. This is important once we allow for partial
specialization and can already occur if we perform function signature
optimizations on specialized functions.

The overall scheme is as follows:

_TTS<MANGLINGINFO>__<FUNCNAME>

Thus if we specialize twice, the first specialization will just be treated as
the function name for the second specialization.

<MANGLINGINFO> is defined as:

_<SPECIALIZATIONKINDID>_<SPECIALIZATIONUNIQUEINFO>

Where specialization kind is an enum that specifies the specific sort of
specialization we are performing and specialization unique info is enough
information to ensure that the identity of the function is appropriately
preserved.

Swift SVN r23801
2014-12-09 02:53:05 +00:00
Joe Groff
755e629c65 Update description of existential container layout in ABI.rst.
Swift SVN r23795
2014-12-08 23:54:45 +00:00
Doug Gregor
5119580d5c Fix broken reST in SIL document.
Swift SVN r23726
2014-12-05 05:28:15 +00:00
John McCall
dd07c8ca10 Add 'mark_dependence', which indicates that an address
or pointer depends on another for validity in a
non-obvious way.

Also, document some basic value-propagation rules
based roughly on the optimization rules for ARC.

Swift SVN r23695
2014-12-04 22:38:09 +00:00
Arnold Schwaighofer
404ce8c599 ArraySemantics: Add support for the upcoming array.props semantic calls
"array.props.isCocoa/needsElementTypeCheck" semantic calls will mark calls that
return array properties: isCocoa and needsElementTypeCheck. We know that said
states can only transfer in certain directions (a native swift array that does
not need an element type check stays in this state) enabling us to version loops
based on the state of said array array properties.

rdar://17955309

Swift SVN r23688
2014-12-04 19:24:39 +00:00
Mark Lacey
1b2d617157 Fix typo.
Swift SVN r23644
2014-12-03 06:08:04 +00:00
Dave Abrahams
d63e8e02d4 [proposal] Inplace.rst fixup
s/let/var/

Swift SVN r23617
2014-12-02 18:10:02 +00:00
Dave Abrahams
747c279bb3 [proposal] Rewrite Inplace.rst
The basic proposal is newly-relevant; this is a first revision to
prepare it for discussion.

Swift SVN r23614
2014-12-02 17:34:58 +00:00
Erik Eckstein
8c715aa04a docs: diagram of current Array implementation in stdlib.
(Not yet embedded in the Array doc)



Swift SVN r23592
2014-12-01 11:21:33 +00:00
David Farler
3c4428dd78 Emit unique metadata for functions with inout
References to functions that take inout parameters crash the compiler
because InOutType isn't a "real" type in itself and has no special type
metadata to emit. It merely further qualifies the function's input
types.

For example, we would like to have a unique entry in the cache for:

var f: (T, T) -> ()

and

var f2: (inout T, T) -> ()

For each argument type metadata pointer in the function's input, take
advantage of pointer alignment and mark the lowest bit if it is inout.
Since the metadata cache uses pointers to create the key, this creates a
unique entry while still being able to extract the actual pointer.

This fixes <rdar://problem/17655125>, and a couple of other similar
crashes.

Swift SVN r23557
2014-11-22 22:01:23 +00:00
John McCall
3cd28b9e62 Document the rules for formal accesses to ? and ! l-values.
! is obvious, but ? raises a more fundamental difficulty.

Swift SVN r23491
2014-11-20 23:01:13 +00:00
Chris Willmore
0867e2e59b [docs] Fix linked list definition in Generics.rst
Swift SVN r23471
2014-11-20 05:22:19 +00:00
Jordan Rose
0606251fc4 [docs] Use the same theme as our internal docs.
In particular, this uses normal HTML bullets instead of images so that
rich text copy/paste works correctly.

Swift SVN r23376
2014-11-17 19:42:00 +00:00
Dave Abrahams
e455dec9fa Accessors: various ReST fixups
Swift SVN r23349
2014-11-15 02:13:11 +00:00
Andrew Trick
70fe4a3065 Accessors.rst:879: ERROR: Unexpected indentation.
Swift SVN r23347
2014-11-15 01:10:28 +00:00
John McCall
26b7dd190a Edits to the accessor proposal in response to Dave's feedback.
The main change here is a total restructuring of the
unspecified behavior rule.  (Note that the rule has not
changed; I'm simply specifying it differently, hopefully
better.)

I still owe some examples for the unspecified behavior rule.

Swift SVN r23344
2014-11-15 00:50:37 +00:00
Andrew Trick
06bfed16f6 Make Accessors doc an orphan so it doesn't break my build.
Swift SVN r23343
2014-11-15 00:37:36 +00:00
John McCall
ca59995032 The most recent accessors proposal, with a few editorial
changes that Dave pointed out.

Swift SVN r23338
2014-11-14 22:32:46 +00:00
Dmitri Hrybenko
e2b974d3d6 docs: fix ReST warnings
Swift SVN r23051
2014-11-01 00:51:34 +00:00
Roman Levenstein
c8d180e660 Generalize the switch_int instruction into switch_value instruction, which may switch on arguments of builtin integer types or function types. The later is required for implementing a more efficient speculative devirtualizaiton implementation. Implement lowering of switch_value into LLVM code. In case of integer operands, it reuses LLVM's switch optimizations. Support for switching on function types is not yet bullet-proof and will be refined in the subsequent patches.
rdar://18508812

Swift SVN r23042
2014-10-31 22:55:56 +00:00
Roman Levenstein
f016754ef9 Add a new select_value instruction. This instruction should be the equivalent of select_enum, just for builtin int types. Such an instruction is needed e.g. to efficiently implement conversions of Int raw values to C-like enums.
rdar://18812325

Swift SVN r23036
2014-10-31 20:44:11 +00:00
Joe Groff
bf3ddb4c59 SIL.rst: Fix up some omissions in the calling convention section.
Explain how @cc(witness_method) is different from @cc(method), and fix a typo.

Swift SVN r23021
2014-10-30 22:04:24 +00:00