Skip to content

Commit c32def4

Browse files
committed
---
yaml --- r: 148818 b: refs/heads/try2 c: dab8640 h: refs/heads/master v: v3
1 parent 8b0795f commit c32def4

File tree

222 files changed

+3244
-3678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+3244
-3678
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a72ab2d31c9f2c0d7f19ef70aa8ef3fcfef68175
8+
refs/heads/try2: dab864098a814830dfed4b9ed6887cd2139d4bad
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
7171

7272
Snapshot binaries are currently built and tested on several platforms:
7373

74-
* Windows (7, 8, Server 2008 R2), x86 only
75-
* Linux (2.6.18 or later, various distributions), x86 and x86-64
76-
* OSX 10.7 (Lion) or greater, x86 and x86-64
74+
* Windows (7, Server 2008 R2), x86 only
75+
* Linux (various distributions), x86 and x86-64
76+
* OSX 10.6 ("Snow Leopard") or greater, x86 and x86-64
7777

7878
You may find that other platforms work, but these are our officially
7979
supported build environments that are most likely to work.

branches/try2/doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,7 +3079,7 @@ A value of type `str` is a Unicode string,
30793079
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
30803080
Since `str` is of unknown size, it is not a _first class_ type,
30813081
but can only be instantiated through a pointer type,
3082-
such as `&str` or `~str`.
3082+
such as `&str`, `@str` or `~str`.
30833083

30843084
### Tuple types
30853085

@@ -3115,7 +3115,7 @@ Such a definite-sized vector type is a first-class type, since its size is known
31153115
A vector without such a size is said to be of _indefinite_ size,
31163116
and is therefore not a _first-class_ type.
31173117
An indefinite-size vector can only be instantiated through a pointer type,
3118-
such as `&[T]` or `~[T]`.
3118+
such as `&[T]`, `@[T]` or `~[T]`.
31193119
The kind of a vector type depends on the kind of its element type,
31203120
as with other simple structural types.
31213121

branches/try2/doc/rustdoc.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,9 @@ that one can still write things like `#[deriving(Eq)]`).
139139

140140
~~~
141141
```rust
142-
# /!\ The three following lines are comments, which are usually stripped off by
143-
# the doc-generating tool. In order to display them anyway in this particular
144-
# case, the character following the leading '#' is not a usual space like in
145-
# these first five lines but a non breakable one.
146-
#
147-
# // showing 'fib' in this documentation would just be tedious and detracts from
148-
# // what's actualy being documented.
149-
# fn fib(n: int) { n + 2 }
142+
# // showing 'fib' in this documentation would just be tedious and detracts from
143+
# // what's actualy being documented.
144+
# fn fib(n: int) { n + 2 }
150145
151146
do spawn { fib(200); }
152147
```

branches/try2/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ from the Internet on our supported platforms.
7272

7373
Snapshot binaries are currently built and tested on several platforms:
7474

75-
* Windows (7, 8, Server 2008 R2), x86 only
76-
* Linux (2.6.18 or later, various distributions), x86 and x86-64
77-
* OSX 10.7 (Lion) or greater, x86 and x86-64
75+
* Windows (7, Server 2008 R2), x86 only
76+
* Linux (various distributions), x86 and x86-64
77+
* OSX 10.6 ("Snow Leopard") or greater, x86 and x86-64
7878

7979
You may find that other platforms work, but these are our "tier 1"
8080
supported build environments that are most likely to work.

branches/try2/src/etc/zsh/_rust

Lines changed: 70 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,80 +5,110 @@ local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug
55
typeset -A opt_args
66

