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

Issue 7565048: code review 7565048: runtime: refactor os-specific code (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years ago by rsc
Modified:
12 years ago
Reviewers:
akumar
CC:
golang-dev, r
Visibility:
Public.

Description

runtime: refactor os-specific code thread_GOOS.c becomes os_GOOS.c. signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c, but with non-GOARCH-specific code moved into os_GOOS.c. The actual arch-specific signal handler moves into signal_GOARCH.c to avoid per-GOOS duplication. New files signal_GOOS_GOARCH.h provide macros for accessing fields of the very system-specific signal info structs. Lots moving, but nothing changing. This is a preliminarly cleanup so I can work on the signal handling code to fix some open issues without having to make each change 13 times. Tested on Linux and OS X, 386 and amd64. Will fix Plan 9, Windows, and ARM after the fact if necessary. (Plan 9 and Windows should be fine; ARM will probably have some typos.) Net effect: -1081 lines of code.

Patch Set 1 #

Patch Set 2 : diff -r 376f233efcc0 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 74da57c3abfe https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 74da57c3abfe https://go.googlecode.com/hg #

Patch Set 5 : diff -r 74da57c3abfe https://go.googlecode.com/hg #

Patch Set 6 : diff -r 74da57c3abfe https://go.googlecode.com/hg #

Patch Set 7 : diff -r 74da57c3abfe https://go.googlecode.com/hg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+785 lines, -2107 lines) Patch
M src/cmd/dist/build.c View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M src/pkg/runtime/os_darwin.h View 1 2 3 3 chunks +0 lines, -6 lines 0 comments Download
M src/pkg/runtime/os_darwin.c View 1 2 3 2 chunks +39 lines, -0 lines 0 comments Download
M src/pkg/runtime/os_freebsd.h View 1 2 3 1 chunk +0 lines, -6 lines 0 comments Download
M src/pkg/runtime/os_freebsd.c View 1 2 3 2 chunks +56 lines, -0 lines 0 comments Download
M src/pkg/runtime/os_freebsd_arm.c View 1 2 3 1 chunk +0 lines, -170 lines 0 comments Download
M src/pkg/runtime/os_linux.h View 1 2 3 2 chunks +0 lines, -6 lines 0 comments Download
M src/pkg/runtime/os_linux.c View 1 2 3 2 chunks +58 lines, -0 lines 0 comments Download
M src/pkg/runtime/os_linux_386.c View 1 2 3 1 chunk +0 lines, -143 lines 0 comments Download
M src/pkg/runtime/os_linux_arm.c View 1 2 3 1 chunk +0 lines, -159 lines 0 comments Download
M src/pkg/runtime/os_netbsd.h View 1 2 3 2 chunks +0 lines, -6 lines 0 comments Download
M src/pkg/runtime/os_netbsd.c View 1 2 3 2 chunks +56 lines, -0 lines 0 comments Download
M src/pkg/runtime/os_netbsd_386.c View 1 2 3 1 chunk +0 lines, -147 lines 0 comments Download
M src/pkg/runtime/os_netbsd_amd64.c View 1 2 3 1 chunk +0 lines, -154 lines 0 comments Download
M src/pkg/runtime/os_netbsd_arm.c View 1 2 3 1 chunk +0 lines, -176 lines 0 comments Download
M src/pkg/runtime/os_openbsd.h View 1 2 3 2 chunks +0 lines, -6 lines 0 comments Download
M src/pkg/runtime/os_openbsd.c View 1 2 3 2 chunks +53 lines, -0 lines 0 comments Download
M src/pkg/runtime/os_plan9.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/os_plan9.c View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
M src/pkg/runtime/os_plan9_386.c View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
M src/pkg/runtime/os_plan9_amd64.c View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
M src/pkg/runtime/os_windows.c View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
M src/pkg/runtime/os_windows_386.c View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
M src/pkg/runtime/os_windows_amd64.c View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
M src/pkg/runtime/signal_386.c View 1 2 4 chunks +52 lines, -88 lines 0 comments Download
M src/pkg/runtime/signal_amd64.c View 1 2 4 chunks +62 lines, -98 lines 0 comments Download
M src/pkg/runtime/signal_arm.c View 1 2 5 chunks +45 lines, -166 lines 0 comments Download
A src/pkg/runtime/signal_darwin_386.h View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_darwin_amd64.h View 1 2 1 chunk +31 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_freebsd_386.h View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
R src/pkg/runtime/signal_freebsd_386.c View 1 2 1 chunk +0 lines, -154 lines 0 comments Download
A src/pkg/runtime/signal_freebsd_amd64.h View 1 2 1 chunk +31 lines, -0 lines 0 comments Download
R src/pkg/runtime/signal_freebsd_amd64.c View 1 2 1 chunk +0 lines, -162 lines 0 comments Download
A src/pkg/runtime/signal_freebsd_arm.h View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_linux_386.h View 1 2 3 4 1 chunk +24 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_linux_amd64.h View 1 2 3 1 chunk +32 lines, -0 lines 0 comments Download
R src/pkg/runtime/signal_linux_amd64.c View 1 2 1 chunk +0 lines, -162 lines 0 comments Download
A src/pkg/runtime/signal_linux_arm.h View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_netbsd_386.h View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_netbsd_amd64.h View 1 2 1 chunk +31 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_netbsd_arm.h View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
A src/pkg/runtime/signal_openbsd_386.h View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
R src/pkg/runtime/signal_openbsd_386.c View 1 2 1 chunk +0 lines, -147 lines 0 comments Download
A src/pkg/runtime/signal_openbsd_amd64.h View 1 2 1 chunk +31 lines, -0 lines 0 comments Download
R src/pkg/runtime/signal_openbsd_amd64.c View 1 2 1 chunk +0 lines, -156 lines 0 comments Download
A src/pkg/runtime/signal_unix.h View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M src/pkg/runtime/signal_unix.c View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 5
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg
12 years ago (2013-03-14 18:31:29 UTC) #1
r
LGTM
12 years ago (2013-03-14 18:34:12 UTC) #2
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=9d23267675ef *** runtime: refactor os-specific code thread_GOOS.c becomes os_GOOS.c. signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c, ...
12 years ago (2013-03-14 18:35:17 UTC) #3
akumar_mail.nanosouffle.net
On 14 March 2013 11:35, <rsc@golang.org> wrote: > The actual arch-specific signal handler moves into ...
12 years ago (2013-03-15 19:59:16 UTC) #4
rsc
12 years ago (2013-03-15 20:31:32 UTC) #5
On Fri, Mar 15, 2013 at 3:58 PM, Akshat Kumar
<akumar@mail.nanosouffle.net>wrote:

> On 14 March 2013 11:35,  <rsc@golang.org> wrote:
> > The actual arch-specific signal handler moves into signal_GOARCH.c
> > to avoid per-GOOS duplication.
>
> However, this is still only built for UNIX systems, so the name
> seems to be inconsistent with the general naming scheme.
> Since the entire signal handling code for Plan 9 and Windows
> has been moved into os_GOOS_GOARCH.c files respectively,
> perhaps even signal_GOARCH.c should become
> os_unix_GOARCH.c? Otherwise, I'd suggest at least
> signal_unix_GOARCH.c.
>

Thanks for the feedback, but we've met our refactoring quota for a few
months. Let's leave things the way they are now. Perhaps some day I will
make Plan 9 and Windows use those files too, but for now I am comfortable
with 386+amd64+arm+plan9/386+plan9/amd64+windows/386+windows/amd64. I can
deal with the 5x duplication a lot better than I can deal with the 17x we
had a few days ago.

> New files signal_GOOS_GOARCH.h provide macros for
> > accessing fields of the very system-specific signal info structs.
>
> Also, these might be better merged into defs_GOOS_GARCH.h,
> in line with the former approach outlined above.
>

The defs files are automatically generated. Hand-written code cannot be
placed there. It is also useful to limit the number of files that see those
definitions.

Russ
Sign in to reply to this message.

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