Skip to content

Commit e943e7d

Browse files
committed
---
yaml --- r: 83185 b: refs/heads/auto c: 0e4d1fc h: refs/heads/master i: 83183: 6ae3eed v: v3
1 parent 0a94b1a commit e943e7d

File tree

15 files changed

+71
-217
lines changed

15 files changed

+71
-217
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 7ab0b0cd41fc4bf567694ebedb2d927da9bf2551
16+
refs/heads/auto: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -839,11 +839,6 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
839839
expr.span,
840840
[]);
841841
}
842-
ast::ExprInlineAsm(ref ia) => {
843-
for &(_, out) in ia.outputs.iter() {
844-
this.check_assignment(out);
845-
}
846-
}
847842
_ => { }
848843
}
849844
}

branches/auto/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -309,23 +309,6 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt,
309309
visit::walk_expr(this, ex, ());
310310
}
311311

312-
ast::ExprInlineAsm(ref ia) => {
313-
for &(_, out) in ia.outputs.iter() {
314-
let out_cmt = this.bccx.cat_expr(out);
315-
match opt_loan_path(out_cmt) {
316-
Some(out_lp) => {
317-
gather_moves::gather_assignment(this.bccx, this.move_data,
318-
ex.id, ex.span,
319-
out_lp, out.id);
320-
}
321-
None => {
322-
// See the comment for ExprAssign.
323-
}
324-
}
325-
}
326-
visit::walk_expr(this, ex, ());
327-
}
328-
329312
_ => {
330313
visit::walk_expr(this, ex, ());
331314
}

branches/auto/src/librustc/middle/liveness.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -1227,15 +1227,12 @@ impl Liveness {
12271227
self.propagate_through_expr(e, succ)
12281228
}
12291229