77
_rustc_opts_switches=(
8+
--android-cross-path'[The path to the Android NDK]'
9+
--ar'[Program to use for managing archives instead of the default.]'
810
--bin'[Compile an executable crate (default)]'
911
-c'[Compile and assemble, but do not link]'
1012
--cfg'[Configure the compilation environment]'
13+
--crate-id'[Output the crate id and exit]'
14+
--crate-file-name'[Output the file(s) that would be written if compilation continued and exit]'
15+
--crate-name'[Output the crate name and exit]'
16+
--dep-info'[Output dependency info to <filename> after compiling]'
17+
--dylib'[Compile a dynamic library crate]'
1118
--emit-llvm'[Produce an LLVM bitcode file]'
1219
{-h,--help}'[Display this message]'
1320
-L'[Add a directory to the library search path]'
1421
--lib'[Compile a library crate]'
1522
--linker'[Program to use for linking instead of the default.]'
1623
--link-args'[FLAGS is a space-separated list of flags passed to the linker]'
24+
--llvm-args'[A list of arguments to pass to llvm, comma separated]'
1725
--ls'[List the symbols defined by a library crate]'
26+
--no-analysis'[Parse and expand the output, but run no analysis or produce output]'
27+
--no-rpath'[Disables setting the rpath in libs/exes]'
1828
--no-trans'[Run all passes except translation; no output]'
1929
-O'[Equivalent to --opt-level=2]'
2030
-o'[Write output to <filename>]'
2131
--opt-level'[Optimize with possible levels 0-3]'
2232
--out-dir'[Write output to compiler-chosen filename in <dir>]'
2333
--parse-only'[Parse only; do not compile, assemble, or link]'
34+
--passes'[Comma or space separated list of pass names to use]'
2435
--pretty'[Pretty-print the input instead of compiling]'
36+
--rlib'[Compile a rust library crate as an rlib file]'
2537
-S'[Compile only; do not assemble or link]'
2638
--save-temps'[Write intermediate files (.bc, .opt.bc, .o) in addition to normal output]'
39+
--staticlib'[Compile a static library crate]'
2740
--sysroot'[Override the system root]'
2841
--test'[Build a test harness]'
2942
--target'[Target triple cpu-manufacturer-kernel\[-os\] to compile]'
3043
--target-cpu'[Select target processor (llc -mcpu=help for details)]'
3144
--target-feature'[Target specific attributes (llc -mattr=help for details)]'
32-
--android-cross-path'[The path to the Android NDK]'
3345
{-v,--version}'[Print version info and exit]'
3446
)
3547
_rustc_opts_lint=(
36-
'path-statement[path statements with no effect]'
37-
'missing-trait-doc[detects missing documentation for traits]'
38-
'missing-struct-doc[detects missing documentation for structs]'
48+
'attribute-usage[detects bad use of attributes]'
3949
'ctypes[proper use of std::libc types in foreign modules]'
40-
"unused-mut[detect mut variables which don't need to be mutable]"
41-
'unused-imports[imports that are never used]'
42-
'heap-memory[use of any (~ type or @ type) heap memory]'
43-
'default-methods[allow default methods]'
44-
'unused-variable[detect variables which are not used in any way]'
4550
'dead-assignment[detect assignments that will never be read]'
46-
'unrecognized-lint[unrecognized lint attribute]'
47-
'type-limits[comparisons made useless by limits of the types involved]'
48-
'unused-unsafe[unnecessary use of an `unsafe` block]'
49-
'while-true[suggest using loop { } instead of while(true) { }]'
50-
'non-camel-case-types[types, variants and traits should have camel case names]'
51+
'dead-code[detect piece of code that will never be used]'
52+
'default-type-param-usage[prevents explicitly setting a type parameter with a default]'
53+
'deprecated[detects use of #\[deprecated\] items]'
54+
'experimental[detects use of #\[experimental\] items]'
55+
'heap-memory[use of any (~ type or @ type) heap memory]'
5156
'managed-heap-memory[use of managed (@ type) heap memory]'
52-
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
57+
'missing-doc[detects missing documentation for public members]'
58+
'non-camel-case-types[types, variants and traits should have camel case names]'
59+
'non-uppercase-pattern-statics[static constants in match patterns should be all caps]'
60+
'non-uppercase-statics[static constants should have uppercase identifiers]'
5361
'owned-heap-memory[use of owned (~ type) heap memory]'
62+
'path-statement[path statements with no effect]'
63+
'type-limits[comparisons made useless by limits of the types involved]'
64+
'type-overflow[literal out of range for its type]'
65+
'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]'
66+
'unknown-features[unknown features found in crate-level #\[feature\] directives]'
67+
'unnecessary-allocation[detects unnecessary allocations that can be eliminated]'
68+
'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]'
69+
'unnecessary-qualification[detects unnecessarily qualified names]'
70+
'unnecessary-typecast[detects unnecessary type casts, that can be removed]'
71+
'unreachable-code[detects unreachable code]'
72+
'unrecognized-lint[unrecognized lint attribute]'
73+
'unsafe-block[usage of an `unsafe` block]'
74+
'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]'
75+
'unused-imports[imports that are never used]'
76+
'unused-must-use[unused result of an type flagged as #\[must_use\]]'
77+
"unused-mut[detect mut variables which don't need to be mutable]"
78+
'unused-result[unused result of an expression in a statement]'
79+
'unused-unsafe[unnecessary use of an `unsafe` block]'
80+
'unused-variable[detect variables which are not used in any way]'
81+
'warnings[mass-change the level for lints which produce warnings]'
82+
'while-true[suggest using `loop { }` instead of `while true { }`]'
5483
)
5584

