Commit Graph

68 Commits

Author SHA1 Message Date
Roman Levenstein
68b6181642 Annotate runtime functions using the newly introduced annotations from runtime/Config.h.
This makes sure that runtime functions use proper calling conventions, get the required visibility, etc.

We annotate the most popular runtime functions in terms of how often they are invoked from Swift code.
- Almost all variants of retain/release functions are annotated to use the new calling convention.
- Some popular non-reference counting functions like swift_getGenericMetadata or swift_dynamicCast are annotated as well.

The set of runtime functions annotated to use the new calling convention should exactly match the definitions in RuntimeFunctions.def!
2016-02-25 05:30:59 -08:00
Michael Gottesman
c684568042 [upstream-fix] llvm::RoundUpToAlignment was renamed to llvm::alignTo. 2016-02-06 11:22:27 -08:00
practicalswift
8efa5f587e [gardening] Remove "-*- C++ -*-" tag from .cpp files
Emacs assumes .h files are C files by default which is why the
tag "-*- C++ -*-" is needed.

.cpp files do not have this problem.
2016-01-23 12:09:32 +01:00
practicalswift
f91525a10f Consistent placement of "-*- [language] -*-===//" in header. 2016-01-04 09:46:20 +01:00
practicalswift
50baf2e53b Use consistent formatting in top of file headers. 2016-01-04 02:17:48 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
69a206229d Runtime: Start splitting out stubs only needed by the standard library.
Set up a separate libSwiftStubs.a archive for C++ stub functionality that's needed by the standard library but not part of the core runtime interface. Seed it with the Stubs.cpp and LibcShims.cpp files, which consist only of stubs, though a few stubs are still strewn across the runtime code base.
2015-11-11 17:28:57 -08:00
Slava Pestov
d926fbe973 Re-apply "Runtime: Enable reflection for multi-payload enums with non-trivial layout"
This re-applies commit r30215 now that the memory error has been fixed.

Swift SVN r30534
2015-07-23 06:49:24 +00:00
Michael Gottesman
603dc59248 Revert "Runtime: Enable reflection for multi-payload enums with non-trivial layout"
This reverts commit r30215.

Fixes a bunch of problems on the ASAN bot.

Before:
    Swift :: 1_stdlib/ErrorType.swift
    Swift :: 1_stdlib/Runtime.swift
    Swift :: Constraints/bridging.swift
    Swift :: Constraints/diagnostics.swift
    Swift :: Constraints/lvalues.swift
    Swift :: DebugInfo/variables-repl.swift
    Swift :: Interpreter/enum_runtime_alignment.swift
    Swift :: Interpreter/nil_error_value.swift
    Swift :: Interpreter/return_from_main.swift
    Swift :: Misc/misc_diagnostics.swift
    Swift :: Prototypes/Result.swift
    Swift :: expr/expressions.swift
    Swift-Unit :: runtime/SwiftRuntimeTests/MetadataTest.installCommonValueWitnesses_pod_indirect

After:
    Swift :: Constraints/bridging.swift
    Swift :: Constraints/diagnostics.swift
    Swift :: Constraints/lvalues.swift
    Swift :: Misc/misc_diagnostics.swift
    Swift :: expr/expressions.swift
    Swift-Unit :: runtime/SwiftRuntimeTests/MetadataTest.installCommonValueWitnesses_pod_indirect

Swift SVN r30396
2015-07-20 08:23:07 +00:00
Joe Groff
ec61fa4c5a IRGen/Runtime: Use only the 'layout' subset of the vwtable to perform value type layout.
Full type metadata isn't necessary to calculate the runtime layout of a dependent struct or enum; we only need the non-function data from the value witness table (size, alignment, extra inhabitant count, and POD/BT/etc. flags). This can be generated more efficiently than the type metadata for many types--if we know a specific instantiation is fixed-layout, we can regenerate the layout information, or if we know the type has the same layout as another well-known type, we can get the layout from a common value witness table. This breaks a deadlock in most (but not all) cases where a value type is recursive using classes or fixed-layout indirected structs like UnsafePointer. rdar://problem/19898165

This time, factor out the ObjC-dependent parts of the tests so they only run with ObjC interop.

Swift SVN r30266
2015-07-16 15:38:17 +00:00
Ted Kremenek
a3d88266b2 Revert "IRGen/Runtime: Use only the 'layout' subset of the vwtable to perform value type layout."
This reverts commit r30243.

This appears to be breaking the Linux build.

Swift SVN r30253
2015-07-16 06:28:24 +00:00
Joe Groff
2641d566ac IRGen/Runtime: Use only the 'layout' subset of the vwtable to perform value type layout.
Full type metadata isn't necessary to calculate the runtime layout of a dependent struct or enum; we only need the non-function data from the value witness table (size, alignment, extra inhabitant count, and POD/BT/etc. flags). This can be generated more efficiently than the type metadata for many types--if we know a specific instantiation is fixed-layout, we can regenerate the layout information, or if we know the type has the same layout as another well-known type, we can get the layout from a common value witness table. This breaks a deadlock in most (but not all) cases where a value type is recursive using classes or fixed-layout indirected structs like UnsafePointer. rdar://problem/19898165

Swift SVN r30243
2015-07-16 01:28:42 +00:00
Slava Pestov
f456f0c25c Runtime: Enable reflection for multi-payload enums with non-trivial layout
This came up for multi-payload enums without generic parameters, eg

enum MyError {
  case BusError
  case TrainError(Int)
  case DataLoss(String)
}

Fixes <rdar://problem/21739870>.

Swift SVN r30215
2015-07-15 06:03:30 +00:00
Slava Pestov
cdd5a4121c IRGen: Generate value witnesses to get enum tag and project payload
These will be used for reflection, and eventually to speed up generic
operations on single payload enums as well.

Progress on <rdar://problem/21739870>.

Swift SVN r30214
2015-07-15 06:03:18 +00:00
Slava Pestov
d2a5fbd94a Implement reflection on instances of empty and single-payload enums
This change attempts to introduce the functionality without being too
disruptive. After we branch, I want to consolidate some of the runtime
functions and implement this functionality for multi-payload enums
as well, which requires adding new runtime metadata.

Example:

(swift) enum Color { case Red, Green, Blue(Int) }
(swift) print(Color.Red)
REPL.Color.Red
(swift) print(Color.Blue(5))
REPL.Color.Blue(5)

Implements <rdar://problem/18334936>.

Swift SVN r28430
2015-05-11 18:21:39 +00:00
Joe Groff
889b8d3826 IRGen: Fix implementation of emitValueCaseTest for multi-payload enums.
Empty cases are packed into the payload under a minimal number of tags, instead of having once case per tag, as for payload cases.

Swift SVN r27813
2015-04-27 19:37:18 +00:00
Joe Groff
4afbe78d59 Runtime: Entry points for dynamic multi-payload enums.
Swift SVN r27791
2015-04-27 00:35:10 +00:00
Dmitri Hrybenko
350248dae5 Reorganize the directory structure under 'stdlib'
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.

See stdlib/{public,internal,private}/README.txt for more information.

Swift SVN r25876
2015-03-09 05:26:05 +00:00