mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Concurrency] Make Job/AsyncTask minimally compatible with dispatch object layout
Create a TargetDispatchClassMetadata for Swift metadata that also has a dispatch-compatible vtable. Dispatch leaves room for ObjC class metadata so the two regions don't overlap. (The vtable currently consists of a single dummy entry; this will be filled out later.) Rearrange the Job and AsyncTask hierarchy so that AsyncTask inherits only from Job, which in turn inherits from HeapObject. This gives all Job instances a dispatch-compatible isa field. It also gives them a refcount word, which is wasted on instances that aren't AsyncTask instances. Maybe we can find some use for that space in the future. rdar://75227953
This commit is contained in:
@@ -619,8 +619,10 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
|
||||
SwiftTaskGroupPtrTy = Int8PtrTy; // we pass it opaquely (TaskGroup*)
|
||||
SwiftExecutorPtrTy = SwiftExecutorTy->getPointerTo(DefaultAS);
|
||||
SwiftJobTy = createStructType(*this, "swift.job", {
|
||||
RefCountedStructTy, // object header
|
||||
Int8PtrTy, Int8PtrTy, // SchedulerPrivate
|
||||
SizeTy, // flags
|
||||
Int8PtrTy // execution function pointer
|
||||
FunctionPtrTy, // RunJob/ResumeTask
|
||||
});
|
||||
SwiftJobPtrTy = SwiftJobTy->getPointerTo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user