JVM_IR, minor: use vals instead of objects

This commit is contained in:
Georgy Bronnikov
2020-08-11 15:15:33 +03:00
parent 6e016ce041
commit f21d8a4c5b
2 changed files with 5 additions and 9 deletions
@@ -113,10 +113,10 @@ class IrIntrinsicMethods(val irBuiltIns: IrBuiltIns, val symbols: JvmSymbols) {
symbols.unsafeCoerceIntrinsic.toKey()!! to UnsafeCoerce, symbols.unsafeCoerceIntrinsic.toKey()!! to UnsafeCoerce,
symbols.signatureStringIntrinsic.toKey()!! to SignatureString, symbols.signatureStringIntrinsic.toKey()!! to SignatureString,
symbols.reassignParameterIntrinsic.toKey()!! to ReassignParameter, symbols.reassignParameterIntrinsic.toKey()!! to ReassignParameter,
symbols.throwNullPointerException.toKey() to ThrowNullPointerException, symbols.throwNullPointerException.toKey()!! to ThrowException(Type.getObjectType("java/lang/NullPointerException")),
symbols.throwTypeCastException.toKey() to ThrowTypeCastException, symbols.throwTypeCastException.toKey()!! to ThrowException(Type.getObjectType("kotlin/TypeCastException")),
symbols.throwUnsupportedOperationException.toKey() to ThrowUnsupportedOperationException, symbols.throwUnsupportedOperationException.toKey()!! to ThrowException(Type.getObjectType("java/lang/UnsupportedOperationException")),
symbols.throwKotlinNothingValueException.toKey()!! to ThrowKotlinNothingValueException symbols.throwKotlinNothingValueException.toKey()!! to ThrowKotlinNothingValueException,
) + ) +
numberConversionMethods() + numberConversionMethods() +
unaryFunForPrimitives("plus", UnaryPlus) + unaryFunForPrimitives("plus", UnaryPlus) +
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression
import org.jetbrains.kotlin.resolve.jvm.AsmTypes import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.Type
abstract class ThrowException(val exceptionClass: Type) : IntrinsicMethod() { class ThrowException(val exceptionClass: Type) : IntrinsicMethod() {
override fun invoke(expression: IrFunctionAccessExpression, codegen: ExpressionCodegen, data: BlockInfo): PromisedValue? { override fun invoke(expression: IrFunctionAccessExpression, codegen: ExpressionCodegen, data: BlockInfo): PromisedValue? {
with(codegen) { with(codegen) {
mv.anew(exceptionClass) mv.anew(exceptionClass)
@@ -25,7 +25,3 @@ abstract class ThrowException(val exceptionClass: Type) : IntrinsicMethod() {
} }
} }
object ThrowNullPointerException : ThrowException(Type.getObjectType("java/lang/NullPointerException"))
object ThrowTypeCastException : ThrowException(Type.getObjectType("kotlin/TypeCastException"))
object ThrowUnsupportedOperationException : ThrowException(Type.getObjectType("java/lang/UnsupportedOperationException"))