Skip to content

Commit 3db4dab

Browse files
committed
---
yaml --- r: 59101 b: refs/heads/incoming c: 2a9a4a8 h: refs/heads/master i: 59099: f3b1b17 v: v3
1 parent 0e3977b commit 3db4dab

File tree

13 files changed

+53
-198
lines changed

13 files changed

+53
-198
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: a9f21326062b0b455aebd2459e8406b03a048a26
9+
refs/heads/incoming: 2a9a4a81e15fbd8146ce8fe5842c46ad615cbcf6
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/driver/driver.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[no_core];
12-
extern mod core(vers = "0.7-pre");
13-
1411
#[cfg(rustpkg)]
1512
extern mod this(name = "rustpkg", vers = "0.7-pre");
1613

branches/incoming/src/libcore/unstable/intrinsics.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ pub extern "rust-intrinsic" {
1919
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
2020
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
2121
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
22-
23-
#[cfg(not(stage0))]
24-
pub fn atomic_load(src: &int) -> int;
25-
#[cfg(not(stage0))]
26-
pub fn atomic_load_acq(src: &int) -> int;
27-
28-
#[cfg(not(stage0))]
29-
pub fn atomic_store(dst: &mut int, val: int);
30-
#[cfg(not(stage0))]
31-
pub fn atomic_store_rel(dst: &mut int, val: int);
3222

3323
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
3424
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;

branches/incoming/src/librust/rust.rc

Lines changed: 45 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#[license = "MIT/ASL2"];
2121
#[crate_type = "lib"];
2222

23+
extern mod rustpkg(vers = "0.7-pre");
24+
extern mod rustdoc(vers = "0.7-pre");
25+
extern mod rusti(vers = "0.7-pre");
26+
extern mod rustc(vers = "0.7-pre");
27+
2328
use core::run;
2429

2530
enum ValidUsage {
@@ -36,13 +41,13 @@ impl ValidUsage {
3641
}
3742

3843
enum Action<'self> {
39-
Exec(&'self str),
40-
Call(&'self fn(args: &[~str]) -> ValidUsage)
44+
Call(&'self fn(args: &[~str]) -> ValidUsage),
45+
CallMain(&'static str, &'self fn()),
4146
}
4247

4348
enum UsageSource<'self> {
44-
UsgExec(&'self str),
45-
UsgStr(&'self str)
49+
UsgStr(&'self str),
50+
UsgCall(&'self fn()),
4651
}
4752

4853
struct Command<'self> {
@@ -55,9 +60,9 @@ struct Command<'self> {
5560
static commands: &'static [Command<'static>] = &[
5661
Command{
5762
cmd: "build",
58-
action: Exec("rustc"),
63+
action: CallMain("rustc", rustc::main),
5964
usage_line: "compile rust source files",
60-
usage_full: UsgExec("rustc --help")
65+
usage_full: UsgCall(rustc_help),
6166
},
6267
Command{
6368
cmd: "run",
@@ -81,21 +86,21 @@ static commands: &'static [Command<'static>] = &[
8186
},
8287
Command{
8388
cmd: "doc",
84-
action: Exec("rustdoc"),
89+
action: CallMain("rustdoc", rustdoc::main),
8590
usage_line: "generate documentation from doc comments",
86-
usage_full: UsgExec("rustdoc --help")
91+
usage_full: UsgCall(rustdoc::config::usage),
8792
},
8893
Command{
8994
cmd: "pkg",
90-
action: Exec("rustpkg"),
95+
action: CallMain("rustpkg", rustpkg::main),
9196
usage_line: "download, build, install rust packages",
92-
usage_full: UsgExec("rustpkg --help")
97+
usage_full: UsgCall(rustpkg::usage::general),
9398
},
9499
Command{
95100
cmd: "sketch",
96-
action: Exec("rusti"),
101+
action: CallMain("rusti", rusti::main),
97102
usage_line: "run a rust interpreter",
98-
usage_full: UsgStr("\nUsage:\trusti")
103+
usage_full: UsgStr("\nUsage:\trusti"),
99104
},
100105
Command{
101106
cmd: "help",
@@ -109,6 +114,10 @@ static commands: &'static [Command<'static>] = &[
109114
}
110115
];
111116

117+
fn rustc_help() {
118+
rustc::usage(copy os::args()[0])
119+
}
120+
112121
fn find_cmd(command_string: &str) -> Option<Command> {
113122
do commands.find |command| {
114123
command.cmd == command_string
@@ -120,20 +129,14 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
120129
match find_cmd(command_string) {
121130
Some(command) => {
122131
match command.action {
123-
Exec(s) => io::println(fmt!(
132+
CallMain(prog, _) => io::println(fmt!(
124133
"The %s command is an alias for the %s program.",
125-
command.cmd, s)),
134+
command.cmd, prog)),
126135
_ => ()
127136
}
128137
match command.usage_full {
129-
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
130-
UsgExec(commandline) => {
131-
let mut words = ~[];
132-
for str::each_word(commandline) |word| { words.push(word.to_owned()) }
133-
let words = words;
134-
let (prog, args) = (words.head(), words.tail());
135-
run::run_program(*prog, args);
136-
}
138+
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
139+
UsgCall(f) => f(),
137140
}
138141
Valid
139142
},
@@ -151,50 +154,40 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
151154
match args {
152155
[filename] => {
153156
let test_exec = Path(filename).filestem().unwrap() + "test~";
154-
if run::run_program("rustc", [
155-
~"--test",
156-
filename.to_owned(),
157-
~"-o",
158-
test_exec.to_owned()
159-
]) == 0 {
160-
run::run_program(~"./" + test_exec, []);
161-
}
157+
invoke("rustc", &[~"--test", filename.to_owned(),
158+
~"-o", test_exec.to_owned()], rustc::main);
159+
run::run_program(~"./" + test_exec, []);
162160
Valid
163161
}
164-
_ => Invalid
162+
_ => Invalid
165163
}
166164
}
167165

168166
fn cmd_run(args: &[~str]) -> ValidUsage {
169167
match args {
170168
[filename, ..prog_args] => {
171169
let exec = Path(filename).filestem().unwrap() + "~";
172-
if run::run_program("rustc", [
173-
filename.to_owned(),
174-
~"-o",
175-
exec.to_owned()
176-
]) == 0 {
177-
run::run_program(~"./"+exec, prog_args);
178-
}
170+
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
171+
rustc::main);
172+
run::run_program(~"./"+exec, prog_args);
179173
Valid
180174
}
181-
_ => Invalid
175+
_ => Invalid
182176
}
183177
}
184178

179+
fn invoke(prog: &str, args: &[~str], f: &fn()) {
180+
let mut osargs = ~[prog.to_owned()];
181+
osargs.push_all_move(args.to_owned());
182+
os::set_args(osargs);
183+
f();
184+
}
185+
185186
fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
186187
match command.action {
187188
Call(f) => f(args),
188-
Exec(commandline) => {
189-
let mut words = ~[];
190-
for str::each_word(commandline) |word| { words.push(word.to_owned()) }
191-
let words = words;
192-
let (prog, prog_args) = (words.head(), words.tail());
193-
let exitstatus = run::run_program(
194-
*prog,
195-
vec::append(vec::to_owned(prog_args), args)
196-
);
197-
os::set_exit_status(exitstatus);
189+
CallMain(prog, f) => {
190+
invoke(prog, args, f);
198191
Valid
199192
}
200193
}
@@ -232,11 +225,9 @@ pub fn main() {
232225
let args = os_args.tail();
233226

234227
if !args.is_empty() {
235-
for commands.each |command| {
236-
if command.cmd == *args.head() {
237-
let result = do_command(command, args.tail());
238-
if result.is_valid() { return; }
239-
}
228+
for find_cmd(*args.head()).each |command| {
229+
let result = do_command(command, args.tail());
230+
if result.is_valid() { return; }
240231
}
241232
}
242233

branches/incoming/src/librustc/lib/llvm.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,16 +1339,13 @@ pub mod llvm {
13391339
PointerVal: ValueRef) -> ValueRef;
13401340
#[fast_ffi]
13411341
pub unsafe fn LLVMBuildLoad(B: BuilderRef,
1342-
PointerVal: ValueRef,
1343-
Name: *c_char)
1344-
-> ValueRef;
1345-
1342+
PointerVal: ValueRef,
1343+
Name: *c_char)
1344+
-> ValueRef;
13461345
#[fast_ffi]
13471346
pub unsafe fn LLVMBuildStore(B: BuilderRef,
13481347
Val: ValueRef,
1349-
Ptr: ValueRef)
1350-
-> ValueRef;
1351-
1348+
Ptr: ValueRef) -> ValueRef;
13521349
#[fast_ffi]
13531350
pub unsafe fn LLVMBuildGEP(B: BuilderRef,
13541351
Pointer: ValueRef,
@@ -1564,17 +1561,6 @@ pub mod llvm {
15641561
Name: *c_char) -> ValueRef;
15651562

15661563
/* Atomic Operations */
1567-
pub unsafe fn LLVMBuildAtomicLoad(B: BuilderRef,
1568-
PointerVal: ValueRef,
1569-
Order: AtomicOrdering)
1570-
-> ValueRef;
1571-
1572-
pub unsafe fn LLVMBuildAtomicStore(B: BuilderRef,
1573-
Val: ValueRef,
1574-
Ptr: ValueRef,
1575-
Order: AtomicOrdering)
1576-
-> ValueRef;
1577-
15781564
pub unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef,
15791565
LHS: ValueRef,
15801566
CMP: ValueRef,

branches/incoming/src/librustc/middle/trans/build.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,6 @@ pub fn Load(cx: block, PointerVal: ValueRef) -> ValueRef {
537537
}
538538
}
539539
540-
pub fn AtomicLoad(cx: block, PointerVal: ValueRef, order: AtomicOrdering) -> ValueRef {
541-
unsafe {
542-
let ccx = cx.fcx.ccx;
543-
if cx.unreachable {
544-
let ty = val_ty(PointerVal);
545-
let eltty = if llvm::LLVMGetTypeKind(ty) == lib::llvm::Array {
546-
llvm::LLVMGetElementType(ty) } else { ccx.int_type };
547-
return llvm::LLVMGetUndef(eltty);
548-
}
549-
count_insn(cx, "load.atomic");
550-
return llvm::LLVMBuildAtomicLoad(B(cx), PointerVal, order);
551-
}
552-
}
553-
554-
555540
pub fn LoadRangeAssert(cx: block, PointerVal: ValueRef, lo: c_ulonglong,
556541
hi: c_ulonglong, signed: lib::llvm::Bool) -> ValueRef {
557542
let value = Load(cx, PointerVal);
@@ -582,17 +567,6 @@ pub fn Store(cx: block, Val: ValueRef, Ptr: ValueRef) {
582567
}
583568
}
584569
585-
pub fn AtomicStore(cx: block, Val: ValueRef, Ptr: ValueRef, order: AtomicOrdering) {
586-
unsafe {
587-
if cx.unreachable { return; }
588-
debug!("Store %s -> %s",
589-
val_str(cx.ccx().tn, Val),
590-
val_str(cx.ccx().tn, Ptr));
591-
count_insn(cx, "store.atomic");
592-
llvm::LLVMBuildAtomicStore(B(cx), Val, Ptr, order);
593-
}
594-
}
595-
596570
pub fn GEP(cx: block, Pointer: ValueRef, Indices: &[ValueRef]) -> ValueRef {
597571
unsafe {
598572
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }

branches/incoming/src/librustc/middle/trans/foreign.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -592,30 +592,6 @@ pub fn trans_intrinsic(ccx: @CrateContext,
592592
Release);
593593
Store(bcx, old, fcx.llretptr.get());
594594
}
595-
~"atomic_load" => {
596-
let old = AtomicLoad(bcx,
597-
get_param(decl, first_real_arg),
598-
SequentiallyConsistent);
599-
Store(bcx, old, fcx.llretptr.get());
600-
}
601-
~"atomic_load_acq" => {
602-
let old = AtomicLoad(bcx,
603-
get_param(decl, first_real_arg),
604-
Acquire);
605-
Store(bcx, old, fcx.llretptr.get());
606-
}
607-
~"atomic_store" => {
608-
AtomicStore(bcx,
609-
get_param(decl, first_real_arg + 1u),
610-
get_param(decl, first_real_arg),
611-
SequentiallyConsistent);
612-
}
613-
~"atomic_store_rel" => {
614-
AtomicStore(bcx,
615-
get_param(decl, first_real_arg + 1u),
616-
get_param(decl, first_real_arg),
617-
Release);
618-
}
619595
~"atomic_xchg" => {
620596
let old = AtomicRMW(bcx, Xchg,
621597
get_param(decl, first_real_arg),

branches/incoming/src/librustc/middle/trans/type_use.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
124124
~"get_tydesc" | ~"needs_drop" => use_tydesc,
125125

126126
~"atomic_cxchg" | ~"atomic_cxchg_acq"|
127-
~"atomic_cxchg_rel"| ~"atomic_load" |
128-
~"atomic_load_acq" | ~"atomic_store" |
129-
~"atomic_store_rel"| ~"atomic_xchg" |
127+
~"atomic_cxchg_rel"| ~"atomic_xchg" |
130128
~"atomic_xadd" | ~"atomic_xsub" |
131129
~"atomic_xchg_acq" | ~"atomic_xadd_acq" |
132130
~"atomic_xsub_acq" | ~"atomic_xchg_rel" |

branches/incoming/src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,25 +3486,6 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
34863486
],
34873487
ty::mk_int())
34883488
}
3489-
~"atomic_load" | ~"atomic_load_acq" => {
3490-
(0,
3491-
~[
3492-
arg(ty::mk_imm_rptr(tcx,
3493-
ty::re_bound(ty::br_anon(0)),
3494-
ty::mk_int()))
3495-
],
3496-
ty::mk_int())
3497-
}
3498-
~"atomic_store" | ~"atomic_store_rel" => {
3499-
(0,
3500-
~[
3501-
arg(ty::mk_mut_rptr(tcx,
3502-
ty::re_bound(ty::br_anon(0)),
3503-
ty::mk_int())),
3504-
arg(ty::mk_int())
3505-
],
3506-
ty::mk_nil())
3507-
}
35083489
~"atomic_xchg" | ~"atomic_xadd" | ~"atomic_xsub" |
35093490
~"atomic_xchg_acq" | ~"atomic_xadd_acq" | ~"atomic_xsub_acq" |
35103491
~"atomic_xchg_rel" | ~"atomic_xadd_rel" | ~"atomic_xsub_rel" => {

branches/incoming/src/librustpkg/rustpkg.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ use context::Ctx;
4242

4343
mod conditions;
4444
mod context;
45-
mod usage;
4645
mod path_util;
4746
mod tests;
4847
mod util;
4948
mod workspace;
5049

50+
pub mod usage;
51+
5152
/// A PkgScript represents user-supplied custom logic for
5253
/// special build hooks. This only exists for packages with
5354
/// an explicit package script.

0 commit comments

Comments
 (0)