Commit Graph

19966 Commits

Author SHA1 Message Date
bors
5cc4e5145d auto merge of #7730 : chris-morgan/rust/bitv-eq_vec-bool, r=cmr
Fixes #7711.
2013-07-12 11:37:35 -07:00
bors
4e1292ad6b auto merge of #7728 : bcully/rust/largestack64, r=cmr
Just to get the ball rolling, this patch sets stacks to 4 MB on >32-bit architectures.
2013-07-12 09:40:36 -07:00
bors
96b3163c83 auto merge of #7717 : dotdash/rust/transmute, r=pcwalton
Currently, immediate values are copied into an alloca only to have an
addressable storage so that it can be used with memcpy. Obviously we
can skip the memcpy in this case.
2013-07-12 07:43:38 -07:00
Chris Morgan
5b656cfbcb Replace owned with borrowed pointer.
As pointed out by cmr, there's no need for it to be owned there.
That was also in the original scope of #7711.
2013-07-12 23:17:59 +10:00
bors
ad708139fe auto merge of #7706 : sanxiyn/rust/qualification-lint, r=pcwalton
Fix #2551.

Lint is off by default because I didn't bother to fix all of std and extra.
2013-07-12 05:46:42 -07:00
bors
f67935257b auto merge of #7696 : glinscott/rust/utf8_perf, r=cmr
Moves multibyte code to it's own function to make char_range_at
easier to inline, and faster for single and multibyte chars.

Benchmarked reading example.json 100 times, 1.18s before, 1.08s
after.

Also, optimize str::is_utf8 for the single and multibyte case
Before:
is_utf8_ascii:          272.355162 ms
is_utf8_multibyte:      167.337334 ms

After:
is_utf8_ascii:          218.088049 ms
is_utf8_multibyte:      134.836722 ms
2013-07-12 03:46:41 -07:00
bors
d56c9762a3 auto merge of #7705 : sanxiyn/rust/simd-op, r=cmr
Fix #3499.

This is the other half of #5841 that was left out when I revised it to #6214.
2013-07-12 01:49:45 -07:00
bors
09394774df auto merge of #7695 : cmr/rust/assert_eq_msg, r=pnkfelix
This changes it from 

```
left: true does not equal right: false
```

to

```
assertion failed: `(left == right) && (right == left)` (left: `true`, right: `false`)
```
2013-07-11 23:43:45 -07:00
Daniel Micay
cc4baac891 Merge pull request #7679 from alexcrichton/consume-smallintmap
Add a `consume` method to SmallIntMap
2013-07-11 23:40:51 -07:00
bors
07183ea6e7 auto merge of #7677 : alexcrichton/rust/tls-gc, r=pcwalton
cc #6004 and #3273

This is a rewrite of TLS to get towards not requiring `@` when using task local storage. Most of the rewrite is straightforward, although there are two caveats:

1. Changing `local_set` to not require `@` is blocked on #7673
2. The code in `local_pop` is some of the most unsafe code I've written. A second set of eyes should definitely scrutinize it...

The public-facing interface currently hasn't changed, although it will have to change because `local_data::get` cannot return `Option<T>`, nor can it return `Option<&T>` (the lifetime isn't known). This will have to be changed to be given a closure which yield `&T` (or as an Option). I didn't do this part of the api rewrite in this pull request as I figured that it could wait until when `@` is fully removed.

This also doesn't deal with the issue of using something other than functions as keys, but I'm looking into using static slices (as mentioned in the issues).
2013-07-11 19:52:37 -07:00
Alex Crichton
0af64ae315 Add a consume method to SmallIntMap 2013-07-11 19:20:46 -07:00
Alex Crichton
a15c1b4464 Fix tests 2013-07-11 18:57:19 -07:00
bors
9a9c84fb83 auto merge of #7688 : nikomatsakis/rust/issue-6298-dataflow-graph, r=graydon
This patch is a step towards #6298. It extracts the graph abstraction from region inference into a library, and then ports the region inference to use it. It also adds a control-flow graph abstraction that will eventually be used by dataflow. The CFG code is not yet used, but I figured better to add it so as to make later rebasing etc easier.
2013-07-11 17:52:40 -07:00
Chris Morgan
b8e95c4602 Make Bitv::eq_vec take ~[bool] rather than ~[uint]
Fixes #7711.
2013-07-12 09:52:49 +10:00
bors
4478ded57c auto merge of #7623 : graydon/rust/codegen-compiletests, r=pcwalton
This is some initial sketch-work for #7461 though it will depend on #7459 to be useful for anything. For the time being, just infrastructure.
2013-07-11 15:55:45 -07:00
Brendan Cully
7910c72de5 Enable large stacks on 64-bit architectures 2013-07-11 15:40:16 -07:00
Graydon Hoare
bbdbd3c69d extra: add explicit ratchet-noise-percent option to benchmark ratchet, plus a few test breaking fixes. 2013-07-11 15:16:11 -07:00
bors
f92b75ac06 auto merge of #7707 : thestinger/rust/double, r=cmr
00da76d r=cmr
6e75f2d r=cmr

