Commit Graph

35 Commits

Author SHA1 Message Date
John McCall
2ba7090fe8 Remove the extra-inhabitant value witness functions.
This is essentially a long-belated follow-up to Arnold's #12606.
The key observation here is that the enum-tag-single-payload witnesses
are strictly more powerful than the XI witnesses: you can simulate
the XI witnesses by using an extra case count that's <= the XI count.
Of course the result is less efficient than the XI witnesses, but
that's less important than overall code size, and we can work on
fast-paths for that.

The extra inhabitant count is stored in a 32-bit field (always present)
following the ValueWitnessFlags, which now occupy a fixed 32 bits.
This inflates non-XI VWTs on 32-bit targets by a word, but the net effect
on XI VWTs is to shrink them by two words, which is likely to be the
more important change.  Also, being able to access the XI count directly
should be a nice win.
2018-12-11 22:18:44 -05:00
Erik Eckstein
8f35a3eff7 runtime: remove pinning in reference counting and pinning runtime entry points
rdar://problem/35401813
2018-08-25 11:14:18 -07:00
Mike Ash
46309d9794 [Runtime] Rename swift_unknown* functions to swift_unknownObject*.
These functions don't accept local variable heap memory, although the names make it sound like they work on anything. When you try, they mistakenly identify such things as ObjC objects, call through to the equivalent objc_* function, and crash confusingly. This adds Object to the name of each one to make it more clear what they accept.

rdar://problem/37285743
2018-08-15 17:48:23 -04:00
John McCall
9bbbe2c418 Update the metadata-initialization ABI:
- Create the value witness table as a separate global object instead
  of concatenating it to the metadata pattern.

- Always pass the metadata to the runtime and let the runtime handle
  instantiating or modifying the value witness table.

- Pass the right layout algorithm version to the runtime; currently
  this is always "Swift 5".

- Create a runtime function to instantiate single-case enums.

Among other things, this makes the copying of the VWT, and any
modifications of it, explicit and in the runtime, which is more
future-proof.
2017-12-21 00:26:37 -05:00
Arnold Schwaighofer
b93e93900e Add _swift_deallocUninitializedObject to Runtime.md 2017-11-03 09:48:17 -07:00
Arnold Schwaighofer
48e889b51b IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums

We map nil to the .None case of Optional. Instead use a singleton object.

SR-5148
rdar://32618580
2017-06-17 09:33:41 -07:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Erik Eckstein
bd0d2bfed4 Remove the LLVM stack promotion pass and related SIL optimization logic.
It's not needed anymore because array buffers are now allocated with alloc_ref instead of a swift_bufferAllocate runtime call.
2016-09-16 11:02:19 -07:00
Dmitri Gribenko
fbb3cf35a5 Revert "New SIL instructions to support tail-allocated arrays in SIL." 2016-09-15 00:25:25 -07:00
Erik Eckstein
6ae818c9d1 Remove the LLVM stack promotion pass and related SIL optimization logic.
It's not needed anymore because array buffers are now allocated with alloc_ref instead of a swift_bufferAllocate runtime call.
2016-09-14 14:54:18 -07:00
Joe Groff
32b50c624d stdlib: Remove _isBridgedToObjectiveC from _ObjectiveCBridgeable.
All generic bridgeable types can bridge for all their instantiations now. Removing this ferrets out some now-unnecessary traps that check for unbridgeable parameter types.
2016-07-25 06:01:21 -07:00
Erik Eckstein
e1b94885a2 runtime: add a new runtime function swift_setDeallocating.
It's to be used by code produced by the ReleaseDevirtualizer.
As the function is only used for non-escaping objects, the deallocating bit is set non-atomically.
2016-03-15 12:56:54 -07:00
Joe Groff
ae0e855aaf Revert "Runtime: Remove retainCount entry points."
This reverts commit 51e0594e1c. The retainCount
entry points are used by Instruments.
2016-02-18 09:38:23 -08:00
Slava Pestov
19fe31fde9 IRGen: Emit and use accessors for generic type metadata
Instead of directly emitting calls to swift_getGenericMetadata*() and
referencing metadata templates, call a metadata accessor function
corresponding to the UnboundGenericType of the NominalTypeDecl.

The body of this accessor forwards arguments to a runtime metadata
instantiation function, together with the template.

