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

jextract: Indirect returns and more value type support #211

Merged
merged 14 commits into from
Jan 28, 2025

Conversation

ktoso
Copy link
Collaborator

@ktoso ktoso commented Jan 27, 2025

This includes:

  • handling indirect return in initializers of value types
  • destroy() done in a SwiftArena on value types
  • some other fixes in calling our thunks -- we no longer need the Self.Type in initializers since we started doing thunks for inits.
  • more safety against use-after free with the arena's marking java wrappers as destroyed.

@ktoso ktoso force-pushed the wip-value-type-fixes branch from 44cc1e3 to 5dff5e8 Compare January 27, 2025 14:27
@@ -73,6 +74,34 @@ public enum NominalTypeKind {
case `class`
case `enum`
case `struct`
case `void` // TODO: NOT NOMINAL, BUT...
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll work on removing this NominalTypeKind so we replace it with SwiftNominalTypeDeclaration.Kind but we'll have to do a bit of a dance to pull it off -- perhaps make it optional somehow or enum over "nominal or not nominal" etc

@@ -44,18 +44,19 @@ public struct ImportedNominalType: ImportedDecl {
TranslatedType(
cCompatibleConvention: .direct,
originalSwiftType: "\(raw: swiftTypeName)",
originalSwiftTypeKind: self.kind,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: we'll want to remove this and instead pass around a SwiftNominalTypeDeclaration instead, and base the name and kind off from that.

@ktoso ktoso changed the title Indirect returns and more value type support jextract: Indirect returns and more value type support Jan 27, 2025
@ktoso ktoso force-pushed the wip-value-type-fixes branch from 5dff5e8 to d4b26a9 Compare January 27, 2025 14:57
@@ -274,6 +294,15 @@ enum CCompatibleJavaMemoryLayout: Hashable {
case cFunction
}

enum SwiftTypeKind {
Copy link
Collaborator Author

@ktoso ktoso Jan 27, 2025

Choose a reason for hiding this comment

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

TODO: Working on removing this and converge with the other SwiftNominalTypeDeclaration.Kind in a follow up PR

@ktoso ktoso merged commit 831397d into swiftlang:main Jan 28, 2025
12 checks passed
@ktoso ktoso deleted the wip-value-type-fixes branch January 28, 2025 17:13
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.

1 participant