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

191 Commits

Author SHA1 Message Date
Russ Cox
e2d326b878 5g, 6g, 8g: fix loop finding bug, squash jmps
The loop recognizer uses the standard dominance
frontiers but gets confused by dead code, which
has a (not explicitly set) rpo number of 0, meaning it
looks like the head of the function, so it dominates
everything.  If the loop recognizer encounters dead
code while tracking backward through the graph
it fails to recognize where it started as a loop, and
then the optimizer does not registerize values loaded
inside that loop.  Fix by checking rpo against rpo2r.

Separately, run a quick pass over the generated
code to squash JMPs to JMP instructions, which
are convenient to emit during code generation but
difficult to read when debugging the -S output.
A side effect of this pass is to eliminate dead code,
so the output files may be slightly smaller and the
optimizer may have less work to do.
There is no semantic effect, because the linkers
flatten JMP chains and delete dead instructions
when laying out the final code.  Doing it here too
just makes the -S output easier to read and more
like what the final binary will contain.

The "dead code breaks loop finding" bug is thus
fixed twice over.  It seemed prudent to fix loopit
separately just in case dead code ever sneaks back
in for one reason or another.

R=ken2
CC=golang-dev
https://golang.org/cl/5190043
2011-10-04 15:06:16 -04: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
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
919cb2ec7c gc: fix zero-length struct eval
Fixes #2232.

R=ken2
CC=golang-dev
https://golang.org/cl/4960054
2011-09-05 15:31:22 -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
Russ Cox
4fb3c4f765 gc: fix div bug
R=ken2
CC=golang-dev
https://golang.org/cl/4950052
2011-08-30 08:47:28 -04:00
Lucio De Re
f6a9807f56 8g: fix build on Plan 9
8g/cgen.c:
8g/gobj.c
. dropped unnecessary assignments;
8g/gg.h
. added varargckk pragmas;
8g/ggen.c
. dropped duplicate assignment;
8g/gsubr.c
. adjusted format in print statement;
. dropped unnecessary assignment;
. replaced GCC's _builtin_return_address(0) with Plan 9's
  getcallerpc(&n) which is defined as a macro in <u.h>;
8g/list.c
. adjusted format in snprint statement;
8g/opt.h
. added varargck pragma (Adr*) that is specific for the invoking
  modules;
8g/peep.c
. dropped unnecessary incrementation;

R=rsc
CC=golang-dev
https://golang.org/cl/4974044
2011-08-26 17:42:59 -04:00
Russ Cox
987649e09b build: fix more unused parameters
R=ken2
CC=golang-dev
https://golang.org/cl/4971042
2011-08-25 16:29:56 -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
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
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
08bfb39515 6g, 8g: divide corner case
Fixes #1772.

R=ken2
CC=golang-dev
https://golang.org/cl/4798062
2011-07-28 14:18:22 -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
Anthony Martin
028f74f827 5g, 6g, 8g: fix comments in method call generation
R=golang-dev
CC=golang-dev
https://golang.org/cl/4652042
2011-06-20 14:49:29 -04:00
Russ Cox
b96ff8458c 5g, 8g: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/4627045
2011-06-17 16:05:00 -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
5a5a7b5163 6g, 8g: fix goto fix
R=ken2
CC=golang-dev
https://golang.org/cl/4632041
2011-06-16 01:25:49 -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
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
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
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
Anthony Martin
f570d9d765 8g: fix conversion from float to uint64
The code for converting negative floats was
incorrectly loading an FP control word from
the stack without ever having stored it there.

Thanks to Lars Pensjö for reporting this bug.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4515091
2011-05-16 22:14:56 -04:00
Luuk van Dijk
d6b2925923 gc: inline append when len<cap
issue 1604

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4313062
2011-05-11 16:35:11 +02:00
Russ Cox
bac8f18035 gc: fix order of operations for f() < g().
Also, 6g was passing uninitialized
Node &n2 to regalloc, causing non-deterministic
register collisions (but only when both left and
right hand side of comparison had function calls).

