Skip to content

Conversation

@aviroop-123
Copy link
Contributor

@aviroop-123 aviroop-123 requested review from a team as code owners December 15, 2025 21:12
@mpiekutowski mpiekutowski requested review from ddolovov and removed request for mpiekutowski December 15, 2025 22:57
@ddolovov ddolovov requested a review from ivandev0 December 16, 2025 09:58
Copy link
Contributor

@ivandev0 ivandev0 left a comment

Choose a reason for hiding this comment

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

Let's make it slightly different. Please move all these required symbols into PreSerializationNativeSymbols and implement them in PreSerializationNativeSymbols.Impl. You can copy/cut required class and callable ids from KonanSymbols. If something is missing (like InteropFqNames) you can add them in NativeStandardInteropNames (with an additional dependency on :core:compiler.common.native insode ir:backend.common). Maybe there is a better approach than copy paste, but it is better to be commented by someone from the Native team (cc @SvyatoslavScherbina )

@SvyatoslavScherbina
Copy link
Contributor

Maybe there is a better approach than copy paste, but it is better to be commented by someone from the Native team (cc @SvyatoslavScherbina )

Copying is fine with me. Anyway, I need to take a look at what values will need to be copied first to have a real opinion.

Copy link
Contributor

@ivandev0 ivandev0 left a comment

Choose a reason for hiding this comment

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

The change is correct. Just some minor comments.

@aviroop-123 aviroop-123 requested a review from ivandev0 January 12, 2026 20:36
ivandev0
ivandev0 previously approved these changes Jan 13, 2026
Copy link
Contributor

@ivandev0 ivandev0 left a comment

Choose a reason for hiding this comment

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

Everything is fine from my side

@ivandev0
Copy link
Contributor

Please take a look at NativePreSerializationSymbolsTest. Because you moved some symbols to the first stage, you should mark them with special annotations. Please run the test and follow the instructions from the output.

Also, please, rebase your branch on top of fresh master.

@aviroop-123
Copy link
Contributor Author

Please take a look at NativePreSerializationSymbolsTest. Because you moved some symbols to the first stage, you should mark them with special annotations. Please run the test and follow the instructions from the output.

Also, please, rebase your branch on top of fresh master.

Done!

import kotlin.native.internal.ref.releaseExternalRCRef

@ExportForCppRuntime
@PublishedApi
Copy link
Contributor

Choose a reason for hiding this comment

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

Has anything changed in terms of where these symbols can be used (and when corresponding function calls are now emitted)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this change requires updating the ABI dump for the native stdlib, but I don't really understand why these symbols are public now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As Ivan said, I followed the instructions for fixing the NativePreSerializationTest and this change was suggested in the error logs, and it fixed the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ivandev0 Shouldn't it be @UsedFromCompilerGeneratedCode instead of @PublishedApi?

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be @UsedFromCompilerGeneratedCode instead of @PublishedApi?

It is already marked as UsedFromCompilerGeneratedCode, but now we say that this symbol is used on the first compilation stage and so by our rules it requires PublishedApi

Has anything changed in terms of where these symbols can be used (and when corresponding function calls are now emitted)?

No, everything is the same. We just formalized how these symbols can be used.

There will be a change with a new inline mode enabled for klib backends (when inliner works before serialization). We will start to write these symbols into klibs and so all the internal declarations must be marked with PublishedApi.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer these symbols not to become public. Please explore alternatives.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that these symbols are not actually used to create new declarations (at least for the compilation phase before serialization). I think we can simplify some things. Let me check it for a bit and I will come back with a plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ivandev0 Did you figure out something or should I proceed with the current changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

@aviroop-123 Yes, I am working on a fix that will simplify things for you. Please wait a little bit.

Copy link
Contributor

@ivandev0 ivandev0 left a comment

Choose a reason for hiding this comment

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

Please squash all the changes and edit the commit message to reflect the change properly. Also, please rebase on the latest green master (without it I can't run CI to fully check your changes).

@aviroop-123 aviroop-123 force-pushed the minimize-konan-symbols branch from 6f9f8b5 to 5200439 Compare January 19, 2026 21:27
@aviroop-123 aviroop-123 force-pushed the minimize-konan-symbols branch from 5200439 to f1884ae Compare January 19, 2026 21:42
@aviroop-123
Copy link
Contributor Author

Please squash all the changes and edit the commit message to reflect the change properly. Also, please rebase on the latest green master (without it I can't run CI to fully check your changes).

Done!

Copy link
Contributor

@ivandev0 ivandev0 left a comment

Choose a reason for hiding this comment

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

  1. Please run org.jetbrains.kotlin.tools.tests.KlibPublicAPITest and fix the falling nativeStdlib test.
  2. Rebase on master once again because I see that there are conflicts in your branch.
  3. Please change the commit message. It does not reflect that was actually changed (we did not create BaseKonanSymbols).

@ivandev0
Copy link
Contributor

ivandev0 commented Jan 29, 2026

@aviroop-123 I pushed the necessary preparation commits. Please take a look at 767551b. After this commit you don't need createUninitializedInstance, createUninitializedArray, createEmptyString, reinterpret and initInstance symbols on the first stage. Please remove them from PreSerializationNativeSymbols and move back to BackendNativeSymbols.

Also, I didn't find any reasons to move throwNullPointerException. If it is not used, please also move it back with the corresponding change in stdlib files.

@ivandev0
Copy link
Contributor

@aviroop-123 Closing this PR. I fixed the issue in this commit

@ivandev0 ivandev0 closed this Feb 10, 2026
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.

5 participants