SIL: Have VTables and WitnessTables bump the reference counts of SILFunctions.

Fixes <rdar://problem/15725600>.

Swift SVN r11666
This commit is contained in:
Joe Groff
2013-12-27 05:59:19 +00:00
parent a9f9440544
commit c76548916e
5 changed files with 63 additions and 10 deletions

View File

@@ -85,6 +85,8 @@ private:
/// This is the number of function_ref instructions using this SILFunction.
friend class FunctionRefInst;
friend class SILVTable;
friend class SILWitnessTable;
unsigned RefCount = 0;
public:

View File

@@ -49,13 +49,11 @@ private:
// Tail-allocated.
Pair Entries[1];
SILVTable(ClassDecl *c, ArrayRef<Pair> entries)
: Class(c), NumEntries(entries.size())
{
memcpy(Entries, entries.begin(), sizeof(Pair) * NumEntries);
}
SILVTable(ClassDecl *c, ArrayRef<Pair> entries);
public:
~SILVTable();
/// Create a new SILVTable with the given method-to-implementation mapping.
/// The SILDeclRef keys should reference the most-overridden members available
/// through the class.

View File

@@ -148,11 +148,7 @@ private:
Entry Entries[1];
SILWitnessTable(NormalProtocolConformance *Conformance,
ArrayRef<Entry> entries)
: Conformance(Conformance), NumEntries(entries.size())
{
memcpy(Entries, entries.begin(), sizeof(Entry) * NumEntries);
}
ArrayRef<Entry> entries);
public:
/// Create a new SILWitnessTable with the given entries.
@@ -160,6 +156,8 @@ public:
NormalProtocolConformance *Conformance,
ArrayRef<Entry> entries);
~SILWitnessTable();
/// Return the AST ProtocolConformance this witness table represents.
NormalProtocolConformance *getConformance() const { return Conformance; }