Skip to content

Commit ffb5c65

Browse files
committed
---
yaml --- r: 54238 b: refs/heads/dist-snap c: 727a565 h: refs/heads/master v: v3
1 parent c720b75 commit ffb5c65

File tree

31 files changed

+265
-361
lines changed

31 files changed

+265
-361
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 58338dd3d00075301ef2d43aeb0998f53776eebe
10+
refs/heads/dist-snap: 727a565f1e65c415b018f26d878a0d3ebdc9e3ea
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ pub trait Shr<RHS,Result> {
7777

7878
#[lang="index"]
7979
pub trait Index<Index,Result> {
80-
fn index(&self, index: Index) -> Result;
80+
fn index(&self, index: &Index) -> Result;
8181
}

branches/dist-snap/src/libcore/rt/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
126126
type Registers = [uint, ..22];
127127

128128
#[cfg(target_arch = "x86_64")]
129-
fn new_regs() -> ~Registers { ~([0, .. 22]) }
129+
fn new_regs() -> ~Registers { ~[0, .. 22] }
130130

131131
#[cfg(target_arch = "x86_64")]
132132
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {

branches/dist-snap/src/librustc/metadata/decoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
630630
let self_ty_kind = string[0];
631631
match self_ty_kind as char {
632632
's' => { return ast::sty_static; }
633-
'r' => { return ast::sty_by_ref; }
634633
'v' => { return ast::sty_value; }
635634
'@' => { return ast::sty_box(get_mutability(string[1])); }
636635
'~' => { return ast::sty_uniq(get_mutability(string[1])); }

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,6 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
410410
sty_static => {
411411
ebml_w.writer.write(&[ 's' as u8 ]);
412412
}
413-
sty_by_ref => {
414-
ebml_w.writer.write(&[ 'r' as u8 ]);
415-
}
416413
sty_value => {
417414
ebml_w.writer.write(&[ 'v' as u8 ]);
418415
}

branches/dist-snap/src/librustc/middle/astencode.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
342342
}
343343
344344
fn decode_ast(par_doc: ebml::Doc) -> ast::inlined_item {
345-
let chi_doc = par_doc[c::tag_tree as uint];
345+
let chi_doc = par_doc.get(c::tag_tree as uint);
346346
let d = &reader::Decoder(chi_doc);
347347
Decodable::decode(d)
348348
}
@@ -1089,9 +1089,9 @@ impl ebml_decoder_decoder_helpers for reader::Decoder {
10891089
fn decode_side_tables(xcx: @ExtendedDecodeContext,
10901090
ast_doc: ebml::Doc) {
10911091
let dcx = xcx.dcx;
1092-
let tbl_doc = ast_doc[c::tag_table as uint];
1092+
let tbl_doc = ast_doc.get(c::tag_table as uint);
10931093
for reader::docs(tbl_doc) |tag, entry_doc| {
1094-
let id0 = entry_doc[c::tag_table_id as uint].as_int();
1094+
let id0 = entry_doc.get(c::tag_table_id as uint).as_int();
10951095
let id = xcx.tr_id(id0);
10961096
10971097
debug!(">> Side table document with tag 0x%x \
@@ -1103,7 +1103,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
11031103
} else if tag == (c::tag_table_moves_map as uint) {
11041104
dcx.maps.moves_map.insert(id);
11051105
} else {
1106-
let val_doc = entry_doc[c::tag_table_val as uint];
1106+
let val_doc = entry_doc.get(c::tag_table_val as uint);
11071107
let val_dsr = &reader::Decoder(val_doc);
11081108
if tag == (c::tag_table_def as uint) {
11091109
let def = decode_def(xcx, val_doc);
@@ -1172,7 +1172,7 @@ fn encode_item_ast(ebml_w: writer::Encoder, item: @ast::item) {
11721172
11731173
#[cfg(test)]
11741174
fn decode_item_ast(par_doc: ebml::Doc) -> @ast::item {
1175-
let chi_doc = par_doc[c::tag_tree as uint];
1175+
let chi_doc = par_doc.get(c::tag_tree as uint);
11761176
let d = &reader::Decoder(chi_doc);
11771177
@Decodable::decode(d)
11781178
}

branches/dist-snap/src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,6 @@ fn req_loans_in_expr(ex: @ast::expr,
180180
}
181181
}
182182

183-
match self.bccx.method_map.find(&ex.id) {
184-
Some(ref method_map_entry) => {
185-
match (*method_map_entry).explicit_self {
186-
ast::sty_by_ref => {
187-
let rcvr_cmt = self.bccx.cat_expr(rcvr);
188-
self.guarantee_valid(rcvr_cmt, m_imm, scope_r);
189-
}
190-
_ => {} // Nothing to do.
191-
}
192-
}
193-
None => {
194-
self.tcx().sess.span_bug(ex.span, ~"no method map entry");
195-
}
196-
}
197-
198183
visit::visit_expr(ex, self, vt);
199184
}
200185

branches/dist-snap/src/librustc/middle/liveness.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,6 @@ fn visit_fn(fk: &visit::fn_kind,
467467
match *fk {
468468
fk_method(_, _, method) => {
469469
match method.self_ty.node {
470-
sty_by_ref => {
471-
fn_maps.add_variable(Arg(method.self_id,
472-
special_idents::self_,
473-
by_ref));
474-
}
475470
sty_value | sty_region(*) | sty_box(_) | sty_uniq(_) => {
476471
fn_maps.add_variable(Arg(method.self_id,
477472
special_idents::self_,

branches/dist-snap/src/librustc/middle/moves.rs

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ pub impl VisitContext {
436436

437437
expr_unary(deref, base) => { // *base
438438
if !self.use_overloaded_operator(
439-
expr, DontDerefArgs, base, [], visitor)
439+
expr, base, [], visitor)
440440
{
441441
// Moving out of *base moves out of base.
442442
self.use_expr(base, comp_mode, visitor);
@@ -450,7 +450,7 @@ pub impl VisitContext {
450450

451451
expr_index(lhs, rhs) => { // lhs[rhs]
452452
if !self.use_overloaded_operator(
453-
expr, DontDerefArgs, lhs, [rhs], visitor)
453+
expr, lhs, [rhs], visitor)
454454
{
455455
self.use_expr(lhs, comp_mode, visitor);
456456
self.consume_expr(rhs, visitor);
@@ -579,15 +579,15 @@ pub impl VisitContext {
579579

580580
expr_unary(_, lhs) => {
581581
if !self.use_overloaded_operator(
582-
expr, DontDerefArgs, lhs, [], visitor)
582+
expr, lhs, [], visitor)
583583
{
584584
self.consume_expr(lhs, visitor);
585585
}
586586
}
587587

588588
expr_binary(_, lhs, rhs) => {
589589
if !self.use_overloaded_operator(
590-
expr, DoDerefArgs, lhs, [rhs], visitor)
590+
expr, lhs, [rhs], visitor)
591591
{
592592
self.consume_expr(lhs, visitor);
593593
self.consume_expr(rhs, visitor);
@@ -659,7 +659,6 @@ pub impl VisitContext {
659659

660660
fn use_overloaded_operator(&self,
661661
expr: @expr,
662-
deref_args: DerefArgs,
663662
receiver_expr: @expr,
664663
arg_exprs: &[@expr],
665664
visitor: vt<VisitContext>) -> bool
@@ -670,21 +669,10 @@ pub impl VisitContext {
670669

671670
self.use_receiver(expr.id, expr.span, receiver_expr, visitor);
672671

673-
// The deref_args stuff should eventually be converted into
674-
// adjustments. Moreover, it should eventually be applied
675-
// consistently to all overloaded operators. But that's not
676-
// how it is today.
677-
match deref_args {
678-
DoDerefArgs => {
679-
// we are always passing in a borrowed pointer,
680-
// so it's always read mode:
681-
for arg_exprs.each |arg_expr| {
682-
self.use_expr(*arg_expr, Read, visitor);
683-
}
684-
}
685-
DontDerefArgs => {
686-
self.use_fn_args(expr.callee_id, arg_exprs, visitor);
687-
}
672+
// for overloaded operatrs, we are always passing in a
673+
// borrowed pointer, so it's always read mode:
674+
for arg_exprs.each |arg_expr| {
675+
self.use_expr(*arg_expr, Read, visitor);
688676
}
689677

690678
return true;
@@ -737,20 +725,7 @@ pub impl VisitContext {
737725
receiver_expr: @expr,
738726
visitor: vt<VisitContext>)
739727
{
740-
let callee_mode = match self.method_map.find(&expr_id) {
741-
Some(ref method_map_entry) => {
742-
match method_map_entry.explicit_self {
743-
sty_by_ref => by_ref,
744-
_ => by_copy
745-
}
746-
}
747-
None => {
748-
self.tcx.sess.span_bug(
749-
span,
750-
~"no method map entry");
751-
}
752-
};
753-
self.use_fn_arg(callee_mode, receiver_expr, visitor);
728+
self.use_fn_arg(by_copy, receiver_expr, visitor);
754729
}
755730

756731
fn use_fn_args(&self,

branches/dist-snap/src/librustc/middle/resolve.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
5050
use syntax::ast::{path, pat_box, pat_lit, pat_range, pat_struct};
5151
use syntax::ast::{pat_tup, pat_uniq, pat_wild, prim_ty, private, provided};
5252
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
53-
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind, sty_by_ref};
53+
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind};
5454
use syntax::ast::{sty_static, subtract, trait_ref, tuple_variant_kind, Ty};
5555
use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i};
5656
use syntax::ast::{ty_i16, ty_i32, ty_i64, ty_i8, ty_int, TyParam, ty_path};
@@ -3792,7 +3792,6 @@ pub impl Resolver {
37923792
// we only have self ty if it is a non static method
37933793
let self_binding = match method.self_ty.node {
37943794
sty_static => { NoSelfBinding }
3795-
sty_by_ref => { HasSelfBinding(method.self_id, true) }
37963795
_ => { HasSelfBinding(method.self_id, false) }
37973796
};
37983797

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
/*!
12+
# Translation of inline assembly.
13+
*/
14+
15+
use core::prelude::*;
16+
17+
use lib;
18+
use middle::trans::build::*;
19+
use middle::trans::callee;
20+
use middle::trans::common::*;
21+
use middle::ty;
22+
23+
use syntax::ast;
24+
use syntax::ast::*;
25+
26+
// Take an inline assembly expression and splat it out via LLVM
27+
pub fn trans_inline_asm(bcx: block, asm: @~str, ins: &[(@~str, @expr)], outs: &[(@~str, @expr)],
28+
clobs: @~str, volatile: bool, alignstack: bool) -> block {
29+
30+
let mut bcx = bcx;
31+
let mut constraints = ~[];
32+
let mut cleanups = ~[];
33+
let mut aoutputs = ~[];
34+
35+
// Prepare the output operands
36+
let outputs = do outs.map |&(c, out)| {
37+
constraints.push(copy *c);
38+
39+
let aoutty = ty::arg {
40+
mode: ast::expl(ast::by_copy),
41+
ty: expr_ty(bcx, out)
42+
};
43+
aoutputs.push(unpack_result!(bcx, {
44+
callee::trans_arg_expr(bcx, aoutty, out, &mut cleanups, None, callee::DontAutorefArg)
45+
}));
46+
47+
let e = match out.node {
48+
ast::expr_addr_of(_, e) => e,
49+
_ => fail!(~"Expression must be addr of")
50+
};
51+
52+
let outty = ty::arg {
53+
mode: ast::expl(ast::by_copy),
54+
ty: expr_ty(bcx, e)
55+
};
56+
57+
unpack_result!(bcx, {
58+
callee::trans_arg_expr(bcx, outty, e, &mut cleanups, None, callee::DontAutorefArg)
59+
})
60+
61+
};
62+
63+
for cleanups.each |c| {
64+
revoke_clean(bcx, *c);
65+
}
66+
cleanups.clear();
67+
68+
// Now the input operands
69+
let inputs = do ins.map |&(c, in)| {
70+
constraints.push(copy *c);
71+
72+
let inty = ty::arg {
73+
mode: ast::expl(ast::by_copy),
74+
ty: expr_ty(bcx, in)
75+
};
76+
77+
unpack_result!(bcx, {
78+
callee::trans_arg_expr(bcx, inty, in, &mut cleanups, None, callee::DontAutorefArg)
79+
})
80+
81+
};
82+
83+
for cleanups.each |c| {
84+
revoke_clean(bcx, *c);
85+
}
86+
87+
let mut constraints = str::connect(constraints, ",");
88+
89+
// Add the clobbers to our constraints list
90+
if *clobs != ~"" && constraints != ~"" {
91+
constraints += ~"," + *clobs;
92+
} else {
93+
constraints += *clobs;
94+
}
95+
96+
debug!("Asm Constraints: %?", constraints);
97+
98+
let numOutputs = outputs.len();
99+
100+
// Depending on how many outputs we have, the return type is different
101+
let output = if numOutputs == 0 {
102+
T_void()
103+
} else if numOutputs == 1 {
104+
val_ty(outputs[0])
105+
} else {
106+
T_struct(outputs.map(|o| val_ty(*o)))
107+
};
108+
109+
let r = do str::as_c_str(*asm) |a| {
110+
do str::as_c_str(constraints) |c| {
111+
// XXX: Allow selection of at&t or intel
112+
InlineAsmCall(bcx, a, c, inputs, output, volatile, alignstack, lib::llvm::AD_ATT)
113+
}
114+
};
115+
116+
// Again, based on how many outputs we have
117+
if numOutputs == 1 {
118+
let op = PointerCast(bcx, aoutputs[0], T_ptr(val_ty(outputs[0])));
119+
Store(bcx, r, op);
120+
} else {
121+
for aoutputs.eachi |i, o| {
122+
let v = ExtractValue(bcx, r, i);
123+
let op = PointerCast(bcx, *o, T_ptr(val_ty(outputs[i])));
124+
Store(bcx, v, op);
125+
}
126+
}
127+
128+
return bcx;
129+
130+
}

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,9 +2540,8 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::node_id) -> ValueRef {
25402540
}
25412541
}
25422542
2543-
ref variant => {
2544-
ccx.sess.bug(fmt!("get_item_val(): unexpected variant: %?",
2545-
variant))
2543+
_ => {
2544+
ccx.sess.bug(~"get_item_val(): unexpected variant")
25462545
}
25472546
};
25482547
if !(exprt || ccx.reachable.contains(&id)) {
@@ -3086,7 +3085,6 @@ pub fn trans_crate(sess: session::Session,
30863085
const_cstr_cache: @mut LinearMap::new(),
30873086
const_globals: @mut LinearMap::new(),
30883087
const_values: @mut LinearMap::new(),
3089-
extern_const_values: @mut LinearMap::new(),
30903088
module_data: @mut LinearMap::new(),
30913089
lltypes: @mut LinearMap::new(),
30923090
llsizingtypes: @mut LinearMap::new(),

branches/dist-snap/src/librustc/middle/trans/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ pub struct CrateContext {
201201

202202
// Cache of emitted const values
203203
const_values: @mut LinearMap<ast::node_id, ValueRef>,
204-
205-
// Cache of external const values
206-
extern_const_values: @mut LinearMap<ast::def_id, ValueRef>,
207-
208204
module_data: @mut LinearMap<~str, ValueRef>,
209205
lltypes: @mut LinearMap<ty::t, TypeRef>,
210206
llsizingtypes: @mut LinearMap<ty::t, TypeRef>,

0 commit comments

Comments
 (0)