1
0
mirror of https://github.com/golang/go synced 2024-10-03 13:21:22 -06:00
Commit Graph

1454 Commits

Author SHA1 Message Date
Russ Cox
6e3a7930eb cmd/gc: if $GOROOT_FINAL is set, rewrite file names in object files
GOROOT_FINAL is a build parameter that means "eventually
the Go tree will be installed here".  Make the file name information
match that eventual location.

Fixes #3180.

R=ken, ken
CC=golang-dev
https://golang.org/cl/5742043
2012-03-05 16:13:33 -05:00
Russ Cox
cae604f734 cmd/gc: must not inline panic, recover
R=lvd, gri
CC=golang-dev
https://golang.org/cl/5731061
2012-03-05 13:51:44 -05:00
Russ Cox
5ab9d2befd cmd/gc: show duplicate key in error
R=ken2
CC=golang-dev
https://golang.org/cl/5728064
2012-03-05 13:47:36 -05:00
Russ Cox
604f375110 cmd/go: fix relative imports again
I tried before to make relative imports work by simply
invoking the compiler in the right directory, so that
an import of ./foo could be resolved by ./foo.a.
This required creating a separate tree of package binaries
that included the full path to the source directory, so that
/home/gopher/bar.go would be compiled in
tmpdir/work/local/home/gopher and perhaps find
a ./foo.a in that directory.

This model breaks on Windows because : appears in path
names but cannot be used in subdirectory names, and I
missed one or two places where it needed to be removed.

The model breaks more fundamentally when compiling
a test of a package that lives outside the Go path, because
we effectively use a ./ import in the generated testmain,
but there we want to be able to resolve the ./ import
of the test package to one directory and all the other ./
imports to a different directory.  Piggybacking on the compiler's
current working directory is then no longer possible.

Instead, introduce a new compiler option -D prefix that
makes the compiler turn a ./ import into prefix+that,
so that import "./foo" with -D a/b/c turns into import
"a/b/c/foo".  Then we can invent a package hierarchy
"_/" with subdirectories named for file system paths:
import "./foo" in the directory /home/gopher becomes
import "_/home/gopher/foo", and since that final path
is just an ordinary import now, all the ordinary processing
works, without special cases.

We will have to change the name of the hierarchy if we
ever decide to introduce a standard package with import
path "_", but that seems unlikely, and the detail is known
only in temporary packages that get thrown away at the
end of a build.

Fixes #3169.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5732045
2012-03-02 22:16:02 -05:00
Anthony Martin
564a1f3358 gc: fix string comparisons for new bool rules
The two string comparison optimizations were
missing the implicit cast from ideal bool.

Fixes #3119.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696071
2012-02-29 13:55:50 -08:00
Russ Cox
d0d251f858 gc: disallow absolute import paths
They are broken and hard to make work.

They have never worked: if you import "/tmp/x"
from "/home/rsc/p.c" then the compiler rewrites
this into import "/home/rsc/tmp/x", which is
clearly wrong.

Also we just disallowed the : character in import
paths, so import "c:/foo" is already not allowed.

Finally, in order to support absolute paths well in
a build tool we'd have to provide a mechanism to
instruct the compiler to resolve absolute imports
by looking in some other tree (where the binaries live)
and provide a mapping from absolute path to location
in that tree.  This CL avoids adding that complexity.

This is not part of the language spec (and should not be),
so no spec change is needed.

If we need to make them work later, we can.

R=ken2
CC=golang-dev
https://golang.org/cl/5712043
2012-02-29 15:28:36 -05:00
Anthony Martin
dc38756ce1 gc: reject import paths containing special characters
Also allow multiple invalid import statements in a
single file.

Fixes #3021. The changes to go/parser and the
language specifcation have already been committed.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5672084
2012-02-24 14:48:36 -05:00
Russ Cox
075eef4018 gc: fix escape analysis + inlining + closure bug
R=ken2
CC=golang-dev, lvd
https://golang.org/cl/5693056
2012-02-23 23:09:53 -05:00
Russ Cox
e29d3dfc49 gc: new, less strict bool rules
R=ken2
CC=golang-dev
https://golang.org/cl/5688064
2012-02-22 00:29:37 -05:00
Russ Cox
6c7daca236 gc: never crash during a debugging print
TBR=lvd
CC=golang-dev
https://golang.org/cl/5686063
2012-02-22 00:29:23 -05:00
Russ Cox
a457fa500d gc: return of ideal bool
This is a manual undo of CL 5674098.
It does not implement the even less strict spec
that we just agreed on, but it gets us back where
we were at the last weekly.

R=ken2
CC=golang-dev
https://golang.org/cl/5683069
2012-02-21 22:54:07 -05:00
Russ Cox
83feedf7bf gc: fix error for floating-point constant %
R=ken2
CC=golang-dev
https://golang.org/cl/5674108
2012-02-19 00:12:31 -05:00
Russ Cox
126d475a43 gc: drop ideal bool
R=golang-dev, ken2
CC=golang-dev
https://golang.org/cl/5674098
2012-02-18 21:07:08 -05:00
Russ Cox
c4c92ebeb6 cmd/gc: fix comparison of struct with _ field
Fixes #2989.

R=ken2
CC=golang-dev
https://golang.org/cl/5674091
2012-02-17 14:45:29 -05:00
Rémy Oudompheng
1d3ca9236e cmd/gc: correctly typecheck expression lists in returns.
Invalid return statements were accidentally compiling or
triggering internal errors.
Fixes #3044.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5673074
2012-02-16 23:42:19 +01:00
Rémy Oudompheng
79db6ada48 cmd/gc: error on constant shift overflows.
Fixes #3019.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5674044
2012-02-16 00:19:42 +01:00
Maxim Pimenov
87a04c0bcf gc: fix comment in mkbuiltin
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5669046
2012-02-14 16:27:35 -05:00
Russ Cox
1f2445d27b gc: delete old unsafe functions
Also update build to be able to run mkbuiltin again.
The export form has changed a little, so builtin.c has
more diffs than unsafe.go.

In CL 5650069, I just edited the documentation, a rarely
successful method of change.

R=ken2
CC=golang-dev
https://golang.org/cl/5662043
2012-02-13 15:37:35 -05:00
Anthony Martin
dbec42104f gc, 8g, 8l: fix a handful of warnings
8g/cgen.c
        print format type mismatch

8l/asm.c
        resoff set and not used

gc/pgen.c
        misleading comparison INT > 0x80000000

gc/reflect.c
        dalgsym must be static to match forward declaration

gc/subr.c
        assumed_equal set and not used
        hashmem's second argument is not used

gc/walk.c
        duplicated (unreachable) code

R=rsc
CC=golang-dev
https://golang.org/cl/5651079
2012-02-12 23:07:31 -08:00
Russ Cox
6a75ece01c runtime: delete Type and implementations (use reflect instead)
unsafe: delete Typeof, Reflect, Unreflect, New, NewArray

Part of issue 2955 and issue 2968.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650069
2012-02-12 23:26:20 -05:00
Russ Cox
7dd90621f8 gc: diagnose field+method of same name
Fixes #2828.

R=ken2
CC=golang-dev
https://golang.org/cl/5653065
2012-02-11 01:21:12 -05:00
Russ Cox
2aafad25b4 gc: print detail for typechecking loop error
R=ken2
CC=golang-dev
https://golang.org/cl/5654060
2012-02-11 01:04:33 -05:00
Russ Cox
2f3d695a61 gc: fix bug introduced earlier
Apparently l and $1 were the same register on Linux.
On the other systems, the compiler caught it.

R=ken2
CC=golang-dev
https://golang.org/cl/5654061
2012-02-11 01:04:24 -05:00
Russ Cox
337547d1c9 gc: make constant arith errors a little more friendly
Fixes #2804.

R=ken2
CC=golang-dev
https://golang.org/cl/5652067
2012-02-11 00:50:56 -05:00
Russ Cox
77aaa3555d gc: fix import of struct type in struct literal
Fixes #2716.

R=ken2
CC=golang-dev
https://golang.org/cl/5652065
2012-02-11 00:34:01 -05:00
Russ Cox
f91cc3bdbb gc: optimize interface ==, !=
If the values being compared have different concrete types,
then they're clearly unequal without needing to invoke the
actual interface compare routine.  This speeds tests for
specific values, like if err == io.EOF, by about 3x.

benchmark                  old ns/op    new ns/op    delta
BenchmarkIfaceCmp100             843          287  -65.95%
BenchmarkIfaceCmpNil100          184          182   -1.09%

Fixes #2591.

R=ken2
CC=golang-dev
https://golang.org/cl/5651073
2012-02-11 00:19:24 -05:00
Russ Cox
896f0c61c8 gc: diagnose init loop involving func
Fixes #2295.

R=ken2
CC=golang-dev
https://golang.org/cl/5655057
2012-02-10 23:10:45 -05:00
Russ Cox
7ae1fe420e gc: eliminate duplicate ambiguous selector message
Also show actual expression in message when possible.

Fixes #2599.

R=ken2
CC=golang-dev
https://golang.org/cl/5654059
2012-02-10 22:46:56 -05:00
Luuk van Dijk
e0b2ce3401 cmd/gc: suspend safemode during typecheck of inlined bodies.
Should be obviously correct.  Includes minimal test case.
A future CL should clear up the logic around typecheckok and importpkg != nil someday.

R=rsc, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5652057
2012-02-10 22:50:55 +01:00
Russ Cox
5c52404aca gc: implicit type bug fix in export data
TBR=lvd
CC=golang-dev
https://golang.org/cl/5644064
2012-02-09 00:26:08 -05:00
Russ Cox
fec7fa8b9d build: delete make paraphernalia
As a convenience to people working on the tools,
leave Makefiles that invoke the go dist tool appropriately.
They are not used during the build.

R=golang-dev, bradfitz, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/5636050
2012-02-06 13:34:25 -05:00
Anthony Martin
7ac03695f8 build: remove unnecessary pragmas
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5629055
2012-02-06 12:45:23 -05:00
Russ Cox
74ee51ee92 cmd/gc: disallow switch _ := v.(type)
Fixes #2827.

R=ken2
CC=golang-dev
https://golang.org/cl/5638045
2012-02-06 12:35:29 -05:00
Luuk van Dijk
0b9f090861 cmd/gc: another special (%hhS) case for method names.
Fixes #2877

R=rsc
CC=golang-dev
https://golang.org/cl/5637047
2012-02-06 16:38:59 +01:00
Luuk van Dijk
5efd5624cc cmd/gc: fix codegen reordering for expressions involving && and ||
Fixes #2821.

R=rsc
CC=golang-dev
https://golang.org/cl/5606061
2012-02-06 15:41:01 +01:00
Luuk van Dijk
419c53af30 gc: don't print implicit type on struct literal in export
As pointed out in the discussion around 2678.

R=rsc
CC=golang-dev
https://golang.org/cl/5534077
2012-02-06 12:19:59 +01:00
Russ Cox
d53cdd1775 gc: check in y.tab.[ch], yerr.h, builtin.c.
This enables builds on systems without Bison/yacc.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5622051
2012-02-03 10:53:31 -05:00
Anthony Martin
4b6cd239c5 gc: describe debugging flags
The change to -m is the only one necessary
to close the issue.  The others are useful
to know about when debugging but shouldn't
be in the usage message since they may go
away or change at any time.

Fixes #2802.

R=lvd, rsc
CC=golang-dev
https://golang.org/cl/5606046
2012-02-02 14:02:54 -08:00
Anthony Martin
e280035fc1 gc, cc: avoid using the wrong library when building the compilers
This can happen on Plan 9 if we we're building
with the 32-bit and 64-bit host compilers, one
after the other.

R=rsc
CC=golang-dev
https://golang.org/cl/5599053
2012-02-01 04:14:37 -08:00
Anthony Martin
8039683cef gc: use octal escapes in mkopnames
Plan 9's tr(1) doesn't accept the C-style escapes
for tab and newline characters.  I was going to use
the \xFF hexadecimal escapes but GNU tr(1) doesn't
accept those.  It seems octal is the least common
denominator.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5576079
2012-01-31 18:15:42 -08:00
Russ Cox
33f3afa7af gc: diagnose \ in import path
R=ken2
CC=golang-dev
https://golang.org/cl/5609044
2012-01-31 17:29:59 -05:00
Rémy Oudompheng
21f1769519 gc: use original constant expression in error messages.
Fixes #2768.

R=golang-dev, lvd, iant
CC=golang-dev, remy
https://golang.org/cl/5572081
2012-01-29 10:35:11 +01:00
David Symonds
1b19134c4f gc: remove extra paranoia from inlining unsafe.Pointer fix.
R=rsc
CC=golang-dev
https://golang.org/cl/5569075
2012-01-27 13:59:32 +11:00
David Symonds
2332439b1b gc: permit unsafe.Pointer for inlined functions.
R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5573075
2012-01-27 13:44:48 +11:00
Russ Cox
408f0b1f74 gc, runtime: handle floating point map keys
Fixes #2609.

R=ken2
CC=golang-dev
https://golang.org/cl/5572069
2012-01-26 16:25:07 -05:00
Luuk van Dijk
93e547a0c2 gc: softer criteria for inlinability.
R=rsc
CC=golang-dev
https://golang.org/cl/5555072
2012-01-26 17:20:48 +01:00
Luuk van Dijk
0a55958b52 cmd/gc: forgotten recursion on ninit itself in order.c
Fixes test/reorder2.go for all cases tripped up with -lll in 5555072

R=rsc
CC=golang-dev
https://golang.org/cl/5569069
2012-01-26 15:10:24 +01:00
Russ Cox
ee9bfb023a gc: fix order of evaluation
Pulling function calls out to happen before the
expression being evaluated was causing illegal
reorderings even without inlining; with inlining
it got worse.  This CL adds a separate ordering pass
to move things with a fixed order out of expressions
and into the statement sequence, where they will
not be reordered by walk.

Replaces lvd's CL 5534079.

Fixes #2740.

R=lvd
CC=golang-dev
https://golang.org/cl/5569062
2012-01-25 17:53:50 -05:00
Luuk van Dijk
0e919ff2c9 gc: static implements check on typeswitches only applies to concrete case types.
Fixes #2700.

R=rsc
CC=golang-dev
https://golang.org/cl/5574046
2012-01-24 13:53:00 +01:00
Russ Cox
bf0c190343 gc: avoid DOT in error messages
R=ken2
CC=golang-dev
https://golang.org/cl/5573047
2012-01-23 15:10:53 -05:00
Luuk van Dijk
93c4e29605 gc: missed typecheck in subscripting a const string.
Fixes #2674.

R=rsc
CC=golang-dev
https://golang.org/cl/5574045
2012-01-23 16:57:12 +01:00
Luuk van Dijk
5ad9e2db28 gc: handle function calls in arguments to builtin complex operations.
Fixes #2582

R=rsc
CC=golang-dev
https://golang.org/cl/5574044
2012-01-23 16:56:57 +01:00
Russ Cox
427b5bddcd gc: fix recursion loop in interface comparison
iant's idea.

Fixes #2745.

R=iant, dsymonds
CC=golang-dev
https://golang.org/cl/5536085
2012-01-23 09:19:02 -05:00
Russ Cox
290e68b983 gc: undo most of 'fix infinite recursion for embedded interfaces'
Preserve test.

changeset:   11593:f1deaf35e1d1
user:        Luuk van Dijk <lvd@golang.org>
date:        Tue Jan 17 10:00:57 2012 +0100
summary:     gc: fix infinite recursion for embedded interfaces

This is causing 'interface type loop' errors during compilation
of a complex program.  I don't understand what's happening
well enough to boil it down to a simple test case, but undoing
this change fixes the problem.

The change being undone is fixing a corner case (uses of
pointer to interface in an interface definition) that basically
only comes up in erroneous Go programs.  Let's not try to
fix this again until after Go 1.

Unfixes issue 1909.

TBR=lvd
CC=golang-dev
https://golang.org/cl/5555063
2012-01-20 17:14:09 -05:00
Jeff R. Allen
46e7cb57c9 gc: do not try to add a key with incorrect type to a hash
Fixes #2623.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5533043
2012-01-20 13:34:38 -05:00
Dmitriy Vyukov
1ff1405cc7 runtime: add type algorithms for zero-sized types
BenchmarkChanSem old=127ns new=78.6ns

R=golang-dev, bradfitz, sameer, rsc
CC=golang-dev
https://golang.org/cl/5558049
2012-01-20 10:32:55 +04:00
David Symonds
ee09a8cd9f gc: don't emit pkgpath for error type.
Fixes #2660.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557060
2012-01-20 09:26:17 +11:00
Luuk van Dijk
6ff01f01f4 gc: fieldnames in structliterals in exported inlines should not be qualified if they're embedded builtin types.
Trust me.
Fixes #2687.

R=rsc
CC=golang-dev
https://golang.org/cl/5545047
2012-01-18 17:51:28 +01:00
Luuk van Dijk
18ee75ec88 gc: handle printing of string/arrayrune conversions
Fixes #2714.

R=rsc
CC=golang-dev
https://golang.org/cl/5540066
2012-01-18 09:52:16 +01:00
Luuk van Dijk
4e78818259 gc: give esc.c's sink an orig so -mm diagnostics work again.
R=rsc
CC=golang-dev
https://golang.org/cl/5543063
2012-01-17 10:01:12 +01:00
Luuk van Dijk
9523b4d59c gc: fix infinite recursion for embedded interfaces
Fixes #1909

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5523047
2012-01-17 10:00:57 +01:00
Scott Lawrence
b16f3a2d50 gc: don't fault on return outside function
Fixes #2598.

R=golang-dev, ality, minux.ma, mpimenov, rsc
CC=golang-dev
https://golang.org/cl/5510043
2012-01-16 18:12:25 -05:00
Rémy Oudompheng
6b72b07016 gc: do not compile switch on interface values into a binary search.
Fixes #2672.

