diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 15:47:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 15:47:21 +0000 |
commit | adb0401dac41c81571722312d4586b2693f95aa6 (patch) | |
tree | ea2b52e3c258d6b6d9356977c683c7f72a4a5fd5 /libgo/go/exp/eval/func.go | |
parent | 5548ca3540bccbc908a45942896d635ea5f1c23f (diff) | |
download | gcc-adb0401dac41c81571722312d4586b2693f95aa6.zip gcc-adb0401dac41c81571722312d4586b2693f95aa6.tar.gz gcc-adb0401dac41c81571722312d4586b2693f95aa6.tar.bz2 |
Update Go library to r60.
From-SVN: r178910
Diffstat (limited to 'libgo/go/exp/eval/func.go')
-rw-r--r-- | libgo/go/exp/eval/func.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/libgo/go/exp/eval/func.go b/libgo/go/exp/eval/func.go deleted file mode 100644 index cb1b579..0000000 --- a/libgo/go/exp/eval/func.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -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. - f *Frame -} - -type code []func(*Thread) - -func (i code) exec(t *Thread) { - opc := t.pc - t.pc = 0 - l := uint(len(i)) - for t.pc < l { - pc := t.pc - t.pc++ - i[pc](t) - } - t.pc = opc -} - -/* - * Code buffer - */ - -type codeBuf struct { - instrs code -} - -func newCodeBuf() *codeBuf { return &codeBuf{make(code, 0, 16)} } - -func (b *codeBuf) push(instr func(*Thread)) { - b.instrs = append(b.instrs, instr) -} - -func (b *codeBuf) nextPC() uint { return uint(len(b.instrs)) } - -func (b *codeBuf) get() code { - // Freeze this buffer into an array of exactly the right size - a := make(code, len(b.instrs)) - copy(a, b.instrs) - return code(a) -} - -/* - * User-defined functions - */ - -type evalFunc struct { - outer *Frame - frameSize int - code code -} - -func (f *evalFunc) NewFrame() *Frame { return f.outer.child(f.frameSize) } - -func (f *evalFunc) Call(t *Thread) { f.code.exec(t) } |