diff --git a/Makefile b/Makefile index c5e8fd97..134dc8e5 100644 --- a/Makefile +++ b/Makefile @@ -2,4 +2,9 @@ .PHONY: antlr antlr: @cd internal/parser && \ - antlr4 -Dlanguage=Go -no-visitor -package parsing ./neva.g4 -o generated \ No newline at end of file + antlr4 -Dlanguage=Go -no-visitor -package parsing ./neva.g4 -o generated + +# generate go sdk from ir proto +.PHONY: irproto +irproto: + @protoc --go_out=pkg/ir ./api/ir.proto \ No newline at end of file diff --git a/api/ir.proto b/api/ir.proto new file mode 100644 index 00000000..8b963872 --- /dev/null +++ b/api/ir.proto @@ -0,0 +1,63 @@ +syntax = "proto3"; + +package ir; + +option go_package = "pkg/ir"; + +message LLProgram { + repeated PortInfo ports = 1; + repeated LLConnection net = 2; + repeated LLFunc funcs = 3; +} + +message PortInfo { + LLPortAddr portAddr = 1; + uint32 bufSize = 2; +} + +message LLPortAddr { + string path = 1; + string port = 2; + uint32 idx = 3; +} + +message LLConnection { + LLPortAddr senderSide = 1; + repeated LLReceiverConnectionSide receiverSides = 2; +} + +message LLReceiverConnectionSide { + LLPortAddr portAddr = 1; + repeated string selectors = 2; +} + +message LLFunc { + LLFuncRef ref = 1; + LLFuncIO io = 2; + LLMsg params = 3; +} + +message LLFuncRef { + string pkg = 1; + string name = 2; +} + +message LLFuncIO { + repeated LLPortAddr in = 1; + repeated LLPortAddr out = 2; +} + +message LLMsg { + LLMsgType type = 1; + bool bool = 2; + int64 int = 3; + double float = 4; + string str = 5; +} + +enum LLMsgType { + LLBoolMsg = 0; + LLIntMsg = 1; + LLFloatMsg = 2; + LLStrMsg = 3; +} diff --git a/cmd/interpreter/main.go b/cmd/interpreter/main.go index 9eb02930..bb6f5229 100644 --- a/cmd/interpreter/main.go +++ b/cmd/interpreter/main.go @@ -11,33 +11,9 @@ import ( "golang.org/x/exp/slog" ) -var prog = ` -use { - std io -} - -types { - MyInt int - MyFloat float - MyStr str - MyBool bool -} - -interfaces { - IReader(path string) (i int, e err) - IWriter(path) (i int, anything) -} - -components { - Main(enter) (exit) { - net { - in.enter -> out.exit - } - } -} -` - func main() { + prog, err := os.ReadFile(os.Args[1]) + logger := slog.New(slog.NewJSONHandler(os.Stdout, nil)) connector, err := runtime.NewDefaultConnector(runtime.DefaultInterceptor{}) diff --git a/go.mod b/go.mod index 3be83cc8..00cffe3e 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,8 @@ require ( github.com/stretchr/testify v1.8.1 ) +require google.golang.org/protobuf v1.31.0 // indirect + require ( github.com/antlr4-go/antlr/v4 v4.13.0 github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index 0ee070c6..0942131d 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ 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= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -40,7 +42,11 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/compiler/highlevel.go b/internal/compiler/highlevel.go index 4059731f..75794572 100644 --- a/internal/compiler/highlevel.go +++ b/internal/compiler/highlevel.go @@ -82,13 +82,11 @@ type Msg struct { } type MsgValue struct { - TypeExpr ts.Expr // type of the message - Bool bool // only for messages with `bool` type - Int int // only for messages with `int` type - Float float64 // only for messages with `float` type - Str string // only for messages with `str` type - Vec []Msg // only for types with `vec` type - Map map[string]Msg // only for types with `map` type + TypeExpr ts.Expr + Bool bool + Int int + Float float64 + Str string } type IO struct { diff --git a/internal/interpreter/interpreter.go b/internal/interpreter/interpreter.go index 818c8a9b..d9dfafe2 100644 --- a/internal/interpreter/interpreter.go +++ b/internal/interpreter/interpreter.go @@ -5,26 +5,27 @@ import ( "github.com/nevalang/neva/internal/runtime" "github.com/nevalang/neva/internal/shared" + ir "github.com/nevalang/neva/pkg/ir/api" "github.com/nevalang/neva/pkg/tools" ) type Interpreter struct { - parser Parser - irgen LowLvlGenerator - transformer Transformer - runtime Runtime + parser SourceCodeParser + irgen IRGenerator + rtgen RuntimeProgramGenerator + runtime Runtime } -type Parser interface { +type SourceCodeParser interface { Parse(context.Context, []byte) (map[string]shared.File, error) } -type LowLvlGenerator interface { - Generate(context.Context, map[string]shared.File) (shared.LLProgram, error) +type IRGenerator interface { + Generate(context.Context, map[string]shared.File) (*ir.LLProgram, error) } -type Transformer interface { - Transform(context.Context, shared.LLProgram) (runtime.Program, error) +type RuntimeProgramGenerator interface { + Transform(context.Context, *ir.LLProgram) (runtime.Program, error) } type Runtime interface { @@ -42,7 +43,7 @@ func (i Interpreter) Interpret(ctx context.Context, bb []byte) (int, error) { return 0, err } - rprog, err := i.transformer.Transform(ctx, ll) + rprog, err := i.rtgen.Transform(ctx, ll) if err != nil { return 0, err } @@ -56,16 +57,16 @@ func (i Interpreter) Interpret(ctx context.Context, bb []byte) (int, error) { } func MustNew( - parser Parser, - irgen LowLvlGenerator, - transformer Transformer, + parser SourceCodeParser, + irgen IRGenerator, + transformer RuntimeProgramGenerator, runtime Runtime, ) Interpreter { tools.NilPanic(parser, irgen, transformer, runtime) return Interpreter{ - parser: parser, - irgen: irgen, - transformer: transformer, - runtime: runtime, + parser: parser, + irgen: irgen, + rtgen: transformer, + runtime: runtime, } } diff --git a/internal/interpreter/transformer.go b/internal/interpreter/transformer.go index 98bc060c..af997cc3 100644 --- a/internal/interpreter/transformer.go +++ b/internal/interpreter/transformer.go @@ -4,19 +4,19 @@ import ( "context" "github.com/nevalang/neva/internal/runtime" - "github.com/nevalang/neva/internal/shared" + ir "github.com/nevalang/neva/pkg/ir/api" ) type transformer struct{} -func (t transformer) Transform(ctx context.Context, ll shared.LLProgram) (runtime.Program, error) { +func (t transformer) Transform(ctx context.Context, ll *ir.LLProgram) (runtime.Program, error) { rPorts := make(runtime.Ports, len(ll.Ports)) - for addr, buf := range ll.Ports { + for _, portInfo := range ll.Ports { rPorts[runtime.PortAddr{ - Path: addr.Path, - Port: addr.Port, - Idx: addr.Idx, - }] = make(chan runtime.Msg, buf) + Path: portInfo.PortAddr.Path, + Port: portInfo.PortAddr.Port, + Idx: uint8(portInfo.PortAddr.Idx), + }] = make(chan runtime.Msg, portInfo.BufSize) } rConns := make([]runtime.Connection, len(ll.Net)) @@ -24,7 +24,7 @@ func (t transformer) Transform(ctx context.Context, ll shared.LLProgram) (runtim senderAddr := runtime.PortAddr{ Path: conn.SenderSide.Path, Port: conn.SenderSide.Port, - Idx: conn.SenderSide.Idx, + Idx: uint8(conn.SenderSide.Idx), } senderPort, ok := rPorts[senderAddr] @@ -44,7 +44,7 @@ func (t transformer) Transform(ctx context.Context, ll shared.LLProgram) (runtim receiverPortAddr := runtime.PortAddr{ Path: rcvr.PortAddr.Path, Port: rcvr.PortAddr.Port, - Idx: rcvr.PortAddr.Idx, + Idx: uint8(rcvr.PortAddr.Idx), } receiverPort, ok := rPorts[receiverPortAddr] @@ -69,22 +69,22 @@ func (t transformer) Transform(ctx context.Context, ll shared.LLProgram) (runtim rFuncs := make([]runtime.FuncRoutine, len(ll.Funcs)) for _, f := range ll.Funcs { - rIOIn := make(map[string][]chan runtime.Msg, len(f.IO.In)) - for _, addr := range f.IO.In { + rIOIn := make(map[string][]chan runtime.Msg, len(f.Io.In)) + for _, addr := range f.Io.In { rPort := rPorts[runtime.PortAddr{ Path: addr.Path, Port: addr.Port, - Idx: addr.Idx, + Idx: uint8(addr.Idx), }] rIOIn[addr.Port] = append(rIOIn[addr.Port], rPort) } - rIOOut := make(map[string][]chan runtime.Msg, len(f.IO.Out)) - for _, addr := range f.IO.Out { + rIOOut := make(map[string][]chan runtime.Msg, len(f.Io.Out)) + for _, addr := range f.Io.Out { rPort := rPorts[runtime.PortAddr{ Path: addr.Path, Port: addr.Port, - Idx: addr.Idx, + Idx: uint8(addr.Idx), }] rIOOut[addr.Port] = append(rIOOut[addr.Port], rPort) } @@ -111,17 +111,17 @@ func (t transformer) Transform(ctx context.Context, ll shared.LLProgram) (runtim }, nil } -func (t transformer) msg(msg shared.LLMsg) runtime.Msg { +func (t transformer) msg(msg *ir.LLMsg) runtime.Msg { var rMsg runtime.Msg switch msg.Type { - case shared.LLBoolMsg: + case ir.LLMsgType_LLBoolMsg: rMsg = runtime.NewBoolMsg(msg.Bool) - case shared.LLIntMsg: + case ir.LLMsgType_LLIntMsg: rMsg = runtime.NewIntMsg(msg.Int) - case shared.LLFloatMsg: + case ir.LLMsgType_LLFloatMsg: rMsg = runtime.NewFloatMsg(msg.Float) - case shared.LLStrMsg: + case ir.LLMsgType_LLStrMsg: rMsg = runtime.NewStrMsg(msg.Str) default: panic("unknown message type") diff --git a/internal/irgen/irgen.go b/internal/irgen/irgen.go index b4286a4e..0e030d09 100644 --- a/internal/irgen/irgen.go +++ b/internal/irgen/irgen.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/nevalang/neva/internal/shared" + ir "github.com/nevalang/neva/pkg/ir/api" ) type Generator struct{} @@ -22,9 +23,9 @@ var ( ErrNodeSlotsCountNotFound = errors.New("node slots count not found") ) -func (g Generator) Generate(ctx context.Context, pkgs map[string]shared.File) (shared.LLProgram, error) { +func (g Generator) Generate(ctx context.Context, pkgs map[string]shared.File) (*ir.LLProgram, error) { if len(pkgs) == 0 { - return shared.LLProgram{}, ErrNoPkgs + return nil, ErrNoPkgs } rootNodeCtx := nodeContext{ @@ -40,14 +41,14 @@ func (g Generator) Generate(ctx context.Context, pkgs map[string]shared.File) (s }, } - result := shared.LLProgram{ - Ports: map[shared.LLPortAddr]uint8{}, - Net: []shared.LLConnection{}, - Funcs: []shared.LLFunc{}, + result := &ir.LLProgram{ + Ports: []*ir.PortInfo{}, + Net: []*ir.LLConnection{}, + Funcs: []*ir.LLFunc{}, } - if err := g.processNode(ctx, rootNodeCtx, pkgs, &result); err != nil { - return shared.LLProgram{}, fmt.Errorf("process root node: %w", err) + if err := g.processNode(ctx, rootNodeCtx, pkgs, result); err != nil { + return nil, fmt.Errorf("process root node: %w", err) } return result, nil @@ -73,7 +74,7 @@ func (g Generator) processNode( ctx context.Context, nodeCtx nodeContext, pkgs map[string]shared.File, - result *shared.LLProgram, + result *ir.LLProgram, ) error { entity, err := g.lookupEntity(pkgs, nodeCtx.entityRef) if err != nil { @@ -87,12 +88,12 @@ func (g Generator) processNode( if len(component.Net) == 0 { result.Funcs = append( result.Funcs, - shared.LLFunc{ - Ref: shared.LLFuncRef{ + &ir.LLFunc{ + Ref: &ir.LLFuncRef{ Pkg: nodeCtx.entityRef.Pkg, Name: nodeCtx.entityRef.Name, }, - IO: shared.LLFuncIO{ + Io: &ir.LLFuncIO{ In: inportAddrs, Out: outPortAddrs, }, @@ -136,7 +137,7 @@ func (g Generator) insertConnectionsAndReturnIOUsage( pkgs map[string]shared.File, conns []shared.Connection, nodeCtx nodeContext, - result *shared.LLProgram, + result *ir.LLProgram, ) (map[string]nodeIOUsage, error) { nodesIOUsage := map[string]nodeIOUsage{} inPortsSlotsSet := map[shared.PortAddr]bool{} @@ -154,16 +155,16 @@ func (g Generator) insertConnectionsAndReturnIOUsage( // we assume every sender is unique thus we don't increment same addr twice nodesIOUsage[senderPortAddr.Node].out[senderPortAddr.Port]++ // fixme why we assume that? - senderSide := shared.LLPortAddr{ + senderSide := ir.LLPortAddr{ Path: nodeCtx.path + "/" + conn.SenderSide.PortAddr.Node, Port: conn.SenderSide.PortAddr.Port, - Idx: conn.SenderSide.PortAddr.Idx, + Idx: uint32(conn.SenderSide.PortAddr.Idx), } - receiverSides := make([]shared.LLReceiverConnectionSide, 0, len(conn.ReceiverSides)) + receiverSides := make([]*ir.LLReceiverConnectionSide, 0, len(conn.ReceiverSides)) for _, receiverSide := range conn.ReceiverSides { irSide := g.mapReceiverConnectionSide(nodeCtx.path, receiverSide) - receiverSides = append(receiverSides, irSide) + receiverSides = append(receiverSides, &irSide) // we can have same receiver for different senders and we don't want to count it twice if !inPortsSlotsSet[receiverSide.PortAddr] { @@ -174,8 +175,8 @@ func (g Generator) insertConnectionsAndReturnIOUsage( } } - result.Net = append(result.Net, shared.LLConnection{ - SenderSide: senderSide, + result.Net = append(result.Net, &ir.LLConnection{ + SenderSide: &senderSide, ReceiverSides: receiverSides, }) } @@ -185,19 +186,22 @@ func (g Generator) insertConnectionsAndReturnIOUsage( func (Generator) insertAndReturnInports( nodeCtx nodeContext, - result *shared.LLProgram, -) []shared.LLPortAddr { - inports := make([]shared.LLPortAddr, 0, len(nodeCtx.ioUsage.in)) + result *ir.LLProgram, +) []*ir.LLPortAddr { + inports := make([]*ir.LLPortAddr, 0, len(nodeCtx.ioUsage.in)) // in valid program all inports are used, so it's safe to depend on nodeCtx and not use component's IO // actually we can't use IO because we need to know how many slots are used for addr := range nodeCtx.ioUsage.in { - addr := shared.LLPortAddr{ + addr := &ir.LLPortAddr{ Path: nodeCtx.path + "/in", Port: addr.Port, - Idx: addr.Idx, + Idx: uint32(addr.Idx), } - result.Ports[addr] = 0 + result.Ports = append(result.Ports, &ir.PortInfo{ + PortAddr: addr, + BufSize: 0, + }) inports = append(inports, addr) } @@ -207,9 +211,9 @@ func (Generator) insertAndReturnInports( func (Generator) insertAndReturnOutports( outports map[string]shared.Port, nodeCtx nodeContext, - result *shared.LLProgram, -) []shared.LLPortAddr { - runtimeFuncOutportAddrs := make([]shared.LLPortAddr, 0, len(nodeCtx.ioUsage.out)) + result *ir.LLProgram, +) []*ir.LLPortAddr { + runtimeFuncOutportAddrs := make([]*ir.LLPortAddr, 0, len(nodeCtx.ioUsage.out)) for name := range outports { slotsCount, ok := nodeCtx.ioUsage.out[name] @@ -218,12 +222,15 @@ func (Generator) insertAndReturnOutports( } for i := 0; i < int(slotsCount); i++ { - addr := shared.LLPortAddr{ + addr := &ir.LLPortAddr{ Path: nodeCtx.path + "/out", Port: name, - Idx: uint8(i), + Idx: uint32(i), } - result.Ports[addr] = 0 + result.Ports = append(result.Ports, &ir.PortInfo{ + PortAddr: addr, + BufSize: 0, + }) runtimeFuncOutportAddrs = append(runtimeFuncOutportAddrs, addr) } } @@ -246,16 +253,16 @@ func (Generator) lookupEntity(pkgs map[string]shared.File, ref shared.EntityRef) } type handleSenderSideResult struct { - irConnSide shared.LLPortAddr + irConnSide ir.LLPortAddr } // mapReceiverConnectionSide maps compiler connection side to ir connection side 1-1 just making the port addr's path absolute -func (g Generator) mapReceiverConnectionSide(nodeCtxPath string, side shared.ReceiverConnectionSide) shared.LLReceiverConnectionSide { - return shared.LLReceiverConnectionSide{ - PortAddr: shared.LLPortAddr{ +func (g Generator) mapReceiverConnectionSide(nodeCtxPath string, side shared.ReceiverConnectionSide) ir.LLReceiverConnectionSide { + return ir.LLReceiverConnectionSide{ + PortAddr: &ir.LLPortAddr{ Path: nodeCtxPath + "/" + side.PortAddr.Node, Port: side.PortAddr.Port, - Idx: side.PortAddr.Idx, + Idx: uint32(side.PortAddr.Idx), }, Selectors: side.Selectors, } diff --git a/internal/runtime/msg.go b/internal/runtime/msg.go index e70ebfb8..54183d33 100644 --- a/internal/runtime/msg.go +++ b/internal/runtime/msg.go @@ -10,7 +10,7 @@ import ( type Msg interface { fmt.Stringer Bool() bool - Int() int + Int() int64 Float() float64 Str() string Vec() []Msg @@ -22,7 +22,7 @@ type Msg interface { type emptyMsg struct{} func (emptyMsg) Bool() bool { return false } -func (emptyMsg) Int() int { return 0 } +func (emptyMsg) Int() int64 { return 0 } func (emptyMsg) Float() float64 { return 0 } func (emptyMsg) Str() string { return "" } func (emptyMsg) Vec() []Msg { return []Msg{} } @@ -33,13 +33,13 @@ func (emptyMsg) String() string { return "stringer not implemented" } type IntMsg struct { emptyMsg - v int + v int64 } -func (msg IntMsg) Int() int { return msg.v } +func (msg IntMsg) Int() int64 { return msg.v } func (msg IntMsg) String() string { return strconv.Itoa(int(msg.v)) } -func NewIntMsg(n int) IntMsg { +func NewIntMsg(n int64) IntMsg { return IntMsg{ emptyMsg: emptyMsg{}, v: n, @@ -53,7 +53,7 @@ type FloatMsg struct { v float64 } -func (msg IntMsg) FloatMsg() int { return msg.v } +func (msg FloatMsg) FloatMsg() float64 { return msg.v } func NewFloatMsg(n float64) FloatMsg { return FloatMsg{ diff --git a/internal/runtime/runtime.go b/internal/runtime/runtime.go index 4bf88720..e637c8d6 100644 --- a/internal/runtime/runtime.go +++ b/internal/runtime/runtime.go @@ -76,11 +76,11 @@ func (r Runtime) Run(ctx context.Context, prog Program) (code int, err error) { startPort <- emptyMsg{} }() - var exitCode int + var exitCode int64 go func() { exitCode = (<-exitPort).Int() cancel() }() - return exitCode, g.Wait() + return int(exitCode), g.Wait() } diff --git a/internal/shared/lowlevel.go b/internal/shared/lowlevel.go deleted file mode 100644 index fe631a10..00000000 --- a/internal/shared/lowlevel.go +++ /dev/null @@ -1,61 +0,0 @@ -package shared - -// IDEA use json/protobuf strings for unmarshalling - -type LLProgram struct { - Ports map[LLPortAddr]uint8 // uint8 for slots usage - Net []LLConnection - Funcs []LLFunc -} - -type LLPortAddr struct { - Path string // Path to node - Port string // Name of the port - Idx uint8 // Slot index of the port -} - -type LLConnection struct { - SenderSide LLPortAddr - ReceiverSides []LLReceiverConnectionSide -} - -type LLReceiverConnectionSide struct { - PortAddr LLPortAddr - Selectors []string -} - -// LLFunc is a instantiation object that runtime will use to spawn a function -type LLFunc struct { - Ref LLFuncRef // runtime will use this reference to find the function to spawn - IO LLFuncIO // this is the ports function will use to receive and send data - Params LLMsg // function can receive predefined message at instantiation time -} - -type LLFuncRef struct { - Pkg, Name string -} - -type LLFuncIO struct { - In, Out []LLPortAddr -} - -type LLMsg struct { - Type LLMsgType - Bool bool - Int int - Float float64 - Str string - Vec []string // ordered list of msg refs - Map map[string]string // key -> msg ref -} - -type LLMsgType uint8 - -const ( - LLBoolMsg LLMsgType = iota + 1 - LLIntMsg - LLFloatMsg - LLStrMsg - LLVecMsg - LLMapMsg -) diff --git a/pkg/ir/api/ir.pb.go b/pkg/ir/api/ir.pb.go new file mode 100644 index 00000000..c0998998 --- /dev/null +++ b/pkg/ir/api/ir.pb.go @@ -0,0 +1,865 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.24.3 +// source: api/ir.proto + +package ir + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LLMsgType int32 + +const ( + LLMsgType_LLBoolMsg LLMsgType = 0 + LLMsgType_LLIntMsg LLMsgType = 1 + LLMsgType_LLFloatMsg LLMsgType = 2 + LLMsgType_LLStrMsg LLMsgType = 3 +) + +// Enum value maps for LLMsgType. +var ( + LLMsgType_name = map[int32]string{ + 0: "LLBoolMsg", + 1: "LLIntMsg", + 2: "LLFloatMsg", + 3: "LLStrMsg", + } + LLMsgType_value = map[string]int32{ + "LLBoolMsg": 0, + "LLIntMsg": 1, + "LLFloatMsg": 2, + "LLStrMsg": 3, + } +) + +func (x LLMsgType) Enum() *LLMsgType { + p := new(LLMsgType) + *p = x + return p +} + +func (x LLMsgType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LLMsgType) Descriptor() protoreflect.EnumDescriptor { + return file_api_ir_proto_enumTypes[0].Descriptor() +} + +func (LLMsgType) Type() protoreflect.EnumType { + return &file_api_ir_proto_enumTypes[0] +} + +func (x LLMsgType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LLMsgType.Descriptor instead. +func (LLMsgType) EnumDescriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{0} +} + +type LLProgram struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ports []*PortInfo `protobuf:"bytes,1,rep,name=ports,proto3" json:"ports,omitempty"` + Net []*LLConnection `protobuf:"bytes,2,rep,name=net,proto3" json:"net,omitempty"` + Funcs []*LLFunc `protobuf:"bytes,3,rep,name=funcs,proto3" json:"funcs,omitempty"` +} + +func (x *LLProgram) Reset() { + *x = LLProgram{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLProgram) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLProgram) ProtoMessage() {} + +func (x *LLProgram) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLProgram.ProtoReflect.Descriptor instead. +func (*LLProgram) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{0} +} + +func (x *LLProgram) GetPorts() []*PortInfo { + if x != nil { + return x.Ports + } + return nil +} + +func (x *LLProgram) GetNet() []*LLConnection { + if x != nil { + return x.Net + } + return nil +} + +func (x *LLProgram) GetFuncs() []*LLFunc { + if x != nil { + return x.Funcs + } + return nil +} + +type PortInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PortAddr *LLPortAddr `protobuf:"bytes,1,opt,name=portAddr,proto3" json:"portAddr,omitempty"` + BufSize uint32 `protobuf:"varint,2,opt,name=bufSize,proto3" json:"bufSize,omitempty"` +} + +func (x *PortInfo) Reset() { + *x = PortInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PortInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PortInfo) ProtoMessage() {} + +func (x *PortInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PortInfo.ProtoReflect.Descriptor instead. +func (*PortInfo) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{1} +} + +func (x *PortInfo) GetPortAddr() *LLPortAddr { + if x != nil { + return x.PortAddr + } + return nil +} + +func (x *PortInfo) GetBufSize() uint32 { + if x != nil { + return x.BufSize + } + return 0 +} + +type LLPortAddr struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Port string `protobuf:"bytes,2,opt,name=port,proto3" json:"port,omitempty"` + Idx uint32 `protobuf:"varint,3,opt,name=idx,proto3" json:"idx,omitempty"` +} + +func (x *LLPortAddr) Reset() { + *x = LLPortAddr{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLPortAddr) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLPortAddr) ProtoMessage() {} + +func (x *LLPortAddr) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLPortAddr.ProtoReflect.Descriptor instead. +func (*LLPortAddr) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{2} +} + +func (x *LLPortAddr) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *LLPortAddr) GetPort() string { + if x != nil { + return x.Port + } + return "" +} + +func (x *LLPortAddr) GetIdx() uint32 { + if x != nil { + return x.Idx + } + return 0 +} + +type LLConnection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderSide *LLPortAddr `protobuf:"bytes,1,opt,name=senderSide,proto3" json:"senderSide,omitempty"` + ReceiverSides []*LLReceiverConnectionSide `protobuf:"bytes,2,rep,name=receiverSides,proto3" json:"receiverSides,omitempty"` +} + +func (x *LLConnection) Reset() { + *x = LLConnection{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLConnection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLConnection) ProtoMessage() {} + +func (x *LLConnection) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLConnection.ProtoReflect.Descriptor instead. +func (*LLConnection) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{3} +} + +func (x *LLConnection) GetSenderSide() *LLPortAddr { + if x != nil { + return x.SenderSide + } + return nil +} + +func (x *LLConnection) GetReceiverSides() []*LLReceiverConnectionSide { + if x != nil { + return x.ReceiverSides + } + return nil +} + +type LLReceiverConnectionSide struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PortAddr *LLPortAddr `protobuf:"bytes,1,opt,name=portAddr,proto3" json:"portAddr,omitempty"` + Selectors []string `protobuf:"bytes,2,rep,name=selectors,proto3" json:"selectors,omitempty"` +} + +func (x *LLReceiverConnectionSide) Reset() { + *x = LLReceiverConnectionSide{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLReceiverConnectionSide) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLReceiverConnectionSide) ProtoMessage() {} + +func (x *LLReceiverConnectionSide) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLReceiverConnectionSide.ProtoReflect.Descriptor instead. +func (*LLReceiverConnectionSide) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{4} +} + +func (x *LLReceiverConnectionSide) GetPortAddr() *LLPortAddr { + if x != nil { + return x.PortAddr + } + return nil +} + +func (x *LLReceiverConnectionSide) GetSelectors() []string { + if x != nil { + return x.Selectors + } + return nil +} + +type LLFunc struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ref *LLFuncRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + Io *LLFuncIO `protobuf:"bytes,2,opt,name=io,proto3" json:"io,omitempty"` + Params *LLMsg `protobuf:"bytes,3,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *LLFunc) Reset() { + *x = LLFunc{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLFunc) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLFunc) ProtoMessage() {} + +func (x *LLFunc) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLFunc.ProtoReflect.Descriptor instead. +func (*LLFunc) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{5} +} + +func (x *LLFunc) GetRef() *LLFuncRef { + if x != nil { + return x.Ref + } + return nil +} + +func (x *LLFunc) GetIo() *LLFuncIO { + if x != nil { + return x.Io + } + return nil +} + +func (x *LLFunc) GetParams() *LLMsg { + if x != nil { + return x.Params + } + return nil +} + +type LLFuncRef struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pkg string `protobuf:"bytes,1,opt,name=pkg,proto3" json:"pkg,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *LLFuncRef) Reset() { + *x = LLFuncRef{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLFuncRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLFuncRef) ProtoMessage() {} + +func (x *LLFuncRef) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLFuncRef.ProtoReflect.Descriptor instead. +func (*LLFuncRef) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{6} +} + +func (x *LLFuncRef) GetPkg() string { + if x != nil { + return x.Pkg + } + return "" +} + +func (x *LLFuncRef) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type LLFuncIO struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + In []*LLPortAddr `protobuf:"bytes,1,rep,name=in,proto3" json:"in,omitempty"` + Out []*LLPortAddr `protobuf:"bytes,2,rep,name=out,proto3" json:"out,omitempty"` +} + +func (x *LLFuncIO) Reset() { + *x = LLFuncIO{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLFuncIO) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLFuncIO) ProtoMessage() {} + +func (x *LLFuncIO) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLFuncIO.ProtoReflect.Descriptor instead. +func (*LLFuncIO) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{7} +} + +func (x *LLFuncIO) GetIn() []*LLPortAddr { + if x != nil { + return x.In + } + return nil +} + +func (x *LLFuncIO) GetOut() []*LLPortAddr { + if x != nil { + return x.Out + } + return nil +} + +type LLMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type LLMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=ir.LLMsgType" json:"type,omitempty"` + Bool bool `protobuf:"varint,2,opt,name=bool,proto3" json:"bool,omitempty"` + Int int64 `protobuf:"varint,3,opt,name=int,proto3" json:"int,omitempty"` + Float float64 `protobuf:"fixed64,4,opt,name=float,proto3" json:"float,omitempty"` + Str string `protobuf:"bytes,5,opt,name=str,proto3" json:"str,omitempty"` +} + +func (x *LLMsg) Reset() { + *x = LLMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_api_ir_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LLMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LLMsg) ProtoMessage() {} + +func (x *LLMsg) ProtoReflect() protoreflect.Message { + mi := &file_api_ir_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LLMsg.ProtoReflect.Descriptor instead. +func (*LLMsg) Descriptor() ([]byte, []int) { + return file_api_ir_proto_rawDescGZIP(), []int{8} +} + +func (x *LLMsg) GetType() LLMsgType { + if x != nil { + return x.Type + } + return LLMsgType_LLBoolMsg +} + +func (x *LLMsg) GetBool() bool { + if x != nil { + return x.Bool + } + return false +} + +func (x *LLMsg) GetInt() int64 { + if x != nil { + return x.Int + } + return 0 +} + +func (x *LLMsg) GetFloat() float64 { + if x != nil { + return x.Float + } + return 0 +} + +func (x *LLMsg) GetStr() string { + if x != nil { + return x.Str + } + return "" +} + +var File_api_ir_proto protoreflect.FileDescriptor + +var file_api_ir_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, + 0x69, 0x72, 0x22, 0x75, 0x0a, 0x09, 0x4c, 0x4c, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, + 0x22, 0x0a, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, + 0x2e, 0x69, 0x72, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x70, 0x6f, + 0x72, 0x74, 0x73, 0x12, 0x22, 0x0a, 0x03, 0x6e, 0x65, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x03, 0x6e, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x05, 0x66, 0x75, 0x6e, 0x63, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x46, 0x75, + 0x6e, 0x63, 0x52, 0x05, 0x66, 0x75, 0x6e, 0x63, 0x73, 0x22, 0x50, 0x0a, 0x08, 0x50, 0x6f, 0x72, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x50, + 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x66, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x07, 0x62, 0x75, 0x66, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x46, 0x0a, 0x0a, 0x4c, + 0x4c, 0x50, 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x72, + 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, + 0x69, 0x64, 0x78, 0x22, 0x82, 0x01, 0x0a, 0x0c, 0x4c, 0x4c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x0a, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, + 0x50, 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, 0x52, 0x0a, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x53, 0x69, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, + 0x53, 0x69, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x72, + 0x2e, 0x4c, 0x4c, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x64, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x65, 0x72, 0x53, 0x69, 0x64, 0x65, 0x73, 0x22, 0x64, 0x0a, 0x18, 0x4c, 0x4c, 0x52, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x69, 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x50, 0x6f, + 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x6a, + 0x0a, 0x06, 0x4c, 0x4c, 0x46, 0x75, 0x6e, 0x63, 0x12, 0x1f, 0x0a, 0x03, 0x72, 0x65, 0x66, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x46, 0x75, 0x6e, + 0x63, 0x52, 0x65, 0x66, 0x52, 0x03, 0x72, 0x65, 0x66, 0x12, 0x1c, 0x0a, 0x02, 0x69, 0x6f, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x46, 0x75, 0x6e, + 0x63, 0x49, 0x4f, 0x52, 0x02, 0x69, 0x6f, 0x12, 0x21, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x4d, + 0x73, 0x67, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x31, 0x0a, 0x09, 0x4c, 0x4c, + 0x46, 0x75, 0x6e, 0x63, 0x52, 0x65, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x6b, 0x67, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x6b, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4c, 0x0a, + 0x08, 0x4c, 0x4c, 0x46, 0x75, 0x6e, 0x63, 0x49, 0x4f, 0x12, 0x1e, 0x0a, 0x02, 0x69, 0x6e, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x50, 0x6f, 0x72, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x03, 0x6f, 0x75, 0x74, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x50, 0x6f, + 0x72, 0x74, 0x41, 0x64, 0x64, 0x72, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x22, 0x78, 0x0a, 0x05, 0x4c, + 0x4c, 0x4d, 0x73, 0x67, 0x12, 0x21, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x69, 0x72, 0x2e, 0x4c, 0x4c, 0x4d, 0x73, 0x67, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x69, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x69, 0x6e, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x66, 0x6c, + 0x6f, 0x61, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x73, 0x74, 0x72, 0x2a, 0x46, 0x0a, 0x09, 0x4c, 0x4c, 0x4d, 0x73, 0x67, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4c, 0x4c, 0x42, 0x6f, 0x6f, 0x6c, 0x4d, 0x73, 0x67, 0x10, + 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4c, 0x49, 0x6e, 0x74, 0x4d, 0x73, 0x67, 0x10, 0x01, 0x12, + 0x0e, 0x0a, 0x0a, 0x4c, 0x4c, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x10, 0x02, 0x12, + 0x0c, 0x0a, 0x08, 0x4c, 0x4c, 0x53, 0x74, 0x72, 0x4d, 0x73, 0x67, 0x10, 0x03, 0x42, 0x08, 0x5a, + 0x06, 0x70, 0x6b, 0x67, 0x2f, 0x69, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_ir_proto_rawDescOnce sync.Once + file_api_ir_proto_rawDescData = file_api_ir_proto_rawDesc +) + +func file_api_ir_proto_rawDescGZIP() []byte { + file_api_ir_proto_rawDescOnce.Do(func() { + file_api_ir_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_ir_proto_rawDescData) + }) + return file_api_ir_proto_rawDescData +} + +var file_api_ir_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_ir_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_api_ir_proto_goTypes = []interface{}{ + (LLMsgType)(0), // 0: ir.LLMsgType + (*LLProgram)(nil), // 1: ir.LLProgram + (*PortInfo)(nil), // 2: ir.PortInfo + (*LLPortAddr)(nil), // 3: ir.LLPortAddr + (*LLConnection)(nil), // 4: ir.LLConnection + (*LLReceiverConnectionSide)(nil), // 5: ir.LLReceiverConnectionSide + (*LLFunc)(nil), // 6: ir.LLFunc + (*LLFuncRef)(nil), // 7: ir.LLFuncRef + (*LLFuncIO)(nil), // 8: ir.LLFuncIO + (*LLMsg)(nil), // 9: ir.LLMsg +} +var file_api_ir_proto_depIdxs = []int32{ + 2, // 0: ir.LLProgram.ports:type_name -> ir.PortInfo + 4, // 1: ir.LLProgram.net:type_name -> ir.LLConnection + 6, // 2: ir.LLProgram.funcs:type_name -> ir.LLFunc + 3, // 3: ir.PortInfo.portAddr:type_name -> ir.LLPortAddr + 3, // 4: ir.LLConnection.senderSide:type_name -> ir.LLPortAddr + 5, // 5: ir.LLConnection.receiverSides:type_name -> ir.LLReceiverConnectionSide + 3, // 6: ir.LLReceiverConnectionSide.portAddr:type_name -> ir.LLPortAddr + 7, // 7: ir.LLFunc.ref:type_name -> ir.LLFuncRef + 8, // 8: ir.LLFunc.io:type_name -> ir.LLFuncIO + 9, // 9: ir.LLFunc.params:type_name -> ir.LLMsg + 3, // 10: ir.LLFuncIO.in:type_name -> ir.LLPortAddr + 3, // 11: ir.LLFuncIO.out:type_name -> ir.LLPortAddr + 0, // 12: ir.LLMsg.type:type_name -> ir.LLMsgType + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_api_ir_proto_init() } +func file_api_ir_proto_init() { + if File_api_ir_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_ir_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLProgram); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PortInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLPortAddr); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLConnection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLReceiverConnectionSide); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLFunc); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLFuncRef); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLFuncIO); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_ir_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LLMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_ir_proto_rawDesc, + NumEnums: 1, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_ir_proto_goTypes, + DependencyIndexes: file_api_ir_proto_depIdxs, + EnumInfos: file_api_ir_proto_enumTypes, + MessageInfos: file_api_ir_proto_msgTypes, + }.Build() + File_api_ir_proto = out.File + file_api_ir_proto_rawDesc = nil + file_api_ir_proto_goTypes = nil + file_api_ir_proto_depIdxs = nil +}