R=golang-dev, lvd
CC=golang-dev, remy
https://golang.org/cl/5543058
2012-01-14 17:00:14 +01:00
Rémy Oudompheng
94ff311d1b gc: avoid false positives when using scalar struct fields.
The escape analysis code does not make a distinction between
scalar and pointers fields in structs. Non-pointer fields
that escape should not make the whole struct escape.

R=lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5489128
2012-01-12 12:08:40 +01:00
Russ Cox
524fb81c41 gc: inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5533078
2012-01-11 20:32:02 -05:00
Russ Cox
81728cf06d gc: fix inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5532077
2012-01-11 17:25:09 -05:00
Russ Cox
836a517f69 gc: fix inlining bug
Fixes #2682.

R=lvd
CC=golang-dev
https://golang.org/cl/5538043
2012-01-11 13:21:06 -08:00
Luuk van Dijk
feaa9ed10a gc: export nil literals without inferred type.
Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
2012-01-11 21:26:54 +01:00
Russ Cox
4a6b07f235 gc: enable inlining by default
R=lvd, r
CC=golang-dev
https://golang.org/cl/5531058
2012-01-10 20:08:53 -08:00
Luuk van Dijk
97fd7d5f34 gc: inlining fixes
flag -l means: inlining on, -ll inline with early typecheck
-l lazily typechecks imports on use and re-export, nicer for debugging
-lm produces output suitable for errchk tests, repeated -mm... increases inl.c's verbosity
export processed constants, instead of originals
outparams get ->inlvar too, and initialized to zero
fix shared rlist bug, that lead to typecheck messing up the patched tree
properly handle non-method calls to methods T.meth(t, a...)
removed embryonic code to handle closures in inlined bodies
also inline calls inside closures (todo: move from phase 6b to 4)

Fixes #2579.

R=rsc
CC=golang-dev
https://golang.org/cl/5489106
2012-01-10 21:24:31 +01:00
Luuk van Dijk
a6c49098bc gc: Nicer errors before miscompiling.
This fixes issue 2444.

A big cleanup of all 31/32bit size boundaries i'll leave for another cl though.  (see also issue 1700).

R=rsc
CC=golang-dev
https://golang.org/cl/5484058
2012-01-10 11:19:22 +01:00
Luuk van Dijk
4bcc9c6b5e gc: disallow declaration of variables outside package.
Fixes #2231.

Declaring main.i in package main in the same way already triggers syntax errors.

R=rsc
CC=golang-dev
https://golang.org/cl/5483078
2012-01-10 11:18:56 +01:00
Luuk van Dijk
556258e57b gc: fix stray %#N in error message
Fixes #2639.

R=rsc
CC=bradfitz, golang-dev
https://golang.org/cl/5489140
2012-01-10 11:09:04 +01:00
Luuk van Dijk
ba25778f3f gc: omit runtime.closure wrap for closures without closure variables
Fixes #1894.

test/closure.go's test for newfunc already covers this.

R=rsc, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/5516051
2012-01-10 11:07:35 +01:00
Luuk van Dijk
41806ec26d gc: remove now redundant typecheck of ->ninit on switches.
Fixes #2576.

R=rsc
CC=golang-dev
https://golang.org/cl/5498105
2012-01-09 21:42:24 +01:00
Russ Cox
8a4bd094a0 undo CL 5504108 / 0edee03791f4
breaks 386 build

««« original CL description
gc: put limit on size of exported recursive interface

Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5504108

»»»

R=lvd, lvd
CC=golang-dev
https://golang.org/cl/5534049
2012-01-09 09:45:08 -08:00
Lorenzo Stoakes
aa63a928ea gc: put limit on size of exported recursive interface
Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5504108
2012-01-09 11:48:53 -05:00
Ryan Hitchman
a15448d65e gc: improve unsafe.Pointer type-check error messages
Fixes #2627.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5498088
2012-01-06 14:34:16 -08:00
Luuk van Dijk
86deacc0bc gc: better linenumbers for inlined functions
Fixes #2580 up to a point.

R=rsc
CC=golang-dev
https://golang.org/cl/5498068
2011-12-22 17:31:54 +01:00
Russ Cox
fd1c1b9679 cmd/go: work toward build script
The commands in the standard tree are now named
by the pseudo-import paths cmd/gofmt etc.
This avoids ambiguity between cmd/go's directory
and go/token's parent directory.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5503050
2011-12-20 16:42:44 -05:00
Russ Cox
82a6a4f39e gc: allow use of unsafe.Pointer in generated code
The functions we generate to implement == on structs
or arrays may need to refer to unsafe.Pointer even in
safe mode, in order to handle unexported fields contained
in other packages' structs.

R=ken2
CC=golang-dev
https://golang.org/cl/5505046
2011-12-20 16:25:57 -05:00
Russ Cox
1d0f93b4be gc: avoid unsafe in defn of package runtime
Keeps -u tracking simple.

R=ken2
CC=golang-dev
https://golang.org/cl/5495094
2011-12-19 15:52:15 -05:00
Luuk van Dijk
7e6890a670 gc: inlining, allow empty bodies, fix _ arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/5487077
2011-12-15 17:50:59 +01:00
Luuk van Dijk
5b2f8d96ce gc: omit argument names from function types in error messages
Fixes #2563

R=rsc
CC=golang-dev
https://golang.org/cl/5495047
2011-12-15 17:38:47 +01:00
Luuk van Dijk
9bf3478658 gc: better loopdepth analysis for labels
This avoids degraded performance caused by extra labels
emitted by inlining (breaking strconv ftoa alloc count unittest) and is better in any case.

R=rsc
CC=golang-dev
https://golang.org/cl/5483071
2011-12-15 17:35:59 +01:00
Russ Cox
17264df112 gc: implement and test \r in raw strings
For issue 680.

R=ken2
CC=golang-dev
https://golang.org/cl/5492046
2011-12-15 10:47:09 -05:00
Luuk van Dijk
e14d1d7e41 gc: use inferred type rather than original one when reporting non-assignability.
Fixes #2451

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5372105
2011-12-14 17:34:35 +01:00
Luuk van Dijk
1f6d130b14 gc: add forgotten typecheck in a lonely corner of sinit
Fixes #2549

R=rsc
CC=golang-dev
https://golang.org/cl/5484060
2011-12-14 15:54:10 +01:00
Luuk van Dijk
a62722bba4 gc: inlining (disabled without -l)
Cross- and intra package inlining of single assignments or return <expression>.
Minus some hairy cases, currently including other calls, expressions with closures and ... arguments.

R=rsc, rogpeppe, adg, gri
CC=golang-dev
https://golang.org/cl/5400043
2011-12-14 15:05:33 +01:00
Luuk van Dijk
3c638f2892 gc: Use %#F in error messages instead of %F.
Fixes #2520

R=rsc
CC=golang-dev
https://golang.org/cl/5482056
2011-12-14 08:22:36 +01:00
Luuk van Dijk
6a401339c1 gc: suppress non-root cause message for bad receivers.
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
2011-12-14 08:21:37 +01:00
Russ Cox
61655bc513 gc: delete DUPOK definition
The relevant header is already included.

R=ken2
CC=golang-dev
https://golang.org/cl/5487062
2011-12-13 13:25:48 -05:00
Luuk van Dijk
7cf4825425 gc: small fixes to fmt.c
don't crash when printing error messages about symbols in a garbled state.
render OCOMPLIT in export mode.

R=rsc
CC=golang-dev
https://golang.org/cl/5466045
2011-12-13 09:15:46 +01:00
Luuk van Dijk
e1b1a5fea2 gc: fix use of stackallocated AST node in generation of static initialisation code.
Fixes #2529

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5483048
2011-12-13 09:09:10 +01:00
Russ Cox
196b663075 gc: implement == on structs and arrays
To allow these types as map keys, we must fill in
equal and hash functions in their algorithm tables.
Structs or arrays that are "just memory", like [2]int,
can and do continue to use the AMEM algorithm.
Structs or arrays that contain special values like
strings or interface values use generated functions
for both equal and hash.

The runtime helper func runtime.equal(t, x, y) bool handles
the general equality case for x == y and calls out to
the equal implementation in the algorithm table.

For short values (<= 4 struct fields or array elements),
the sequence of elementwise comparisons is inlined
instead of calling runtime.equal.

R=ken, mpimenov
CC=golang-dev
https://golang.org/cl/5451105
2011-12-12 22:22:09 -05:00
Lucio De Re
0f4f3c6769 gc: avoid 0-length C array
R=golang-dev, ality
CC=golang-dev, rsc
https://golang.org/cl/5467066
2011-12-12 16:25:31 -05:00
Rémy Oudompheng
d7634ad7d9 gc: fix wrong arguments to error message for switches.
Fixes #2502.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5472062
2011-12-12 16:08:32 -05:00
Lucio De Re
d56ca13c03 gc: add varargck for %lN
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5476049
2011-12-12 15:42:02 -05:00
Russ Cox
ecda0fa5d4 gc: allow colon in //line file name
Assume last colon introduces line number.

