diff options
author | Russ Cox <rsc@golang.org> | 2009-09-02 14:11:40 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-09-02 14:11:40 -0700 |
commit | e3144b93290471291b01eaf9b388e51a6ab3714e (patch) | |
tree | 4c6d913b60666f25465e75df6f10897bbd3eb8b6 /usr/austin/eval/func.go | |
parent | 6c38613736071997c30b8d84aaeecd12bb142030 (diff) | |
download | golang-e3144b93290471291b01eaf9b388e51a6ab3714e.tar.gz |
move abortChan into Thread.
reuse Thread in function calls.
R=austin
DELTA=59 (8 added, 7 deleted, 44 changed)
OCL=34266
CL=34266
Diffstat (limited to 'usr/austin/eval/func.go')
-rw-r--r-- | usr/austin/eval/func.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr/austin/eval/func.go b/usr/austin/eval/func.go index d13fbbed4..3bf52871d 100644 --- a/usr/austin/eval/func.go +++ b/usr/austin/eval/func.go @@ -4,11 +4,14 @@ package eval +import "os" + /* * Virtual machine */ type Thread struct { + abort chan os.Error; pc uint; // The execution frame of this function. This remains the // same throughout a function invocation. @@ -18,13 +21,15 @@ type Thread struct { type code []func(*Thread) func (i code) exec(t *Thread) { - v := Thread{0, t.f}; // TODO: reuse t + opc := t.pc; + t.pc = 0; l := uint(len(i)); - for v.pc < l { - pc := v.pc; - v.pc++; - i[pc](&v); + for t.pc < l { + pc := t.pc; + t.pc++; + i[pc](t); } + t.pc = opc; } /* |