Commit Graph

1397 Commits

Author SHA1 Message Date
Dave Abrahams
0c1e5265c4 [stdlib] Degenericize some BridgeObject primitives
There's really no reason to make the compiler and optimizer work hard,
here.

Also, make some sanity checks more informative

Swift SVN r23503
2014-11-21 01:39:54 +00:00
Dave Abrahams
b9342e5c1b [stdlib] Array: one-element _typeCheck, for ARC
the ARC optimizer does not handle loops well, and so can get blocked by
the presence of a loop over the range. Therefore, add a single-element
check for the common case where we're not slicing.

Swift SVN r23502
2014-11-21 01:39:53 +00:00
Maxwell Swadling
530ae1777a Added ASCII fast paths for common string operations
- ==, <, lowercaseString and uppercaseString on String now have ASCII fast paths
- Fixes rdar://problem/17962640

Swift SVN r23494
2014-11-21 00:07:32 +00:00
Maxwell Swadling
55f3289054 Added additional tests and comments to String
Swift SVN r23490
2014-11-20 22:33:13 +00:00
Dave Abrahams
66da8500c7 [stdlib] Kill a stray backslash
Swift SVN r23467
2014-11-20 03:41:10 +00:00
Dave Abrahams
1ed31fa31a [stdlib] Fix BridgeStorage!
Fix the test so it actually runs, then fix all the bugs it finds, then
extend the test to cover the no-bits-fast-path functionality.

Swift SVN r23466
2014-11-20 03:41:10 +00:00
Dave Abrahams
44a18861b6 [stdlib] BridgeStorage: no-bits fast path
When there's static knowledge that no spare bits are to be set, it's
faster to use that knowledge.  We need a proper builtin to let us drop
the reinterpretCasts.

Swift SVN r23465
2014-11-20 03:41:09 +00:00
Mark Lacey
d344976d3d Remove @inline(__always) on a var decl.
@inline(__always) can only be used on functions and constructors.

Swift SVN r23462
2014-11-20 03:01:43 +00:00
Dave Abrahams
4785e7b2e9 [stdlib] Explicit keywords for BridgeStorage.init
This improves clarity of usage, especially when we add a fast
constructor for the "native with no spare bits set" case.

Swift SVN r23460
2014-11-20 01:05:39 +00:00
Dave Abrahams
e78ad13b7f [stdlib] Force-inline some bitmask constants
Swift SVN r23454
2014-11-19 22:57:44 +00:00
Dave Abrahams
e581216d28 [stdlib] Fix a comment
Swift SVN r23453
2014-11-19 22:57:44 +00:00
Dave Abrahams
2f29db9bfa [stdlib] Finish incomplete comment
Swift SVN r23432
2014-11-19 06:21:49 +00:00
Dave Abrahams
d4e06bd174 [stdlib] Clean up a sanity check
Swift SVN r23431
2014-11-19 06:21:01 +00:00
Dave Abrahams
68fbea2988 BridgeObject: native object with no spare bits set
Naturally, the fast path for things like Array<Int> has to be that no
masking is required to get at the buffer.  Therefore, the state with no
spare bits set needs to be reserved for native objects.  After the
change, an ObjC non-tagged pointer is stored with all spare bits set, and
native objects are stored with 0..<N bits set, where N is the number of
spare bits.  ObjC tagged pointers are still stored verbatim.

Swift SVN r23430
2014-11-19 06:07:19 +00:00
Dave Abrahams
726aba123a [stdlib] BridgeStorage optimizations
Stop trafficking in optionals and using checked arithmetic; the
optimizer doesn't like that.  Also drop a needless cast, fix up some
names, and accept a native 2nd argument.  Only classes imported from
ObjC actually have non-native refcounting, and we don't really care
about enforcing that for the 2nd argument.  It's just expected to be a
possibly-non-native class.

Swift SVN r23396
2014-11-18 02:46:09 +00:00
Dave Abrahams
9d6cccbf11 Revert "[stdlib] Workarounds for <rdar://18992875>"
This reverts commit r23361 now that Joe fixed the problem

Swift SVN r23388
2014-11-17 22:54:39 +00:00
Maxwell Swadling
5f75d2dca8 Removed _stdlib_dynamicCastToExistential1 hack
It is no longer required.