Fixes #1728.

R=ken2
CC=golang-dev
https://golang.org/cl/4425070
2011-04-26 00:57:03 -04:00
Fazlul Shahriar
f1781bec3b 8g,8l: fix "set but not used" gcc error
$ gcc --version
gcc (GCC) 4.6.0 20110415 (prerelease)

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4442080
2011-04-25 12:14:30 -04:00
Russ Cox
3a1fdc655e gc: fix import width bug
Fixes #1705.

R=ken2
CC=golang-dev
https://golang.org/cl/4443060
2011-04-25 12:08:48 -04:00
Russ Cox
1bc84b7e18 ld: 25% faster
The ld time was dominated by symbol table processing, so
  * increase hash table size
  * emit fewer symbols in gc (just 1 per string, 1 per type)
  * add read-only lookup to avoid creating spurious symbols
  * add linked list to speed whole-table traversals

Breaks dwarf generator (no idea why), so disable dwarf.

Reduces time for 6l to link godoc by 25%.

R=ken2
CC=golang-dev
https://golang.org/cl/4383047
2011-04-09 09:44:20 -04:00
Russ Cox
23f6479be6 8g: optimize byte mov
Rewrite MOVB with less expensive
instruction when possible.

Suggested by atomic symbol.

benchmark                                        old ns/op    new ns/op    delta
crc32.BenchmarkCrc32KB                               13066         3942  -69.83%
crc64.BenchmarkCrc64KB                                8780         5949  -32.24%
lzw.BenchmarkDecoder1e4                             771224       636538  -17.46%
lzw.BenchmarkDecoder1e5                            7101218      6096634  -14.15%
lzw.BenchmarkDecoder1e6                           69762020     60789400  -12.86%
lzw.BenchmarkEncoder1e4                             707968       638812   -9.77%
lzw.BenchmarkEncoder1e5                            6567122      5965552   -9.16%
lzw.BenchmarkEncoder1e6                           65006000     58911680   -9.38%
utf8_test.BenchmarkRuneCountTenASCIIChars              166          165   -0.60%
utf8_test.BenchmarkRuneCountTenJapaneseChars           246          258   +4.88%
utf8_test.BenchmarkEncodeASCIIRune                      13           10  -23.08%
utf8_test.BenchmarkEncodeJapaneseRune                   37           16  -56.76%
utf8_test.BenchmarkDecodeASCIIRune                      23           21   -8.70%
utf8_test.BenchmarkDecodeJapaneseRune                   58           32  -44.83%

R=ken2
CC=golang-dev
https://golang.org/cl/4381045
2011-04-08 13:53:59 -04:00
Russ Cox
66f09fd459 gc: diagnose unused labels
R=ken2
CC=golang-dev
https://golang.org/cl/4287047
2011-03-15 14:05:37 -04:00
Russ Cox
0849944694 gc: delete float, complex
rename cmplx -> complex

R=ken2
CC=golang-dev
https://golang.org/cl/4071041
2011-01-19 23:08:11 -05:00
Russ Cox
0c54225b51 remove nacl
The recent linker changes broke NaCl support
a month ago, and there are no known users of it.

The NaCl code can always be recovered from the
repository history.

R=adg, r
CC=golang-dev
https://golang.org/cl/3671042
2010-12-15 11:49:23 -05:00
Russ Cox
e7a0f67603 gc: introduce explicit alignments
No semantic changes here, but working
toward being able to align structs based
on the maximum alignment of the fields
inside instead of having a fixed alignment
for all structs (issue 482).

R=ken2
CC=golang-dev
https://golang.org/cl/3617041
2010-12-13 11:57:41 -05:00
Eoghan Sherry
40ff071e9b 5g/8g, 8l, ld, prof: fix output of 32-bit values
If an %lld argument can be 32 or 64 bits wide, cast to vlong.
If always 32 bits, drop the ll.
Fixes #1336.

