realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

Support coroutine 1.6.0's freeze transparency

Open rorbech opened this issue 3 years ago • 3 comments

This PR makes our internal freeze calls a no-op when running with Kotlin's new experimental memory model. This way we avoid freezing coroutine primitive to support Coroutine 1.6.0's new freeze transparency.

NOTE: Since ktor 1.6.5 doesn't support that yet the kotlin.native.binary.freezing=disabled is still required for library-sync

rorbech avatar Feb 03 '22 12:02 rorbech

Ah sorry. Missed this was still a draft 🙈 ... Use the comments for what you want.

cmelchior avatar Feb 04 '22 20:02 cmelchior

Ah sorry. Missed this was still a draft 🙈 ... Use the comments for what you want.

Yeah. I didn't settle on whether we should use the new conditional freeze on all our freeze calls. Some of them are actually catching/freezing user provided data. If we used the new variant that only freezes data on the old memory model people could just opt into the new one if it caused troubles for them. So I guess best thing would just be to use the new freeze-variant all over, but wasn't completely ready to do that when I did the PR. Any thoughts?

rorbech avatar Feb 07 '22 08:02 rorbech

  • Is this being tested somehow? I assume not (outside manual testing)? But I guess there is a question about how many different memory models we want to run tests for.

We do a full test suite run with the new memory model, but the interesting parameter is actually the coroutine version. This PR enables us to run with Coroutines 1.6.0's freeze transparency without adding the kotlin.native.binary.freezing=disabled runtime flag (still required for sync as ktor also needs it) because we no-op the freeze outselves.

rorbech avatar Feb 07 '22 08:02 rorbech

Superseded by https://github.com/realm/realm-kotlin/pull/1059

cmelchior avatar Oct 11 '22 13:10 cmelchior