Swift SVN r23379
2014-11-17 20:56:41 +00:00
Dave Abrahams
d7689759f9 [stdlib] BridgeStorage: rename uniqueness check
The name should reflect the fact that the check only ever returns true
in the native case.

Swift SVN r23362
2014-11-17 02:15:27 +00:00
Dave Abrahams
f7ae19f7b9 [stdlib] Workarounds for <rdar://18992875>
Some brutal casting and type punning can get us past this bug, for now.

Swift SVN r23361
2014-11-17 02:15:26 +00:00
Dave Abrahams
d59e781b61 [stdlib] Kill some dead code
That this code is dead implies we are throwing away the knowledge that
we have a native buffer whenever we downcast an array.  That'll be fixed
when the array buffer simplification goes in.

Swift SVN r23350
2014-11-15 03:42:12 +00:00
Dave Abrahams
4111b94d1f [stdlib] _BridgeStorage: use Builtin.BridgeObject
Swift SVN r23348
2014-11-15 01:54:53 +00:00
Graham Batty
04f8efbdf5 Correctly calculate non-objc instance size and rename to reflect.
Renames swift_class_getInstanceSize to
swift_class_getInstancePositiveExtentSize to reflect that it is
the size of the object after the instance address point.

Swift SVN r23333
2014-11-14 22:09:20 +00:00
David Farler
2539ebdabf <rdar://problem/18979003> _Set([1,2,3]) crashes in Xcode playground: assertion in IDEPlaygroundQuickLookForStructure.m:405
Swift SVN r23319
2014-11-14 02:32:35 +00:00
Michael Gottesman
9a691a55b2 [playgrounds] Implement _swift_isClass(x: Any) -> Bool.
This is acting as a temporary work around until the more general
getTypeKind() is finalized from an API perspective.

The reason that removing this now instead of waiting makes sense is:

1. The previous way playgrounds was performing this check was using the runtime
c++ implementation of swift_isClassOrObjCExistential via @asmname. We
want to move away from the @asmname approach in general since it is
brittle since it leads to loose cupling of dependencies.

2. The @asmname version in playgrounds caused the deserializer to assert since
the c++ version of swift_isClassOrObjCExistential() does not match the signature
of the swift declaration of swift_isClassOrObjCExistential().

This allows us to avoid the aforementioned issues and make forward
progress on re-enabling the playground logger with optimization.

rdar://18841292

Swift SVN r23307
2014-11-13 19:35:59 +00:00
Dmitri Hrybenko
5f4a31aef4 Revert "stdlib: put back C_ARGC and C_ARGV for now to stage in the API change"
This reverts commit r23288.  All users have been updated.

Swift SVN r23300
2014-11-13 07:44:15 +00:00
Dmitri Hrybenko
2aef2c3c7d stdlib: put back C_ARGC and C_ARGV for now to stage in the API change
Swift SVN r23288
2014-11-12 22:59:20 +00:00
Dmitri Hrybenko
4cd60e6b4e stdlib/Set: add #if guards for non-ObjC platforms
Swift SVN r23266
2014-11-12 09:05:39 +00:00
David Farler
d0718c69fc Prefix Set<T> with underscore for API development
Swift SVN r23263
2014-11-12 07:07:01 +00:00
David Farler
c453eb4c48 Add Set type.
<rdar://problem/14661754> TLF: [data-structure] Set<T> data type + Bridging from NSSet

Swift SVN r23262
2014-11-12 07:07:00 +00:00
Dave Abrahams
b6c7d89ee7 [stdlib] Don't let gyb interfere with doc comments
The interposed line directive comment "// #line ..." prevents Swift from
associating the doc comment with the declaration.  Tested, this time,
and everything!

Swift SVN r23260
2014-11-12 02:58:40 +00:00
Maxwell Swadling
2bbf6b9293 [stdlib] changed C_ARG{C,V} @availability to provide fix-its
Swift SVN r23255
2014-11-12 00:09:52 +00:00
Joe Groff
08fe138808 Runtime: Generate a human-understandable name for Any.Type.
Expose this in the stdlib as _typeName(Any.Type) -> String, pending API review.