R=brainman, rsc
CC=golang-dev
https://golang.org/cl/3580041
2010-12-12 14:40:19 -05:00
Russ Cox
e48c0fb562 5g, 6g, 8g: generate code for string index
instead of calling function.

R=ken2
CC=golang-dev
https://golang.org/cl/2762041
2010-10-26 21:11:17 -07:00
Russ Cox
69188ad9bb arm: prop up software floating point
Just enough to make mov instructions work,
which in turn is enough to make strconv work
when it avoids any floating point calculations.
That makes a bunch of other packages pass
their tests.

Should suffice until hardware floating point
is available.

Enable package tests that now pass
(some due to earlier fixes).

Looks like there is a new integer math bug
exposed in the fmt and json tests.

R=ken2
CC=golang-dev
https://golang.org/cl/2638041
2010-10-21 06:56:20 +02:00
Russ Cox
d9c989fa25 various: avoid %ld etc
The Plan 9 tools assume that long is 32 bits.
We converted all instances of long to int32 when
importing the code but missed the print formats.
Because int32 is always int on the compilers we use,
it is never correct to use %lux, %ld, etc.  Convert to %ux, %d, etc.

(It matters because on 64-bit gcc, long is 64 bits,
so we were printing 32-bit quantities with 64-bit formats.)

R=ken2
CC=golang-dev
https://golang.org/cl/2491041
2010-10-13 16:20:22 -04:00
Russ Cox
30dd191171 gc: O(1) string comparison when lengths differ
R=ken2
CC=golang-dev
https://golang.org/cl/2331045
2010-10-06 09:53:12 -04:00
Russ Cox
698fb4f192 6g, 6l, 8g, 8l: move read-only data to text segment
Changing 5g and 5l too, but it doesn't work yet.

R=ken2
CC=golang-dev
https://golang.org/cl/2136047
2010-09-12 00:17:44 -04:00
Russ Cox
1678dcc378 gc: more accurate line numbers for ATEXT
and other begin and end of function code

R=ken2
CC=golang-dev
https://golang.org/cl/2158044
2010-09-09 17:11:51 -04:00
Russ Cox
9686ab2da9 8g: use FCHS, not FMUL, for minus float
Fixes #1052.

R=ken2
CC=golang-dev
https://golang.org/cl/2055041
2010-08-27 14:02:00 -04:00
Russ Cox
aafe474ec9 build: $GOBIN defaults to $GOROOT/bin
R=r
CC=golang-dev
https://golang.org/cl/1982049
2010-08-24 20:00:33 -04:00
Russ Cox
1d77ff5b6b 6g, 8g: handle slice by sub-word-sized index (uint8, int8, uint16, int16)
R=ken2
CC=golang-dev
https://golang.org/cl/1960042
2010-08-11 22:27:47 -07:00
Russ Cox
14e0df34fd 5g, 8g: dead code (already removed from 6g)
R=ken2
CC=golang-dev
https://golang.org/cl/1983041
2010-08-11 21:58:29 -07:00
Russ Cox
9bac9d23d3 gc: index bounds tests and fixes
move constant index checking to front end
x[2:1] is a compile-time error now too

R=ken2
CC=golang-dev
https://golang.org/cl/1848056
2010-08-03 00:26:02 -07:00
Russ Cox
f930d28164 5g: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/1893042
2010-07-27 13:43:58 -07:00
Russ Cox
607eaea456 gc: fix smaller-than-pointer-sized receivers in interfaces
Fixes #812.

R=ken2
CC=golang-dev
https://golang.org/cl/1904041
2010-07-26 15:25:10 -07:00
Russ Cox
ece6a8c549 gc: bug293
Fixes #846.

R=ken2
CC=golang-dev
https://golang.org/cl/1862042
2010-07-15 16:14:06 -07:00
Russ Cox
b2a919fc29 gc: issue 894
Fixes #894.