This implements the trait for vector iterators, replacing the reverse
iterator types. The methods will stay, for implementing the future
reverse Iterable traits and convenience.

This can also be trivially implemented for circular buffers and other
variants of arrays like strings.

The `DoubleEndedIterator` trait will allow for implementing algorithms
like in-place reverse on generic mutable iterators.

The naming (`Range` vs. `Iterator`, `Bidirectional` vs. `DoubleEnded`)
can be bikeshedded in the future.
2013-07-11 13:28:38 -07:00
Graydon Hoare
83fb3d224a extra: add metrics ratchet to test driver. 2013-07-11 13:15:52 -07:00
Graydon Hoare
8614d1694c extra: factor ConsoleTestState methods into an impl, fix perf bug.
It was re-reading terminfo on each line of output.
2013-07-11 13:15:52 -07:00
Graydon Hoare
bf1f69c156 extra: add ToJson for TreeMap. 2013-07-11 13:15:52 -07:00
Graydon Hoare
9e67bc37ff extra: simplify the bench stat loop, improve stability somewhat (?) 2013-07-11 13:15:52 -07:00
Graydon Hoare
fbc5bb4c0a wire up makefile to run codegen tests and add one to start 2013-07-11 13:15:52 -07:00
Graydon Hoare
e14cd392a4 initial sketch of codegen mode for compiletest; doesn't measure / compare / ratchet the disassembly yet 2013-07-11 13:15:52 -07:00
Niko Matsakis
3b911816ec Silence various warnings 2013-07-11 15:21:29 -04:00
Gary Linscott
8926b31088 Add is_utf8 bench tests
Before:
is_utf8_ascii:          272.355162 ms
is_utf8_multibyte:      167.337334 ms

After:
is_utf8_ascii:          218.088049 ms
is_utf8_multibyte:      134.836722 ms
2013-07-11 15:02:12 -04:00
Chris Morgan
6e75f2de9c Fix Vim indentation for inline closures. 2013-07-11 14:38:32 -04:00
Chris Morgan
1d08ceb043 Fix comment indenting properly for Vim files.
Indentation now works correctly on subsequent lines of a multi-line
comment, whether there are leaders (` * `) or not. (Formerly it was
incorrectly doing a two-space indent if there was no leader.)

By default, this no longer puts a ` * ` leader on `/*!` comments, as
that appears to be the current convention in the Rust source code, but
that can easily be re-enabled if desired:

    let g:rust_bang_comment_leader = 1
2013-07-11 14:38:24 -04:00
Niko Matsakis
86b6e6e2f5 Add simple control-flow-graph abstraction based on graph, currently unused 2013-07-11 14:37:45 -04:00
Niko Matsakis
a2fbe4d09a Construct the graph only when it is needed to report errors. 2013-07-11 14:37:45 -04:00
Niko Matsakis
e706590e70 Port region inference code to use new graph 2013-07-11 14:37:45 -04:00
Niko Matsakis
7429e7a114 rustc: Add new graph library, based on code from region_infernece 2013-07-11 14:37:45 -04:00
bors
9fce8c918a auto merge of #7652 : blake2-ppc/rust/dlist, r=huonw
This is a new doubly-linked list using owned nodes. In the forward direction, the list is linked with owned pointers, and the backwards direction is linked with &'static Node pointers.

This intends to replace the previous extra::DList that was using managed nodes and also featured freestanding nodes.  The new List does not give access to the nodes, but means to implement all relevant linked-list methods.
 
The list supports pop_back, push_back, pop_front, push_front, front, back, iter, mut_iter, +more iterators,  append, insert_ordered, and merge.

* Add a trait Deque for double ended sequences.

* Both List and Deque implement this trait. Rename Deque to ArrayDeque.

*The text has been updated to summarize resolved items*

## RFC Topics

### Resolved

* Should be in extra
* Representation for the backlinks

### Container Method Names and Trait Names and Type Names

* Location and name of trait `extra::collection::Deque`?
* Name of the ring buffer `extra::deque::ArrayDeque` ?
* Name of the doubly linked list `extra::dlist::List` ?

For container methods I think we have two options:

* Align with the existing methods on the vector. That would be `.push()`, `.pop()`, `.shift()`, `.unshift()`.
* Use the API described in https://github.com/mozilla/rust/wiki/Containers   Obviously that's the way List is written right now.

Should we use `pop_front() -> Option<T>` or `pop_front() -> T` ?

### Benchmarks

Some basic bench numbers for List vs. Vec, Deque and *old DList*

This List implementation's performance is dominated by the allocation of Nodes required when pushing. 

Iterate (by-ref) collection of 128 elements

    test test_bench::bench_iter ... bench: 198 ns/iter (+/- 0)
    test test_bench::bench_iter_mut ... bench: 294 ns/iter (+/- 0)
    test test_bench::bench_iter_rev ... bench: 198 ns/iter (+/- 0)
    test test_bench::bench_iter_mut_rev ... bench: 198 ns/iter (+/- 3)

    test test_bench::bench_iter_vec ... bench: 101 ns/iter (+/- 0)
    test test_bench::bench_iter_deque ... bench: 581 ns/iter (+/- 0)
    test test_bench::bench_iter_dlist ... bench: 9262 ns/iter (+/- 273)

Sequence of `.push(elt)`, `.pop()` or equivalent at the tail end

    test test_bench::bench_push_back_pop_back ... bench: 72 ns/iter (+/- 0)

    test test_bench::bench_push_back_pop_back_vec ... bench: 5 ns/iter (+/- 0)
    test test_bench::bench_push_back_pop_back_deque ... bench: 15 ns/iter (+/- 0)
    test test_bench::bench_push_back_pop_back_dlist ... bench: 234 ns/iter (+/- 0)
2013-07-11 11:31:41 -07:00
Gary Linscott
5aee5a11e3 Optimize is_utf8
Manually unroll the multibyte loops, and optimize for the single
byte chars.
2013-07-11 14:23:15 -04:00
Gary Linscott
179637304a char_range_at perf work
Moves multibyte code to it's own function to make char_range_at
easier to inline, and faster for single and multibyte chars.

Benchmarked reading example.json 100 times, 1.18s before, 1.08s
after.
2013-07-11 14:23:14 -04:00
Björn Steinbrink
7e97277289 transmute: Avoid double copy for immediate values
Currently, immediate values are copied into an alloca only to have an
addressable storage so that it can be used with memcpy. Obviously we
can skip the memcpy in this case.
2013-07-11 18:46:05 +02:00
bors
278ed50e0a auto merge of #7455 : nikomatsakis/rust/issue-7336-constrain-closure-lifetimes, r=pnkfelix
Constrain maximum lifetime of stack closures that capture variables to be limited by the innermost repeating scope.

Fixes #7336.

r? whomever.
2013-07-11 09:34:40 -07:00
bors
e95fcfafc7 auto merge of #7632 : gavinb/rust/7484_manpages, r=cmr
This patch updates the existing manpage and creates new pages for all of the rust command line tools. Closes #7484.
2013-07-11 07:37:36 -07:00
blake2-ppc
0f9b9a5fb7 extra: Mention extra::container::Deque trait in doc for RingBuf and DList 2013-07-11 16:17:51 +02:00
blake2-ppc
b2b88b326d dlist: Name the type DList for doubly-linked list 2013-07-11 15:54:35 +02:00
blake2-ppc
a8e7bdd142 dlist: Fix license header 2013-07-11 15:54:35 +02:00
blake2-ppc
24d2d7b5bb dlist: Implement trait Deque 2013-07-11 15:54:35 +02:00
blake2-ppc
7052371e39 extra: Rename deque::Deque to ringbuf::RingBuf and impl trait Deque
Let RingBuf have a logical name for a concrete type, and Deque is
used for the Deque trait (implemented by RingBuf and dlist).
2013-07-11 15:54:35 +02:00
blake2-ppc
6a95e49fc5 extra: Add mod container with trait Deque 2013-07-11 15:54:35 +02:00
blake2-ppc
92842d6516 dlist: Expose ListInsertion trait with insert_before and peek_next
An iterator that allows mutating the list is very useful but needs care
to not be unsound. ListIteration exposes only insert_before (used for
insert_ordered) and peek_next so far.
2013-07-11 15:54:35 +02:00
blake2-ppc
4fa69ab97c dlist: Put all tests into a tests module
The exception is the function check_links which needs access to struct
Node (which is not pub).
2013-07-11 15:54:34 +02:00
blake2-ppc
8d06efb8ea dlist: Collect a common pattern into link_with_prev() 2013-07-11 15:54:34 +02:00
blake2-ppc
7b1c57713d dlist: Introduce a struct Rawlink mimicing Option<T> for a raw pointer
Rawlink<T> holds a *mut T pointer and can convert itself to Option<&mut T>.
The null pointer is of course None.
2013-07-11 15:54:34 +02:00
blake2-ppc
f97e64083b dlist: Implement size_hint properly for all iterators 2013-07-11 15:52:21 +02:00
blake2-ppc
824bb44f92 dlist: A new implementation of an owned doubly-linked list
This is an owned sendable linked list which allows insertion and
deletion at both ends, with fast traversal through iteration, and fast
append/prepend.

It is indended to replace the previous managed DList with exposed list
nodes. It does not match it feature by feature, but DList could grow
more methods if needed.
2013-07-11 15:52:21 +02:00