Skip to content

Commit

Permalink
fix Pool + interop, update wasmtime
Browse files Browse the repository at this point in the history
  • Loading branch information
guregu committed Jul 24, 2023
1 parent a509390 commit a77d53e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/trealla-prolog/go
go 1.19

require (
github.com/bytecodealliance/wasmtime-go/v9 v9.0.0
github.com/bytecodealliance/wasmtime-go/v11 v11.0.0
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/bytecodealliance/wasmtime-go/v9 v9.0.0 h1:lkyiPbbo++bSmDyJVxDQwxxaiu3LOFVm0iBHnTS1W5A=
github.com/bytecodealliance/wasmtime-go/v9 v9.0.0/go.mod h1:zpOxt1j5vj44AzXZVhS4H+hr39vMk4hDlyC42kGksbU=
github.com/bytecodealliance/wasmtime-go/v11 v11.0.0 h1:SwLgbjbFpQ1tf5vIbWexaZABezBSL8WmzP+foLyi0lE=
github.com/bytecodealliance/wasmtime-go/v11 v11.0.0/go.mod h1:9btfEuCkOP7EDR9a7LqDXrfQ7dtWeGlDHt3buV5UyjY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
2 changes: 1 addition & 1 deletion trealla/interop.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/binary"
"fmt"

"github.com/bytecodealliance/wasmtime-go/v9"
"github.com/bytecodealliance/wasmtime-go/v11"
)

// Predicate is a Prolog predicate implemented in Go.
Expand Down
Binary file modified trealla/libtpl.wasm
Binary file not shown.
2 changes: 2 additions & 0 deletions trealla/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package trealla

import (
"fmt"
"log"
"runtime"
"sync"
)
Expand Down Expand Up @@ -34,6 +35,7 @@ func NewPool(options ...PoolOption) (*Pool, error) {
if err != nil {
return nil, err
}
log.Println("daddy procs", pl.(*prolog).procs)
pool.canon = pl.(*prolog)
pool.children = make([]*prolog, pool.size)
pool.idle = make(chan *prolog, pool.size)
Expand Down
4 changes: 2 additions & 2 deletions trealla/prolog.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"runtime"
"sync"

"github.com/bytecodealliance/wasmtime-go/v9"
"github.com/bytecodealliance/wasmtime-go/v11"
"golang.org/x/exp/maps"
)

Expand Down Expand Up @@ -207,7 +207,7 @@ func (pl *prolog) init(parent *prolog) error {
pl.mu = new(sync.Mutex)
pl.running = make(map[int32]*query)
pl.spawning = make(map[int32]*query)
pl.procs = maps.Clone(pl.procs)
pl.procs = maps.Clone(parent.procs)
pl.preopen = parent.preopen
pl.dirs = parent.dirs
pl.library = parent.library
Expand Down
6 changes: 5 additions & 1 deletion trealla/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package trealla
import (
_ "embed"

"github.com/bytecodealliance/wasmtime-go/v9"
"github.com/bytecodealliance/wasmtime-go/v11"
)

//go:embed libtpl.wasm
Expand All @@ -23,6 +23,10 @@ func init() {
cfg.SetWasmSIMD(true)
cfg.SetWasmMultiValue(true)
cfg.SetWasmMultiMemory(true)

// libtpl.wasm is built with: -zstack-size=8388608
// cfg.SetMaxWasmStack(8388608)

// cfg.CacheConfigLoadDefault()
wasmEngine = wasmtime.NewEngineWithConfig(cfg)

Expand Down

0 comments on commit a77d53e

Please sign in to comment.