This commit is contained in:
Iaroslav Postovalov 2020-11-10 17:44:53 +07:00
parent b2263b1feb
commit c26c5bd145
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7
4 changed files with 5055 additions and 5990 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
package kscience.kmath.ast
import binaryen.readBinary
import kscience.kmath.operations.*
private const val ARGS_PTR = 0
@ -9,7 +8,7 @@ private const val ARGS_SIZE = 1
public fun compileMstToWasmF64(mst: MST) {
val keys = mutableListOf<String>()
val bin = with(readBinary(rt)) {
val bin = with(binaryen.parseText(INITIAL)) {
fun MST.visit(): binaryen.ExpressionRef = when (this) {
is MST.Symbolic -> {
var idx = keys.indexOf(value)
@ -48,7 +47,7 @@ public fun compileMstToWasmF64(mst: MST) {
mst.visit()
)
setMemory(0, 10000)
// setMemory(0, 10000)
addFunctionExport("executable", "executable")
optimize()
@ -58,4 +57,6 @@ public fun compileMstToWasmF64(mst: MST) {
println(emitText())
emitBinary()
}
}

View File

@ -1,6 +1,5 @@
package kscience.kmath.ast
import kscience.kmath.ast.MstExtendedField
import kscience.kmath.ast.compileMstToWasmF64
import kscience.kmath.operations.invoke
import kotlin.test.Test
@ -9,4 +8,4 @@ internal class Test {
fun c() {
compileMstToWasmF64(MstExtendedField { sin(symbol("x")) })
}
}
}