FAQ
Reviewers: adonovan, minux,

Message:
Hello adonovan@google.com, minux.ma@gmail.com (cc:
golang-dev@googlegroups.com, lucio.dere@gmail.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
exp/ssa/interp: fix build for Plan 9

Please review this at https://codereview.appspot.com/7300078/

Affected files:
M src/pkg/exp/ssa/interp/external_plan9.go
M src/pkg/exp/ssa/interp/external_unix.go
M src/pkg/exp/ssa/interp/external_windows.go


Index: src/pkg/exp/ssa/interp/external_plan9.go
===================================================================
copy from src/pkg/exp/ssa/interp/external_unix.go
copy to src/pkg/exp/ssa/interp/external_plan9.go
--- a/src/pkg/exp/ssa/interp/external_unix.go
+++ b/src/pkg/exp/ssa/interp/external_plan9.go
@@ -2,8 +2,6 @@
// 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 (
@@ -12,10 +10,7 @@
)

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{}
+ panic("syscall.Kill not yet implemented")
}

func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value)
value {
@@ -28,5 +23,4 @@
n, _ := syscall.Write(args[0].(int), b)
err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted
iface.
return tuple{n, err}
-
}
Index: src/pkg/exp/ssa/interp/external_unix.go
===================================================================
--- a/src/pkg/exp/ssa/interp/external_unix.go
+++ b/src/pkg/exp/ssa/interp/external_unix.go
@@ -28,5 +28,4 @@
n, _ := syscall.Write(args[0].(int), b)
err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted
iface.
return tuple{n, err}
-
}
Index: src/pkg/exp/ssa/interp/external_windows.go
===================================================================
--- a/src/pkg/exp/ssa/interp/external_windows.go
+++ b/src/pkg/exp/ssa/interp/external_windows.go
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

-// +build windows plan9
+// +build windows

package interp

import (
"exp/ssa"
+ "syscall"
)

func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value
{
@@ -15,5 +16,13 @@
}

func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value)
value {
- panic("syscall.Write not yet implemented")
+ // 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].(syscall.Handle), b)
+ err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted
iface.
+ return tuple{n, err}
}


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Lucio De Re at Feb 10, 2013 at 4:19 am
    Thank, Anthony, please forgive the belated - now redundant - comment from me.

    Lucio.
    On 2/10/13, ality@pbrane.org wrote:
    Reviewers: adonovan, minux,

    Message:
    Hello adonovan@google.com, minux.ma@gmail.com (cc:
    golang-dev@googlegroups.com, lucio.dere@gmail.com),

    I'd like you to review this change to
    https://code.google.com/p/go/


    Description:
    exp/ssa/interp: fix build for Plan 9

    Please review this at https://codereview.appspot.com/7300078/

    Affected files:
    M src/pkg/exp/ssa/interp/external_plan9.go
    M src/pkg/exp/ssa/interp/external_unix.go
    M src/pkg/exp/ssa/interp/external_windows.go


    Index: src/pkg/exp/ssa/interp/external_plan9.go
    ===================================================================
    copy from src/pkg/exp/ssa/interp/external_unix.go
    copy to src/pkg/exp/ssa/interp/external_plan9.go
    --- a/src/pkg/exp/ssa/interp/external_unix.go
    +++ b/src/pkg/exp/ssa/interp/external_plan9.go
    @@ -2,8 +2,6 @@
    // 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 (
    @@ -12,10 +10,7 @@
    )

    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{}
    + panic("syscall.Kill not yet implemented")
    }

    func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value)
    value {
    @@ -28,5 +23,4 @@
    n, _ := syscall.Write(args[0].(int), b)
    err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted

    iface.
    return tuple{n, err}
    -
    }
    Index: src/pkg/exp/ssa/interp/external_unix.go
    ===================================================================
    --- a/src/pkg/exp/ssa/interp/external_unix.go
    +++ b/src/pkg/exp/ssa/interp/external_unix.go
    @@ -28,5 +28,4 @@
    n, _ := syscall.Write(args[0].(int), b)
    err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted

    iface.
    return tuple{n, err}
    -
    }
    Index: src/pkg/exp/ssa/interp/external_windows.go
    ===================================================================
    --- a/src/pkg/exp/ssa/interp/external_windows.go
    +++ b/src/pkg/exp/ssa/interp/external_windows.go
    @@ -2,12 +2,13 @@
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.

    -// +build windows plan9
    +// +build windows

    package interp

    import (
    "exp/ssa"
    + "syscall"
    )

    func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value

    {
    @@ -15,5 +16,13 @@
    }

    func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value)
    value {
    - panic("syscall.Write not yet implemented")
    + // 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].(syscall.Handle), b)
    + err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted

    iface.
    + return tuple{n, err}
    }

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Adonovan at Feb 10, 2013 at 5:23 am
    https://codereview.appspot.com/7300078/diff/4004/src/pkg/exp/ssa/interp/external_windows.go
    File src/pkg/exp/ssa/interp/external_windows.go (right):

    https://codereview.appspot.com/7300078/diff/4004/src/pkg/exp/ssa/interp/external_windows.go#newcode25
    src/pkg/exp/ssa/interp/external_windows.go:25: n, _ :=
    syscall.Write(args[0].(syscall.Handle), b)
    The set of dynamic types that can appear inside a 'value' interface is
    finite and does not include syscall.Handle; perhaps uintptr will work
    though. You'd need to build exp/ssa/ssadump.go and run it on a 'hello
    world' program to test it:

    % ./ssadump -run hello.go

    https://codereview.appspot.com/7300078/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Anthony Martin at Feb 10, 2013 at 6:15 am
    PTAL
    syscall.Write(args[0].(syscall.Handle), b)
    The set of dynamic types that can appear inside a 'value' interface is
    finite and does not include syscall.Handle; perhaps uintptr will work
    though. You'd need to build exp/ssa/ssadump.go and run it on a 'hello
    world' program to test it:

    % ./ssadump -run hello.go
    I changed it to use a uintptr.

    Can anyone test this on a Windows machine?

    Thanks,
    Anthony

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Minux at Feb 10, 2013 at 9:28 pm

    On Sun, Feb 10, 2013 at 2:15 PM, Anthony Martin wrote:

    Can anyone test this on a Windows machine?
    ./make.bash succeeded, but building ssadump.go results in linker error:
    see https://code.google.com/p/go/issues/detail?id=4785

    the code for windows won't handle writes to console right, but i think
    this is acceptable.

    after issue 4785 is fixed, i can test further on windows.

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedFeb 10, '13 at 3:54a
activeFeb 10, '13 at 9:28p
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase