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

simple array buffer #82

Merged
merged 24 commits into from
Jun 22, 2020
Merged

simple array buffer #82

merged 24 commits into from
Jun 22, 2020

Conversation

dabrahams
Copy link
Collaborator

No description provided.

Dave Abrahams added 3 commits June 13, 2020 03:43
These mutation functions allow the buffer's elements to be mutated in place
without incurring spurious CoW.
@marcrasi marcrasi self-requested a review June 17, 2020 23:41
public init<SrcStorage>(_ src: AnyArrayBuffer<SrcStorage>) {
self.storage = unsafeDowncast(src.storage, to: Storage.self)
/// - Requires: `p` is the address of an initialized `ArrayStorage<Element>`.
public static func asStorage(_ p: UnsafeRawPointer) -> ArrayStorage<Element> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is p an UnsafeRawPointer instead of an AnyObject?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly fear of ARC

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should try the AnyObject arrangement and see if it slows anything down. If not, maybe that's better.

Copy link
Collaborator

@marcrasi marcrasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I migrated SwiftFusion to this and it works. A few "feature requests" are in Sources/SwiftFusion/Inference/PenguinExtensions.swift in the migration PR but we can do them in subsequent PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants