Skip to content

Commit bb0ca96

Browse files
committed
---
yaml --- r: 144908 b: refs/heads/try2 c: af259a6 h: refs/heads/master v: v3
1 parent 35eef4a commit bb0ca96

File tree

31 files changed

+243
-210
lines changed

31 files changed

+243
-210
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: 2a0dd9767546c3abd43a9f4dedf142959ef7c6b7
8+
refs/heads/try2: af259a651d52e7243c74a833b2b39a61890e89fe
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)):
179+
$$(LIBUV_MAKEFILE_$(1)_$(2)): $$(LIBUV_DEPS)
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: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,43 @@ 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+
156193
impl Shl<uint, BigUint> for BigUint {
157194
#[inline]
158195
fn shl(&self, rhs: &uint) -> BigUint {
@@ -1166,6 +1203,48 @@ mod biguint_tests {
11661203
}
11671204
}
11681205
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+
11691248
#[test]
11701249
fn test_shl() {
11711250
fn check(s: &str, shift: uint, ans: &str) {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,12 @@ 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+
876882
#[fast_ffi]
877883
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef,
878884
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,7 +389,6 @@ impl CFGBuilder {
389389
self.straightline(expr, pred, [r, l])
390390
}
391391

392-
ast::ExprLog(l, r) |
393392
ast::ExprIndex(_, l, r) |
394393
ast::ExprBinary(_, _, l, r) => { // NB: && and || handled earlier
395394
self.straightline(expr, pred, [l, r])
@@ -405,6 +404,7 @@ impl CFGBuilder {
405404
self.straightline(expr, pred, [e])
406405
}
407406

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) |
706705
ast::ExprIndex(_, l, r) |
707706
ast::ExprBinary(_, _, l, r) => {
708707
self.walk_exprs([l, r], in_out, loop_scopes);
709708
}
710709

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

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

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

6060
StrEqFnLangItem, // 19
6161
UniqStrEqFnLangItem, // 20
62-
LogTypeFnLangItem, // 21
6362
FailFnLangItem, // 22
6463
FailBoundsCheckFnLangItem, // 23
6564
ExchangeMallocFnLangItem, // 24
@@ -238,9 +237,6 @@ impl LanguageItems {
238237
pub fn uniq_str_eq_fn(&self) -> Option<DefId> {
239238
self.items[UniqStrEqFnLangItem as uint]
240239
}
241-
pub fn log_type_fn(&self) -> Option<DefId> {
242-
self.items[LogTypeFnLangItem as uint]
243-
}
244240
pub fn fail_fn(&self) -> Option<DefId> {
245241
self.items[FailFnLangItem as uint]
246242
}
@@ -357,7 +353,6 @@ impl<'self> LanguageItemCollector<'self> {
357353

358354
item_refs.insert(@"str_eq", StrEqFnLangItem as uint);
359355
item_refs.insert(@"uniq_str_eq", UniqStrEqFnLangItem as uint);
360-
item_refs.insert(@"log_type", LogTypeFnLangItem as uint);
361356
item_refs.insert(@"fail_", FailFnLangItem as uint);
362357
item_refs.insert(@"fail_bounds_check",
363358
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(*) | ExprLog(*) |
529+
ExprCall(*) | ExprMethodCall(*) | ExprTup(*) | ExprLogLevel |
530530
ExprBinary(*) | ExprAddrOf(*) |
531531
ExprDoBody(*) | ExprCast(*) | ExprUnary(*) | ExprBreak(_) |
532532
ExprAgain(_) | ExprLit(_) | ExprRet(*) | ExprBlock(*) |
@@ -1217,7 +1217,6 @@ impl Liveness {
12171217
self.propagate_through_expr(l, ln)
12181218
}
12191219

1220-
ExprLog(l, r) |
12211220
ExprIndex(_, l, r) |
12221221
ExprBinary(_, _, l, r) => {
12231222
self.propagate_through_exprs([l, r], succ)
@@ -1240,6 +1239,7 @@ impl Liveness {
12401239
}
12411240
}
12421241

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(*) | ExprLog(*) |
1499+
ExprVstore(*) | ExprVec(*) | ExprTup(*) | ExprLogLevel |
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::ExprLog(*) | ast::ExprBinary(*) | ast::ExprWhile(*) |
432+
ast::ExprLogLevel | 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: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ impl VisitContext {
480480
self.use_expr(base, Read, visitor);
481481
}
482482

483+
ExprLogLevel |
483484
ExprInlineAsm(*) |
484485
ExprBreak(*) |
485486
ExprAgain(*) |
@@ -489,11 +490,6 @@ impl VisitContext {
489490
self.consume_block(blk, visitor);
490491
}
491492

492-
ExprLog(a_expr, b_expr) => {
493-
self.consume_expr(a_expr, visitor);
494-
self.use_expr(b_expr, Read, visitor);
495-
}
496-
497493
ExprWhile(cond_expr, ref blk) => {
498494
self.consume_expr(cond_expr, visitor);
499495
self.consume_block(blk, visitor);

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,21 +1716,15 @@ 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-
// `~` pointers never alias other parameters, because
1720-
// ownership was transferred
1719+
// `~` pointer parameters never alias because ownership is transferred
17211720
ty::ty_uniq(*) |
17221721
ty::ty_evec(_, ty::vstore_uniq) |
17231722
ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, _}) => {
17241723
unsafe {
1725-
llvm::LLVMAddAttribute(
1726-
llarg, lib::llvm::NoAliasAttribute as c_uint);
1724+
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
17271725
}
17281726
}
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-
_ => {}
1727+
_ => ()
17341728
}
17351729

17361730
llarg
@@ -1952,6 +1946,18 @@ pub fn trans_fn(ccx: @mut CrateContext,
19521946
param_substs.repr(ccx.tcx));
19531947
let _icx = push_ctxt("trans_fn");
19541948
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+
19551961
trans_closure(ccx,
19561962
path.clone(),
19571963
decl,

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

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
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;
1511
use lib::llvm::*;
1612
use middle::lang_items::{FailFnLangItem, FailBoundsCheckFnLangItem};
17-
use middle::lang_items::LogTypeFnLangItem;
1813
use middle::trans::base::*;
1914
use middle::trans::build::*;
2015
use middle::trans::callee;
@@ -28,7 +23,6 @@ use middle::trans::type_::Type;
2823

2924
use syntax::ast;
3025
use syntax::ast::Ident;
31-
use syntax::ast_map::path_mod;
3226
use syntax::ast_util;
3327
use syntax::codemap::Span;
3428

@@ -206,72 +200,6 @@ pub fn trans_loop(bcx:@mut Block,
206200
return next_bcx;
207201
}
208202

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-
275203
pub fn trans_break_cont(bcx: @mut Block,
276204
opt_label: Option<Ident>,
277205
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,6 +1995,7 @@ 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 |
19981999
ast::ExprSelf |
19992000
ast::ExprLit(_) |
20002001
ast::ExprBreak(_) |
@@ -2033,7 +2034,6 @@ fn populate_scope_map(cx: &mut CrateContext,
20332034
}
20342035

20352036
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)