Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-2875] Emit objc_allocWithZone(cls) instead of [cls allocWithZone:nil] #45469

Closed
gparker42 mannequin opened this issue Oct 6, 2016 · 2 comments
Closed

[SR-2875] Emit objc_allocWithZone(cls) instead of [cls allocWithZone:nil] #45469

gparker42 mannequin opened this issue Oct 6, 2016 · 2 comments
Assignees
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement IRGen LLVM IR generation performance

Comments

@gparker42
Copy link
Mannequin

gparker42 mannequin commented Oct 6, 2016

Previous ID SR-2875
Radar rdar://28642974
Original Reporter @gparker42
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, IRGen, Performance, StarterBug
Assignee @gregomni
Priority Medium

md5: 290b74ceb34276614c4313e6cf1f8348

Issue Description:

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.

@gparker42
Copy link
Mannequin Author

gparker42 mannequin commented Oct 6, 2016

I believe this is all inside getAllocObjectFormalType() and emitObjCAllocObjectCall() in swift/lib/IRGen/GenObjC.cpp.

@modocache
Copy link
Mannequin

modocache mannequin commented Jan 13, 2017

This was done in #5180

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement IRGen LLVM IR generation performance
Projects
None yet
Development

No branches or pull requests

0 participants