Fixes #2543.

R=ken2
CC=golang-dev
https://golang.org/cl/5485047
2011-12-12 15:41:54 -05:00
Russ Cox
1cb7f85d74 gc: 0 expected bugs
Now that Luuk's qualified exporting code
is in, fixing this bug is trivial.

R=ken2
CC=golang-dev
https://golang.org/cl/5479048
2011-12-09 14:58:28 -05:00
Russ Cox
e77f057bf3 gc: resolve built-ins to built-in symbol
R=lvd
CC=golang-dev
https://golang.org/cl/5480049
2011-12-09 08:28:17 -05:00
Russ Cox
fc128403dc gc: minor changes for inlining
Copied from 5400043 since they stand alone from inlining.

R=lvd
CC=golang-dev
https://golang.org/cl/5479046
2011-12-09 08:03:51 -05:00
Russ Cox
012798a325 gc: rune is now an alias for int32
R=ken2
CC=golang-dev
https://golang.org/cl/5467049
2011-12-09 00:12:07 -05:00
Russ Cox
2ab9bb6aaf gc: fix export of '\'' and '\\' constants
Fixes Windows build.

R=ken2
CC=golang-dev
https://golang.org/cl/5472046
2011-12-08 22:43:31 -05:00
Russ Cox
be0ffbfd02 gc: implement character constant type rules
R=ken2
CC=golang-dev
https://golang.org/cl/5444054
2011-12-08 22:07:43 -05:00
Russ Cox
f00340f022 gc: rename %union field name from lint to i
#define lint has special meaning to Bison;
having a field named lint conflicts with that.

R=ken2
CC=golang-dev
https://golang.org/cl/5462044
2011-12-07 23:38:32 -05:00
Rémy Oudompheng
4349effb15 gc: keep pointer to original node in constant rewrites.
This allows printing meaningful expressions in error messages
instead of evaluated constants.
Fixes #2276.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5432082
2011-12-07 16:18:50 -05:00
Russ Cox
5e98505ba7 gc: fix spurious typecheck loop in &composite literal
Fixes #2538.

R=ken2
CC=golang-dev
https://golang.org/cl/5449114
2011-12-07 15:48:55 -05:00
Rémy Oudompheng
0c64972dd1 gc: more accurate description of -w and -W switches.
The -w switch actually prints steps of the syntax tree walks
while -W prints a summary before and after the walk.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5444049
2011-12-07 11:45:30 -05:00
Russ Cox
46deaa297b gc: disallow map/func equality via interface comparison
Missed when I removed direct map/func equality.

R=ken2
CC=golang-dev
https://golang.org/cl/5452052
2011-12-06 10:48:17 -05:00
Luuk van Dijk
40b2fe004f gc: changes in export format in preparation of inlining.
Includes minimal change to gcimporter to keep it working,

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5431046
2011-12-05 14:40:19 -05:00
Russ Cox
5cb1c82d96 gc: remove type elision in struct literals
R=ken2
CC=golang-dev
https://golang.org/cl/5437136
2011-12-05 14:22:41 -05:00
Russ Cox
b9ccd077dc runtime: prep for type-specific algorithms
Equality on structs will require arbitrary code for type equality,
so change algorithm in type data from uint8 to table pointer.
In the process, trim top-level map structure from
104/80 bytes (64-bit/32-bit) to 24/12.

Equality on structs will require being able to call code generated
by the Go compiler, and C code has no way to access Go return
values, so change the hash and equal algorithm functions to take
a pointer to a result instead of returning the result.

R=ken
CC=golang-dev
https://golang.org/cl/5453043
2011-12-05 09:40:22 -05:00
Russ Cox
214ec7b547 gc: fix build (not sure how this edit got lost)
R=ken2, ken
CC=golang-dev
https://golang.org/cl/5449072
2011-12-02 15:05:45 -05:00
Russ Cox
7a42dddbe6 gc: fix line number for redundant print
R=ken2
CC=golang-dev
https://golang.org/cl/5434111
2011-12-02 14:58:26 -05:00
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Russ Cox
7dc9d8c72b gc: composite literals as per Go 1
R=ken2
CC=golang-dev
https://golang.org/cl/5450067
2011-12-02 14:13:12 -05:00
Russ Cox
7d15eda95d gc: do not allow slice of array literal
R=ken2
CC=golang-dev
https://golang.org/cl/5440083
2011-12-02 12:30:56 -05:00
Luuk van Dijk
882368939c gc: move typedcl2 into export.c
R=rsc
CC=golang-dev
https://golang.org/cl/5447043
2011-11-29 13:34:08 +01:00
Russ Cox
8e515485e2 gc: remove funarg special case in structfield
This should make CL 5431046 a little simpler.

R=ken2
CC=golang-dev
https://golang.org/cl/5444048
2011-11-28 16:40:39 -05:00
Rémy Oudompheng
60e4a61d30 gc: don't inherit orig from subnodes in constant expression nodes.
The wrong value made Nconv() show "1" for node "-1", and "2" from
node "2+3".
Fixes #2452.

R=gri, lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5435064
2011-11-28 12:22:15 -05:00
Maxim Pimenov
ffa6b383f5 gc: fix copying of types
reset xmethod during copytype

Fixes #2497

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5441045
2011-11-28 11:52:16 -05:00
Russ Cox
6e3e380923 allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes #1707.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
2011-11-22 12:30:02 -05:00
Anthony Martin
920df48fb1 gc: support for building with Plan 9 yacc
I've modified Plan 9's yacc to work with
the grammar in go.y.  These are the only
changes necessary on the Go side.

R=rsc
CC=golang-dev
https://golang.org/cl/5375104
2011-11-16 16:58:02 -05:00
Russ Cox
d03611f628 allow copy of struct containing unexported fields
An experiment: allow structs to be copied even if they
contain unexported fields.  This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.

In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.

All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.

Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef

R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
2011-11-15 12:20:59 -05:00
Luuk van Dijk
40afe58692 gc: fix newlines in %+N
fixes #2442

R=rsc
CC=golang-dev
https://golang.org/cl/5370066
2011-11-14 10:08:04 +01:00
Russ Cox
5bb54b8e9c gc: remove func, map compare
R=ken, ken
CC=golang-dev
https://golang.org/cl/5373079
2011-11-13 22:58:08 -05:00
Luuk van Dijk
3208917d54 gc: look at cumulative error count, not just per-function.
Not sure if this is what you'd really want.  Maybe with a higher limit than 10
or perhaps keep checking nerrors > 10 per yyerror, but check the cumulative
after each function?

R=rsc
CC=golang-dev
https://golang.org/cl/5376064
2011-11-12 00:32:56 -05:00
Russ Cox
5fc3771b3a gc: remove m[k] = x, false
R=ken2
CC=golang-dev
https://golang.org/cl/5376076
2011-11-11 16:48:25 -05:00
Russ Cox
1eadb89ee1 undo CL 5375043 / ea8b178f9b73
Never lasts long.

««« original CL description
gc: add GOEXPERIMENT=reorg

This won't last long but may ease conversions.

R=ken2
CC=golang-dev
https://golang.org/cl/5375043
»»»

R=ken2, ken
CC=golang-dev
https://golang.org/cl/5370043
2011-11-09 12:36:51 -05:00
Russ Cox
ae7a003cf9 gc: add GOEXPERIMENT=reorg
This won't last long but may ease conversions.

R=ken2
CC=golang-dev
https://golang.org/cl/5375043
2011-11-09 12:35:45 -05:00
Luuk van Dijk
924ea515cf gc: better error for non-calling use of unsafe builtins.
Fixes #1951

R=rsc
CC=golang-dev
https://golang.org/cl/5372041
2011-11-09 18:30:54 +01:00
Luuk van Dijk
d5a5855ba1 gc: Preserve original blank name for .anon substitution on out params.
Fixes #1802.

R=rsc
CC=golang-dev
https://golang.org/cl/5364043
2011-11-09 11:27:27 +01:00
Luuk van Dijk
151b2f1509 gc: Fail on implicit assigment to non-exported fields in copy and append.
Fixes #1387.

R=rsc
CC=golang-dev
https://golang.org/cl/5348046
2011-11-09 11:17:06 +01:00
Luuk van Dijk
13e92e4d75 gc: Better typechecks and errors in switches.
Allow any type in switch on interface value.
Statically check typeswitch early.

Fixes #2423.
Fixes #2424.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5339045
2011-11-09 10:58:53 +01:00
Luuk van Dijk
087bec3dcd gc: Clean up dostruct/stotype, detect broken fields and propagate up to structs and functions to supress spurious errors.
Fixes #1556.

