1
0
mirror of https://github.com/golang/go synced 2024-10-04 15:11:20 -06:00
Commit Graph

1815 Commits

Author SHA1 Message Date
Russ Cox
837c204ada 6l, 8l: avoid recursion in asmandsz
The old code said

	if(x) {
		handle a
		return
	}
	aa = *a
	rewrite aa to make x true
	recursivecall(&aa)

The new code says

	params = copy out of a
	if(!x) {
		rewrite params to make x true
	}
	handle params

but it's hard to see that in the Rietveld diffs because
it gets confused by changes in indentation.

Avoiding the recursion makes other changes easier.

R=ken2
CC=golang-dev
https://golang.org/cl/2533041
2010-10-15 13:01:03 -04:00
Russ Cox
be2c2120d0 5l, 6l, 8l: accumulate data image during import
Using explicit relocations internally, we can
represent the data for a particular symbol as
an initialized block of memory instead of a
linked list of ADATA instructions.  The real
goal here is to be able to hand off some of the
relocations to the dynamic linker when interacting
with system libraries, but a pleasant side effect is
that the memory image is much more compact
than the ADATA list, so the linkers use less memory.

R=ken2
CC=golang-dev
https://golang.org/cl/2512041
2010-10-14 23:48:40 -04:00
Ken Thompson
b33f5d537f fix arm bug in reflect.call
R=rsc
CC=golang-dev
https://golang.org/cl/2475042
2010-10-13 13:24:14 -07: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
085be1740a 5l, 6l, 8l: first pass cleanup
* Maintain Sym* list for text with individual
  prog lists instead of using one huge list and
  overloading p->pcond.
* Comment what each file is for.
* Move some output code from span.c to asm.c.
* Move profiling into prof.c, symbol table into symtab.c.
* Move mkfwd to ld/lib.c.
* Throw away dhog dynamic loading code.
* Throw away Alef become.
* Fix printing of WORD instructions in 5l -a.

Goal here is to be able to handle each piece of text or data
as a separate piece, both to make it easier to load the
occasional .o file and also to make it possible to split the
work across multiple threads.

R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/2335043
2010-10-13 15:51:21 -04:00
Russ Cox
d42903119b 5l, 6l, 8l: indent, outdent
This is entirely adding and removing tabs.
It looks weird but will make the diffs for the
next change easier to read.

R=ken2
CC=golang-dev
https://golang.org/cl/2490041
2010-10-13 15:19:53 -04:00
Jim McGrath
8a1b2e59ef 6l: work with OS X nm/otool
6l was skipping emitting the (2 byte) symbol table if there were no imported or exported
symbols. You can't just drop the symbol table entirely - the linker dies if you have
a linkedit section but no table. You can omit the linkedit section or both the linkedit
and the dlyd parts in the right circumstances, but that seems much more risky to me.

R=rsc
CC=golang-dev
https://golang.org/cl/2421042
2010-10-12 16:52:17 -04:00
Rob Pike
12da5a90e0 log: new interface
New logging interface simplifies and generalizes.

1) Loggers now have only one output.
2) log.Stdout, Stderr, Crash and friends are gone.
	Logging is now always to standard error by default.
3) log.Panic* replaces log.Crash*.
4) Exiting and panicking are not part of the logger's state; instead
	the functions Exit* and Panic* simply call Exit or panic after
	printing.
5) There is now one 'standard logger'.  Instead of calling Stderr,
	use Print etc.  There are now triples, by analogy with fmt:
		Print, Println, Printf
	What was log.Stderr is now best represented by log.Println,
	since there are now separate Print and Println functions
	(and methods).
6) New functions SetOutput, SetFlags, and SetPrefix allow global
	editing of the standard logger's properties.   This is new
	functionality. For instance, one can call
		log.SetFlags(log.Lshortfile|log.Ltime|log.Lmicroseconds)
	to get all logging output to show file name, line number, and
	time stamp.

In short, for most purposes
	log.Stderr -> log.Println or log.Print
	log.Stderrf -> log.Printf
	log.Crash -> log.Panicln or log.Panic
	log.Crashf -> log.Panicf
	log.Exit -> log.Exitln or log.Exit
	log.Exitf -> log.Exitf (no change)

This has a slight breakage: since loggers now write only to one
output, existing calls to log.New() need to delete the second argument.
Also, custom loggers with exit or panic properties will need to be
reworked.

All package code updated to new interface.

The test has been reworked somewhat.

The old interface will be removed after the new release.
For now, its elements are marked 'deprecated' in their comments.

Fixes #1184.

R=rsc
CC=golang-dev
https://golang.org/cl/2419042
2010-10-12 12:59:18 -07:00
Russ Cox
054be1b6c3 ld: be less picky about bad line number info
Fixes #1175.

