Commit Graph

122 Commits

Author SHA1 Message Date
Graham Batty
ec44f52f4e Use pthreads in the metadata runtime unit test.
Swift SVN r23369
2014-11-17 17:15:12 +00:00
Joe Groff
dd6fdc4041 Update metatype metadata unit tests.
Metatype metadata now always refers to the maximally-abstracted @thick metatype representation, so metatypes are never trivial from the runtime's point of view.

Swift SVN r21975
2014-09-16 16:55:46 +00:00
Greg Parker
215d852f8d Fix cached metadata lookup for generics that have an address point offset.
Attempt to detect thread races in metadata caches.


Swift SVN r21962
2014-09-16 01:27:38 +00:00
John McCall
c367362f22 Properly flag opaque existential types as not being
bitwise-takable.

Swift SVN r20803
2014-07-31 02:03:56 +00:00
John McCall
a611637c5a Add a unit test to validate that the new runtime machinery
constructs generic class metadata properly when the
superclass has an unexpected prefix.

Also fix a bug in the constructor for ClassMetadata (which is
only actually constructed this way in unit tests).

Swift SVN r20586
2014-07-26 01:04:58 +00:00
John McCall
d1ccc7e10a Fix the metadata unit test and ensure that it gets set up
correctly for at least my build configuration.

Swift SVN r20566
2014-07-25 22:18:01 +00:00
John McCall
64aa0ea950 When instantiating a generic class, compensate for
unexpected forematter from the superclass.

This requires a pretty substantial shift in the
generic-metadata allocation/initialization dance
because (1) we can't allocate class metadata without
knowing what the superclass is and (2) the offset
from the metadata cache entry to the address point is
no longer determined solely by the metadata pattern.

While I'm making invasive changes to metadata, fix
two race conditions in metadata creation.  The first
is that we need to ensure that only one thread succeeds
at lazily creating a generic-metadata cache.  The second
is that we need to ensure that only one thread actually
attempts to create a particular metadata; any others
should block until the metadata is successfully built.

This commit finishes rdar://17776354.  LLDB will
need to adjust to the runtime-private metadata layout
changes.

Swift SVN r20537
2014-07-25 10:08:51 +00:00
John McCall
ae0dfd4676 Change the layout of the extended class-object header: add
a flags field, add an instance address point field, and reserve
some additional space.

This change must be coordinated with a corresponding change
to ObjC runtime bits in libarclite; without this, dynamic
subclassing features like KVO will break.

The actual contents of the new fields can change without
bothering the ObjC runtime.

Swift SVN r20183
2014-07-18 21:39:43 +00:00
John McCall
63072df530 Add class size and address point fields to class metadata.
I've put these fields on the class object for now, just
so we can at least theoretically update them.  A superclass
that grew left rather than right could maybe even be made
to work with this schema, but probably not.

rdar://16705821

Swift SVN r16880
2014-04-26 10:57:50 +00:00
Joe Groff
87c26c3fcb Unit-test that existential metadata is instantiated with the right kind.
Swift SVN r9878
2013-11-01 20:21:46 +00:00
Joe Groff
98f0a5fc03 Update runtime unit tests for getExistentialTypeMetadata name change.
Swift SVN r9875
2013-11-01 18:27:43 +00:00
Joe Groff
37e652b2ba Runtime: Add swift_getExistentialMetadata entry point.
Set up a metadata cache for existential type metadata. Instantiate existential metadata by first sorting the protocol list, so that it is order invariant, precomputing the overall witness table count and class constraint of the composition so it can be cached in the existential metadata.

We still need to implement value witnesses for existential containers in the runtime before this is complete. We can at least test the uniquing and flags computations at this point.

Swift SVN r9727
2013-10-28 20:53:20 +00:00
Joe Groff
3a8f81433f IRGen: Add a nominal type descriptor to class metadata.
Swift SVN r9503
2013-10-18 22:51:27 +00:00
Dmitri Hrybenko
28c24ea5a9 Fix Metadata unittest after r9249
Swift SVN r9256
2013-10-12 07:32:32 +00:00
Joe Groff
d516b1fe59 Update metadata unittest for generic metadata pattern ABI change.
Swift SVN r7902
2013-09-04 17:50:42 +00:00
John McCall
045d7e4934 Fix the unittests suite.
Just assume that there's a snarky comment about the magic of cmake here.

Swift SVN r4533
2013-03-29 03:17:15 +00:00
Dave Zarzycki
2e802a3376 Fix some build failures introduced by r3397
Swift SVN r3412
2012-12-07 21:39:48 +00:00
John McCall
65db19395d Make metatype layout compatible with struct objc_class.
The principal difficulty here is that we need accessing the
value witness table for a type to be an efficient operation,
but there (obviously) isn't a VWT field for ObjC classes.
Placing this field after the metatype would tend to bloat
metatypes by quite a bit.  Placing it before is best, but
it introduces an unfortunate difference between the address
point of a metatype and the address of the global symbol.
That, however, can be fixed with appropriate linker support.
Still, for now this is rather unfortunately over-subtle.

Swift SVN r3307
2012-11-30 02:47:01 +00:00
John McCall
dda270495f Add a runtime entrypoint to map up a level of metatype.
Swift SVN r3179
2012-11-14 08:45:13 +00:00
Dave Zarzycki
4d8739f083 Accept limitations of LLVM build system
1) Move the low-level runtime code into swift/runtime
2) Move the high-level "standard library" code into swift/stdlib

The key difference is that the 'runtime' contains language support logic
(like retain/release logic) that the compiler assumes to always exist
and may assume intimate details about the implementation. This library
will have intimate knowledge of the swift ABI.

In contrast, the 'stdlib' can be completely rewritten and the
language/compiler make little if any assumptions about it. It is
expected to reexport fundamental types and operators, and implement
fundamental policies (precedence, implicit conversions, etc).

Swift SVN r3045
2012-10-23 21:33:52 +00:00
Dave Zarzycki
d0f889764a Various runtime cleanup
1) Move httpd to examples where it belongs.
2) Build examples on a regular basis for now.
3) Move low-level runtime source to a sub directory.

Swift SVN r3040
2012-10-23 04:56:45 +00:00
John McCall
eaae8b50d1 Add a unit test suite, including a test for
swift_getGenericMetadata.  Mostly ripped off clang's
support for same.  I did not feel confident in pulling
over the CMake equivalents, so someone else will need to.

Swift SVN r2982
2012-10-11 06:51:47 +00:00