R=ken2
CC=golang-dev
https://golang.org/cl/1701051
2010-07-15 15:25:32 -07:00
Russ Cox
7c9ed7946c 8g: out of register bug fix
Fixes #868.

R=ken2
CC=golang-dev
https://golang.org/cl/1695049
2010-06-30 20:45:50 -07:00
Ken Thompson
1246ad8390 code gen bug in len(nil) and cap(nil)
fixes #892

R=rsc
CC=golang-dev
https://golang.org/cl/1745042
2010-06-29 12:48:24 -07:00
Ken Thompson
e5d748a333 8g compiler missing call to splitclean().
fixes #887.

R=rsc
CC=golang-dev
https://golang.org/cl/1675050
2010-06-28 12:19:12 -07:00
Russ Cox
a212d174ac gc: better error messages for interface failures, conversions
x.go:13: cannot use t (type T) as type Reader in assignment:
	T does not implement Reader (Read method requires pointer receiver)
x.go:19: cannot use q (type Q) as type Reader in assignment:
	Q does not implement Reader (missing Read method)
		have read()
		want Read()
x.go:22: cannot use z (type int) as type Reader in assignment:
	int does not implement Reader (missing Read method)

x.go:24: too many arguments to conversion to complex: complex(1, 3)

R=ken2
CC=golang-dev
https://golang.org/cl/1736041
2010-06-20 11:45:53 -07:00
Russ Cox
6a060200cc 8g: out of register bug
Fixes #806.

R=ken2
CC=golang-dev
https://golang.org/cl/1281042
2010-05-24 17:22:51 -07:00
Russ Cox
9fc9246bf3 gc: bug281 - bad overlap in stack copy
Fixes #807.

R=ken2
CC=golang-dev
https://golang.org/cl/1283041
2010-05-24 16:54:24 -07:00
Ken Thompson
b0283611e4 fix issue 798
cannot allocate an audomatic temp
while real registers are allocated.
there is a chance that the automatic
will be allocated to one of the
allocated registers. the fix is to
not registerize such variables.

R=rsc
CC=golang-dev
https://golang.org/cl/1202042
2010-05-20 17:31:28 -07:00
Russ Cox
c66b49845c 8g: bug272
Fixes #589.

R=ken2
CC=golang-dev
https://golang.org/cl/1043042
2010-04-30 14:04:34 -07:00
Russ Cox
c6138efbcb runtime: closures, defer bug fix for Native Client
Enable package tests for Native Client build.

R=r
CC=golang-dev
https://golang.org/cl/957042
2010-04-22 17:52:22 -07:00
Russ Cox
f75d0d224f runtime: turn run time errors checks into panics
R=ken2, r
CC=golang-dev
https://golang.org/cl/871042
2010-04-01 22:31:27 -07:00
Russ Cox
9b1507b050 gc: implement panic and recover
R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/831042
2010-03-31 11:46:01 -07:00
Russ Cox
97d0e8fe6c gc: allow taking address of out parameters
Fixes #186.

R=ken2
CC=golang-dev
https://golang.org/cl/793041
2010-03-26 18:01:02 -07:00
Ken Thompson
8021296179 issue 682
complex DATA statement fo
initialization of complex variables.

R=rsc
CC=golang-dev
https://golang.org/cl/634045
2010-03-20 18:50:01 -07:00
Russ Cox
16e6df9807 fix 386 a[i] = cmplx(r, j)
R=ken2
CC=golang-dev
https://golang.org/cl/384043
2010-03-10 13:06:35 -08:00
Ken Thompson
f229c8b546 identical complex implementation
for 6g and 8g. can also be used
for 5g. 5g is still a stub.

R=rsc
CC=golang-dev
https://golang.org/cl/362041
2010-03-09 12:49:24 -08:00
Russ Cox
4f89dcdf99 5g/6g/8g: fix double function call in slice
Fixes #654.

R=ken2
CC=golang-dev
https://golang.org/cl/310041
2010-03-08 14:19:28 -08:00
Ken Thompson
426099f42e 6g complex type usable
8g and 5g have stubs to ignore complex

