[swift-dev] Starter bug: SR-2875 Emit objc_allocWithZone(cls) instead of [cls allocWithZone:nil]
gparker at apple.com
Wed Oct 5 20:22:59 CDT 2016
A starter bug for someone who wants to dip their toes into the Swift compiler:
SR-2875 Emit objc_allocWithZone(cls) instead of [cls allocWithZone:nil]
swiftc currently emits calls to [cls allocWithZone:nil] when constructing Objective-C objects. It should emit calls to objc_allocWithZone(cls) instead.
objc_allocWithZone() is faster (it avoids a message send when there are no overrides in place) and is a smaller call site.
I believe the code to change is getAllocObjectFormalType() and emitObjCAllocObjectCall() in swift/lib/IRGen/GenObjC.cpp.
Not interested in this bug? We have dozens of other bugs marked "StarterBug" that we expect to be suitable for someone who has not contributed to the Swift project before. You can see the list here:
Greg Parker gparker at apple.com Runtime Wrangler
More information about the swift-dev