Change suggested by iant. The compiler generates
special code for a/b when a is -0x80...0 and b = -1.
A single instruction can cover the case where b is -1,
so only one comparison is needed.
Fixes#3551.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6922049
The code inside the casee and casep labels can perfectly be merged since
they essentially do the same. The character to be stored where cp points is
just the character contained by the c variable.
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6845112
This check for BADWIDTH might happen while in defercheckwidth, making it raise errors for non-erroneous situations.
Fixes#4495.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6927043
Fixes#4492.
% go version
go version devel +6b602ab487d6 Sat Dec 08 14:43:00 2012 +0100 linux/amd64
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6906058
The fixjmp step eliminates redundant chains of JMP
instructions that are produced by the compiler during
code generation.
It is already implemented in gc, and can be adapted to 6c/8c with
the exception that JMPs refer to destination by pc instead of by
pointer. The algorithm is modified to operate on Regs instead of Progs
for this reason. The pcs are already restored later by regopt.
R=goalng-dev, rsc
CC=golang-dev
https://golang.org/cl/6865046
Add missing file that should have been included in CL 6854063 / 5eac1a2d6fc3
R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6891049
The 0-length part is fine, but some callers that write 0 bytes
also pass nil as the data pointer, and the Plan 9 kernel kills the
process with 'invalid address in sys call' in that case.
R=ken2
CC=golang-dev
https://golang.org/cl/6862051
Used to say:
issue4251.go:12: inverted slice range
issue4251.go:12: constant -1 overflows uint64
issue4251.go:16: inverted slice range
issue4251.go:16: constant -1 overflows uint64
issue4251.go:20: inverted slice range
issue4251.go:20: constant -1 overflows uint64
With this patch, only gives the "inverted slice range" errors.
R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/6871058
Fixes#4396.
For fixed arrays larger than the unmapped page, agenr would general a nil check by loading the first word of the array. However there is no requirement for the first element of a byte array to be word aligned, so this check causes a trap on ARMv5 hardware (ARMv6 since relaxed that restriction, but it probably still comes at a cost).
Switching the check to MOVB ensures alignment is not an issue. This check is only invoked in a few places in the code where large fixed arrays are embedded into structs, compress/lzw is the biggest offender, and switching to MOVB has no observable performance penalty.
Thanks to Rémy and Daniel Morsing for helping me debug this on IRC last night.
R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6854063
The debian/kFreeBSD project uses the FreeBSD kernel and the debian userspace. From our point of view, this is freebsd not linux as GOOS talks about the kernel syscall interface, not the userspace (although cgo alters that). As debian/kFreeBSD is experimental at this time, I do not think it is worth the effort of duplicating all the freebsd specific code so this is proposal represents a reasonable workaround.
Currently cgo is not supported, make.bash will detect this and disable cgo automatically during the build.
dfc@debian:~/go/src$ uname -a
GNU/kFreeBSD debian 8.1-1-686 #0 Sat Jul 21 17:02:04 UTC 2012 i686 i386 Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz GNU/kFreeBSD
dfc@debian:~/go/src$ ../bin/go version
go version devel +d05272f402ec Sat Dec 01 15:15:14 2012 -0800
Tested with GOOS=freebsd GOARCH=386
R=golang-dev
CC=golang-dev
https://golang.org/cl/6868046
The compiler was confused when inlining a T.Method(f()) call
where f returns multiple values: support for this was marked
as TODO.
Variadic calls are not supported but are not inlined either.
Add a test preventively for that case.
Fixes#4167.
R=golang-dev, rsc, lvd
CC=golang-dev
https://golang.org/cl/6871043
`godoc net/http` used to complain "/target contains more than one package: http, main"
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6852100
W/o this change stack traces do not show from where sync.Once()
or atomic.XXX was called.
This change add funcenter/exit instrumentation to sync/sync.atomic
packages.
R=golang-dev
CC=golang-dev
https://golang.org/cl/6854112
Package format is a utility package that takes care of
parsing, sorting of imports, and formatting of .go source
using the canonical gofmt formatting parameters.
Use go/format in various clients instead of the lower-level components.
R=r, bradfitz, dave, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/6852075
This allows 5g and 8g to benefit from the rewrite as shifts
or magic multiplies. The 64-bit arithmetic is not handled there,
and left in 6g.
Update #2230.
R=golang-dev, dave, mtj, iant, rsc
CC=golang-dev
https://golang.org/cl/6819123
Bools from comparisons can be assigned to all bool types, but this idealness would propagate through logical operators when the result should have been lowered to a non-ideal form.
Fixes#3924.
R=golang-dev, remyoudompheng, r, rsc, mtj
CC=golang-dev
https://golang.org/cl/6855061
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
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
compiler_rt introduces a weak and hidden symbol compilerrt_abort_impl
into our pre-linked _all.o object, we have to handle it.
Fixes#4273.
R=iant, rsc, r
CC=golang-dev
https://golang.org/cl/6783050
Feature extraction was tested before, but not the final diffs.
This CL breaks function main into a smaller main + testable
compareAPI.
No functional changes.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6820057
- make sure dclcontext == PAUTO only in function bodies
- introduce PDISCARD to discard declarations in bodies of repeated imports
- skip printing initializing OAS'es in export mode, assuming they only occur after ODCL's
- remove ODCL and the initializing OAS from inl.c:ishairy
- fix confused use of ->typecheck in typecheckinl: it's about the ->inl, not about the fn.
- debuging aids: print ntype on ONAMEs too and -Emm instead of -Ell.
fixes#2812
R=rsc
CC=golang-dev
https://golang.org/cl/6800043
includes step 0: synthesize outparams, from 6600044
includes step 1,2: give outparams loopdepth 0 and verify unchanged results
generate esc:$mask tags, but still tie to sink if a param has mask != 0
from 6610054
adds final steps:
- have esccall generate n->escretval, a list of nodes the function results flow to
- use these in esccall and ORETURN/OAS2FUNC/and f(g())
- only tie parameters to sink if tag is absent, otherwise according to mask, tie them to escretval
R=rsc, bradfitz
CC=dave, gobot, golang-dev, iant, rsc
https://golang.org/cl/6741044
includes step 0: synthesize outparams, from 6600044
step 1: give outparams loopdepth 0 and verify unchanged results
step 2: generate esc:$mask tags, but still tie to sink if a param has mask != 0
next step: use in esccall (and ORETURN with implicit OAS2FUNC) to avoid tying to sink
R=rsc
CC=golang-dev
https://golang.org/cl/6610054
in typecheck and walk, conversion from OAS2RECV to OAS2
and to OSELRECV2 duplicated the ->rlist->n to ->right
thereby destroying the strict tree-ness of the AST (up to
ONAMES) of course. Several recursions in esc.c and inl.c
and probably elsewhere assume nodes of the tree aren't duplicated.
rather than defensively code around this, i'd rather assert
these cases away and fix their cause.
(this was tripped in 6741044)
R=rsc
CC=golang-dev
https://golang.org/cl/6750043
It's common to use the go list command in shell scripts, but
currently it's awkward to print a string slice from the Package
type in a way that's easily parseable by the shell. For example:
go list -f '{{range .Deps}}{{.}}
{{end}}'
(and even that prints an unwanted new line at the end|).
To make this easier, this CL adds a "join" function to the
format template.
go list -f '{{join .Deps "\n"}}'
R=rsc, dsymonds, minux.ma, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6680044
Someone new to the language may not know the connection between ints and arrays, which was the only thing that the previous error told you anything about.
Fixes#4256.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6739048
Since this patch changes the way complex literals are written
in export data, there are a few other glitches.
Fixes#4159.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6674047
This patch is enough to fix compilation of
exp/types tests but only passes a stripped down
version of the appripriate torture test.
Update #4207.
R=dave, nigeltao, rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6621061
Valgrind Massif result when linking godoc:
On amd64:
old new -/+
mem_heap_B 185844612 175358047 -5.7%
mem_heap_extra_B 773404 773137 -0.0%
On 386/ARM:
old new -/+
mem_heap_B 141775701 131289941 -7.4%
mem_heap_extra_B 737011 736955 -0.0%
R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/6655045
The compiler is crashing on the following code:
type TypeID int
func (t *TypeID) encodeType(x int) (tt TypeID, err error) {
switch x {
case 0:
return t.encodeType(x * x)
}
return 0, nil
}
The pass marks "return struct" {tt TypeID, err error} as used,
and this causes internal check failure.
I've added the test to:
https://golang.org/cl/6525052/diff/7020/src/pkg/runtime/race/regression_test.go
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6611049
Preparation for forthcoming CL 6624051: Will make it
easier to see if/what changes are incurred by it.
The alignment changes in this CL are due to CL 6610051
(fix to alignment heuristic) where it appears that an
old version of gofmt was run (and thus the correct
alignment updates were not done).
R=r
CC=golang-dev
https://golang.org/cl/6639044
1. correctly initialize .plt.got entries (point to the 1st entry)
2. add section .rel.plt (FreeBSD insists PLT relocs to be there)
3. put relocs of .got.plt into .rel.plt
4. set ELFOSABI_FREEBSD in ELF header
R=rsc
CC=golang-dev
https://golang.org/cl/6643050
Check for specific, important misalignment in garbage collector.
Not a complete fix for issue 599 but an important workaround.
Update #599.
R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/6641049
Updates setup-godoc-app.bash to produce a working godoc app
by substituting the go1.0.x go/... packages with those from tip.
R=gri
CC=golang-dev
https://golang.org/cl/6587080
1. R_ARM_CALL can also be used to call a PLT entry
2. add support for R_ARM_PC24 and R_ARM_JUMP24
3. refactor, remove D_PLT32 in favor of D_CALL
Fixes#4006.
R=rsc, dave
CC=fullung, golang-dev
https://golang.org/cl/6622057
The protection against segfaults does not completely solve
crashes and breaks test/fixedbugs/bug365.go
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6615058
The nil dereference in the next few lines doesn't seem
to cause a segmentation fault on Unix, but does seem
to halt the Go compiler.
The following is a test case:
>>>
package main
func mine(int b) int {
return b + 2
}
func main() {
mine()
c = mine()
}
<<<
Without this change only the following is caught:
typecheck.go:3: undefined: b
typecheck.go:4: undefined: b
with it, we catch all the errors:
typecheck.go:3: undefined: b
typecheck.go:4: undefined: b
typecheck.go:10: undefined: c
typecheck.go:10: cannot assign to c .
R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6542060
The profiler collects goroutine blocking information similar to Google Perf Tools.
You may see an example of the profile (converted to svg) attached to
http://code.google.com/p/go/issues/detail?id=3946
The public API changes are:
+pkg runtime, func BlockProfile([]BlockProfileRecord) (int, bool)
+pkg runtime, func SetBlockProfileRate(int)
+pkg runtime, method (*BlockProfileRecord) Stack() []uintptr
+pkg runtime, type BlockProfileRecord struct
+pkg runtime, type BlockProfileRecord struct, Count int64
+pkg runtime, type BlockProfileRecord struct, Cycles int64
+pkg runtime, type BlockProfileRecord struct, embedded StackRecord
R=rsc, dave, minux.ma, r
CC=gobot, golang-dev, r, remyoudompheng
https://golang.org/cl/6443115
This is the first part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
This change makes gc compiler instrument memory accesses when supplied with -b flag.
R=rsc, nigeltao, lvd
CC=golang-dev
https://golang.org/cl/6497074
This change allows the Go build and install tools to
recognize Plan 9 i386 and amd64 binaries.
R=rsc, r, rminnich
CC=golang-dev
https://golang.org/cl/6575064
Also mention that ignoring second blank identifier of range is required by the spec in the code.
Fixes#4173.
R=daniel.morsing, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6594043
FormatSelections tries to call a nil function value if lw is nil
and the final entry in the selections array is non-nil. Luckily,
this doesn't actually happen in practice since godoc doesn't use
this combination (no line numbers, but with selections).
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6488106
In two cases, registers were allocated too early resulting
in exhausting of available registers when nesting these
operations.
The case of method calls was due to missing cases in igen,
which only makes calls but doesn't allocate a register for
the result.
The case of 8-bit multiplication was due to a wrong order
in register allocation when Ullman numbers were bigger on the
RHS.
Fixes#3907.
Fixes#4156.
R=rsc
CC=golang-dev, remy
https://golang.org/cl/6560054
Low hanging fruit optimization. Will remove an expensive copy if the range variable is an array.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6564052
This CL adds support for the these 7 new instructions to 6a/6l in
preparation of the upcoming CL for AES-NI accelerated crypto/aes:
AESENC, AESENCLAST, AESDEC, AESDECLAST, AESIMC, AESKEYGENASSIST,
and PSHUFD.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5970055
Do not check compiler/linker timestamps for packages that are in the
$GOROOT. Avoids trying to rebuild non-writable standard packages when
timestamps have not been retained on the Go binaries.
Fixes#4106.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6533053
file old_size new_size base@c1ce95068533
bin/go 14717392 6287824 5918236
this huge size difference is due to GC data for runtime.mheap
(NOPTR dataflag is not obeyed).
R=rsc, dave
CC=golang-dev
https://golang.org/cl/6547051
Remove VERSION, which was forcing version to 'devel'.
Old:
$ go version
go version devel
New:
$ go version
go version devel +0a3866d6cc6b Mon Sep 24 20:08:05 2012 -0400
The date and time (and time zone) is that of the most recent commit,
not the time of the build itself. With some effort we could normalize
the zone, but I don't think it's worth the effort (more C coding,
since Mercurial is unhelpful).
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6569049
The assembly offsets were converted mechanically using
code.google.com/p/rsc/cmd/asmlint. The instruction
changes were done by hand.
Fixes#2188.
R=iant, r, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6550058
Was not handling &x.y[0] and &x.y.z correctly where
y is an array or struct-valued field (not a pointer).
R=ken2
CC=golang-dev
https://golang.org/cl/6551059
This CL makes the compiler understand that the type of
the len or cap of a map, slice, or string is 'int', not 'int32'.
It does not change the meaning of int, but it should make
the eventual change of the meaning of int in 6g a bit smoother.
Update #2188.
R=ken, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6542059
Use explicit IntSize constant instead of 4.
This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.
Update #2188.
R=ken, dave
CC=golang-dev
https://golang.org/cl/6554076
This CL makes the size of an int controlled by a variable
in cgo instead of hard-coding 4 (or 32 bits) in various places.
Update #2188.
R=iant, r, dave
CC=golang-dev
https://golang.org/cl/6548061
This CL makes the runtime understand that the type of
the len or cap of a map, slice, or string is 'int', not 'int32',
and it is also careful to distinguish between function arguments
and results of type 'int' vs type 'int32'.
In the runtime, the new typedefs 'intgo' and 'uintgo' refer
to Go int and uint. The C types int and uint continue to be
unavailable (cause intentional compile errors).
This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.
Update #2188.
R=iant, r, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6551067
Using offsets from Tos is cumbersome and we've had problems
in the past. Since it's only being used to grab the PID, we'll just
get that from the default TLS instead.
R=rsc, rminnich, npe
CC=golang-dev
https://golang.org/cl/6543049
Revision 63f7abcae015 introduced a bug caused by
code assuming registers started at X5, not X0.
Fixes#4138.
R=rsc
CC=golang-dev, remy
https://golang.org/cl/6558043
The width was not being set on the address, which meant
that the optimizer could not find variables that overlapped
with it and mark them as having had their address taken.
This let to the compiler believing variables had been set
but never used and then optimizing away the set.
Fixes#4129.
R=ken2
CC=golang-dev
https://golang.org/cl/6552059
OpenBSD now requires ELF binaries to have a PT_NOTE that identifies
it as an OpenBSD binary. Refactor the existing NetBSD ELF signature
code and implement support for OpenBSD ELF signatures.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6489131
Always process the DWARF info, even when the const value is determined
using the debug data block. This ensures that the injected enum is
removed and future loads of the same constant do not trigger
inconsistent definitions.
Add tests for issues 2470 and 4054.
Fixes#4054.
R=golang-dev, fullung, dave, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6501101
In a range loop, the presence of a value implies the presence of a key.
However, the presence of a value as an *ast.Ident does not imply that
the key is also an *ast.Ident, thus leading to a panic any time the
two argument form is used where the key is not an identifier.
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6540045
(see also issue 3961).
hexdump -c testdata/crlf.input
0000000 / * \r \n \t S o u r c e c o n t
0000010 a i n i n g C R / L F l i n
0000020 e e n d i n g s . \r \n \t T h e
0000030 g o f m t ' e d o u t p u t
0000040 m u s t o n l y h a v e
0000050 L F \r \n \t l i n e e n d i n g
0000060 s . \r \n * / \r \n p a c k a g e
0000070 m a i n \r \n \r \n f u n c m a i
0000080 n ( ) { \r \n \t / / l i n e
0000090 c o m m e n t \r \n \t p r i n t l
00000a0 n ( " h e l l o , w o r l d !
00000b0 " ) / / a n o t h e r l i
00000c0 n e c o m m e n t \r \n \t p r i
00000d0 n t l n ( ) \r \n } \r \n
00000db
hexdump -c testdata/crlf.golden
0000000 / * \n \t S o u r c e c o n t a
0000010 i n i n g C R / L F l i n e
0000020 e n d i n g s . \n \t T h e g
0000030 o f m t ' e d o u t p u t m
0000040 u s t o n l y h a v e L F
0000050 \n \t l i n e e n d i n g s . \n
0000060 * / \n p a c k a g e m a i n \n
0000070 \n f u n c m a i n ( ) { \n \t
0000080 / / l i n e c o m m e n t \n
0000090 \t p r i n t l n ( " h e l l o ,
00000a0 w o r l d ! " ) / / a n o
00000b0 t h e r l i n e c o m m e n
00000c0 t \n \t p r i n t l n ( ) \n } \n
00000cf
R=rsc
CC=golang-dev
https://golang.org/cl/6526052
We use pkg path instead of file name (which contains $WORK) in section symbols names.
R=golang-dev, fullung, rsc, iant
CC=golang-dev
https://golang.org/cl/6445085