R=rsc
CC=golang-dev
https://golang.org/cl/257042
2010-03-05 20:16:04 -08:00
Russ Cox
ac499ed7a5 gc: better compilation of floating point +=
R=ken2
CC=golang-dev
https://golang.org/cl/255042
2010-03-05 15:35:09 -08:00
Russ Cox
bc6878331a 8g: fix out of register bug in byte(x) code
R=ken2
CC=golang-dev
https://golang.org/cl/223070
2010-02-26 14:21:52 -08:00
Russ Cox
ba50599e46 8g: make a[byte(x)] truncate x
R=ken2
CC=golang-dev
https://golang.org/cl/223069
2010-02-26 13:15:29 -08:00
Russ Cox
4589c34580 gc: fix this morning's bug fix
R=ken2
CC=golang-dev
https://golang.org/cl/216043
2010-02-18 18:31:13 -08:00
Russ Cox
cf015fd0b8 5g/8g: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/215042
2010-02-17 22:41:04 -08:00
Russ Cox
fb5506600f 8g: respect ullman numbers in float comparison
Fixes #602.

R=ken2
CC=golang-dev
https://golang.org/cl/212045
2010-02-17 15:28:45 -08:00
Russ Cox
68796b0270 gc: add ... T, rework plain ...
No longer a distinct type; now a property of func types.

R=ken2
CC=golang-dev
https://golang.org/cl/197042
2010-02-01 00:25:59 -08:00
Ken Thompson
424f9ca6ab change print print buffer size
to go with the full path names

R=rsc
CC=golang-dev
https://golang.org/cl/195079
2010-01-27 15:37:46 -08:00
Russ Cox
758f2bc556 eliminate the package global name space assumption in object files
5g/6g/8g: add import statements to export metadata, mapping package path to package name.
	recognize "" as the path of the package in export metadata.
	use "" as the path of the package in object symbol names.

5c/6c/8c, 5a/6a/8a: rewrite leading . to "". so that ·Sin means Sin in this package.

5l/6l/8l: rewrite "" in symbol names as object files are read.

gotest: handle new symbol names.

gopack: handle new import lines in export metadata.

Collectively, these changes eliminate the assumption of a global
name space in the object file formats.  Higher level pieces such as
reflect and the computation of type hashes still depend on the
assumption; we're not done yet.

R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/186263
2010-01-22 17:06:20 -08:00
Russ Cox
a6736fa4ff cleanup toward eliminating package global name space
* switch to real dot (.) instead of center dot (·) everywhere in object files.
    before it was half and half depending on where in the name it appeared.
  * in 6c/6a/etc identifiers, · can still be used but turns into . immediately.
  * in export metadata, replace package identifiers with quoted strings
    (still package names, not paths).

R=ken2, r
CC=golang-dev
https://golang.org/cl/190076
2010-01-19 21:34:44 -08:00
Evan Shaw
a551ffe809 8g: float->uint64 conversion optimization
Using FUCOMIP instead of the FUCOMP-FSTSW-SAHF sequence gives better performance and saves code space.

R=rsc
CC=golang-dev
https://golang.org/cl/183139
2010-01-06 19:28:19 -08:00
Russ Cox
4ab0ce107a 8g: add TESTL etc to reg opt
Fixes #436.

R=ken2
https://golang.org/cl/180105
2009-12-21 11:02:18 -08:00
Ken Thompson
bedfc2c2f1 more on the optimizer
trying to get alizses
to optimize

R=rsc
https://golang.org/cl/176061
2009-12-12 14:36:52 -08:00
Ken Thompson
cd00bc78da bug in 6g optimizer
8g still needs fixing