Swift SVN r23254
2014-11-11 23:38:24 +00:00
Arnold Schwaighofer
9ac0595334 Revert "[stdlib] Don't let gyb interfere with doc comments"
This reverts commit r23247.

It broke the incremental builder - I could reproduce this locally with a clean
rebuild.

Swift SVN r23250
2014-11-11 23:03:39 +00:00
Maxwell Swadling
963619cdc1 [stdlib] C_ARG{c,v} renamed to argc/unsafeArgv
Fixes rdar://problem/17229052
Make it clear C_ARGV var is unsafe.
Made it impossible to set the argc/unsafeArgv outside of the stdlib.
Refactored tests to not use C_ARG{C,V}.
Made C_ARG{C,V} unavailable.

Swift SVN r23249
2014-11-11 22:34:49 +00:00
Dave Abrahams
392a675b05 [stdlib] Don't let gyb interfere with doc comments
The interposed line directive comment "// #line ..." prevents Swift from
associating the doc comment with the declaration.

Swift SVN r23247
2014-11-11 22:16:31 +00:00
Arnold Schwaighofer
06a0a23562 Add a destructor memory effect analysis
This adds an analysis to the compiler that identifies types that are may store
to memory on destruction.

It adds a compiler known protocol _DestructorSafeContainer that allows the
standard library to identify containers whose destructor's memory effects
depends strictly on the type parameters of the container.

Array<T> : _DestructorSafeContainer {} may not store to memory during
destruction if the bound T is a type that does not store to memory on
destruction.

This is needed to deduce that for example Array<Array<Int>> is does not store to
memory on destruction (e.g during a call to release).

rdar://18940376

Swift SVN r23242
2014-11-11 19:27:41 +00:00
Maxwell Swadling
03021eccb3 [stdlib] simplified implementation of Process
Fixes rdar://problem/17257011

Swift SVN r23241
2014-11-11 19:20:48 +00:00
Graham Batty
dc6a776d10 stdlib: Use config directives to work without objective-c.
Swift SVN r23211
2014-11-10 20:06:25 +00:00
Graham Batty
98586b32e5 stdlib: Move withUnsafePointer(s) to LifetimeManager.swift.
Swift SVN r23210
2014-11-10 20:05:48 +00:00
Graham Batty
9524ca20b3 stdlib: Move _nilRawPointer to Builtin.swift
Swift SVN r23209
2014-11-10 20:05:26 +00:00
Graham Batty
373414864d Revert "Use config directives to carve out a 'portable' kernel stdlib."
This reverts commit r23202 pending further discussion.

Swift SVN r23205
2014-11-10 18:46:42 +00:00
Graham Batty
dfa260fab1 Use config directives to carve out a 'portable' kernel stdlib.
Swift SVN r23202
2014-11-10 18:03:09 +00:00
Dave Abrahams
2cf30d2661 [stdlib] Nix stale comment
Swift SVN r23198
2014-11-09 07:44:29 +00:00
Dave Abrahams
2942359d81 [stdlib] Kill unused enum
Swift SVN r23196
2014-11-09 06:23:23 +00:00
Dave Abrahams
3475aa6dd6 [stdlib] use sanity-checked downcasts
Avoid type punning except where absolutely necessary

Swift SVN r23195
2014-11-09 06:20:46 +00:00
Dave Abrahams
cb27b7d821 [stdlib] Excise unsafeBitCasts from SliceBuffer
Swift SVN r23192
2014-11-09 04:53:35 +00:00
Dave Abrahams
c20389583c [stdlib] Drop needless unsafeBitCast
Swift SVN r23191
2014-11-09 04:53:34 +00:00
Dave Abrahams
2c48f57c30 [stdlib] Sanity checks for empty array buffer
Swift SVN r23190
2014-11-09 04:53:33 +00:00
Dave Abrahams
057d680726 [stdlib] Kill off some needless downcasting
We're still casting down, but only to the common base of all native
array buffers.  Given that native buffers might turn out to be the empty
array buffer, this eliminates some evil type punning.

Swift SVN r23187
2014-11-09 03:46:27 +00:00
Dave Abrahams
2794fe3a13 [stdlib] Restore a combination of 11 commits
...but remove all new uses of closures, to make things easier on the
optimizer.

Swift SVN r23183
2014-11-08 20:04:29 +00:00