The stack overflow checker in the linker uses the spadj field
to determine whether stack space will be large enough or not.
When spadj=0, the checker treats the function as a nosplit
and emits an error although the program is correct.
Also enable the stack checker in 8l.
Fixes#4316.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6855088
also:
- composite literal checking close to complete
- cleaned up parameter, method, field checking
- don't let panics escape type checker
- more TODOs eliminated
R=rsc
CC=golang-dev
https://golang.org/cl/6816083
The 8l linker automatically inserts XCHG instructions
to support otherwise impossible byte registers
(only available on AX, BX, CX, DX).
Sometimes AX or DX is needed (for MUL and DIV) so
we need to avoid clobbering them.
R=golang-dev, dave, iant, iant, rsc
CC=golang-dev
https://golang.org/cl/6846057
This CL starts to introduce IPv6 scoped addressing capability
into the net package.
The Public API changes are:
+pkg net, type IPAddr struct, Zone string
+pkg net, type IPNet struct, Zone string
+pkg net, type TCPAddr struct, Zone string
+pkg net, type UDPAddr struct, Zone string
Update #4234.
R=rsc, bradfitz, iant
CC=golang-dev
https://golang.org/cl/6849045
Check the return value from malloc - do not assume that we were
allocated memory just because we asked for it.
Update #4415.
R=minux.ma, daniel.morsing, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6782100
If the a network read would block, and a packet arrived just before the timeout expired, then the number of bytes from the previous (blocking) read, -1, would be returned.
This change restores the previous logic, where n would be unconditionally set to 0 if err != nil, but was skipped due to a change in CL 6851096.
The test for this change is CL 6851061.
R=bradfitz, mikioh.mikioh, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/6852085
Should make BSDs more reliable. (they seem to reuse ports
quicker than Linux)
Tested by hand with local modifications to force reuse on
Linux. (net/http tests failed before, pass now) Details in the
issue.
Fixes#4436
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6847101
The tests verify that deadlines are "persistent",
read/write deadlines do not interfere, can be reset,
read deadline can be set with both SetDeadline()
and SetReadDeadline(), etc.
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6850070
The fix for issue 4403 may include more calls to time.Now().UnixNano(). I was concerned that if this function allocated it would cause additional garbage on the heap. It turns out that it doesn't, which is a nice surprise.
Also add benchmark for Now().UnixNano()
R=bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/6849097
Otherwise a fast sender or receiver can make sockets always
readable or writable, preventing deadline checks from ever
occuring.
Update #4191 (fixes it with other CL, coming separately)
Fixes#4403
R=golang-dev, alex.brainman, dave, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6851096
madvise was missing so implement it in assembler. This change
needs to be extended to the other BSD variantes (Net and Open)
Without this change the scavenger will attempt to pass memory back
to the operating system when it has become idle, but the memory is
not returned and for long running Go processes the total memory used
can grow until OOM occurs.
I have only been able to test the code on FreeBSD AMD64. The ARM
platforms needs testing.
R=golang-dev, mikioh.mikioh, dave, jgc, minux.ma
CC=golang-dev
https://golang.org/cl/6850081
Update OpenBSD runtime to use the new version of the sys___tfork
syscall and switch TLS initialisation from sys_arch to sys___set_tcb
(note that both of these syscalls are available in OpenBSD 5.2).
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6843058
Putting aside the unguarded access to fd.sysfile, the condition will never be true as fd.incref above handles the closed condition.
R=mikioh.mikioh, dvyukov
CC=golang-dev
https://golang.org/cl/6845062
The exp/types packages does not support the gccgo export data
format. At some point it should, but not yet.
R=gri, bradfitz, r, iant, dsymonds
CC=golang-dev
https://golang.org/cl/6854068
Noticed this while closing tabs. Yesterday I thought I could
ignore this garbage and hope that a fix for issue 2205 handled
it, but I just realized that's the opposite case,
string->[]byte, whereas this is []byte->string. I'm having a
hard time convincing myself that an Issue 2205-style fix with
static analysis and faking a string header would be safe in
all cases without violating the memory model (callee assumes
frozen memory; are there non-racy ways it could keep being
modified?)
R=dsymonds
CC=dave, gobot, golang-dev
https://golang.org/cl/6850067
Saves 5 seconds on my machine. If Issue 4380 is fixed this
clone can be removed.
Update #4380
R=golang-dev, remyoudompheng, minux.ma, gri
CC=golang-dev
https://golang.org/cl/6845058
There's no good reason to make any printer state adjustments
simply because the file name in node position information has
changed. Eliminate the relevant code.
R=r
CC=golang-dev
https://golang.org/cl/6856054
This enables to loop over some goroutines, e.g. to print the
backtrace of goroutines 1 to 9:
set $i = 1
while $i < 10
printf "backtrace of goroutine %d:\n", $i
goroutine $i++ bt
end
R=lvd, lvd
CC=golang-dev
https://golang.org/cl/6843071
Fixes#4369.
Remove the check for fd.sysfd < 0, the first line of fd.accept() tests if the fd is open correctly and will handle the fd being closed during accept.
R=dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/6843076
This is part 1 of a series of proposals to fix issue 4369.
In resolving issue 3507 it was decided not to nil out the inner conn.fd field to avoid a race. This implies the checks for fd == nil inside incref/decref are never true.
Removing this logic removes one source of errClosing error values, which affects issue 4373 and moves towards bradfitz's request that fd.accept() return io.EOF when closed concurrently.
Update #4369.
Update #4373.
R=mikioh.mikioh, bradfitz, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/6852057
ASTs may be created by various tools and built from nodes of
different files. An incorrectly constructed AST will likely
not print at all, but a (structurally) correct AST with bad
position information should still print structurally correct.
One heuristic used was to reset indentation when the filename
in the position information of nodes changed. However, this
can lead to wrong indentation for structurally correct ASTs.
Fix: Don't change the indentation in this case.
Related to issue 4300.
R=r
CC=golang-dev
https://golang.org/cl/6849066
This significantly decreases amount of shadow memory
mapped by race detector.
I haven't tested on Windows, but on Linux it reduces
virtual memory size from 1351m to 330m for fmt.test.
Fixes#4379.
R=golang-dev, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/6849057
Add support for loading X.509 key pairs that consist of a certificate
with an EC public key and its corresponding EC private key.
R=agl
CC=golang-dev
https://golang.org/cl/6776043
compare incrementally. Also modified collation API to be more high-level
by removing the need for an explicit buffer to be passed as an argument.
This considerably speeds up Compare and CompareString. This change also eliminates
the need to reinitialize the normalization buffer for each use of an iter. This
also significantly improves performance for Key and KeyString.
R=r, rsc
CC=golang-dev
https://golang.org/cl/6842050
Since we no longer skip the first entry when reading a symbol table,
we no longer need to allow for the offset difference when processing
the GNU version symbols.
Unbreaks builds on Linux.
R=golang-dev, agl, iant
CC=golang-dev
https://golang.org/cl/6843057
Do not skip the first symbol in the symbol table. Any other indexes
into the symbol table (for example, indexes in relocation entries)
will now refer to the symbol following the one that was intended.
Add an object that contains debug relocations, which debug/dwarf
failed to decode correctly. Extend the relocation tests to cover
this case.
Note that the existing tests passed since the symbol following the
symbol that required relocation is also of type STT_SECTION.
Fixes#4107.
R=golang-dev, mikioh.mikioh, iant, iant
CC=golang-dev
https://golang.org/cl/6848044
Currently race detector runtime just disables race detection in the finalizer goroutine.
It has false positives when a finalizer writes to shared memory -- the race with finalizer is reported in a normal goroutine that accesses the same memory.
After this change I am going to synchronize the finalizer goroutine with the rest of the world in racefingo(). This is closer to what happens in reality and so
does not have false positives.
And also add README file with instructions how to build the runtime.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6810095
It allows to catch e.g. a data race between atomic write and non-atomic write,
or Mutex.Lock() and mutex overwrite (e.g. mu = Mutex{}).
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6817103
This is a simplified version of earlier versions of this CL
and now only fixes obviously incorrect things, without
changing the locking on bodyEOFReader.
I'd like to see if this is sufficient before changing the
locking.
Update #4191
R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/6739055
The existing algorithm did not properly propagate the type
count from one level to the next, and as a consequence it
missed collisions.
Properly propagate multiplicity (count) information to the
next level.
benchmark old ns/op new ns/op delta
BenchmarkFieldByName1 182 180 -1.10%
BenchmarkFieldByName2 6273 6183 -1.43%
BenchmarkFieldByName3 49267 46784 -5.04%
Fixes#4355.
R=rsc
CC=golang-dev
https://golang.org/cl/6821094
In order to add these, we need to be able to find references
to such types that already exist in the binary. To do that, introduce
a new linker section holding a list of the types corresponding to
arrays, chans, maps, and slices.
To offset the storage cost of this list, and to simplify the code,
remove the interface{} header from the representation of a
runtime type. It was used in early versions of the code but was
made obsolete by the kind field: a switch on kind is more efficient
than a type switch.
In the godoc binary, removing the interface{} header cuts two
words from each of about 10,000 types. Adding back the list of pointers
to array, chan, map, and slice types reintroduces one word for
each of about 500 types. On a 64-bit machine, then, this CL *removes*
a net 156 kB of read-only data from the binary.
This CL does not include the needed support for precise garbage
collection. I have created issue 4375 to track that.
This CL also does not set the 'algorithm' - specifically the equality
and copy functions - for a new array correctly, so I have unexported
ArrayOf for now. That is also part of issue 4375.
Fixes#2339.
R=r, remyoudompheng, mirtchovski, iant
CC=golang-dev
https://golang.org/cl/6572043
This patch introduces a sort of pre-regopt peephole optimization.
When a temporary is introduced that just holds a value for the
duration of the next instruction and is otherwise unused, we
elide it to make the job of regopt easier.
Since x86 has very few registers, this situation happens very
often. The result is large savings in stack variables for
arithmetic-heavy functions.
crypto/aes
benchmark old ns/op new ns/op delta
BenchmarkEncrypt 1301 392 -69.87%
BenchmarkDecrypt 1309 368 -71.89%
BenchmarkExpand 2913 1036 -64.44%
benchmark old MB/s new MB/s speedup
BenchmarkEncrypt 12.29 40.74 3.31x
BenchmarkDecrypt 12.21 43.37 3.55x
crypto/md5
benchmark old ns/op new ns/op delta
BenchmarkHash8Bytes 1761 914 -48.10%
BenchmarkHash1K 16912 5570 -67.06%
BenchmarkHash8K 123895 38286 -69.10%
benchmark old MB/s new MB/s speedup
BenchmarkHash8Bytes 4.54 8.75 1.93x
BenchmarkHash1K 60.55 183.83 3.04x
BenchmarkHash8K 66.12 213.97 3.24x
bench/go1
benchmark old ns/op new ns/op delta
BenchmarkBinaryTree17 8364835000 8303154000 -0.74%
BenchmarkFannkuch11 7511723000 6381729000 -15.04%
BenchmarkGobDecode 27764090 27103270 -2.38%
BenchmarkGobEncode 11240880 11184370 -0.50%
BenchmarkGzip 1470224000 856668400 -41.73%
BenchmarkGunzip 240660800 201697300 -16.19%
BenchmarkJSONEncode 155225800 185571900 +19.55%
BenchmarkJSONDecode 243347900 282123000 +15.93%
BenchmarkMandelbrot200 12240970 12201880 -0.32%
BenchmarkParse 8837445 8765210 -0.82%
BenchmarkRevcomp 2556310000 1868566000 -26.90%
BenchmarkTemplate 389298000 379792000 -2.44%
benchmark old MB/s new MB/s speedup
BenchmarkGobDecode 27.64 28.32 1.02x
BenchmarkGobEncode 68.28 68.63 1.01x
BenchmarkGzip 13.20 22.65 1.72x
BenchmarkGunzip 80.63 96.21 1.19x
BenchmarkJSONEncode 12.50 10.46 0.84x
BenchmarkJSONDecode 7.97 6.88 0.86x
BenchmarkParse 6.55 6.61 1.01x
BenchmarkRevcomp 99.43 136.02 1.37x
BenchmarkTemplate 4.98 5.11 1.03x
Fixes#4035.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6828056
When a nil listener address is passed to some protocol specific
listen function, it will create an unnamed, unbound socket because
of the nil listener address. Other listener functions may return
invalid address error.
This CL allows to pass a nil listener address to all protocol
specific listen functions to fix above inconsistency. Also make it
possible to return a proper local socket address in case of a nil
listner address.
Fixes#4190.
Fixes#3847.
R=rsc, iant
CC=golang-dev
https://golang.org/cl/6525048
The package go.net/ipv4 allows to exist a single UDP listener
that join multiple different group addresses. That means that
LocalAddr on multicast UDPConn returns a first joined group
address is not desirable.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822108
By keeping a single copy of the strings that commonly show up
in headers, we can avoid one string allocation per header.
benchmark old ns/op new ns/op delta
BenchmarkReadMIMEHeader 19590 10824 -44.75%
BenchmarkUncommon 3168 1861 -41.26%
benchmark old allocs new allocs delta
BenchmarkReadMIMEHeader 32 25 -21.88%
BenchmarkUncommon 5 5 0.00%
R=bradfitz, golang-dev, dave, rsc, jra
CC=golang-dev
https://golang.org/cl/6721055
When HTTP bodies were too large and we didn't want to finish
reading them for DoS reasons, we previously found it necessary
to send a FIN and then pause before closing the connection
(which might send a RST) if we wanted the client to have a
better chance at receiving our error response. That was Issue 3595.
This issue adds the same fix to request headers which
are too large, which might fix the Windows flakiness
we observed on TestRequestLimit at:
http://build.golang.org/log/146a2a7d9b24441dc14602a1293918191d4e75f1
R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/6826084
The patch adds more cases to agenr to allocate registers later,
and makes 6g generate addresses for sgen in something else than
SI and DI. It avoids a complex save/restore sequence that
amounts to allocate a register before descending in subtrees.
Fixes#4207.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6817080
There was an init race between
check_test.go:init
universe.go:def
use of Universe
and
universe.go:init
creation of Universe
The order in which init funcs are executed in a package is unspecified.
The test is not currently broken in the golang.org environment
because the go tool compiles the test with non-test sources before test sources,
but other environments may, say, sort the source files before compiling,
and thus trigger this race, causing a nil pointer panic.
R=gri
CC=golang-dev
https://golang.org/cl/6827076
As discussed in issue 2540, nulls are allowed for any type in JSON so they should not result in an error during Unmarshal.
Fixes#2540.
R=rsc
CC=golang-dev
https://golang.org/cl/6759043
Arbitrary decisions: order of the arguments and the
fact it takes a block-type argument (rather than
leaving to user to fill it in later); I'm happy whatever
colour we want to paint it.
We also change DecryptPEMBlock so that it won't
panic when the IV has the wrong size.
R=agl, agl
CC=golang-dev
https://golang.org/cl/6820114
xtramodes' C_PBIT optimisation transforms:
MOVW 0(R3),R1
ADD $4,R3,R3
into:
MOVW.P 4(R3),R1
and the AADD optimisation tranforms:
ADD R0,R1
MOVBU 0(R1),R0
into:
MOVBU R0<<0(R1),R0
5g does not appear to generate sequences that
can be transformed by xtramodes' AMOVW.
R=remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6817085
Otherwise a poorly timed GC can collect the memory before it
is returned to the Go program.
R=golang-dev, dave, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/6819119
On ARM, char is unsigned, and the code generation for
multiplication gets totally broken.
Fixes#4354.
R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6826079
Currently it works incorrectly if user specifies own build tags
and with race detection (e.g. runtime/race is not selected,
because it contains only test files with +build race).
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6814107
When exporting a body containing
x, ok := v.(Type)
the definition for Type was not being included, so when the body
was actually used, it would cause an "unknown type" compiler error.
Fixes#4370.
R=ken2
CC=golang-dev
https://golang.org/cl/6827064
Re-enable the crash tests on NetBSD now that the issue has been
identified and fixed.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6813100
Integrates with the pollserver now.
Uses the old implementation on windows and plan9.
Fixes#2631
R=paul, iant, adg, bendaglish, rsc
CC=golang-dev
https://golang.org/cl/6815049
This is blocking me submitting the net fd timeout
CL, since goapi chokes on my constant.
The much more extensive fix to goapi's type checker
in pending review in https://golang.org/cl/6742050
But I'd rather get this quick fix in first.
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6818104
The code assumed that the only choices were EscNone, EscScope, and EscHeap,
so that it makes sense to set EscScope only if the current setting is EscNone.
Now that we have the many variants of EscReturn, this logic is false, and it was
causing important EscScopes to be ignored in favor of EscReturn.
Fixes#4360.
R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6816103
The old code worked with gc, I assume because the linker
unified identical strings, but it failed with gccgo.
R=rsc
CC=gobot, golang-dev
https://golang.org/cl/6826063
The current implement can fail when the
block size is not a multiple of 8 bytes.
This CL makes it work, and also checks that the
data is in fact a multiple of the block size.
R=agl, agl
CC=golang-dev
https://golang.org/cl/6827058
Avoids problems with local declarations shadowing other names.
We write a more explicit form than the incoming program, so there
may be additional type annotations. For example:
int := "hello"
j := 2
would normally turn into
var int string = "hello"
var j int = 2
but the int variable shadows the int type in the second line.
This CL marks all local variables with a per-function sequence number,
so that this would instead be:
var int·1 string = "hello"
var j·2 int = 2
Fixes#4326.
R=ken2
CC=golang-dev
https://golang.org/cl/6816100
Currently race detector runtime maps shadow memory eagerly at process startup.
It works poorly on Windows, because Windows requires reservation in swap file
(especially problematic if several Go program runs at the same, each consuming GBs
of memory).
With this change race detector maps shadow memory lazily, so Go runtime must notify
about all new heap memory.
It will help with Windows port, but also eliminates scary 16TB virtual mememory
consumption in top output (which sometimes confuses some monitoring scripts).
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6811085
Current racewalk transformation looks like:
x := <-makeChan().c
\/\/\/\/\/\/\/\/\/
runtime.raceread(&makeChan().c)
x := <-makeChan().c
and so makeChan() is called twice.
With this CL the transformation looks like:
x := <-makeChan().c
\/\/\/\/\/\/\/\/\/
chan *tmp = &(makeChan().c)
raceread(&*tmp)
x := <-(*tmp)
Fixes#4245.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822075
It is refactoring towards generic walk
+ it handles mode nodes.
Partially fixes 4228 issue.
R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/6775098
Thank you zhoumichaely for original CL 5175042.
Fixes#1740.
Fixes#2315.
R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev, zhoumichaely
https://golang.org/cl/6822045
Unlike when using -http, godoc -url didn't initialize the "filesystem"
and metadata that are used when generating responses. This CL adds this
initialization, so that -url provides the same results as an HTTP
request when using -http.
Fixes#4335.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6817075
When the first result of a type assertion is blank, the compiler would still copy out a potentially large non-interface type.
Fixes#1021.
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6812079
The test for this is test/index.go, which is not run by
default. That test does not currently pass even after this is
applied, due to issue 4348.
Fixes#4344.
R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6815085
It speedups the race detector somewhat, but also prevents
getcallerpc() from obtaining lessstack().
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6812091
Currently the build fails with -race if a package in GOPATH
imports another package in GOPATH.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6811083
The deadlock occurs when another goroutine requests GC
during the test. When wait=true the test expects physical parallelism,
that is, that P goroutines are all active at the same time.
If GC is requested, then part of the goroutines are not scheduled,
so other goroutines deadlock.
With wait=false, goroutines finish parallel for w/o waiting for all
other goroutines.
Fixes#3954.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6820098
The race detector does not understand ParFor synchronization, because it's implemented in C.
If run with -cpu=2 currently race detector says:
WARNING: DATA RACE
Read by goroutine 5:
runtime_test.TestParForParallel()
src/pkg/runtime/parfor_test.go:118 +0x2e0
testing.tRunner()
src/pkg/testing/testing.go:301 +0x8f
Previous write by goroutine 6:
runtime_test.func·024()
src/pkg/runtime/parfor_test.go:111 +0x52
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6811082
This CL is a backport of 6012049 which improves code
generation for shift operations.
benchmark old ns/op new ns/op delta
BenchmarkLSL 9 5 -49.67%
BenchmarkLSR 9 4 -50.00%
R=golang-dev, minux.ma, r, rsc
CC=golang-dev
https://golang.org/cl/6813045
It also increases timeout deltas to allow for longer wait.
Also disables this test on plan9.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6821062
It was well-defined but easy to miss that the return value for
"not found" is len(input) not -1 as many expect.
Fixes#4205.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6820080
It happens that blocks are used for function calls in a
quite low-level way so they cannot be instrumented as
usual.
Blocks are also used for inlined functions.
R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/6821068
Compiling expressions like:
s[s[s[s[s[s[s[s[s[s[s[s[i]]]]]]]]]]]]
make 5g and 6g run out of registers. Such expressions can arise
if a slice is used to represent a permutation and the user wants
to iterate it.
This is due to the usual problem of allocating registers before
going down the expression tree, instead of allocating them in a
postfix way.
The functions cgenr and agenr (that generate a value to a newly
allocated register instead of an existing location), are either
introduced or modified when they already existed to allocate
the new register as late as possible, and sudoaddable is disabled
for OINDEX nodes so that igen/agenr is used instead.
Update #4207.
R=dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6733055
This is an experiment in static analysis of Go programs
to understand which struct fields a program might use.
It is not part of the Go language specification, it must
be enabled explicitly when building the toolchain,
and it may be removed at any time.
After building the toolchain with GOEXPERIMENT=fieldtrack,
a specific field can be marked for tracking by including
`go:"track"` in the field tag:
package pkg
type T struct {
F int `go:"track"`
G int // untracked
}
To simplify usage, only named struct types can have
tracked fields, and only exported fields can be tracked.
The implementation works by making each function begin
with a sequence of no-op USEFIELD instructions declaring
which tracked fields are accessed by a specific function.
After the linker's dead code elimination removes unused
functions, the fields referred to by the remaining
USEFIELD instructions are the ones reported as used by
the binary.
The -k option to the linker specifies the fully qualified
symbol name (such as my/pkg.list) of a string variable that
should be initialized with the field tracking information
for the program. The field tracking string is a sequence
of lines, each terminated by a \n and describing a single
tracked field referred to by the program. Each line is made
up of one or more tab-separated fields. The first field is
the name of the tracked field, fully qualified, as in
"my/pkg.T.F". Subsequent fields give a shortest path of
reverse references from that field to a global variable or
function, corresponding to one way in which the program
might reach that field.
A common source of false positives in field tracking is
types with large method sets, because a reference to the
type descriptor carries with it references to all methods.
To address this problem, the CL also introduces a comment
annotation
//go:nointerface
that marks an upcoming method declaration as unavailable
for use in satisfying interfaces, both statically and
dynamically. Such a method is also invisible to package
reflect.
Again, all of this is disabled by default. It only turns on
if you have GOEXPERIMENT=fieldtrack set during make.bash.
R=iant, ken
CC=golang-dev
https://golang.org/cl/6749064
The only code change is in exp/gotype/gotype.go.
The latest reviewed version of exp/types is now
exp/types/staging.
First step toward replacing exp/types with
exp/types/staging.
R=iant
CC=golang-dev
https://golang.org/cl/6819071
1. Prepend racefuncenter() to fn->enter -- fn->enter can contain new() calls,
and we want them to be in the scope of the function.
2. Dump fn->enter and fn->exit.
3. Add TODO that OTYPESW expression can contain interesting memory accesses.
4. Ignore only _ names instead of all names starting with _.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6822048
- simplified assignment checking by removing duplicate code
- implemented field lookup (methods, structs, embedded fields)
- importing methods (not just parsing them)
- type-checking functions and methods
- typechecking more statements (inc/dec, select, return)
- tracing support for easier debugging
- handling nil more correctly (comparisons)
- initial support for [...]T{} arrays
- initial support for method expressions
- lots of bug fixes
All packages under pkg/go as well as pkg/exp/types typecheck
now with pkg/exp/gotype applied to them; i.e., a significant
amount of typechecking works now (several statements are not
implemented yet, but handling statements is almost trivial in
comparison with typechecking expressions).
R=rsc
CC=golang-dev
https://golang.org/cl/6768063
Use wrapper functions to tell scheduler what we are doing.
With this patch, and a separate patch to the go tool, all the
cgo tests pass with gccgo.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6812058
* Use -fgo-pkgpath and -gccgopkgpath rather than -fgo-prefix
and -gccgoprefix.
* Define GOPKGPATH when compiling .c or .s files for gccgo.
* Use -fgo-relative-import-path.
* Produce .o files for gccgo, not .[568] files.
* Pass -E when linking if using cgo.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6820064
The idea is to (1) process ninit of all nodes,
and (2) put instrumentation of ninit into the nodes themselves (not the top-level statement ninit).
Fixes#4304.
R=golang-dev, rsc
CC=golang-dev, lvd
https://golang.org/cl/6818049
When local declarations needed unexported types, these could
be missing in the export data.
Fixes build with -gcflags -lll, except for exp/gotype.
R=golang-dev, rsc, lvd
CC=golang-dev
https://golang.org/cl/6813067
This should make the compiler emit errors specific to the bounds checking instead of overflow errors on the underlying types.
Updates #4232.
R=rsc
CC=golang-dev
https://golang.org/cl/6783054
Incorrect cast was causing panics when
calling String() on dnsMsg with dnsRR_A
answers.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6818043
Plan 9 and Go's lib9/fmt disagree on whether %#x includes the 0x prefix
when printing 0, because ANSI C gave bad advice long ago.
Avoiding that case makes binaries compiled on different systems compatible.
R=ken2
CC=akumar, golang-dev
https://golang.org/cl/6814066
defined by the PLTE chunk. Such pixels decode to opaque black,
which matches what libpng does.
Fixes#4319.
On my reading, the PNG spec isn't clear whether palette index values
outside of those defined by the PLTE chunk is an error, and if not,
what to do.
Libpng 1.5.3 falls back to opaque black. png_set_PLTE says:
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
* of num_palette entries, in case of an invalid PNG file that has
* too-large sample values.
*/
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
ImageMagick 6.5.7 returns an error:
$ convert -version
Version: ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP
$ convert packetloss.png x.bmp
convert: Invalid colormap index `packetloss.png' @ image.c/SyncImage/3849.
R=r
CC=golang-dev
https://golang.org/cl/6822065