1230-
ExprInlineAsm(ref ia) => {
1230+
ExprInlineAsm(ref ia) =>{
12311231
let succ = do ia.inputs.rev_iter().fold(succ) |succ, &(_, expr)| {
12321232
self.propagate_through_expr(expr, succ)
12331233
};
12341234
do ia.outputs.rev_iter().fold(succ) |succ, &(_, expr)| {
1235-
// see comment on lvalues in
1236-
// propagate_through_lvalue_components()
1237-
let succ = self.write_lvalue(expr, succ, ACC_WRITE);
1238-
self.propagate_through_lvalue_components(expr, succ)
1235+
self.propagate_through_expr(expr, succ)
12391236
}
12401237
}
12411238

@@ -1481,7 +1478,12 @@ fn check_expr(this: &mut Liveness, expr: @Expr) {
14811478

14821479
// Output operands must be lvalues
14831480
for &(_, out) in ia.outputs.iter() {
1484-
this.check_lvalue(out);
1481+
match out.node {
1482+
ExprAddrOf(_, inner) => {
1483+
this.check_lvalue(inner);
1484+
}
1485+
_ => {}
1486+
}
14851487
this.visit_expr(out, ());
14861488
}
14871489

branches/auto/src/librustc/middle/trans/asm.rs

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ use lib;
1818
use middle::trans::build::*;
1919
use middle::trans::callee;
2020
use middle::trans::common::*;
21-
use middle::trans::expr::*;
22-
use middle::trans::type_of::*;
2321
use middle::ty;
2422

2523
use middle::trans::type_::Type;
@@ -32,15 +30,34 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block {
3230
let mut bcx = bcx;
3331
let mut constraints = ~[];
3432
let mut cleanups = ~[];
35-
let mut output_types = ~[];
33+
let mut aoutputs = ~[];
3634

3735
// Prepare the output operands
3836
let outputs = do ia.outputs.map |&(c, out)| {
3937
constraints.push(c);
4038

41-
let out_datum = unpack_datum!(bcx, trans_to_datum(bcx, out));
42-
output_types.push(type_of(bcx.ccx(), out_datum.ty));
43-
out_datum.val
39+
aoutputs.push(unpack_result!(bcx, {
40+
callee::trans_arg_expr(bcx,
41+
expr_ty(bcx, out),
42+
ty::ByCopy,
43+
out,
44+
&mut cleanups,
45+
callee::DontAutorefArg)
46+
}));
47+
48+
let e = match out.node {
49+
ast::ExprAddrOf(_, e) => e,
50+
_ => fail2!("Expression must be addr of")
51+
};
52+
53+
unpack_result!(bcx, {
54+
callee::trans_arg_expr(bcx,
55+
expr_ty(bcx, e),
56+
ty::ByCopy,
57+
e,
58+
&mut cleanups,
59+
callee::DontAutorefArg)
60+
})
4461

4562
};
4663

@@ -75,7 +92,7 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block {
7592
clobbers = format!("{},{}", ia.clobbers, clobbers);
7693
} else {
7794
clobbers.push_str(ia.clobbers);
78-
}
95+
};
7996

8097
// Add the clobbers to our constraints list
8198
if clobbers.len() != 0 && constraints.len() != 0 {
@@ -90,12 +107,12 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block {
90107
let numOutputs = outputs.len();
91108

92109
// Depending on how many outputs we have, the return type is different
93-
let output_type = if numOutputs == 0 {
110+
let output = if numOutputs == 0 {
94111
Type::void()
95112
} else if numOutputs == 1 {
96-
output_types[0]
113+
val_ty(outputs[0])
97114
} else {
98-
Type::struct_(output_types, false)
115+
Type::struct_(outputs.map(|o| val_ty(*o)), false)
99116
};
100117

101118
let dialect = match ia.dialect {
@@ -105,17 +122,19 @@ pub fn trans_inline_asm(bcx: @mut Block, ia: &ast::inline_asm) -> @mut Block {
105122

106123
let r = do ia.asm.with_c_str |a| {
107124
do constraints.with_c_str |c| {
108-
InlineAsmCall(bcx, a, c, inputs, output_type, ia.volatile, ia.alignstack, dialect)
125+
InlineAsmCall(bcx, a, c, inputs, output, ia.volatile, ia.alignstack, dialect)
109126
}
110127
};
111128

112129
// Again, based on how many outputs we have
113130
if numOutputs == 1 {
114-
Store(bcx, r, outputs[0]);
131+
let op = PointerCast(bcx, aoutputs[0], val_ty(outputs[0]).ptr_to());
132+
Store(bcx, r, op);
115133
} else {
116-
for (i, o) in outputs.iter().enumerate() {
134+
for (i, o) in aoutputs.iter().enumerate() {
117135
let v = ExtractValue(bcx, r, i);
118-
Store(bcx, v, *o);
136+
let op = PointerCast(bcx, *o, val_ty(outputs[i]).ptr_to());
137+
Store(bcx, v, op);
119138
}
120139
}
121140

branches/auto/src/libstd/managed.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ use ptr::to_unsafe_ptr;
1717
pub static RC_MANAGED_UNIQUE : uint = (-2) as uint;
1818
pub static RC_IMMORTAL : uint = 0x77777777;
1919

20+
/// Returns the refcount of a shared box (as just before calling this)
21+
#[inline]
22+
pub fn refcount<T>(t: @T) -> uint {
23+
use unstable::raw::Repr;
24+
unsafe { (*t.repr()).ref_count }
25+
}
26+
2027
/// Determine if two shared boxes point to the same object
2128
#[inline]
2229
pub fn ptr_eq<T>(a: @T, b: @T) -> bool {

branches/auto/src/libstd/sys.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,12 @@
1313
#[allow(missing_doc)];
1414

1515
use c_str::ToCStr;
16-
use cast;
1716
use libc::size_t;
1817
use libc;
1918
use repr;
2019
use rt::task;
2120
use str;
2221

23-
/// Returns the refcount of a shared box (as just before calling this)
24-
#[inline]
25-
pub fn refcount<T>(t: @T) -> uint {
26-
unsafe {
27-
let ref_ptr: *uint = cast::transmute_copy(&t);
28-
*ref_ptr - 1
29-
}
30-
}
31-
3222
pub fn log_str<T>(t: &T) -> ~str {
3323
use rt::io;
3424
use rt::io::Decorator;

branches/auto/src/libsyntax/ext/asm.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,16 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
7575
}
7676

7777
let (constraint, _str_style) = p.parse_str();
78-
79-
if constraint.starts_with("+") {
80-
cx.span_unimpl(*p.last_span,
81-
"'+' (read+write) output operand constraint modifier");
82-
} else if !constraint.starts_with("=") {
83-
cx.span_err(*p.last_span, "output operand constraint lacks '='");
84-
}
85-
8678
p.expect(&token::LPAREN);
8779
let out = p.parse_expr();
8880
p.expect(&token::RPAREN);
8981

82+
let out = @ast::Expr {
83+
id: ast::DUMMY_NODE_ID,
84+
span: out.span,
85+
node: ast::ExprAddrOf(ast::MutMutable, out)
86+
};
87+
9088
outputs.push((constraint, out));
9189
}
9290
}
@@ -100,13 +98,6 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
10098
}
10199

102100
let (constraint, _str_style) = p.parse_str();
103-
104-
if constraint.starts_with("=") {
105-
cx.span_err(*p.last_span, "input operand constraint contains '='");
106-
} else if constraint.starts_with("+") {
107-
cx.span_err(*p.last_span, "input operand constraint contains '+'");
108-
}
109-
110101
p.expect(&token::LPAREN);
111102
let input = p.parse_expr();
112103
p.expect(&token::RPAREN);

branches/auto/src/test/compile-fail/asm-in-bad-modifier.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

branches/auto/src/test/compile-fail/asm-out-assign-imm.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

branches/auto/src/test/compile-fail/asm-out-no-modifier.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

branches/auto/src/test/compile-fail/asm-out-read-uninit.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)