[swift-dev] Starter bug: SR-2875 Emit objc_allocWithZone(cls) instead of [cls allocWithZone:nil]

Greg Parker 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]
https://bugs.swift.org/browse/SR-2875

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:
https://bugs.swift.org/issues/?jql=status%20%3D%20Open%20AND%20labels%20%3D%20StarterBug%20AND%20assignee%20in%20(EMPTY)


-- 
Greg Parker     gparker at apple.com     Runtime Wrangler




More information about the swift-dev mailing list