Commit graph

20259 commits

Author SHA1 Message Date
blake2-ppc
21adfd5645 dlist: Use Ord for .insert_ordered()
We don't need TotalOrd for ordered insertion, just the normal sort order
Ord.
2013-07-21 21:05:48 +02:00
blake2-ppc
b1a071e314 dlist: Remove bench tests for vec
These tests for ~[] performance don't really belong here, they were for
comparison.
2013-07-21 21:05:48 +02:00
blake2-ppc
bfa9b43b71 dlist: Add bench test for rotate_to_{front, back} 2013-07-21 21:05:48 +02:00
blake2-ppc
b71c3d250f dlist: Add .rotate_to_front(), .rotate_to_back()
Add methods to move back element to front or front element to back,
without reallocating nodes.
2013-07-21 19:31:40 +02:00
blake2-ppc
78d0cf1409 dlist: Factor out pop and push operations by list node
Factor out internal methods for pop/push ~Node<T>, This allows moving
nodes instead of destructuring and allocating new.

Make use of this in .merge() so that it requires no allocations when
merging two DList.
2013-07-21 19:31:40 +02:00
blake2-ppc
5336bdcab1 dlist: Simplify match clauses to use Option methods
Make the core Deque implementation a bit simpler by using Option methods
when we simply map on a Some value, and deduplicate some common lines.
2013-07-21 19:31:40 +02:00
blake2-ppc
60cb9c003c serialize: implement Encodable for DList
This impl was missing for unknown reason.
2013-07-21 19:31:40 +02:00
bors
c4b6216943 auto merge of #7913 : brson/rust/rm-install-snap, r=graydon 2013-07-20 23:55:27 -07:00
bors
c325cb0a42 auto merge of #7912 : graydon/rust/extra-new-benchmarks-1, r=catamorphism
This adds new #[bench] benchmarks for extra::smallintmap, treemap, sha1, sha256 and 512, and base64. Also fixes a bunch of warnings in bitv.
2013-07-20 22:10:28 -07:00
bors
d029ebfc5f auto merge of #7902 : huonw/rust/attr++, r=cmr,pcwalton
This does a number of things, but especially dramatically reduce the
number of allocations performed for operations involving attributes/
meta items:

- Converts ast::meta_item & ast::attribute and other associated enums
  to CamelCase.
- Converts several standalone functions in syntax::attr into methods,
  defined on two traits AttrMetaMethods & AttributeMethods. The former
  is common to both MetaItem and Attribute since the latter is a thin
  wrapper around the former.
- Deletes functions that are unnecessary due to iterators.
- Converts other standalone functions to use iterators and the generic
  AttrMetaMethods rather than allocating a lot of new vectors (e.g. the
  old code would have to allocate a new vector to use functions that
  operated on &[meta_item] on &[attribute].)
- Moves the core algorithm of the #[cfg] matching to syntax::attr,
  similar to find_inline_attr and find_linkage_metas.

This doesn't have much of an effect on the speed of #[cfg] stripping,
despite hugely reducing the number of allocations performed; presumably
most of the time is spent in the ast folder rather than doing attribute
checks.

Also fixes the Eq instance of MetaItem_ to correctly ignore spans, so
that `rustc --cfg 'foo(bar)'` now works.
2013-07-20 20:25:31 -07:00
bors
8476419fef auto merge of #7896 : pcwalton/rust/pub-extern, r=pcwalton
r? @nikomatsakis
2013-07-20 18:40:39 -07:00
Patrick Walton
06594ed96b librustc: Remove pub extern and priv extern from the language.
Place `pub` or `priv` on individual items instead.
2013-07-20 17:39:38 -07:00
bors
75b4b1b027 auto merge of #7882 : blake2-ppc/rust/iterator-clone, r=thestinger
Implement method .cycle() that repeats an iterator endlessly

Implement Clone for simple iterators (without closures), including VecIterator.

> The theory is simple, the immutable iterators simply hold state
> variables (indicies or pointers) into frozen containers. We can freely
> clone these iterators, just like we can clone borrowed pointers.
2013-07-20 16:58:30 -07:00
bors
bb8ca1f52c auto merge of #7910 : brson/rust/rm-fixme, r=graydon 2013-07-20 15:16:33 -07:00
bors
c5c0252511 auto merge of #7908 : anasazi/rust/fix_udp_mut, r=brson 2013-07-20 13:31:34 -07:00
blake2-ppc
fe134b9509 dlist: Implement Clone for immutable iterators 2013-07-20 20:30:58 +02:00
blake2-ppc
24b6901b26 std: Implement Clone for VecIterator and iterators using it
The theory is simple, the immutable iterators simply hold state
variables (indicies or pointers) into frozen containers. We can freely
clone these iterators, just like we can clone borrowed pointers.

VecIterator needs a manual impl to handle the lifetime struct member.
2013-07-20 20:30:57 +02:00
blake2-ppc
ffe2623e47 iterator: Add test for .cycle() 2013-07-20 20:24:00 +02:00
blake2-ppc
4623e81aa5 iterator: Let closure-less iterators derive Clone 2013-07-20 20:22:48 +02:00
blake2-ppc
435fcda5e9 iterator: Add .cycle() to repeat an iterator 2013-07-20 20:22:48 +02:00
bors
5c999d4eca auto merge of #7894 : pcwalton/rust/and-pointers-in-at-boxes, r=brson
r? @brson
2013-07-20 10:55:34 -07:00
bors
8aae6edce0 auto merge of #7710 : michaelwoerister/rust/WP4, r=jdm
This pull request includes various improvements:

+ Composite types (structs, tuples, boxes, etc) are now handled more cleanly by debuginfo generation. Most notably, field offsets are now extracted directly from LLVM types, as opposed to trying to reconstruct them. This leads to more stable handling of edge cases (e.g. packed structs or structs implementing drop).

+ `debuginfo.rs` in general has seen a major cleanup. This includes better formatting, more readable variable and function names, removal of dead code, and better factoring of functionality.

+ Handling of `VariantInfo` in `ty.rs` has been improved. That is, the `type VariantInfo = @VariantInfo_` typedef has been replaced with explicit uses of @VariantInfo, and the duplicated logic for creating VariantInfo instances in `ty::enum_variants()` and `typeck::check::mod::check_enum_variants()` has been unified into a single constructor function. Both function now look nicer too :)

+ Debug info generation for enum types is now mostly supported. This includes:
  + Good support for C-style enums. Both DWARF and `gdb` know how to handle them.
  + Proper description of tuple- and struct-style enum variants as unions of structs.
  + Proper handling of univariant enums without discriminator field.
  + Unfortunately `gdb` always prints all possible interpretations of a union, so debug output of enums is verbose and unintuitive. Neither `LLVM` nor `gdb` support DWARF's `DW_TAG_variant` which allows to properly describe tagged unions. Adding support for this to `LLVM` seems doable. `gdb` however is another story. In the future we might be able to use `gdb`'s Python scripting support to alleviate this problem. In agreement with @jdm this is not a high priority for now.

+ The debuginfo test suite has been extended with 14 test files including tests for packed structs (with Drop), boxed structs, boxed vecs, vec slices, c-style enums (standalone and embedded), empty enums, tuple- and struct-style enums, and various pointer types to the above.

~~What is not yet included is DI support for some enum edge-cases represented as described in `trans::adt::NullablePointer`.~~

Cheers,
Michael

PS: closes #7819,  fixes #7712
2013-07-20 09:10:34 -07:00
bors
3a1db2d1e6 auto merge of #7886 : msullivan/rust/default-methods, r=pcwalton
This does a bunch of cleanup on the data structures for the trait system. (Unfortunately it doesn't remove `provided_method_sources`. Maybe later.)

It also changes how cross crate methods are handled, so that information about them is exported in metadata, instead of having the methods regenerated by every crate that imports an impl.

r? @nikomatsakis, maybe?
2013-07-20 07:28:36 -07:00
bors
ec53efa64d auto merge of #7884 : pcwalton/rust/check-loans-and-inside-at, r=graydon
r? @graydon
2013-07-20 05:43:38 -07:00
bors
e3142c5d3e auto merge of #7858 : bblum/rust/kill, r=brson
Some notes about the commits.

Exit code propagation commits:
* ```Reimplement unwrap()``` has the same old code from ```arc::unwrap``` ported to use modern atomic types and finally (it's considerably nicer this way)
* ```Add try_unwrap()``` has some new slightly-tricky (but pretty simple) concurrency primitive code
* ```Add KillHandle``` and ```Add kill::Death``` are the bulk of the logic.

Task killing commits:
* ```Implement KillHandle::kill() and friends```, ```Do a task-killed check```, and ```Add BlockedTask``` implement the killing logic;
* ```Change the HOF context switchers``` turns said logic on

Linked failure commits:
* ```Replace *rust_task ptrs``` adapts the taskgroup code to work for both runtimes
* ```Enable taskgroup code``` does what it says on the tin.

r? @brson
2013-07-20 03:55:39 -07:00
bors
fdbd56ca38 auto merge of #7419 : catamorphism/rust/default-package, r=graydon
r? @brson `rustpkg build`, if executed in a package source directory inside
a workspace, will now build that package. By "inside a workspace"
I mean that the parent directory has to be called `src`, and rustpkg
will create a `build` directory in .. if there isn't already one.

Same goes for `rustpkg install` and `rustpkg clean`.

For the time being, `rustpkg build` (etc.) will still error out if
you run it inside a directory whose parent isn't called `src`.
I'm not sure whether or not it's desirable to have it do something
in a non-workspace directory.
2013-07-20 02:16:41 -07:00
blake2-ppc
980646a450 Use Option .take() or .take_unwrap() instead of util::replace where possible 2013-07-20 05:12:05 -04:00
Ben Blum
621bc79d0d Fix warnings in stdtest and extratest. Maybe somebody will care. 2013-07-20 05:12:05 -04:00
Ben Blum
4bcda7148d Fix warnings in src/test/bench tests. Nobody will ever care. 2013-07-20 05:12:04 -04:00
Ben Blum
7ad7911222 Add watched and indestructible spawn modes. 2013-07-20 05:12:04 -04:00
Ben Blum
2183145850 Rename TCB to Taskgroup 2013-07-20 05:12:04 -04:00
Ben Blum
f3c79c4026 Enable taskgroup code for newsched spawns. 2013-07-20 05:12:03 -04:00
Ben Blum
0e1be5ff9e Fix linked failure tests to block forever instead of looping around yield. 2013-07-20 05:08:58 -04:00
Ben Blum
728edb5af6 (cleanup) impl TaskSet 2013-07-20 05:08:58 -04:00
Ben Blum
6d9184609a (cleanup) Don't check taskgroup generation monotonicity unless cfg(test). 2013-07-20 05:08:58 -04:00
Ben Blum
87bbcb579a (cleanup) Modernize taskgroup code for the new borrow-checker. 2013-07-20 05:08:58 -04:00
Ben Blum
9bbec651df Replace *rust_task ptrs in taskgroup code with TaskHandle, for transitioning to newsched killing. 2013-07-20 05:08:57 -04:00
Ben Blum
e2a42416dd Add option::take(), the building block of the option::take_* family. 2013-07-20 05:08:57 -04:00
Ben Blum
2a7273c71e Stash a spare kill flag inside tasks, to save two atomic xadds in the blocking fastpath. 2013-07-20 05:08:57 -04:00
Ben Blum
e283c4ddff Add tests for task killing and blocking. 2013-07-20 05:08:57 -04:00
Ben Blum
a093b5434a Add test::with_test_task() convenience function. 2013-07-20 05:08:57 -04:00
Ben Blum
9ad1997549 Change the HOF context switchers to pass a BlockedTask instead of a ~Task. 2013-07-20 05:08:57 -04:00
Ben Blum
0101f35f27 Add BlockedTask (wake, try_block, etc) in kill.rs. 2013-07-20 05:08:57 -04:00
Ben Blum
e80efe3fda Do a task-killed check at the start of task 'timeslices'. 2013-07-20 05:08:56 -04:00
Ben Blum
629f6e8d68 Implement KillHandle::kill() and friends (unkillable, atomically). Close #6377. 2013-07-20 05:08:56 -04:00
Ben Blum
2a99320583 Add tests for KillHandle 2013-07-20 05:08:56 -04:00
Ben Blum
afc199bea0 Remove join_latch 2013-07-20 05:08:56 -04:00
Ben Blum
6882508b6f Add kill::Death for task death services and use it in Task. 2013-07-20 05:08:56 -04:00
Ben Blum
52ca256d7b Add KillHandle and implement exit code propagation to replace join_latch 2013-07-20 05:08:56 -04:00
Ben Blum
2a99163f5d Add UnsafeAtomicRcBox::try_unwrap() 2013-07-20 05:08:55 -04:00