2011-08-29 08:42:16 -06:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// System calls and other sys.stuff for 386, OpenBSD
|
|
|
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
|
|
|
//
|
|
|
|
|
[dev.cc] runtime: convert assembly files for C to Go transition
The main change is that #include "zasm_GOOS_GOARCH.h"
is now #include "go_asm.h" and/or #include "go_tls.h".
Also, because C StackGuard is now Go _StackGuard,
the assembly name changes from const_StackGuard to
const__StackGuard.
In asm_$GOARCH.s, add new function getg, formerly
implemented in C.
The renamed atomics now have Go wrappers, to get
escape analysis annotations right. Those wrappers
are in CL 174860043.
LGTM=r, aram
R=r, aram
CC=austin, dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/168510043
2014-11-11 15:06:22 -07:00
|
|
|
#include "go_asm.h"
|
|
|
|
#include "go_tls.h"
|
2014-09-04 21:05:18 -06:00
|
|
|
#include "textflag.h"
|
2011-08-29 08:42:16 -06:00
|
|
|
|
2014-02-25 19:20:36 -07:00
|
|
|
#define CLOCK_MONOTONIC $3
|
|
|
|
|
2011-08-29 08:42:16 -06:00
|
|
|
// Exit the entire program (like C exit)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·exit(SB),NOSPLIT,$-4
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $1, AX
|
|
|
|
INT $0x80
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·exit1(SB),NOSPLIT,$8
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0, 0(SP)
|
|
|
|
MOVL $0, 4(SP) // arg 1 - notdead
|
|
|
|
MOVL $302, AX // sys___threxit
|
2011-08-29 08:42:16 -06:00
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·open(SB),NOSPLIT,$-4
|
2013-03-12 11:47:44 -06:00
|
|
|
MOVL $5, AX
|
|
|
|
INT $0x80
|
2015-03-02 21:16:48 -07:00
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $-1, AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+12(FP)
|
2013-03-12 11:47:44 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·close(SB),NOSPLIT,$-4
|
2013-03-12 11:47:44 -06:00
|
|
|
MOVL $6, AX
|
|
|
|
INT $0x80
|
2015-03-02 21:16:48 -07:00
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $-1, AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+4(FP)
|
2013-03-12 11:47:44 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·read(SB),NOSPLIT,$-4
|
2013-03-12 11:47:44 -06:00
|
|
|
MOVL $3, AX
|
|
|
|
INT $0x80
|
2015-03-02 21:16:48 -07:00
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $-1, AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+12(FP)
|
2013-03-12 11:47:44 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·write(SB),NOSPLIT,$-4
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $4, AX // sys_write
|
|
|
|
INT $0x80
|
2015-03-02 21:16:48 -07:00
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $-1, AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+12(FP)
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2014-01-11 01:00:32 -07:00
|
|
|
TEXT runtime·usleep(SB),NOSPLIT,$24
|
2011-10-01 12:58:36 -06:00
|
|
|
MOVL $0, DX
|
|
|
|
MOVL usec+0(FP), AX
|
|
|
|
MOVL $1000000, CX
|
|
|
|
DIVL CX
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL AX, 12(SP) // tv_sec - l32
|
|
|
|
MOVL $0, 16(SP) // tv_sec - h32
|
2011-10-01 12:58:36 -06:00
|
|
|
MOVL $1000, AX
|
|
|
|
MULL DX
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL AX, 20(SP) // tv_nsec
|
2011-10-01 12:58:36 -06:00
|
|
|
|
|
|
|
MOVL $0, 0(SP)
|
|
|
|
LEAL 12(SP), AX
|
|
|
|
MOVL AX, 4(SP) // arg 1 - rqtp
|
|
|
|
MOVL $0, 8(SP) // arg 2 - rmtp
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL $91, AX // sys_nanosleep
|
2011-10-01 12:58:36 -06:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·raise(SB),NOSPLIT,$12
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $299, AX // sys_getthrid
|
2011-09-05 11:05:57 -06:00
|
|
|
INT $0x80
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $0, 0(SP)
|
|
|
|
MOVL AX, 4(SP) // arg 1 - pid
|
2013-03-14 23:11:03 -06:00
|
|
|
MOVL sig+0(FP), AX
|
|
|
|
MOVL AX, 8(SP) // arg 2 - signum
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $37, AX // sys_kill
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·mmap(SB),NOSPLIT,$36
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
LEAL addr+0(FP), SI
|
2011-08-29 08:42:16 -06:00
|
|
|
LEAL 4(SP), DI
|
|
|
|
CLD
|
|
|
|
MOVSL // arg 1 - addr
|
|
|
|
MOVSL // arg 2 - len
|
|
|
|
MOVSL // arg 3 - prot
|
|
|
|
MOVSL // arg 4 - flags
|
|
|
|
MOVSL // arg 5 - fd
|
|
|
|
MOVL $0, AX
|
|
|
|
STOSL // arg 6 - pad
|
|
|
|
MOVSL // arg 7 - offset
|
2012-09-20 23:50:02 -06:00
|
|
|
MOVL $0, AX // top 32 bits of file offset
|
2011-08-29 08:42:16 -06:00
|
|
|
STOSL
|
|
|
|
MOVL $197, AX // sys_mmap
|
|
|
|
INT $0x80
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+24(FP)
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·munmap(SB),NOSPLIT,$-4
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $73, AX // sys_munmap
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·madvise(SB),NOSPLIT,$-4
|
2012-11-26 04:32:59 -07:00
|
|
|
MOVL $75, AX // sys_madvise
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
MOVL $0xf1, 0xf1 // crash
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·setitimer(SB),NOSPLIT,$-4
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL $69, AX
|
2011-08-29 08:42:16 -06:00
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2011-11-30 09:59:44 -07:00
|
|
|
// func now() (sec int64, nsec int32)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT time·now(SB), NOSPLIT, $32
|
2011-11-30 09:59:44 -07:00
|
|
|
LEAL 12(SP), BX
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL $0, 4(SP) // arg 1 - clock_id
|
|
|
|
MOVL BX, 8(SP) // arg 2 - tp
|
|
|
|
MOVL $87, AX // sys_clock_gettime
|
2011-11-30 09:59:44 -07:00
|
|
|
INT $0x80
|
|
|
|
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL 12(SP), AX // sec - l32
|
2011-11-30 09:59:44 -07:00
|
|
|
MOVL AX, sec+0(FP)
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL 16(SP), AX // sec - h32
|
|
|
|
MOVL AX, sec+4(FP)
|
|
|
|
|
|
|
|
MOVL 20(SP), BX // nsec
|
2011-11-30 09:59:44 -07:00
|
|
|
MOVL BX, nsec+8(FP)
|
|
|
|
RET
|
|
|
|
|
2011-11-03 15:35:28 -06:00
|
|
|
// int64 nanotime(void) so really
|
|
|
|
// void nanotime(int64 *nsec)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·nanotime(SB),NOSPLIT,$32
|
2011-08-29 08:42:16 -06:00
|
|
|
LEAL 12(SP), BX
|
2014-02-25 19:20:36 -07:00
|
|
|
MOVL CLOCK_MONOTONIC, 4(SP) // arg 1 - clock_id
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL BX, 8(SP) // arg 2 - tp
|
|
|
|
MOVL $87, AX // sys_clock_gettime
|
2011-08-29 08:42:16 -06:00
|
|
|
INT $0x80
|
2011-11-03 15:35:28 -06:00
|
|
|
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL 16(SP), CX // sec - h32
|
|
|
|
IMULL $1000000000, CX
|
|
|
|
|
|
|
|
MOVL 12(SP), AX // sec - l32
|
|
|
|
MOVL $1000000000, BX
|
|
|
|
MULL BX // result in dx:ax
|
|
|
|
|
|
|
|
MOVL 20(SP), BX // nsec
|
2011-11-03 15:35:28 -06:00
|
|
|
ADDL BX, AX
|
2014-01-11 01:00:32 -07:00
|
|
|
ADCL CX, DX // add high bits with carry
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret_lo+0(FP)
|
|
|
|
MOVL DX, ret_hi+4(FP)
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigaction(SB),NOSPLIT,$-4
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $46, AX // sys_sigaction
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigprocmask(SB),NOSPLIT,$-4
|
2012-04-10 05:57:05 -06:00
|
|
|
MOVL $48, AX // sys_sigprocmask
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+8(FP)
|
2012-04-10 05:57:05 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigtramp(SB),NOSPLIT,$44
|
2011-08-29 08:42:16 -06:00
|
|
|
get_tls(CX)
|
|
|
|
|
all: remove 'extern register M *m' from runtime
The runtime has historically held two dedicated values g (current goroutine)
and m (current thread) in 'extern register' slots (TLS on x86, real registers
backed by TLS on ARM).
This CL removes the extern register m; code now uses g->m.
On ARM, this frees up the register that formerly held m (R9).
This is important for NaCl, because NaCl ARM code cannot use R9 at all.
The Go 1 macrobenchmarks (those with per-op times >= 10 µs) are unaffected:
BenchmarkBinaryTree17 5491374955 5471024381 -0.37%
BenchmarkFannkuch11 4357101311 4275174828 -1.88%
BenchmarkGobDecode 11029957 11364184 +3.03%
BenchmarkGobEncode 6852205 6784822 -0.98%
BenchmarkGzip 650795967 650152275 -0.10%
BenchmarkGunzip 140962363 141041670 +0.06%
BenchmarkHTTPClientServer 71581 73081 +2.10%
BenchmarkJSONEncode 31928079 31913356 -0.05%
BenchmarkJSONDecode 117470065 113689916 -3.22%
BenchmarkMandelbrot200 6008923 5998712 -0.17%
BenchmarkGoParse 6310917 6327487 +0.26%
BenchmarkRegexpMatchMedium_1K 114568 114763 +0.17%
BenchmarkRegexpMatchHard_1K 168977 169244 +0.16%
BenchmarkRevcomp 935294971 914060918 -2.27%
BenchmarkTemplate 145917123 148186096 +1.55%
Minux previous reported larger variations, but these were caused by
run-to-run noise, not repeatable slowdowns.
Actual code changes by Minux.
I only did the docs and the benchmarking.
LGTM=dvyukov, iant, minux
R=minux, josharian, iant, dave, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/109050043
2014-06-26 09:54:39 -06:00
|
|
|
// check that g exists
|
|
|
|
MOVL g(CX), DI
|
|
|
|
CMPL DI, $0
|
2013-07-11 14:39:39 -06:00
|
|
|
JNE 6(PC)
|
2012-09-04 12:40:49 -06:00
|
|
|
MOVL signo+0(FP), BX
|
|
|
|
MOVL BX, 0(SP)
|
2013-07-11 14:39:39 -06:00
|
|
|
MOVL $runtime·badsignal(SB), AX
|
|
|
|
CALL AX
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
JMP ret
|
2012-03-12 13:55:18 -06:00
|
|
|
|
2011-08-29 08:42:16 -06:00
|
|
|
// save g
|
|
|
|
MOVL DI, 20(SP)
|
|
|
|
|
|
|
|
// g = m->gsignal
|
all: remove 'extern register M *m' from runtime
The runtime has historically held two dedicated values g (current goroutine)
and m (current thread) in 'extern register' slots (TLS on x86, real registers
backed by TLS on ARM).
This CL removes the extern register m; code now uses g->m.
On ARM, this frees up the register that formerly held m (R9).
This is important for NaCl, because NaCl ARM code cannot use R9 at all.
The Go 1 macrobenchmarks (those with per-op times >= 10 µs) are unaffected:
BenchmarkBinaryTree17 5491374955 5471024381 -0.37%
BenchmarkFannkuch11 4357101311 4275174828 -1.88%
BenchmarkGobDecode 11029957 11364184 +3.03%
BenchmarkGobEncode 6852205 6784822 -0.98%
BenchmarkGzip 650795967 650152275 -0.10%
BenchmarkGunzip 140962363 141041670 +0.06%
BenchmarkHTTPClientServer 71581 73081 +2.10%
BenchmarkJSONEncode 31928079 31913356 -0.05%
BenchmarkJSONDecode 117470065 113689916 -3.22%
BenchmarkMandelbrot200 6008923 5998712 -0.17%
BenchmarkGoParse 6310917 6327487 +0.26%
BenchmarkRegexpMatchMedium_1K 114568 114763 +0.17%
BenchmarkRegexpMatchHard_1K 168977 169244 +0.16%
BenchmarkRevcomp 935294971 914060918 -2.27%
BenchmarkTemplate 145917123 148186096 +1.55%
Minux previous reported larger variations, but these were caused by
run-to-run noise, not repeatable slowdowns.
Actual code changes by Minux.
I only did the docs and the benchmarking.
LGTM=dvyukov, iant, minux
R=minux, josharian, iant, dave, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/109050043
2014-06-26 09:54:39 -06:00
|
|
|
MOVL g_m(DI), BX
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL m_gsignal(BX), BX
|
|
|
|
MOVL BX, g(CX)
|
|
|
|
|
|
|
|
// copy arguments for call to sighandler
|
|
|
|
MOVL signo+0(FP), BX
|
|
|
|
MOVL BX, 0(SP)
|
|
|
|
MOVL info+4(FP), BX
|
|
|
|
MOVL BX, 4(SP)
|
|
|
|
MOVL context+8(FP), BX
|
|
|
|
MOVL BX, 8(SP)
|
|
|
|
MOVL DI, 12(SP)
|
|
|
|
|
|
|
|
CALL runtime·sighandler(SB)
|
|
|
|
|
|
|
|
// restore g
|
|
|
|
get_tls(CX)
|
|
|
|
MOVL 20(SP), BX
|
|
|
|
MOVL BX, g(CX)
|
2013-07-11 14:39:39 -06:00
|
|
|
|
[dev.power64] cmd/5a, cmd/6a, cmd/8a, cmd/9a: make labels function-scoped
I removed support for jumping between functions years ago,
as part of doing the instruction layout for each function separately.
Given that, it makes sense to treat labels as function-scoped.
This lets each function have its own 'loop' label, for example.
Makes the assembly much cleaner and removes the last
reason anyone would reach for the 123(PC) form instead.
Note that this is on the dev.power64 branch, but it changes all
the assemblers. The change will ship in Go 1.5 (perhaps after
being ported into the new assembler).
Came up as part of CL 167730043.
LGTM=r
R=r
CC=austin, dave, golang-codereviews, minux
https://golang.org/cl/159670043
2014-10-28 19:50:16 -06:00
|
|
|
ret:
|
2011-08-29 08:42:16 -06:00
|
|
|
// call sigreturn
|
|
|
|
MOVL context+8(FP), AX
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
|
|
|
MOVL AX, 4(SP) // arg 1 - sigcontext
|
|
|
|
MOVL $103, AX // sys_sigreturn
|
|
|
|
INT $0x80
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2012-12-18 09:30:29 -07:00
|
|
|
// int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·tfork(SB),NOSPLIT,$12
|
2011-08-29 08:42:16 -06:00
|
|
|
|
2012-12-18 09:30:29 -07:00
|
|
|
// Copy mp, gp and fn from the parent stack onto the child stack.
|
2014-08-28 15:23:25 -06:00
|
|
|
MOVL param+0(FP), AX
|
2012-11-21 07:25:53 -07:00
|
|
|
MOVL 8(AX), CX // tf_stack
|
2011-08-29 08:42:16 -06:00
|
|
|
SUBL $16, CX
|
2012-11-21 07:25:53 -07:00
|
|
|
MOVL CX, 8(AX)
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL mm+8(FP), SI
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL SI, 0(CX)
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL gg+12(FP), SI
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL SI, 4(CX)
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL fn+16(FP), SI
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL SI, 8(CX)
|
|
|
|
MOVL $1234, 12(CX)
|
|
|
|
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL param+0(FP), AX
|
2012-04-25 08:08:02 -06:00
|
|
|
MOVL AX, 4(SP) // arg 1 - param
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL psize+4(FP), AX
|
2012-11-21 07:25:53 -07:00
|
|
|
MOVL AX, 8(SP) // arg 2 - psize
|
|
|
|
MOVL $8, AX // sys___tfork
|
2011-08-29 08:42:16 -06:00
|
|
|
INT $0x80
|
|
|
|
|
2012-04-25 08:08:02 -06:00
|
|
|
// Return if tfork syscall failed.
|
2014-08-28 15:23:25 -06:00
|
|
|
JCC 4(PC)
|
2011-08-29 08:42:16 -06:00
|
|
|
NEGL AX
|
2014-08-28 15:23:25 -06:00
|
|
|
MOVL AX, ret+20(FP)
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
|
|
|
// In parent, return.
|
|
|
|
CMPL AX, $0
|
2014-08-28 15:23:25 -06:00
|
|
|
JEQ 3(PC)
|
|
|
|
MOVL AX, ret+20(FP)
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
|
|
|
// Paranoia: check that SP is as we expect.
|
|
|
|
MOVL 12(SP), BP
|
|
|
|
CMPL BP, $1234
|
|
|
|
JEQ 2(PC)
|
|
|
|
INT $3
|
|
|
|
|
2012-04-25 08:08:02 -06:00
|
|
|
// Reload registers.
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL 0(SP), BX // m
|
|
|
|
MOVL 4(SP), DX // g
|
|
|
|
MOVL 8(SP), SI // fn
|
|
|
|
|
2012-04-25 08:08:02 -06:00
|
|
|
// Set FS to point at m->tls.
|
2011-08-29 08:42:16 -06:00
|
|
|
LEAL m_tls(BX), BP
|
|
|
|
PUSHAL // save registers
|
|
|
|
PUSHL BP
|
|
|
|
CALL runtime·settls(SB)
|
|
|
|
POPL AX
|
|
|
|
POPAL
|
|
|
|
|
|
|
|
// Now segment is established. Initialize m, g.
|
|
|
|
get_tls(AX)
|
|
|
|
MOVL DX, g(AX)
|
all: remove 'extern register M *m' from runtime
The runtime has historically held two dedicated values g (current goroutine)
and m (current thread) in 'extern register' slots (TLS on x86, real registers
backed by TLS on ARM).
This CL removes the extern register m; code now uses g->m.
On ARM, this frees up the register that formerly held m (R9).
This is important for NaCl, because NaCl ARM code cannot use R9 at all.
The Go 1 macrobenchmarks (those with per-op times >= 10 µs) are unaffected:
BenchmarkBinaryTree17 5491374955 5471024381 -0.37%
BenchmarkFannkuch11 4357101311 4275174828 -1.88%
BenchmarkGobDecode 11029957 11364184 +3.03%
BenchmarkGobEncode 6852205 6784822 -0.98%
BenchmarkGzip 650795967 650152275 -0.10%
BenchmarkGunzip 140962363 141041670 +0.06%
BenchmarkHTTPClientServer 71581 73081 +2.10%
BenchmarkJSONEncode 31928079 31913356 -0.05%
BenchmarkJSONDecode 117470065 113689916 -3.22%
BenchmarkMandelbrot200 6008923 5998712 -0.17%
BenchmarkGoParse 6310917 6327487 +0.26%
BenchmarkRegexpMatchMedium_1K 114568 114763 +0.17%
BenchmarkRegexpMatchHard_1K 168977 169244 +0.16%
BenchmarkRevcomp 935294971 914060918 -2.27%
BenchmarkTemplate 145917123 148186096 +1.55%
Minux previous reported larger variations, but these were caused by
run-to-run noise, not repeatable slowdowns.
Actual code changes by Minux.
I only did the docs and the benchmarking.
LGTM=dvyukov, iant, minux
R=minux, josharian, iant, dave, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/109050043
2014-06-26 09:54:39 -06:00
|
|
|
MOVL BX, g_m(DX)
|
2011-08-29 08:42:16 -06:00
|
|
|
|
|
|
|
CALL runtime·stackcheck(SB) // smashes AX, CX
|
|
|
|
MOVL 0(DX), DX // paranoia; check they are not nil
|
|
|
|
MOVL 0(BX), BX
|
|
|
|
|
2012-04-25 08:08:02 -06:00
|
|
|
// More paranoia; check that stack splitting code works.
|
2011-08-29 08:42:16 -06:00
|
|
|
PUSHAL
|
|
|
|
CALL runtime·emptyfunc(SB)
|
|
|
|
POPAL
|
|
|
|
|
2012-04-25 08:08:02 -06:00
|
|
|
// Call fn.
|
2011-08-29 08:42:16 -06:00
|
|
|
CALL SI
|
|
|
|
|
|
|
|
CALL runtime·exit1(SB)
|
|
|
|
MOVL $0x1234, 0x1005
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $288, AX // sys_sigaltstack
|
|
|
|
MOVL new+4(SP), BX
|
|
|
|
MOVL old+8(SP), CX
|
|
|
|
INT $0x80
|
|
|
|
CMPL AX, $0xfffff001
|
|
|
|
JLS 2(PC)
|
|
|
|
INT $3
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·setldt(SB),NOSPLIT,$4
|
2011-08-29 08:42:16 -06:00
|
|
|
// Under OpenBSD we set the GS base instead of messing with the LDT.
|
2012-11-21 07:25:53 -07:00
|
|
|
MOVL tls0+4(FP), AX
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL AX, 0(SP)
|
|
|
|
CALL runtime·settls(SB)
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·settls(SB),NOSPLIT,$8
|
2011-08-29 08:42:16 -06:00
|
|
|
// adjust for ELF: wants to use -8(GS) and -4(GS) for g and m
|
2012-11-21 07:25:53 -07:00
|
|
|
MOVL tlsbase+0(FP), CX
|
2011-08-29 08:42:16 -06:00
|
|
|
ADDL $8, CX
|
|
|
|
MOVL $0, 0(SP) // syscall gap
|
2012-11-21 07:25:53 -07:00
|
|
|
MOVL CX, 4(SP) // arg 1 - tcb
|
|
|
|
MOVL $329, AX // sys___set_tcb
|
2011-08-29 08:42:16 -06:00
|
|
|
INT $0x80
|
|
|
|
JCC 2(PC)
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $0xf1, 0xf1 // crash
|
2011-08-29 08:42:16 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·osyield(SB),NOSPLIT,$-4
|
2011-08-29 08:42:16 -06:00
|
|
|
MOVL $298, AX // sys_sched_yield
|
|
|
|
INT $0x80
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·thrsleep(SB),NOSPLIT,$-4
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL $94, AX // sys___thrsleep
|
2011-10-08 07:56:13 -06:00
|
|
|
INT $0x80
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+20(FP)
|
2011-10-08 07:56:13 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·thrwakeup(SB),NOSPLIT,$-4
|
2012-04-11 06:02:08 -06:00
|
|
|
MOVL $301, AX // sys___thrwakeup
|
2011-10-08 07:56:13 -06:00
|
|
|
INT $0x80
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+8(FP)
|
2011-10-08 07:56:13 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sysctl(SB),NOSPLIT,$28
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
LEAL mib+0(FP), SI
|
2011-10-05 11:16:43 -06:00
|
|
|
LEAL 4(SP), DI
|
|
|
|
CLD
|
|
|
|
MOVSL // arg 1 - name
|
|
|
|
MOVSL // arg 2 - namelen
|
|
|
|
MOVSL // arg 3 - oldp
|
|
|
|
MOVSL // arg 4 - oldlenp
|
|
|
|
MOVSL // arg 5 - newp
|
|
|
|
MOVSL // arg 6 - newlen
|
|
|
|
MOVL $202, AX // sys___sysctl
|
|
|
|
INT $0x80
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
JCC 4(PC)
|
2011-10-05 11:16:43 -06:00
|
|
|
NEGL AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+24(FP)
|
2011-10-05 11:16:43 -06:00
|
|
|
RET
|
|
|
|
MOVL $0, AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+24(FP)
|
2011-10-05 11:16:43 -06:00
|
|
|
RET
|
|
|
|
|
2013-05-20 04:25:32 -06:00
|
|
|
// int32 runtime·kqueue(void);
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·kqueue(SB),NOSPLIT,$0
|
2013-08-15 08:22:55 -06:00
|
|
|
MOVL $269, AX
|
2013-05-20 04:25:32 -06:00
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
NEGL AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+0(FP)
|
2013-05-20 04:25:32 -06:00
|
|
|
RET
|
|
|
|
|
|
|
|
// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout);
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·kevent(SB),NOSPLIT,$0
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL $72, AX // sys_kevent
|
2013-05-20 04:25:32 -06:00
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
NEGL AX
|
cmd/cc, runtime: convert C compilers to use Go calling convention
To date, the C compilers and Go compilers differed only in how
values were returned from functions. This made it difficult to call
Go from C or C from Go if return values were involved. It also made
assembly called from Go and assembly called from C different.
This CL changes the C compiler to use the Go conventions, passing
results on the stack, after the arguments.
[Exception: this does not apply to C ... functions, because you can't
know where on the stack the arguments end.]
By doing this, the CL makes it possible to rewrite C functions into Go
one at a time, without worrying about which languages call that
function or which languages it calls.
This CL also updates all the assembly files in package runtime to use
the new conventions. Argument references of the form 40(SP) have
been rewritten to the form name+10(FP) instead, and there are now
Go func prototypes for every assembly function called from C or Go.
This means that 'go vet runtime' checks effectively every assembly
function, and go vet's output was used to automate the bulk of the
conversion.
Some functions, like seek and nsec on Plan 9, needed to be rewritten.
Many assembly routines called from C were reading arguments
incorrectly, using MOVL instead of MOVQ or vice versa, especially on
the less used systems like openbsd.
These were found by go vet and have been corrected too.
If we're lucky, this may reduce flakiness on those systems.
Tested on:
darwin/386
darwin/amd64
linux/arm
linux/386
linux/amd64
If this breaks another system, the bug is almost certainly in the
sys_$GOOS_$GOARCH.s file, since the rest of the CL is tested
by the combination of the above systems.
LGTM=dvyukov, iant
R=golang-codereviews, 0intro, dave, alex.brainman, dvyukov, iant
CC=golang-codereviews, josharian, r
https://golang.org/cl/135830043
2014-08-27 09:32:17 -06:00
|
|
|
MOVL AX, ret+24(FP)
|
2013-05-20 04:25:32 -06:00
|
|
|
RET
|
|
|
|
|
|
|
|
// int32 runtime·closeonexec(int32 fd);
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·closeonexec(SB),NOSPLIT,$32
|
2014-01-11 01:00:32 -07:00
|
|
|
MOVL $92, AX // sys_fcntl
|
2013-05-20 04:25:32 -06:00
|
|
|
// 0(SP) is where the caller PC would be; kernel skips it
|
|
|
|
MOVL fd+0(FP), BX
|
|
|
|
MOVL BX, 4(SP) // fd
|
|
|
|
MOVL $2, 8(SP) // F_SETFD
|
|
|
|
MOVL $1, 12(SP) // FD_CLOEXEC
|
|
|
|
INT $0x80
|
|
|
|
JAE 2(PC)
|
|
|
|
NEGL AX
|
|
|
|
RET
|
|
|
|
|
2014-09-24 17:04:06 -06:00
|
|
|
GLOBL runtime·tlsoffset(SB),NOPTR,$4
|