Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(207)

Issue 65220044: code review 65220044: runtime: use goc2c as much as possible (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by rsc
Modified:
11 years, 3 months ago
Reviewers:
r, gobot
CC:
dave_cheney.net, brainman, r, golang-codereviews
Visibility:
Public.

Description

runtime: use goc2c as much as possible Package runtime's C functions written to be called from Go started out written in C using carefully constructed argument lists and the FLUSH macro to write a result back to memory. For some functions, the appropriate parameter list ended up being architecture-dependent due to differences in alignment, so we added 'goc2c', which takes a .goc file containing Go func declarations but C bodies, rewrites the Go func declaration to equivalent C declarations for the target architecture, adds the needed FLUSH statements, and writes out an equivalent C file. That C file is compiled as part of package runtime. Native Client's x86-64 support introduces the most complex alignment rules yet, breaking many functions that could until now be portably written in C. Using goc2c for those avoids the breakage. Separately, Keith's work on emitting stack information from the C compiler would require the hand-written functions to add #pragmas specifying how many arguments are result parameters. Using goc2c for those avoids maintaining #pragmas. For both reasons, use goc2c for as many Go-called C functions as possible. This CL is a replay of the bulk of CL 15400047 and CL 15790043, both of which were reviewed as part of the NaCl port and are checked in to the NaCl branch. This CL is part of bringing the NaCl code into the main tree. No new code here, just reformatting and occasional movement into .h files.

Patch Set 1 #

Patch Set 2 : diff -r 63af41fd1829 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 63af41fd1829 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 306e64f0c0cf https://code.google.com/p/go/ #

Total comments: 3

Patch Set 5 : diff -r 50c8fc924389 https://code.google.com/p/go/ #

Patch Set 6 : diff -r 50c8fc924389 https://code.google.com/p/go/ #

Patch Set 7 : diff -r 50c8fc924389 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+716 lines, -963 lines) Patch
M src/cmd/dist/buildruntime.c View 1 1 chunk +1 line, -3 lines 0 comments Download
M src/cmd/dist/goc2c.c View 1 2 3 4 5 17 chunks +69 lines, -28 lines 0 comments Download
M src/pkg/runtime/alg.goc View 1 2 chunks +14 lines, -15 lines 0 comments Download
M src/pkg/runtime/cgocall.c View 1 1 chunk +0 lines, -11 lines 0 comments Download
A src/pkg/runtime/chan.h View 1 2 3 4 1 chunk +75 lines, -0 lines 0 comments Download
M src/pkg/runtime/chan.goc View 1 14 chunks +39 lines, -212 lines 0 comments Download
M src/pkg/runtime/complex.goc View 1 2 chunks +2 lines, -6 lines 0 comments Download
M src/pkg/runtime/cpuprof.goc View 1 2 chunks +2 lines, -4 lines 0 comments Download
A src/pkg/runtime/defs.c View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
R src/pkg/runtime/export_test.c View 1 1 chunk +0 lines, -13 lines 0 comments Download
M src/pkg/runtime/export_test.go View 1 3 chunks +16 lines, -14 lines 0 comments Download
A src/pkg/runtime/hashmap.h View 1 2 3 4 1 chunk +147 lines, -0 lines 0 comments Download
M src/pkg/runtime/hashmap.goc View 1 24 chunks +69 lines, -266 lines 0 comments Download
M src/pkg/runtime/hashmap_fast.c View 1 1 chunk +3 lines, -0 lines 0 comments Download
M src/pkg/runtime/iface.goc View 1 16 chunks +39 lines, -158 lines 0 comments Download
M src/pkg/runtime/lfstack.goc View 1 2 chunks +6 lines, -4 lines 0 comments Download
M src/pkg/runtime/malloc.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/runtime/malloc.goc View 1 1 chunk +1 line, -4 lines 0 comments Download
M src/pkg/runtime/mgc0.c View 1 2 3 3 chunks +6 lines, -4 lines 0 comments Download
M src/pkg/runtime/parfor.c View 1 3 chunks +4 lines, -24 lines 0 comments Download
M src/pkg/runtime/pprof/pprof_test.go View 1 1 chunk +5 lines, -5 lines 0 comments Download
M src/pkg/runtime/print.c View 1 4 chunks +14 lines, -22 lines 0 comments Download
M src/pkg/runtime/proc.c View 1 3 chunks +5 lines, -38 lines 0 comments Download
A src/pkg/runtime/rdebug.goc View 1 1 chunk +22 lines, -0 lines 0 comments Download
M src/pkg/runtime/runtime.h View 1 6 chunks +28 lines, -3 lines 0 comments Download
M src/pkg/runtime/runtime.c View 1 4 chunks +0 lines, -81 lines 0 comments Download
M src/pkg/runtime/runtime1.goc View 1 2 chunks +114 lines, -0 lines 0 comments Download
M src/pkg/runtime/slice.goc View 1 8 chunks +7 lines, -23 lines 0 comments Download
M src/pkg/runtime/stack.c View 1 1 chunk +0 lines, -8 lines 0 comments Download
M src/pkg/runtime/string.goc View 1 1 chunk +1 line, -4 lines 0 comments Download
M src/pkg/runtime/symtab.goc View 1 2 3 4 chunks +12 lines, -13 lines 0 comments Download

Messages

Total messages: 9
rsc
Hello dave@cheney.net (cc: golang-codereviews@googlegroups.com, r), I'd like you to review this change to https://code.google.com/p/go/
11 years, 4 months ago (2014-02-18 03:37:00 UTC) #1
brainman
In CL description you have double "from": ... Separately, Keith's work on emitting stack information ...
11 years, 4 months ago (2014-02-18 05:15:04 UTC) #2
rsc
Hello dave@cheney.net, alex.brainman@gmail.com (cc: golang-codereviews@googlegroups.com, r@golang.org), Please take another look.
11 years, 4 months ago (2014-02-19 15:02:03 UTC) #3
brainman
This is a large change ... https://codereview.appspot.com/65220044/diff/60001/src/cmd/dist/buildruntime.c File src/cmd/dist/buildruntime.c (right): https://codereview.appspot.com/65220044/diff/60001/src/cmd/dist/buildruntime.c#newcode373 src/cmd/dist/buildruntime.c:373: "defs.c", Cannot see ...
11 years, 4 months ago (2014-02-19 23:33:10 UTC) #4
dave_cheney.net
I think defs.c is missing. This wouldn't compile cleanly for me yesterday. Dave > On ...
11 years, 4 months ago (2014-02-20 19:38:35 UTC) #5
rsc
I added chan.h, hashmap.h, and defs.c. Sorry.
11 years, 4 months ago (2014-02-20 20:51:31 UTC) #6
r
LGTM
11 years, 4 months ago (2014-02-20 20:54:21 UTC) #7
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=63484e8b6b76 *** runtime: use goc2c as much as possible Package runtime's C ...
11 years, 4 months ago (2014-02-20 20:58:54 UTC) #8
gobot
11 years, 4 months ago (2014-02-20 22:32:07 UTC) #9
Message was sent while issue was closed.
This CL appears to have broken the plan9-386-cnielsen builder.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b