The crypto package is added as a common place to store identifiers for
hash functions. At the moment, the rsa package has an enumeration of
hash functions and knowledge of their digest lengths. This is an
unfortunate coupling and other high level crypto packages tend to need
to duplicate this enumeration and knowledge (i.e. openpgp).
crypto pulls this code out into a common location.
It would also make sense to add similar support for ciphers to crypto,
but the problem there isn't as acute that isn't done in this change.
R=bradfitzgo, r, rsc
CC=golang-dev
https://golang.org/cl/4080046
If there were warnings or errors in the user code,
cgo would print the first error from gcc and then stop,
which is not helpful.
This CL makes cgo ignore errors from user code
in the first pass - they will be shown later.
It also prints errors from user preamble code
with the correct line numbers.
(Also fixed misleading usage message).
R=iant, rsc
CC=golang-dev
https://golang.org/cl/4082047
The "all:" target is the default for running gomake
by hand, but it is not used during the build.
The build runs make install and make test.
Save the build of maketables for the test phase
so that the packages it needs will have been
installed already.
R=r, r2
CC=golang-dev
https://golang.org/cl/4121043
- fixed length of amd64 .data pe section
(don't need to include non-initialised data)
- use correct oh/oh64 variable when updating
data directory in addexports
- simplify and cleanup
R=vcc, rsc
CC=golang-dev
https://golang.org/cl/4106044
The sanity checking in pass 2 is wrong
when a select is offering to communicate in
either direction on a channel and neither case
is immediately ready.
R=ken2
CC=golang-dev
https://golang.org/cl/3991047
The old heap maps used a multilevel table, but that
was overkill: there are only 1M entries on a 32-bit
machine and we can arrange to use a dense address
range on a 64-bit machine.
The heap map is in bss. The assumption is that if
we don't touch the pages they won't be mapped in.
Also moved some duplicated memory allocation
code out of the OS-specific files.
R=r
CC=golang-dev
https://golang.org/cl/4118042
- complex numbers now supported.
- entirely independent of standard decode code.
- parser has no read-ahead; that is, the scanning works
simply by reading the values as they arrive, not by trying
to count bytes for message boundaries, a proof of concept
for the pending rewrite of the regular decoder.
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4084044
This bug prevented files such as READMEs etc. from being included in the index.
For instance, now author names recorded in the AUTHORS file can be found with
a godoc query.
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4005047
The linker avoids a GOT indirection by turning a MOV into
a LEA, but with x86-64 GCC has started emitting CMOV*
instructions which break the existing logic.
This will generate errors such as:
unexpected GOT reloc for non-dynamic symbol luaO_nilobject_
The CMOV* instructions may be emitted with normal code like:
if (o >= L->top) return cast(TValue *, luaO_nilobject);
else return o;
Which gets compiled into (relocation offset at 1b):
13: 48 3b 47 10 cmp 0x10(%rdi),%rax
17: 48 0f 43 05 00 00 00 cmovae 0x0(%rip),%rax
1e: 00
This change will allow the indirection through the GOT to
avoid the problem in those cases.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4071044
It is unmaintained and untested, and I think it's broken too.
It was a toy to show that Go can run on real hardware,
and it served its purpose.
The source code will of course remain in the repository
history, so it could be brought back if needed later.
R=r, r2, uriel
CC=golang-dev
https://golang.org/cl/3996047
The implementation of the position computation
was surprisingly broken. Implemented fixes and
added extra test cases.
There is a slight interface change: Calling
Pos() returns the current position; but if
called before Scan() that position may not
be the position of the next token returned
by Scan() (depending on the scan settings
and the source text) - this in contrast to
the original comment.
However, after calling Scan(), the Scanner's
Position field reports the position of the
scanned token, as before.
Fixes#1327.
R=rsc
CC=golang-dev
https://golang.org/cl/3972047
Also simplify sleeper algorithm and poll
occasionally so redundant sleeper goroutines
will quit sooner.
R=r, niemeyer, r2
CC=golang-dev
https://golang.org/cl/4063043
The docstring claims the function uses PSS message encoding,
when the function actually implements PKCS1-v1_5 encoding.
R=agl1, rsc
CC=danderson, golang-dev
https://golang.org/cl/4097042
Init may report an error on the first character and
thus one needs an ability to set the error handler
for Init. Was a design bug.
Added corresponding test cases and better documentation.
Also: Fixed a subtle infinite loop exposed by one of the
new test cases.
Fixes#1380.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4094041
When parsing numbers with an exponent (like "12e-1"), the JSON scanner
would only allow a lowercase 'e', while the RFC also allows the
uppercase 'E'.
R=adg
CC=golang-dev, rsc
https://golang.org/cl/3986042
(or at least a correct encoder, still to come).
Change the debug structure slightly to better represent
the grammar.
Minor tweaks for consistency in type.go.
R=rsc
CC=golang-dev
https://golang.org/cl/4007044
The test code used to do this:
for _, tc := range tests {
ch <- &tc
}
Note that &tc is always the same value here. As the value is
received from the channel, the sender can loop around and
change the contents of tc. This means that the receiver's
value is unstable and can change while it is in use.
R=adg, r2, rsc
CC=chris, golang-dev
https://golang.org/cl/3978043
Close of closed channel panics.
Receive from closed channel never panics,
even if done repeatedly.
Fixes#1349.
Fixes#1419.
R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry
CC=golang-dev
https://golang.org/cl/3989042
Re-implement the debugging helper to be independent of the existing
implementation. This is preparatory to a rewrite to clean up issue 1416.
Include a definition of the grammar of the data stream.
R=rsc
CC=golang-dev
https://golang.org/cl/3970045
This was broken after the last update (2011-01-20).
However, I'm not sure if the changed example is a
sensible use of import(), so I'd appreciate comments.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4067043
The functionality we want (shared ppid) is implied
by CLONE_THREAD already, and CLONE_PARENT
causes problems if the Go program is pid 1 (init).
See issue 1406 for more details.
Fixes#1406.
R=adg, iant
CC=golang-dev
https://golang.org/cl/3971044
The o+i*p approach to visiting select cases in random
order stops being fair when there is some case that
is never ready. If that happens, then the case that follows
it in the order gets more chances than the others.
In general the only way to ensure fairness is to make
all permutations equally likely. I've done that by computing
one explicitly.
Makes the permutations correct for n >= 4 where
previously they were broken. For n > 12, there's not
enough randomness to do a perfect job but this should
still be much better than before.
Fixes#1425.
R=r, ken2, ejsherry
CC=golang-dev
https://golang.org/cl/4037043
- added flag -maxresults (default: 10000) to limit the max.
number of full text results shown
- removed flag -fulltext; use -maxresults=0 to disable fulltext
index
- better indication on result page if not all results are shown
(... after line list)
R=rsc, gri1
CC=golang-dev
https://golang.org/cl/4049042
A query string of the form ident.ident will be used both as a qualified
identifier for identifier search and as a regular expression.
Qualified identifier lookup got broken accidentally when introducing
regexp full text search. Cleaned up surrounding logic a bit.
R=rsc
CC=golang-dev
https://golang.org/cl/3984042
With the current implementation, xml unmarshalling
will silently fail to unmarshal any paths passing
through the same element, such as:
type T struct {
A string "dummy>a"
B string "dummy>b"
}
This change tweaks the algorithm so that this works
correctly.
Also, using paths that would cause the same element to
unmarshal twice will error out ahead of time explaining
the problem, rather than silently misbehaving.
R=rsc
CC=golang-dev
https://golang.org/cl/4082041
When data is received for a channel, but that channel
is not ready to receive it, the central run() loop
is currently blocked, but this can lead to deadlock
and interference between independent channels.
This CL adds an explicit buffer size to netchan
channels (an API change) - the sender will not
send values until the buffer is non empty.
The protocol changes to send ids rather than channel names
because acks can still be sent after a channel is hung up,
we we need an identifier that can be ignored.
R=r, rsc
CC=golang-dev
https://golang.org/cl/2447042
Also:
* document special cases for Frexp and Ldexp
* handle ±Inf in Ldexp
* correctly return -0 on underflow in Ldexp
* test special cases for Ldexp
* test boundary cases for Frexp, Ilogb, Ldexp, and Logb
R=rsc
CC=golang-dev
https://golang.org/cl/3676041
Minor cleanup:
- removed a duplicate test case
- added a function to remove repeated code
- for consistency, replaced "return nil" with a panic at an
unreachable point
Fixes#1428.
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4057042
RFC2616 sections 4.4 and 14.16:
* Cannot use Content-Length with non-identity Transfer-Encoding
* Content-Range response is "bytes x-y/z" not "x-y/z"
R=rsc
CC=golang-dev
https://golang.org/cl/4018041
For Windows, the options for syscall.Wait4() aren't used.
Then this will be dummy value like WNOHANG, WSTOPPED.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4075041
This introduces support for selecting which subelement
to unmarshal into a given struct field by providing a
nesting path separated by the > character.
R=rsc
CC=golang-dev
https://golang.org/cl/4066041
Have to set #defines correctly to get correct value.
Otherwise get a mask for use in implementing WIFSTOPPED(status).
Changed WSTOPPED definition in os because on
OS X WSTOPPED and WUNTRACED have different values
even though they seem to mean the same thing.
Fixes#1374.
R=r, r2
CC=golang-dev
https://golang.org/cl/4063042
The fault was lucky: when it wasn't faulting it was silently
copying a word from some other block and later putting
that same word back. If some other goroutine had changed
that word of memory in the interim, too bad.
The ARM code was inconsistent about whether the
"argument frame" included the saved LR. Including it made
some things more regular but mostly just caused confusion
in the places where the regularity broke. Now the rule
reflects reality: argp is always a pointer to arguments,
never a saved link register.
Renamed struct fields to make meaning clearer.
Running ARM in QEMU, package time's gotest:
* before: 27/58 failed
* after: 0/50
R=r, r2
CC=golang-dev
https://golang.org/cl/3993041
This defines crosscall2 in a way that matches that real
definition, and also defines _cgo_allocate and _cgo_panic to
indicate that they are available to be called by code compiled
with gcc.
R=rsc
CC=golang-dev
https://golang.org/cl/4026041
In this specific package crosscall2 is already defined in a .S
file anyhow. This avoids a warning about mismatched
alignment.
R=rsc
CC=golang-dev
https://golang.org/cl/4000043
Introduced a printer mode (pmode) type and corresponding
pmode values which permit easy toggling of the current
printer mode for fine-tuning of layout.
Use the printer mode to disable potential introduction of
line breaks before a closing '}' in composite literals.
Added extra test case. Applied gofmt to src and misc.
Fixes#1365.
R=r2
CC=golang-dev
https://golang.org/cl/4008041
Until now, each scan of a file added a new file to the file set.
With this change, a file can be re-scanned using the same *token.File
w/o changing the file set. Eventually this will enable the re-use of
cached source code in godoc (for the fulltext index). At the moment,
source files are read over and over again from disk.
This is the first step in that direction.
R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4001041
Also adds some tests for Issue 900 which was the reason
the current URL parsing is broken. (the previous fix
was wrong)
R=rsc, adg, dangabrad, bradfitzwork
CC=golang-dev
https://golang.org/cl/3910042
When searching for regular expressions such as
".", there are many consecutive matches.
In the generated HTML, combine them instead of
generating a new <span> for each adjacent text
segment highlighting a match.
Massively reduces the size of the generated
HTML in those cases.
R=r, rsc
CC=golang-dev
https://golang.org/cl/3971041
This implements the algorithm qsufsort using the sort package
as a sorting primitive. Its worst-case performance is O(N*log(N)), and it
uses only an additional slice of N ints of memory during creation.
Benchmarks (seconds):
old new
10k nulls 149 0.044
1M English corpus 32.0 3.6
R=gri, gri1
CC=golang-dev
https://golang.org/cl/3752044
error is needed by all the OpenPGP packages as they return a shared
family of error types.
armor implements OpenPGP armoring. It's very like PEM except:
a) it includes a CRC24 checksum
b) PEM values are small (a few KB) and so encoding/pem assumes that
they fit in memory. Armored data can be very large and so this
package presents a streaming interface.
R=r, nsz, rsc
CC=golang-dev
https://golang.org/cl/3786043
I missed that environment is used during runtime setup,
well before go init() functions run. Implemented os-dependent
runtime.goenvs functions to allow for different unix, plan9 and
windows versions of environment discovery.
R=rsc, paulzhol
CC=golang-dev
https://golang.org/cl/3787046
In the case where r.Method == "POST", was
calling Printf with an argument but "" format string,
causing a spurious %!EXTRA(...) message.
Also escape string properly in HTML generation.
R=r
CC=golang-dev
https://golang.org/cl/3923043
* Avoid confusion between imported and exported symbols.
* Record number of imported and exported symbols correctly.
* Explictly relocate SMACHOSYM section, since it is not in datap.
R=rsc
CC=golang-dev
https://golang.org/cl/3920042
A few system call numbers on x86 Linux are
defined in terms of a previous definition,
e.g.,
#define __NR_timer_create 259
#define __NR_timer_settime (__NR_timer_create+1)
...
#define __NR_mq_open 277
#define __NR_mq_unlink (__NR_mq_open+1)
This change assumes the numbers are sorted
sequentially in the input file.
R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/3946041
This change prevents enum consts from conflicting with themselves
when loaded twice in different go files.
Fixes#1400.
R=rsc
CC=golang-dev
https://golang.org/cl/3849044
Regular expressions may now be used in conjuction with full text
search. Godoc will show the first 10000 occurences in the source
code and highlight the respective text segments.
- added new flag -testDir to specify a small directory for testing
(fast index creation; default = "")
- use new FormatText function to format text and Go source
code in HTML, supporting multiple kinds of text selections
simulatenously); this replaces the uses of go/printer
Stylers
- for now removed currently unused mechanism for identifier-
specific JS popups (will come back in some form once we
have type or other useful information)
- various typo fixes and minor cleanups throughout
Missing:
- indexing of non-.go files
R=r, r2
CC=golang-dev, rsc
https://golang.org/cl/3699041
The After code is trivially generalisable to provide support
for this, and it is possible to use AfterFunc to do
things that After cannot, such as waiting
for many events at varied times without an overhead
of one goroutine per event.
R=rsc, r
CC=golang-dev
https://golang.org/cl/3905041
- added position information for [ and ] brackets of Index and Slice expression nodes
- removed a TODO in go/printer
R=r, rsc
CC=golang-dev
https://golang.org/cl/3867045
If we don't do this, then when C code calls back to Go code
which panics, we lose space on the scheduler stack. If that
happens a lot, eventually there is no space left on the
scheduler stack.
R=rsc
CC=golang-dev
https://golang.org/cl/3898042
Not absolutely certain it's right to do this, but since there's
no error value coming back, it seems reasonable.
Fixes#1392.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/3896042
A cursory reading of the cgo code suggests this
should be necessary, though I don't have access
to a FreeBSD machine for testing.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/3746047
The old loop was a bit odd; change it to be more regular.
This also enables a diagnostic for Printf("%", 3): %!(NOVERB)
R=rsc, Kyle C
CC=golang-dev
https://golang.org/cl/3749044
- add End() method to all nodes; the text range of a node n is [n.Pos(), n.End())
- various small bug fixes in the process
- fixed several comments
R=r, rsc
CC=golang-dev
https://golang.org/cl/3769042
After a prefix match, the old code advanced the length of the
prefix. This is incorrect since the full match might begin
in the middle of the prefix. (Consider "aaaab+" matching
"aaaaaab").
Fixes#1373
R=rsc
CC=golang-dev
https://golang.org/cl/3795044
The bug was that for an anchored pattern such as ^x, the prefix
scan ignored the anchor, and could scan the whole file if there was
no x present. The fix is to do prefix matching after the anchor;
the cost miniscule; the speedups huge.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/3837042
Implementation uses fast suffixarray lookup to find
initial matches if the regular expression starts with
a suitable prefix without meta characters.
R=r, rsc
CC=golang-dev
https://golang.org/cl/3720042
#pragma dynexport is no longer needed for
this use of cgo, since the gcc and gc code are
now linked together into the same binary.
It may still be necessary later.
On the Mac, you cannot use the GOT to resolve
symbols that exist in the current binary, so 6l and 8l
translate the GOT-loading mov instructions into lea
instructions.
On ELF systems, we could use the GOT for those
symbols, but for consistency 6l and 8l apply the
same translation.
The translation is sketchy in the extreme
(depending on the relocation being in a mov
instruction) but it verifies that the instruction
is a mov before rewriting it to lea.
Also makes typedefs global across files.
Fixes#1335.
Fixes#1345.
R=iant, r
CC=golang-dev
https://golang.org/cl/3650042
The former is a boolean function to test whether a string
contains a regular expression metacharacter; the second
returns the string used to compile the regexp.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/3728041