@@ -11,7 +11,7 @@ namespace Slang
11
11
{
12
12
SharedGenericsLoweringContext* sharedContext;
13
13
14
- void processMakeExistential (IRMakeExistential * inst)
14
+ void processMakeExistential (IRMakeExistentialWithRTTI * inst)
15
15
{
16
16
IRBuilder builderStorage;
17
17
auto builder = &builderStorage;
@@ -27,17 +27,11 @@ namespace Slang
27
27
auto rttiType = builder->getPtrType (builder->getRTTIType ());
28
28
auto tupleType = builder->getTupleType (anyValueType, witnessTableType, rttiType);
29
29
30
- IRInst* rttiObject = nullptr ;
31
- if (valueType->op != kIROp_AnyValueType )
32
- {
33
- rttiObject = sharedContext->maybeEmitRTTIObject (valueType);
34
- rttiObject = builder->emitGetAddress (
35
- builder->getPtrType (builder->getRTTIType ()),
36
- rttiObject);
37
- }
38
- else
30
+ IRInst* rttiObject = inst->getRTTI ();
31
+ if (auto type = as<IRType>(rttiObject))
39
32
{
40
- rttiObject = valueType;
33
+ rttiObject = sharedContext->maybeEmitRTTIObject (type);
34
+ rttiObject = builder->emitGetAddress (rttiType, rttiObject);
41
35
}
42
36
IRInst* packedValue = value;
43
37
if (valueType->op != kIROp_AnyValueType )
@@ -87,7 +81,7 @@ namespace Slang
87
81
88
82
void processInst (IRInst* inst)
89
83
{
90
- if (auto makeExistential = as<IRMakeExistential >(inst))
84
+ if (auto makeExistential = as<IRMakeExistentialWithRTTI >(inst))
91
85
{
92
86
processMakeExistential (makeExistential);
93
87
}
@@ -119,21 +113,16 @@ namespace Slang
119
113
120
114
while (sharedContext->workList .getCount () != 0 )
121
115
{
122
- // We will then iterate until our work list goes dry.
123
- //
124
- while (sharedContext->workList .getCount () != 0 )
125
- {
126
- IRInst* inst = sharedContext->workList .getLast ();
116
+ IRInst* inst = sharedContext->workList .getLast ();
127
117
128
- sharedContext->workList .removeLast ();
129
- sharedContext->workListSet .Remove (inst);
118
+ sharedContext->workList .removeLast ();
119
+ sharedContext->workListSet .Remove (inst);
130
120
131
- processInst (inst);
121
+ processInst (inst);
132
122
133
- for (auto child = inst->getLastChild (); child; child = child->getPrevInst ())
134
- {
135
- sharedContext->addToWorkList (child);
136
- }
123
+ for (auto child = inst->getLastChild (); child; child = child->getPrevInst ())
124
+ {
125
+ sharedContext->addToWorkList (child);
137
126
}
138
127
}
139
128
}
0 commit comments