R=rsc
CC=golang-dev
https://golang.org/cl/5351042
2011-11-07 21:35:13 +01:00
Ron Minnich
986ad31b2d gc: use HEADER_IO macro from gopack
Use HEADER_IO macro from gopack to read archive header
The HEADER_IO macro portably reads archive headers. The
current arsize code fails in the case of archive headers produced
on plan 9 6c and read on other systems (it's not portable).
Modify lex.c to use the portable macro
Build tested (including tests) on OSX.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5323072
2011-11-07 11:42:13 -05:00
Lucio De Re
2e1bb76f9b gc: format nits
src/cmd/gc/bits.c: corrected a mistaken format;
src/cmd/gc/go.h: %E can accept uints.

R=rsc
CC=golang-dev
https://golang.org/cl/5331041
2011-11-07 11:42:08 -05:00
Luuk van Dijk
ea9e93862d gc: Better error message for range over non-receive channel.
Fixes #2354

R=rsc
CC=golang-dev
https://golang.org/cl/5346044
2011-11-06 22:14:15 +01:00
Luuk van Dijk
0d6f857c3f gc: Switch related errors should use plain format.
Fixes #2422.

R=rsc
CC=golang-dev
https://golang.org/cl/5353046
2011-11-06 22:13:54 +01:00
Luuk van Dijk
aac144b120 gc: detect type switch variable not used cases.
Fixes #873
Fixes #2162

R=rsc
CC=golang-dev
https://golang.org/cl/5341043
2011-11-04 17:03:50 +01:00
Luuk van Dijk
11075ed893 gc: Don't pollute the xmethod list with non-methods.
Fixes #2355.

I have a test, but not sure if it's worth adding.  Instead i've made
the patching-over in reflect.c methods more fatal and more descriptive.

R=rsc
CC=golang-dev
https://golang.org/cl/5302082
2011-11-03 17:51:15 +01:00
Russ Cox
80bce97e45 gc, ld: sync pathtoprefix + add comments
R=lvd, lvd
CC=golang-dev
https://golang.org/cl/5332051
2011-11-03 12:44:51 -04:00
Luuk van Dijk
33f1d47b38 gc: package paths in symbol names: don't escape periods before last slash, always escape >=0x7f.
R=rsc
CC=golang-dev
https://golang.org/cl/5323071
2011-11-02 22:33:15 +01:00
Luuk van Dijk
7df9ff5594 gc: helpful message instead of internal error on method call on pointer to pointer.
Fixes #2343.

R=rsc
CC=golang-dev
https://golang.org/cl/5332048
2011-11-02 17:18:53 +01:00
Luuk van Dijk
29a5ae657f gc: small fixes for printing.
mark OADDR inserted by typecheck as implicit
OCOPY takes ->left and ->right, not ->list
OMAKE*'s can all have arguments
precedence for OIND was initalized twice

fixes #2414

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5319065
2011-11-02 15:36:33 +01:00
David Symonds
c4845c1c49 gc: fix spelling of "GOEXPERIMENT" in a comment.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5323070
2011-11-02 16:25:24 +11:00
Russ Cox
4c3ea0008c undo CL 5330066 / 6a5647d82728
I promised it wouldn't last very long.
People who really need this can sync to 6a5647d82728.

««« original CL description
gc: add GOEXPERIMENT=os.Error

This won't last long, I promise.

R=ken2
CC=golang-dev
https://golang.org/cl/5330066
»»»

R=ken2
CC=golang-dev
https://golang.org/cl/5333053
2011-11-01 23:26:10 -04:00
Russ Cox
47f4bf763d gc: add GOEXPERIMENT=os.Error
This won't last long, I promise.

R=ken2
CC=golang-dev
https://golang.org/cl/5330066
2011-11-01 23:24:28 -04:00
Russ Cox
2a0e15d36c gc: add error type
R=ken
CC=golang-dev
https://golang.org/cl/5331043
2011-11-01 21:46:41 -04:00
Russ Cox
b4df33a6ea gc: test + fix escape analysis bug
R=lvd
CC=golang-dev
https://golang.org/cl/5333049
2011-11-01 11:02:43 -04:00
Luuk van Dijk
50110c9f83 gc: clean up printing.
Got rid of all the magic mystery globals. Now
for %N, %T, and %S, the flags +,- and # set a sticky
debug, sym and export mode, only visible in the new fmt.c.
Default is error mode. Handle h and l flags consistently with
the least side effects, so we can now change
things without worrying about unrelated things
breaking.

fixes #2361

R=rsc
CC=golang-dev
https://golang.org/cl/5316043
2011-10-31 18:09:40 +01:00
Mikio Hara
8b92066e31 gc: fix [568]g -V crash
R=lvd
CC=golang-dev
https://golang.org/cl/5314060
2011-10-26 16:16:46 +09:00
Russ Cox
6ed3fa6553 gc: introduce rune
R=ken, r
CC=golang-dev
https://golang.org/cl/5293046
2011-10-25 22:19:39 -07:00
Russ Cox
862179b0f5 gc: preserve uint8 and byte distinction in errors, import data
There is no semantic change here, just better errors.
If a function says it takes a byte, and you pass it an int,
the compiler error now says that you need a byte, not
that you need a uint8.

Groundwork for rune.

R=ken2
CC=golang-dev
https://golang.org/cl/5300042
2011-10-18 14:55:50 -04:00
Russ Cox
4e7aac5413 reflect: make unsafe use of SliceHeader gc-friendly
Revert workaround in compiler and
revert test for compiler workaround.

Tested that the 386 build continues to fail if
the gc change is made without the reflect change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5312041
2011-10-18 10:03:37 -04:00
Russ Cox
1d687c742d gc: add delete(m, x) but leave in m[x] = 0, false.
The old m[x] = 0, false syntax will be deleted
in a month or so, once people have had time to
change their code (there is a gofix in a separate CL).

R=ken2
CC=golang-dev
https://golang.org/cl/5265048
2011-10-18 09:41:32 -04:00
Russ Cox
e40d6e066a runtime: random offset for map iteration
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5285042
2011-10-17 18:49:02 -04:00
Dmitriy Vyukov
b0c674b65d gc: treat uintptr as potentially containing a pointer
Fixes #2376

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5278048
2011-10-17 15:14:07 -04:00
Russ Cox
f58ed4e641 gc: disallow close on receive-only channels
Fixes #2353.
Fixes #2246.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5282042
2011-10-13 16:58:04 -04:00
Russ Cox
eb3aba24b5 gc: stricter multiple assignment + test
Fixes #693.

R=ken2
CC=golang-dev
https://golang.org/cl/5265045
2011-10-13 15:46:39 -04:00
Russ Cox
c18d1a78a4 gc: implement new return restriction
R=ken2
CC=golang-dev
https://golang.org/cl/5245056
2011-10-13 12:17:55 -04:00
Dmitriy Vyukov
bf9c778fe2 gc: pass FlagNoPointers to runtime.new
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5151043
2011-10-13 11:06:55 +03:00
Luuk van Dijk
77fac21e82 runtime: append([]byte, string...)
Fixes #2274

R=rsc, gri, dsymonds, bradfitz, lvd
CC=golang-dev
https://golang.org/cl/5149045
2011-10-12 15:59:23 +02:00
Luuk van Dijk
b536adbfba gc: changes to export format in preparation for inlining.
string literals used as package qualifiers are now prefixed with '@'
which obviates the need for the extra ':' before tags.

R=rsc, gri, lvd
CC=golang-dev
https://golang.org/cl/5129057
2011-10-08 19:37:06 +02:00
Russ Cox
e419535f2a 5g, 6g, 8g: registerize variables again
My previous CL:

changeset:   9645:ce2e5f44b310
user:        Russ Cox <rsc@golang.org>
date:        Tue Sep 06 10:24:21 2011 -0400
summary:     gc: unify stack frame layout

introduced a bug wherein no variables were
being registerized, making Go programs 2-3x
slower than they had been before.

This CL fixes that bug (along with some others
it was hiding) and adds a test that optimization
makes at least one test case faster.

R=ken2
CC=golang-dev
https://golang.org/cl/5174045
2011-10-03 17:46:36 -04:00
Russ Cox
7ca406396f gc: disallow invalid map keys
The algtype-based test broke when algtype
got a bit more fine-grained, so replace with
an explicit check for the invalid key types.

R=ken2
CC=golang-dev
https://golang.org/cl/5071041
2011-09-19 13:11:24 -04:00
Russ Cox
ad7dea1e96 gc: handle complex CONVNOP
Fixes #2256.

R=ken2
CC=golang-dev
https://golang.org/cl/5044047
2011-09-19 11:50:53 -04:00
Russ Cox
9fc687392c gc: clean up if grammar
Fixes #2248.

R=ken2
CC=golang-dev
https://golang.org/cl/4978064
2011-09-12 15:52:29 -04:00
Luuk van Dijk
ac1b9545e3 ld: grow dwarf includestack on demand.
Fixes #2241
while not breaking issue 1878 again.

R=rsc
CC=golang-dev
https://golang.org/cl/4988048
2011-09-09 15:08:57 +02:00
Russ Cox
1e480cd1ad gc: add -p flag to catch import cycles earlier
The linker would catch them if gc succeeded,
but too often the cycle manifests as making the
current package and the imported copy of itself
appear as different packages, which result in
type signature mismatches that confuse users.

As a crutch, add the -p flag to say 'if you see an
import of this package, give up early'.  Results in
messages like (during gotest in sort):

export_test.go:7: import "sort" while compiling that package (import cycle)
export_test.go:7: import "container/heap": package depends on "sort" (import cycle)

Fixes #2042.

R=ken
CC=bradfitz, dsymonds, golang-dev
https://golang.org/cl/4972057
2011-09-07 15:50:21 -04:00
Lucio De Re
4ba677c6ea gc: silence Plan 9 warnings
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4975055
2011-09-07 13:55:48 -04:00
Luuk van Dijk
f2460a8c57 gc: treat DOTMETH like DOT in escape analysis.
Fixes #2225

R=rsc, nigeltao, dave
CC=bradfitz, golang-dev, mikioh.mikioh
https://golang.org/cl/4972056
2011-09-07 19:03:11 +02:00
Russ Cox
5ddf6255a1 gc: unify stack frame layout
allocparams + tempname + compactframe
all knew about how to place stack variables.

Now only compactframe, renamed to allocauto,
does the work.  Until the last minute, each PAUTO
variable is in its own space and has xoffset == 0.

This might break 5g.  I get failures in concurrent
code running under qemu and I can't tell whether
it's 5g's fault or qemu's.  We'll see what the real
ARM builders say.

R=ken2
CC=golang-dev
https://golang.org/cl/4973057
2011-09-06 10:24:21 -04:00
Russ Cox
9854fd2a0e gc: introduce temp = nod+tempname
R=ken2
CC=golang-dev
https://golang.org/cl/4967052
2011-09-02 15:35:16 -04:00
Russ Cox
c45c0c0c1d gc: zero stack-allocated slice backing arrays
Fixes Han-Wen's termite bug.

R=lvd
CC=golang-dev
https://golang.org/cl/4977052
2011-09-02 15:11:28 -04:00
Russ Cox
60d47101aa gc: fix label recursion bugs
Was keeping a pointer to the labeled statement in n->right,
which meant that generic traversals of the tree visited it twice.
That combined with aggressive flattening of the block
structure when possible during parsing meant that
the kinds of label: code label: code label: code sequences
generated by yacc were giving the recursion 2ⁿ paths
through the program.

Fixes #2212.

R=lvd
CC=golang-dev
https://golang.org/cl/4960050
2011-09-01 13:44:46 -04:00
Russ Cox
335da67e00 gc: make static initialization more static
Does as much as possible in data layout instead
of during the init function.

Handles var x = y; var y = z as a special case too,
because it is so prevalent in package unicode
(var Greek = _Greek; var _Greek = []...).

Introduces InitPlan description of initialized data
so that it can be traversed multiple times (for example,
in the copy handler).

Cuts package unicode's init function size by 8x.
All that remains there is map initialization, which
is on the chopping block too.

Fixes sinit.go test case.

Aggregate DATA instructions at end of object file.

Checkpoint.  More to come.

R=ken2
CC=golang-dev
https://golang.org/cl/4969051
2011-08-31 07:37:14 -04:00
Lucio De Re
4ca2172f38 gc: fix for Plan 9 build
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4977045
2011-08-30 09:40:46 -04:00
Lucio De Re
2d489e67dc gc: fix for Plan 9 build
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4975044
2011-08-30 08:00:07 -04:00
Lucio De Re
b3cc4897be gc: fix build on Plan 9
gc/bits.c
. improved format with associated cast;
gc/closure.c
gc/dcl.c
gc/range.c
gc/reflect.c
gc/sinit.c
. dropped unnecessary assignments;
gc/gen.c
. dropped unnecessary assignment;
. added static qualifier to local function definition;
gc/go.h
. added varargck pragmas;
gc/lex.c
. used {} instead of ; in if statement to suppress warning;
. replaced exit(0) with exits(0);
. added compilation conditions for SIGBUS/SIGSEGV;
. dropped unnecessary assignment;
gc/mparith2.c
. dropped four unnecessary assignments/initialisations;
gc/obj.c
. added type cast to local pointer;
gc/pgen.c
. added cast and related print format;
gc/subr.c
. replaced exit(1) with exits("error");
. replaced unlink() with remove();
. renamed local cistrmp() as ucistrmp() to remove conflict with
  Plan 9 function by the same name;
gc/swt.c
. added braces instead of ; as empty statment;
gc/typecheck.c
. added static qualifier to local function definition;
. dropped unnecessary assignments;
gc/walk.c
. dropped unnecessary assignments;
. added static qualifier to local function definitions;

R=rsc
CC=golang-dev
https://golang.org/cl/4964046
2011-08-29 09:35:04 -04:00
Russ Cox
77f0bdce07 gc: fix arm build
Escape analysis was incorrectly assuming that
functions without bodies don't leak their
parameters.  This meant that sync/atomic's
TestAddInt64 was allocating x on its stack,
and then x was not properly aligned for use
with the atomic 64-bit instructions.  Obviously
we should figure out the alignment story on 5g
too, but this fix is correct and should restore the
build to 'ok'.

TBR=lvd
CC=golang-dev
https://golang.org/cl/4964047
2011-08-28 23:29:34 -04:00
Russ Cox
db5f9da425 gc: tweak and enable escape analysis
-s now means *disable* escape analysis.

Fix escape leaks for struct/slice/map literals.
Add ... tracking.
Rewrite new(T) and slice literal into stack allocation when safe.

Add annotations to reflect.
Reflect is too chummy with the compiler,
so changes like these affect it more than they should.

R=lvd, dave, gustavo
CC=golang-dev
https://golang.org/cl/4954043
2011-08-28 12:05:00 -04:00
Russ Cox
61f84a2cdc gc: shuffle #includes
#include "go.h" (or "gg.h")

becomes

#include <u.h>
#include <libc.h>
#include "go.h"

so that go.y can #include <stdio.h>
after <u.h> but before "go.h".
This is necessary on Plan 9.

R=ken2
CC=golang-dev
https://golang.org/cl/4971041
2011-08-25 16:25:10 -04:00
Russ Cox
55db9fe730 build: fix unused parameters
Found with gcc 4.6 -Wunused -Wextra
but should be applicable to Plan 9 too.

R=ken2
CC=golang-dev
https://golang.org/cl/4958044
2011-08-25 16:08:13 -04:00
Russ Cox
0227c45ede gc: fix some spurious leaks
Probably will spark some discussion.  ☺

R=lvd
CC=golang-dev
https://golang.org/cl/4948041
2011-08-25 09:26:13 -04:00
Russ Cox
42687d6ce4 gc: simplify escape analysis recursion
Merge escassign(N, x), escassign(x, N), escexpr(n), and escstmt(n) into esc(n).

1. Renaming
https://golang.org/cl/4917050/diff2/1:2001/src/cmd/gc/esc.c

2. Merging.
https://golang.org/cl/4917050/diff2/2001:4001/src/cmd/gc/esc.c

3. Simplify esccall.
https://golang.org/cl/4917050/diff2/4001:5002/src/cmd/gc/esc.c

R=lvd
CC=golang-dev
https://golang.org/cl/4917050
2011-08-24 16:47:32 -04:00
Luuk van Dijk
847b61b554 gc: Escape analysis.
For now it's switch-on-and-offable with -s, and the effects can be inspected
with -m.  Defaults are the old codepaths.

R=rsc
CC=golang-dev
https://golang.org/cl/4634073
2011-08-24 19:07:08 +02:00
Russ Cox
5e188b40f2 build: avoid redundant bss declarations
Some compilers care, sadly.

R=iant, ken
CC=golang-dev
https://golang.org/cl/4931042
2011-08-23 22:39:14 -04:00
Julian Phillips
b99d722963 gc: fix pc/line table
When a line directive was encountered we would push a new 'z' entry into
the history to indicate the start of new file attributation, and a 'Z'
entry to change line numbering.  However we didn't pop the 'z' entry, so
we were actually corrupting the history stack.  The most obvious
occurance of this was in the code that build the symbol tables for the
DWARF information - where an internal stack in the linker would overflow
when more than a few line directives were encountered in a single stack
(Issue 1878).  So now we pop the 'z' entry when we encounter the end of
the file that the directive was in, which maintains the history stack
integrity.

Also, although new 'z' entries for new files had relative paths
expanded, the same was not done for line directives.  Now we do it for
line directives also - so that the now correct DWARF information has the
full path available.

Fixes #1878.

R=rsc
CC=golang-dev
https://golang.org/cl/4938042
2011-08-23 17:01:14 -04:00
Rob Pike
1696b5fe2a cmd/gc/lex: remove reference to container/vector in comment
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4921045
2011-08-22 14:07:27 +10:00
Russ Cox
3770b0e60c gc: implement nil chan support
The spec has defined nil chans this way for months.
I'm behind.

R=ken2
CC=golang-dev
https://golang.org/cl/4897050
2011-08-17 15:54:17 -04:00
Russ Cox
65bde087ae gc: implement nil map support
The spec has defined nil maps this way for months.
I'm behind.

R=ken2
CC=golang-dev
https://golang.org/cl/4901052
2011-08-17 14:56:27 -04:00
Russ Cox
cf79411b1d gc: fix mkbuiltin
Broken by Plan 9 changes.

R=ken2
CC=golang-dev
https://golang.org/cl/4896050
2011-08-17 14:54:51 -04:00
Dmitriy Vyukov
54e9406ffb runtime: add more specialized type algorithms
The change adds specialized type algorithms
for slices and types of size 8/16/32/64/128.
It significantly accelerates chan and map operations
for most builtin types as well as user structs.

benchmark                   old,ns/op   new,ns/op
BenchmarkChanUncontended          226          94
(on Intel Xeon E5620, 2.4GHz, Linux 64 bit)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4815087
2011-08-08 09:35:32 -04:00
Russ Cox
032ffb2e90 gc: more graceful errors during struct definition
Fixes #2110.

R=ken2
CC=golang-dev
https://golang.org/cl/4823060
2011-07-28 20:41:18 -04:00
Russ Cox
28a23675cd 5g, 6g, 8g: shift, opt fixes
Fixes #1808.

R=ken2
CC=golang-dev
https://golang.org/cl/4813052
2011-07-28 18:22:12 -04:00
Russ Cox
4389192669 gc: shift type bug
Fixes #1664.

R=ken2
CC=golang-dev
https://golang.org/cl/4798056
2011-07-28 13:03:30 -04:00
Russ Cox
2f8190a8f8 gc: line number + type checking nits
Fixes #1910.
Fixes #1979.
Fixes #1990.
Fixes #1993.
Fixes #2089.

R=ken2
CC=golang-dev
https://golang.org/cl/4828046
2011-07-28 12:31:16 -04:00
Russ Cox
890bdc5339 gc: top-level closure bug
Fixes #2055.

R=ken2
CC=golang-dev
https://golang.org/cl/4816059
2011-07-27 19:31:11 -04:00
Russ Cox
f91eb3c2f9 gc: composite literal double eval bug
Fixes #2086.

R=ken2
CC=golang-dev
https://golang.org/cl/4803055
2011-07-27 18:55:30 -04:00
Russ Cox
1bd4b6371a gc: use more Go-like names for methods
Fixes #991.

R=ken2
CC=golang-dev
https://golang.org/cl/4819049
2011-07-27 17:56:13 -04:00
Russ Cox
112267d55e gc: diagnose (x) := 0
Fixes #1756.

R=ken2
CC=golang-dev
https://golang.org/cl/4810057
2011-07-27 17:39:30 -04:00
Russ Cox
a84abbe508 gc: zero-width struct, zero-length array fixes
Fixes #1774.
Fixes #2095.
Fixes #2097.

R=ken2
CC=golang-dev
https://golang.org/cl/4826046
2011-07-27 16:47:45 -04:00
Russ Cox
dec8009fe8 gc: iota outside const
Fixes #1662.

R=ken2
CC=golang-dev
https://golang.org/cl/4828045
2011-07-27 14:45:27 -04:00
Russ Cox
49b70d01c0 gc: echo literal in error message
Fixes #1192.

R=ken2
CC=golang-dev
https://golang.org/cl/4794062
2011-07-27 14:36:21 -04:00
Russ Cox
12a5774cde gc, runtime: fix range+panic line number bugs
Fixes #1856.

R=ken2
CC=golang-dev
https://golang.org/cl/4810054
2011-07-26 00:52:46 -04:00
Russ Cox
cce10dacc6 gc: fix select line number
Fixes #1393.

R=ken2
CC=golang-dev
https://golang.org/cl/4811054
2011-07-26 00:52:17 -04:00
Russ Cox
bf899befdb gc: disallow [...][...]int{{1,2,3}}
Fixes #1600.

R=ken2
CC=golang-dev
https://golang.org/cl/4819045
2011-07-26 00:52:02 -04:00
Lucio De Re
12995e2d35 gc: fix mkbuiltin for Plan 9 build
. Replaced Posix #includes with u.h and libc.h.
. Replaced fprintf(stderr,...); exit(1); with sysfatal() calls.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4823047
2011-07-25 13:45:37 -04:00
Dmitriy Vyukov
33ff947cac runtime: fix compilation of send select cases
Fixes #2102.

R=fullung, rsc
CC=golang-dev
https://golang.org/cl/4825043
2011-07-25 12:25:37 -04:00
Russ Cox
22853098a9 gc: select functions are no longer special
R=ken2
CC=golang-dev
https://golang.org/cl/4794049
2011-07-21 14:10:39 -04:00
Dmitriy Vyukov
6b2ec06587 runtime: faster select
Make selectsend() accept pointer to the element,
it makes it possible to make Scase fixed-size
and allocate/free Select, all Scase's and all SudoG at once.
As a consequence SudoG freelist die out.

benchmark                       old,ns/op  new,ns/op
BenchmarkSelectUncontended	     1080        558
BenchmarkSelectUncontended-2	      675        264
BenchmarkSelectUncontended-4	      459        205
BenchmarkSelectContended	     1086        560
BenchmarkSelectContended-2	     1775       1672
BenchmarkSelectContended-4	     2668       2149
(on Intel Q6600, 4 cores, 2.4GHz)

benchmark                       old ns/op    new ns/op    delta
BenchmarkSelectUncontended         517.00       326.00  -36.94%
BenchmarkSelectUncontended-2       281.00       166.00  -40.93%
BenchmarkSelectUncontended-4       250.00        83.10  -66.76%
BenchmarkSelectUncontended-8       107.00        47.40  -55.70%
BenchmarkSelectUncontended-16       67.80        41.30  -39.09%
BenchmarkSelectContended           513.00       325.00  -36.65%
BenchmarkSelectContended-2         699.00       628.00  -10.16%
BenchmarkSelectContended-4        1085.00      1092.00   +0.65%
BenchmarkSelectContended-8        3253.00      2477.00  -23.85%
BenchmarkSelectContended-16       5313.00      5116.00   -3.71%
(on Intel E5620, 8 HT cores, 2.4 GHz)

R=rsc, ken
CC=golang-dev
https://golang.org/cl/4811041
2011-07-21 13:57:13 -04:00
Dave Cheney
c945d9c8a1 gc: fix silent sign truncation in pgen.c
Fixes #2076.

R=golang-dev, r, r, dsymonds, lucio.dere
CC=golang-dev
https://golang.org/cl/4744047
2011-07-18 21:09:28 +10:00
Luuk van Dijk
8cf8806d31 gc: some enhancements to printing debug info.
R=rsc
CC=golang-dev
https://golang.org/cl/4710046
2011-07-15 16:00:05 +02:00
Russ Cox
58e19aa4cb go: require { } around else block
R=gri, ken, r
CC=golang-dev
https://golang.org/cl/4721044
2011-07-14 17:15:52 -04:00
Luuk van Dijk
e8ff9a624f gc: fix closure bug
Fixes #2056.

R=rsc
CC=golang-dev
https://golang.org/cl/4709042
2011-07-14 18:13:39 +02:00
Robert Hencke
67edf9cb87 gc: make size of struct{} and [0]byte 0 bytes
Fixes #1949.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/4634124
2011-07-12 11:12:06 -07:00
Luuk van Dijk
13d048a221 gc: fix %N for OGOTO nodes.
6g -W crashed on any source with a goto. this fixes that.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4675052
2011-07-06 00:02:03 +02:00
Russ Cox
ff4518da17 gc: fix package quoting logic
The decision for when to say "hash/crc32".New instead of
crc32.New in an error was double-counting imports
from different packages or indirect imports, so it was
quoting even when there was no ambiguity.

R=ken2
CC=golang-dev
https://golang.org/cl/4645070
2011-06-28 23:58:35 -04:00
Russ Cox
6aaa86ff66 gc: avoid package name ambiguity in error messages
Fixes #2006.

R=ken2
CC=golang-dev
https://golang.org/cl/4643056
2011-06-27 18:44:30 -04:00
Russ Cox
cf9f380499 gc: unsafe.Alignof, unsafe.Offsetof, unsafe.Sizeof now return uintptr
R=ken2
CC=golang-dev
https://golang.org/cl/4640045
2011-06-17 16:12:14 -04:00
Russ Cox
7f4c5ea7d8 gc: implement goto restriction
Remove now-unnecessary zeroing of stack frames.

R=ken2
CC=golang-dev
https://golang.org/cl/4641044
2011-06-17 15:25:05 -04:00
Russ Cox
e852202f37 gc: descriptive panic for nil pointer -> value method call
R=ken2
CC=golang-dev
https://golang.org/cl/4646042
2011-06-17 15:23:27 -04:00
Russ Cox
5d9dbe19a7 gc: work around goto bug
R=ken2
CC=golang-dev
https://golang.org/cl/4629042
2011-06-16 00:18:43 -04:00
Luuk van Dijk
2ad42a8249 gc: frame compaction for arm.
Required moving some parts of gc/pgen.c to ?g/ggen.c

on linux tests pass for all 3 architectures, and
frames are actually compacted (diagnostic code for
that has been removed from the CL).

R=rsc
CC=golang-dev
https://golang.org/cl/4571071
2011-06-14 17:03:37 +02:00
Stephen Ma
b4bb970e18 gc: handle go print() and go println()
Fixes #1952.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4611041
2011-06-13 22:50:51 +10:00
Russ Cox
900c5fa98e gc: compactframe breaks arm - fix build
R=lvd
CC=golang-dev
https://golang.org/cl/4591063
2011-06-09 18:28:27 -04:00
Luuk van Dijk
fd2e24727e gc: nit
R=rsc
CC=golang-dev
https://golang.org/cl/4604041
2011-06-10 00:08:57 +02:00
Luuk van Dijk
2ac375b2df gc: compact stackframe
After allocparams and walk, remove unused auto variables
and re-layout the remaining in reverse alignment order.

R=rsc
CC=golang-dev
https://golang.org/cl/4568068
2011-06-10 00:02:34 +02:00
Russ Cox
17ca32e9db gc: nits
R=ken2
CC=golang-dev
https://golang.org/cl/4572052
2011-06-09 11:44:28 -04:00
Dave Cheney
6998ea2982 gc: alternative clang compatible abort.
Tested on clang 2.9/amd64

R=rsc, jeff, r
CC=golang-dev
https://golang.org/cl/4517143
2011-06-08 10:46:15 +10:00
Caine Tighe
7c19d88b0f gc/lex.c: fix formatting of #include statement
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4564048
2011-06-07 09:57:26 -07:00
Dave Cheney
60a4b5e4db gc: enable building under clang/2.9
To build under clang, pass the path to clang in CC when
calling ./make.bash

CC=/opt/llvm/llvm-2.9/bin/clang ./make.bash

Credit goes to jmhodges for suggestions.

R=jeff, r, ality
CC=golang-dev
https://golang.org/cl/4527098
2011-06-06 19:53:44 +10:00
Russ Cox
84f291b1bd 8g: compute register liveness during regopt
Input code like

0000 (x.go:2) TEXT    main+0(SB),$36-0
0001 (x.go:3) MOVL    $5,i+-8(SP)
0002 (x.go:3) MOVL    $0,i+-4(SP)
0003 (x.go:4) MOVL    $1,BX
0004 (x.go:4) MOVL    i+-8(SP),AX
0005 (x.go:4) MOVL    i+-4(SP),DX
0006 (x.go:4) MOVL    AX,autotmp_0000+-20(SP)
0007 (x.go:4) MOVL    DX,autotmp_0000+-16(SP)
0008 (x.go:4) MOVL    autotmp_0000+-20(SP),CX
0009 (x.go:4) CMPL    autotmp_0000+-16(SP),$0
0010 (x.go:4) JNE     ,13
0011 (x.go:4) CMPL    CX,$32
0012 (x.go:4) JCS     ,14
0013 (x.go:4) MOVL    $0,BX
0014 (x.go:4) SHLL    CX,BX
0015 (x.go:4) MOVL    BX,x+-12(SP)
0016 (x.go:5) MOVL    x+-12(SP),AX
0017 (x.go:5) CDQ     ,
0018 (x.go:5) MOVL    AX,autotmp_0001+-28(SP)
0019 (x.go:5) MOVL    DX,autotmp_0001+-24(SP)
0020 (x.go:5) MOVL    autotmp_0001+-28(SP),AX
0021 (x.go:5) MOVL    autotmp_0001+-24(SP),DX
0022 (x.go:5) MOVL    AX,(SP)
0023 (x.go:5) MOVL    DX,4(SP)
0024 (x.go:5) CALL    ,runtime.printint+0(SB)
0025 (x.go:5) CALL    ,runtime.printnl+0(SB)
0026 (x.go:6) RET     ,

is problematic because the liveness range for
autotmp_0000 (0006-0009) is nested completely
inside a span where BX holds a live value (0003-0015).
Because the register allocator only looks at 0006-0009
to see which registers are used, it misses the fact that
BX is unavailable and uses it anyway.

The n->pun = anyregalloc() check in tempname is
a workaround for this bug, but I hit it again because
I did the tempname call before allocating BX, even
though I then used the temporary after storing in BX.
This should fix the real bug, and then we can remove
the workaround in tempname.

The code creates pseudo-variables for each register
and includes that information in the liveness propagation.
Then the regu fields can be populated using that more
complete information.  With that approach, BX is marked
as in use on every line in the whole span 0003-0015,
so that the decision about autotmp_0000
(using only 0006-0009) still has all the information
it needs.

This is not specific to the 386, but it only happens in
generated code of the form

        load R1
        ...
        load var into R2
        ...
        store R2 back into var
        ...
        use R1

and for the most part the other compilers generate
the loads for a given compiled line before any of
the stores.  Even so, this may not be the case everywhere,
so the change is worth making in all three.

R=ken2, ken, ken
CC=golang-dev
https://golang.org/cl/4529106
2011-06-03 14:10:39 -04:00
Luuk van Dijk
ab8ed7f8dd gc: renamed walkdef to typecheckdef and moved from walk to typedef.
also inlined a typechecking function in dcl away.

R=rsc
CC=golang-dev
https://golang.org/cl/4550115
2011-06-03 17:44:02 +02:00
Luuk van Dijk
56668283f1 gc: allow tags on parameters in export section of object files.
This is in preparation of escape analysis; function parameters
can now be tagged with interesting bits by the compiler by
assigning to n->note.

tested by having typecheck put a fake tag on all parameters of
pointer type and compiling the tree.

R=rsc
CC=golang-dev
https://golang.org/cl/4524092
2011-06-03 03:54:56 +02:00
Luuk van Dijk
e59aa8ea4a gc: typecheck the whole tree before walking. preparation for some escape-analysis related changes.
R=rsc
CC=golang-dev
https://golang.org/cl/4528116
2011-06-02 18:48:17 +02:00
Luuk van Dijk
2c4edb0eea gc: make merely referencing an outer variable in a closure not force heapallocation.
before: runtime_test.BenchmarkCallClosure1       20000000              135 ns/op
after:  runtime_test.BenchmarkCallClosure1      500000000                6 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4527091
2011-06-01 17:02:43 +02:00
Russ Cox
15dcdf751c gc: fix m[x], _ = y.(T)
Fixes #1900.

R=ken2
CC=golang-dev
https://golang.org/cl/4561053
2011-05-31 15:52:04 -04:00
Anthony Martin
5b62ba14c4 gc: disallow ... in type conversions
Fixes #1866.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548073
2011-05-31 15:41:47 -04:00
Russ Cox
5ab096d030 gc: implement new shift rules
The change is that 1.0<<2 is now okay.

R=ken2
CC=golang-dev
https://golang.org/cl/4524084
2011-05-31 15:05:40 -04:00
Luuk van Dijk
9b82408f6d gc: elide call to runtime.closure for function literals called in-place.
before:
runtime_test.BenchmarkCallClosure        5000000               499 ns/op
runtime_test.BenchmarkCallClosure1       5000000               681 ns/op

after:
runtime_test.BenchmarkCallClosure       500000000                5 ns/op
runtime_test.BenchmarkCallClosure1       10000000              160 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4515167
2011-05-31 20:52:21 +02:00
Anthony Martin
67b4db9e9e gc: check parameter declarations in interface fields
Fixes #1663.
Fixes #1871.

R=rsc, lstoakes
CC=golang-dev
https://golang.org/cl/4530084
2011-05-31 13:41:32 -04:00
Ian Lance Taylor
9ef8ebafe4 gc: patch y.tab.c to fix build when using Bison 2.5
Fixes #1843.

R=rsc
CC=golang-dev
https://golang.org/cl/4535101
2011-05-26 11:28:23 -07:00
Russ Cox
e94eb38975 gc: typo
R=ken2
CC=golang-dev
https://golang.org/cl/4539086
2011-05-25 10:19:50 -04:00
Russ Cox
2286471651 5g: alignment fixes
Makes all.bash work after echo 4 >/proc/cpu/alignment,
which means kill the process on an unaligned access.

The default behavior on DreamPlug/GuruPlug/SheevaPlug
is to simulate an ARMv3 and just let the unaligned accesses
stop at the word boundary, resulting in all kinds of surprises.

Fixes #1240.

R=ken2
CC=golang-dev
https://golang.org/cl/4551064
2011-05-25 10:18:49 -04:00
Anthony Martin
0b209b36b6 gc: relax assignability of method receivers
The spec was adjusted in commit df410d6a4842 to allow the
implicit assignment of strutures with unexported fields in
method receivers.  This change updates the compiler.

Also moved bug322 into fixedbugs and updated golden.out
to reflect the removal of the last known bug.

Fixes #1402.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4526069
2011-05-24 19:48:19 -04:00
Luuk van Dijk
36cec789cd gc: generalize dst = append(src,...) inlining to arbitrary src and dst arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/4517057
2011-05-14 00:35:10 +02:00
Lorenzo Stoakes
f58d911698 gc: fix type switch error message for invalid cases.
Fixes #1606.

R=rsc
CC=golang-dev
https://golang.org/cl/4532045
2011-05-11 23:41:59 -04:00