5685
_rustc_opts_debug=(
57-
'verbose:in general, enable more debug printouts'
58-
'time-passes:measure time of each rustc pass'
59-
'count-llvm-insns:count where LLVM instrs originate'
60-
'time-llvm-passes:measure time of each LLVM pass'
61-
'trans-stats:gather trans statistics'
62-
'asm-comments:generate comments into the assembly (may change behavior)'
63-
'no-verify:skip LLVM verification'
64-
'trace:emit trace logs'
65-
'coherence:perform coherence checking'
66-
'borrowck-stats:gather borrowck statistics'
67-
"borrowck-note-pure:note where purity is req'd"
68-
"borrowck-note-loan:note where loans are req'd"
69-
'no-landing-pads:omit landing pads for unwinding'
70-
'debug-llvm:enable debug output from LLVM'
71-
'count-type-sizes:count the sizes of aggregate types'
72-
'meta-stats:gather metadata statistics'
73-
'no-opt:do not optimize, even if -O is passed'
74-
'print-link-args:Print the arguments passed to the linker'
75-
'gc:Garbage collect shared data (experimental)'
76-
'jit:Execute using JIT (experimental)'
77-
'extra-debug-info:Extra debugging info (experimental)'
78-
'debug-info:Produce debug info (experimental)'
79-
'static:Use or produce static libraries or binaries (experimental)'
80-
'no-debug-borrows:do not show where borrow checks fail'
81-
'lint-llvm:Run the LLVM lint pass on the pre-optimization IR'
86+
'asm-comments[generate comments into the assembly (may change behavior)]'
87+
'borrowck-stats[gather borrowck statistics]'
88+
'count-llvm-insns[count where LLVM instrs originate]'
89+
'count-type-sizes[count the sizes of aggregate types]'
90+
'debug-info[Produce debug info (experimental)]'
91+
'debug-llvm[enable debug output from LLVM]'
92+
'extra-debug-info[Extra debugging info (experimental)]'
93+
'gc[Garbage collect shared data (experimental)]'
94+
'gen-crate-map[Force generation of a toplevel crate map]'
95+
'lto[Perform LLVM link-time optimizations]'
96+
'meta-stats[gather metadata statistics]'
97+
"no-integrated-as[Use external assembler rather than LLVM's integrated one]"
98+
'no-landing-pads[omit landing pads for unwinding]'
99+
'no-opt[do not optimize, even if -O is passed]'
100+
"no-prepopulate-passes[Don't pre-populate the pass managers with a list of passes, only use the passes from --passes]"
101+
"no-vectorize-loops[Don't run the loop vectorization optimization passes]"
102+
"no-vectorize-slp[Don't run LLVM's SLP vectorization passes]"
103+
'no-verify[skip LLVM verification]'
104+
'prefer-dynamic[Prefer dynamic linking to static linking]'
105+
'print-link-args[Print the arguments passed to the linker]'
106+
'print-llvm-passes[Prints the llvm optimization passes being run]'
107+
'soft-float[Generate software floating point library calls]'
108+
'time-llvm-passes[measure time of each LLVM pass]'
109+
'time-passes[measure time of each rustc pass]'
110+
'trans-stats[gather trans statistics]'
111+
'verbose[in general, enable more debug printouts]'
82112
)
83113

