Skip to content

Commit 7137237

Browse files
committed
---
yaml --- r: 63217 b: refs/heads/snap-stage3 c: d641b0b h: refs/heads/master i: 63215: 9eb6b9d v: v3
1 parent 6cff096 commit 7137237

Some content is hidden

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

86 files changed

+901
-740
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e06579bc0935ed1dcbddef41bc1b6a8850a2059c
4+
refs/heads/snap-stage3: d641b0b575f4de12900a0265e03bc34357b2a77f
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/rust.css

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,81 @@
11
body {
2-
padding: 1em;
3-
margin: 0;
4-
margin-bottom: 4em;
5-
font-family: "Helvetica Neue", Helvetica, sans-serif;
6-
background-color: white;
7-
color: black;
8-
line-height: 1.6em;
9-
}
10-
11-
body {
12-
padding: 1em 6em;
13-
max-width: 60em;
2+
padding: 1em 6em;
3+
margin: 0;
4+
margin-bottom: 4em;
5+
font-family: "Helvetica Neue", Helvetica, sans-serif;
6+
font-size: 12pt;
7+
background-color: white;
8+
color: black;
9+
line-height: 1.6em;
10+
min-width: 45em;
11+
max-width: 60em;
1412
}
1513

1614
h1 {
17-
font-size: 20pt;
18-
margin-top: 2em;
19-
border-bottom: 1px solid silver;
20-
line-height: 1.6em;
15+
font-size: 20pt;
16+
margin-top: 2em;
17+
padding-left: 0.4em;
18+
line-height: 1.6em;
19+
background-color:#FFF2CE;
20+
border-radius: 0.2em;
21+
border: 1px solid rgba(0, 0, 0, 0.15);
2122
}
23+
2224
h2 {
2325
font-size: 15pt;
2426
margin-top: 2em;
27+
padding-left: 0.4em;
28+
background-color:#FFF2CE;
29+
border-radius: 0.4em;
30+
border: 1px solid rgba(0, 0, 0, 0.15);
31+
}
32+
33+
h2 code {
34+
color: #097334;
35+
font-size: 15pt;
36+
}
37+
38+
h3 {
39+
font-size: 13pt;
40+
color: black;
41+
background-color:#D9E7FF;
42+
border-radius: 0.4em;
43+
border: 1px solid rgba(0, 0, 0, 0.15);
44+
padding: 0 0.4em 0 0.4em;
45+
}
46+
47+
h3 code {
48+
color: #541800;
49+
font-size: 13pt;
50+
font-style: italic;
51+
}
52+
53+
h4 {
54+
font-size: 11pt;
55+
margin-top: 0em;
56+
margin-bottom: 0em;
57+
}
58+
59+
code {
60+
font-size: 11pt;
2561
}
26-
h3 { font-size: 13pt; }
2762

2863
pre {
29-
margin: 1.1em 0;
30-
padding: .4em .4em .4em 2em;
31-
font-size: 120%;
64+
margin-left: 1.1em;
65+
padding: .4em .4em .4em .8em;
66+
font-size: 10pt;
67+
background-color: #F5F5F5;
68+
border-radius: 0.5em;
69+
border: 1px solid rgba(0, 0, 0, 0.15);
70+
}
71+
72+
pre.rust {
73+
background-color: #F3F6FF;
3274
}
3375

3476
a, a:visited, a:link {
35-
text-decoration: none;
36-
color: rgb(0, 105, 214);
77+
text-decoration: none;
78+
color: rgb(0, 105, 214);
3779
}
3880

3981
h1 a:link, h1 a:visited, h2 a:link, h2 a:visited,
@@ -106,4 +148,12 @@ td {
106148
/* Adjust list alignment so rustdoc indexes don't align with blockquotes */
107149
div.index ul {
108150
padding-left: 1em;
109-
}
151+
}
152+
153+
ul {
154+
margin-top: 0em
155+
}
156+
157+
div.section.level3 {
158+
margin-left: 1.0em;
159+
}

branches/snap-stage3/src/compiletest/procsrv.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use core::prelude::*;
12-
use core::iterator::IteratorUtil;
1312

1413
use core::os;
1514
use core::run;
@@ -59,7 +58,7 @@ pub fn run(lib_path: &str,
5958
err_fd: None
6059
});
6160

62-
for input.iter().advance |input| {
61+
for input.each |input| {
6362
proc.input().write_str(*input);
6463
}
6564
let output = proc.finish_with_output();

branches/snap-stage3/src/libextra/par.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ pub fn any<A:Copy + Owned>(
139139
fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
140140
let mapped = map_slices(xs, || {
141141
let f = fn_factory();
142-
let result: ~fn(uint, &[A]) -> bool = |_, slice| slice.iter().any_(f);
142+
let result: ~fn(uint, &[A]) -> bool = |_, slice| slice.iter().any(f);
143143
result
144144
});
145-
mapped.iter().any_(|&x| x)
145+
mapped.iter().any(|&x| x)
146146
}

branches/snap-stage3/src/libextra/treemap.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
427427
b = y.next();
428428
}
429429
}
430-
b.iter().advance(|&x| f(x)) && y.advance(f)
430+
return b.each(|&x| f(x)) && y.advance(f);
431431
}
432432

