aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encodingexec.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-13 20:12:13 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-17 11:39:14 +0100
commit8ef00507063baf3fa681bb53113cb33adda5e4d7 (patch)
tree90f5be39889c5e064c92f16d9649627e84933820 /prog/encodingexec.go
parenteaeccee1d7f7a3f22e842309f21e3b118bd95254 (diff)
prog: don't serialize output data args
Fixes #188 We now will write just ""/1000 to denote a 1000-byte output buffer. Also we now don't store 1000-byte buffer in memory just to denote size. Old format is still parsed.
Diffstat (limited to 'prog/encodingexec.go')
-rw-r--r--prog/encodingexec.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/prog/encodingexec.go b/prog/encodingexec.go
index e45ba1192..937f3c322 100644
--- a/prog/encodingexec.go
+++ b/prog/encodingexec.go
@@ -104,7 +104,8 @@ func (p *Prog) SerializeForExec(buffer []byte, pid int) (int, error) {
if _, ok := arg1.(*UnionArg); ok {
return
}
- if a1, ok := arg1.(*DataArg); ok && len(a1.Data) == 0 {
+ if a1, ok := arg1.(*DataArg); ok &&
+ (a1.Type().Dir() == DirOut || len(a1.Data()) == 0) {
return
}
if !IsPad(arg1.Type()) && arg1.Type().Dir() != DirOut {
@@ -270,16 +271,17 @@ func (w *execContext) writeArg(arg Arg, pid int, csumMap map[Arg]CsumInfo) {
w.write(0) // bit field offset
w.write(0) // bit field length
case *DataArg:
+ data := a.Data()
w.write(ExecArgData)
- w.write(uint64(len(a.Data)))
- padded := len(a.Data)
- if pad := 8 - len(a.Data)%8; pad != 8 {
+ w.write(uint64(len(data)))
+ padded := len(data)
+ if pad := 8 - len(data)%8; pad != 8 {
padded += pad
}
if len(w.buf) < padded {
w.eof = true
} else {
- copy(w.buf, a.Data)
+ copy(w.buf, data)
w.buf = w.buf[padded:]
}
default: