Skip to content

Commit

Permalink
Updated documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
markkurossi committed Aug 25, 2023
1 parent bccdf3b commit 9b6314c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/ssa/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewProgram(params *utils.Params, in, out circuit.IO,
Outputs: out,
Constants: consts,
Steps: steps,
walloc: NewWAllocValue(),
walloc: NewWAllocString(),
}

// Inputs into wires.
Expand Down Expand Up @@ -262,6 +262,7 @@ func (prog *Program) DefineConstants(zero, one *circuits.Wire) error {
return nil
}

// StreamDebug print debugging information about streaming mode.
func (prog *Program) StreamDebug() {
prog.walloc.Debug()
}
Expand Down
1 change: 1 addition & 0 deletions compiler/ssa/wire_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/markkurossi/mpc/types"
)

// WireAllocator implements dynamic wire allocation.
type WireAllocator interface {
// Allocated tests if the wires have been allocated for the value.
Allocated(v Value) bool
Expand Down
3 changes: 3 additions & 0 deletions compiler/ssa/wire_allocator_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/markkurossi/mpc/types"
)

// WAllocString implements WireAllocator using Value.String to map
// values to wires.
type WAllocString struct {
freeWires map[types.Size][][]*circuits.Wire
wires map[string]*wireAlloc
Expand All @@ -22,6 +24,7 @@ type WAllocString struct {
flMiss int
}

// NewWAllocString creates a new WAllocString.
func NewWAllocString() WireAllocator {
return &WAllocString{
wires: make(map[string]*wireAlloc),
Expand Down
3 changes: 3 additions & 0 deletions compiler/ssa/wire_allocator_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/markkurossi/mpc/types"
)

// WAllocValue implements WireAllocator using Value.HashCode to map
// values to wires.
type WAllocValue struct {
freeWires map[types.Size][][]*circuits.Wire
wires [10240]*allocByValue
Expand All @@ -35,6 +37,7 @@ func (alloc *allocByValue) String() string {
alloc.base, len(alloc.wires))
}

// NewWAllocValue creates a new WAllocValue.
func NewWAllocValue() WireAllocator {
return &WAllocValue{
freeWires: make(map[types.Size][][]*circuits.Wire),
Expand Down

0 comments on commit 9b6314c

Please sign in to comment.