Commit Graph

488 Commits

Author SHA1 Message Date
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
Kuba Mracek
7ae20b7039 [embedded] Port Swift.String to embedded Swift 2024-05-08 11:11:37 -07:00
Alastair Houghton
6afdcd311f Merge pull request #72061 from al45tair/eng/PR-123504095
[Linux][Runtime][IRGen] Mark metadata sections as retained and support section GC.
2024-05-04 09:23:06 +01:00
Alastair Houghton
f9ec4793e9 [Test] Add linker_overridden feature.
When testing different linkers, it's sometimes useful to run the tests
with `SWIFT_DRIVER_TEST_OPTIONS=" -use-ld=<linker>"`.  If we do this,
it will break a handful of tests because they expect the compiler driver
to choose an appropriate linker automatically.

To avoid having these fail, detect when someone has done this, and
set a new feature, `linker_overridden`, then mark the tests in question
with `UNSUPPORTED: linker_overridden`.

rdar://123504095
2024-04-29 10:48:22 +01:00
Alastair Houghton
3c029ebd3f [IRGen] Use llvm.used on ELF instead of llvm.compiler.used.
We changed to `llvm.compiler.used` because of the behaviour of `gold`,
which refuses to coalesce sections that have different `SHF_GNU_RETAIN`
flags, which causes problems with metadata.

Originally I thought we were going to have to generate two sections
with distinct names and have the runtime look for both of them, but
it turns out that the runtime only wants to see sections that have
`SHF_GNU_RETAIN` in any case.  It's really the reflection code that
is interested in being able to see non-retained sections.  The upshot
is that we don't need to use `llvm.compiler.used`; it's just fine if
we have duplicate sections, as long as the reflection code looks for
them when it's inspecting an ELF image.

This also means we no longer need to pass `-z nostart-stop-gc` to the
linker if we're using `lld`.

rdar://123504095
2024-04-29 10:48:22 +01:00
eeckstein
e9d6ba9154 cmake: enable SwiftCompilerSources on Windows 2024-04-29 10:52:24 +02:00
Kuba (Brecka) Mracek
f0af3ca479 Merge pull request #73184 from kubamracek/embedded-more-keypath
[embedded] Consider move_value/copy_value as removable for keypath optimization
2024-04-23 14:42:55 -07:00
Kuba Mracek
e97943ecce [embedded] Mark embedded/classes-indirect-return.swift test as 'REQUIRES: OS=macosx || OS=linux-gnu' 2024-04-22 17:36:52 -07:00
Kuba Mracek
33e89c0aad [embedded] Consider move_value/copy_value as removable for keypath optimization 2024-04-22 13:33:24 -07:00
Erik Eckstein
7746c0ada6 embedded: fix a crash when specializing a generic class method with an indirect return value
rdar://126762162
2024-04-22 10:41:53 +02:00
Kuba Mracek
9b8c5d682c [embedded] Add an indirect enum test for the stride/size bug 2024-04-19 10:40:38 -07:00
Kuba Mracek
d040c6e754 [embedded] Add testcase for stride/size bug on enums 2024-04-19 10:35:35 -07:00
Kuba Mracek
35a1ef8d97 Explicitly pass the deployment target to the embedded/FixedArray.swift test 2024-04-11 19:06:42 -07:00
Kuba (Brecka) Mracek
ae205cc9ec Merge pull request #72972 from kubamracek/embedded-enable-trap-exec-tests-on-linux
[embedded] Re-enable executable trap tests on Linux
2024-04-11 10:13:57 -07:00
Yuta Saito
10410f1030 Merge pull request #72973 from kateinoigakukun/yt/repair-embedded-wasm-class
[embedded][wasm] Fix missing putchar symbol in test
2024-04-12 00:06:35 +09:00
Yuta Saito
65723193a9 [embedded] Use @_extern(c) instead of @_silgen_name for putchar in tests
Using inconsistent attributes between stdlib and tests causes
compilation errors. There are still several misuses of @_silgen_name in
tests, but leaving them as is for now to incrementally fix them.
2024-04-11 10:37:25 +00:00
Yuta Saito
88c904036c [embedded][wasm] Fix missing putchar symbol in test
Baremetal Wasm targets do not have stdio, so we need to provide a stub putchar.
2024-04-11 02:51:00 +00:00
Kuba Mracek
a34517bf2d [embedded] Re-enable executable trap tests on Linux 2024-04-10 19:43:31 -07:00
Kuba Mracek
2b516e87d0 [embedded] Use 'REQUIRES: swift_test_mode_optimize_none' in executable trap tests 2024-04-10 19:33:33 -07:00
Kuba (Brecka) Mracek
c531f2914f Merge pull request #72947 from kubamracek/embedded-concurrency-trim-deps-after-deployment-target-bump
[embedded] Trim expected dependencies of Embedded Swift Concurrency after deployment target raise
2024-04-10 14:22:25 -07:00
Kuba (Brecka) Mracek
6e4ccca2db Merge pull request #72817 from kubamracek/embedded-print-on-assert
[embedded] In -assert-config Debug, print errors in assertions, preconditions, fatalErrors
2024-04-10 07:52:02 -07:00
Kuba Mracek
fbdcb54bbd [embedded] Trim expected dependencies of Embedded Swift Concurrency after deployment target raise 2024-04-09 22:50:28 -07:00
Kuba (Brecka) Mracek
f9ed12d781 Merge pull request #72716 from kubamracek/embedded-build-macos-as-14
[embedded] Build the macOS Embedded Stdlib with a recent deployment target
2024-04-09 19:11:08 -07:00
Kuba Mracek
67f3d34d02 [embedded] Fix fatalError() to produce a trap in Release configurations 2024-04-09 11:36:39 -07:00
Kuba Mracek
3db72c627d [embedded] Disable test/embedded/traps-*-exec tests on Linux 2024-04-09 11:36:38 -07:00
Kuba Mracek
e0c83de6fe [embedded] Add IR tests for fatalError and precondition in embedded Swift 2024-04-09 11:36:38 -07:00
Kuba Mracek
8b2253446f [embedded] Add executable tests for fatalError, precondition, preconditionFailure in embedded Swift 2024-04-09 11:36:38 -07:00
Kuba Mracek
1bf38aa780 [embedded] Relax assert in SILLinkerVisitor::maybeAddFunctionToWorklist to allow external forward-declarations even in regular Swift, add tests 2024-04-09 11:36:37 -07:00