Skip to content

Commit

Permalink
align tamago support to go1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
abarisani committed Sep 10, 2021
1 parent 8de93d2 commit 90f15f4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/net/unixsock_readmsg_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (js && wasm) || windows
// +build js,wasm windows
//go:build (js && wasm) || windows || tamago
// +build js,wasm windows tamago

package net

Expand Down
4 changes: 3 additions & 1 deletion src/runtime/lock_tamago.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func checkTimeouts() {
// beforeIdle gets called by the scheduler if no goroutine is awake.
// If we are not already handling an event, then we pause for an async event.
// If an event handler returned, we resume it and it will pause the execution.
func beforeIdle(delay int64) (gp *g, otherReady bool) {
// beforeIdle either returns the specific goroutine to schedule next or
// indicates with otherReady that some goroutine became ready.
func beforeIdle(now, pollUntil int64) (gp *g, otherReady bool) {
return nil, false
}
2 changes: 1 addition & 1 deletion src/runtime/mmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !aix && !darwin && !js && (!linux || !amd64) && (!linux || !arm64) && !openbsd && !plan9 && !solaris && !windows
//go:build !aix && !darwin && !js && (!linux || !amd64) && (!linux || !arm64) && !openbsd && !plan9 && !solaris && !windows && !tamago
// +build !aix
// +build !darwin
// +build !js
Expand Down
8 changes: 7 additions & 1 deletion src/runtime/os_tamago_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func setProcessCPUProfiler(hz int32) {}
func setThreadCPUProfiler(hz int32) {}
func initsig(preinit bool) {}
func osyield() {}
func osyield_no_g() {}

// May run with m.p==nil, so write barriers are not allowed.
//go:nowritebarrier
Expand Down Expand Up @@ -169,7 +170,7 @@ func syscall_now() (sec int64, nsec int32) {
}

//go:nosplit
func walltime1() (sec int64, nsec int32) {
func walltime() (sec int64, nsec int32) {
// TODO: probably better implement this in sys_tamago_arm.s for better
// performance
nano := nanotime()
Expand All @@ -185,6 +186,11 @@ func usleep(us uint32) {
}
}

//go:nosplit
func usleep_no_g(usec uint32) {
usleep(usec)
}

func exit(code int32) {
print("exit with code ", code, " halting\n")
for {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sigqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// unnecessary rechecks of sig.mask, but it cannot lead to missed signals
// nor deadlocks.

//go:build !plan9
//go:build !plan9 && !tamago
// +build !plan9
// +build !tamago

Expand Down
7 changes: 4 additions & 3 deletions src/syscall/syscall_tamago.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package syscall

import (
"internal/itoa"
"internal/oserror"
"sync"
"unsafe"
Expand Down Expand Up @@ -53,7 +54,7 @@ const PathMax = 256
// using errors.Is. For example:
//
// _, _, err := syscall.Syscall(...)
// if errors.Is(err, os.ErrNotExist) ...
// if errors.Is(err, fs.ErrNotExist) ...
type Errno uintptr

func (e Errno) Error() string {
Expand All @@ -63,7 +64,7 @@ func (e Errno) Error() string {
return s
}
}
return "errno " + itoa(int(e))
return "errno " + itoa.Itoa(int(e))
}

func (e Errno) Is(target error) bool {
Expand Down Expand Up @@ -109,7 +110,7 @@ func (s Signal) String() string {
return str
}
}
return "signal " + itoa(int(s))
return "signal " + itoa.Itoa(int(s))
}

var signals = [...]string{}
Expand Down

0 comments on commit 90f15f4

Please sign in to comment.