Skip to content

Commit 159ac2b

Browse files
[Prototype] Serialize instruction size to YAML
1 parent 20c3f42 commit 159ac2b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

include/swift/Serialization/ModuleSummary.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class FunctionSummary {
100100
/// The symbol name of the function only for debug and test purposes.
101101
std::string Name;
102102
/// Size of instructions only for debug purpose
103-
size_t InstSize;
103+
uint32_t InstSize;
104104

105105
public:
106106
FunctionSummary() = default;
@@ -129,8 +129,8 @@ class FunctionSummary {
129129

130130
GUID getGUID() const { return Guid; }
131131

132-
size_t getInstSize() const { return InstSize; }
133-
void setInstSize(size_t size) { this->InstSize = size; }
132+
uint32_t getInstSize() const { return InstSize; }
133+
void setInstSize(uint32_t size) { this->InstSize = size; }
134134
};
135135

136136
/// A slot in a set of virtual tables.

lib/Serialization/ModuleSummaryIndexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ bool shouldPreserveFunction(const SILFunction &F) {
332332

333333
void FunctionSummaryIndexer::indexFunction() {
334334
GUID guid = getGUIDFromUniqueName(F.getName());
335-
size_t instSize = 0;
335+
uint32_t instSize = 0;
336336
TheSummary = std::make_unique<FunctionSummary>(guid);
337337
TheSummary->setName(F.getName());
338338
for (auto &BB : F) {

tools/swift-module-summary-test/swift-module-summary-test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void MappingTraits<FunctionSummary>::mapping(IO &io, FunctionSummary &V) {
119119
io.mapRequired("preserved", V.Flags.Preserved);
120120
io.mapRequired("calls", V.CallGraphEdgeList);
121121
io.mapRequired("type_refs", V.TypeRefList);
122+
io.mapRequired("inst_size", V.InstSize);
122123
}
123124

124125
template <>

0 commit comments

Comments
 (0)