Refactor
This commit is contained in:
parent
b2263b1feb
commit
c26c5bd145
File diff suppressed because one or more lines are too long
@ -1,6 +1,5 @@
|
|||||||
package kscience.kmath.ast
|
package kscience.kmath.ast
|
||||||
|
|
||||||
import binaryen.readBinary
|
|
||||||
import kscience.kmath.operations.*
|
import kscience.kmath.operations.*
|
||||||
|
|
||||||
private const val ARGS_PTR = 0
|
private const val ARGS_PTR = 0
|
||||||
@ -9,7 +8,7 @@ private const val ARGS_SIZE = 1
|
|||||||
public fun compileMstToWasmF64(mst: MST) {
|
public fun compileMstToWasmF64(mst: MST) {
|
||||||
val keys = mutableListOf<String>()
|
val keys = mutableListOf<String>()
|
||||||
|
|
||||||
val bin = with(readBinary(rt)) {
|
val bin = with(binaryen.parseText(INITIAL)) {
|
||||||
fun MST.visit(): binaryen.ExpressionRef = when (this) {
|
fun MST.visit(): binaryen.ExpressionRef = when (this) {
|
||||||
is MST.Symbolic -> {
|
is MST.Symbolic -> {
|
||||||
var idx = keys.indexOf(value)
|
var idx = keys.indexOf(value)
|
||||||
@ -48,7 +47,7 @@ public fun compileMstToWasmF64(mst: MST) {
|
|||||||
mst.visit()
|
mst.visit()
|
||||||
)
|
)
|
||||||
|
|
||||||
setMemory(0, 10000)
|
// setMemory(0, 10000)
|
||||||
addFunctionExport("executable", "executable")
|
addFunctionExport("executable", "executable")
|
||||||
optimize()
|
optimize()
|
||||||
|
|
||||||
@ -58,4 +57,6 @@ public fun compileMstToWasmF64(mst: MST) {
|
|||||||
println(emitText())
|
println(emitText())
|
||||||
emitBinary()
|
emitBinary()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
package kscience.kmath.ast
|
||||||
|
|
||||||
import kscience.kmath.ast.MstExtendedField
|
|
||||||
import kscience.kmath.ast.compileMstToWasmF64
|
|
||||||
import kscience.kmath.operations.invoke
|
import kscience.kmath.operations.invoke
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
@ -9,4 +8,4 @@ internal class Test {
|
|||||||
fun c() {
|
fun c() {
|
||||||
compileMstToWasmF64(MstExtendedField { sin(symbol("x")) })
|
compileMstToWasmF64(MstExtendedField { sin(symbol("x")) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user