Commit Graph

59 Commits

Author SHA1 Message Date
Arnold Schwaighofer
fc766a39d3 Fix some more tests 2023-06-29 16:16:56 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Greg Parker
e223f1fc9b [IRGen][runtime] Simplify runtime CCs and entry point ABIs (#14175)
* Remove RegisterPreservingCC. It was unused.
* Remove DefaultCC from the runtime. The distinction between C_CC and DefaultCC
  was unused and inconsistently applied. Separate C_CC and DefaultCC are
  still present in the compiler.
* Remove function pointer indirection from runtime functions except those
  that are used by Instruments. The remaining Instruments interface is
  expected to change later due to function pointer liability.
* Remove swift_rt_ wrappers. Function pointers are an ABI liability that we
  don't want, and there are better ways to get nonlazy binding if we need it.
  The fully custom wrappers were only needed for RegisterPreservingCC and
  for optimizing the Instruments function pointers.
2018-01-29 13:22:30 -08:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Pavel Yaskevich
600b15821d [Mangling/ABI] NFC: Fix DebugInfo tests to reflect label mangling changes 2017-12-18 15:44:24 -08:00
Arnold Schwaighofer
0971d82f70 SILGen: Remaining fixes for @callee_guaranteed closures and enable it
- Fix block to func reabstraction thunks block argument handling
- Forward cast ownership
- Fix applyPartiallyAppliedSuperMethod ownership for @callee_guaranteed closures
- Avoid a copy in buildBlockToFuncThunkBody
- Update tests for callee_guaranteed closures

SR-5441
rdar://33255593
2017-11-15 19:46:08 -08:00
Adrian Prantl
b998c103fc Debug Info: Associate a function call with the beginning of the expression.
Before this change, stepping through the code
  1 foo(x,
  2     f(a)
  3     f(b)
  4   )

would visit the code in the order 2, 3, 4, with the function call
being on line 4.  After this patch the order is 2, 3, 1 with the
function call being on line 1. This is both closer to what clang
generates for simialar C code and more useful to the programmer since
it is easier to understand which function is being called in a nested
expression.

rdar://problem/35430708
2017-11-10 14:37:47 -08:00
Slava Pestov
2a0cb060f8 SILGen: Look up the callee method after evaluating arguments 2017-11-08 01:31:55 -08:00
Greg Parker
b7f744c302 [test] Replace CPU=i386_or_x86_64 with CPU=i386 || CPU=x86_64. (#11889) 2017-09-12 19:34:08 -07:00
swift-ci
37889d8ae9 Merge remote-tracking branch 'origin/master' into master-next 2017-03-30 10:08:44 -07:00
Erik Eckstein
e9b4db13ee Reinstate "AllocBoxToStack: Improve alloc_stack/dealloc_stack scoping"
This reverts commit c7ef60c7ed.

It also contains an additional test for the fix in StackNesting
2017-03-30 09:40:09 -07:00
swift-ci
082230e5a5 Merge remote-tracking branch 'origin/master' into master-next 2017-03-30 08:28:30 -07:00
Erik Eckstein
c7ef60c7ed Revert "AllocBoxToStack: Improve alloc_stack/dealloc_stack scoping"
It broke some bots.

This reverts commit 43ddc2a643.
2017-03-30 07:59:05 -07:00
swift-ci
bf5fae93d1 Merge remote-tracking branch 'origin/master' into master-next 2017-03-29 18:28:30 -07:00
Erik Eckstein
43ddc2a643 AllocBoxToStack: Improve alloc_stack/dealloc_stack scoping
Instead of inserting all alloc_stack/dealloc_stack instructions at the begin/end of the function, insert them at the actual lifetime boundaries.

rdar://problem/16723128
2017-03-29 17:23:16 -07:00
swift-ci
598946bcad Merge remote-tracking branch 'origin/master' into master-next 2017-03-22 12:28:51 -07:00
Erik Eckstein
c4a11f4c92 tests: remove the now unused option -new-mangling-for-tests 2017-03-22 11:28:43 -07:00
Bob Wilson
101682e34e Adjust linetable test output to work with LLVM r297045.
The change in LLVM r297045, which enables X86 copy elision from i64
arguments, affects the debug info output for the linetable.swift test.
For iOS simulator targets (but not macOS), the prologue_end .loc
directive has a non-zero line number, instead of having that line
number specified separately in a subsequent .loc directive.
2017-03-07 16:32:53 -08:00
Greg Parker
6295f3d8b3 Revert "[test] Remove CPU=i386_or_x86_64 hack."
Swift master uses LLVM swift-4.0-branch, which does not yet have
the lit change implementing this syntax.

This reverts commit dfd10ae485.
2017-02-28 14:59:31 -08:00
Greg Parker
dfd10ae485 [test] Remove CPU=i386_or_x86_64 hack.
LLVM lit now supports boolean expressions in REQUIRES: directives.
2017-02-16 16:27:15 -08:00
Arnold Schwaighofer
39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00
Erik Eckstein
1d3724666f tests: convert about 400 tests to the new mangling by using the -new-mangling-for-tests option
When the new mangling is enabled permanently, the option can be removed from the RUN command lines again.
2017-01-24 15:27:45 -08:00
Roman Levenstein
56d55dec2b [swift-runtime] Rename rt_swift_* to swift_rt_*. NFC
Swift uses rt_swift_* functions to call the Swift runtime without using dyld's stubs. These functions are renamed to swift_rt_* to reduce namespace pollution.

rdar://28706212
2016-10-11 09:49:06 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Michael Ilseman
c37751ae96 [noescape by defaul] make noescape the default
This flips the switch to have @noescape be the default semantics for
function types in argument positions, for everything except property
setters. Property setters are naturally escaping, so they keep their
escaping-by-default behavior.

Adds contentual printing, and updates the test cases.

There is some further (non-source-breaking) work to be done for
SE-0103:

- We need the withoutActuallyEscaping function
- Improve diagnostics and QoI to at least @noescape's standards
- Deprecate / drop @noescape, right now we allow it
- Update internal code completion printing to be contextual
- Add more tests to explore tricky corner cases
- Small regressions in fixits in attr/attr_availability.swift
2016-07-29 13:49:08 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Roman Levenstein
2ff5755dc3 Use the "rt_" prefix for all generated wrappers to distinguish them from the actual runtime functions. 2016-02-25 06:00:30 -08:00
Joe Groff
1524b5146e IRGen: Put lifetime markers on stack allocations. 2015-12-24 12:11:19 -08:00
Daniel Duan
239c6629e9 Remove trailing semi-colons in .swift files 2015-12-20 21:12:11 -08:00
Adrian Prantl
cdaaca1929 Tweak this test run work on Linux and Darwin.
https://bugs.swift.org/browse/SR-149
2015-12-08 16:11:48 -08:00
Adrian Prantl
ecb14661ab Simplify this testcase. 2015-12-08 15:54:24 -08:00
Joe Groff
2af50789d3 XFAIL test/DebugInfo/linetable.swift on Linux.
Until we figure out SR-149.
2015-12-08 15:17:40 -08:00
Joe Groff
022c0a3bc4 Update tests to merge with @adrian-prantl's changes. 2015-12-08 14:35:48 -08:00
Joe Groff
d0bb0274e9 SILGen: Pass heap captures by only box.
Now that boxes are typed and projectable, the address no longer has to be passed separately.

For now, this breaks capture promotion, DI, and debug info, which analyze uses of the address param. Will be addressed in upcoming commits:

    Swift :: DebugInfo/byref-capture.swift
    Swift :: DebugInfo/closure-args.swift
    Swift :: DebugInfo/closure-args2.swift
    Swift :: DebugInfo/inout.swift
    Swift :: DebugInfo/linetable.swift
    Swift :: SILPasses/capture_promotion.swift
    Swift :: SILPasses/definite_init_diagnostics.swift
2015-12-08 14:35:47 -08:00
Adrian Prantl
7821341542 Add an argument-number field to DebugValueInst and friends.
This commit adds a DebugVariable field that is shared by
- AllocBoxInst
- AllocStackInst
- DebugValueInst
- DebugValueAddrInst
Currently DebugVariable only holds the Swift argument number.

This allows us to retire several expensive heuristics in IRGen that
attempted to identify which local variables actually where arguments
and recover their relative order.

Memory footprint notes:
This commit adds a 4-byte field to 4 SILInstructin subclasses.
This was offset by 8ab1e2dd50
which removed 20 bytes from *every* SILInstruction.

Caveats:
This commit surfaces a known bug in FunctionSigantureOpts, tracked in
rdar://problem/23727705 — debug info for exploded function arguments
cannot be expressed until this is fixed.

This reapplies ed2b16dc5a with a bugfix for
generic function arrguments and an additional testcase.

<rdar://problem/21185379&22705926>
2015-12-03 13:40:35 -08:00
Adrian Prantl
2740ad6976 Temporarily Revert "Add an argument-number field to DebugValueInst and friends."
while investigating buildbot breakage.

This reverts commit ed2b16dc5a.
2015-12-02 19:10:05 -08:00
Adrian Prantl
ed2b16dc5a Add an argument-number field to DebugValueInst and friends.
This commit adds a DebugVariable field that is shared by
- AllocBoxInst
- AllocStackInst
- DebugValueInst
- DebugValueAddrInst
Currently DebugVariable only holds the Swift argument number.

This allows us to retire several expensive heuristics in IRGen that
attempted to identify which local variables actually where arguments
and recover their relative order.

Memory footprint notes:
This commit adds a 4-byte field to 4 SILInstructin subclasses.
This was offset by 8ab1e2dd50
which removed 20 bytes from *every* SILInstruction.

Caveats:
This commit surfaces a known bug in FunctionSigantureOpts, tracked in
rdar://problem/23727705 — debug info for exploded function arguments
cannot be expressed until this is fixed.

<rdar://problem/21185379&22705926>
2015-12-02 18:33:07 -08:00
Joe Groff
0cd5aa8c7c Change mangling for the Swift module from 'Ss' to 's'.
'Ss' appears in manglings tens of thousands of times in the standard library and is also incredibly frequent in other modules. This alone is enough to shrink the standard library by 59KB.

Swift SVN r32409
2015-10-02 22:39:44 +00:00
Adrian Prantl
4f11ecc1da Get rid of Int in the debug info tests and preform some general cleanup.
<rdar://problem/20856296> Extinguish 'Int' from DebugInfo tests

Swift SVN r31177
2015-08-12 18:16:43 +00:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Duncan Exon Smith
c6d42db070 Adapt to MD* => DI* renaming of debug info types
Applied the upgrade script from r236120 (LLVM) and r236121 (CFE).  This is the
final step of rdar://problem/20434113.



Swift SVN r27925
2015-04-29 21:40:21 +00:00
Michael Gottesman
75ea31dba9 Turn on +0 self by default.
The only caveat is that:

1. We do not properly recognize when we have a let binding and we
perform a guaranteed dynamic call. In such a case, we add an extra
retain, release pair around the call. In order to get that case I will
need to refactor some code in Callee. I want to make this change, but
not at the expense of getting the rest of this work in.

2. Some of the protocol witness thunks generated have unnecessary
retains or releases in a similar manner.

But this is a good first step.

I am going to send a large follow up email with all of the relevant results, so
I can let the bots chew on this a little bit.

rdar://19933044

Swift SVN r27241
2015-04-12 22:23:37 +00:00
Dmitri Hrybenko
041ee3ca4c tests: adjust tests to pass on armv7-apple-ios7.0
Swift SVN r24505
2015-01-19 09:50:08 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Adrian Prantl
d7489b7272 Update testcases for new LLVM IR assembler syntax.
Swift SVN r24428
2015-01-14 23:38:18 +00:00
Adrian Prantl
162bc8d24c Updated testcases for upstream assembler changes.
Swift SVN r23942
2014-12-15 19:39:21 +00:00
Michael Gottesman
7e39f33f98 [mangle] Include a pass id in the mangling, just to be careful.
I am starting to reuse manglings for different passes. I want to make sure that
when we reuse functions we actually get a function created by the same pass.

Swift SVN r23924
2014-12-14 10:29:11 +00:00
Michael Gottesman
45b5389854 [mangle] Add support for mangling CapturePromotion specializations and wire it up.
<rdar://problem/19216281>

Swift SVN r23923
2014-12-14 08:17:32 +00:00