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

Apply kotlinx-atomicfu compiler plugin #4018

Merged
merged 3 commits into from Apr 29, 2024
Merged

Conversation

mvicsokolova
Copy link
Collaborator

@mvicsokolova mvicsokolova commented Apr 4, 2024

Motivation
kotlinx-atomicfu is on the way to stabilization, as the next step I'm going to enable compiler transformations by default with the following getting rid of legacy transformations. For that it would be great to enable compiler plugin transformations in ktor. This PR enables JVM and Kotlin Native IR transformations performed by atomicfu-compiler-plugin.

I've disabled JS IR transformations, for now there is a discussion regarding removal of the JS part of the compiler plugin.

Solution
Minor changes were made in the code:

  • replaced minusAssign/plusAssign operators with addAndGet call, because the operators are not supported by the compiler plugin.
  • introduced atomic extension function to avoid passing atomic reference as a parameter (AtomicRef<*>.setContinuation(..)).
  • atomic properties are recommended to be private, their values may be exposed via delegated properties.

@mvicsokolova mvicsokolova force-pushed the apply-atomicfu-compiler-plugin branch from fdaf524 to 95aa3bd Compare April 15, 2024 18:25
@mvicsokolova mvicsokolova force-pushed the apply-atomicfu-compiler-plugin branch from f7df4d2 to e85ca02 Compare April 16, 2024 04:53
@mvicsokolova mvicsokolova requested a review from e5l April 16, 2024 12:07
@mvicsokolova
Copy link
Collaborator Author

mvicsokolova commented Apr 16, 2024

@e5l Could you please take a look? 🙏🏻

Seems, the in the main branch the same tests are failing.

@mvicsokolova mvicsokolova marked this pull request as ready for review April 16, 2024 12:32
@e5l e5l merged commit d5ae8e5 into main Apr 29, 2024
12 of 16 checks passed
@e5l e5l deleted the apply-atomicfu-compiler-plugin branch April 29, 2024 07:48
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