Commit Graph

365 Commits

Author SHA1 Message Date
Joe Groff
9f2ee07de8 Merge pull request #75334 from jckarter/extern-is-experimental
`@_extern` is an experimental feature.
2024-07-19 09:04:14 -07:00
Joe Groff
51829c17bf @_extern is an experimental feature.
Mark it as such. rdar://132013078
2024-07-18 11:46:16 -07:00
Yuta Saito
c120c5a8e1 [test] Guard AVR test with CODEGENERATOR=AVR
This test is only relevant for the AVR target, so it should be guarded
with the CODEGENERATOR=AVR condition to avoid running it when the target
is not enabled in llvm-targets-to-build.
2024-07-18 15:44:48 +00:00
Doug Gregor
ac0f574fdb Merge pull request #75127 from carlos4242/embedded-avr-cross-compile-stdlib
[AVR] standard library support for AVR
2024-07-17 22:17:42 -07:00
Carl Peto
39adecbfcb simplify standard library unit test to just check basic usage 2024-07-17 10:58:08 +01:00
Carl Peto
3c65c79def fix test 2024-07-16 22:30:34 +01:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
Owen Voorhees
5490b44772 Allow enabling embedded Swift without WMO when not generating SIL
This allows modes like -index-file to work the same way they do when not using embedded Swift
2024-07-15 17:49:47 -07:00
Erik Eckstein
823036d5a1 embedded: fix vtable specialization for nested classes
Fixes a crash in case of an inner class (with no generic parameters), which is nested inside another generic type, like
```
struct G<T> {
  class Inner {}
}
```

rdar://131311511
2024-07-12 21:44:49 +02:00
Ryan Mansfield
ec20345a52 Add REQUIRES for noncopyable-captures.swift. 2024-07-08 15:12:38 -04:00
Erik Eckstein
1a308ef2fe PerformanceDiagnostic: give an error if a generic non-copyable value with a deinit is captured by an escaping closure.
Otherwise IRGen would crash.
It needs a bit of work to support alloc_box of generic non-copyable structs/enums with deinit, because we need to specialize the deinit functions, though they are not explicitly referenced in SIL.
Until this is supported, give an error in such cases.

Fixes a compiler crash in IRGen
rdar://130283111
2024-07-08 10:05:19 +02:00
Meghana Gupta
5815424ef2 Merge pull request #74703 from meg-gupta/bringbackflag
[NFC] Add -enable-import-ptrauth-field-function-pointers as a no-op
2024-06-25 23:14:51 -07:00
Meghana Gupta
d509e628a6 [NFC] Add -enable-import-ptrauth-field-function-pointers as a no-op 2024-06-25 16:03:53 -07:00
Kuba (Brecka) Mracek
5e949b8e2b Merge pull request #74674 from kubamracek/embedded-failable
[embedded] Fix crash when using failable initializers on generic classes
2024-06-25 06:58:20 -07:00
Kuba Mracek
bda0c904ef [embedded] Fix crash when using failable initializers on generic classes 2024-06-24 20:36:02 -07:00
Erik Eckstein
1f9588e5c6 MandatoryPerformanceOptimizations: prevent inlining of dynamic-self class methods
This fixes a compiler crash in embedded swift.

rdar://129241915
2024-06-24 15:01:02 +02:00
Kuba (Brecka) Mracek
70c54bb739 Merge pull request #74551 from kubamracek/embedded-static-objects
[embedded] Enable read-only static array promotion in embedded mode
2024-06-19 21:07:06 -07:00
Kuba (Brecka) Mracek
6844292d72 Merge pull request #74553 from kubamracek/volatile-tests
Mark tests that use the _Volatile module as REQUIRES: volatile
2024-06-19 16:48:45 -07:00
Kuba Mracek
a8312b6c1f Mark tests that use the _Volatile module as REQUIRES: volatile 2024-06-19 10:13:14 -07:00
Kuba Mracek
632c78b18f [embedded] Fix missing linkage to Unicode data tables in specialize-attrs2.swift test 2024-06-19 09:27:20 -07:00
Kuba Mracek
155c9708bd [embedded] Fix -target in modules-empty-object.swift test 2024-06-19 09:22:57 -07:00
Kuba Mracek
62d7167c3f [embedded] Enable read-only static array promotion in embedded mode 2024-06-19 09:16:04 -07:00
Kuba (Brecka) Mracek
9e7501601c Merge pull request #74489 from kubamracek/embedded-less-stdlibs
[embedded] Don't build *all* the embedded stdlibs by default
2024-06-18 13:50:25 -07:00
Kuba (Brecka) Mracek
4d52b58d44 Merge pull request #74480 from kubamracek/embedded-no-eager-specializer
[embedded] Skip EagerSpecializer on embedded Swift
2024-06-17 18:44:14 -07:00
Kuba (Brecka) Mracek
03b0f0cc57 Merge pull request #74442 from kubamracek/embedded-string-to-pointer
[embedded] Implement missing _convertConstStringToUTF8PointerArgument to support string to pointer conversion
2024-06-17 10:45:39 -07:00
Kuba Mracek
dc2edb6e9b [embedded] Don't build *all* the embedded stdlibs by default 2024-06-17 10:32:56 -07:00
Kuba Mracek
b0f3da65eb [embedded] Skip EagerSpecializer on embedded Swift 2024-06-17 08:58:46 -07:00
Kuba Mracek
92a39fce2f [embedded] Implement missing _convertConstStringToUTF8PointerArgument to support string to pointer conversion 2024-06-14 15:32:25 -07:00
Kuba (Brecka) Mracek
17eef2733d Merge pull request #74354 from kubamracek/embedded-float-abi-hard
[embedded] Respect float arg lowering convention under -mfloat-abi=hard
2024-06-14 08:07:51 -07:00
Kuba Mracek
e871cea025 [embedded] Respect float arg lowering convention under -mfloat-abi=hard 2024-06-12 11:26:02 -07:00
Erik Eckstein
13ecb51612 embedded: add swift_dynamicCastClass runtime function
To enable dynamic class casts