433433
/// Visit the values (in-order) representing the intersection
@@ -485,7 +485,7 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
485485
a = x.next();
486486
}
487487
}
488-
b.iter().advance(|&x| f(x)) && y.advance(f)
488+
return b.each(|&x| f(x)) && y.advance(f);
489489
}
490490
}
491491

@@ -527,14 +527,14 @@ impl<K: TotalOrd, V> TreeNode<K, V> {
527527

528528
fn each<'r, K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>,
529529
f: &fn(&'r K, &'r V) -> bool) -> bool {
530-
node.iter().advance(|x| each(&x.left, f) && f(&x.key, &x.value) &&
531-
each(&x.right, f))
530+
node.each(|x| each(&x.left, f) && f(&x.key, &x.value) &&
531+
each(&x.right, f))
532532
}
533533

534534
fn each_reverse<'r, K: TotalOrd, V>(node: &'r Option<~TreeNode<K, V>>,
535535
f: &fn(&'r K, &'r V) -> bool) -> bool {
536-
node.iter().advance(|x| each_reverse(&x.right, f) && f(&x.key, &x.value) &&
537-
each_reverse(&x.left, f))
536+
node.each(|x| each_reverse(&x.right, f) && f(&x.key, &x.value) &&
537+
each_reverse(&x.left, f))
538538
}
539539

