aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encodingexec.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-05 09:08:48 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-05 09:08:48 +0200
commit5ca897bd501e4b9a3a1b130bc9ec95243a4804a0 (patch)
treeb7d6b332f0961f5a759a507c473f49c0b76d08df /prog/encodingexec.go
parentb438ff23281a55c2976013818179423e732d179f (diff)
prog: remove ReturnArg
It's not all that needed.
Diffstat (limited to 'prog/encodingexec.go')
-rw-r--r--prog/encodingexec.go11
1 files changed, 8 insertions, 3 deletions
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) {