The kern.rthreads sysctl has not existed for a long time - there is no way to
disable rthreads and __tfork no longer returns ENOTSUP.
Change-Id: Ia50ff01ac86ea83358e72b8f45f7818aaec1e4b1
Reviewed-on: https://go-review.googlesource.com/7490
Reviewed-by: Minux Ma <minux@golang.org>
Also:
- Implemented NewFloat convenience factory function (analogous to
NewInt and NewRat).
- Implemented convenience accessors for Accuracy values returned
from Float.Cmp.
- Added test and example.
Change-Id: I985bb4f86e6def222d4b2505417250d29a39c60e
Reviewed-on: https://go-review.googlesource.com/6970
Reviewed-by: Alan Donovan <adonovan@google.com>
Four spaces is what works well for both 4- and 8-space tab stops.
Screen with fixed-width font and 4-space tab stops:
http://imgur.com/lps5Lbb
Change-Id: I7d2b813d674c3e0a68f79d63bc5d5ec5bd4f87bb
Reviewed-on: https://go-review.googlesource.com/7503
Reviewed-by: Rob Pike <r@golang.org>
This is a fairly significant _internal_ representation change. Instead
of encoding 0, finite, infinite, and NaN values with special mantissa
and exponent values, a new (1 byte) 'form' field is used (without making
the Float struct bigger). The form field permits simpler and faster
case distinctions. As a side benefit, for zero and non-finite floats,
fewer fields need to be set. Also, the exponent range is not the full
int32 range (in the old format, infExp and nanExp were used to represent
Inf and NaN values and tests for those values sometimes didn't test
for the empty mantissa, so the range was reduced by 2 values).
The correspondence between the old and new fields is as follows.
Old representation:
x neg mant exp
---------------------------------------------------------------
+/-0 sign empty 0
0 < |x| < +Inf sign mantissa exponent
+/-Inf sign empty infExp
NaN false empty nanExp
New representation (- stands for ignored fields):
x neg mant exp form
---------------------------------------------------------------
+/-0 sign - - zero
0 < |x| < +Inf sign mantissa exponent finite
+/-Inf sign - - inf
NaN - - - nan
Client should not be affected by this change.
Change-Id: I7e355894d602ceb23f9ec01da755fe6e0386b101
Reviewed-on: https://go-review.googlesource.com/6870
Reviewed-by: Alan Donovan <adonovan@google.com>
Make PrintDefaults print an easier-to-read format, and allow the user
to control it a bit by putting a hint into the usage string.
Here is the new doc comment for PrintDefaults, which does the work:
PrintDefaults prints, to standard error unless configured otherwise, a
usage message showing the default settings of all defined command-line
flags. For an integer valued flag x, the default output has the form
-x int
usage-message-for-x (default 7)
The usage message will appear on a separate line except for single-
letter boolean flags. Boolean flags omit the type, since they can be
used without an actual value, and the parenthetical default is omitted
if the default is the zero value for the type. The type, here int, can
be replaced by a string of the user's choosing by placing in the usage
string for the flag a back-quoted name; the first such item in the
message is taken to be a parameter name to show in the message and the
back quotes are stripped from the message when displayed. For instance,
given
flag.String("I", "", "search `directory` for include files")
the output will be
-I directory
search directory for include files.
Given
A = flag.Bool("A", false, "for bootstrapping, allow 'any' type")
B = flag.Bool("Alongflagname", false, "disable bounds checking")
C = flag.Bool("C", true, "a boolean defaulting to true")
D = flag.String("D", "", "set relative `path` for local imports")
F = flag.Float64("F", 2.7, "a non-zero float")
G = flag.Float64("G", 0, "a float that defaults to zero")
N = flag.Int("N", 27, "a non-zero int")
Z = flag.Int("Z", 0, "an int that defaults to zero")
T = flag.Duration("deltaT", 0, "a duration")
the old output was
-A=false: for bootstrapping, allow 'any' type
-Alongflagname=false: disable bounds checking
-C=true: a boolean defaulting to true
-D="": set relative `path` for local imports
-F=2.7: a non-zero float
-G=0: a float that defaults to zero
-N=27: a non-zero int
-Z=0: an int that defaults to zero
-deltaT=0: a duration
and the new output is
-A for bootstrapping, allow 'any' type
-Alongflagname
disable bounds checking
-C a boolean defaulting to true (default true)
-D path
set relative path for local imports
-F float
a non-zero float (default 2.7)
-G float
a float that defaults to zero
-N int
a non-zero int (default 27)
-Z int
an int that defaults to zero
-deltaT duration
a duration
Change-Id: I54ab3cd5610d551422b004d95ab78305e06a395d
Reviewed-on: https://go-review.googlesource.com/7330
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
The old, per-architecture operand printers didn't lock down the
format of the constant in the MRC and MCR instructions (a value
that could be presented more helpfully - maybe how the
input looks? - but that is an issue for another day). But there is
a portable standard printer now so we can enable tests for these
instructions.
Change-Id: I437a3b112ce63f4d6e1fe3450fc21d8c3372602f
Reviewed-on: https://go-review.googlesource.com/7420
Reviewed-by: Russ Cox <rsc@golang.org>
When printing the type of the function there was no newline printed in
case of unexpected type.
Change-Id: I5946413f0864f712a1b955f488b436793018e0e0
Reviewed-on: https://go-review.googlesource.com/7480
Reviewed-by: Minux Ma <minux@golang.org>
Just a trivial thing I noticed in passing.
Change-Id: I875069ceffd623f9e430d07feb5042ab9e69917e
Reviewed-on: https://go-review.googlesource.com/7472
Reviewed-by: Rob Pike <r@golang.org>
Somehow, terribly embarrassingly, I lost part of the "re-enable
-shared on amd64" patch when rebasing before it got submitted.
This restores it and also fixes the addend to be the necessary -4.
Now updated so that Git will not put the new case into the wrong
switch.
Change-Id: I1d628232771a6d6ce6d085adf379f94a377822c5
Reviewed-on: https://go-review.googlesource.com/7126
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This allows /debug/pprof/ and descendents to be used through
http.StripPrefix and other path rewriting handlers.
Change-Id: I53673876c107bbfaf430123ead78e6524b42ac21
Reviewed-on: https://go-review.googlesource.com/7351
Reviewed-by: Andrew Gerrand <adg@golang.org>
When appending zip data to existing data such as a binary file the
zip headers must use the correct offset. NewWriterWithOptions
allows creating a Writer that uses the provided offset in the zip
headers.
Fixes#8669
Change-Id: I6ec64f1e816cc57b6fc8bb9e8a0918e586fc56b0
Reviewed-on: https://go-review.googlesource.com/2978
Reviewed-by: Andrew Gerrand <adg@golang.org>
Fixes#10135.
Change-Id: Ic4c5ab15bcb7b9c3fcc685a788d3b59c60c26e1e
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This will make the intention clearer.
This is migrated from pre-c2go CL 4930.
Change-Id: I9103126a05323daedd729a43b94b2be8cd7408c9
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7410
Reviewed-by: Austin Clements <austin@google.com>
Many headers in DWARF sections have a "unit length" that can be either
4 bytes or 12 bytes and indicates both the length of the unit and
whether the unit is in 32-bit or 64-bit format.
Currently, we implement unit length parsing in four different places.
Add a "unitLength" method to buf that parses a unit length and use it
in these four places.
Change-Id: I7950b91caaa92aa5e19aa63debc8ae46178ecc4d
Reviewed-on: https://go-review.googlesource.com/7281
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The conversion of this logic from C introduced a few subtle behavior
changes. E.g., assigning "name := data[p0:]" and then "name =
name[:p1-p0]" actually caused name to span the vast majority of the
package data, as at the time of the second statement p0 points just
after the package name and p1 points to the end of the package data.
Similarly, the logic for advancing past the newline at the end of the
package line changed slightly: for a "package foo safe" line, the new
code would only advance up to the newline, but not past. (Albeit, in
practice this doesn't matter: newlines in package data are harmless.)
Lastly, "data[p0]" was incorrectly written as "data[0]" a few times.
Change-Id: I49017e16ba33a627f773532b418cbf85a84f2b4b
Reviewed-on: https://go-review.googlesource.com/7000
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The slash is replaced with os.PathSeparator before returning.
Split, SplitList are the exceptions; comments for them mention this.
Fixesgolang/go#10122.
Change-Id: I66dbee8d09f378582e046be8df309a3930151820
Reviewed-on: https://go-review.googlesource.com/7310
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
Everything has moved to Go, but comments still refer to .c/.h files.
Fix all of those up, at least for these three directories.
Fixes#10138
Change-Id: Ie5efe89b247841e0b3f82aac5256b2c606ef67dc
Reviewed-on: https://go-review.googlesource.com/7431
Reviewed-by: Russ Cox <rsc@golang.org>
Add cmd/internal/obj/stringer.go to do the generation and update
the architecture packages to use it to maintain the Anames tables.
Change-Id: I9c6d4def1bf21624668396d70c17973d0db11fbc
Reviewed-on: https://go-review.googlesource.com/7430
Reviewed-by: Russ Cox <rsc@golang.org>
It's an oddball that needs special treatment because it is not really
an opcode, but a variant of MRC.
The String method of Prog still needs updating to print it nicely.
Change-Id: I6005b7f2234ccd3d4ac1f658948e3be97cf1f1c2
Reviewed-on: https://go-review.googlesource.com/7220
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
This allows to test goroutine analysis code in runtime/pprof tests.
Also fix a nil-deref crash in goroutine analysis code that happens on runtime/pprof tests.
Change-Id: Id7884aa29f7fe4a8d7042482a86fe434e030461e
Reviewed-on: https://go-review.googlesource.com/7301
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Augment ProcStart events with OS thread id.
This helps in scheduler locality analysis.
Change-Id: I93fea75d3072cf68de66110d0b59d07101badcb5
Reviewed-on: https://go-review.googlesource.com/7302
Reviewed-by: Keith Randall <khr@golang.org>
More cleanups to gc.Node
- make Node.Local a boolean
- make Type.Local a boolean
- reduce the size of Node.Esc to a uint8
Reducing the size of Node.Esc shaves ~45mb off the RSS compiling cmd/internal/gc on amd64
before:
Maximum resident set size (kbytes): 659496
after:
Maximum resident set size (kbytes): 612196
- declare gc.Funcdepth as int32
- declare Node.Funcdepth as int32
In both cases, these were previously machine specific int types. This doesn't result in
any memory saving at the moment due to struct padding.
Change-Id: Iabef8da15e962fe8b79d7fd3d402fb26ce7ec31c
Reviewed-on: https://go-review.googlesource.com/7261
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This change adds the minimum necessary to implement applyRelocations.
For adg, this code uses the switch statement.
Change-Id: I0989daab8d0e36c2a4f6a315ced258b832744616
Reviewed-on: https://go-review.googlesource.com/7266
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Updates #9974
This change is in preparation for merging the arm64 platform.
Arm64 does not support SYS_DUP2 at all, so define a new constant to be
the minimum dup(2) version supported. This constant defaults to SYS_DUP2
on all existing platforms.
Change-Id: If405878105082c7c880f8541c1491970124c9ce4
Reviewed-on: https://go-review.googlesource.com/7123
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Kick start the upstreaming of the arm64 port. The only manual
change is cmd/go/pkg.go.
Change-Id: I0607ad045486f0998c4e21654b59276ca5348069
Reviewed-on: https://go-review.googlesource.com/7075
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Some of the trace stacks are OS-dependent due to OS-specific code
in net package. Check these stacks only on subset of OSes.
Change-Id: If95e4485839f4120fd6395725374c3a2f8706dfc
Reviewed-on: https://go-review.googlesource.com/7300
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Even though the world is stopped the GC may do pointer
writes that need to be protected by write barriers.
This means that the write barrier must be on
continuously from the time the mark phase starts and
the mark termination phase ends. Checks were added to
ensure that no allocation happens during a GC.
Hoist the logic that clears pools the start of the GC
so that the memory can be reclaimed during this GC cycle.
Change-Id: I9d1551ac5db9bac7bac0cb5370d5b2b19a9e6a52
Reviewed-on: https://go-review.googlesource.com/6990
Reviewed-by: Austin Clements <austin@google.com>
Stip uninteresting bottom and top frames from trace stacks.
This makes both binary and json trace files smaller,
and also makes stacks shorter and more readable in the viewer.
Change-Id: Ib9c80ccc280504f0e235f867f53f1d2652c41583
Reviewed-on: https://go-review.googlesource.com/5523
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
This adds simple ELF test binaries generated by gcc and clang and
compares the line tables returned by the line table reader against
tables based on the output of readelf.
The binaries were generated with
# gcc --version | head -n1
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
# gcc -g -o line-gcc.elf line*.c
# clang --version | head -n1
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
# clang -g -o line-clang.elf line*.c
Change-Id: Id210fdc1d007ac9719e8f5dc845f2b94eed12234
Reviewed-on: https://go-review.googlesource.com/7070
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
This implements a LineReader for line tables that parallels the
existing Reader for debug entries.
This code is partly based on the debug subrepo's fork of dwarf, but it
is a more complete (and, I believe, correct) implementation of the
spec and exposes a more general API. While the debug subrepo's
implementation exposed only a PC-to-line function, this version
exposes the line table rows to the caller. This way the caller can
make its own trade-offs when implementing PC-to-line (or line-to-PC),
such as whether or not to build an index for fast lookup.
Change-Id: Ie157bc817f55e940b6f2e1ae010c5a4e1f29c5c8
Reviewed-on: https://go-review.googlesource.com/6734
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This factors out the code for finding which unit contains an offset in
the "info" section. The new code also replaces linear search with a
binary search. The line table reader will also need this
functionality.
Change-Id: I2076e4fc6719b6f06fd2796cbbc7548ec1876cb3
Reviewed-on: https://go-review.googlesource.com/6733
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: Ia6f9bd77a3d4250339dcb054edc76942864dd358
Reviewed-on: https://go-review.googlesource.com/6781
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Previously, different DWARF sections had relocations applied in very
different ways. .debug_info was relocated, but only on x86-64 and 386
and using hard-coded relocation section names instead of relocation
links. .debug_abbrev and .debug_str were never relocated (which is
excusable because they shouldn't need it). .debug_types sections were
relocated on all architectures and found their relocation section
using a relocation link because section names could be ambiguous.
Simplify all of this so that every DWARF section that has a linked
relocation section gets those relocations applied.
This prepares this code to load .debug_line sections without the need
for yet more ad hoc relocation logic.
Change-Id: Ia00ac8e656b22f22bb31a5f6ef9b0f23cda64d19
Reviewed-on: https://go-review.googlesource.com/6780
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Convert Node.Isddd to a boolean and simplify usage.
- Node.Isddd converted to bool
- Type.Isddd converted to bool
- mkinlcall converted to take isddd as a bool
- typecheckaste converted to take isddd as a bool
- ascompatte converted to take isddd as a bool
Change-Id: I52586145619c44182bb0c2c5d80a0a3fe3e50a07
Reviewed-on: https://go-review.googlesource.com/7172
Reviewed-by: Keith Randall <khr@golang.org>
Removes a potential data race between os.Setenv and runtime.GOROOT,
along with a bug where os.Setenv would only sometimes change the
value of runtime.GOROOT.
Change-Id: I7d2a905115c667ea6e73f349f3784a1d3e8f810d
Reviewed-on: https://go-review.googlesource.com/6611
Reviewed-by: Keith Randall <khr@golang.org>
Updates #7338.
Change-Id: I859a73543352dbdd13ec05efb23a95aecbcc628a
Reviewed-on: https://go-review.googlesource.com/7164
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>