Commit Graph

4650 Commits

Author SHA1 Message Date
Max Moiseev
885b564bf5 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 17:16:37 -08:00
Xi Ge
94e999f312 ModuleGroup: Add several missing files to their groups. 2016-03-09 17:09:34 -08:00
Max Moiseev
bcc08b6c3c fixing availability attribute hint for joinWithSeparator 2016-03-09 17:38:31 -07:00
Max Moiseev
aacc0f8293 merging RangeReplaceableCollectionType into RangeReplaceableCollection 2016-03-09 16:17:00 -08:00
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Arnold Schwaighofer
8df5ed5c53 Merge pull request #1599 from aschwaighofer/tune_withUnsafeMutableBufferPointer_for_inlining
Force inlining of Array.withUnsafeMutableBufferPointer
2016-03-09 13:36:48 -08:00
Dmitri Gribenko
2b342cdc19 Merge pull request #1568 from rintaro/simplify-transcode
[stdlib] Simplify transcode implementation
2016-03-09 13:05:05 -08:00
Arnold Schwaighofer
3738178a43 Force inlining of Array.withUnsafeMutableBufferPointer
We do this to enable removal of the closure (allocation).

The size of the libSwiftCore.dylib grows by 300 bytes. A program (such as
benchmark/single-source/unit-tests/StackPromo.swift) that uses one invocation of
withUnsafeMutableBufferPointer shrinks by roughly 500 bytes.
2016-03-09 13:01:05 -08:00
Ted Kremenek
838d5864ba Merge pull request #1498 from ianpartridge/print-using-fwrite
[stdlib] Use fwrite(3) in _Stdout.write()
2016-03-08 21:52:42 -08:00
Arnold Schwaighofer
3676671b7f Merge pull request #1587 from aschwaighofer/stack_promote_with_unsafe_mutable_buffer_pointer
Mark Array.withUnsafeMutableBuffer as not escaping the array storage.
2016-03-08 19:39:28 -08:00
Arnold Schwaighofer
b5f018a4b1 Mark Array.withUnsafeMutableBuffer as not escaping the array storage.
This is safe because the closure is not allowed to capture the array according
to the documentation of 'withUnsafeMutableBuffer' and the current implementation
makes sure that any such capture would observe an empty array by swapping self
with an empty array.

Users will get "almost guaranteed" stack promotion for small arrays by writing
something like:

  func testStackAllocation(p: Proto) {
    var a = [p, p, p]
    a.withUnsafeMutableBufferPointer {
      let array = $0
      work(array)
    }
  }

It is "almost guaranteed" because we need to statically be able to tell the size
required for the array (no unspecialized generics) and the total buffer size
must not exceed 1K.
2016-03-08 19:37:47 -08:00
Michael Gottesman
1b7ecf5fc7 Fix the leaks checker bot.
Sadly it looks like someone took down my leaks checking bot a couple of months
ago. =--(. This updates the code to compile with Swift today.
2016-03-08 18:31:11 -08:00
Jordan Rose
2a5a8903e4 Revert "[stdlib] Add @noescape to output parameter of UnicodeCodecType.encode" 2016-03-08 17:29:56 -08:00
Doug Gregor
3fb06d7442 [Swift runtime] Deallocation of partial class instances for Objective-C-derived classes.
Teach swift_deallocPartialClassInstance how to deal with classes that
have pure Objective-C classes in their hierarchy. In such cases, we
need to make sure a few things happen:

1) We deallocate via objc_release rather than
swift_deallocClassInstance.
2) We only attempt to find an execute ivar destroyers for
Swift-defined classes in the hierarchy
3) When we hit the most-derived pure Objective-C class, make sure that we
only execute the dealloc of that class and not any of the subclasses
(which would end up trying to destroy ivars again).

Fixes rdar://problem/25023544.
2016-03-08 16:47:57 -08:00
Max Moiseev
4da439d406 copy(withZone:) => copy(with:) in ShadowProtocols 2016-03-08 15:50:59 -08:00
Max Moiseev
1fae0d1325 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-08 12:48:48 -08:00
Rintaro Ishizaki
4f1a4ecd62 [stdlib] Add @noescape to output parameter of UnicodeCodecType.encode
Conformance:
 - UTF8.encode
 - UTF16.encode
 - UTF32.encode

Related functions:
 - transcode
 - String._encode
 - _StringCore.encode
2016-03-08 17:34:15 +09:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Rintaro Ishizaki
1b54593362 [stdlib] Simplify transcode implementation 2016-03-08 02:04:32 +09:00
Dmitri Gribenko
449869ccae stdlib: Remove dead code in String and UnicodeScalar 2016-03-06 02:46:21 -08:00
Ted Kremenek
90ce8daf0b Merge pull request #1552 from hughbe/stdlib-newlines
[gardening] Remove double new lines from stdlib files
2016-03-05 14:40:04 -08:00
Hugh Bellamy
c1b25bb32f [gardening] Remove double new lines from stdlib files 2016-03-05 15:44:54 +00:00
Rintaro Ishizaki
8408e12540 [stdlib] Fix an unused function warning on Linux 2016-03-05 10:23:14 +09:00
Dmitri Gribenko
43a5d4cf55 stdlib: rename Array.appendContents(of:) to Array.append(contentsOf:) 2016-03-04 14:39:14 -08:00
Arnold Schwaighofer
0b181a1861 Don't throw away the top bits of our hashed value for strings on 64bit platforms
SR-877
rdar://24918173
2016-03-04 14:29:02 -08:00
Max Moiseev
cf4bafe9e3 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-03 13:22:03 -08:00
David Farler
e958f99acf Revert "Mangle declared interface type into NominalTypeDescriptor's Name"
This reverts commit 2262bd579a.