540540
fn mutate_values<'r, K: TotalOrd, V>(node: &'r mut Option<~TreeNode<K, V>>,
@@ -625,7 +625,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
625625
fn heir_swap<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>,
626626
child: &mut Option<~TreeNode<K, V>>) {
627627
// *could* be done without recursion, but it won't borrow check
628-
for child.mut_iter().advance |x| {
628+
for child.each_mut |x| {
629629
if x.right.is_some() {
630630
heir_swap(node, &mut x.right);
631631
} else {
@@ -680,18 +680,18 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
680680
save.level -= 1;
681681

682682
if right_level > save.level {
683-
for save.right.mut_iter().advance |x| { x.level = save.level }
683+
for save.right.each_mut |x| { x.level = save.level }
684684
}
685685

686686
skew(save);
687687

688-
for save.right.mut_iter().advance |right| {
688+
for save.right.each_mut |right| {
689689
skew(right);
690-
for right.right.mut_iter().advance |x| { skew(x) }
690+
for right.right.each_mut |x| { skew(x) }
691691
}
692692

693693
split(save);
694-
for save.right.mut_iter().advance |x| { split(x) }
694+
for save.right.each_mut |x| { split(x) }
695695
}
696696

697697
return ret;
@@ -1111,7 +1111,6 @@ mod test_set {
11111111

11121112
let mut n = 0;
11131113
for m.each |x| {
1114-
println(fmt!("%?", x));
11151114
assert_eq!(*x, n);
11161115
n += 1
11171116
}

branches/snap-stage3/src/librust/rust.rc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ extern mod rusti;
3030
extern mod rustc;
3131

3232
use core::prelude::*;
33-
use core::iterator::IteratorUtil;
3433

3534
use core::io;
3635
use core::os;
@@ -243,8 +242,7 @@ pub fn main() {
243242
let args = os_args.tail();
244243

245244
if !args.is_empty() {
246-
let r = find_cmd(*args.head());
247-
for r.iter().advance |command| {
245+
for find_cmd(*args.head()).each |command| {
248246
let result = do_command(command, args.tail());
249247
match result {
250248
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub mod jit {
103103
use back::link::llvm_err;
104104
use driver::session::Session;
105105
use lib::llvm::llvm;
106-
use lib::llvm::{ModuleRef, PassManagerRef, ContextRef};
106+
use lib::llvm::{ModuleRef, PassManagerRef};
107107
use metadata::cstore;
108108

109109
use core::cast;
@@ -126,7 +126,6 @@ pub mod jit {
126126

127127
pub fn exec(sess: Session,
128128
pm: PassManagerRef,
129-
c: ContextRef,
130129
m: ModuleRef,
131130
opt: c_int,
132131
stacks: bool) {
@@ -155,43 +154,26 @@ pub mod jit {
155154
});
156155
}
157156

158-
// We custom-build a JIT execution engine via some rust wrappers
159-
// first. This wrappers takes ownership of the module passed in.
160-
let ee = llvm::LLVMRustBuildJIT(manager, pm, m, opt, stacks);
161-
if ee.is_null() {
162-
llvm::LLVMContextDispose(c);
163-
llvm_err(sess, ~"Could not create the JIT");
164-
}
157+
// The execute function will return a void pointer
158+
// to the _rust_main function. We can do closure
159+
// magic here to turn it straight into a callable rust
160+
// closure. It will also cleanup the memory manager
161+
// for us.
165162

166-
// Next, we need to get a handle on the _rust_main function by
167-
// looking up it's corresponding ValueRef and then requesting that
168-
// the execution engine compiles the function.
169-
let fun = do str::as_c_str("_rust_main") |entry| {
170-
llvm::LLVMGetNamedFunction(m, entry)
171-
};
172-
if fun.is_null() {
173-
llvm::LLVMDisposeExecutionEngine(ee);
174-
llvm::LLVMContextDispose(c);
175-
llvm_err(sess, ~"Could not find _rust_main in the JIT");
176-
}
163+
let entry = llvm::LLVMRustExecuteJIT(manager,
164+
pm, m, opt, stacks);
177165

178-
// Finally, once we have the pointer to the code, we can do some
179-
// closure magic here to turn it straight into a callable rust
180-
// closure
181-
let code = llvm::LLVMGetPointerToGlobal(ee, fun);
182-
assert!(!code.is_null());
183-
let closure = Closure {
184-
code: code,
185-
env: ptr::null()
186-
};
187-
let func: &fn() = cast::transmute(closure);
188-
func();
189-
190-
// Sadly, there currently is no interface to re-use this execution
191-
// engine, so it's disposed of here along with the context to
192-
// prevent leaks.
193-
llvm::LLVMDisposeExecutionEngine(ee);
194-
llvm::LLVMContextDispose(c);
166+
if ptr::is_null(entry) {
167+
llvm_err(sess, ~"Could not JIT");
168+
} else {
169+
let closure = Closure {
170+
code: entry,
171+
env: ptr::null()
172+
};
173+
let func: &fn() = cast::transmute(closure);
174+
175+
func();
176+
}
195177
}
196178
}
197179
}
@@ -208,7 +190,6 @@ pub mod write {
208190
use driver::session;
209191
use lib::llvm::llvm;
210192
use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data};
211-
use lib::llvm::{False, ContextRef};
212193
use lib;
213194

214195
use back::passes;
@@ -227,7 +208,6 @@ pub mod write {
227208
}
228209

229210
pub fn run_passes(sess: Session,
230-
llcx: ContextRef,
231211
llmod: ModuleRef,
232212
output_type: output_type,
233213
output: &Path) {
@@ -302,7 +282,7 @@ pub mod write {
302282
// JIT execution takes ownership of the module,
303283
// so don't dispose and return.
304284

305-
jit::exec(sess, pm.llpm, llcx, llmod, CodeGenOptLevel, true);
285+
jit::exec(sess, pm.llpm, llmod, CodeGenOptLevel, true);
306286

307287
if sess.time_llvm_passes() {
308288
llvm::LLVMRustPrintPassTimings();
@@ -370,7 +350,6 @@ pub mod write {
370350
// Clean up and return
371351

372352
llvm::LLVMDisposeModule(llmod);
373-
llvm::LLVMContextDispose(llcx);
374353
if sess.time_llvm_passes() {
375354
llvm::LLVMRustPrintPassTimings();
376355
}
@@ -389,7 +368,6 @@ pub mod write {
389368
}
390369

391370
llvm::LLVMDisposeModule(llmod);
392-
llvm::LLVMContextDispose(llcx);
393371
if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); }
394372
}
395373
}

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn compile_rest(sess: Session,
217217

218218
let mut crate = crate_opt.unwrap();
219219

220-
let (llcx, llmod, link_meta) = {
220+
let (llmod, link_meta) = {
221221
crate = time(time_passes, ~"intrinsic injection", ||
222222
front::intrinsic_inject::inject_intrinsic(sess, crate));
223223

@@ -340,14 +340,14 @@ pub fn compile_rest(sess: Session,
340340
let obj_filename = outputs.obj_filename.with_filetype("s");
341341

342342
time(time_passes, ~"LLVM passes", ||
343-
link::write::run_passes(sess, llcx, llmod, output_type,
344-
&obj_filename));
343+
link::write::run_passes(sess, llmod, output_type,
344+
&obj_filename));
345345

346346
link::write::run_ndk(sess, &obj_filename, &outputs.obj_filename);
347347
} else {
348348
time(time_passes, ~"LLVM passes", ||
349-
link::write::run_passes(sess, llcx, llmod, sess.opts.output_type,
350-
&outputs.obj_filename));
349+
link::write::run_passes(sess, llmod, sess.opts.output_type,
350+
&outputs.obj_filename));
351351
}
352352

353353
let stop_after_codegen =

0 commit comments

Comments
 (0)