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 f4951081b..876e7abe2 100644 --- a/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressions.kt +++ b/kmath-asm/src/main/kotlin/scientifik/kmath/expressions/AsmExpressions.kt @@ -24,17 +24,26 @@ class AsmGenerationContext(classOfT: Class<*>, private val algebra: Algebra = mutableListOf() - private val asmCompiledClassWriter = ClassWriter(0) + private val slashesClassName: String = className.replace(oldChar = '.', newChar = '/') - private val evaluateMethodVisitor: MethodVisitor private val evaluateThisVar: Int = 0 private val evaluateArgumentsVar: Int = 1 - private var evaluateL0: Label + private var maxStack: Int = 0 + private lateinit var constants: MutableList + private lateinit var asmCompiledClassWriter: ClassWriter + private lateinit var evaluateMethodVisitor: MethodVisitor + private lateinit var evaluateL0: Label private lateinit var evaluateL1: Label - var maxStack: Int = 0 init { + start() + } + + fun start() { + constants = mutableListOf() + asmCompiledClassWriter = ClassWriter(0) + maxStack = 0 + asmCompiledClassWriter.visit( V1_8, ACC_PUBLIC or ACC_FINAL or ACC_SUPER,