This information isn't necessary for field descriptor lookup,
after all. It's only the fields that need to have generic information,
which is already in the field descriptor.
2016-03-03 12:55:35 -08:00
David Farler
2262bd579a Mangle declared interface type into NominalTypeDescriptor's Name
Previously, the mangling didn't include generics, but these are
needed to key off of the new field descriptor metadata, as well
as to construct type references for the nominal type.
2016-03-03 12:14:38 -08:00
David Farler
cd65a8e0b0 Template metadata structures
- Add RuntimeTarget template This will allow for converting between
  metadata structures for native host and remote target architectures.

- Create InProcess and External templates for stored pointers

Add a few more types to abstract pointer access in the runtime
structures but keep native in-process pointer access the same as that
with a plain old pointer type.

There is now a notion of a "stored pointer", which is just the raw value
of the pointer, and the actual pointer type, which is used for loads.
Decoupling these allows us to fork the behavior when looking at metadata
in an external process, but keep things the same for the in-process
case.

There are two basic "runtime targets" that you can use to work with
metadata:

InProcess: Defines the pointer to be trivially a T* and stored as a
uintptr_t. A Metadata * is exactly as it was before, but defined via
AbstractMetadata<InProcess>.

External: A template that requires a target to specify its pointer size.

ExternalPointer: An opaque pointer in another address space that can't
(and shouldn't) be indirected with operator* or operator->.  The memory
reader will fetch the data explicitly.
2016-03-02 21:25:04 -08:00
practicalswift
e33f1747a9 [Python] Improve Python consistency: "variable in function should be lowercase" (N806)
The repo contains roughly 80 Python scripts. "snake_case" naming is used for
local variables in all those scripts. This is the form recommended by the PEP 8
naming recommendations (Python Software Foundation) and typically associated
with idiomatic Python code.

However, in nine of the 80 scripts there were at least one instance of
"camelCase" naming prior to this commit.

This commit improves consistency in the Python code base by making sure that
these nine remaining files follow the variable naming convention used for
Python code in the project.

References:
* PEP 8: https://www.python.org/dev/peps/pep-0008/
* pep8-naming: https://pypi.python.org/pypi/pep8-naming
2016-03-02 18:56:47 +01:00
Ian Partridge
1fcf15b150 [stdlib] Ignore errors from fwrite() 2016-03-02 17:29:18 +00:00
practicalswift
da6f2f3a9e [gardening] Fix formatting of recently introduced file headers 2016-03-02 09:50:27 +01:00
swiftix
2573782c8b Merge pull request #1357 from swiftix/wip-runtime-calling-convention
Prepare the ground for using a new calling convention for functions from the runtime library
2016-03-01 16:22:37 -08:00
Dmitri Gribenko
27c4074bb1 stdlib: docs: fix a reference to a type that does not exist 2016-03-01 14:59:23 -08:00
Ian Partridge
1ee493218b [stdlib] Add _fixLifetime() to avoid ARC leak 2016-03-01 22:23:39 +00:00
Max Moiseev
859db53d87 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-01 12:56:26 -08:00
Ian Partridge
fbf11ce054 [stdlib] Fix indentation 2016-03-01 20:49:53 +00:00
Ian Partridge
9412c21345 [stdlib] Use fwrite(3) in ASCII fastpath only 2016-03-01 20:18:32 +00:00
Max Moiseev
a61d9d04f5 [stdlib] availability attributes for UnsafePointer.destroy 2016-03-01 10:38:01 -08:00
Ian Partridge
259d57bbe7 [stdlib] Use fwrite(3) in print() 2016-03-01 15:55:52 +00:00
Max Moiseev
234bc2830d [stdlib] fixing compilation on Linux 2016-02-29 16:29:20 -07:00
Dmitri Gribenko
56785e81a6 Merge pull request #1477 from PatrickPijnappel/patch-3
[stdlib] Rewrite UTF8._isValidUTF8()
2016-02-29 13:12:24 -08:00
Max Moiseev
e48f452a2e Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-api-guidelines 2016-02-29 12:15:33 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Patrick Pijnappel
7c7be3dc00 [stdlib] Add @testable for _isValidUTF8() 2016-02-29 08:09:46 +11:00
Patrick Pijnappel
3543664088 [stdlib] Replace usage of UTF8._numTrailingBytes()
The checks are technically different (previous check only rejected malformed initial code units, not all malformed sequences). Which is more correct is debatable, but since _buffer is only filled by transcoding from UTF-16 it should always be well-formed anyway and the difference is not very relevant.
2016-02-28 21:19:27 +11:00
Patrick Pijnappel
f783558111 [stdlib] Refactor UTF8._isValidUTF() to be useable throughout stdlib
This is as a replacement for usages of UTF8._numTrailingBytes().
Note that the sanityCheck was redundant at both call sites.
2016-02-28 18:48:41 +11:00
Xi Ge
f195adba80 Module group: suggested by @gribozavr, move ExistentialCollection.swift to collection/type-erased group. 2016-02-27 21:14:38 -08:00
Patrick Pijnappel
04f760d836 [stdlib] Fix comments 2016-02-28 16:12:11 +11:00
Patrick Pijnappel
95ea76717c [stdlib] Rewrite UTF8._isValidUTF8() 2016-02-28 15:38:52 +11:00