]> Cypherpunks repositories - gostls13.git/commitdiff
exp/ssa/interp: fix MS Windows breakage.
authorAlan Donovan <adonovan@google.com>
Fri, 8 Feb 2013 16:58:24 +0000 (11:58 -0500)
committerAlan Donovan <adonovan@google.com>
Fri, 8 Feb 2013 16:58:24 +0000 (11:58 -0500)
syscall.{Kill,Write} are not portable to MS Windows, so we
disable them for now.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/7312066

src/pkg/exp/ssa/interp/external.go
src/pkg/exp/ssa/interp/external_unix.go [new file with mode: 0644]
src/pkg/exp/ssa/interp/external_windows.go [new file with mode: 0644]

index e67ae5ee65ba67a3196945dc086111988cdc5439..39c5fd33baa57843a84934a154cd0a7643a67746 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright 2013 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 interp
 
 // Emulated functions that we cannot interpret because they are
@@ -173,26 +177,6 @@ func ext۰syscall۰Getpid(fn *ssa.Function, args []value, slots []value) value {
        return syscall.Getpid()
 }
 
-func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value {
-       // We could emulate syscall.Syscall but it's more effort.
-       err := syscall.Kill(args[0].(int), syscall.Signal(args[1].(int)))
-       err = err // TODO(adonovan): fix: adapt concrete err to interpreted iface (e.g. call interpreted errors.New)
-       return iface{}
-}
-
-func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value) value {
-       // We could emulate syscall.Syscall but it's more effort.
-       p := args[1].([]value)
-       b := make([]byte, 0, len(p))
-       for i := range p {
-               b = append(b, p[i].(byte))
-       }
-       n, _ := syscall.Write(args[0].(int), b)
-       err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted iface.
-       return tuple{n, err}
-
-}
-
 // The set of remaining native functions we need to implement (as needed):
 
 // bytes/bytes.go:42:func Equal(a, b []byte) bool
diff --git a/src/pkg/exp/ssa/interp/external_unix.go b/src/pkg/exp/ssa/interp/external_unix.go
new file mode 100644 (file)
index 0000000..114a0f3
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright 2013 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.
+
+// +build !windows,!plan9
+
+package interp
+
+import (
+       "exp/ssa"
+       "syscall"
+)
+
+func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value {
+       // We could emulate syscall.Syscall but it's more effort.
+       err := syscall.Kill(args[0].(int), syscall.Signal(args[1].(int)))
+       err = err // TODO(adonovan): fix: adapt concrete err to interpreted iface (e.g. call interpreted errors.New)
+       return iface{}
+}
+
+func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value) value {
+       // We could emulate syscall.Syscall but it's more effort.
+       p := args[1].([]value)
+       b := make([]byte, 0, len(p))
+       for i := range p {
+               b = append(b, p[i].(byte))
+       }
+       n, _ := syscall.Write(args[0].(int), b)
+       err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted iface.
+       return tuple{n, err}
+
+}
diff --git a/src/pkg/exp/ssa/interp/external_windows.go b/src/pkg/exp/ssa/interp/external_windows.go
new file mode 100644 (file)
index 0000000..cb86d83
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2013 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.
+
+// +build windows plan9
+
+package interp
+
+import (
+       "exp/ssa"
+)
+
+func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value {
+       panic("syscall.Kill not yet implemented")
+}
+
+func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value) value {
+       panic("syscall.Write not yet implemented")
+}