Skip to content

Commit 35eef4a

Browse files
committed
---
yaml --- r: 144907 b: refs/heads/try2 c: 2a0dd97 h: refs/heads/master i: 144905: b4ccd5d 144903: af8ec34 v: v3
1 parent 63afb0a commit 35eef4a

32 files changed

+236
-269
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: d41b5587927da19fbde2cd28e615b3bdb8ad6e01
8+
refs/heads/try2: 2a0dd9767546c3abd43a9f4dedf142959ef7c6b7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ LIBUV_NO_LOAD = run-benchmarks.target.mk run-tests.target.mk \
176176

177177
export PYTHONPATH := $(PYTHONPATH):$$(S)src/gyp/pylib
178178

179-
$$(LIBUV_MAKEFILE_$(1)_$(2)): $$(LIBUV_DEPS)
179+
$$(LIBUV_MAKEFILE_$(1)_$(2)):
180180
(cd $(S)src/libuv/ && \
181181
$$(CFG_PYTHON) ./gyp_uv -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) -D ninja \
182182
-Goutput_dir=$$(@D) --generator-output $$(@D))

branches/try2/src/libextra/num/bigint.rs

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -153,43 +153,6 @@ impl Orderable for BigUint {
153153
}
154154
}
155155

156-
impl BitAnd<BigUint, BigUint> for BigUint {
157-
fn bitand(&self, other: &BigUint) -> BigUint {
158-
let new_len = num::min(self.data.len(), other.data.len());
159-
let anded = do vec::from_fn(new_len) |i| {
160-
// i will never be less than the size of either data vector
161-
let ai = self.data[i];
162-
let bi = other.data[i];
163-
ai & bi
164-
};
165-
return BigUint::new(anded);
166-
}
167-
}
168-
169-
impl BitOr<BigUint, BigUint> for BigUint {
170-
fn bitor(&self, other: &BigUint) -> BigUint {
171-
let new_len = num::max(self.data.len(), other.data.len());
172-
let ored = do vec::from_fn(new_len) |i| {
173-
let ai = if i < self.data.len() { self.data[i] } else { 0 };
174-
let bi = if i < other.data.len() { other.data[i] } else { 0 };
175-
ai | bi
176-
};
177-
return BigUint::new(ored);
178-
}
179-
}
180-
181-
impl BitXor<BigUint, BigUint> for BigUint {
182-
fn bitxor(&self, other: &BigUint) -> BigUint {
183-
let new_len = num::max(self.data.len(), other.data.len());
184-
let xored = do vec::from_fn(new_len) |i| {
185-
let ai = if i < self.data.len() { self.data[i] } else { 0 };
186-
let bi = if i < other.data.len() { other.data[i] } else { 0 };
187-
ai ^ bi
188-
};
189-
return BigUint::new(xored);
190-
}
191-
}
192-
193156
impl Shl<uint, BigUint> for BigUint {
194157
#[inline]
195158
fn shl(&self, rhs: &uint) -> BigUint {
@@ -1203,48 +1166,6 @@ mod biguint_tests {
12031166
}
12041167
}
12051168
1206-
#[test]
1207-
fn test_bitand() {
1208-
fn check(left: ~[BigDigit],
1209-
right: ~[BigDigit],
1210-
expected: ~[BigDigit]) {
1211-
assert_eq!(BigUint::new(left) & BigUint::new(right),
1212-
BigUint::new(expected));
1213-
}
1214-
check(~[], ~[], ~[]);
1215-
check(~[268, 482, 17],
1216-
~[964, 54],
1217-
~[260, 34]);
1218-
}
1219-
1220-
#[test]
1221-
fn test_bitor() {
1222-
fn check(left: ~[BigDigit],
1223-
right: ~[BigDigit],
1224-
expected: ~[BigDigit]) {
1225-
assert_eq!(BigUint::new(left) | BigUint::new(right),
1226-
BigUint::new(expected));
1227-
}
1228-
check(~[], ~[], ~[]);
1229-
check(~[268, 482, 17],
1230-
~[964, 54],
1231-
~[972, 502, 17]);
1232-
}
1233-
1234-
#[test]
1235-
fn test_bitxor() {
1236-
fn check(left: ~[BigDigit],
1237-
right: ~[BigDigit],
1238-
expected: ~[BigDigit]) {
1239-
assert_eq!(BigUint::new(left) ^ BigUint::new(right),
1240-
BigUint::new(expected));
1241-
}
1242-
check(~[], ~[], ~[]);
1243-
check(~[268, 482, 17],
1244-
~[964, 54],
1245-
~[712, 468, 17]);
1246-
}
1247-
12481169
#[test]
12491170
fn test_shl() {
12501171
fn check(s: &str, shift: uint, ans: &str) {

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -873,12 +873,6 @@ pub mod llvm {
873873
pub fn LLVMAddFunctionAttrString(Fn: ValueRef, Name: *c_char);
874874
#[fast_ffi]
875875
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
876-
877-
#[fast_ffi]
878-
pub fn LLVMAddReturnAttribute(Fn: ValueRef, PA: c_uint);
879-
#[fast_ffi]
880-
pub fn LLVMRemoveReturnAttribute(Fn: ValueRef, PA: c_uint);
881-
882876
#[fast_ffi]
883877
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef,
884878
PA: c_ulonglong,

branches/try2/src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ impl CFGBuilder {
389389
self.straightline(expr, pred, [r, l])
390390
}
391391

392+
ast::ExprLog(l, r) |
392393
ast::ExprIndex(_, l, r) |
393394
ast::ExprBinary(_, _, l, r) => { // NB: && and || handled earlier
394395
self.straightline(expr, pred, [l, r])
@@ -404,7 +405,6 @@ impl CFGBuilder {
404405
self.straightline(expr, pred, [e])
405406
}
406407

407-
ast::ExprLogLevel |
408408
ast::ExprMac(*) |
409409
ast::ExprInlineAsm(*) |
410410
ast::ExprSelf |

branches/try2/src/librustc/middle/dataflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,12 +702,12 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
702702
join_bits(&self.dfcx.oper, temp, in_out);
703703
}
704704

705+
ast::ExprLog(l, r) |
705706
ast::ExprIndex(_, l, r) |
706707
ast::ExprBinary(_, _, l, r) => {
707708
self.walk_exprs([l, r], in_out, loop_scopes);
708709
}
709710

710-
ast::ExprLogLevel |
711711
ast::ExprLit(*) |
712712
ast::ExprPath(*) |
713713
ast::ExprSelf => {

branches/try2/src/librustc/middle/lang_items.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub enum LangItem {
5959

6060
StrEqFnLangItem, // 19
6161
UniqStrEqFnLangItem, // 20
62+
LogTypeFnLangItem, // 21
6263
FailFnLangItem, // 22
6364
FailBoundsCheckFnLangItem, // 23
6465
ExchangeMallocFnLangItem, // 24
@@ -237,6 +238,9 @@ impl LanguageItems {
237238
pub fn uniq_str_eq_fn(&self) -> Option<DefId> {
238239
self.items[UniqStrEqFnLangItem as uint]
239240
}
241+
pub fn log_type_fn(&self) -> Option<DefId> {
242+
self.items[LogTypeFnLangItem as uint]
243+
}
240244
pub fn fail_fn(&self) -> Option<DefId> {
241245
self.items[FailFnLangItem as uint]
242246
}
@@ -353,6 +357,7 @@ impl<'self> LanguageItemCollector<'self> {
353357

354358
item_refs.insert(@"str_eq", StrEqFnLangItem as uint);
355359
item_refs.insert(@"uniq_str_eq", UniqStrEqFnLangItem as uint);
360+
item_refs.insert(@"log_type", LogTypeFnLangItem as uint);
356361
item_refs.insert(@"fail_", FailFnLangItem as uint);
357362
item_refs.insert(@"fail_bounds_check",
358363
FailBoundsCheckFnLangItem as uint);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: @Expr, this: @mut IrMaps) {
526526

527527
// otherwise, live nodes are not required:
528528
ExprIndex(*) | ExprField(*) | ExprVstore(*) | ExprVec(*) |
529-
ExprCall(*) | ExprMethodCall(*) | ExprTup(*) | ExprLogLevel |
529+
ExprCall(*) | ExprMethodCall(*) | ExprTup(*) | ExprLog(*) |
530530
ExprBinary(*) | ExprAddrOf(*) |
531531
ExprDoBody(*) | ExprCast(*) | ExprUnary(*) | ExprBreak(_) |
532532
ExprAgain(_) | ExprLit(_) | ExprRet(*) | ExprBlock(*) |
@@ -1217,6 +1217,7 @@ impl Liveness {
12171217
self.propagate_through_expr(l, ln)
12181218
}
12191219

1220+
ExprLog(l, r) |
12201221
ExprIndex(_, l, r) |
12211222
ExprBinary(_, _, l, r) => {
12221223
self.propagate_through_exprs([l, r], succ)
@@ -1239,7 +1240,6 @@ impl Liveness {
12391240
}
12401241
}
12411242

1242-
ExprLogLevel |
12431243
ExprLit(*) => {
12441244
succ
12451245
}
@@ -1496,7 +1496,7 @@ fn check_expr(vt: &mut ErrorCheckVisitor, expr: @Expr, this: @Liveness) {
14961496
// no correctness conditions related to liveness
14971497
ExprCall(*) | ExprMethodCall(*) | ExprIf(*) | ExprMatch(*) |
14981498
ExprWhile(*) | ExprLoop(*) | ExprIndex(*) | ExprField(*) |
1499-
ExprVstore(*) | ExprVec(*) | ExprTup(*) | ExprLogLevel |
1499+
ExprVstore(*) | ExprVec(*) | ExprTup(*) | ExprLog(*) |
15001500
ExprBinary(*) | ExprDoBody(*) |
15011501
ExprCast(*) | ExprUnary(*) | ExprRet(*) | ExprBreak(*) |
15021502
ExprAgain(*) | ExprLit(_) | ExprBlock(*) |

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl mem_categorization_ctxt {
429429
ast::ExprDoBody(*) | ast::ExprUnary(*) |
430430
ast::ExprMethodCall(*) | ast::ExprCast(*) | ast::ExprVstore(*) |
431431
ast::ExprVec(*) | ast::ExprTup(*) | ast::ExprIf(*) |
432-
ast::ExprLogLevel | ast::ExprBinary(*) | ast::ExprWhile(*) |
432+
ast::ExprLog(*) | ast::ExprBinary(*) | ast::ExprWhile(*) |
433433
ast::ExprBlock(*) | ast::ExprLoop(*) | ast::ExprMatch(*) |
434434
ast::ExprLit(*) | ast::ExprBreak(*) | ast::ExprMac(*) |
435435
ast::ExprAgain(*) | ast::ExprStruct(*) | ast::ExprRepeat(*) |

branches/try2/src/librustc/middle/moves.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ impl VisitContext {
480480
self.use_expr(base, Read, visitor);
481481
}
482482

483-
ExprLogLevel |
484483
ExprInlineAsm(*) |
485484
ExprBreak(*) |
486485
ExprAgain(*) |
@@ -490,6 +489,11 @@ impl VisitContext {
490489
self.consume_block(blk, visitor);
491490
}
492491

492+
ExprLog(a_expr, b_expr) => {
493+
self.consume_expr(a_expr, visitor);
494+
self.use_expr(b_expr, Read, visitor);
495+
}
496+
493497
ExprWhile(cond_expr, ref blk) => {
494498
self.consume_expr(cond_expr, visitor);
495499
self.consume_block(blk, visitor);

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,15 +1716,21 @@ pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
17161716
let llarg = unsafe {llvm::LLVMGetParam(cx.llfn, arg_n as c_uint) };
17171717

17181718
match ty::get(arg_ty).sty {
1719-
// `~` pointer parameters never alias because ownership is transferred
1719+
// `~` pointers never alias other parameters, because
1720+
// ownership was transferred
17201721
ty::ty_uniq(*) |
17211722
ty::ty_evec(_, ty::vstore_uniq) |
17221723
ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, _}) => {
17231724
unsafe {
1724-
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
1725+
llvm::LLVMAddAttribute(
1726+
llarg, lib::llvm::NoAliasAttribute as c_uint);
17251727
}
17261728
}
1727-
_ => ()
1729+
// FIXME: #6785: `&mut` can only alias `&const` and
1730+
// `@mut`, we should check for those in the other
1731+
// parameters and then mark it as `noalias` if there
1732+
// aren't any
1733+
_ => {}
17281734
}
17291735

17301736
llarg
@@ -1946,18 +1952,6 @@ pub fn trans_fn(ccx: @mut CrateContext,
19461952
param_substs.repr(ccx.tcx));
19471953
let _icx = push_ctxt("trans_fn");
19481954
let output_type = ty::ty_fn_ret(ty::node_id_to_type(ccx.tcx, id));
1949-
1950-
match ty::get(output_type).sty {
1951-
// `~` pointer return values never alias because ownership is transferred
1952-
ty::ty_uniq(*) |
1953-
ty::ty_evec(_, ty::vstore_uniq) => {
1954-
unsafe {
1955-
llvm::LLVMAddReturnAttribute(llfndecl, lib::llvm::NoAliasAttribute as c_uint);
1956-
}
1957-
}
1958-
_ => ()
1959-
}
1960-
19611955
trans_closure(ccx,
19621956
path.clone(),
19631957
decl,

branches/try2/src/librustc/middle/trans/controlflow.rs

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

11+
use std::c_str::ToCStr;
12+
13+
use back::link;
14+
use lib;
1115
use lib::llvm::*;
1216
use middle::lang_items::{FailFnLangItem, FailBoundsCheckFnLangItem};
17+
use middle::lang_items::LogTypeFnLangItem;
1318
use middle::trans::base::*;
1419
use middle::trans::build::*;
1520
use middle::trans::callee;
@@ -23,6 +28,7 @@ use middle::trans::type_::Type;
2328

2429
use syntax::ast;
2530
use syntax::ast::Ident;
31+
use syntax::ast_map::path_mod;
2632
use syntax::ast_util;
2733
use syntax::codemap::Span;
2834

@@ -200,6 +206,72 @@ pub fn trans_loop(bcx:@mut Block,
200206
return next_bcx;
201207
}
202208

209+
pub fn trans_log(log_ex: &ast::Expr,
210+
lvl: @ast::Expr,
211+
bcx: @mut Block,
212+
e: @ast::Expr) -> @mut Block {
213+
let _icx = push_ctxt("trans_log");
214+
let ccx = bcx.ccx();
215+
let mut bcx = bcx;
216+
if ty::type_is_bot(expr_ty(bcx, lvl)) {
217+
return expr::trans_into(bcx, lvl, expr::Ignore);
218+
}
219+
220+
let (modpath, modname) = {
221+
let path = &mut bcx.fcx.path;
222+
let mut modpath = ~[path_mod(ccx.sess.ident_of(ccx.link_meta.name))];
223+
for e in path.iter() {
224+
match *e {
225+
path_mod(_) => { modpath.push(*e) }
226+
_ => {}
227+
}
228+
}
229+
let modname = path_str(ccx.sess, modpath);
230+
(modpath, modname)
231+
};
232+
233+
let global = if ccx.module_data.contains_key(&modname) {
234+
ccx.module_data.get_copy(&modname)
235+
} else {
236+
let s = link::mangle_internal_name_by_path_and_seq(
237+
ccx, modpath, "loglevel");
238+
let global;
239+
unsafe {
240+
global = do s.with_c_str |buf| {
241+
llvm::LLVMAddGlobal(ccx.llmod, Type::i32().to_ref(), buf)
242+
};
243+
llvm::LLVMSetGlobalConstant(global, False);
244+
llvm::LLVMSetInitializer(global, C_null(Type::i32()));
245+
lib::llvm::SetLinkage(global, lib::llvm::InternalLinkage);
246+
}
247+
ccx.module_data.insert(modname, global);
248+
global
249+
};
250+
let current_level = Load(bcx, global);
251+
let level = unpack_result!(bcx, {
252+
do with_scope_result(bcx, lvl.info(), "level") |bcx| {
253+
expr::trans_to_datum(bcx, lvl).to_result()
254+
}
255+
});
256+
257+
let llenabled = ICmp(bcx, lib::llvm::IntUGE, current_level, level);
258+
do with_cond(bcx, llenabled) |bcx| {
259+
do with_scope(bcx, log_ex.info(), "log") |bcx| {
260+
let mut bcx = bcx;
261+
262+
// Translate the value to be logged
263+
let val_datum = unpack_datum!(bcx, expr::trans_to_datum(bcx, e));
264+
265+
// Call the polymorphic log function
266+
let val = val_datum.to_ref_llval(bcx);
267+
let did = langcall(bcx, Some(e.span), "", LogTypeFnLangItem);
268+
let bcx = callee::trans_lang_call_with_type_params(
269+
bcx, did, [level, val], [val_datum.ty], expr::Ignore);
270+
bcx
271+
}
272+
}
273+
}
274+
203275
pub fn trans_break_cont(bcx: @mut Block,
204276
opt_label: Option<Ident>,
205277
to_end: bool)

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,6 @@ fn populate_scope_map(cx: &mut CrateContext,
19951995
scope_map.insert(exp.id, scope_stack.last().scope_metadata);
19961996

19971997
match exp.node {
1998-
ast::ExprLogLevel |
19991998
ast::ExprSelf |
20001999
ast::ExprLit(_) |
20012000
ast::ExprBreak(_) |
@@ -2034,6 +2033,7 @@ fn populate_scope_map(cx: &mut CrateContext,
20342033
}
20352034

20362035
ast::ExprAssign(@ref sub_exp1, @ref sub_exp2) |
2036+
ast::ExprLog(@ref sub_exp1, @ref sub_exp2) |
20372037
ast::ExprRepeat(@ref sub_exp1, @ref sub_exp2, _) => {
20382038
walk_expr(cx, sub_exp1, scope_stack, scope_map);
20392039
walk_expr(cx, sub_exp2, scope_stack, scope_map);

0 commit comments

Comments
 (0)