summaryrefslogtreecommitdiff
path: root/src/cmd/6c
Commit message (Collapse)AuthorAgeFilesLines
* runtime: use funcdata to supply garbage collection informationRuss Cox2013-07-191-0/+2
| | | | | | | | | | | | | This CL introduces a FUNCDATA number for runtime-specific garbage collection metadata, changes the C and Go compilers to emit that metadata, and changes the runtime to expect it. The old pseudo-instructions that carried this information are gone, as is the linker code to process them. R=golang-dev, dvyukov, cshapiro CC=golang-dev https://codereview.appspot.com/11406044
* runtime: cleanup: use ArgsSizeUnknown to mark all functionsKeith Randall2013-07-191-10/+1
| | | | | | | | | | | | whose argument size is unknown (C vararg functions, and assembly code without an explicit specification). We used to use 0 to mean "unknown" and 1 to mean "zero". Now we use ArgsSizeUnknown (0x80000000) to mean "unknown". R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/11590043
* cmd/5c, cmd/6c, cmd/8c: record arg size for every callRuss Cox2013-07-164-3/+23
| | | | | | R=ken2 CC=golang-dev https://codereview.appspot.com/11364043
* all: fix typosShenghou Ma2013-06-092-2/+2
| | | | | | R=golang-dev, bradfitz, khr, r CC=golang-dev https://codereview.appspot.com/7461046
* cmd/6c: use full 64-bit address in block copyRuss Cox2013-06-051-5/+5
| | | | | | | | Already fixed independently in Plan 9. R=ken2 CC=golang-dev https://codereview.appspot.com/10041044
* cmd/5c, cmd/6c, cmd/8c: isolate textflag and dataflagAnthony Martin2013-06-041-4/+10
| | | | | | | | Fixes issue 5419. R=golang-dev, dave, minux.ma, rsc CC=golang-dev https://codereview.appspot.com/9241044
* cmd/6c, cmd/8c: avoid generating long multiplication when not necessary.R?my Oudompheng2013-06-041-2/+3
| | | | | | | | | | | | | | | On amd64 benchmark old ns/op new ns/op delta BenchmarkHashStringSpeed 91 74 -18.49% BenchmarkHashInt32Speed 54 45 -17.88% BenchmarkHashInt64Speed 76 58 -23.53% BenchmarkHashStringArraySpeed 231 188 -18.61% Fixes issue 5367. R=golang-dev, iant, dave, daniel.morsing, ality, rsc CC=golang-dev https://codereview.appspot.com/9040043
* cmd/6c, cmd/8c: fix stack allocated Biobuf leaking at exitDave Cheney2013-03-201-1/+1
| | | | | | | | | | | | Fixes issue 5085. {6,8}c/swt.c allocates a third Biobuf in automatic memory which is not terminated at the end of the function. This causes the buffer to be 'in use' when the batexit handler fires, confusing valgrind. Huge thanks to DMorsing for the diagnosis. R=golang-dev, daniel.morsing, rsc CC=golang-dev https://codereview.appspot.com/7844044
* cmd/cgo, cmd/ld: new cgo object file sectionRuss Cox2013-03-011-13/+3
| | | | | | | | | | Switch to new pragma names, but leave old ones available for now. Merge the three cgo-related sections in the .6 files into a single cgo section. R=golang-dev, iant, ality CC=golang-dev https://codereview.appspot.com/7424048
* cmd/godoc: use go/build to determine package and example filesRobert Griesemer2013-02-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Also: - faster code for example extraction - simplify handling of command documentation: all "main" packages are treated as commands - various minor cleanups along the way For commands written in Go, any doc.go file containing documentation must now be part of package main (rather then package documentation), otherwise the documentation won't show up in godoc (it will still build, though). For commands written in C, documentation may still be in doc.go files defining package documentation, but the recommended way is to explicitly ignore those files with a +build ignore constraint to define package main. Fixes issue 4806. R=adg, rsc, dave, bradfitz CC=golang-dev https://codereview.appspot.com/7333046
* cmd/6c: fix buildRuss Cox2013-02-181-1/+1
| | | | | | | | copy+paste error while cleaning up CL 7303099 before submit R=ken2 CC=golang-dev https://codereview.appspot.com/7308104
* cmd/6c, cmd/8c: cut stack frames by about halfRuss Cox2013-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The routine that adds an automatic to the stack was adding ptrsize-1 to the size before rounding up. That addition would only make sense to turn a round down into a round up. Before a round up, it just wastes a word. The effect was that a 6c function with one local and one two-word function call used (8+8)+(16+8) = 40 bytes instead of 8+16 = 24 bytes. The wasted space mostly didn't matter, but one place where it does matter is when trying to stay within the 128-byte total frame constraint for #pragma textflag 7 functions. This only affects the C compilers, not the Go compilers. 5c already had correct code, which is now copied to 6c and 8c. R=ken2 CC=golang-dev https://codereview.appspot.com/7303099
* cmd/6c, cmd/6g: add flag to support large-model code generationElias Naur2013-02-011-1/+4
| | | | | | | | | | | | | | | | Added the -pic flag to 6c and 6g to avoid assembler instructions that cannot?use RIP-relative adressing. This is needed to support the -shared mode in 6l. See also: https://codereview.appspot.com/6926049 https://codereview.appspot.com/6822078 R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/7064048 Committer: Russ Cox <rsc@golang.org>
* cmd/6c, cmd/8c: fix print format for ProgAnthony Martin2013-01-181-29/+24
| | | | | | | | | | | | | | | The FmtLong flag should only be used with the %D verb when printing an ATEXT Prog. It was erroneously used for every Prog except ADATA. This caused a preponderance of exclamation points, "!!", in the assembly listings. I also cleaned up the code so that the list.c files look very similar. Now the real differences are easily spotted with a simple diff. R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/7128045
* cmd/6c: Optimize rotate expressions to use rotate instructions.Matthew Dempsky2013-01-182-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For simplicity, only recognizes expressions of the exact form "(x << a) | (x >> b)" where x is a variable and a and b are integer constant expressions that add to x's bit width. Fixes issue 4629. $ cat rotate.c unsigned int rotate(unsigned int x) { x = (x << 3) | (x >> (sizeof(x) * 8 - 3)); return x; } ## BEFORE $ go tool 6c -S rotate.c (rotate.c:2) TEXT rotate+0(SB),$0-8 (rotate.c:2) MOVL x+0(FP),!!DX (rotate.c:4) MOVL DX,!!AX (rotate.c:4) SALL $3,!!AX (rotate.c:4) MOVL DX,!!CX (rotate.c:4) SHRL $29,!!CX (rotate.c:4) ORL CX,!!AX (rotate.c:5) RET ,!! (rotate.c:5) RET ,!! (rotate.c:5) END ,!! ## AFTER $ go tool 6c -S rotate.c (rotate.c:2) TEXT rotate+0(SB),$0-8 (rotate.c:4) MOVL x+0(FP),!!AX (rotate.c:4) ROLL $3,!!AX (rotate.c:5) RET ,!! (rotate.c:5) RET ,!! (rotate.c:5) END ,!! R=rsc, minux.ma CC=golang-dev https://codereview.appspot.com/7069056 Committer: Russ Cox <rsc@golang.org>
* cmd/5a, cmd/5c, cmd/6a, cmd/6c, cmd/8a, cmd/8c, cmd/ld: update referenceCarl Shapiro2013-01-181-1/+1
| | | | | | | | | Reference the 80386 compiler documentation now that the documentation for the 68020 is offline. R=golang-dev, minux.ma, rsc CC=golang-dev https://codereview.appspot.com/7127053
* cmd/6c: Improve peep hole optimization of rotate and shift instructions.Matthew Dempsky2013-01-181-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update issue 4629. $ cat shift2.c unsigned int shift(unsigned int x, unsigned int y) { x = (x << 3); y = (y << 5); x = (x << 7); y = (y << 9); return x ^ y; } ## BEFORE $ go tool 6c -S shift2.c (shift2.c:2) TEXT shift+0(SB),$0-8 (shift2.c:4) MOVL x+0(FP),!!AX (shift2.c:4) SALL $3,!!AX (shift2.c:4) MOVL AX,!!DX (shift2.c:5) MOVL y+4(FP),!!AX (shift2.c:5) SALL $5,!!AX (shift2.c:5) MOVL AX,!!CX (shift2.c:6) MOVL DX,!!AX (shift2.c:6) SALL $7,!!AX (shift2.c:6) MOVL AX,!!DX (shift2.c:7) MOVL CX,!!AX (shift2.c:7) SALL $9,!!AX (shift2.c:7) MOVL AX,!!CX (shift2.c:8) MOVL DX,!!AX (shift2.c:8) XORL CX,!!AX (shift2.c:8) RET ,!! (shift2.c:8) RET ,!! (shift2.c:8) END ,!! ## AFTER $ go tool 6c -S shift2.c (shift2.c:2) TEXT shift+0(SB),$0-8 (shift2.c:4) MOVL x+0(FP),!!AX (shift2.c:4) SALL $3,!!AX (shift2.c:5) MOVL y+4(FP),!!CX (shift2.c:5) SALL $5,!!CX (shift2.c:6) SALL $7,!!AX (shift2.c:7) SALL $9,!!CX (shift2.c:8) XORL CX,!!AX (shift2.c:8) RET ,!! (shift2.c:8) RET ,!! (shift2.c:8) END ,!! R=rsc, minux.ma, dave, nigeltao CC=golang-dev https://codereview.appspot.com/7066055 Committer: Russ Cox <rsc@golang.org>
* cmd/6c, cmd/8c: add fixjmp step to regopt.R?my Oudompheng2012-12-062-1/+132
| | | | | | | | | | | | | | | The fixjmp step eliminates redundant chains of JMP instructions that are produced by the compiler during code generation. It is already implemented in gc, and can be adapted to 6c/8c with the exception that JMPs refer to destination by pc instead of by pointer. The algorithm is modified to operate on Regs instead of Progs for this reason. The pcs are already restored later by regopt. R=goalng-dev, rsc CC=golang-dev https://codereview.appspot.com/6865046
* cmd/6c, cmd/8c: use signed char explicitly in mul.cR?my Oudompheng2012-11-091-4/+4
| | | | | | | | | | | On ARM, char is unsigned, and the code generation for multiplication gets totally broken. Fixes issue 4354. R=golang-dev, dave, minux.ma, rsc CC=golang-dev http://codereview.appspot.com/6826079
* cmd/{5g,6g,8g,6c}: remove unused macro, use %E to print etype.R?my Oudompheng2012-09-241-2/+0
| | | | | | R=golang-dev, rsc, dave CC=golang-dev http://codereview.appspot.com/6569044
* cmd/cgo, cmd/cc, cmd/ld: detect dynamic linker automaticallyShenghou Ma2012-05-051-0/+4
| | | | | | | | | | | | | | | | | | Some newer Linux distributions (Ubuntu ARM at least) use a new multiarch directory organization, where dynamic linker is no longer in the hardcoded path in our linker. For example, Ubuntu 12.04 ARM hardfloat places its dynamic linker at /lib/arm-linux-gnueabihf/ld-linux.so.3 Ref: http://lackof.org/taggart/hacking/multiarch/ Also, to support Debian GNU/kFreeBSD as a FreeBSD variant, we need this capability, so it's part of issue 3533. This CL add a new pragma (#pragma dynlinker "path") to cc. R=iant, rsc CC=golang-dev http://codereview.appspot.com/6086043
* cmd/cc: add PREFETCH built-in (like SET, USED)Russ Cox2012-05-024-0/+22
| | | | | | | | | | | | | | This makes it possible to inline the prefetch of upcoming memory addresses during garbage collection, instead of needing to flush registers, make a function call, and reload registers. On garbage collection-heavy workloads, this results in a 5% speedup. Fixes issue 3493. R=dvyukov, ken, r, dave CC=golang-dev http://codereview.appspot.com/5990066
* 6c, 6g, 6l: add MOVQL to make truncation explicitRuss Cox2012-04-103-28/+43
| | | | | | | | | | | | | | | | | | | | Without an explicit signal for a truncation, copy propagation will sometimes propagate a 32-bit truncation and end up overwriting uses of the original 64-bit value. The case that arose in practice is in C but I believe that the same could plausibly happen in Go. The main reason we didn't run into the same in Go is that I (perhaps incorrectly?) drop MOVL AX, AX during gins, so the truncation was never generated, so it didn't confuse the optimizer. Fixes issue 1315. Fixes issue 3488. R=ken2 CC=golang-dev http://codereview.appspot.com/6002043
* cmd/6c: fix probable code gen bugRuss Cox2012-04-101-1/+1
| | | | | | | | This is a pointer being copied; MOVL can't possibly be right. R=ken2 CC=golang-dev http://codereview.appspot.com/5999043
* 5c, 6c, 8c: take GOROOT_FINAL into considerationShenghou Ma2012-04-041-0/+31
| | | | | | R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/5936050
* ld: add NOPTRBSS for large, pointer-free uninitialized dataRuss Cox2012-02-211-0/+2
| | | | | | | | | | | | | | | | | cc: add #pragma textflag to set it runtime: mark mheap to go into noptr-bss. remove special case in garbage collector Remove the ARM from.flag field created by CL 5687044. The DUPOK flag was already in p->reg, so keep using that. Otherwise test/nilptr.go creates a very large binary. Should fix the arm build. Diagnosed by minux.ma; replacement for CL 5690044. R=golang-dev, minux.ma, r CC=golang-dev http://codereview.appspot.com/5686060
* 5c, 6c, 8c, 6g, 8g: correct boundary checkingShenghou Ma2012-02-151-1/+1
| | | | | | | | | | CL 5666043 fixed the same checking for 5g. R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/5666045 Committer: Russ Cox <rsc@golang.org>
* build: delete make paraphernaliaRuss Cox2012-02-061-33/+2
| | | | | | | | | | 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 http://codereview.appspot.com/5636050
* gc, cc: avoid using the wrong library when building the compilersAnthony Martin2012-02-011-1/+1
| | | | | | | | | | 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 http://codereview.appspot.com/5599053
* build: move the "-c" flag into HOST_CFLAGSAnthony Martin2012-01-311-1/+1
| | | | | | | | | On Plan 9 this flag is used to discover constant expressions in "if" statements. R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/5601060
* go: move compilers into the go-tool directoryRob Pike2012-01-301-1/+1
| | | | | | | | | | | | Also delete gotest, since it's messy to fix and slated for deletion anyway. A couple of things outside src can't be tested any more. "go test" will be fixed and these tests will be re-enabled. They're noisy for now. Fixes issue 284. R=rsc CC=golang-dev http://codereview.appspot.com/5598049
* 6c, 8c: make floating point code NaN-safeRuss Cox2012-01-261-3/+45
| | | | | | R=ken2 CC=golang-dev http://codereview.appspot.com/5569071
* 5c, 6c, 8c: support 64-bit switch valueAnthony Martin2011-12-142-2/+18
| | | | | | | | | | For real this time. :-) R=rsc, ken CC=golang-dev http://codereview.appspot.com/5486061 Committer: Russ Cox <rsc@golang.org>
* cc: change cas to newcaseRon Minnich2011-10-261-1/+1
| | | | | | | | | | | | | | | | Change the name of cas() in cc to newcase() to avoid a NIX conflict. cas() is used in cc to create a new Case struct. There is a name conflict in that cas() is a commonly-used name for compare and swap. Since cas() is only used internally in the compiler in 3 places, change the name to avoid a wider conflict with the NIX runtime. This issue might well come up on other OSes in the future anyway, as the name is fairly common. R=rsc CC=golang-dev http://codereview.appspot.com/5294071 Committer: Russ Cox <rsc@golang.org>
* 5a, 5c, 6a, 6c, 8a, 8c: fix Windows file pathsHector Chu2011-09-071-8/+4
| | | | | | | | | | Verified with objdump -W. R=alex.brainman, rsc CC=golang-dev http://codereview.appspot.com/4974061 Committer: Russ Cox <rsc@golang.org>
* 5c, 6c, 6l: fix Plan 9 build warningsLucio De Re2011-08-161-6/+2
| | | | | | | | | | | | | | | | | | | src/cmd/5c/reg.c: . Added USED() attribute. src/cmd/6c/cgen.c: . Revised code around "REGARG" to resemble use in "8c" and consequently remove a warning. src/cmd/6l/asm.c: . Added USED() attributes. . Removed an unnecessary assignment. R=golang-dev CC=golang-dev, rsc http://codereview.appspot.com/4836045 Committer: Russ Cox <rsc@golang.org>
* 6a, 6c, 6l: fix for Plan 9 buildLucio De Re2011-07-152-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6a/a.h: . Dropped <u.h> and <libc.h>. . Made definition of EOF conditional. 6a/a.y: . Added <u.h> and <libc.h>. 6a/lex.c: . Added <u.h> and <libc.h>. . Dropped <ctype.h> (now in <u.h>). 6c/gc.h: . Added varargck pragma for "lD". 6c/swt.c: . Dropped unused "thestring" argument in Bprint() calls. 6l/Makefile: . Dropped unneeded directory prefix. 6l/l.h: . Dropped unneeded directory prefix. . Added varargck pragma for "I" and "i". 6l/obj.c: . Dropped unneeded assignment. . Dropped unreachable goto statement. 6l/pass.c: . Dropped assignments flagged as unused. 6l/prof.c: . Replaced "#if 0" with "#ifdef NOTDEF". 6l/span.c: . Dropped unused incrementation. . Added USED() as required. . Dropped unreachable "return" statement. R=golang-dev CC=golang-dev, rsc http://codereview.appspot.com/4747044 Committer: Russ Cox <rsc@golang.org>
* 5c, 6c: fix buildRuss Cox2011-07-011-0/+1
| | | | | | R=ken2 CC=golang-dev http://codereview.appspot.com/4668049
* cc: nit: silence comment warningsDave Cheney2011-06-191-1/+1
| | | | | | | | R=golang-dev, r, r CC=golang-dev http://codereview.appspot.com/4648043 Committer: Rob Pike <r@golang.org>
* build: use gcc -WerrorRuss Cox2011-04-132-4/+6
| | | | | | | | Better to fix the warnings that we find. R=iant CC=golang-dev http://codereview.appspot.com/4406042
* gc, ld: detect stale or incompatible object filesRuss Cox2011-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The object files begin with a header that is $GOARCH on a line by itself. This CL changes that header to go object $GOOS $GOARCH release.2011-01-01 4567+ where the final two fields are the most recent release tag and the current hg version number. All objects imported into a Go compilation or linked into an executable must have the same header line, and that header line must match the compiler and linker versions. The effect of this will be that if you update and run all.bash and then try to link in objects compiled with an earlier version of the compiler (or invoke the wrong version of the compiler), you will get an error showing the different headers instead of perhaps silent incompatibility. Normal usage with all.bash should be unaffected, because all.bash deletes all the object files in $GOROOT/pkg/$GOOS_$GOARCH and cleans all intermediate object files before starting. This change is intended to diagnose stale objects arising when users maintaining alternate installation directories forget to rebuild some of their files after updating. It should help make the adoption of $GOPATH (CL 3780043) less error-prone. R=ken2, r CC=golang-dev http://codereview.appspot.com/4023063
* gc: align structs according to max alignment of fieldsRuss Cox2010-12-133-17/+24
| | | | | | | | | | | | | cc: same runtime: test cc alignment (required moving #define of offsetof to runtime.h) fix bug260 Fixes issue 482. Fixes issue 609. R=ken2, r CC=golang-dev http://codereview.appspot.com/3563042
* 6c: automatically #define _64BIT.Ian Lance Taylor2010-11-181-0/+1
| | | | | | | | | | This makes it much easier to use a tool like Swig which needs to run either 8c or 6c on generated code which #include's "runtime.h". R=ken2, rsc CC=golang-dev http://codereview.appspot.com/3205041
* various: avoid %ld etcRuss Cox2010-10-134-10/+10
| | | | | | | | | | | | | | | 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 http://codereview.appspot.com/2491041
* 6c, 8c: show line numbers in -S outputRuss Cox2010-09-101-7/+8
| | | | | | R=ken2 CC=golang-dev http://codereview.appspot.com/2107047
* build: $GOBIN defaults to $GOROOT/binRuss Cox2010-08-241-15/+6
| | | | | | R=r CC=golang-dev http://codereview.appspot.com/1982049
* amd64: use segment memory for thread-local storageRuss Cox2010-08-044-7/+17
| | | | | | | | | | | | | Returns R14 and R15 to the available register pool. Plays more nicely with ELF ABI C code. In particular, our signal handlers will no longer crash when a signal arrives during execution of a cgo C call. Fixes issue 720. R=ken2, r CC=golang-dev http://codereview.appspot.com/1847051
* fix spelling of alignRob Pike2010-03-261-1/+1
| | | | | | R=rsc CC=golang-dev http://codereview.appspot.com/778041
* Add support for #pragma dynexport.Ian Lance Taylor2010-03-231-2/+5
| | | | | | R=rsc CC=golang-dev http://codereview.appspot.com/661043
* Rename dynld to dynimport throughout.Ian Lance Taylor2010-03-221-4/+4
| | | | | | | | Cgo users will need to rerun cgo. R=rsc CC=golang-dev http://codereview.appspot.com/692041