mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Have VTables and WitnessTables bump the reference counts of SILFunctions.
Fixes <rdar://problem/15725600>. Swift SVN r11666
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user