diff --git a/tslang/include/TypeScript/MLIRLogic/MLIRGenStore.h b/tslang/include/TypeScript/MLIRLogic/MLIRGenStore.h index d596a652b..4b503f767 100644 --- a/tslang/include/TypeScript/MLIRLogic/MLIRGenStore.h +++ b/tslang/include/TypeScript/MLIRLogic/MLIRGenStore.h @@ -165,16 +165,13 @@ struct MethodInfo bool isCppSlotGap = false; // `@keeps`, `@borrows`, `@lends` (OWN_DECLARED_KEEPS_ATTR_NAME): argument indices, `this` 0, for // the declaration an importer re-parses; `@lends` names one, or several for a borrowing record - // (own spec 32), as a mask of argument indices (a vector would push the vtable's SmallVector - // past its inline-size limit) + // (own spec 32), as a mask of argument indices std::vector ownKeeps; std::vector ownBorrows; uint64_t ownLendsMask = 0; // `@record` (OWN_DECLARED_RECORD_ATTR_NAME): what `@lends` names, the result is a record of bool ownRecord = false; - // `@immortalizes` (OWN_DECLARED_IMMORTALIZES_ATTR_NAME), as a mask like `@lends`'s, of 32 bits: - // it fits beside `ownRecord`, where a 64-bit one would grow the vtable's SmallVector past its - // inline-size limit + // `@immortalizes` (OWN_DECLARED_IMMORTALIZES_ATTR_NAME), as a mask like `@lends`'s, of 32 bits uint32_t ownImmortalizesMask = 0; }; @@ -406,7 +403,7 @@ struct InterfaceInfo // yet-to-compile field/method access sites whenever presence of an optional member // differed between casts (ยง5) - do not reintroduce that. mlir::LogicalResult getVirtualTable( - llvm::SmallVector &vtable, + llvm::SmallVector &vtable, std::function(mlir::Attribute, mlir::Type, bool)> resolveField, std::function(std::string, mlir_ts::FunctionType, bool, int)> resolveMethod, bool methodsAsFields = false) @@ -925,7 +922,7 @@ struct ClassInfo return false; } - void getVirtualTable(llvm::SmallVector &vtable) + void getVirtualTable(llvm::SmallVector &vtable) { // name -> slot indices built alongside the vtable: override resolution is O(1) // per method instead of a linear scan of the accumulated table, and keeping @@ -937,7 +934,7 @@ struct ClassInfo getVirtualTable(vtable, methodSlots, interfaceSlots); } - void getVirtualTable(llvm::SmallVector &vtable, + void getVirtualTable(llvm::SmallVector &vtable, llvm::StringMap &methodSlots, llvm::StringMap &interfaceSlots) { // in static class I don't want to have virtual table diff --git a/tslang/include/TypeScript/MLIRLogic/MLIRTypeHelper.h b/tslang/include/TypeScript/MLIRLogic/MLIRTypeHelper.h index 39b3dd0ab..e1262db05 100644 --- a/tslang/include/TypeScript/MLIRLogic/MLIRTypeHelper.h +++ b/tslang/include/TypeScript/MLIRLogic/MLIRTypeHelper.h @@ -1529,7 +1529,7 @@ class MLIRTypeHelper mlir::LogicalResult canCastTupleToInterface(mlir::Location location, mlir_ts::TupleType tupleStorageType, InterfaceInfo::TypePtr newInterfacePtr, bool suppressErrors = false) { - SmallVector virtualTable; + SmallVector virtualTable; return getInterfaceVirtualTableForObject(location, tupleStorageType, newInterfacePtr, virtualTable, suppressErrors); } @@ -1545,7 +1545,7 @@ class MLIRTypeHelper mlir::LogicalResult getInterfaceVirtualTableForObject(mlir::Location location, mlir_ts::TupleType tupleStorageType, InterfaceInfo::TypePtr newInterfacePtr, - SmallVector &virtualTable, + SmallVector &virtualTable, bool suppressErrors = false) { diff --git a/tslang/lib/TypeScript/MLIRGenClasses.cpp b/tslang/lib/TypeScript/MLIRGenClasses.cpp index ad7a3af1f..7eb343580 100644 --- a/tslang/lib/TypeScript/MLIRGenClasses.cpp +++ b/tslang/lib/TypeScript/MLIRGenClasses.cpp @@ -249,7 +249,7 @@ namespace mlirgen setProcessingState(newClassPtr, ProcessingStages::ProcessingBody, genContext); // prepare VTable - llvm::SmallVector virtualTable; + llvm::SmallVector virtualTable; newClassPtr->getVirtualTable(virtualTable); // a @cpp class is never constructed, typed or allocated here: its objects come from C++; @@ -314,7 +314,7 @@ namespace mlirgen // an error (getVirtualTable finds it, here it's reported) if (newClassPtr->isCppVTable) { - llvm::SmallVector cppVirtualTable; + llvm::SmallVector cppVirtualTable; newClassPtr->cppSlotConflict.clear(); newClassPtr->getVirtualTable(cppVirtualTable); if (!newClassPtr->cppSlotConflict.empty()) @@ -2569,12 +2569,12 @@ genContext); // TODO: ... auto classStorageType = mlir::cast(newClassPtr->classType.getStorageType()); - llvm::SmallVector virtualTable; + llvm::SmallVector virtualTable; // the fields stored as optional for an interface's `v?: T`: their slots are tagged llvm::SmallVector optionalStorageFields; // the interface's function-typed fields (`fn: () => int`) the class implements with a method // (`fn(): int`): their slots point at a cell holding the method (see INTERFACE_METHOD_CELL_TAG) - llvm::SmallVector> methodsForFields; + llvm::SmallVector, 1> methodsForFields; // of those, the ones filled by an optional class field (`fn?: () => int`): their cells carry the // offset of the field's flag, so an access reads the instance's presence llvm::SmallVector optionalFieldsForCells; @@ -3181,7 +3181,7 @@ genContext); } // TODO: ... - llvm::SmallVector virtualTable; + llvm::SmallVector virtualTable; newClassPtr->getVirtualTable(virtualTable); // TODO: this is pure hack, add ability to clean up created globals while "dummyRun = true" diff --git a/tslang/lib/TypeScript/MLIRGenImpl.h b/tslang/lib/TypeScript/MLIRGenImpl.h index 27d25a88a..82a3682db 100644 --- a/tslang/lib/TypeScript/MLIRGenImpl.h +++ b/tslang/lib/TypeScript/MLIRGenImpl.h @@ -10269,7 +10269,7 @@ class MLIRGenImpl { // we need to calculate VTable type /* - llvm::SmallVector virtualTable; + llvm::SmallVector virtualTable; classInfo->getVirtualTable(virtualTable); auto virtTuple = getVirtualTableType(virtualTable); @@ -13031,7 +13031,7 @@ class MLIRGenImpl mlir::LogicalResult getInterfaceVirtualTableForObject(mlir::Location location, mlir_ts::TupleType tupleStorageType, InterfaceInfo::TypePtr newInterfacePtr, - SmallVector &virtualTable, + SmallVector &virtualTable, bool suppressErrors = false) { return mth.getInterfaceVirtualTableForObject(location, tupleStorageType, newInterfacePtr, virtualTable, suppressErrors); @@ -13228,7 +13228,7 @@ class MLIRGenImpl HeritageClause heritageClause, const GenContext &genContext); - mlir::Type getVirtualTableType(llvm::SmallVector &virtualTable) + mlir::Type getVirtualTableType(llvm::SmallVector &virtualTable) { llvm::SmallVector fields; for (auto vtableRecord : virtualTable) @@ -13261,7 +13261,7 @@ class MLIRGenImpl return virtTuple; } - mlir::Type getVirtualTableType(llvm::SmallVector &virtualTable) + mlir::Type getVirtualTableType(llvm::SmallVector &virtualTable) { llvm::SmallVector fields; for (auto vtableRecord : virtualTable) diff --git a/tslang/lib/TypeScript/MLIRGenInterfaces.cpp b/tslang/lib/TypeScript/MLIRGenInterfaces.cpp index af26354ba..8eb6ace53 100644 --- a/tslang/lib/TypeScript/MLIRGenInterfaces.cpp +++ b/tslang/lib/TypeScript/MLIRGenInterfaces.cpp @@ -584,7 +584,7 @@ namespace mlirgen mlir_ts::FieldInfo emptyFieldInfo; // the slots' MethodInfo are handed out by reference (getVirtualTable) std::deque stubs; - llvm::SmallVector virtualTable; + llvm::SmallVector virtualTable; auto result = newInterfacePtr->getVirtualTable( virtualTable, [&](mlir::Attribute id, mlir::Type fieldType, bool isConditional) -> std::pair { @@ -743,7 +743,7 @@ namespace mlirgen auto tupleStorageType = mlir::cast(mth.convertConstTupleTypeToTupleType(storeType)); - SmallVector virtualTable; + SmallVector virtualTable; auto result = getInterfaceVirtualTableForObject(location, tupleStorageType, newInterfacePtr, virtualTable); if (mlir::failed(result)) {