From fbb3d81367a2fdab908bbd5d6e322391de81a972 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 27 Jan 2014 13:11:16 -0500 Subject: [PATCH] go.tools/ssa/interp: add intrinsics for (*sync.Pool).{Get,Put}. Since Put() makes a dynamic function call, this CL includes a long-overdue change to supply a *frame (and thus the call stack and the interpreter) to intrinsics too. This fixes the tests that were broken by (sound) revision e4a4cb47c141. LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/57350043 --- go/ssa/interp/external.go | 385 +++++++++++------------------- go/ssa/interp/external_plan9.go | 28 +-- go/ssa/interp/external_unix.go | 28 +-- go/ssa/interp/external_windows.go | 28 +-- go/ssa/interp/interp.go | 18 +- go/ssa/interp/reflect.go | 78 +++--- 6 files changed, 229 insertions(+), 336 deletions(-) diff --git a/go/ssa/interp/external.go b/go/ssa/interp/external.go index 172294fe..091780d0 100644 --- a/go/ssa/interp/external.go +++ b/go/ssa/interp/external.go @@ -13,105 +13,109 @@ import ( "runtime" "syscall" "time" - - "code.google.com/p/go.tools/go/ssa" ) -type externalFn func(fn *ssa.Function, args []value) value +type externalFn func(fr *frame, args []value) value // TODO(adonovan): fix: reflect.Value abstracts an lvalue or an // rvalue; Set() causes mutations that can be observed via aliases. // We have not captured that correctly here. -// Key strings are from Function.FullName(). -// That little dot ۰ is an Arabic zero numeral (U+06F0), categories [Nd]. -var externals = map[string]externalFn{ - "(*runtime.Func).Entry": ext۰runtime۰Func۰Entry, - "(*runtime.Func).FileLine": ext۰runtime۰Func۰FileLine, - "(*runtime.Func).Name": ext۰runtime۰Func۰Name, - "(reflect.Value).Bool": ext۰reflect۰Value۰Bool, - "(reflect.Value).CanAddr": ext۰reflect۰Value۰CanAddr, - "(reflect.Value).CanInterface": ext۰reflect۰Value۰CanInterface, - "(reflect.Value).Elem": ext۰reflect۰Value۰Elem, - "(reflect.Value).Field": ext۰reflect۰Value۰Field, - "(reflect.Value).Float": ext۰reflect۰Value۰Float, - "(reflect.Value).Index": ext۰reflect۰Value۰Index, - "(reflect.Value).Int": ext۰reflect۰Value۰Int, - "(reflect.Value).Interface": ext۰reflect۰Value۰Interface, - "(reflect.Value).IsNil": ext۰reflect۰Value۰IsNil, - "(reflect.Value).IsValid": ext۰reflect۰Value۰IsValid, - "(reflect.Value).Kind": ext۰reflect۰Value۰Kind, - "(reflect.Value).Len": ext۰reflect۰Value۰Len, - "(reflect.Value).MapIndex": ext۰reflect۰Value۰MapIndex, - "(reflect.Value).MapKeys": ext۰reflect۰Value۰MapKeys, - "(reflect.Value).NumField": ext۰reflect۰Value۰NumField, - "(reflect.Value).NumMethod": ext۰reflect۰Value۰NumMethod, - "(reflect.Value).Pointer": ext۰reflect۰Value۰Pointer, - "(reflect.Value).Set": ext۰reflect۰Value۰Set, - "(reflect.Value).String": ext۰reflect۰Value۰String, - "(reflect.Value).Type": ext۰reflect۰Value۰Type, - "(reflect.Value).Uint": ext۰reflect۰Value۰Uint, - "(reflect.error).Error": ext۰reflect۰error۰Error, - "(reflect.rtype).Bits": ext۰reflect۰rtype۰Bits, - "(reflect.rtype).Elem": ext۰reflect۰rtype۰Elem, - "(reflect.rtype).Field": ext۰reflect۰rtype۰Field, - "(reflect.rtype).Kind": ext۰reflect۰rtype۰Kind, - "(reflect.rtype).NumField": ext۰reflect۰rtype۰NumField, - "(reflect.rtype).NumMethod": ext۰reflect۰rtype۰NumMethod, - "(reflect.rtype).NumOut": ext۰reflect۰rtype۰NumOut, - "(reflect.rtype).Out": ext۰reflect۰rtype۰Out, - "(reflect.rtype).Size": ext۰reflect۰rtype۰Size, - "(reflect.rtype).String": ext۰reflect۰rtype۰String, - "bytes.Equal": ext۰bytes۰Equal, - "bytes.IndexByte": ext۰bytes۰IndexByte, - "hash/crc32.haveSSE42": ext۰crc32۰haveSSE42, - "math.Abs": ext۰math۰Abs, - "math.Exp": ext۰math۰Exp, - "math.Float32bits": ext۰math۰Float32bits, - "math.Float32frombits": ext۰math۰Float32frombits, - "math.Float64bits": ext۰math۰Float64bits, - "math.Float64frombits": ext۰math۰Float64frombits, - "math.Min": ext۰math۰Min, - "reflect.New": ext۰reflect۰New, - "reflect.TypeOf": ext۰reflect۰TypeOf, - "reflect.ValueOf": ext۰reflect۰ValueOf, - "reflect.init": ext۰reflect۰Init, - "reflect.valueInterface": ext۰reflect۰valueInterface, - "runtime.Breakpoint": ext۰runtime۰Breakpoint, - "runtime.Caller": ext۰runtime۰Caller, - "runtime.FuncForPC": ext۰runtime۰FuncForPC, - "runtime.GC": ext۰runtime۰GC, - "runtime.GOMAXPROCS": ext۰runtime۰GOMAXPROCS, - "runtime.Gosched": ext۰runtime۰Gosched, - "runtime.NumCPU": ext۰runtime۰NumCPU, - "runtime.ReadMemStats": ext۰runtime۰ReadMemStats, - "runtime.SetFinalizer": ext۰runtime۰SetFinalizer, - "runtime.getgoroot": ext۰runtime۰getgoroot, - "strings.IndexByte": ext۰strings۰IndexByte, - "sync.runtime_registerPool": ext۰sync۰runtime_registerPool, - "sync.runtime_Syncsemcheck": ext۰sync۰runtime_Syncsemcheck, - "sync/atomic.AddInt32": ext۰atomic۰AddInt32, - "sync/atomic.CompareAndSwapInt32": ext۰atomic۰CompareAndSwapInt32, - "sync/atomic.LoadInt32": ext۰atomic۰LoadInt32, - "sync/atomic.LoadUint32": ext۰atomic۰LoadUint32, - "sync/atomic.StoreInt32": ext۰atomic۰StoreInt32, - "sync/atomic.StoreUint32": ext۰atomic۰StoreUint32, - "syscall.Close": ext۰syscall۰Close, - "syscall.Exit": ext۰syscall۰Exit, - "syscall.Fstat": ext۰syscall۰Fstat, - "syscall.Getpid": ext۰syscall۰Getpid, - "syscall.Getwd": ext۰syscall۰Getwd, - "syscall.Kill": ext۰syscall۰Kill, - "syscall.Lstat": ext۰syscall۰Lstat, - "syscall.Open": ext۰syscall۰Open, - "syscall.ParseDirent": ext۰syscall۰ParseDirent, - "syscall.RawSyscall": ext۰syscall۰RawSyscall, - "syscall.Read": ext۰syscall۰Read, - "syscall.ReadDirent": ext۰syscall۰ReadDirent, - "syscall.Stat": ext۰syscall۰Stat, - "syscall.Write": ext۰syscall۰Write, - "time.Sleep": ext۰time۰Sleep, - "time.now": ext۰time۰now, +// Key strings are from Function.String(). +var externals map[string]externalFn + +func init() { + // That little dot ۰ is an Arabic zero numeral (U+06F0), categories [Nd]. + externals = map[string]externalFn{ + "(*runtime.Func).Entry": ext۰runtime۰Func۰Entry, + "(*runtime.Func).FileLine": ext۰runtime۰Func۰FileLine, + "(*runtime.Func).Name": ext۰runtime۰Func۰Name, + "(*sync.Pool).Get": ext۰sync۰Pool۰Get, + "(*sync.Pool).Put": ext۰sync۰Pool۰Put, + "(reflect.Value).Bool": ext۰reflect۰Value۰Bool, + "(reflect.Value).CanAddr": ext۰reflect۰Value۰CanAddr, + "(reflect.Value).CanInterface": ext۰reflect۰Value۰CanInterface, + "(reflect.Value).Elem": ext۰reflect۰Value۰Elem, + "(reflect.Value).Field": ext۰reflect۰Value۰Field, + "(reflect.Value).Float": ext۰reflect۰Value۰Float, + "(reflect.Value).Index": ext۰reflect۰Value۰Index, + "(reflect.Value).Int": ext۰reflect۰Value۰Int, + "(reflect.Value).Interface": ext۰reflect۰Value۰Interface, + "(reflect.Value).IsNil": ext۰reflect۰Value۰IsNil, + "(reflect.Value).IsValid": ext۰reflect۰Value۰IsValid, + "(reflect.Value).Kind": ext۰reflect۰Value۰Kind, + "(reflect.Value).Len": ext۰reflect۰Value۰Len, + "(reflect.Value).MapIndex": ext۰reflect۰Value۰MapIndex, + "(reflect.Value).MapKeys": ext۰reflect۰Value۰MapKeys, + "(reflect.Value).NumField": ext۰reflect۰Value۰NumField, + "(reflect.Value).NumMethod": ext۰reflect۰Value۰NumMethod, + "(reflect.Value).Pointer": ext۰reflect۰Value۰Pointer, + "(reflect.Value).Set": ext۰reflect۰Value۰Set, + "(reflect.Value).String": ext۰reflect۰Value۰String, + "(reflect.Value).Type": ext۰reflect۰Value۰Type, + "(reflect.Value).Uint": ext۰reflect۰Value۰Uint, + "(reflect.error).Error": ext۰reflect۰error۰Error, + "(reflect.rtype).Bits": ext۰reflect۰rtype۰Bits, + "(reflect.rtype).Elem": ext۰reflect۰rtype۰Elem, + "(reflect.rtype).Field": ext۰reflect۰rtype۰Field, + "(reflect.rtype).Kind": ext۰reflect۰rtype۰Kind, + "(reflect.rtype).NumField": ext۰reflect۰rtype۰NumField, + "(reflect.rtype).NumMethod": ext۰reflect۰rtype۰NumMethod, + "(reflect.rtype).NumOut": ext۰reflect۰rtype۰NumOut, + "(reflect.rtype).Out": ext۰reflect۰rtype۰Out, + "(reflect.rtype).Size": ext۰reflect۰rtype۰Size, + "(reflect.rtype).String": ext۰reflect۰rtype۰String, + "bytes.Equal": ext۰bytes۰Equal, + "bytes.IndexByte": ext۰bytes۰IndexByte, + "hash/crc32.haveSSE42": ext۰crc32۰haveSSE42, + "math.Abs": ext۰math۰Abs, + "math.Exp": ext۰math۰Exp, + "math.Float32bits": ext۰math۰Float32bits, + "math.Float32frombits": ext۰math۰Float32frombits, + "math.Float64bits": ext۰math۰Float64bits, + "math.Float64frombits": ext۰math۰Float64frombits, + "math.Min": ext۰math۰Min, + "reflect.New": ext۰reflect۰New, + "reflect.TypeOf": ext۰reflect۰TypeOf, + "reflect.ValueOf": ext۰reflect۰ValueOf, + "reflect.init": ext۰reflect۰Init, + "reflect.valueInterface": ext۰reflect۰valueInterface, + "runtime.Breakpoint": ext۰runtime۰Breakpoint, + "runtime.Caller": ext۰runtime۰Caller, + "runtime.FuncForPC": ext۰runtime۰FuncForPC, + "runtime.GC": ext۰runtime۰GC, + "runtime.GOMAXPROCS": ext۰runtime۰GOMAXPROCS, + "runtime.Gosched": ext۰runtime۰Gosched, + "runtime.NumCPU": ext۰runtime۰NumCPU, + "runtime.ReadMemStats": ext۰runtime۰ReadMemStats, + "runtime.SetFinalizer": ext۰runtime۰SetFinalizer, + "runtime.getgoroot": ext۰runtime۰getgoroot, + "strings.IndexByte": ext۰strings۰IndexByte, + "sync.runtime_Syncsemcheck": ext۰sync۰runtime_Syncsemcheck, + "sync.runtime_registerPool": ext۰sync۰runtime_registerPool, + "sync/atomic.AddInt32": ext۰atomic۰AddInt32, + "sync/atomic.CompareAndSwapInt32": ext۰atomic۰CompareAndSwapInt32, + "sync/atomic.LoadInt32": ext۰atomic۰LoadInt32, + "sync/atomic.LoadUint32": ext۰atomic۰LoadUint32, + "sync/atomic.StoreInt32": ext۰atomic۰StoreInt32, + "sync/atomic.StoreUint32": ext۰atomic۰StoreUint32, + "syscall.Close": ext۰syscall۰Close, + "syscall.Exit": ext۰syscall۰Exit, + "syscall.Fstat": ext۰syscall۰Fstat, + "syscall.Getpid": ext۰syscall۰Getpid, + "syscall.Getwd": ext۰syscall۰Getwd, + "syscall.Kill": ext۰syscall۰Kill, + "syscall.Lstat": ext۰syscall۰Lstat, + "syscall.Open": ext۰syscall۰Open, + "syscall.ParseDirent": ext۰syscall۰ParseDirent, + "syscall.RawSyscall": ext۰syscall۰RawSyscall, + "syscall.Read": ext۰syscall۰Read, + "syscall.ReadDirent": ext۰syscall۰ReadDirent, + "syscall.Stat": ext۰syscall۰Stat, + "syscall.Write": ext۰syscall۰Write, + "time.Sleep": ext۰time۰Sleep, + "time.now": ext۰time۰now, + } } // wrapError returns an interpreted 'error' interface value for err. @@ -122,19 +126,30 @@ func wrapError(err error) value { return iface{t: errorType, v: err.Error()} } -func ext۰runtime۰Func۰Entry(fn *ssa.Function, args []value) value { +func ext۰runtime۰Func۰Entry(fr *frame, args []value) value { return 0 } -func ext۰runtime۰Func۰FileLine(fn *ssa.Function, args []value) value { +func ext۰runtime۰Func۰FileLine(fr *frame, args []value) value { return tuple{"unknown.go", -1} } -func ext۰runtime۰Func۰Name(fn *ssa.Function, args []value) value { +func ext۰runtime۰Func۰Name(fr *frame, args []value) value { return "unknown" } -func ext۰bytes۰Equal(fn *ssa.Function, args []value) value { +func ext۰sync۰Pool۰Get(fr *frame, args []value) value { + if New := (*args[0].(*value)).(structure)[4]; New != nil { + return call(fr.i, fr, 0, New, nil) + } + return nil +} + +func ext۰sync۰Pool۰Put(fr *frame, args []value) value { + return nil +} + +func ext۰bytes۰Equal(fr *frame, args []value) value { // func Equal(a, b []byte) bool a := args[0].([]value) b := args[1].([]value) @@ -149,7 +164,7 @@ func ext۰bytes۰Equal(fn *ssa.Function, args []value) value { return true } -func ext۰bytes۰IndexByte(fn *ssa.Function, args []value) value { +func ext۰bytes۰IndexByte(fr *frame, args []value) value { // func IndexByte(s []byte, c byte) int s := args[0].([]value) c := args[1].(byte) @@ -161,49 +176,49 @@ func ext۰bytes۰IndexByte(fn *ssa.Function, args []value) value { return -1 } -func ext۰crc32۰haveSSE42(fn *ssa.Function, args []value) value { +func ext۰crc32۰haveSSE42(fr *frame, args []value) value { return false } -func ext۰math۰Float64frombits(fn *ssa.Function, args []value) value { +func ext۰math۰Float64frombits(fr *frame, args []value) value { return math.Float64frombits(args[0].(uint64)) } -func ext۰math۰Float64bits(fn *ssa.Function, args []value) value { +func ext۰math۰Float64bits(fr *frame, args []value) value { return math.Float64bits(args[0].(float64)) } -func ext۰math۰Float32frombits(fn *ssa.Function, args []value) value { +func ext۰math۰Float32frombits(fr *frame, args []value) value { return math.Float32frombits(args[0].(uint32)) } -func ext۰math۰Abs(fn *ssa.Function, args []value) value { +func ext۰math۰Abs(fr *frame, args []value) value { return math.Abs(args[0].(float64)) } -func ext۰math۰Exp(fn *ssa.Function, args []value) value { +func ext۰math۰Exp(fr *frame, args []value) value { return math.Exp(args[0].(float64)) } -func ext۰math۰Float32bits(fn *ssa.Function, args []value) value { +func ext۰math۰Float32bits(fr *frame, args []value) value { return math.Float32bits(args[0].(float32)) } -func ext۰math۰Min(fn *ssa.Function, args []value) value { +func ext۰math۰Min(fr *frame, args []value) value { return math.Min(args[0].(float64), args[1].(float64)) } -func ext۰runtime۰Breakpoint(fn *ssa.Function, args []value) value { +func ext۰runtime۰Breakpoint(fr *frame, args []value) value { runtime.Breakpoint() return nil } -func ext۰runtime۰Caller(fn *ssa.Function, args []value) value { +func ext۰runtime۰Caller(fr *frame, args []value) value { // TODO(adonovan): actually inspect the stack. return tuple{0, "somefile.go", 42, true} } -func ext۰runtime۰FuncForPC(fn *ssa.Function, args []value) value { +func ext۰runtime۰FuncForPC(fr *frame, args []value) value { // TODO(adonovan): actually inspect the stack. return (*value)(nil) //tuple{0, "somefile.go", 42, true} @@ -211,11 +226,11 @@ func ext۰runtime۰FuncForPC(fn *ssa.Function, args []value) value { //func FuncForPC(pc uintptr) *Func } -func ext۰runtime۰getgoroot(fn *ssa.Function, args []value) value { +func ext۰runtime۰getgoroot(fr *frame, args []value) value { return os.Getenv("GOROOT") } -func ext۰strings۰IndexByte(fn *ssa.Function, args []value) value { +func ext۰strings۰IndexByte(fr *frame, args []value) value { // func IndexByte(s string, c byte) int s := args[0].(string) c := args[1].(byte) @@ -227,60 +242,60 @@ func ext۰strings۰IndexByte(fn *ssa.Function, args []value) value { return -1 } -func ext۰sync۰runtime_registerPool(fn *ssa.Function, args []value) value { +func ext۰sync۰runtime_registerPool(fr *frame, args []value) value { return nil } -func ext۰sync۰runtime_Syncsemcheck(fn *ssa.Function, args []value) value { +func ext۰sync۰runtime_Syncsemcheck(fr *frame, args []value) value { return nil } -func ext۰runtime۰GOMAXPROCS(fn *ssa.Function, args []value) value { +func ext۰runtime۰GOMAXPROCS(fr *frame, args []value) value { return runtime.GOMAXPROCS(args[0].(int)) } -func ext۰runtime۰GC(fn *ssa.Function, args []value) value { +func ext۰runtime۰GC(fr *frame, args []value) value { runtime.GC() return nil } -func ext۰runtime۰Gosched(fn *ssa.Function, args []value) value { +func ext۰runtime۰Gosched(fr *frame, args []value) value { runtime.Gosched() return nil } -func ext۰runtime۰NumCPU(fn *ssa.Function, args []value) value { +func ext۰runtime۰NumCPU(fr *frame, args []value) value { return runtime.NumCPU() } -func ext۰runtime۰ReadMemStats(fn *ssa.Function, args []value) value { +func ext۰runtime۰ReadMemStats(fr *frame, args []value) value { // TODO(adonovan): populate args[0].(Struct) return nil } -func ext۰atomic۰LoadUint32(fn *ssa.Function, args []value) value { +func ext۰atomic۰LoadUint32(fr *frame, args []value) value { // TODO(adonovan): fix: not atomic! return (*args[0].(*value)).(uint32) } -func ext۰atomic۰StoreUint32(fn *ssa.Function, args []value) value { +func ext۰atomic۰StoreUint32(fr *frame, args []value) value { // TODO(adonovan): fix: not atomic! *args[0].(*value) = args[1].(uint32) return nil } -func ext۰atomic۰LoadInt32(fn *ssa.Function, args []value) value { +func ext۰atomic۰LoadInt32(fr *frame, args []value) value { // TODO(adonovan): fix: not atomic! return (*args[0].(*value)).(int32) } -func ext۰atomic۰StoreInt32(fn *ssa.Function, args []value) value { +func ext۰atomic۰StoreInt32(fr *frame, args []value) value { // TODO(adonovan): fix: not atomic! *args[0].(*value) = args[1].(int32) return nil } -func ext۰atomic۰CompareAndSwapInt32(fn *ssa.Function, args []value) value { +func ext۰atomic۰CompareAndSwapInt32(fr *frame, args []value) value { // TODO(adonovan): fix: not atomic! p := args[0].(*value) if (*p).(int32) == args[1].(int32) { @@ -290,7 +305,7 @@ func ext۰atomic۰CompareAndSwapInt32(fn *ssa.Function, args []value) value { return false } -func ext۰atomic۰AddInt32(fn *ssa.Function, args []value) value { +func ext۰atomic۰AddInt32(fr *frame, args []value) value { // TODO(adonovan): fix: not atomic! p := args[0].(*value) newv := (*p).(int32) + args[1].(int32) @@ -298,11 +313,11 @@ func ext۰atomic۰AddInt32(fn *ssa.Function, args []value) value { return newv } -func ext۰runtime۰SetFinalizer(fn *ssa.Function, args []value) value { +func ext۰runtime۰SetFinalizer(fr *frame, args []value) value { return nil // ignore } -func ext۰runtime۰funcname_go(fn *ssa.Function, args []value) value { +func ext۰runtime۰funcname_go(fr *frame, args []value) value { // TODO(adonovan): actually inspect the stack. return (*value)(nil) //tuple{0, "somefile.go", 42, true} @@ -310,26 +325,26 @@ func ext۰runtime۰funcname_go(fn *ssa.Function, args []value) value { //func FuncForPC(pc uintptr) *Func } -func ext۰time۰now(fn *ssa.Function, args []value) value { +func ext۰time۰now(fr *frame, args []value) value { nano := time.Now().UnixNano() return tuple{int64(nano / 1e9), int32(nano % 1e9)} } -func ext۰time۰Sleep(fn *ssa.Function, args []value) value { +func ext۰time۰Sleep(fr *frame, args []value) value { time.Sleep(time.Duration(args[0].(int64))) return nil } -func ext۰syscall۰Exit(fn *ssa.Function, args []value) value { +func ext۰syscall۰Exit(fr *frame, args []value) value { panic(exitPanic(args[0].(int))) } -func ext۰syscall۰Getwd(fn *ssa.Function, args []value) value { +func ext۰syscall۰Getwd(fr *frame, args []value) value { s, err := syscall.Getwd() return tuple{s, wrapError(err)} } -func ext۰syscall۰Getpid(fn *ssa.Function, args []value) value { +func ext۰syscall۰Getpid(fr *frame, args []value) value { return syscall.Getpid() } @@ -341,113 +356,3 @@ func valueToBytes(v value) []byte { } return b } - -// The set of remaining native functions we need to implement (as needed): - -// crypto/aes/cipher_asm.go:10:func hasAsm() bool -// crypto/aes/cipher_asm.go:11:func encryptBlockAsm(nr int, xk *uint32, dst, src *byte) -// crypto/aes/cipher_asm.go:12:func decryptBlockAsm(nr int, xk *uint32, dst, src *byte) -// crypto/aes/cipher_asm.go:13:func expandKeyAsm(nr int, key *byte, enc *uint32, dec *uint32) -// hash/crc32/crc32_amd64.go:12:func haveSSE42() bool -// hash/crc32/crc32_amd64.go:16:func castagnoliSSE42(crc uint32, p []byte) uint32 -// math/abs.go:12:func Abs(x float64) float64 -// math/asin.go:19:func Asin(x float64) float64 -// math/asin.go:51:func Acos(x float64) float64 -// math/atan.go:95:func Atan(x float64) float64 -// math/atan2.go:29:func Atan2(y, x float64) float64 -// math/big/arith_decl.go:8:func mulWW(x, y Word) (z1, z0 Word) -// math/big/arith_decl.go:9:func divWW(x1, x0, y Word) (q, r Word) -// math/big/arith_decl.go:10:func addVV(z, x, y []Word) (c Word) -// math/big/arith_decl.go:11:func subVV(z, x, y []Word) (c Word) -// math/big/arith_decl.go:12:func addVW(z, x []Word, y Word) (c Word) -// math/big/arith_decl.go:13:func subVW(z, x []Word, y Word) (c Word) -// math/big/arith_decl.go:14:func shlVU(z, x []Word, s uint) (c Word) -// math/big/arith_decl.go:15:func shrVU(z, x []Word, s uint) (c Word) -// math/big/arith_decl.go:16:func mulAddVWW(z, x []Word, y, r Word) (c Word) -// math/big/arith_decl.go:17:func addMulVVW(z, x []Word, y Word) (c Word) -// math/big/arith_decl.go:18:func divWVW(z []Word, xn Word, x []Word, y Word) (r Word) -// math/big/arith_decl.go:19:func bitLen(x Word) (n int) -// math/dim.go:13:func Dim(x, y float64) float64 -// math/dim.go:26:func Max(x, y float64) float64 -// math/exp.go:14:func Exp(x float64) float64 -// math/exp.go:135:func Exp2(x float64) float64 -// math/expm1.go:124:func Expm1(x float64) float64 -// math/floor.go:13:func Floor(x float64) float64 -// math/floor.go:36:func Ceil(x float64) float64 -// math/floor.go:48:func Trunc(x float64) float64 -// math/frexp.go:16:func Frexp(f float64) (frac float64, exp int) -// math/hypot.go:17:func Hypot(p, q float64) float64 -// math/ldexp.go:14:func Ldexp(frac float64, exp int) float64 -// math/log.go:80:func Log(x float64) float64 -// math/log10.go:9:func Log10(x float64) float64 -// math/log10.go:17:func Log2(x float64) float64 -// math/log1p.go:95:func Log1p(x float64) float64 -// math/mod.go:21:func Mod(x, y float64) float64 -// math/modf.go:13:func Modf(f float64) (int float64, frac float64) -// math/remainder.go:37:func Remainder(x, y float64) float64 -// math/sin.go:117:func Cos(x float64) float64 -// math/sin.go:174:func Sin(x float64) float64 -// math/sincos.go:15:func Sincos(x float64) (sin, cos float64) -// math/sqrt.go:14:func Sqrt(x float64) float64 -// math/tan.go:82:func Tan(x float64) float64 -// os/file_posix.go:14:func sigpipe() // implemented in package runtime -// os/signal/signal_unix.go:15:func signal_enable(uint32) -// os/signal/signal_unix.go:16:func signal_recv() uint32 -// runtime/debug.go:13:func LockOSThread() -// runtime/debug.go:17:func UnlockOSThread() -// runtime/debug.go:30:func NumCgoCall() int64 -// runtime/debug.go:33:func NumGoroutine() int -// runtime/debug.go:90:func MemProfile(p []MemProfileRecord, inuseZero bool) (n int, ok bool) -// runtime/debug.go:114:func ThreadCreateProfile(p []StackRecord) (n int, ok bool) -// runtime/debug.go:122:func GoroutineProfile(p []StackRecord) (n int, ok bool) -// runtime/debug.go:132:func CPUProfile() []byte -// runtime/debug.go:141:func SetCPUProfileRate(hz int) -// runtime/debug.go:149:func SetBlockProfileRate(rate int) -// runtime/debug.go:166:func BlockProfile(p []BlockProfileRecord) (n int, ok bool) -// runtime/debug.go:172:func Stack(buf []byte, all bool) int -// runtime/error.go:81:func typestring(interface{}) string -// runtime/extern.go:19:func Goexit() -// runtime/extern.go:27:func Caller(skip int) (pc uintptr, file string, line int, ok bool) -// runtime/extern.go:34:func Callers(skip int, pc []uintptr) int -// runtime/extern.go:51:func FuncForPC(pc uintptr) *Func -// runtime/extern.go:68:func funcline_go(*Func, uintptr) (string, int) -// runtime/extern.go:71:func mid() uint32 -// runtime/pprof/pprof.go:667:func runtime_cyclesPerSecond() int64 -// runtime/race.go:16:func RaceDisable() -// runtime/race.go:19:func RaceEnable() -// runtime/race.go:21:func RaceAcquire(addr unsafe.Pointer) -// runtime/race.go:22:func RaceRelease(addr unsafe.Pointer) -// runtime/race.go:23:func RaceReleaseMerge(addr unsafe.Pointer) -// runtime/race.go:25:func RaceRead(addr unsafe.Pointer) -// runtime/race.go:26:func RaceWrite(addr unsafe.Pointer) -// runtime/race.go:28:func RaceSemacquire(s *uint32) -// runtime/race.go:29:func RaceSemrelease(s *uint32) -// sync/atomic/doc.go:49:func CompareAndSwapInt64(addr *int64, old, new int64) (swapped bool) -// sync/atomic/doc.go:52:func CompareAndSwapUint32(addr *uint32, old, new uint32) (swapped bool) -// sync/atomic/doc.go:55:func CompareAndSwapUint64(addr *uint64, old, new uint64) (swapped bool) -// sync/atomic/doc.go:58:func CompareAndSwapUintptr(addr *uintptr, old, new uintptr) (swapped bool) -// sync/atomic/doc.go:61:func CompareAndSwapPointer(addr *unsafe.Pointer, old, new unsafe.Pointer) (swapped bool) -// sync/atomic/doc.go:67:func AddUint32(addr *uint32, delta uint32) (new uint32) -// sync/atomic/doc.go:70:func AddInt64(addr *int64, delta int64) (new int64) -// sync/atomic/doc.go:73:func AddUint64(addr *uint64, delta uint64) (new uint64) -// sync/atomic/doc.go:76:func AddUintptr(addr *uintptr, delta uintptr) (new uintptr) -// sync/atomic/doc.go:82:func LoadInt64(addr *int64) (val int64) -// sync/atomic/doc.go:88:func LoadUint64(addr *uint64) (val uint64) -// sync/atomic/doc.go:91:func LoadUintptr(addr *uintptr) (val uintptr) -// sync/atomic/doc.go:94:func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) -// sync/atomic/doc.go:100:func StoreInt64(addr *int64, val int64) -// sync/atomic/doc.go:106:func StoreUint64(addr *uint64, val uint64) -// sync/atomic/doc.go:109:func StoreUintptr(addr *uintptr, val uintptr) -// sync/atomic/doc.go:112:func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) -// sync/runtime.go:12:func runtime_Semacquire(s *uint32) -// sync/runtime.go:18:func runtime_Semrelease(s *uint32) -// syscall/env_unix.go:30:func setenv_c(k, v string) -// syscall/syscall_linux_amd64.go:60:func Gettimeofday(tv *Timeval) (err error) -// syscall/syscall_linux_amd64.go:61:func Time(t *Time_t) (tt Time_t, err error) -// syscall/syscall_linux_arm.go:28:func Seek(fd int, offset int64, whence int) (newoffset int64, err error) -// time/sleep.go:25:func startTimer(*runtimeTimer) -// time/sleep.go:26:func stopTimer(*runtimeTimer) bool -// time/time.go:758:func now() (sec int64, nsec int32) -// unsafe/unsafe.go:27:func Sizeof(v ArbitraryType) uintptr -// unsafe/unsafe.go:32:func Offsetof(v ArbitraryType) uintptr -// unsafe/unsafe.go:37:func Alignof(v ArbitraryType) uintptr diff --git a/go/ssa/interp/external_plan9.go b/go/ssa/interp/external_plan9.go index fa6fbab3..05d02d56 100644 --- a/go/ssa/interp/external_plan9.go +++ b/go/ssa/interp/external_plan9.go @@ -4,45 +4,41 @@ package interp -import ( - "syscall" +import "syscall" - "code.google.com/p/go.tools/go/ssa" -) - -func ext۰syscall۰Close(fn *ssa.Function, args []value) value { +func ext۰syscall۰Close(fr *frame, args []value) value { panic("syscall.Close not yet implemented") } -func ext۰syscall۰Fstat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Fstat(fr *frame, args []value) value { panic("syscall.Fstat not yet implemented") } -func ext۰syscall۰Kill(fn *ssa.Function, args []value) value { +func ext۰syscall۰Kill(fr *frame, args []value) value { panic("syscall.Kill not yet implemented") } -func ext۰syscall۰Lstat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Lstat(fr *frame, args []value) value { panic("syscall.Lstat not yet implemented") } -func ext۰syscall۰Open(fn *ssa.Function, args []value) value { +func ext۰syscall۰Open(fr *frame, args []value) value { panic("syscall.Open not yet implemented") } -func ext۰syscall۰ParseDirent(fn *ssa.Function, args []value) value { +func ext۰syscall۰ParseDirent(fr *frame, args []value) value { panic("syscall.ParseDirent not yet implemented") } -func ext۰syscall۰Read(fn *ssa.Function, args []value) value { +func ext۰syscall۰Read(fr *frame, args []value) value { panic("syscall.Read not yet implemented") } -func ext۰syscall۰ReadDirent(fn *ssa.Function, args []value) value { +func ext۰syscall۰ReadDirent(fr *frame, args []value) value { panic("syscall.ReadDirent not yet implemented") } -func ext۰syscall۰Stat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Stat(fr *frame, args []value) value { panic("syscall.Stat not yet implemented") } -func ext۰syscall۰Write(fn *ssa.Function, args []value) value { +func ext۰syscall۰Write(fr *frame, args []value) value { // func Write(fd int, p []byte) (n int, err error) n, err := write(args[0].(int), valueToBytes(args[1])) return tuple{n, wrapError(err)} } -func ext۰syscall۰RawSyscall(fn *ssa.Function, args []value) value { +func ext۰syscall۰RawSyscall(fr *frame, args []value) value { return tuple{^uintptr(0), uintptr(0), uintptr(0)} } diff --git a/go/ssa/interp/external_unix.go b/go/ssa/interp/external_unix.go index efd50fbd..c482eabb 100644 --- a/go/ssa/interp/external_unix.go +++ b/go/ssa/interp/external_unix.go @@ -6,11 +6,7 @@ package interp -import ( - "syscall" - - "code.google.com/p/go.tools/go/ssa" -) +import "syscall" func fillStat(st *syscall.Stat_t, stat structure) { stat[0] = st.Dev @@ -30,12 +26,12 @@ func fillStat(st *syscall.Stat_t, stat structure) { // stat[13] = st.Ctim } -func ext۰syscall۰Close(fn *ssa.Function, args []value) value { +func ext۰syscall۰Close(fr *frame, args []value) value { // func Close(fd int) (err error) return wrapError(syscall.Close(args[0].(int))) } -func ext۰syscall۰Fstat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Fstat(fr *frame, args []value) value { // func Fstat(fd int, stat *Stat_t) (err error) fd := args[0].(int) stat := (*args[1].(*value)).(structure) @@ -46,7 +42,7 @@ func ext۰syscall۰Fstat(fn *ssa.Function, args []value) value { return wrapError(err) } -func ext۰syscall۰ReadDirent(fn *ssa.Function, args []value) value { +func ext۰syscall۰ReadDirent(fr *frame, args []value) value { // func ReadDirent(fd int, buf []byte) (n int, err error) fd := args[0].(int) p := args[1].([]value) @@ -58,12 +54,12 @@ func ext۰syscall۰ReadDirent(fn *ssa.Function, args []value) value { return tuple{n, wrapError(err)} } -func ext۰syscall۰Kill(fn *ssa.Function, args []value) value { +func ext۰syscall۰Kill(fr *frame, args []value) value { // func Kill(pid int, sig Signal) (err error) return wrapError(syscall.Kill(args[0].(int), syscall.Signal(args[1].(int)))) } -func ext۰syscall۰Lstat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Lstat(fr *frame, args []value) value { // func Lstat(name string, stat *Stat_t) (err error) name := args[0].(string) stat := (*args[1].(*value)).(structure) @@ -74,7 +70,7 @@ func ext۰syscall۰Lstat(fn *ssa.Function, args []value) value { return wrapError(err) } -func ext۰syscall۰Open(fn *ssa.Function, args []value) value { +func ext۰syscall۰Open(fr *frame, args []value) value { // func Open(path string, mode int, perm uint32) (fd int, err error) { path := args[0].(string) mode := args[1].(int) @@ -83,7 +79,7 @@ func ext۰syscall۰Open(fn *ssa.Function, args []value) value { return tuple{fd, wrapError(err)} } -func ext۰syscall۰ParseDirent(fn *ssa.Function, args []value) value { +func ext۰syscall۰ParseDirent(fr *frame, args []value) value { // func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) max := args[1].(int) var names []string @@ -98,7 +94,7 @@ func ext۰syscall۰ParseDirent(fn *ssa.Function, args []value) value { return tuple{consumed, count, inewnames} } -func ext۰syscall۰Read(fn *ssa.Function, args []value) value { +func ext۰syscall۰Read(fr *frame, args []value) value { // func Read(fd int, p []byte) (n int, err error) fd := args[0].(int) p := args[1].([]value) @@ -110,7 +106,7 @@ func ext۰syscall۰Read(fn *ssa.Function, args []value) value { return tuple{n, wrapError(err)} } -func ext۰syscall۰Stat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Stat(fr *frame, args []value) value { // func Stat(name string, stat *Stat_t) (err error) name := args[0].(string) stat := (*args[1].(*value)).(structure) @@ -121,13 +117,13 @@ func ext۰syscall۰Stat(fn *ssa.Function, args []value) value { return wrapError(err) } -func ext۰syscall۰Write(fn *ssa.Function, args []value) value { +func ext۰syscall۰Write(fr *frame, args []value) value { // func Write(fd int, p []byte) (n int, err error) n, err := write(args[0].(int), valueToBytes(args[1])) return tuple{n, wrapError(err)} } -func ext۰syscall۰RawSyscall(fn *ssa.Function, args []value) value { +func ext۰syscall۰RawSyscall(fr *frame, args []value) value { return tuple{uintptr(0), uintptr(0), uintptr(syscall.ENOSYS)} } diff --git a/go/ssa/interp/external_windows.go b/go/ssa/interp/external_windows.go index 08f012ab..ef28a371 100644 --- a/go/ssa/interp/external_windows.go +++ b/go/ssa/interp/external_windows.go @@ -4,43 +4,39 @@ package interp -import ( - "syscall" +import "syscall" - "code.google.com/p/go.tools/go/ssa" -) - -func ext۰syscall۰Close(fn *ssa.Function, args []value) value { +func ext۰syscall۰Close(fr *frame, args []value) value { panic("syscall.Close not yet implemented") } -func ext۰syscall۰Fstat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Fstat(fr *frame, args []value) value { panic("syscall.Fstat not yet implemented") } -func ext۰syscall۰Kill(fn *ssa.Function, args []value) value { +func ext۰syscall۰Kill(fr *frame, args []value) value { panic("syscall.Kill not yet implemented") } -func ext۰syscall۰Lstat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Lstat(fr *frame, args []value) value { panic("syscall.Lstat not yet implemented") } -func ext۰syscall۰Open(fn *ssa.Function, args []value) value { +func ext۰syscall۰Open(fr *frame, args []value) value { panic("syscall.Open not yet implemented") } -func ext۰syscall۰ParseDirent(fn *ssa.Function, args []value) value { +func ext۰syscall۰ParseDirent(fr *frame, args []value) value { panic("syscall.ParseDirent not yet implemented") } -func ext۰syscall۰Read(fn *ssa.Function, args []value) value { +func ext۰syscall۰Read(fr *frame, args []value) value { panic("syscall.Read not yet implemented") } -func ext۰syscall۰ReadDirent(fn *ssa.Function, args []value) value { +func ext۰syscall۰ReadDirent(fr *frame, args []value) value { panic("syscall.ReadDirent not yet implemented") } -func ext۰syscall۰Stat(fn *ssa.Function, args []value) value { +func ext۰syscall۰Stat(fr *frame, args []value) value { panic("syscall.Stat not yet implemented") } -func ext۰syscall۰Write(fn *ssa.Function, args []value) value { +func ext۰syscall۰Write(fr *frame, args []value) value { panic("syscall.Write not yet implemented") } -func ext۰syscall۰RawSyscall(fn *ssa.Function, args []value) value { +func ext۰syscall۰RawSyscall(fr *frame, args []value) value { return tuple{uintptr(0), uintptr(0), uintptr(syscall.ENOSYS)} } func syswrite(fd int, b []byte) (int, error) { diff --git a/go/ssa/interp/interp.go b/go/ssa/interp/interp.go index 20988cd8..1c521369 100644 --- a/go/ssa/interp/interp.go +++ b/go/ssa/interp/interp.go @@ -483,26 +483,26 @@ func callSSA(i *interpreter, caller *frame, callpos token.Pos, fn *ssa.Function, } defer fmt.Fprintf(os.Stderr, "Leaving %s%s.\n", fn, suffix) } + fr := &frame{ + i: i, + caller: caller, // for panic/recover + fn: fn, + } if fn.Enclosing == nil { name := fn.String() if ext := externals[name]; ext != nil { if i.mode&EnableTracing != 0 { fmt.Fprintln(os.Stderr, "\t(external)") } - return ext(fn, args) + return ext(fr, args) } if fn.Blocks == nil { panic("no code for function: " + name) } } - fr := &frame{ - i: i, - caller: caller, // currently unused; for unwinding. - fn: fn, - env: make(map[ssa.Value]value), - block: fn.Blocks[0], - locals: make([]value, len(fn.Locals)), - } + fr.env = make(map[ssa.Value]value) + fr.block = fn.Blocks[0] + fr.locals = make([]value, len(fn.Locals)) for i, l := range fn.Locals { fr.locals[i] = zero(deref(l.Type())) fr.env[l] = &fr.locals[i] diff --git a/go/ssa/interp/reflect.go b/go/ssa/interp/reflect.go index 98dabc46..cc9b2ce6 100644 --- a/go/ssa/interp/reflect.go +++ b/go/ssa/interp/reflect.go @@ -69,12 +69,12 @@ func makeReflectType(rt rtype) value { return iface{rtypeType, rt} } -func ext۰reflect۰Init(fn *ssa.Function, args []value) value { +func ext۰reflect۰Init(fr *frame, args []value) value { // Signature: func() return nil } -func ext۰reflect۰rtype۰Bits(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰Bits(fr *frame, args []value) value { // Signature: func (t reflect.rtype) int rt := args[0].(rtype).t basic, ok := rt.Underlying().(*types.Basic) @@ -84,14 +84,14 @@ func ext۰reflect۰rtype۰Bits(fn *ssa.Function, args []value) value { return _sizes.Sizeof(basic) * 8 } -func ext۰reflect۰rtype۰Elem(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰Elem(fr *frame, args []value) value { // Signature: func (t reflect.rtype) reflect.Type return makeReflectType(rtype{args[0].(rtype).t.Underlying().(interface { Elem() types.Type }).Elem()}) } -func ext۰reflect۰rtype۰Field(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰Field(fr *frame, args []value) value { // Signature: func (t reflect.rtype, i int) reflect.StructField st := args[0].(rtype).t.Underlying().(*types.Struct) i := args[1].(int) @@ -107,55 +107,55 @@ func ext۰reflect۰rtype۰Field(fn *ssa.Function, args []value) value { } } -func ext۰reflect۰rtype۰Kind(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰Kind(fr *frame, args []value) value { // Signature: func (t reflect.rtype) uint return uint(reflectKind(args[0].(rtype).t)) } -func ext۰reflect۰rtype۰NumField(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰NumField(fr *frame, args []value) value { // Signature: func (t reflect.rtype) int return args[0].(rtype).t.Underlying().(*types.Struct).NumFields() } -func ext۰reflect۰rtype۰NumMethod(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰NumMethod(fr *frame, args []value) value { // Signature: func (t reflect.rtype) int return args[0].(rtype).t.MethodSet().Len() } -func ext۰reflect۰rtype۰NumOut(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰NumOut(fr *frame, args []value) value { // Signature: func (t reflect.rtype) int return args[0].(rtype).t.(*types.Signature).Results().Len() } -func ext۰reflect۰rtype۰Out(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰Out(fr *frame, args []value) value { // Signature: func (t reflect.rtype, i int) int i := args[1].(int) return makeReflectType(rtype{args[0].(rtype).t.(*types.Signature).Results().At(i).Type()}) } -func ext۰reflect۰rtype۰Size(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰Size(fr *frame, args []value) value { // Signature: func (t reflect.rtype) uintptr return uint64(_sizes.Sizeof(args[0].(rtype).t)) } -func ext۰reflect۰rtype۰String(fn *ssa.Function, args []value) value { +func ext۰reflect۰rtype۰String(fr *frame, args []value) value { // Signature: func (t reflect.rtype) string return args[0].(rtype).t.String() } -func ext۰reflect۰New(fn *ssa.Function, args []value) value { +func ext۰reflect۰New(fr *frame, args []value) value { // Signature: func (t reflect.Type) reflect.Value t := args[0].(iface).v.(rtype).t alloc := zero(t) return makeReflectValue(types.NewPointer(t), &alloc) } -func ext۰reflect۰TypeOf(fn *ssa.Function, args []value) value { +func ext۰reflect۰TypeOf(fr *frame, args []value) value { // Signature: func (t reflect.rtype) string return makeReflectType(rtype{args[0].(iface).t}) } -func ext۰reflect۰ValueOf(fn *ssa.Function, args []value) value { +func ext۰reflect۰ValueOf(fr *frame, args []value) value { // Signature: func (interface{}) reflect.Value itf := args[0].(iface) return makeReflectValue(itf.t, itf.v) @@ -224,22 +224,22 @@ func reflectKind(t types.Type) reflect.Kind { panic(fmt.Sprint("unexpected type: ", t)) } -func ext۰reflect۰Value۰Kind(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Kind(fr *frame, args []value) value { // Signature: func (reflect.Value) uint return uint(reflectKind(rV2T(args[0]).t)) } -func ext۰reflect۰Value۰String(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰String(fr *frame, args []value) value { // Signature: func (reflect.Value) string return toString(rV2V(args[0])) } -func ext۰reflect۰Value۰Type(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Type(fr *frame, args []value) value { // Signature: func (reflect.Value) reflect.Type return makeReflectType(rV2T(args[0])) } -func ext۰reflect۰Value۰Uint(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Uint(fr *frame, args []value) value { // Signature: func (reflect.Value) uint64 switch v := rV2V(args[0]).(type) { case uint: @@ -258,7 +258,7 @@ func ext۰reflect۰Value۰Uint(fn *ssa.Function, args []value) value { panic("reflect.Value.Uint") } -func ext۰reflect۰Value۰Len(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Len(fr *frame, args []value) value { // Signature: func (reflect.Value) int switch v := rV2V(args[0]).(type) { case string: @@ -279,7 +279,7 @@ func ext۰reflect۰Value۰Len(fn *ssa.Function, args []value) value { return nil // unreachable } -func ext۰reflect۰Value۰MapIndex(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰MapIndex(fr *frame, args []value) value { // Signature: func (reflect.Value) Value tValue := rV2T(args[0]).t.Underlying().(*types.Map).Key() k := rV2V(args[1]) @@ -300,7 +300,7 @@ func ext۰reflect۰Value۰MapIndex(fn *ssa.Function, args []value) value { return makeReflectValue(nil, nil) } -func ext۰reflect۰Value۰MapKeys(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰MapKeys(fr *frame, args []value) value { // Signature: func (reflect.Value) []Value var keys []value tKey := rV2T(args[0]).t.Underlying().(*types.Map).Key() @@ -323,17 +323,17 @@ func ext۰reflect۰Value۰MapKeys(fn *ssa.Function, args []value) value { return keys } -func ext۰reflect۰Value۰NumField(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰NumField(fr *frame, args []value) value { // Signature: func (reflect.Value) int return len(rV2V(args[0]).(structure)) } -func ext۰reflect۰Value۰NumMethod(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰NumMethod(fr *frame, args []value) value { // Signature: func (reflect.Value) int return rV2T(args[0]).t.MethodSet().Len() } -func ext۰reflect۰Value۰Pointer(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Pointer(fr *frame, args []value) value { // Signature: func (v reflect.Value) uintptr switch v := rV2V(args[0]).(type) { case *value: @@ -354,7 +354,7 @@ func ext۰reflect۰Value۰Pointer(fn *ssa.Function, args []value) value { return nil // unreachable } -func ext۰reflect۰Value۰Index(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Index(fr *frame, args []value) value { // Signature: func (v reflect.Value, i int) Value i := args[1].(int) t := rV2T(args[0]).t.Underlying() @@ -369,24 +369,24 @@ func ext۰reflect۰Value۰Index(fn *ssa.Function, args []value) value { return nil // unreachable } -func ext۰reflect۰Value۰Bool(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Bool(fr *frame, args []value) value { // Signature: func (reflect.Value) bool return rV2V(args[0]).(bool) } -func ext۰reflect۰Value۰CanAddr(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰CanAddr(fr *frame, args []value) value { // Signature: func (v reflect.Value) bool // Always false for our representation. return false } -func ext۰reflect۰Value۰CanInterface(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰CanInterface(fr *frame, args []value) value { // Signature: func (v reflect.Value) bool // Always true for our representation. return true } -func ext۰reflect۰Value۰Elem(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Elem(fr *frame, args []value) value { // Signature: func (v reflect.Value) reflect.Value switch x := rV2V(args[0]).(type) { case iface: @@ -399,14 +399,14 @@ func ext۰reflect۰Value۰Elem(fn *ssa.Function, args []value) value { return nil // unreachable } -func ext۰reflect۰Value۰Field(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Field(fr *frame, args []value) value { // Signature: func (v reflect.Value, i int) reflect.Value v := args[0] i := args[1].(int) return makeReflectValue(rV2T(v).t.Underlying().(*types.Struct).Field(i).Type(), rV2V(v).(structure)[i]) } -func ext۰reflect۰Value۰Float(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Float(fr *frame, args []value) value { // Signature: func (reflect.Value) float64 switch v := rV2V(args[0]).(type) { case float32: @@ -417,12 +417,12 @@ func ext۰reflect۰Value۰Float(fn *ssa.Function, args []value) value { panic("reflect.Value.Float") } -func ext۰reflect۰Value۰Interface(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Interface(fr *frame, args []value) value { // Signature: func (v reflect.Value) interface{} - return ext۰reflect۰valueInterface(fn, args) + return ext۰reflect۰valueInterface(fr, args) } -func ext۰reflect۰Value۰Int(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Int(fr *frame, args []value) value { // Signature: func (reflect.Value) int64 switch x := rV2V(args[0]).(type) { case int: @@ -441,7 +441,7 @@ func ext۰reflect۰Value۰Int(fn *ssa.Function, args []value) value { return nil // unreachable } -func ext۰reflect۰Value۰IsNil(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰IsNil(fr *frame, args []value) value { // Signature: func (reflect.Value) bool switch x := rV2V(args[0]).(type) { case *value: @@ -468,23 +468,23 @@ func ext۰reflect۰Value۰IsNil(fn *ssa.Function, args []value) value { return nil // unreachable } -func ext۰reflect۰Value۰IsValid(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰IsValid(fr *frame, args []value) value { // Signature: func (reflect.Value) bool return rV2V(args[0]) != nil } -func ext۰reflect۰Value۰Set(fn *ssa.Function, args []value) value { +func ext۰reflect۰Value۰Set(fr *frame, args []value) value { // TODO(adonovan): implement. return nil } -func ext۰reflect۰valueInterface(fn *ssa.Function, args []value) value { +func ext۰reflect۰valueInterface(fr *frame, args []value) value { // Signature: func (v reflect.Value, safe bool) interface{} v := args[0].(structure) return iface{rV2T(v).t, rV2V(v)} } -func ext۰reflect۰error۰Error(fn *ssa.Function, args []value) value { +func ext۰reflect۰error۰Error(fr *frame, args []value) value { return args[0] }