Serialization: Fix a couple of issues with serializing context params of generic SILFunctions.

- Parameterize maybeReadGenericParams' BitstreamCursor so that we can read from
  the correct cursor when trying to read the generic params of a SILFunction.
- Only serialize the context generic params for SILFunctions for which we're
  serializing a complete definition. This fixes issues with us getting the
  wrong archetypes forward-declared from references in other modules.

In this version of the patch, we adjust the deserialization point for the
generic param list to correctly come before we check if the SILFunction block
is empty, and we add a kludge to keep the JIT from crapping itself when it sees
the same transparent definition in multiple REPL lines' modules
<rdar://problem/16094902>.

The previous commit solves a problem this exposed at r14050 in inout deshadowing
that caused memory corruption when transparent functions were imported. This
should now be safe to commit.

Swift SVN r14109
This commit is contained in:
Joe Groff
2014-02-19 22:47:25 +00:00
parent 033867be57
commit 7fd26d22d5
5 changed files with 71 additions and 41 deletions

View File

@@ -275,7 +275,8 @@ private:
llvm::BitstreamCursor &Cursor);
GenericParamList *maybeGetOrReadGenericParams(serialization::DeclID contextID,
DeclContext *DC);
DeclContext *DC,
llvm::BitstreamCursor &Cursor);
/// Reads a set of requirements from \c DeclTypeCursor.
void readGenericRequirements(SmallVectorImpl<Requirement> &requirements);
@@ -455,7 +456,8 @@ public:
///
/// If the record at the cursor is not a generic param list, returns null
/// without moving the cursor.
GenericParamList *maybeReadGenericParams(DeclContext *DC);
GenericParamList *maybeReadGenericParams(DeclContext *DC,
llvm::BitstreamCursor &Cursor);
virtual ArrayRef<Decl *> loadAllMembers(const Decl *D,
uint64_t contextData) override;