Commit Graph

228 Commits

Author SHA1 Message Date
Karoy Lorentey
40aae6b235 [String] 32-bit platform support
Add support for 32-bit platforms for UTF-8 backed String.
2018-11-04 10:42:41 -08:00
Michael Ilseman
e6582c37ee [test] Adjust String tests for UTF-8 representation.
Adjust tests for the UTF-8 representation, in preparation for 32-bit
support. Includes UTF-8 literal update.
2018-11-04 10:42:41 -08:00
Karoy Lorentey
aba15a1151 [test] Set and Dictionary now has an extra inhabitant (32-bit) 2018-10-06 01:47:09 +01:00
Karoy Lorentey
3665294d1e [test] Set and Dictionary now has an extra inhabitant 2018-10-05 12:33:25 +01:00
Joe Groff
93d85997e8 Generalize extra inhabitants of tuples.
Like we did for structs, make it so that tuple types can also get extra inhabitants from whichever element with the most, not only the first. This lets us move all of the extra inhabitant handling functionality between structs and tuples in IRGen up to the common RecordTypeInfo CRTP base.
2018-09-20 15:39:44 -07:00
Joe Groff
b4abe8503a Give opaque existential containers extra inhabitants.
We can use the extra inhabitants of the type metadata field as extra inhabitants of the entire
existential container, allowing `Any?` and similar types to be the same size as non-optional
existentials.
2018-09-14 12:07:58 -07:00
Jordan Rose
b7aacec9ce [test] Fix swift-reflection-test issues for all test run environments (#19171)
I stopped trying to guess and actually tested them all, including the
Apple-internal tool I keep breaking. As a bonus, the RUN lines in
validation-test/Reflection/ go back to being simple.

rdar://problem/44154961
2018-09-06 16:05:56 -07:00
Jordan Rose
7ec1db9aa3 Re-apply "[test] Yet more tweaks to remote-run" (#19150) 2018-09-05 19:24:51 -07:00
Jordan Rose
1377722f86 Revert "[test] Yet more tweaks to remote-run" 2018-09-05 10:29:01 -07:00
Jordan Rose
c52809be0f [test] One last tweak to "%target-run-reflection-test"
Copy %target-swift-reflection-test into %t instead of using a hard
link. The problem with hard links is that they can be overwritten when
the test fails, which would then truncate the original executable to
an empty file!
2018-09-04 18:25:24 -07:00
Jordan Rose
e3f3e939cb [test] Fix target-based reflection tests for real (#19098)
- Hard-link %target-swift-reflection-test into %t/ for %target-run
  implementations that copy executables, like remote-run.
- Use DYLD_LIBRARY_PATH to undo that for %target-run implementations
  that run the executable in place (host and simulators)

rdar://problem/43809613
2018-09-04 08:45:25 -07:00
Doug Gregor
ecf752d54b Revert "Revert " [Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger"" 2018-08-29 13:18:44 -07:00
Jordan Rose
11bddb49a0 [test] Temporarily disable Reflection tests on non-macOS (#19031)
utils/remote-run will only run things in %t.
An Apple-internal tool doesn't follow symlinks.
Normal macOS and simulator runs find the support libraries relative to
the binary.

I'm not sure what to do yet, but for now let's unbreak the
Apple-internal bots I broke in 01a0de2.
2018-08-29 11:38:27 -07:00
Mike Ash
8a9065a369 Revert " [Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger" 2018-08-29 13:55:20 -04:00
Doug Gregor
15a538ae1a [Reflection] Add a test for reflection on nested generic types. 2018-08-28 10:49:01 -07:00
Jordan Rose
01a0de27ec [test] Update for remote-run-ing tests on a different macOS (#18966)
Most of this is just "remember to specify the inputs and outputs on
the command line, so remote-run can see them". A bit is "prefix
environment variables with '%env-'". And the last few are "yeah,
this was never going to work in a remote environment".

In the few cases where I couldn't think of anything reasonable, I just
marked the test as "UNSUPPORTED: remote_run", a new "feature".
2018-08-27 14:50:40 -07:00
Arnold Schwaighofer
5ebc6e77e7 Codesign the reflection tests 2018-08-09 09:18:04 -07:00
Karoy Lorentey
90e894729a [StringGuts] Linux support
Add support for compiling StringGuts without the Objective-C runtime.
2018-01-21 12:37:36 -08:00
Karoy Lorentey
f2a96496a0 [StringGuts] Support for 32-bit platforms
Add 32-bit support to the new StringGuts.
2018-01-21 12:36:09 -08:00
Michael Ilseman
3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Ben Langmuir
9b283f6b09 [test] Re-enable tests that started XPASSing on resilience bot
https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RDA_test-macos-resilience/164/

XPASS: validation-test/Reflection/reflect_Character.swift
XPASS: validation-test/Reflection/reflect_multiple_types.swift
2018-01-10 10:03:45 -08:00
Erik Eckstein
76f281510f Remove @_semantics("optimize.sil.never")
The replacement is @_optimize(none)
2017-11-16 14:11:52 -08:00
Greg Parker
9a38e609af [IRGen][runtime] Reduce object header to 8 bytes on 32-bit platforms. (#12790)
SR-4353, rdar://29765800
2017-11-08 02:50:11 -08:00
Slava Pestov
76ec65f4a2 Reflection: Update tests for recent stdlib changes
Fixes <https://bugs.swift.org/browse/SR-5066> / <rdar://problem/32511557>.
2017-06-26 23:03:23 -04:00
Joe Groff
3663c36284 IRGen: Begin NSObject subclass layout with an NSObject 'isa' header only.
We would lay out all classes starting with a Swift-style two-word header, even classes that inherit NSObject and therefore don't have Swift refcounting. The ObjC runtime would slide our ivars down for us at realization time, but it's nice to avoid unnecessarily dirtying memory in the not-uncommon case of direct NSObject subclasses.
2017-06-16 14:42:27 -07:00
Robert Widmann
71bf312a25 Migrate the rest of the tests to %empty-directory 2017-06-04 11:08:39 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Dave Abrahams
82660324b9 Annotate some XFAILs with Jira/Radar links 2017-06-01 08:26:26 -07:00
Dave Abrahams
b2e4bd5d09 [stdlib] Replace _HeapBuffer with a thin wrapper
...over ManagedBufferPointer
2017-06-01 04:40:52 -07:00
Slava Pestov
b5721e8d8e AST: Remove AnyObject protocol 2017-05-02 19:45:00 -07:00
Slava Pestov
f3761c1c2e Reflection: Update for subclass existentials and primitive AnyObject 2017-05-02 02:23:08 -07:00
Slava Pestov
6a8e579601 Reflection: Fix layout of Set, Dictionary and other fixed-size multi-payload enums
For generic multi-payload enums, we would proceed down the
dynamic layout path without checking for a builtin descriptor.

As a result Set and Dictionary were always reported as being
9 bytes in size and not 8. Oops...

Fixes <rdar://problem/30066015>.
2017-01-17 21:38:06 -08:00
Slava Pestov
1c7a50dcc5 Reflection: Fix class layout, again
There were a few problems here with subclasses of Objective-C classes.
Use the InstanceStart field from rodata to correctly lay out instance
variables, and verify the results match with dynamic and static layout.

Better fix for <rdar://problem/27932061>.
2016-11-16 19:31:18 -08:00
Alexis Beingessner
1b3ce475ca update memory layouts in reflection tests 2016-11-11 23:24:20 -05:00
Alexis Beingessner
a76c35a752 reenable collection reflection tests, with impl details ignored 2016-11-11 20:30:56 -05:00
Slava Pestov
db79762c3b Reflection: Fix class layout start offset calculations
Fixes <rdar://problem/29115967>.
2016-11-11 03:13:22 -08:00
Alexis Beingessner
e36247d7fc block collection reflections tests on a stable collection ABI 2016-11-07 12:23:07 -05:00
Ben Langmuir
e27f45caf9 Disable test failing in simulator testing
rdar://problem/29127272
2016-11-05 09:45:35 -07:00
Alexis Beingessner
7ec26fc976 fallout of renaming on tests which rely on internals
Some of these are kinda dubious, but I think this would be better
addressed as part of eager bridging, which will invalidate the concept
most of these are checking for.
2016-11-03 19:55:36 -04:00
Alexis Beingessner
e8f4cb66e4 update reflection tests with new type layouts for Dictionary 2016-10-29 10:04:35 -04:00
Slava Pestov
d28b8ead50 Add resilient_stdlib to available_features and XFAIL remaining failing tests
All unoptimized tests should now pass when Swift is built with
'build-script -- --swift-stdlib-enable-resilience=1'.

There are still some issues when the tests themselves are built
with optimizations via 'check-swift-validation-optimize'.

Fixes <rdar://problem/28409189>.
2016-09-30 18:28:12 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Rintaro Ishizaki
0a40f10bb4 [SE-0095] Migrate remaining use of protocol<> syntax 2016-07-20 19:18:46 +09:00
Doug Gregor
823c24b355 [SE-0112] Rename ErrorProtocol to Error.
This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
2016-07-12 10:53:52 -07:00
Slava Pestov
95bc009e3e Reflection: Multi-payload enum layout
The approach here is to split this into two cases:

- If all case payloads have a fixed size, spare bits may be
  potentially used to differentiate between cases, and the
  remote reflection library does not have enough information to
  compute the layout itself.

  However, the total size must be fixed, so IRGen just emits a
  builtin type descriptor (which I need to rename to 'fixed type
  descriptor' since these are also used for imported value types,
  and now, certain enums).

- If at least one case has a size that depends on a generic
  parameter or is a resilient type, IRGen does not know the size,
  but this means fancy tricks with spare bits cannot be used either.
  The remote reflection library uses the same approach as the
  runtime, basically taking the maximum of the payload size and
  alignment, and adding a tag byte.

As with single-payload enums, we produce a new kind of
RecordTypeInfo, this time with a field for every enum case.
All cases start at offset zero (but of course this might change,
if for example we put the enum tag before the address point).

Also, just as with single-payload enums, there is no remote
'project case index' operation on ReflectionContext yet.

So the the main benefit from this change is that we don't entirely
give up when doing layout of class instances containing enums;
however, tools still cannot look inside the enum values themselves,
except in the simplest cases involving optionals.

Notably, the remote reflection library finally understands all
of the standard library's collection types -- Array, Character,
Dictionary, Set, and String.
2016-07-01 01:31:25 -07:00
Slava Pestov
48c928938a Reflection: Single-payload enum layout
Attempt to lay out single-payload enums, using knowledge of extra
inhabitants where possible.

- The extra inhabitants of an aggregate are the extra inhabitants of
  the first field. If the first field is empty, there are no extra
  inhabitants, and subsequent fields do not affect anything.

- Function pointers and metatypes have different extra inhabitants
  than Builtin.RawPointer, so have IRGen emit distinct builtin type
  descriptors for those.

- Opaque existentials do not have extra inhabitants.

- Weak references do not have extra inhabitants.

Also, fix IRGen to emit more accurate enum reflection metadata in
these two cases:

- We now record whether enum cases are indirect or not. An indirect
  case is the same as a payload case with Builtin.NativeObject.

- We now record whether a case is empty or not using the same logic
  as the rest of IRGen. Previously, we would incorrectly emit a
  payload type for a case with a payload that is an empty struct,
  for example.

At this point we don't have a way to get the currently inhabited
enum case from a value. However, this is still an improvement because
we can still reflect other fields of aggregates containing enums,
instead of just giving up.

Finally make some methods on TypeCoverter private, and use 'friend'
to allow them to be accessed from other internal classes, making the
public API simpler.
2016-06-30 12:57:14 -06:00
Slava Pestov
d7d2ed5046 Reflection: Remove a redundant test 2016-06-30 12:57:14 -06:00
Luke Larson
4845059d7b Test reflection for classes containing multiple types 2016-06-08 12:31:02 -07:00
Slava Pestov
e33def826c Reflection: Fix inherits_NSObject test for 32-bit
Looks like class instances are still aligned on 16 byte boundaries
here, probably because of SIMD.
2016-06-03 00:13:04 -07:00
Slava Pestov
127961795e Reflection: Fix tests to pass when optimizations are on
Prevent the optimizer from eliminating alloc_box instructions
in box_descriptors.sil by returning the boxes, and inhibit
literal capture propagation in functions.swift.

Fixes <rdar://problem/26561954>.
2016-06-02 23:43:58 -07:00