mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Distributed] IRGen: Fix loading of the witness tables
The witness table is an array of pointers - `void **`, which means that the list of the witnesses has type of `void ***`. Instead of using result of `emitAddressAtOffset` accessor should set the correct type for the list, which is `void ***` and emit bit a lot for each of the witness table slots. Resolves: rdar://87568630 Resolves: rdar://88340451
This commit is contained in:
@@ -510,15 +510,17 @@ void DistributedAccessor::emitLoadOfWitnessTables(llvm::Value *witnessTables,
|
||||
|
||||
IGF.Builder.emitBlock(contBB);
|
||||
|
||||
witnessTables = IGF.Builder.CreateBitCast(witnessTables, IGM.Int8PtrPtrTy);
|
||||
witnessTables = IGF.Builder.CreateBitCast(witnessTables,
|
||||
IGM.Int8PtrPtrTy->getPointerTo());
|
||||
|
||||
for (unsigned i = 0, n = expectedWitnessTables; i != n; ++i) {
|
||||
auto offset = Size(i * IGM.getPointerSize());
|
||||
auto alignment = IGM.getPointerAlignment();
|
||||
|
||||
auto witnessTableAddr = IGF.emitAddressAtOffset(
|
||||
witnessTables, Offset(offset), IGM.Int8PtrTy, Alignment(alignment));
|
||||
arguments.add(witnessTableAddr.getAddress());
|
||||
witnessTables, Offset(offset), IGM.Int8PtrPtrTy, Alignment(alignment));
|
||||
|
||||
arguments.add(IGF.Builder.CreateLoad(witnessTableAddr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user