JVM: rename IrIntrinsicFunction -> IntrinsicFunction
To avoid confusion that this might be an IR tree element.
This commit is contained in:
committed by
Space Team
parent
f8faa0fe5a
commit
56ed240774
+2
-2
@@ -28,9 +28,9 @@ object ArrayIterator : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen,
|
classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
val owner = classCodegen.typeMapper.mapClass(expression.symbol.owner.parentAsClass)
|
val owner = classCodegen.typeMapper.mapClass(expression.symbol.owner.parentAsClass)
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen, listOf(owner)) {
|
return IntrinsicFunction.create(expression, signature, classCodegen, listOf(owner)) {
|
||||||
val methodSignature = "(${owner.descriptor})${signature.returnType.descriptor}"
|
val methodSignature = "(${owner.descriptor})${signature.returnType.descriptor}"
|
||||||
val intrinsicOwner =
|
val intrinsicOwner =
|
||||||
if (AsmUtil.isPrimitive(owner.elementType))
|
if (AsmUtil.isPrimitive(owner.elementType))
|
||||||
|
|||||||
+2
-2
@@ -23,8 +23,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
object ArraySize : IntrinsicMethod() {
|
object ArraySize : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
it.arraylength()
|
it.arraylength()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -35,7 +35,7 @@ class BinaryOp(private val opcode: Int) : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
val returnType = signature.returnType
|
val returnType = signature.returnType
|
||||||
val intermediateResultType = numberFunctionOperandType(returnType)
|
val intermediateResultType = numberFunctionOperandType(returnType)
|
||||||
val argTypes = if (!expression.symbol.owner.parentAsClass.defaultType.isChar()) {
|
val argTypes = if (!expression.symbol.owner.parentAsClass.defaultType.isChar()) {
|
||||||
@@ -44,7 +44,7 @@ class BinaryOp(private val opcode: Int) : IntrinsicMethod() {
|
|||||||
listOf(Type.CHAR_TYPE, signature.valueParameters[0].asmType)
|
listOf(Type.CHAR_TYPE, signature.valueParameters[0].asmType)
|
||||||
}
|
}
|
||||||
|
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen, argTypes) {
|
return IntrinsicFunction.create(expression, signature, classCodegen, argTypes) {
|
||||||
it.visitInsn(returnType.getOpcode(opcode))
|
it.visitInsn(returnType.getOpcode(opcode))
|
||||||
StackValue.coerce(intermediateResultType, returnType, it)
|
StackValue.coerce(intermediateResultType, returnType, it)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -32,14 +32,14 @@ object Clone : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
val isSuperCall = expression is IrCall && expression.superQualifierSymbol != null
|
val isSuperCall = expression is IrCall && expression.superQualifierSymbol != null
|
||||||
val opcode = if (isSuperCall) Opcodes.INVOKESPECIAL else Opcodes.INVOKEVIRTUAL
|
val opcode = if (isSuperCall) Opcodes.INVOKESPECIAL else Opcodes.INVOKEVIRTUAL
|
||||||
val newSignature = signature.newReturnType(AsmTypes.OBJECT_TYPE)
|
val newSignature = signature.newReturnType(AsmTypes.OBJECT_TYPE)
|
||||||
val argTypes0 = expression.argTypes(classCodegen)
|
val argTypes0 = expression.argTypes(classCodegen)
|
||||||
// Don't upcast receiver to java.lang.Cloneable, since 'clone' is protected in java.lang.Object.
|
// Don't upcast receiver to java.lang.Cloneable, since 'clone' is protected in java.lang.Object.
|
||||||
val argTypes = if (isSuperCall || argTypes0[0] == CLONEABLE_TYPE) listOf(AsmTypes.OBJECT_TYPE) else argTypes0
|
val argTypes = if (isSuperCall || argTypes0[0] == CLONEABLE_TYPE) listOf(AsmTypes.OBJECT_TYPE) else argTypes0
|
||||||
return IrIntrinsicFunction.create(expression, newSignature, classCodegen, argTypes) { mv ->
|
return IntrinsicFunction.create(expression, newSignature, classCodegen, argTypes) { mv ->
|
||||||
mv.visitMethodInsn(opcode, "java/lang/Object", "clone", "()Ljava/lang/Object;", false)
|
mv.visitMethodInsn(opcode, "java/lang/Object", "clone", "()Ljava/lang/Object;", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -54,14 +54,14 @@ object CompareTo : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
val callee = expression.symbol.owner
|
val callee = expression.symbol.owner
|
||||||
val calleeParameter = callee.dispatchReceiverParameter ?: callee.extensionReceiverParameter!!
|
val calleeParameter = callee.dispatchReceiverParameter ?: callee.extensionReceiverParameter!!
|
||||||
val parameterType = comparisonOperandType(
|
val parameterType = comparisonOperandType(
|
||||||
classCodegen.typeMapper.mapType(calleeParameter.type),
|
classCodegen.typeMapper.mapType(calleeParameter.type),
|
||||||
signature.valueParameters.single().asmType,
|
signature.valueParameters.single().asmType,
|
||||||
)
|
)
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen, listOf(parameterType, parameterType)) {
|
return IntrinsicFunction.create(expression, signature, classCodegen, listOf(parameterType, parameterType)) {
|
||||||
genInvoke(parameterType, it)
|
genInvoke(parameterType, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -160,11 +160,11 @@ class Ieee754Equals(val operandType: Type) : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
class Ieee754AreEqual(
|
class Ieee754AreEqual(
|
||||||
val left: Type,
|
val left: Type,
|
||||||
val right: Type
|
val right: Type
|
||||||
) : IrIntrinsicFunction(expression, signature, classCodegen, listOf(left, right)) {
|
) : IntrinsicFunction(expression, signature, classCodegen, listOf(left, right)) {
|
||||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||||
v.invokestatic(
|
v.invokestatic(
|
||||||
IntrinsicMethods.INTRINSICS_CLASS_NAME, "areEqual",
|
IntrinsicMethods.INTRINSICS_CLASS_NAME, "areEqual",
|
||||||
@@ -197,7 +197,7 @@ class Ieee754Equals(val operandType: Type) : IntrinsicMethod() {
|
|||||||
Ieee754AreEqual(AsmTypes.OBJECT_TYPE, AsmTypes.OBJECT_TYPE)
|
Ieee754AreEqual(AsmTypes.OBJECT_TYPE, AsmTypes.OBJECT_TYPE)
|
||||||
|
|
||||||
!arg0isNullable && !arg1isNullable ->
|
!arg0isNullable && !arg1isNullable ->
|
||||||
object : IrIntrinsicFunction(expression, signature, classCodegen, listOf(operandType, operandType)) {
|
object : IntrinsicFunction(expression, signature, classCodegen, listOf(operandType, operandType)) {
|
||||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||||
StackValue.cmp(KtTokens.EQEQ, operandType, StackValue.onStack(operandType), StackValue.onStack(operandType))
|
StackValue.cmp(KtTokens.EQEQ, operandType, StackValue.onStack(operandType), StackValue.onStack(operandType))
|
||||||
.put(Type.BOOLEAN_TYPE, v)
|
.put(Type.BOOLEAN_TYPE, v)
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
class Increment(private val myDelta: Int) : IntrinsicMethod() {
|
class Increment(private val myDelta: Int) : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
genIncrement(signature.returnType, myDelta, it)
|
genIncrement(signature.returnType, myDelta, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||||
|
|
||||||
abstract class IrIntrinsicFunction(
|
abstract class IntrinsicFunction(
|
||||||
val expression: IrFunctionAccessExpression,
|
val expression: IrFunctionAccessExpression,
|
||||||
val signature: JvmMethodSignature,
|
val signature: JvmMethodSignature,
|
||||||
val classCodegen: ClassCodegen,
|
val classCodegen: ClassCodegen,
|
||||||
@@ -79,9 +79,9 @@ abstract class IrIntrinsicFunction(
|
|||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen,
|
classCodegen: ClassCodegen,
|
||||||
argsTypes: List<Type> = expression.argTypes(classCodegen),
|
argsTypes: List<Type> = expression.argTypes(classCodegen),
|
||||||
invokeInstruction: IrIntrinsicFunction.(InstructionAdapter) -> Unit,
|
invokeInstruction: IntrinsicFunction.(InstructionAdapter) -> Unit,
|
||||||
): IrIntrinsicFunction =
|
): IntrinsicFunction =
|
||||||
object : IrIntrinsicFunction(expression, signature, classCodegen, argsTypes) {
|
object : IntrinsicFunction(expression, signature, classCodegen, argsTypes) {
|
||||||
override fun genInvokeInstruction(v: InstructionAdapter) = invokeInstruction(v)
|
override fun genInvokeInstruction(v: InstructionAdapter) = invokeInstruction(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -17,7 +17,7 @@ abstract class IntrinsicMethod : IntrinsicMarker {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction = TODO("implement toCallable() or invoke() of $this")
|
): IntrinsicFunction = TODO("implement toCallable() or invoke() of $this")
|
||||||
|
|
||||||
open fun invoke(expression: IrFunctionAccessExpression, codegen: ExpressionCodegen, data: BlockInfo): PromisedValue? =
|
open fun invoke(expression: IrFunctionAccessExpression, codegen: ExpressionCodegen, data: BlockInfo): PromisedValue? =
|
||||||
with(codegen) {
|
with(codegen) {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ object IntrinsicShouldHaveBeenLowered : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
error("Intrinsic should have been lowered: '${expression.symbol.owner.render()}'")
|
error("Intrinsic should have been lowered: '${expression.symbol.owner.render()}'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -25,10 +25,10 @@ import org.jetbrains.org.objectweb.asm.Type
|
|||||||
object Inv : IntrinsicMethod() {
|
object Inv : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
val returnType = signature.returnType
|
val returnType = signature.returnType
|
||||||
val type = numberFunctionOperandType(returnType)
|
val type = numberFunctionOperandType(returnType)
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen, listOf(type)) {
|
return IntrinsicFunction.create(expression, signature, classCodegen, listOf(type)) {
|
||||||
if (returnType == Type.LONG_TYPE) {
|
if (returnType == Type.LONG_TYPE) {
|
||||||
it.lconst(-1)
|
it.lconst(-1)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ object IrIllegalArgumentException : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return object : IrIntrinsicFunction(expression, signature, classCodegen, listOf(JAVA_STRING_TYPE)) {
|
return object : IntrinsicFunction(expression, signature, classCodegen, listOf(JAVA_STRING_TYPE)) {
|
||||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||||
v.invokespecial(
|
v.invokespecial(
|
||||||
exceptionTypeDescriptor.internalName,
|
exceptionTypeDescriptor.internalName,
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
object IrNoWhenBranchMatchedException : IntrinsicMethod() {
|
object IrNoWhenBranchMatchedException : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
genThrow(it, "kotlin/NoWhenBranchMatchedException", null)
|
genThrow(it, "kotlin/NoWhenBranchMatchedException", null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ object IsArrayOf : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction = IrIntrinsicFunction.create(expression, signature, classCodegen) { v ->
|
): IntrinsicFunction = IntrinsicFunction.create(expression, signature, classCodegen) { v ->
|
||||||
val arrayType = classCodegen.context.irBuiltIns.arrayClass.typeWith(expression.getTypeArgument(0)!!)
|
val arrayType = classCodegen.context.irBuiltIns.arrayClass.typeWith(expression.getTypeArgument(0)!!)
|
||||||
v.instanceOf(classCodegen.typeMapper.mapType(arrayType))
|
v.instanceOf(classCodegen.typeMapper.mapType(arrayType))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -29,12 +29,12 @@ import org.jetbrains.org.objectweb.asm.Type
|
|||||||
object IteratorNext : IntrinsicMethod() {
|
object IteratorNext : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
// If the array element type is unboxed primitive, do not unbox. Otherwise AsmUtil.unbox throws exception
|
// If the array element type is unboxed primitive, do not unbox. Otherwise AsmUtil.unbox throws exception
|
||||||
val type = if (AsmUtil.isBoxedPrimitiveType(signature.returnType)) AsmUtil.unboxType(signature.returnType) else signature.returnType
|
val type = if (AsmUtil.isBoxedPrimitiveType(signature.returnType)) AsmUtil.unboxType(signature.returnType) else signature.returnType
|
||||||
val newSignature = signature.newReturnType(type)
|
val newSignature = signature.newReturnType(type)
|
||||||
val primitiveClassName = getKotlinPrimitiveClassName(type)
|
val primitiveClassName = getKotlinPrimitiveClassName(type)
|
||||||
return IrIntrinsicFunction.create(expression, newSignature, classCodegen, listOf(getPrimitiveIteratorType(primitiveClassName))) {
|
return IntrinsicFunction.create(expression, newSignature, classCodegen, listOf(getPrimitiveIteratorType(primitiveClassName))) {
|
||||||
it.invokevirtual(
|
it.invokevirtual(
|
||||||
getPrimitiveIteratorType(primitiveClassName).internalName,
|
getPrimitiveIteratorType(primitiveClassName).internalName,
|
||||||
"next${primitiveClassName.asString()}",
|
"next${primitiveClassName.asString()}",
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ class MonitorInstruction private constructor(private val opcode: Int) : Intrinsi
|
|||||||
|
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen, listOf(OBJECT_TYPE)) {
|
return IntrinsicFunction.create(expression, signature, classCodegen, listOf(OBJECT_TYPE)) {
|
||||||
it.visitInsn(opcode)
|
it.visitInsn(opcode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
object NumberCast : IntrinsicMethod() {
|
object NumberCast : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
StackValue.coerce(argsTypes[0], signature.returnType, it)
|
StackValue.coerce(argsTypes[0], signature.returnType, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -17,9 +17,9 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
|||||||
object RangeTo : IntrinsicMethod() {
|
object RangeTo : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
val argType = mapRangeTypeToPrimitiveType(signature.returnType)
|
val argType = mapRangeTypeToPrimitiveType(signature.returnType)
|
||||||
return object : IrIntrinsicFunction(
|
return object : IntrinsicFunction(
|
||||||
expression, signature, classCodegen, listOf(argType) + signature.valueParameters.map { argType }
|
expression, signature, classCodegen, listOf(argType) + signature.valueParameters.map { argType }
|
||||||
) {
|
) {
|
||||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,8 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
|||||||
object RangeUntil : IntrinsicMethod() {
|
object RangeUntil : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return object : IrIntrinsicFunction(expression, signature, classCodegen, expression.argTypes(classCodegen)) {
|
return object : IntrinsicFunction(expression, signature, classCodegen, expression.argTypes(classCodegen)) {
|
||||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||||
v.invokestatic(
|
v.invokestatic(
|
||||||
"kotlin/ranges/RangesKt", "until",
|
"kotlin/ranges/RangesKt", "until",
|
||||||
|
|||||||
+2
-2
@@ -23,8 +23,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
object StringGetChar : IntrinsicMethod() {
|
object StringGetChar : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
it.invokevirtual("java/lang/String", "charAt", "(I)C", false)
|
it.invokevirtual("java/lang/String", "charAt", "(I)C", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -18,8 +18,8 @@ object StringPlus : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction =
|
): IntrinsicFunction =
|
||||||
IrIntrinsicFunction.create(expression, signature, classCodegen, listOf(AsmTypes.JAVA_STRING_TYPE, AsmTypes.OBJECT_TYPE)) {
|
IntrinsicFunction.create(expression, signature, classCodegen, listOf(AsmTypes.JAVA_STRING_TYPE, AsmTypes.OBJECT_TYPE)) {
|
||||||
it.invokestatic(
|
it.invokestatic(
|
||||||
IntrinsicMethods.INTRINSICS_CLASS_NAME,
|
IntrinsicMethods.INTRINSICS_CLASS_NAME,
|
||||||
"stringPlus",
|
"stringPlus",
|
||||||
|
|||||||
+2
-2
@@ -15,8 +15,8 @@ object ThrowKotlinNothingValueException : IntrinsicMethod() {
|
|||||||
expression: IrFunctionAccessExpression,
|
expression: IrFunctionAccessExpression,
|
||||||
signature: JvmMethodSignature,
|
signature: JvmMethodSignature,
|
||||||
classCodegen: ClassCodegen
|
classCodegen: ClassCodegen
|
||||||
): IrIntrinsicFunction =
|
): IntrinsicFunction =
|
||||||
IrIntrinsicFunction.create(expression, signature, classCodegen) { mv ->
|
IntrinsicFunction.create(expression, signature, classCodegen) { mv ->
|
||||||
if (classCodegen.context.state.useKotlinNothingValueException) {
|
if (classCodegen.context.state.useKotlinNothingValueException) {
|
||||||
mv.anew(Type.getObjectType("kotlin/KotlinNothingValueException"))
|
mv.anew(Type.getObjectType("kotlin/KotlinNothingValueException"))
|
||||||
mv.dup()
|
mv.dup()
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
object UnaryMinus : IntrinsicMethod() {
|
object UnaryMinus : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
it.neg(numberFunctionOperandType(signature.returnType))
|
it.neg(numberFunctionOperandType(signature.returnType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -23,8 +23,8 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
|||||||
object UnaryPlus : IntrinsicMethod() {
|
object UnaryPlus : IntrinsicMethod() {
|
||||||
override fun toCallable(
|
override fun toCallable(
|
||||||
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
expression: IrFunctionAccessExpression, signature: JvmMethodSignature, classCodegen: ClassCodegen,
|
||||||
): IrIntrinsicFunction {
|
): IntrinsicFunction {
|
||||||
return IrIntrinsicFunction.create(expression, signature, classCodegen) {
|
return IntrinsicFunction.create(expression, signature, classCodegen) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user