84114
_rustc_opts_fun_lint(){

branches/try2/src/libarena/lib.rs

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,28 @@ extern mod extra;
2727
use extra::list::{List, Cons, Nil};
2828
use extra::list;
2929

30+
use std::at_vec;
3031
use std::cast::{transmute, transmute_mut, transmute_mut_region};
3132
use std::cast;
3233
use std::cell::{Cell, RefCell};
3334
use std::num;
3435
use std::ptr;
35-
use std::kinds::marker;
3636
use std::mem;
37-
use std::rc::Rc;
3837
use std::rt::global_heap;
38+
use std::uint;
3939
use std::unstable::intrinsics::{TyDesc, get_tydesc};
4040
use std::unstable::intrinsics;
4141
use std::util;
42-
use std::vec;
4342

4443
// The way arena uses arrays is really deeply awful. The arrays are
4544
// allocated, and have capacities reserved, but the fill for the array
4645
// will always stay at 0.
4746
#[deriving(Clone)]
4847
struct Chunk {
49-
data: Rc<RefCell<~[u8]>>,
48+
data: RefCell<@[u8]>,
5049
fill: Cell<uint>,
5150
is_pod: Cell<bool>,
5251
}
53-
impl Chunk {
54-
fn capacity(&self) -> uint {
55-
self.data.borrow().borrow().get().capacity()
56-
}
57-
58-
unsafe fn as_ptr(&self) -> *u8 {
59-
self.data.borrow().borrow().get().as_ptr()
60-
}
61-
}
6252

6353
// Arenas are used to quickly allocate objects that share a
6454
// lifetime. The arena uses ~[u8] vectors as a backing store to
@@ -81,14 +71,14 @@ impl Chunk {
8171
// different chunks than objects without destructors. This reduces
8272
// overhead when initializing plain-old-data and means we don't need
8373
// to waste time running the destructors of POD.
74+
#[no_freeze]
8475
pub struct Arena {
8576
// The head is separated out from the list as a unbenchmarked
8677
// microoptimization, to avoid needing to case on the list to
8778
// access the head.
8879
priv head: Chunk,
8980
priv pod_head: Chunk,
9081
priv chunks: RefCell<@List<Chunk>>,
91-
priv no_freeze: marker::NoFreeze,
9282
}
9383

9484
impl Arena {
@@ -101,14 +91,15 @@ impl Arena {
10191
head: chunk(initial_size, false),
10292
pod_head: chunk(initial_size, true),
10393
chunks: RefCell::new(@Nil),
104-
no_freeze: marker::NoFreeze,
10594
}
10695
}
10796
}
10897

10998
fn chunk(size: uint, is_pod: bool) -> Chunk {
99+
let mut v: @[u8] = @[];
100+
unsafe { at_vec::raw::reserve(&mut v, size); }
110101
Chunk {
111-
data: Rc::new(RefCell::new(vec::with_capacity(size))),
102+
data: RefCell::new(unsafe { cast::transmute(v) }),
112103
fill: Cell::new(0u),
113104
is_pod: Cell::new(is_pod),
114105
}
@@ -139,7 +130,10 @@ fn round_up(base: uint, align: uint) -> uint {
139130
// in it.
140131
unsafe fn destroy_chunk(chunk: &Chunk) {
141132
let mut idx = 0;
142-
let buf = chunk.as_ptr();
133+
let buf = {
134+
let data = chunk.data.borrow();
135+
data.get().as_ptr()
136+
};
143137
let fill = chunk.fill.get();
144138

145139
while idx < fill {
@@ -177,16 +171,14 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
177171
}
178172

179173
impl Arena {
180-
fn chunk_size(&self) -> uint {
181-
self.pod_head.capacity()
182-
}
183174
// Functions for the POD part of the arena
184175
fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
185176
// Allocate a new chunk.
186-
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
177+
let chunk_size = at_vec::capacity(self.pod_head.data.get());
178+
let new_min_chunk_size = num::max(n_bytes, chunk_size);
187179
self.chunks.set(@Cons(self.pod_head.clone(), self.chunks.get()));
188180
self.pod_head =
189-
chunk(num::next_power_of_two(new_min_chunk_size + 1u), true);
181+
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), true);
190182

191183
return self.alloc_pod_inner(n_bytes, align);
192184
}
@@ -197,15 +189,15 @@ impl Arena {
197189
let this = transmute_mut_region(self);
198190
let start = round_up(this.pod_head.fill.get(), align);
199191
let end = start + n_bytes;
200-
if end > self.chunk_size() {
192+
if end > at_vec::capacity(this.pod_head.data.get()) {
201193
return this.alloc_pod_grow(n_bytes, align);
202194
}
203195
this.pod_head.fill.set(end);
204196

205197
//debug!("idx = {}, size = {}, align = {}, fill = {}",
206198
// start, n_bytes, align, head.fill.get());
207199

208-
this.pod_head.as_ptr().offset(start as int)
200+
ptr::offset(this.pod_head.data.get().as_ptr(), start as int)
209201
}
210202
}
211203

@@ -224,10 +216,11 @@ impl Arena {
224216
fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
225217
-> (*u8, *u8) {
226218
// Allocate a new chunk.
227-
let new_min_chunk_size = num::max(n_bytes, self.chunk_size());
219+
let chunk_size = at_vec::capacity(self.head.data.get());
220+
let new_min_chunk_size = num::max(n_bytes, chunk_size);
228221
self.chunks.set(@Cons(self.head.clone(), self.chunks.get()));
229222
self.head =
230-
chunk(num::next_power_of_two(new_min_chunk_size + 1u), false);
223+
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), false);
231224

232225
return self.alloc_nonpod_inner(n_bytes, align);
233226
}
@@ -250,7 +243,7 @@ impl Arena {
250243
end = start + n_bytes;
251244
}
252245

253-
if end > self.head.capacity() {
246+
if end > at_vec::capacity(self.head.data.get()) {
254247
return self.alloc_nonpod_grow(n_bytes, align);
255248
}
256249

@@ -260,7 +253,7 @@ impl Arena {
260253
//debug!("idx = {}, size = {}, align = {}, fill = {}",
261254
// start, n_bytes, align, head.fill);
262255

263-
let buf = self.head.as_ptr();
256+
let buf = self.head.data.get().as_ptr();
264257
return (ptr::offset(buf, tydesc_start as int), ptr::offset(buf, start as int));
265258
}
266259
}
@@ -612,3 +605,5 @@ mod test {
612605
})
613606
}
614607
}
608+
609+

0 commit comments

Comments
 (0)