diff options
| author | Yong He <yonghe@outlook.com> | 2020-09-14 10:28:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-14 10:28:22 -0700 |
| commit | 2e3688af574738650c2753680ce9f417fb22e5e7 (patch) | |
| tree | d99d049a98540336f2d803545d94d91fb200cc8e /source/slang/slang-ir-any-value-marshalling.cpp | |
| parent | 54616718b07b2256271a88b4fc862c6acdb23773 (diff) | |
Dynamic dispatch bug fixes. (#1541)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-any-value-marshalling.cpp')
| -rw-r--r-- | source/slang/slang-ir-any-value-marshalling.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/slang/slang-ir-any-value-marshalling.cpp b/source/slang/slang-ir-any-value-marshalling.cpp index f732ffbe7..0a988da1d 100644 --- a/source/slang/slang-ir-any-value-marshalling.cpp +++ b/source/slang/slang-ir-any-value-marshalling.cpp @@ -126,13 +126,14 @@ namespace Slang auto vectorType = static_cast<IRVectorType*>(dataType); auto elementType = vectorType->getElementType(); auto elementCount = getIntVal(vectorType->getElementCount()); + auto elementPtrType = builder->getPtrType(elementType); for (IRIntegerValue i = 0; i < elementCount; i++) { - auto elementVal = builder->emitElementExtract( - elementType, + auto elementAddr = builder->emitElementAddress( + elementPtrType, concreteTypedVar, builder->getIntValue(builder->getIntType(), i)); - emitMarshallingCode(builder, context, elementVal); + emitMarshallingCode(builder, context, elementAddr); } break; } @@ -469,6 +470,10 @@ namespace Slang if (auto anyValueType = as<IRAnyValueType>(inst)) processAnyValueType(anyValueType); } + // Because we replaced all `AnyValueType` uses, some old type definitions (e.g. PtrType(AnyValueType)) + // will become duplicates with new types we introduced (e.g. PtrType(AnyValueStruct)), and therefore + // invalidates our `globalValueNumberingMap` hash map. We need to rebuild it. + sharedContext->sharedBuilderStorage.deduplicateAndRebuildGlobalNumberingMap(); } }; |
