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-6503] Support realloc() for tail allocated objects #49053

Closed
eeckstein opened this issue Nov 29, 2017 · 1 comment
Closed

[SR-6503] Support realloc() for tail allocated objects #49053

eeckstein opened this issue Nov 29, 2017 · 1 comment
Labels
compiler The Swift compiler in itself duplicate Resolution: Duplicates another issue feature A feature request or implementation SIL standard library Area: Standard library umbrella

Comments

@eeckstein
Copy link
Member

Previous ID SR-6503
Radar None
Original Reporter @eeckstein
Type New Feature
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels New Feature
Assignee None
Priority Medium

md5: 5af6a0c6445f2e995b4d38fd667e94d6

is duplicated by:

  • SR-7545 Swift should support using realloc for tail allocated classes

Issue Description:

We should support using realloc() for increasing the size of tail allocated objects, like an array buffer.

This could be done by introducing a new built-in: Builtin.reallocWithTailElems_n (n == 1, 2, 3)

It’s similar to Builtin.allocWithTailElems_n, but receives the original object reference as an additional (first) parameter.

On the implementation side we could introduce a new instruction realloc_ref, again with an additional operand, which is the reference to the original object.

Obviously there are some restrictions: The original object must be uniquely reference, i.e. must have a reference count of 1 (and no weak/unowned references). All stored properties, including the tail allocated elements, must be bit-wise movable.

The work to do here is:

  • add the new builtins

  • add the new SIL instruction

  • implement the IRGen part of it

  • add a new runtime function swift_reallocObject (similar to swift_allocObject)

@atrick
Copy link
Member

atrick commented May 4, 2018

I'm duping this to a newer bug because the newer bug already has a radar.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added feature A feature request or implementation SIL standard library Area: Standard library umbrella duplicate Resolution: Duplicates another issue and removed new feature labels Jan 29, 2023
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 duplicate Resolution: Duplicates another issue feature A feature request or implementation SIL standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

3 participants