1
0
mirror of https://github.com/golang/go synced 2024-10-02 14:38:33 -06:00
Commit Graph

77 Commits

Author SHA1 Message Date
Carl Shapiro
4cb921bbf1 runtime: store asmcgocall return PC where the ARM unwind expects it
The ARM implementation of runtime.cgocallback_gofunc diverged
from the calling convention by leaving a word of garbage at
the top of the stack and storing the return PC above the
locals.  This change stores the return PC at the top of the
stack and removes the save area above the locals.

Update #5124
This CL fixes first part of the ARM issues and added the unwind test.

R=golang-dev, bradfitz, minux.ma, cshapiro, rsc
CC=golang-dev
https://golang.org/cl/7728045
2013-03-25 14:10:28 -07:00
Keith Randall
a5d4024139 runtime: faster & safer hash function
Uses AES hardware instructions on 386/amd64 to implement
a fast hash function.  Incorporates a random key to
thwart hash collision DOS attacks.
Depends on CL#7548043 for new assembly instructions.

Update #3885
Helps some by making hashing faster.  Go time drops from
0.65s to 0.51s.

R=rsc, r, bradfitz, remyoudompheng, khr, dsymonds, minux.ma, elias.naur
CC=golang-dev
https://golang.org/cl/7543043
2013-03-12 10:47:44 -07:00
Russ Cox
f8d49b509b runtime/cgo: make symbol naming consistent
The naming in this package is a disaster.
Make it all consistent.

Remove some 'static' from functions that will
be referred to from other files soon.

This CL is purely renames using global search and replace.

Submitting separately so that real changes will not
be drowned out by these renames in future CLs.

TBR=iant
CC=golang-dev
https://golang.org/cl/7416046
2013-02-28 16:24:38 -05:00
Russ Cox
56a0bafdb6 runtime: fix arm build
R=ken2
CC=golang-dev
https://golang.org/cl/7399050
2013-02-22 16:38:44 -05:00
Russ Cox
3d2dfc5a7b runtime: add cgocallback_gofunc that can call Go func value
For now, all the callbacks from C use top-level Go functions,
so they use the equivalent C function pointer, and will continue
to do so. But perhaps some day this will be useful for calling
a Go func value (at least if the type is already known).

More importantly, the Windows callback code needs to be able
to use cgocallback_gofunc to call a Go func value.
Should fix the Windows build.

R=ken2
CC=golang-dev
https://golang.org/cl/7388049
2013-02-22 16:08:56 -05:00
Russ Cox
9f647288ef cmd/gc: avoid runtime code generation for closures
Change ARM context register to R7, to get out of the way
of the register allocator during the compilation of the
prologue statements (it wants to use R0 as a temporary).

Step 2 of http://golang.org/s/go11func.

R=ken2
CC=golang-dev
https://golang.org/cl/7369048
2013-02-22 14:25:50 -05:00
Russ Cox
6066fdcf38 cmd/6g, cmd/8g: switch to DX for indirect call block
runtime: add context argument to gogocall

Too many other things use AX, and at least one
(stack zeroing) cannot be moved onto a different
register. Use the less special DX instead.

Preparation for step 2 of http://golang.org/s/go11func.
Nothing interesting here, just split out so that we can
see it's correct before moving on.

R=ken2
CC=golang-dev
https://golang.org/cl/7395050
2013-02-22 10:47:54 -05:00
Russ Cox
1903ad7189 cmd/gc, reflect, runtime: switch to indirect func value representation
Step 1 of http://golang.org/s/go11func.

R=golang-dev, r, daniel.morsing, remyoudompheng
CC=golang-dev
https://golang.org/cl/7393045
2013-02-21 17:01:13 -05:00
Russ Cox
6c976393ae runtime: allow cgo callbacks on non-Go threads
Fixes #4435.

R=golang-dev, iant, alex.brainman, minux.ma, dvyukov
CC=golang-dev
https://golang.org/cl/7304104
2013-02-20 17:48:23 -05:00
Shenghou Ma
37aba1aa77 runtime: NetBSD/ARM support
R=rsc, dave
CC=golang-dev
https://golang.org/cl/7289044
2013-02-13 01:00:04 +08:00
Dave Cheney
212ce41d00 runtime: arm: abort if hardware floating point missing
Fixes #3911.

Requires CL 6449127.

dfc@qnap:~$ ./runtime.test
runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=7 binary. Recompile using GOARM=5.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6442109
2012-09-07 14:26:42 +10:00
Dave Cheney
3a50bc1a24 runtime: remove memset/memclr shim
This CL resolves https://golang.org/cl/6300043/#msg3
by renaming memset_arm.s to memclr_arm.s and merging the function
of the same name from asm_arm.s.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6336054
2012-06-25 23:01:34 +10:00
Dave Cheney
07826038c3 runtime: avoid r9/r10 during memset
Partially fixes issue 3718.