rdar://129672994
2024-06-12 18:23:38 +02:00
Kuba Mracek
5e1721dd4a [embedded] Make Mirror present but unavailable 2024-06-10 13:40:36 -07:00
Kuba Mracek
16183415f3 [embedded] Add a lit test for -emit-empty-object-file 2024-06-02 21:30:01 -07:00
Daniel Rodríguez Troitiño
aa61d953ba [embedded] Allow disabling embedded stdlib, but still test compiler (#73977)
While one can disable building the embedded stdlib, the tests for that
feature were unconditionally added. If one wants to just build the
compiler without any stdlib (except target), a bunch of embedded tests
would have failed.

Inject the value of `SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB` into the Lit
test system as a feature `embedded_stdlib` and add `REQUIRES:` to
a couple of tests outside the `embedded/` directory that seems to use
the experimental feature. Make the tests in `embedded/` unsupported in
the local Lit configuration file.
2024-05-29 15:45:05 -07:00
Kuba (Brecka) Mracek
67e9df028e Merge pull request #73585 from kubamracek/embedded-string-unicode-tables
[embedded] Provide Unicode data tables for embedded as a static library
2024-05-27 21:59:08 -07:00
Kuba Mracek
f63f1320d4 [embedded] For now, only run Unicode data tables tests on macOS 2024-05-27 16:27:27 -07:00
Yuta Saito
0727689d07 [test] Add missing memmove definition for wasm tests
7ae20b7039 added a memmove dependency
to the embedded build, so we need to add a definition for it in the
test to satisfy the linker.
2024-05-27 11:12:00 +00:00
Kuba Mracek
20f104093d [embedded] Use -Xlinker in unicode tests 2024-05-26 21:39:31 -07:00
Kuba Mracek
d7b306b611 [embedded] Add tests that verify dead-stripping of Unicode data tables works 2024-05-26 13:00:53 -07:00
Kuba Mracek
7d92baaddd [embedded] Provide Unicode data tables for embedded as a static library 2024-05-26 13:00:52 -07:00
Kuba (Brecka) Mracek
545c2434c0 Merge pull request #70446 from kubamracek/embedded-string
[embedded] Port Swift.String to embedded Swift
2024-05-26 12:59:01 -07:00
Erik Eckstein
1463506f56 tests: fix embedded/static-object.swift
A REQUIRES for embedded tests was missing

rdar://128611737
2024-05-23 17:04:04 +02:00
Erik Eckstein
162139364e IRGen: support read-only statically initialized arrays in embedded swift
Arrays buffers need to be initialized with a (minimal) metatype and with an immortal reference count.
2024-05-21 18:04:10 +02:00
eeckstein
323cb677f5 Merge pull request #73703 from eeckstein/fix-cast-simplification
embedded: fix a compiler crash when using dynamic casts
2024-05-21 08:46:24 +02:00
Yuta Saito
0f50aca4e9 [test] Move embedded wasm tests to a separate directory
The `classes-wasm.swift` test was the only executable test for
WebAssembly that requires wasm runtime at test-time. Other tests
in the `embedded` directory run only on the macOS / Linux host toolchain
builds and some of them are incompatible with SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB=OFF.
Given that the `classes-wasm.swift` test is the only test we want to run
during WasmStdlib build, move it to a separate directory `embedded/wasm`.
2024-05-20 11:55:10 +00:00
Erik Eckstein
369021f2b0 PerformanceDiagnostics: diagnose dynamic casts
Dynamic casts need metadata and therefore cannot be used in embedded swift.
Fixes an internal IRGen error.
2024-05-17 15:07:40 +02:00
Augusto Noronha
529845056b Fix functions not being kept for debugger
At Onone, many types of functions (anything user written, compiler
generated setters and getters, etc), should be kept in the final
binary so they're accessible by the debugger.

rdar://126763340
2024-05-14 10:31:44 -07:00
Kuba Mracek
63742ba4ab [embedded] Add a test checking that printing StaticStrings, integers, booleans is allocation-free 2024-05-12 08:53:29 -07:00
Kuba Mracek
7bdffbbdfa [embedded] Mark test/embedded/lto-multiple-object-files.swift as REQUIRES: optimized_stdlib 2024-05-10 14:03:32 -07:00
Kuba Mracek
92c20a699b [embedded] Avoid unsafeBitCast, use Builtin.castFromNativeObject instead, add armv7 test 2024-05-08 21:29:11 -07:00