diff --git a/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressions.kt b/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressions.kt index b9c357671..36607d2b5 100644 --- a/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressions.kt +++ b/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressions.kt @@ -7,7 +7,6 @@ import org.objectweb.asm.Opcodes.* import scientifik.kmath.operations.Algebra import scientifik.kmath.operations.Field import scientifik.kmath.operations.Space -import java.io.File abstract class AsmCompiled(@JvmField val algebra: Algebra, @JvmField val constants: MutableList) { abstract fun evaluate(arguments: Map): T @@ -223,15 +222,13 @@ class AsmGenerationContext(classOfT: Class<*>, private val algebra: Algebra(classOfT: Class<*>, private val algebra: Algebra { internal class AsmVariableExpression(val name: String, val default: T? = null) : AsmExpression { - override fun invoke(gen: AsmGenerationContext) { - gen.visitLoadFromVariables(name, default) - } + override fun invoke(gen: AsmGenerationContext): Unit = gen.visitLoadFromVariables(name, default) } internal class AsmConstantExpression(val value: T) : AsmExpression { - override fun invoke(gen: AsmGenerationContext) { - gen.visitLoadFromConstants(value) - } + override fun invoke(gen: AsmGenerationContext): Unit = gen.visitLoadFromConstants(value) } internal class AsmSumExpression( @@ -273,7 +267,7 @@ internal class AsmSumExpression( first.invoke(gen) second.invoke(gen) - gen.visitInvokeAlgebraOperation( + gen.visitAlgebraOperation( owner = AsmGenerationContext.SPACE_OPERATIONS_CLASS, method = "add", descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.OBJECT_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};" @@ -290,8 +284,8 @@ internal class AsmProductExpression( first.invoke(gen) second.invoke(gen) - gen.visitInvokeAlgebraOperation( - owner = AsmGenerationContext.SPACE_CLASS, + gen.visitAlgebraOperation( + owner = AsmGenerationContext.SPACE_OPERATIONS_CLASS, method = "times", descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.OBJECT_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};" ) @@ -307,7 +301,7 @@ internal class AsmConstProductExpression( expr.invoke(gen) gen.visitNumberConstant(const) - gen.visitInvokeAlgebraOperation( + gen.visitAlgebraOperation( owner = AsmGenerationContext.SPACE_CLASS, method = "multiply", descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.OBJECT_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};" @@ -324,8 +318,8 @@ internal class AsmDivExpression( expr.invoke(gen) second.invoke(gen) - gen.visitInvokeAlgebraOperation( - owner = AsmGenerationContext.FIELD_CLASS, + gen.visitAlgebraOperation( + owner = AsmGenerationContext.FIELD_OPERATIONS_CLASS, method = "divide", descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.OBJECT_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};" )