R=rsc
https://golang.org/cl/176057
2009-12-11 15:55:09 -08:00
Charles L. Dorian
3ca1b1d27f Continuation of issue 221 fix. When 8g or 6g or 5g are called with a
UTF-8 string, Yconv() converts it into an octal sequence. If the
string converted to more than 30 bytes, the str buffer would
overflow. For example, 4 Greek runes became 32 bytes, 3 Hiragana
runes became 36 bytes, and 2 Gothic runes became 32 bytes. In
8l, 6l and 5l the function is Sconv(). For some reason, only 5l uses
the constant STRINGSZ (defined as 200) for the buffer size.

R=rsc
https://golang.org/cl/168045
2009-12-09 11:56:45 -08:00
Russ Cox
7c4aeec868 6g/8g optimizer fix: throw functions now in runtime
R=ken2
https://golang.org/cl/166070
2009-12-04 20:37:32 -08:00
Ken Thompson
62be24d949 6g code gen bug
R=rsc
https://golang.org/cl/166052
2009-12-03 20:28:24 -08:00
Russ Cox
69c0edd59b 8g: discard tempalloc/tempfree experiment
in favor of tempname.
allows optimizer to do more.
unfortunately, optimizer seems to be broken; disable it.

R=ken2
https://golang.org/cl/163091
2009-12-02 18:31:29 -08:00
Russ Cox
fdb030d86f 6g etc: groundwork for eliminating redundant bounds checks.
drop check in range over array.
	drop check in [256]array indexed by byte.

R=ken2
https://golang.org/cl/163088
2009-12-02 17:30:07 -08:00
Evan Shaw
1664e81585 8g: Match sgen definition to declaration
R=rsc
CC=golang-dev
https://golang.org/cl/164069
2009-12-01 21:42:35 -08:00
Charles L. Dorian
e1c347ca59 8g: fix 386 floating point stack bug
Also fixes issue 310 comment 5 error.
Fixes #310.

R=rsc
https://golang.org/cl/163042
2009-12-01 15:53:50 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
Russ Cox
dc30800c28 8g: call throwindex for array out of bounds
R=ken2
https://golang.org/cl/160043
2009-11-23 12:58:28 -08:00
Russ Cox
652f55672d x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
  * remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
  * port cgen_inline into 8g, 5g.
  * use native memmove in maps

R=ken2
https://golang.org/cl/157106
2009-11-20 09:11:46 -08:00
Russ Cox
ef46a9ddac gc: fix up floating point NaN comparisons
Fixes #167.

R=ken2
https://golang.org/cl/155062
2009-11-15 17:24:14 -08:00
Russ Cox
18ccbc69f8 tweak documentation of commands
so that first sentence is better for cmd page.

live at http://r45:3456/cmd/

R=gri, r
http://go/go-review/1024034
2009-11-09 11:45:15 -08:00
Ken Thompson
0eb2a79ff3 8g optimizer
R=rsc
http://go/go-review/1025011
2009-11-06 16:51:49 -08:00
Rob Pike
3fa379e797 document the gc go compilers.
fix the usage message.

R=rsc
CC=go-dev
http://go/go-review/1016033
2009-11-03 22:00:36 -08:00
Russ Cox
9dd2e1e30f nil pointer checks in 8g.
fix nil pointer check in 6g.
was dereferencing after the ADD;
dereference before instead.

R=ken@golang.org
CC=iant
http://go/go-review/1016022
2009-11-01 21:04:16 -08:00
Kai Backman
58ee1f5d54 shift for non-64 bit integers.
R=rsc
http://go/go-review/1015017
2009-10-27 22:38:45 -07:00
Russ Cox
4e4097d9d9 386 shift bug; wasn't zero-extending 16- and 8-bit counts
+test

R=ken
OCL=35801
CL=35801
2009-10-15 16:32:45 -07:00
Russ Cox
11d3805579 clean more
R=r
DELTA=40  (9 added, 3 deleted, 28 changed)
OCL=35277
CL=35305
2009-10-03 10:38:03 -07:00
Russ Cox
b71c484c91 fix 386 build - register allocation and shift bug
R=ken
OCL=35140
CL=35142
2009-09-30 08:56:01 -07:00