R=lvd
CC=golang-dev
https://golang.org/cl/2439041
2010-10-11 16:21:03 -04:00
Rob Pike
570f59c109 new command gotry.
An exercise in reflection and an unusual tool.

From the usage message:

usage: gotry [packagedirectory] expression ...
Given one expression, gotry attempts to evaluate that expression.
Given multiple expressions, gotry treats them as a list of arguments
and result values and attempts to find a function in the package
that, given the first few expressions as arguments, evaluates to
the remaining expressions as results.  If the first expression has
methods, it will also search for applicable methods.

If there are multiple expressions, a package directory must be
specified. If there is a package argument, the expressions are
evaluated in an environment that includes
	import . "packagedirectory"

Examples:
	gotry 3+4
		# evaluates to 7
	gotry strings '"abc"' '"c"' 7-5
		# finds strings.Index etc.
	gotry regexp 'MustCompile("^[0-9]+")' '"12345"' true
		# finds Regexp.MatchString

R=rsc, PeterGo, r2
CC=golang-dev
https://golang.org/cl/2352043
2010-10-11 12:40:13 -07:00
Jim McGrath
3d0726b04d 6l: correct offset for __nl_symbol_ptr in Mach-O.
Fixes malformed object message from nm etc.
Fixes #1180.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/2390042
2010-10-11 14:45:01 -04:00
Jim McGrath
0f6926474f 6l: fix Mach-O LC_RPATH
Fixes #1177.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/2387042
2010-10-11 14:39:41 -04:00
Russ Cox
1f6f563900 5l, 8l: dregs
R=ken2
CC=golang-dev
https://golang.org/cl/2390041
2010-10-07 07:51:37 -04:00
Russ Cox
53fff1e74d gc: maybe the code is only mostly dead
R=ken2
CC=golang-dev
https://golang.org/cl/2346044
2010-10-07 06:36:39 -04:00
Luuk van Dijk
2ad521c19a [568]a: precise linenumbers for statements.
R=rsc, ken2, r, rsc1
CC=golang-dev
https://golang.org/cl/2297042
2010-10-07 11:13:06 +02:00
Russ Cox
2a7019894a gc: better error for method non-call
was
x.go:7: must call (&b).*Buffer·Write

now
x.go:7: method b.Write is not an expression, must be called

Fixes #1171.

R=ken2
CC=golang-dev
https://golang.org/cl/2384042
2010-10-07 04:42:44 -04:00
Russ Cox
410927d1ad gc: elide dead code
R=ken2
CC=golang-dev
https://golang.org/cl/2365044
2010-10-07 04:42:26 -04:00
Russ Cox
42c26b734c gc: fix error for 1 <- "foo"
was
x.go:4: invalid operation: 1 <- "foo" (send to receive-only type int)

now
x.go:4: invalid operation: 1 <- "foo" (send to non-chan type int)

R=ken2
CC=golang-dev
https://golang.org/cl/2330042
2010-10-07 03:33:42 -04:00
Russ Cox
01385b400d gc: ... bug
Fixes #1165.

R=ken2
CC=golang-dev
https://golang.org/cl/2339042
2010-10-06 11:12:30 -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
30edda690f ld: share asmlc
R=ken2
CC=golang-dev
https://golang.org/cl/2373043
2010-10-06 09:52:54 -04:00
Luuk van Dijk
454f03ff0b 6g: set kind to KindUnsafePointer where appropriate in reflect structures.
R=rsc, ken2, r
CC=golang-dev
https://golang.org/cl/2355043
2010-10-05 21:17:16 +02:00
Russ Cox
a3c682267f gc: various bugs
Fixes #1016.
Fixes #1152.
Fixes #1153.

R=ken2
CC=golang-dev
https://golang.org/cl/2344042
2010-10-03 11:50:44 -04:00
Ken Thompson
57858b70fb code gen error for
lv += f()
fixes asn1 and maybe more

R=rsc
CC=golang-dev
https://golang.org/cl/2341042
2010-09-30 18:02:38 -07:00
Russ Cox
52d619cfdf gc: bug308
confused by using isddd for both ONAME and OCALL

Fixes #1136.

R=ken2
CC=golang-dev
https://golang.org/cl/2314043
2010-09-30 15:05:01 -04:00
Russ Cox
779dfea487 gc: correct buffer size in sprint, add -L to show full paths
R=ken2
CC=golang-dev
https://golang.org/cl/2338041
2010-09-30 15:02:43 -04:00
Russ Cox
bee2d5b0ad gc, spec, tests: no auto-indirect of pointer to interface value
Implies no embedding of pointer to interface value either.

