From 5ca897bd501e4b9a3a1b130bc9ec95243a4804a0 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 5 May 2018 09:08:48 +0200 Subject: prog: remove ReturnArg It's not all that needed. --- prog/encodingexec.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'prog/encodingexec.go') diff --git a/prog/encodingexec.go b/prog/encodingexec.go index ea01560d9..4085262a9 100644 --- a/prog/encodingexec.go +++ b/prog/encodingexec.go @@ -153,7 +153,10 @@ func (p *Prog) SerializeForExec(buffer []byte) (int, error) { // Generate the call itself. w.write(uint64(c.Meta.ID)) if isUsed(c.Ret) { - w.args[c.Ret] = argInfo{Idx: copyoutSeq} + if _, ok := w.args[c.Ret]; ok { + panic("argInfo is already created for return value") + } + w.args[c.Ret] = argInfo{Idx: copyoutSeq, Ret: true} w.write(copyoutSeq) copyoutSeq++ } else { @@ -169,11 +172,12 @@ func (p *Prog) SerializeForExec(buffer []byte) (int, error) { return } switch arg.(type) { - case *ReturnArg: - // Idx is already assigned above. case *ConstArg, *ResultArg: // Create a separate copyout instruction that has own Idx. info := w.args[arg] + if info.Ret { + break // Idx is already assigned above. + } info.Idx = copyoutSeq copyoutSeq++ w.args[arg] = info @@ -210,6 +214,7 @@ type execContext struct { type argInfo struct { Addr uint64 // physical addr Idx uint64 // copyout instruction index + Ret bool } func (w *execContext) write(v uint64) { -- cgit mrf-deployment