From 7bcc2b15c8be4aebc6b9b8f05af6db7a451b228b Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 10 Nov 2020 14:55:36 -0800 Subject: Use integer RTTI/witness handles in existential tuples. (#1598) * Use integer RTTI/witness handles in existential tuples. * Fix clang error. * Fix IR serialization to use 16bits for opcode. * Undo accidental comment change. * Use variable length encoding for opcode. * Fix compile error. * Fixing issues * Fix code review issues. --- source/slang/slang-ir-generics-lowering-context.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-ir-generics-lowering-context.cpp') diff --git a/source/slang/slang-ir-generics-lowering-context.cpp b/source/slang/slang-ir-generics-lowering-context.cpp index bef4dbb0a..4c4224295 100644 --- a/source/slang/slang-ir-generics-lowering-context.cpp +++ b/source/slang/slang-ir-generics-lowering-context.cpp @@ -134,13 +134,14 @@ namespace Slang if (isTypeValue(paramType)) { - return builder->getPtrType(builder->getRTTIType()); + return builder->getRTTIHandleType(); } IRIntegerValue anyValueSize = kInvalidAnyValueSize; switch (paramType->op) { case kIROp_WitnessTableType: + case kIROp_WitnessTableIDType: case kIROp_ExtractExistentialType: // Do not translate these types. return (IRType*)paramType; @@ -174,8 +175,8 @@ namespace Slang // An existential type translates into a tuple of (AnyValue, WitnessTable, RTTI*) anyValueSize = getInterfaceAnyValueSize(paramType, paramType->sourceLoc); auto anyValueType = builder->getAnyValueType(anyValueSize); - auto witnessTableType = builder->getWitnessTableType((IRType*)paramType); - auto rttiType = builder->getPtrType(builder->getRTTIType()); + auto witnessTableType = builder->getWitnessTableIDType((IRType*)paramType); + auto rttiType = builder->getRTTIHandleType(); auto tupleType = builder->getTupleType(rttiType, witnessTableType, anyValueType); return tupleType; } -- cgit v1.2.3