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

Fix Factory createInstance for class types on linux platforms #95

Merged
merged 2 commits into from Jul 16, 2021

Conversation

Supereg
Copy link
Contributor

@Supereg Supereg commented Jul 1, 2021

My comment in #49 (comment) explains the issue and how to resolve (to my understanding and knowledge) in detail.

The changes in this PR have proven to be working: see GitHub CI Run (Note this run includes the PRs #93 and #94)

This PR makes two adjustments to the createClass method:

  • It fixes the discussed alignmentMask property passed to the Swift Runtime
  • It replaces let instanceSize = Int32(md.pointer.pointee.classSize) with let instanceSize = Int32(md.pointer.pointee.instanceSize)
    To my knowledge and careful reading through the Class Metadata Layout docs to me, using .classSize here seems wrong. The value is not constant across platforms while instanceSize is. I'm not really an expert with the Swift Runtime, so feel free to correct me if I'm wrong.

Further, this PR reenables some tests cases which were previously skipped on linux platforms (which allowed for this issue being unnoticed).

@wickwirew wickwirew merged commit 2f63210 into wickwirew:master Jul 16, 2021
@PSchmiedmayer PSchmiedmayer mentioned this pull request Nov 2, 2021
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.

None yet

2 participants