Also, move some code around, so that metadata accesses which are
only done as part of the body of a metadata accessor function are
handled separately in emitTypeMetadataAccessFunction().

Apart from protocol conformances, this means metadata templates are
no longer referenced from outside the module where they were defined.
2016-01-26 16:00:54 -08:00
Joe Groff
7775b9c261 Runtime: Remove swift_retainCount entry points.
These are no longer needed by the corelibs.
2016-01-06 14:12:03 -08:00
Joe Groff
9d58f21371 Runtime.md: TODO note to add getExistentialMetadata[n] entry points. 2015-12-26 15:19:07 -08:00
Joe Groff
2201c99a32 IRGen/Runtime: Open-code respondsToSelector: checks for AnyObject lookup.
Emit the respondsToSelector: msgSend inline instead of relying on a runtime call.
2015-12-24 09:00:43 -08:00
Joe Groff
9af439b87e Runtime: Rename reportMissingMethod to deletedMethodError.
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.
2015-12-23 16:01:21 -08:00
Sean Callanan
09f48ee2b4 Revert "Runtime: Rename reportMissingMethod to deletedMethodError."
This reverts commit bdffe703b0.
Required to revert b1e3120a28.
2015-12-23 15:41:06 -08:00
Joe Groff
d366089df7 Runtime: Change getInstancePositiveExtents methods to return both extents.
A bit of future-proofing, since we plan to be able to grow class instances in both directions relative to their object header.
2015-12-23 15:39:53 -08:00
Joe Groff
583f5bdb6f Runtime: Rename class property lookup functions with consistent naming scheme.
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.
2015-12-23 15:04:27 -08:00
Joe Groff
fe4782ef05 Runtime: Rename swift_isClassOrObjCExistential to -Type.
To conform with the other 'is*Type' queries.
2015-12-23 13:34:47 -08:00
Joe Groff
8edde2c503 Runtime: Push swift_demangleSimpleClass into XCTest overlay.
The only place it's used.
2015-12-23 11:19:42 -08:00
Joe Groff
ff74e8e81c Runtime.md: Rearrange some type-related deckchairs 2015-12-23 09:17:09 -08:00
Joe Groff
359e18f54f Runtime: Internalize 'usesNativeSwiftReferenceCounting_nonnull' check.
It's used as a helper by some other entry points, but isn't used outside the runtime.
2015-12-23 09:17:09 -08:00
Joe Groff
eb12224e09 Runtime.md: Stub out a section for exported standard metadata objects. 2015-12-23 09:17:08 -08:00
Joe Groff
4b461684e3 Remove unused _swift_isClass function. 2015-12-23 09:17:08 -08:00
Joe Groff
bdffe703b0 Runtime: Rename reportMissingMethod to deletedMethodError.
The runtime entry doesn't just report the error, unlike the other report* functions, it also does the crashing.
2015-12-23 09:17:07 -08:00
Joe Groff
d3cba67344 Runtime: Move assert implementation details to stdlib.
Many of the report* entry points are specific to the stdlib assert implementation, so belong in the stdlib. Keep a single `reportError` entry point in the runtime to handle the CrashReporter/ASL interface, and call down to it from the assert implementation functions.
2015-12-22 15:54:42 -08:00
Joe Groff
e1589a0a3a Runtime: Implement convertNSErrorToErrorType and v.v. in Swift.
These are compiler hooks that belong in the Foundation overlay; they don't need to be in the core runtime.
2015-12-22 14:41:23 -08:00
Joe Groff
4b7ed84c42 Revert "Runtime: Remove retainCount entry points."
This reverts 51e0594e1c. The corelibs are using this entry point.
2015-12-22 13:06:42 -08:00
Joe Groff
51e0594e1c Runtime: Remove retainCount entry points.
They're only used for testing and ObjC interop, so don't need to be exported from the runtime.
2015-12-22 11:51:59 -08:00
Joe Groff
920103112c Runtime.md: Finish bucketing entry points. 2015-12-22 09:43:45 -08:00
Joe Groff
dd39a66b91 Runtime.md: Clarify purpose as suggested by @jrose-apple.
And take a first pass at categorization.
2015-12-21 18:06:18 -08:00
Joe Groff
9fd53832fe Start working on a document to describe the runtime interface. 2015-12-21 12:18:57 -08:00