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

Code inlining and jvm-target #81

Closed
altavir opened this issue Jun 8, 2020 · 8 comments
Closed

Code inlining and jvm-target #81

altavir opened this issue Jun 8, 2020 · 8 comments
Assignees
Labels
bug Installation and functionality issues

Comments

@altavir
Copy link
Contributor

altavir commented Jun 8, 2020

I just encountered the following error:

Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8

Obviously, the kernel uses JVM 8 as a target and if the library targets 11, there will be problems with inlining. There are several ways to address the problem. There could be a switch in the configuration, or it could use current JDK target as default or both.

@ileasile
Copy link
Collaborator

ileasile commented Jun 8, 2020

What are you trying to do? We have a gradle option to change a target for kernel (see #39), will it help you if the kernel will be built with 11 target?

@altavir
Copy link
Contributor Author

altavir commented Jun 8, 2020

I tried to use a library with inline methods which were built with jvmTarget="11". Now I understand that it is not a simple problem, we usually can't control the target of libraries we use in the notebook and it is quite possible that some of those will be built with different targets.

@altavir
Copy link
Contributor Author

altavir commented Jun 8, 2020

image
I've explicitly checked that the java version is 11. This version of plotly.kt is built with jvmTarget ="11".

@ileasile
Copy link
Collaborator

ileasile commented Jun 8, 2020

Could you please share your notebook (here or in JB Slack direct messages)? I think I know where this error goes from, need to check it.

@ileasile ileasile added the bug Installation and functionality issues label Jun 8, 2020
@ileasile
Copy link
Collaborator

ileasile commented Jun 9, 2020

Could you please try kernel version (from dev channel) 0.8.1.40.dev7?

@altavir
Copy link
Contributor Author

altavir commented Jun 9, 2020

It works for 0.8.1.40.dev7

ileasile added a commit that referenced this issue Jul 14, 2020
They are available in notebook via JavaRuntimeUtils object.
Note that snippets compilation target is set by current
runtime version, it was done in previous commits.

Relates to #81
@ileasile
Copy link
Collaborator

I've added a possibility to assert version in the notebook like that:

JavaRuntimeUtils.assertVersionAtLeast(11)

More version utils are available via JavaRuntimeUtils object.

Also, JVM target for snippets is now set to current JRE version. So, the issue should be fixed now.

@phiSgr
Copy link

phiSgr commented Apr 12, 2024

Also, JVM target for snippets is now set to current JRE version. So, the issue should be fixed now.

Can it be currentJavaVersion.coerceAtMost(max of JvmTarget supported by compiler)?

If I run Kotlin Jupyter on Java 22, JVM target 22 (class file version 66) is unsupported by current Kotlin compiler, so it defaults to 1.8. And I will still get Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Installation and functionality issues
Projects
None yet
Development

No branches or pull requests

3 participants