R=gri, iant, ken2, r, r2
CC=golang-dev
https://golang.org/cl/2289041
2010-09-30 14:59:41 -04:00
David Symonds
763cb8ad11 6prof: more accurate usage message.
R=r, r2
CC=golang-dev
https://golang.org/cl/2323042
2010-09-29 20:17:18 -07:00
Russ Cox
e642503d6f 6l, 8l: fix -K implementation
R=ken2
CC=golang-dev
https://golang.org/cl/2313041
2010-09-29 15:10:14 -04:00
Stephen Ma
fd9a5d22c6 http: revised http Handler interface
R=rsc
CC=golang-dev
https://golang.org/cl/1993043
2010-09-29 14:30:12 +10:00
Russ Cox
6a1ea00d59 gotest: leave _testmain.go for "make clean" to clean up
R=r, brainman
CC=golang-dev
https://golang.org/cl/2297041
2010-09-28 22:59:16 -04:00
Ken Thompson
a2d2341e80 arm code gen error in unsign extend
R=rsc
CC=golang-dev
https://golang.org/cl/2295041
2010-09-28 18:12:46 -07:00
Russ Cox
2ccbf83b32 6l, 8l: elfsetstring is only for .shstrtab
Was also recording for .dynstrtab which made the
table run out of space and would have caused confusion
if the ELF code tried to refer to any of the strings.

R=r
CC=golang-dev
https://golang.org/cl/2288041
2010-09-28 15:18:02 -04:00
Russ Cox
00ffd59c1a gc: fix reflect table method receiver
Fixes #451.
Fixes #770.

R=ken2
CC=golang-dev
https://golang.org/cl/2207045
2010-09-28 13:43:50 -04:00
Russ Cox
05cc83bf4e various: appease the ubuntu gcc monster
Silence warnings about not checking
return values from read and write system calls.

R=r, r2
CC=golang-dev
https://golang.org/cl/2258045
2010-09-28 13:00:13 -04:00
Russ Cox
ec13ed1fce gc: insert semicolon at EOF if needed
R=ken2, gri
CC=golang-dev
https://golang.org/cl/2208053
2010-09-28 10:35:02 -04:00
Russ Cox
2d5e732c54 gc: eliminate duplicates in method table
Fixes #906.

R=ken2
CC=golang-dev
https://golang.org/cl/2279042
2010-09-27 14:09:10 -04:00
Russ Cox
7e92e1cbfa gc: fix non-canonical import error message
Fixes #1142.

R=ken2
CC=golang-dev
https://golang.org/cl/2218046
2010-09-27 12:59:26 -04:00
Russ Cox
9b62461a8f gc: allow select case expr = <-c
Fixes #1139.

R=ken2
CC=golang-dev
https://golang.org/cl/2194046
2010-09-27 12:04:21 -04:00
Russ Cox
b1f44a120f gc: improve error message for x \= 0
was
x.go:2: syntax error: unexpected $undefined

now
x.go:2: syntax error: unexpected \

R=ken2
CC=golang-dev
https://golang.org/cl/2267044
2010-09-24 17:09:31 -04:00
Robert Griesemer
daf64bf567 gofmt: don't substitute invalid positions with valid ones in rewrites
Fixes rewrite bug: 'f(x) -> f(0)' where functions "picked up" ... arguments.

R=rsc
CC=golang-dev
https://golang.org/cl/2279041
2010-09-24 12:58:08 -07:00
Russ Cox
1d315a8abd gc: printing of ...
R=ken2
CC=golang-dev
https://golang.org/cl/2218043
2010-09-24 12:29:20 -04:00
Russ Cox
2ee420fa5e ... changes
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/2273042
2010-09-24 11:55:48 -04:00
Russ Cox
75dd8fdb34 gc: ... changes
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/2208047
2010-09-24 11:55:30 -04:00
Russ Cox
a2450c1456 cgo: bug fixes
* Add documentation about array arguments.  Fixes issue 1125.
* Do not interpret x, y := z, w as special errno form.  Fixes issue 952.
* Fix nested Go calls (brainman).  Fixes issue 907.

R=r
CC=golang-dev
https://golang.org/cl/2214044
2010-09-21 22:41:19 -04:00
Robert Griesemer
c20e024df3 godoc: default filter file name should be ""
R=rsc
CC=golang-dev
https://golang.org/cl/2241043
2010-09-20 16:19:17 -07:00
Ken Thompson
103d756663 loader fix
static init redo

R=rsc
CC=golang-dev
https://golang.org/cl/2254041
2010-09-20 14:23:25 -07:00
Luuk van Dijk
eb572e0174 6l/8l: emit DWARF frame info.
R=rsc, ken2, r
CC=golang-dev
https://golang.org/cl/2151044
2010-09-20 18:44:19 +02:00
Russ Cox
af12feb8d5 6l, 8l: clean up ELF code, fix NaCl
R=r
CC=golang-dev
https://golang.org/cl/2221042
2010-09-19 22:10:34 -04:00
Russ Cox
63623ba2d8 5l: avoid fixed buffers in list
R=ken2
CC=golang-dev
https://golang.org/cl/2204045
2010-09-19 19:44:52 -04:00