ASM Bytecode Generation to unwrap Expressions of adv-expr API #94

Merged
CommanderTvis merged 44 commits from adv-expr into adv-expr 2020-06-13 21:07:15 +03:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit fec8c7f9d1 - Show all commits

View File

@ -11,7 +11,7 @@ interface AsmExpression<T> {
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
fun invoke(gen: AsmGenerationContext<T>)
}
internal val methodNameAdapters = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
private val methodNameAdapters: Map<String, String> = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
internal fun <T> hasSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
val aName = methodNameAdapters[name] ?: name
@ -137,7 +137,9 @@ internal class AsmConstProductExpression<T>(
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
gen.visitAlgebraOperation(
owner = AsmGenerationContext.SPACE_OPERATIONS_CLASS,
method = "multiply",
descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.NUMBER_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};"
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};" +
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
"L${AsmGenerationContext.NUMBER_CLASS};)" +
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
"L${AsmGenerationContext.OBJECT_CLASS};"
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
)
}
}

altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 19:27:11 +03:00 (Migrated from github.com)
Review

Add documentation since the interface is public.

Add documentation since the interface is public.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
altavir commented 2020-06-13 20:02:04 +03:00 (Migrated from github.com)
Review

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 `operator`? It seems that it should be renamed to `compile`. Those method need to be documented as well.
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:12 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
CommanderTvis commented 2020-06-13 20:03:14 +03:00 (Migrated from github.com)
Review

OK

OK
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.
altavir commented 2020-06-13 20:05:35 +03:00 (Migrated from github.com)
Review

It seems like compile is a better name.

It seems like `compile` is a better name.

View File

@ -2,7 +2,7 @@ package scientifik.kmath.expressions
import scientifik.kmath.operations.*
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, val expr: Expression<T>) :
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, private val expr: Expression<T>) :
Expression<T> {
override fun invoke(arguments: Map<String, T>): T = context.unaryOperation(name, expr.invoke(arguments))
}