This more cleanly groups together the initialization steps needed to warm up the conformance cache, so redundant work doesn't need to be done by other interested parties (such as the type-by-name lookup @lhoward's working on).
Many lazy collections don't offer O(1) performance for `startIndex`,
`first`, or any method that depends on `startIndex`.
`LazyFilterCollection` already had a note to this effect (which I
tweaked a bit), but `FlattenCollection` didn't.
Related to SR-425.
For lazy collections, `isEmpty` and `startIndex` may be O(N) operations.
The old implementation ended up being potentially O(2N) instead of O(1).
In particular, accessing `col.lazy.filter(pred).first` would evaluate
the predicate on elements twice, once to determine the result of
`isEmpty` and once to determine `startIndex`.
We can define the operations for N+1-tuples in terms of the ones for N-tuples, which reduces an x86-64 stdlib by about 4KB:
-rwxr-xr-x 1 jgroff staff 5172856 Dec 30 10:54 lib/swift/macosx/libswiftCore.before.dylib
-rwxr-xr-x 1 jgroff staff 5168752 Dec 30 11:59 lib/swift/macosx/libswiftCore.after.dylib
The optimizer should still be able to inline all the calls together in release builds.
of associated types in protocol witness tables.
We use the global access functions when the result isn't
dependent, and a simple accessor when the result can be cheaply
recovered from the conforming metadata. Otherwise, we add a
cache slot to a private section of the witness table, forcing
an instantiation per conformance. Like generic type metadata,
concrete instantiations of generic conformances are memoized.
There's a fair amount of code in this patch that can't be
dynamically tested at the moment because of the widespread
reliance on recursive expansion of archetypes / dependent
types. That's something we're now theoretically in a position
to change, and as we do so, we'll test more of this code.
This speculatively re-applies 7576a91009,
i.e. reverts commit 11ab3d537f.
We have not been able to duplicate the build failure in
independent testing; it might have been spurious or unrelated.
When I originally added this I did not understand how dtrace worked well enough.
Turns out we do not need any of this runtime instrumentation and we can just
dynamically instrument the calls.
This commit rips out the all of the static calls and replaces the old
runtime_statistics dtrace file with a new one that does the dynamic
instrumentation for you. To do this one does the following:
sudo dtrace -s ./swift/utils/runtime_statistics.d -c "$CMD"
The statistics are currently focused around dynamic retain/release counts.
1. I think replace the NSMutableSet with Set<UIView>(and Set<NSView>)
could make the operations more Swift-like.
These code works fine in my Playground, and I also pass the test. But
I’m not quite sure it’s ok to use Set here rather than NSSet.
2. I also simplify the read-only computed property in “UIKit.swift”
of associated types in protocol witness tables.
We use the global access functions when the result isn't
dependent, and a simple accessor when the result can be cheaply
recovered from the conforming metadata. Otherwise, we add a
cache slot to a private section of the witness table, forcing
an instantiation per conformance. Like generic type metadata,
concrete instantiations of generic conformances are memoized.
There's a fair amount of code in this patch that can't be
dynamically tested at the moment because of the widespread
reliance on recursive expansion of archetypes / dependent
types. That's something we're now theoretically in a position
to change, and as we do so, we'll test more of this code.
This reverts commit 6528ec2887, i.e.
it reapplies b1e3120a28, with a fix
to unbreak release builds.
Running the Python style guide checker
[`pep8`](https://pypi.python.org/pypi/pep8) on the Python code headers
in this repository results in the following error being emitted:
$ pep8 utils/build-script
utils/build-script:1:1: E265 block comment should start with '# '
utils/build-script:3:1: E266 too many leading '#' for block comment
utils/build-script:5:1: E266 too many leading '#' for block comment
utils/build-script:6:1: E266 too many leading '#' for block comment
utils/build-script:8:1: E266 too many leading '#' for block comment
utils/build-script:9:1: E266 too many leading '#' for block comment
utils/build-script:11:1: E265 block comment should start with '# '
utils/build-script:11:80: E501 line too long (80 > 79 characters)
The problem is that the code header used in most Python files in the
repository:
1. Do not place a space in between `#` and the rest of the comment.
2. Contains some lines that just barely exceed the recommend length
limit.
In addition, not all code headers in the repository follow the same
template.
This commit moves all Python code headers to the following template:
# subfolder/file_name.py - Very brief description -*- python -*--
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# -----------------------------------------------------------------------------
#
# This file contains stuff that I am describing here in the header and will
# be sure to keep up to date.
#
# ----------------------------------------------------------------------------
We're not currently doing it, but we will soon be able to use
swift_initializeSuperclass() for class layouts which are not
dependent on generic parameters. In this case, we still need
to set the Objective-C class name.
On the other hand, if we're doing resilient layout for a
non-generic class, we don't need to set the Objective-C class
name.
NFC since this isn't hooked up completely yet.
Implement == and != for tuples up to arity 6 where each component type
is Equatable.
Implement <, <=, >, and >= for tuples up to arity 6 where each component
type is Comparable.
The runtime entry doesn't just report the error, unlike the other report* functions, it also does the crashing.
Reapplying independent of unrelated reverted patches.
This reverts commit b1e3120a28.
Reverting because this patch uses WitnessTableBuilder::PI in NDEBUG code.
That field only exists when NDEBUG is not defined, but now NextCacheIndex, a
field that exists regardless, is being updated based on information from PI.
This problem means that Release builds do not work.
Getting a superclass, instance extents, and whether a class is native-refcounted are all useful type API. De-underscore these functions and give them a consistent `swift[_objc]_class*` naming scheme.