Skip to content

Commit 63fed20

Browse files
author
Mikhael Bogdanov
committed
Fix VerifyError on android with 'inv' operation on Byte and Short
1 parent 5b44343 commit 63fed20

File tree

1 file changed

+5
-3
lines changed
  • compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics

1 file changed

+5
-3
lines changed

compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/Inv.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ package org.jetbrains.kotlin.codegen.intrinsics
1919
import org.jetbrains.kotlin.codegen.AsmUtil.numberFunctionOperandType
2020
import org.jetbrains.kotlin.codegen.Callable
2121
import org.jetbrains.kotlin.codegen.CallableMethod
22+
import org.jetbrains.kotlin.codegen.StackValue
2223
import org.jetbrains.org.objectweb.asm.Type
2324

2425
class Inv : IntrinsicMethod() {
2526
override fun toCallable(method: CallableMethod): Callable {
26-
val type = numberFunctionOperandType(method.returnType)
27-
return createUnaryIntrinsicCallable(method, newThisType = type) {
27+
val intermediateResultType = numberFunctionOperandType(method.returnType)
28+
return createUnaryIntrinsicCallable(method) {
2829
if (returnType == Type.LONG_TYPE) {
2930
it.lconst(-1)
3031
}
3132
else {
3233
it.iconst(-1)
3334
}
34-
it.xor(returnType)
35+
it.xor(intermediateResultType)
36+
StackValue.coerce(intermediateResultType, returnType, it)
3537
}
3638
}
3739
}

0 commit comments

Comments
 (0)