Commit Graph

1069 Commits

Author SHA1 Message Date
Erik Eckstein
2e01b0edeb SIL: add assign_by_delegate instruction
Used for property delegates.
2019-04-23 11:32:28 -07:00
Kuba (Brecka) Mracek
904ba9bafe Undo "Disable TSan in coroutine functions" (0ca3f79). (#23952)
This is no longer needed because we now make sure to run the coroutine lowering pass before ASan/TSan instrumentation passes.

Also fixes a typo in the test.
2019-04-21 18:16:48 -07:00
Kuba (Brecka) Mracek
a1aced9e71 Undo "Disable ASan in coroutine functions; it interferes with splitting." (3a4185c). (#23951)
This is no longer needed because we now make sure to run the coroutine lowering pass before ASan/TSan instrumentation passes.
2019-04-11 15:16:51 -07:00
Adrian Prantl
0b8fc3d405 Remove Resilience workarounds and describe fixed-size global resilient
variables in DWARF.

rdar://problem/48409386
2019-03-27 10:51:16 -07:00
Adrian Prantl
54af8e461f Debug Info: Encode Archetype names in DWARF
Currently LLDB calls into ide::getDeclFromMangledSymbolName() to get
to this information and we would like to get rid of this call.

rdar://problem/47798056
2019-02-20 16:04:16 -08:00
Slava Pestov
c8622538ca IRGen: DebugTypeInfo doesn't need a DeclContext or GenericEnvironment 2019-02-13 21:51:28 -05:00
John McCall
0ca3f7992c Disable TSan in coroutine functions; it interferes with lowering.
Fixes rdar://47491307.

I've filed rdar://47642395 to track re-enabling TSan in coroutines.
2019-01-29 17:04:26 -05:00
Arnold Schwaighofer
6f822a227c IRGen for partial_apply [stack] 2019-01-15 11:20:33 -08:00
Arnold Schwaighofer
13f7a219aa IRGen: Drop the witness table pointer in visitThickToObjCMetatypeInst
Otherwise, we will assert in an assert build of the compiler.

rdar://46563206
2018-12-10 10:45:13 -08:00
Slava Pestov
aa747dcd81 Remove property behaviors 2018-12-07 20:38:33 -05:00
Slava Pestov
ff09603f30 IRGen: @_fixed_layout classes still have resilient metadata 2018-11-29 23:20:02 -05:00
Adrian Prantl
936fead1b9 Remove DebugTypeInfo::isImplicitlyIndirect().
I found the corresponding code in LLDB that depended on this hack and
am now removing both. This makes it possible to share the same code
path for top-level archetypes and member types.

rdar://problem/45462765
2018-11-27 16:11:05 -08:00
Michael Gottesman
fed6145922 [sil] Change all single value instructions with forwarding ownership to have static ownership.
Previously we would always calculate these instructions ownership dynamically
when asked and rely on the ownership verifier to catch if we made any
mistakes. Instead with this commit we move to a more static model where the
ownership that these instructions can take are frozen on construction. This is a
more static model that simplifies the ownership model.

I also eliminated a few asserts that are enforced in other places that caused
problems when parsing since we may not have a Function while Parsing (it was
generally asserts if a type was trivial).
2018-11-11 15:23:36 -08:00
Arnold Schwaighofer
152e8db8bb IRGen and runtime implementation for dynamic replacements 2018-11-06 09:58:36 -08:00
Arnold Schwaighofer
7e32c68e1d Add new SIL instruction for calling dynamically_replaceable funtions
%0 = dynamic_function_ref @dynamically_replaceable_function
  apply %0()
  Calls a [dynamically_replaceable] function.

  %0 = prev_dynamic_function_ref @dynamic_replacement_function
  apply %0
  Calls the previous implementation that dynamic_replacement_function
  replaced.
2018-11-06 09:53:22 -08:00
Arnold Schwaighofer
ebbe3aed1c IRGen: Add implementation for dynamically replaceable functions
A dynamically replaceable function calls through a global variable that
holds the function pointer.

struct ChainEntry {
   void *(funPtr)();
   struct ChainEntry *next;
}

ChainEntry dynamicallyReplaceableVar;

void dynamicallyReplaceableFunction() {
  dynamicallyReplaceableVar.funPtr()
}

dynamic replacements will be chainable so the global variable also
functions as the root entry in the chain of replacements.

A dynamic replacement functions can call the previous implementation by
going through its chain entry.

ChainEntry chainEntryOf_dynamic_replacement_for_foo;

void dynamic_replacement_for_foo() {
   // call the previous (original) implementation.
   chainEntryOf_dynamic_replacement_for_foo.funPtr();
}
2018-11-06 09:53:21 -08:00
John McCall
cf511445e2 Basic support for Builtin.IntegerLiteral. 2018-10-31 18:42:34 -04:00
Andrew Trick
2ecb48a89d Remove exclusivity support for Swift 3 mode.
Remove the compiler support for exclusivity warnings.

Leave runtime support for exclusivity warnings in non-release builds
only for unit testing convenience.

Remove a test case that checked the warning log output.

Modify test cases that relied on successful compilation in the
presence of exclusivity violations.

Fixes: <rdar://problem/45146046> Remaining -swift-version 3 tests for exclusivity
2018-10-12 09:08:42 -07:00
Slava Pestov
c969abdf1d IRGen: Remove some unused and used-once functions
A few utility methods would bypass computing the TypeInfo for a tuple,
but they were only used in assertions or used in places where I can't
imagine tuples coming up often enough for it to matter.
2018-10-04 20:01:23 -04:00
swift-ci
e1d00e7b65 Merge pull request #19547 from apple/anotherdayanothercommit 2018-09-25 19:09:20 -07:00
Davide Italiano
983c399b25 [IRGenSIL] DI variable decl for visitAllocBoxInst is always indirect.
This code is presumably dead, and now we're a step closer to
remove the broken isImplicitlyIndirect().

<rdar://problem/44744592>
2018-09-25 16:39:50 -07:00
Michael Gottesman
3cd1b7bedc [sil] Extract out ApplySite/FullApplySite into their own header.
I believe that these were in SILInstruction for historic reasons. This is a
separate API on top of SILInstruction so it makes sense to pull it out into its
own header.
2018-09-25 13:32:59 -07:00
Arnold Schwaighofer
149b891785 IRGen: Witness method concrete wtable fulfillment
This is a rebase of John Mccall's patch from
https://github.com/rjmccall/swift/tree/concrete-wtable-fulfillment

SR-7657
rdar://40149340
2018-09-24 07:21:58 -07:00
Jordan Rose
d412f4b4ba [IRGen] Adopt std::unique_ptr for IRGenDebugInfo (#19369) 2018-09-18 11:10:10 -07:00
adrian-prantl
dfe4393ae5 Merge pull request #19333 from adrian-prantl/43566087
Zero-initialize -Onone debug shadow copies for exploded values
2018-09-16 18:51:17 -07:00
Doug Gregor
e77cba7b63 [IRGen] witness_method should always refer to a slot in the witness table. 2018-09-14 20:59:03 -07:00
Adrian Prantl
9cb0b8ef25 Zero-initialize -Onone debug shadow copies for exploded values
and simplify the initialization code by emitting a memset intrinsic.

rdar://problem/43566087
2018-09-14 17:20:11 -07:00
adrian-prantl
855fc74716 Merge pull request #19228 from adrian-prantl/inlined-generics
Enable debug info for inlined generics by default. It works now.
2018-09-11 13:59:43 -07:00
swift-ci
cc329fee03 Merge pull request #19141 from aschwaighofer/remove_constant_string_literal 2018-09-10 15:51:47 -07:00
Adrian Prantl
beb32f3821 Enable debug info for inlined generics by default. It works now. 2018-09-10 14:48:53 -07:00
Slava Pestov
719ba2fb27 IRGen: Fix case where we would go through the vtable entry and not the dispatch thunk
Make sure we check resilience of the class defining the method,
and not the class with the override we're calling.
2018-09-07 21:57:16 -07:00
Slava Pestov
3808ae0d58 IRGen: Use method lookup function for resilient super method calls
Fixes <https://bugs.swift.org/browse/SR-3928>, <rdar://problem/31411193>.
2018-09-07 21:57:16 -07:00
swift-ci
5e2b705f6d Merge pull request #19131 from gottesmm/pr-67d16ab8862dce3cff561b2a4dbee16514133383 2018-09-06 15:02:39 -07:00
Michael Gottesman
0290cd4323 [sil] Eliminate end_borrow_argument now that end_borrow has a single operand.
I changed all of the places that used end_borrow_argument to use end_borrow.

NOTE: I discovered in the process of this patch that we are not verifying
guaranteed block arguments completely. I disabled the tests here that show this
bad behavior and am going to re-enable them with more tests in a separate PR.
This has not been a problem since SILGen does not emit any such arguments as
guaranteed today. But once I do the SILGenPattern work this will change.

rdar://33440767
2018-09-06 14:04:57 -07:00
Doug Gregor
c7152f3576 [SIL] Don’t create witness table entries for overriding requirements.
SIL will not generate calls to protocol requirements that override
other protocol requirements, so all of the witness table entries for
the overriding arguments are dynamically dead. Remove them from the
witness tables entirely.

Implements rdar://problem/43870489, reducing the size of the standard
library binary by 196k.
2018-09-05 13:51:26 -07:00
Arnold Schwaighofer
73df12c09f Remove dead constant_string_literal
constant_string_literal was added to support a one word representation
of String that never materialized.
2018-09-05 12:13:57 -07:00
Erik Eckstein
899a619ed0 IRGen: remove remaining (dead) code which deals with pinning 2018-08-25 11:14:18 -07:00
John McCall
6b9cfbe893 Disable inlining coroutines until the coroutine-splitting pass runs.
Cloning the coroutine intrinsics generally yields invalid IR.
2018-08-25 03:33:34 -04:00
John McCall
3a4185ca48 Disable ASan in coroutine functions; it interferes with splitting.
I filed rdar://43673059 to track re-enabling it.
2018-08-24 02:01:31 -04:00
Erik Eckstein
99a9ed5535 SIL: remove the pinning instructions: strong_pin, strong_unpin, is_unique_or_pinned
They are not used anymore after removing the pinning addressors.
2018-08-23 12:47:56 -07:00
Adrian Prantl
556c8e5a2f Add initial support for debug info for coroutine allocas.
Unfortunately the example I was testing this with still crashed IRGen later on...

<rdar://problem/43296089>
2018-08-14 19:07:55 -07:00
Adrian Prantl
58475ef1ad Add debug info support for inlined and specialized generic variables.
This patch adds SIL-level debug info support for variables whose
static type is rewritten by an optimizer transformation. When a
function is (generic-)specialized or inlined, the static types of
inlined variables my change as they are remapped into the generic
environment of the inlined call site. With this patch all inlined
SILDebugScopes that point to functions with a generic signature are
recursively rewritten to point to clones of the original function with
new unique mangled names. The new mangled names consist of the old
mangled names plus the new substituions, similar (or exactly,
respectively) to how generic specialization is handled.

On libSwiftCore.dylib (x86_64), this yields a 17% increase in unique
source vars and a ~24% increase in variables with a debug location.

rdar://problem/28859432
rdar://problem/34526036
2018-07-31 16:59:56 -07:00
Bob Wilson
8e330ee344 NFC: Fix indentation around the newly renamed LLVM_DEBUG macro.
Jordan used a sed command to rename DEBUG to LLVM_DEBUG. That caused some
lines to wrap and messed up indentiation for multi-line arguments.
2018-07-21 00:56:18 -07:00
Jordan Rose
cefb0b62ba Replace old DEBUG macro with new LLVM_DEBUG
...using a sed command provided by Vedant:

$ find . -name \*.cpp -print -exec sed -i "" -E "s/ DEBUG\(/ LLVM_DEBUG(/g" {} \;
2018-07-20 14:37:26 -07:00
Davide Italiano
dc85c0a469 Merge pull request #17426 from sparkasaurusRex/codeview-linetables
[IRGen] Fix debug locations to work well with CodeView
2018-07-20 09:54:31 -07:00
Ellis Hoag
8200916129 Fix debug locations to work well with CodeView
Summary:
There are a few problems with how Swift currently emits location
information for CodeView.

1. WinDbg does not work well with column information so all column
locations must be set to zero.

2. Some instructions, e.g., ``a + b``,  will emit ``@llvm.trap()``
and ``unreachable``. Those instructions should have artificial
locations, i.e., they should have a line location of zero.

3. Some instructions, e.g., ``a / b``, will emit ``unreachable``
sandwiched between other code for that instruction. This makes
WinDbg confused and it cannot decide which set of instructions
to break on. Those instructions should have the same line location
as the others.

4. There are several prologue instructions with artificial line
locations that create breaks in the linetables. Those instructions
should have valid line locations, usually at the start of the
function.

5. Case bodies have cleanup instructions with artificial line
locations unless it has a ``do`` block. Those locations should
be the last line in the case block.

Test Plan:
test/DebugInfo/basic.swift
test/DebugInfo/columns.swift
test/DebugInfo/linetable-codeview.swift
test/DebugInfo/line-directive-codeview.swift
2018-07-18 09:54:19 -07:00
David Zarzycki
71472cfa96 Enable optional unowned/unowned(unsafe) references
John okayed this change in a comment on GitHub pull request: #16237
2018-07-11 14:33:23 -04:00
Adrian Prantl
fdad9076f2 Revert "Add debug info support for inlined and specialized generic variables."
There is an assertion failure building the source compatibility suite that
needs to be investigated.

This reverts commit 91f6f34119.
2018-07-07 13:01:01 -07:00
Adrian Prantl
91f6f34119 Add debug info support for inlined and specialized generic variables.
This patch adds SIL-level debug info support for variables whose
static type is rewritten by an optimizer transformation. When a
function is (generic-)specialized or inlined, the static types of
inlined variables my change as they are remapped into the generic
environment of the inlined call site. With this patch all inlined
SILDebugScopes that point to functions with a generic signature are
recursively rewritten to point to clones of the original function with
new unique mangled names. The new mangled names consist of the old
mangled names plus the new substituions, similar (or exactly,
respectively) to how generic specialization is handled.

On libSwiftCore.dylib (x86_64), this yields a 17% increase in unique
source vars and a ~24% increase in variables with a debug location.

rdar://problem/28859432
rdar://problem/34526036
2018-07-06 22:06:48 -07:00
John McCall
34b0cbc11d Merge pull request #16237 from davezarzycki/metaprogram_ref_storage_types
[AST] NFC: Enable reference storage type meta-programming
2018-07-05 14:45:38 -04:00