|
cmd/cc, cmd/ld, runtime: disallow conservative data/bss objects
In linker, refuse to write conservative (array of pointers) as the
garbage collection type for any variable in the data/bss GC program.
In the linker, attach the Go type to an already-read C declaration
during dedup. This gives us Go types for C globals for free as long
as the cmd/dist-generated Go code contains the declaration.
(Most runtime C declarations have a corresponding Go declaration.
Both are bss declarations and so the linker dedups them.)
In cmd/dist, add a few more C files to the auto-Go-declaration list
in order to get Go type information for the C declarations into the linker.
In C compiler, mark all non-pointer-containing global declarations
and all string data as NOPTR. This allows them to exist in C files
without any corresponding Go declaration. Count C function pointers
as "non-pointer-containing", since we have no heap-allocated C functions.
In runtime, add NOPTR to the remaining pointer-containing declarations,
none of which refer to Go heap objects.
In runtime, also move os.Args and syscall.envs data into runtime-owned
variables. Otherwise, in programs that do not import os or syscall, the
runtime variables named os.Args and syscall.envs will be missing type
information.
I believe that this CL eliminates the final source of conservative GC scanning
in non-SWIG Go programs, and therefore...
Fixes issue 909.
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+126 lines, -77 lines) |
Patch |
|
M |
src/cmd/cc/dcl.c
|
View
|
1
|
3 chunks |
+6 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/cmd/cc/lex.c
|
View
|
1
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/cmd/cgo/out.go
|
View
|
1
|
3 chunks |
+13 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/cmd/dist/buildruntime.c
|
View
|
1
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/cmd/ld/data.c
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
src/liblink/objfile.c
|
View
|
1
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/os/proc.go
|
View
|
1
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/asm_386.s
|
View
|
1
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/runtime/asm_amd64.s
|
View
|
1
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/runtime/asm_amd64p32.s
|
View
|
1
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/runtime/heapdump.c
|
View
|
1
|
2 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/malloc.h
|
View
|
1
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/runtime/malloc.c
|
View
|
1
|
1 chunk |
+0 lines, -23 lines |
0 comments
|
Download
|
|
M |
src/runtime/mcache.c
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/runtime/mgc0.c
|
View
|
1
|
3 chunks |
+2 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/runtime/os_windows.c
|
View
|
1
|
2 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/runtime/proc.c
|
View
|
1
|
3 chunks |
+9 lines, -21 lines |
0 comments
|
Download
|
|
M |
src/runtime/proc.go
|
View
|
1
|
1 chunk |
+8 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/runtime.c
|
View
|
1
2
|
5 chunks |
+16 lines, -9 lines |
0 comments
|
Download
|
|
M |
src/runtime/runtime.go
|
View
|
1
2
|
2 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_darwin.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_dragonfly.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_freebsd.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_linux.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_nacl.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_netbsd.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_openbsd.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_plan9.h
|
View
|
1
|
2 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/signals_solaris.h
|
View
|
1
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime/stack.c
|
View
|
1
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/runtime/thunk.s
|
View
|
1
|
2 chunks |
+7 lines, -1 line |
0 comments
|
Download
|
|
M |
src/syscall/env_unix.go
|
View
|
1
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
Total messages: 4
|