2016-03-01 15:57:46 -07:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
2013-02-28 23:14:55 -07:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2014-09-06 13:27:39 -06:00
|
|
|
#include "textflag.h"
|
2013-08-12 11:25:36 -06:00
|
|
|
|
2016-04-27 15:18:29 -06:00
|
|
|
// Called by C code generated by cmd/cgo.
|
|
|
|
// func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr)
|
|
|
|
// Saves C callee-saved registers and calls fn with three arguments.
|
2013-08-12 11:25:36 -06:00
|
|
|
TEXT crosscall2(SB),NOSPLIT,$-4
|
2013-02-28 23:14:55 -07:00
|
|
|
/*
|
|
|
|
* We still need to save all callee save register as before, and then
|
2016-04-27 15:18:29 -06:00
|
|
|
* push 3 args for fn (R1, R2, R3).
|
2015-06-23 17:50:12 -06:00
|
|
|
* Also note that at procedure entry in gc world, 4(R13) will be the
|
2013-02-28 23:14:55 -07:00
|
|
|
* first arg, so we must push another dummy reg (R0) for 0(R13).
|
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
|
|
|
* Additionally, runtime·load_g will clobber R0, so we need to save R0
|
2013-02-28 23:14:55 -07:00
|
|
|
* nevertheless.
|
|
|
|
*/
|
2016-05-16 07:51:07 -06:00
|
|
|
SUB $(8*9), R13 // Reserve space for the floating point registers.
|
2016-04-27 15:18:29 -06:00
|
|
|
MOVM.WP [R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, g, R11, R12, R14], (R13)
|
2016-05-16 07:51:07 -06:00
|
|
|
|
|
|
|
// Skip floating point registers on GOARM < 6.
|
|
|
|
MOVB runtime·goarm(SB), R11
|
|
|
|
CMP $6, R11
|
|
|
|
BLT skipfpsave
|
|
|
|
MOVD F8, (14*4+8*1)(R13)
|
|
|
|
MOVD F9, (14*4+8*2)(R13)
|
|
|
|
MOVD F10, (14*4+8*3)(R13)
|
|
|
|
MOVD F11, (14*4+8*4)(R13)
|
|
|
|
MOVD F12, (14*4+8*5)(R13)
|
|
|
|
MOVD F13, (14*4+8*6)(R13)
|
|
|
|
MOVD F14, (14*4+8*7)(R13)
|
|
|
|
MOVD F15, (14*4+8*8)(R13)
|
|
|
|
|
|
|
|
skipfpsave:
|
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
|
|
|
BL runtime·load_g(SB)
|
2015-02-17 10:49:57 -07:00
|
|
|
MOVW R15, R14 // R15 is PC.
|
|
|
|
MOVW 0(R13), R15
|
2016-05-16 07:51:07 -06:00
|
|
|
|
|
|
|
MOVB runtime·goarm(SB), R11
|
|
|
|
CMP $6, R11
|
|
|
|
BLT skipfprest
|
|
|
|
MOVD (14*4+8*1)(R13), F8
|
|
|
|
MOVD (14*4+8*2)(R13), F9
|
|
|
|
MOVD (14*4+8*3)(R13), F10
|
|
|
|
MOVD (14*4+8*4)(R13), F11
|
|
|
|
MOVD (14*4+8*5)(R13), F12
|
|
|
|
MOVD (14*4+8*6)(R13), F13
|
|
|
|
MOVD (14*4+8*7)(R13), F14
|
|
|
|
MOVD (14*4+8*8)(R13), F15
|
|
|
|
|
|
|
|
skipfprest:
|
|
|
|
MOVM.IAW (R13), [R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, g, R11, R12, R14]
|
|
|
|
ADD $(8*9), R13
|
|
|
|
MOVW R14, R15
|