# test program
1 package main
2
3 type C chan int
4
5 func F(c C) {
6 c <- true
7 }
# old error
test.go:6: cannot use true (type bool) as type int in function argument
# new error
test.go:6: cannot use true (type bool) as type int in channel send
R=rsc, ejsherry
CC=golang-dev
https://golang.org/cl/3231042
- compare against fsModified to check if index is out of date
- don't change fsModified if there are no user-mapped file systems
R=rsc, iant
CC=golang-dev
https://golang.org/cl/3213041
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
https://golang.org/cl/3205041
This fixes a problem with relativePath, where
a prefix was not recognized because it ended
in "//" as opposed to just "/".
Also: Minor unrelated cleanup of a declaration.
R=rsc
CC=golang-dev
https://golang.org/cl/3146041
This is in preparation for a different position representation.
It also resolves situations where a node would be printed as
it's node position simply because the embedded token.Position
has a String method.
R=r
CC=golang-dev
https://golang.org/cl/2991041
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
Restore ability to have different file and
section alignment in generated pe file.
Stop generating .bss pe section, it is
part of .data now.
Some code refactoring.
R=rsc, vcc
CC=golang-dev
https://golang.org/cl/2731041
Rather than updating the stripped-down regexp implementation embedded
in testing, delete it by passing the one function we need from the package
main file created by gotest.
R=rsc
CC=golang-dev
https://golang.org/cl/2761043
There are other missing conversion cases
still but they do not show up in my tests.
This one is needed for vlrt.c's _v2d (int64, uint64 -> float).
Thankfully, VFP has a single instruction to do this.
R=ken2
CC=golang-dev
https://golang.org/cl/2726041
Sub-symbols are laid out inside a larger symbol
but can be addressed directly.
Use to make Mach-O pointer array not a special case.
Will use later to describe ELF sections.
Glimpses of the beginning of ELF loading.
R=ken2
CC=golang-dev
https://golang.org/cl/2623043
Load the entire archive file instead.
Reduces I/O by avoiding additional passes
through libraries to resolve symbols.
Go packages always need all the files anyway
(most often, all 1 of them).
R=ken2
CC=golang-dev
https://golang.org/cl/2613042
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
The frame that gets allocated is for both
the args and the autos. If together they
exceed the default frame size, we need to
tell morestack about both so that it allocates
a large enough frame.
Sanity check stack pointer in morestack
to catch similar bugs.
R=ken2
CC=golang-dev
https://golang.org/cl/2609041
That is, move the pc/ln table and the symbol table
into the read-only data segment. This eliminates
the need for a special load command to map the
symbol table into memory, which makes the
information available on systems that couldn't handle
the magic load to 0x99000000, like NaCl and ARM QEMU
and Linux without config_highmem=y. It also
eliminates an #ifdef and some clumsy code to
find the symbol table on Windows.
The bad news is that the binary appears to be bigger
than it used to be. This is not actually the case, though:
the same amount of data is being mapped into memory
as before, and the tables are still read-only, so they're
still shared across multiple instances of the binary as
they were before. The difference is just that the tables
aren't squirreled away in some section that "size" doesn't
know to look at.
This is a checkpoint.
It probably breaks Windows and breaks NaCl more
than it used to be broken, but those will be fixed.
The logic involving -s needs to be revisited too.
Fixes#871.
R=ken2
CC=golang-dev
https://golang.org/cl/2587041
No multiple processes/locks, managed to compile
and run a hello.go (with print not fmt). Also test/sieve.go
seems to run until 439 and stops with a
'throw: all goroutines are asleep - deadlock!'
- just like runtime/tiny.
based on Russ's suggestions at:
http://groups.google.com/group/comp.os.plan9/browse_thread/thread/cfda8b82535d2d68/243777a597ec1612
Build instructions:
cd src/pkg/runtime
make clean && GOOS=plan9 make install
this will build and install the runtime.
When linking with 8l, you should pass -s to suppress symbol
generation in the a.out, otherwise the generated executable will not run.
This is runtime only, the porting of the toolchain has already
been done: http://code.google.com/p/go-plan9/source/browse
in the plan9-quanstro branch.
R=rsc
CC=golang-dev
https://golang.org/cl/2273041
Because the SB is only good for 8k and Go programs
tend to have much more data than that, SB doesn't
save very much. A fmt.Printf-based hello world program
has 360 kB text segment. Removing SB makes the text
500 bytes (0.14%) longer.
R=ken2, r2, ken3
CC=golang-dev
https://golang.org/cl/2487042
Also change the span-dependent jump algorithm
to use fewer iterations:
* resolve forward jumps at their targets (comefrom list)
* mark jumps as small or big and only do small->big
* record whether a jump failed to be encodable
These changes mean that a function with only small
jumps can be laid out in a single iteration, and the
vast majority of functions take just two iterations.
I was seeing a maximum of 5 iterations before; the
max now is 3 and there are fewer that get even that far.
R=ken2
CC=golang-dev
https://golang.org/cl/2537041
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
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
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
* 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
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
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
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
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
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
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