R=golang-dev, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6300043
2012-06-25 07:59:50 +10:00
Shenghou Ma
a642ca4930 runtime: get per-process random number from auxv for hash table
Decode AT_RANDOM, AT_HWCAP, and AT_PLATFORM.
This CL only make use of AT_RANDOM, but future CLs will make use of the others.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/5978051
2012-05-05 01:59:14 +08:00
Shenghou Ma
018bcc3535 runtime, misc/cgo/test: fix build for Linux/ARM
1. In CL 5989057, I made a mistake in the last minute change.
"MOVW.W R4, -4(SP)" should really be "MOVW.W R4, -4(R13)",
as 5l will rewrite offset for SP.
2. misc/cgo/test/issue1560.go tests for parallel sleep of 1s,
but on ARM, the deadline is frequently missed, so change sleep
time to 2s on ARM.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6202043
2012-05-05 01:35:13 +08:00
Shenghou Ma
5cffce611a runtime: cgo support for Linux/ARM
Part 2 of CL 5601044 (cgo: Linux/ARM support)

R=dave, rsc
CC=golang-dev
https://golang.org/cl/5989057
2012-05-04 18:20:09 +08:00
Shenghou Ma
0f80050542 runtime: fix runtime.Breakpoint for ARM
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6100053
2012-04-24 23:19:44 +08:00
Shenghou Ma
1a59e6239c 5l, runtime: remove softfloat emulation code when not used
This leads to ~30kB improvement on code size for ARM machines with VFP/NEON.
Example: go test -c math
       GOARM=5  GOARM=6
  Old: 1884200  1839144
  New: 1884165  1805245
  -:        35    33899

R=rsc, bradfitz, dave, kai.backman
CC=golang-dev
https://golang.org/cl/5975060
2012-04-11 04:11:27 +08:00
Russ Cox
bd6404a4cc runtime: fix arm build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5832047
2012-03-15 17:40:17 -04:00
Russ Cox
9e5db8c90a 5l, 6l, 8l: fix stack split logic for stacks near default segment size
Fixes #3310.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5823051
2012-03-15 15:22:30 -04:00
Russ Cox
1707a9977f runtime: on 386, fix FP control word on all threads, not just initial thread
It is possible that Linux and Windows copy the FP control word
from the parent thread when creating a new thread.  Empirically,
Darwin does not.  Reset the FP control world in all cases.

Enable the floating-point strconv test.

Fixes #2917 (again).

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5660047
2012-02-14 01:23:15 -05:00
Damian Gryski
8e765da941 runtime: add runtime.cputicks() and seed fastrand with it
This patch adds a function to get the current cpu ticks.  This is
deemed to be 'sufficiently random' to use to seed fastrand to mitigate
the algorithmic complexity attacks on the hash table implementation.

On AMD64 we use the RDTSC instruction.  For 386, this instruction,
while valid, is not recognized by 8a so I've inserted the opcode by
hand.  For ARM, this routine is currently stubbed to return a constant
0 value.

Future work: update 8a to recognize RDTSC.

Fixes #2630.

R=rsc
CC=golang-dev
https://golang.org/cl/5606048
2012-02-02 14:09:27 -05:00
Shenghou Ma
e021357673 runtime: update out-of-date comment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532118
2012-01-22 10:34:17 -08:00
Russ Cox
55889409f8 runtime: separate out auto-generated files, take 2
This is like the ill-fated CL 5493063 except that
I have written a shell script (autogen.sh) instead of
thinking I could possibly write a correct Makefile.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496075
2011-12-19 15:51:13 -05:00
Russ Cox
86dcc431e9 runtime: hg revert -r 6ec0a5c12d75
That was the last build that was close to working.
I will try that change again next week.
Make is being very subtle today.

At the reverted-to CL, the ARM traceback appears
to be broken.  I'll look into that next week too.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5492063
2011-12-16 18:50:40 -05:00
Russ Cox
bd9243da22 runtime: separate out auto-generated files
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5493063
2011-12-16 17:04:32 -05:00
Russ Cox
851f30136d runtime: make more build-friendly
Collapse the arch,os-specific directories into the main directory
by renaming xxx/foo.c to foo_xxx.c, and so on.

There are no substantial edits here, except to the Makefile.
The assumption is that the Go tool will #define GOOS_darwin
and GOARCH_amd64 and will make any file named something
like signals_darwin.h available as signals_GOOS.h during the
build.  This replaces what used to be done with -I$(GOOS).

There is still work to be done to make runtime build with
standard tools, but this is a big step.  After this we will have
to write a script to generate all the generated files so they
can be checked in (instead of generated during the build).

R=r, iant, r, lucio.dere
CC=golang-dev
https://golang.org/cl/5490053
2011-12-16 15:33:58 -05:00