ASM Bytecode Generation to unwrap Expressions of adv-expr API #94
@ -11,37 +11,6 @@ interface AsmExpression<T> {
|
|||||||
|
|||||||
fun invoke(gen: AsmGenerationContext<T>)
|
fun invoke(gen: AsmGenerationContext<T>)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val methodNameAdapters: Map<String, String> = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
internal fun <T> hasSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
val aName = methodNameAdapters[name] ?: name
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
context::class.memberFunctions.find { it.name == aName && it.parameters.size == arity }
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
?: return false
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
return true
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
}
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
internal fun <T> AsmGenerationContext<T>.tryInvokeSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
val aName = methodNameAdapters[name] ?: name
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
context::class.memberFunctions.find { it.name == aName && it.parameters.size == arity }
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
?: return false
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
val owner = context::class.jvmName.replace('.', '/')
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
val sig = buildString {
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
append('(')
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
repeat(arity) { append("L${AsmGenerationContext.OBJECT_CLASS};") }
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
append(')')
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
append("L${AsmGenerationContext.OBJECT_CLASS};")
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
}
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
visitAlgebraOperation(owner = owner, method = aName, descriptor = sig)
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
return true
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
}
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
|
|
||||||
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
It seems like It seems like `compile` is a better name.
|
|||||||
internal class AsmUnaryOperation<T>(private val context: Algebra<T>, private val name: String, expr: AsmExpression<T>) :
|
internal class AsmUnaryOperation<T>(private val context: Algebra<T>, private val name: String, expr: AsmExpression<T>) :
|
||||||
AsmExpression<T> {
|
AsmExpression<T> {
|
||||||
private val expr: AsmExpression<T> = expr.optimize()
|
private val expr: AsmExpression<T> = expr.optimize()
|
||||||
|
|||||||
Add documentation since the interface is public. Add documentation since the interface is public.
Add documentation since the interface is public. Add documentation since the interface is public.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
does it make sense to do invoke without does it make sense to do invoke without `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
OK OK
OK OK
OK OK
OK OK
It seems like It seems like `compile` is a better name.
It seems like It seems like `compile` is a better name.
|
@ -1,5 +1,40 @@
|
|||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
OK OK
|
|||||||
package scientifik.kmath.asm
|
package scientifik.kmath.asm
|
||||||
|
|
||||||
|
import scientifik.kmath.operations.Algebra
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
import kotlin.reflect.full.memberFunctions
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
import kotlin.reflect.jvm.jvmName
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
private val methodNameAdapters: Map<String, String> = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
internal fun <T> hasSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
val aName = methodNameAdapters[name] ?: name
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
context::class.memberFunctions.find { it.name == aName && it.parameters.size == arity }
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
?: return false
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
return true
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
}
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
internal fun <T> AsmGenerationContext<T>.tryInvokeSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
val aName = methodNameAdapters[name] ?: name
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
context::class.memberFunctions.find { it.name == aName && it.parameters.size == arity }
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
?: return false
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
val owner = context::class.jvmName.replace('.', '/')
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
val sig = buildString {
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
append('(')
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
repeat(arity) { append("L${AsmGenerationContext.OBJECT_CLASS};") }
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
append(')')
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
append("L${AsmGenerationContext.OBJECT_CLASS};")
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
}
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
visitAlgebraOperation(owner = owner, method = aName, descriptor = sig)
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
return true
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
}
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
|
|
||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
|
|||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <T> AsmExpression<T>.optimize(): AsmExpression<T> {
|
internal fun <T> AsmExpression<T>.optimize(): AsmExpression<T> {
|
||||||
val a = tryEvaluate()
|
val a = tryEvaluate()
|
||||||
|
|||||||
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
I suggest to bundle all misc methodsin one file or create I suggest to bundle all misc methodsin one file or create `internal` directory for them to limit their visibility.
OK OK
OK OK
|
Add documentation since the interface is public.
Add documentation since the interface is public.
does it make sense to do invoke without
operator
? It seems that it should be renamed tocompile
. Those method need to be documented as well.does it make sense to do invoke without
operator
? It seems that it should be renamed tocompile
. Those method need to be documented as well.OK
OK
OK
OK
It seems like
compile
is a better name.It seems like
compile
is a better name.