Skip to content

Conversation

DougGregor
Copy link
Member

Bring in the whole pile of fixes for the runtime's demangle-to-metadata path, including:

  • Indirect symbolic references, so we can reference private entities correctly
  • CF type fixes
  • @autoclosure demangling support
  • Proper encoding of dependent member types within generic requirements

DougGregor and others added 15 commits October 30, 2018 15:08
When performing the round-tripping verification for mangled type names,
make sure we resolve symbolic references to something
user-comprehensible that can be meaningfully rem angled.

Part of rdar://problem/37551850.

(cherry picked from commit cae1c8c)
When searching the superclasses at runtime, e.g., to find a suitable
protocol conformance record, also consider the superclasses of CF
types, which were recorded in the metadata but otherwise unused.

(cherry picked from commit c5e226b)
…rameter flags’ bit.

There are some cases where the AST’s notion of what constitutes function parameter flags
differ from the ABI notion. Specifically, these are @escaping and @autoclosure, which
are both modeled as types in the ABI. Teach IRGen to look at the ABI’s version of
function parameter flags when determining whether to pass parameter flags
to swift_getFunctionType([0-3])?.

Without this fix, we would end up with mismatches between the function types
built by IRGen and those built from mangled names. Part of
rdar://problem/37551850.


(cherry picked from commit 5fa92dc)
@autoclosure is currently represented in mangled names, but the
demangle-to-metadata path did not handle it. Add basic support for it
so we can round-trip.

(cherry picked from commit 7d88a7d)
(cherry picked from commit 1f2f90e)
…ata.

The instantiation of an Objective-C class or definition of an Objective-C
category can depend (at runtime) on Swift metadata, which is triggered
(only) by mangled name round-trip verification. Teach the JIT to call
the registration functions for Objective-C classes and categories
after we’ve called all of the metadata registration functions.

(cherry picked from commit 705cfa4)
…ype reference.

The root generic parameter of an associated type reference in a generic requirement
is not shifted by one.

(cherry picked from commit 29a73bc)
Simplify calls to getAddrOfLLVMVariableOrGOTEquivalent() and
getAddrOfLLVMVariable() by moving the computation of the alignment and
default type into LinkEntity.

Co-authored-by: Joe Groff <jgroff@apple.com>
(cherry picked from commit 602b38e)
Co-authored-by: Joe Groff <jgroff@apple.com>
(cherry picked from commit 8d3da66)
Extending the mangling of symbolic references to also include indirect
symbolic references. This allows mangled names to refer to context
descriptors (both type and protocol) not in the current source file.

For now, only permit indirect symbolic references within the current module,
because remote mirrors (among other things) is unable to handle relocations.

Co-authored-by: Joe Groff <jgroff@apple.com>
(cherry picked from commit 5b41ac1)
…names.

(file)private entities are always available in the current file, so use
symbolic references to refer to them within mangled names (always). This
also eliminates problems stemming from our inability to demangle names
referring to private entities, because we (intentionally) don't allow
lookup for them.

Should fix rdar://problem/44977236.

(cherry picked from commit 54615ff)
…oduction.

We were strangely excluding protocols from being symbolically referenced
in the any-generic-type production, which meant that we could not resolve
(e.g.) associated type references to private protocols at runtime. Allow
protocol symbolic references in this position, and cope with it in the
demangler.

Fixes the rest of rdar://problem/44977236.

(cherry picked from commit dafaabe)
Collapse the generic witness table, which was used only as a uniquing
data structure during witness table instantiation, into the protocol
conformance record. This colocates all of the constant protocol conformance
metadata and makes it possible for us to recover the generic witness table
from the conformance descriptor (including looking at the pattern itself).

Rename swift_getGenericWitnessTable() to swift_instantiateWitnessTable()
to make it clearer what its purpose is, and take the conformance descriptor
directly.

(cherry picked from commit a0e3258)
(cherry picked from commit a858e4f)
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit 878a2fa into swiftlang:swift-5.0-branch Oct 30, 2018
@DougGregor DougGregor deleted the demangle-fixes-5.0 branch October 30, 2018 22:38
@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 1f6cd9e

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1f6cd9e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants