Commit Graph

20693 Commits

Author SHA1 Message Date
Palmer Cox
ee3f75366c Sha2: Re-write the Sha2 compression functions to improve performance.
The Sha2 compression functions were re-written to execute the message
scheduling calculations in the same loop as the rest of the compression
function. The compiler is able to generate much better code. Additionally,
innermost part of the compression functions were turned into macros to
reduce code duplicate and to make the functions more concise.
2013-08-02 18:49:00 -04:00
Palmer Cox
654c536fec Sha2: Create cryptoutil.rs and re-write the Sha2 module to make use of it.
There are 2 main pieces of functionality in cryptoutil.rs:
* A set of unsafe function for efficiently reading and writing u32 and u64
  values. All of these functions are fairly easy to audit to confirm that
  they do what they are supposed to.
* A FixedBuffer struct. This struct keeps track of input data until there
  is enough of it to execute the a function on it which expects a fixed
  block of data.

The Sha2 module was rewritten to take advantage of the new functions in
cryptoutil as well as FixedBuffer. The result is that the duplicate code
for maintaining a buffer of input data is removed from the Sha512 and
Sha256 implementation. Additionally, the FixedBuffer code is much more
efficient than the previous code was.
2013-08-02 18:48:14 -04:00
Palmer Cox
3cac62822e Sha2: Remove the result_X() methods; move logic into the Digest impls.
The result_X() methods just calculate an output of a fixed size. They don't
really have much to do with running the actually hash algorithm until the very
last step - the output. It makes much more sense to put all this logic into
the Digest impls for each specific variation on the hash function.
2013-08-02 18:46:11 -04:00
Palmer Cox
5b01555155 Sha2: Rearrage traits / impls / structs.
The code was arranged so that the core Sha2 code came first, and then
all of the various implementation of Digest followed along later. The
problem is that the Sha512 compression function code is far away from
the Sha512 Digest implementation, so, if you are trying to read over
the code, you need to scroll all around the file for no good reason. The
code was rearranged so that all of the Sha512 code is in one place and
all of the Sha256 code is in another and so that all impls for a struct
are near the definition of that struct.
2013-08-02 18:46:11 -04:00
Palmer Cox
a1bbd18dc1 Sha2: Remove unecessary integer type specifications. 2013-08-02 18:46:11 -04:00
bors
f1c1f92d0c auto merge of #8221 : brson/rust/single-threaded, r=graydon
This is the last major runtime feature needed for the transition to the new scheduler.
2013-08-02 10:52:50 -07:00
bors
fc571820d1 auto merge of #8202 : pnkfelix/rust/fsk-issue8056-make-crates-must-dep-on-subcrates, r=graydon
Reorder TEST_HOST_CRATES in hopes of exposing future instances of this bug.

Fix #8056
2013-08-02 09:13:53 -07:00
bors
986df44753 auto merge of #8195 : bblum/rust/task-cleanup, r=brson
In the first commit it is obvious why some of the barriers can be changed to ```Relaxed```, but it is not as obvious for the once I changed in ```kill.rs```. The rationale for those is documented as part of the documenting commit.

Also the last commit is a temporary hack to prevent kill signals from being received in taskgroup cleanup code, which could be fixed in a more principled way once the old runtime is gone.
2013-08-02 07:31:52 -07:00
bors
af97339771 auto merge of #8193 : cmr/rust/linux-errno, r=graydon 2013-08-02 05:49:53 -07:00
bors
2460170e6a auto merge of #8188 : huonw/rust/cfg-macro, r=pcwalton
Example:

    if cfg!(test) {
       calculation_to_run_only_when_testing();
    }

Closes #8130.
2013-08-02 03:52:51 -07:00
bors
dbde42e59e auto merge of #8175 : brson/rust/nodbg, r=graydon
This stuff is ancient, unused, and tied to oldsched
2013-08-02 01:13:51 -07:00
Brian Anderson
c3fa411459 std: Implement SingleThreaded spawn mode for newsched 2013-08-02 00:26:45 -07:00
bors
bbcce8d95c auto merge of #8216 : thestinger/rust/range, r=huonw 2013-08-01 22:10:45 -07:00
Daniel Micay
234acad404 replace range with an external iterator 2013-08-02 00:51:14 -04:00
bors
ecefeb03cc auto merge of #8185 : alexcrichton/rust/issue-8179, r=pcwalton
* All globals marked as `pub` won't have the `internal` linkage type set
* All global references across crates are forced to use the address of the
  global in the other crate via an external reference.

r? @graydon

Closes #8179
2013-08-01 19:46:47 -07:00
bors
5890fcf872 auto merge of #8116 : toddaaro/rust/tls-tk-pr-pre, r=brson
Merged with task killing code this time around.
2013-08-01 18:01:42 -07:00
toddaaro
ce761f4980 xfailed the myserious failing test 2013-08-01 17:23:55 -07:00
bors
d346f1a40e auto merge of #8172 : brson/rust/nomorestack, r=pcwalton
The new scheduler does not yet implement split stacks
2013-08-01 16:19:37 -07:00
Felix S. Klock II
3e5b058521 Make crate tests depend on their extern crates. Reorder TEST_HOST_CRATES in hopes of exposing future instances of this bug. 2013-08-02 01:11:24 +02:00
toddaaro
8e98eabce5 modified local to include an implementation for try_unsafe_borrow::<Task> so that the log methods will work 2013-08-01 15:38:48 -07:00
toddaaro
1d82fe5aea fixed incorrect handling of returned scheduler option and restructed scheduler functions slightly 2013-08-01 15:18:29 -07:00
toddaaro
a5f55b3ead minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer inside the task struct, and also added an assert to verify that send is never called inside scheduler context as it is undefined (BROKEN) if that happens 2013-08-01 15:17:19 -07:00
toddaaro
997719c13d Fixed a race where a scheduler configured to only run tasks pinned to it would "bounch" a regular task in and out of the work queue without allowing a different scheduler to run it. 2013-08-01 15:16:01 -07:00
Ben Blum
37f385e44b Have linked failure tests run on the new scheduler instead of requiring RUST_NEWRT to test. 2013-08-01 15:16:01 -07:00
toddaaro
f7eed22387 A major refactoring that changes the way the runtime uses TLS. In the
old design the TLS held the scheduler struct, and the scheduler struct
held the active task. This posed all sorts of weird problems due to
how we wanted to use the contents of TLS. The cleaner approach is to
leave the active task in TLS and have the task hold the scheduler. To
make this work out the scheduler has to run inside a regular task, and
then once that is the case the context switching code is massively
simplified, as instead of three possible paths there is only one. The
logical flow is also easier to follow, as the scheduler struct acts
somewhat like a "token" indicating what is active.

These changes also necessitated changing a large number of runtime
tests, and rewriting most of the runtime testing helpers.

Polish level is "low", as I will very soon start on more scheduler
changes that will require wiping the polish off. That being said there
should be sufficient comments around anything complex to make this
entirely respectable as a standalone commit.
2013-08-01 15:14:00 -07:00
bors
eb5743bfb2 auto merge of #8170 : brson/rust/nopipes, r=pcwalton
The pipes compiler produced data types that encoded efficient and safe
bounded message passing protocols between two endpoints. It was also
capable of producing unbounded protocols.

It was useful research but was arguably done before its proper time.

I am removing it for the following reasons:

* In practice we used it only for producing the `oneshot` protcol  and
  the unbounded `stream` protocol and all communication in Rust use those.
* The interface between the proto! macro and the standard library
  has a large surface area and was difficult to maintain through
  language and library changes.
* It is now written in an old dialect of Rust and generates code
  which would likely be considered non-idiomatic.
* Both the compiler and the runtime are difficult to understand,
  and likewise the relationship between the generated code and
  the library is hard to understand. Debugging is difficult.
* The new scheduler implements `stream` and `oneshot` by hand
  in a way that will be significantly easier to maintain.

This shouldn't be taken as an indication that 'channel protocols'
for Rust are not worth pursuing again in the future.

Concerned parties may include: @graydon, @pcwalton, @eholk, @bblum

The most likely candidates for closing are #7666, #3018, #3020, #7021, #7667, #7303, #3658, #3295.
2013-08-01 14:37:31 -07:00
Ben Blum
963d37e821 Temporary workaround to prevent taskgroup cleanup code from failing without an exception handler. 2013-08-01 17:07:31 -04:00
Ben Blum
aeaed77301 Make a forgotten assert in comm be cfg(test)-dependent 2013-08-01 16:52:37 -04:00
Ben Blum
036a6d2f00 Document task killing design and relaxed barrier rationale. 2013-08-01 16:52:37 -04:00
Ben Blum
880246618b Relax some atomic barriers. Loosen up all that tension. There, doesn't that feel good? 2013-08-01 16:52:37 -04:00
bors
82b24559e6 auto merge of #8190 : thestinger/rust/for, r=thestinger 2013-08-01 12:52:29 -07:00
Corey Richardson
2b026718c3 Add a boatload of Linux x86/x86-64/arm errnos 2013-08-01 15:37:01 -04:00
Daniel Micay
94f1a5d6f8 migrate to foreach 2013-08-01 15:28:45 -04:00
Brian Anderson
4b3e766ac6 Remove the pipes compiler
The pipes compiler produced data types that encoded efficient and safe
bounded message passing protocols between two endpoints. It was also
capable of producing unbounded protocols.

It was useful research but was arguably done before its proper time.

I am removing it for the following reasons:

* In practice we used it only for producing the `oneshot` and `stream`
  unbounded protocols and all communication in Rust use those.
* The interface between the proto! macro and the standard library
  has a large surface area and was difficult to maintain through
  language and library changes.
* It is now written in an old dialect of Rust and generates code
  which would likely be considered non-idiomatic.
* Both the compiler and the runtime are difficult to understand,
  and likewise the relationship between the generated code and
  the library is hard to understand. Debugging is difficult.
* The new scheduler implements `stream` and `oneshot` by hand
  in a way that will be significantly easier to maintain.

This shouldn't be taken as an indication that 'channel protocols'
for Rust are not worth pursuing again in the future.
2013-08-01 12:17:32 -07:00
Huon Wilson
7c21ccc483 rustc: add a lint for for, suggesting foreach or do.
This is just to aid the transistion to the new `for` loop, by
pointing at each location where the old one occurs.
2013-08-01 15:07:19 -04:00
bors
479809a267 auto merge of #8166 : emillon/rust/clean-tests-mk, r=brson
Hello,

While looking at `tests.mk` I noticed two errors:

  - there's a `srcrustllvm` instead of `src/rustllvm`
  - some filtered out files don't exist anymore

These two commits fix these issues. Thanks!
2013-08-01 11:10:35 -07:00
bors
7daea7c9c1 auto merge of #8165 : graydon/rust/2013-07-31-new-codegen-tests, r=brson
r? @pcwalton or someone
2013-08-01 09:28:36 -07:00
blake2-ppc
78cde5b9fb std: Change Times trait to use do instead of for
Change the former repetition::

    for 5.times { }

to::

    do 5.times { }

.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
2013-08-01 16:54:22 +02:00
blake2-ppc
7e210a8129 std: Replace for with do { .. } expr in std::gc
Change all users of old-style for with internal iterators to using
`do`-loops.

The code in stackwalk.rs does not actually implement the
looping protocol (no break on return false).

The code in gc.rs does not use loop breaks, nor does any code using it.

We remove the capacity to break from the loops in std::gc and implement
the walks using `do { .. }` expressions.

No behavior change.
2013-08-01 16:54:22 +02:00
blake2-ppc
e5a64f2add std: Remove the internal iterator methods from trait Set
.intersection(), .union() etc methods in trait std::container::Set use
internal iters. Remove these methods from the trait.

I reported issue #8154 for the reinstatement of iterator-based set algebra
methods to the Set trait.

For bitv and treemap, that lack Iterator implementations of set
operations, preserve them as methods directly on the types themselves.

For HashSet, these methods are replaced by the present .union_iter()
etc.
2013-08-01 16:54:22 +02:00
blake2-ppc
310e0b6e92 extra: Use external iterators in bitv implementation
Convert some internally used functions to use a external iterators.

Change all uses of remaining internal iterators to use `do` expr
2013-08-01 16:54:22 +02:00
blake2-ppc
dbcb74e247 extra: Replace for with do { .. } expr where internal iterators are used 2013-08-01 16:54:22 +02:00
blake2-ppc
b18bd785ec std: Replace for with do { .. } expr where internal iterators are used 2013-08-01 16:54:22 +02:00
blake2-ppc
02bdf90cf6 extra: Use do instead of for in extra::iter 2013-08-01 16:54:22 +02:00
blake2-ppc
6d7a0c8cbc std: Use do blocks instead of for with .iter_bytes() 2013-08-01 16:54:22 +02:00
bors
fe28ac6891 auto merge of #8164 : brson/rust/noportset, r=pcwalton
...haredChan.
2013-08-01 07:46:38 -07:00
Huon Wilson
e995d9935b syntax: implement cfg!() which evaluates to true/false where #[cfg] would keep/remove.
Example:

   if cfg!(test) {
      calculation_to_run_only_when_testing();
   }
2013-08-01 23:03:03 +10:00
bors
18d124b9b5 auto merge of #8158 : bblum/rust/task-cleanup, r=brson
r? @brson
2013-08-01 06:01:39 -07:00
bors
9824d90ffd auto merge of #8155 : stepancheg/rust/unit-zero, r=alexcrichton 2013-08-01 04:19:35 -07:00
bors
5c6069c7a9 auto merge of #8184 : thestinger/rust/retreat, r=huonw 2013-08-01 02:37:36 -07:00