https://kotlinlang.org logo
Join SlackCommunities
Powered by
# jvm-ir-backend-feedback
  • g

    Grantas33

    03/03/2021, 11:22 PM
    hello, this might be a dumb question, but when compiling project with IR, do all of the libs have to be compiled with IR aswell?
    z
    • 2
    • 1
  • r

    robfletcher

    03/04/2021, 12:31 AM
    I’m seeing an error relating to
    kotlin.Result
    when I enable IR. No other changes. [This line of code](https://github.com/robfletcher/strikt/blob/main/strikt-core/src/main/kotlin/strikt/assertions/Result.kt#L17) starts throwing
    Copy code
    java.lang.ClassCastException: class kotlin.Result$Failure cannot be cast to class kotlin.Result (kotlin.Result$Failure and kotlin.Result are in unnamed module of loader 'app')
    i
    • 2
    • 4
  • a

    Anton Yalyshev [JB]

    03/05/2021, 8:02 AM
    The same issue as in the old BE, but with the different stacktrace: https://youtrack.jetbrains.com/issue/KT-28287#focus=Comments-27-4712502.0-0 [“Show Kotlin bytecode”: “Internal error: null” for inline property delegation from a different file]
    🙏 1
  • g

    gbaldeck

    03/06/2021, 7:28 PM
    I am getting the below error very regularly when I build in IntelliJ with Kotlin 1.4.31 and Compose for desktop 0.4.0-build171. The only way I have found to fix it is to do a gradle clean and build. Is there a way I can get it to go away permanently? It seems to happen only when I edit my composable functions.
    u
    • 2
    • 4
  • a

    Agi Maulana

    03/08/2021, 5:16 AM
    Hello, everyone! My app got an error and the app is an Android app, but I think this is the right channel for this topic. As long as I remember, the last thing I've done that might be contributing to this error is enabling the IR compiler on the Android Studio by the following line
    Copy code
    kotlinOptions.useIR = true
    The view model has a LiveData that hold Kotlin's Result class
    Copy code
    fun doSomething(code: String, price: Long)  {
            repository.doX(code, price)
                    .doOnComplete { _priceSubmission.postValue(Result.success(true)) }
                    .doOnError { _priceSubmission.postValue(Result.failure(it.cause ?: it)) }
                    .fromIo2Ui()
                    .subscribe()
                    .disposeOnCleared()
    }
    and the activity observing it by
    Copy code
    viewModel.priceSubmission.observe(this) { result ->
                if (result.isSuccess) {
                    setResult(RESULT_OK)
                    finish()
                } else {
                    val error = result.exceptionOrNull()
                    if (error is HttpException && error.code() == 400) {
                        showDialog()
                    } else {
                        ToastUtils.showNetworkFailureToast()
                    }
                }
            }
    I got an error on runtime
    Copy code
    java.lang.VerifyError: Bad type on operand stack
    Exception Details:
      Location:
        com/app/package/ui/MyActivity$onCreate$1.onChanged(Lkotlin/Result;)V @31: invokevirtual
      Reason:
        Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'kotlin/Result'
      Current Frame:
        bci: @31
        flags: { }
        locals: { 'com/app/package/ui/MyActivity$onCreate$1', 'kotlin/Result' }
        stack: { 'java/lang/Object' }
      Bytecode:
        0x0000000: 2b59 c600 09b6 001c a700 0557 0112 1eb8
        0x0000010: 0024 2b59 c600 09b6 001c a700 0557 01b6
        0x0000020: 001c b800 2899 0015 2ab4 000d 02b6 002e
        0x0000030: 2ab4 000d b600 31a7 004d 2b59 c600 09b6
        0x0000040: 001c a700 0557 0112 1eb8 0024 2b59 c600
        0x0000050: 09b6 001c a700 0557 01b6 001c b800 354d
        0x0000060: 2cc1 0037 9900 1a2c c000 37b6 003b 1101
        0x0000070: 90a0 000d 2ab4 000d b800 3ea7 0009 b200
        0x0000080: 44b6 0047 b1                           
      Stackmap Table:
        same_locals_1_stack_item_frame(@11,Object[#24])
        same_locals_1_stack_item_frame(@13,Object[#5])
        same_locals_1_stack_item_frame(@29,Object[#24])
        same_locals_1_stack_item_frame(@31,Object[#5])
        same_frame(@58)
        same_locals_1_stack_item_frame(@69,Object[#24])
        same_locals_1_stack_item_frame(@71,Object[#5])
        same_locals_1_stack_item_frame(@87,Object[#24])
        same_locals_1_stack_item_frame(@89,Object[#5])
        append_frame(@126,Object[#76])
        chop_frame(@132,1)
    
    
    	at com.app.package.ui.MyActivity.onCreate(MyActivity.kt:36)
    	at android.app.Activity.performCreate(Activity.java:7136)
    	at android.app.Activity.performCreate(Activity.java:7127)
    The 36th line of
    MyActivity
    is the
    priceSubmission
    observer Is this Kotlin's IR backend issue? Thanks.
    i
    • 2
    • 3
  • r

    ralf

    03/15/2021, 1:14 AM
    I was a little surprised to see that the
    useIR
    flag became a no-op with 1.5. Was this intentional? I’m aware that the new IR backend will be the default with 1.5. But I assumed setting it to false will go back to the old backend (rather than using another property). https://github.com/JetBrains/kotlin/blob/1.5.0-M1/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt#L195-L200
    i
    u
    • 3
    • 3
  • r

    Roland Yeghiazaryan

    03/16/2021, 1:36 PM
    When trying out new IR, should we add
    kotlinOptions.useIR = true
    for every module we have? New IR works fine, no issues so far 👌
    e
    • 2
    • 2
  • e

    eygraber

    03/25/2021, 10:33 PM
    https://youtrack.jetbrains.com/issue/KT-45704
    l
    u
    • 3
    • 11
  • r

    ralf

    03/29/2021, 1:58 PM
    Not gonna lie, it’s quite discouraging if bugs reported for the IR backend over a month ago are targeted to be fixed in
    1.5.20
    rather than the
    1.5.0
    release https://youtrack.jetbrains.com/issue/KT-44891
    i
    e
    +2
    • 5
    • 6
  • w

    wasyl

    03/29/2021, 3:51 PM
    Is JVM IR on by default in 1.5.0-M2?
    r
    • 2
    • 1
  • w

    wasyl

    03/29/2021, 4:09 PM
    In that case I found https://youtrack.jetbrains.com/issue/KT-45760
  • i

    ivan.savytskyi

    03/29/2021, 4:13 PM
    With new backend IR, should kotlinx serialization library be updated to specific version? Getting this crash when run build with IR enabled (Kotlin 1.4.31, Kotlinx serialization 1.0.1)
    w
    r
    l
    • 4
    • 8
  • s

    Steffen Funke

    04/01/2021, 2:29 PM
    Hello, just ran a quick benchmark on a Android Project, Kotlin 1.4.30, and it seems
    useIR
    does slow down the build a bit:
    Copy code
    useIR: false, clean & rebuild:
    1. 41s
    2. 41s
    3. 40s
    
    useIR: true, clean & rebuild:
    1. 44s
    2. 43s
    3. 43s
    Granted, it is only marginal slower since it is also only a relatively small project (single module) - but will it affect larger projects proportionally? Out of curiosity I also tried with
    compose: true
    and was rather disappointed:
    Copy code
    useIR: true, compose: true, clean & rebuild:
    1. 53s
    2. 52s
    3. 52s
    I honestly expected the new Backend to be if anything, then faster than the existing one?
    👍 1
    l
    • 2
    • 1
  • c

    Colton Idle

    04/02/2021, 7:58 PM
    I'm trying to test a fix in 1.5.0 m2 to see if this fixes an issue with IR compiler BUT I can't seem to run it because I use hilt in this project. I just added hilt last week. Hope I don't have to revert it. Searching in kotlinlang slack and on google hasn't gotten me any promising results. Am I missing something simple to just enable hilt working with 1.5+?
    z
    • 2
    • 5
  • h

    hho

    04/07/2021, 10:24 PM
    Not sure if it's a bug in the new backend or in MockK, but it sure is a difference in behavior: This test fails with the new backend and works with the old one.
    🙏 1
    • 1
    • 1
  • z

    Zac Sweers

    04/08/2021, 4:11 AM
    Found a bug with contravariance and intersection types, filed with a repro sample here: https://youtrack.jetbrains.com/issue/KT-45945 https://youtrack.jetbrains.com/issue/KT-45945
    🙏 1
  • r

    ralf

    04/08/2021, 5:52 PM
    We’re running into a crash at runtime with Kotlin 1.5.0-M2 IR enabled. This doesn’t happen with M1, so it’s a new regression. It’s actually also the first runtime crash I’m running into with the IR backend. All other problems were compile time problems. https://youtrack.jetbrains.com/issue/KT-45967
    👍 1
  • m

    marios proto

    04/21/2021, 10:43 AM
    We are having a failure on our CI, running UI tests, only after enabling the useIR option in our 🤖 project. The failure is about a custom rule failing with this
    Copy code
    protected val activity: T by lazy {
    activityRule.activity
    } must not be null
    This is happening somehow else. also, if it helps,
    Copy code
    @JvmField
    @Rule
    var activityRule: SomeActivityTestRule<out T> =
    i
    • 2
    • 1
  • e

    eygraber

    04/29/2021, 3:54 PM
    This is blocking me from updating to 1.5 and it doesn't even have a target fix version 😑 I reported it over a month ago.
  • z

    Zac Sweers

    05/06/2021, 12:56 AM
    I’ve been working on a compiler plugin that hooks in via
    AnalysisHandlerExtension
    , it just generates some extra files and nothing too complicated. It works fine on the old backend, but when IR is enabled it fails somewhere deep in the compiler for reasons that aren’t clear to me. Looking to see if I should file a bug or if there’s something I’m doing wrong using this API.
    Copy code
    Caused by: java.lang.AssertionError: IR backend shouldn't call KotlinTypeMapper.mapType
    Repo is here: https://github.com/ZacSweers/auto-service-kt, stacktrace in thread
    😱 1
    🙏 2
    • 1
    • 2
  • m

    marios proto

    05/07/2021, 4:34 PM
    Hi, I get an internal compiler error to my project right after I updated to 1.5.0 from 1.4.3. The problem seems to be when trying to invoke an extension function with some lambdas as parameters. I opened an issue here https://youtrack.jetbrains.com/issue/KT-46557
  • j

    Jeff Lockhart

    05/15/2021, 3:02 AM
    I get
    IllegalStateException: IrTypeAliasSymbol expected: Unbound public symbol for public kotlinx.coroutines/CancellationException|null[0]
    compiling KMM module for Kotlin/Native with Kotlin 1.5: https://youtrack.jetbrains.com/issue/KT-46697
    a
    • 2
    • 1
  • n

    neworldlt

    06/23/2021, 1:47 PM
    Hello, I found that after 1.5.0 upgrade lambdas are compiled as method, like:
    Copy code
    private static final void setupStrictMode$lambda-2(com.vinted.MDApplication, android.os.strictmode.Violation);
      private static final void safePenaltyListener$lambda-3(com.vinted.MDApplication, android.os.strictmode.Violation);
  • n

    neworldlt

    06/23/2021, 1:47 PM
    Is it a new compiler feature, or JVM 8 support?
    i
    • 2
    • 3
  • j

    Jon Miller

    07/12/2021, 1:13 PM
    This is probably a shot in the dark, but hoping to get some guidance on where to start. I have a plugin into a android map app written in java but the plugin is 100% kotlin. After updating to kotlin 1.5, everything worked fine in debug but in release with obfuscation, got an abstract method error crash. Long story short, setting useoldjvmbackend to true fixes the issue. It would probably be hard to provide a sample repo for this scenario since it's a plugin to a java map app,but I could see someslight differences in the mapping.txt file when using the old jvm backend and the new one. Production wise, can move forward with using 1.5 but sucks to not be able to realize all the improvements the team is making with the new IR.
    u
    • 2
    • 7
  • n

    Nikhilkumar80

    12/09/2021, 8:46 PM
    I see this difference with the way garbage collection is handled after jvm-ir-backend change. In this code,
    println(weakStateRef.get())
    used to return
    null
    prior to upgrading. Now, it is not cleared when `System.gc()`is called. Is this expected?
    Copy code
    data class State(val stateKey: String? = null)
    
    fun func1(newState: State) {
        // do nothing
    }
    
    fun func2() {
        val weakStateRef = WeakReference(State("Foo"))
        func1(weakStateRef.get()!!)
        System.gc()
        println(weakStateRef.get()) // State(stateKey="Foo")
    }
    u
    • 2
    • 2
  • i

    ipe_1221

    01/20/2022, 10:46 AM
    Hi, I’m trying multimodule with kotlinspring but i had an error like this. Help plz…. I'm having this error when I click gradle compileKotlin or gradle build.
    i
    • 2
    • 13
  • v

    vio

    03/30/2022, 10:58 AM
    hi all! not sure if I'm asking in the right channel, but has anyone come across this issue and knows what could cause it? happens when I try running tests.
    Copy code
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007f2734cd8aac, pid=19064, tid=19263
    #
    # JRE version: OpenJDK Runtime Environment Temurin-17.0.2+8 (17.0.2+8) (build 17.0.2+8)
    # Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (17.0.2+8, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
    # Problematic frame:
    # V  [libjvm.so+0x8d8aac]  jni_SetStaticIntField+0x8c
    z
    • 2
    • 5
  • r

    ralf

    02/14/2023, 1:17 AM
    FYI
  • u

    udalov

    05/13/2024, 10:16 AM
    archived the channel