[swift-dev] Adding a field to StrongRefCount class

Jiho Choi jray319 at gmail.com
Thu Oct 12 14:29:21 CDT 2017

Now I am finally able to build the Swift runtime with an extended object
header and run some benchmarks.  For future reference, in addition to
making changes similar to the commits which Greg pointed to, I needed to
change the Foundation library's CFRuntimeBase class which mirrors the
Swift's object header layout.

On Thu, Sep 28, 2017 at 11:52 PM Greg Parker <gparker at apple.com> wrote:

> On Sep 27, 2017, at 10:39 AM, John McCall via swift-dev <
> swift-dev at swift.org> wrote:
> On Sep 27, 2017, at 1:24 PM, Jiho Choi <jray319 at gmail.com> wrote:
> Thanks for the explanation.  I modified those two locations you mentioned
> but the build failed during tests.  I've been browsing the source code to
> figure out other dependences but didn't succeed yet.  Could you please give
> me some pointers on where to look at?
> You'll have to look at the test failures individually.  If they're just
> IRGen tests failing because the IR no longer matches the current output,
> then you need to either fix the tests or just ignore them for the purposes
> of your experiment.  If they're IRGen tests failing because the compiler is
> crashing, or execution tests failing because the running code is crashing,
> it's likely that I just forgot something that depends on the output.  We're
> not going to be able to debug this problem for you in the abstract, though.
> You should look at pull requests #7837 and #9214:
> https://github.com/apple/swift/pull/7837
> https://github.com/apple/swift/pull/9214
> #7837 the object header size on 32-bit architectures. The PR is not
> currently up-to-date, but should give you an idea of the scope of changes
> that would be necessary for your experiment. #9214 is an addition after
> #7837 that would also be affected by a header size change.
> Another approach for experimental purposes is to modify StrongRefCount
> without changing its size. That struct is designed to store some data
> inline, and if necessary can transform into an out-of-line form that stores
> data of any size.
> You could change the arrangement of bits in the StrongRefCount inline form
> if you only need a few bits for your storage.
> Or you could force StrongRefCount to always use the out-of-line form and
> store whatever data you want there. This would be slower but probably fine
> for experimentation.
> --
> Greg Parker     gparker at apple.com     Runtime Wrangler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20171012/67550cbd/attachment.html>

More information about the swift-dev mailing list