Fix workerAutoreleasePool test on macos_arm64 using __autoreleasing
Also merge `createAutorelease` and `create. There is no need in such separation since it was originally added to prevent optimization `result`'s lifetime. Turned out, it was still happening on Apple Silicon, and only addition of __autoreleasing attribute solves the problem.
This commit is contained in:
committed by
TeamCityServer
parent
4826e3278f
commit
ec23ebd1c5
@@ -6,14 +6,12 @@
|
|||||||
@implementation CreateAutorelease {
|
@implementation CreateAutorelease {
|
||||||
CreateAutoreleaseDeallocated* deallocated;
|
CreateAutoreleaseDeallocated* deallocated;
|
||||||
}
|
}
|
||||||
+(instancetype)create:(CreateAutoreleaseDeallocated*)deallocated {
|
|
||||||
CreateAutorelease* result = [self new];
|
|
||||||
result->deallocated = deallocated;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
+(void)createAutorelease:(CreateAutoreleaseDeallocated*)deallocated {
|
+(void)createAutorelease:(CreateAutoreleaseDeallocated*)deallocated {
|
||||||
[self create:deallocated];
|
// __autoreleasing attribute prevents from early deallocation
|
||||||
|
// and thus makes test behaviour identical on Intel and ARM CPUs.
|
||||||
|
__autoreleasing CreateAutorelease* result = [self new];
|
||||||
|
result->deallocated = deallocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc {
|
-(void)dealloc {
|
||||||
|
|||||||
Reference in New Issue
Block a user