Skip to content

Commit 0d79c7b

Browse files
committed
---
yaml --- r: 63356 b: refs/heads/snap-stage3 c: 9c4f9bb h: refs/heads/master v: v3
1 parent 932c4e8 commit 0d79c7b

File tree

10 files changed

+334
-352
lines changed

10 files changed

+334
-352
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 01e098aa05e01104d1a09f56bc188f6b53450778
4+
refs/heads/snap-stage3: 9c4f9bb71bbac102621fb53efa8d41351a92350e
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/terminfo/parm.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
224224
}
225225
} else { return Err(~"stack is empty") },
226226
'i' => match (copy mparams[0], copy mparams[1]) {
227-
(Number(ref mut x), Number(ref mut y)) => {
228-
*x += 1;
229-
*y += 1;
227+
(Number(x), Number(y)) => {
228+
mparams[0] = Number(x+1);
229+
mparams[1] = Number(y+1);
230230
},
231231
(_, _) => return Err(~"first two params not numbers with %i")
232232
},
@@ -352,6 +352,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
352352
#[cfg(test)]
353353
mod test {
354354
use super::*;
355+
use core::result::Ok;
355356

356357
#[test]
357358
fn test_basic_setabf() {
@@ -366,6 +367,16 @@ mod test {
366367
bytes!("21").to_owned());
367368
}
368369

370+
#[test]
371+
fn test_op_i() {
372+
let mut vars = Variables::new();
373+
assert_eq!(expand(bytes!("%p1%d%p2%d%p3%d%i%p1%d%p2%d%p3%d"),
374+
[Number(1),Number(2),Number(3)], &mut vars),
375+
Ok(bytes!("123233").to_owned()));
376+
assert_eq!(expand(bytes!("%p1%d%p2%d%i%p1%d%p2%d"), [], &mut vars),
377+
Ok(bytes!("0011").to_owned()));
378+
}
379+
369380
#[test]
370381
fn test_param_stack_failure_conditions() {
371382
let mut varstruct = Variables::new();

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use lib::llvm::ModuleRef;
1818
use lib;
1919
use metadata::common::LinkMeta;
2020
use metadata::{encoder, csearch, cstore};
21-
use middle::trans::context::CrateContext;
21+
use middle::trans::common::CrateContext;
2222
use middle::ty;
2323
use util::ppaux;
2424

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

Lines changed: 146 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
use core::prelude::*;
2727

2828
use back::link::{mangle_exported_name};
29-
use back::{link, abi};
29+
use back::{link, abi, upcall};
3030
use driver::session;
3131
use driver::session::Session;
3232
use lib::llvm::{ContextRef, ModuleRef, ValueRef, TypeRef, BasicBlockRef};
33-
use lib::llvm::{llvm, True, False};
33+
use lib::llvm::{True, False};
34+
use lib::llvm::{llvm, mk_target_data, mk_type_names};
3435
use lib;
3536
use metadata::common::LinkMeta;
3637
use metadata::{csearch, cstore, encoder};
@@ -64,7 +65,7 @@ use util::common::indenter;
6465
use util::ppaux::{Repr, ty_to_str};
6566

6667
use core::hash;
67-
use core::hashmap::{HashMap};
68+
use core::hashmap::{HashMap, HashSet};
6869
use core::int;
6970
use core::io;
7071
use core::libc::c_uint;
@@ -85,8 +86,6 @@ use syntax::visit;
8586
use syntax::{ast, ast_util, codemap, ast_map};
8687
use syntax::abi::{X86, X86_64, Arm, Mips};
8788

88-
pub use middle::trans::context::task_llcx;
89-
9089
pub struct icx_popper {
9190
ccx: @CrateContext,
9291
}
@@ -3038,52 +3037,152 @@ pub fn trans_crate(sess: session::Session,
30383037
// such as a function name in the module.
30393038
// 1. http://llvm.org/bugs/show_bug.cgi?id=11479
30403039
let llmod_id = link_meta.name.to_owned() + ".rc";
3041-
let ccx = @CrateContext::new(sess, llmod_id, tcx, emap2, maps,
3042-
symbol_hasher, link_meta, reachable);
3043-
// FIXME(#6511): get LLVM building with --enable-threads so this
3044-
// function can be called
3045-
// if !llvm::LLVMRustStartMultithreading() {
3046-
// sess.bug("couldn't enable multi-threaded LLVM");
3047-
// }
30483040
3049-
{
3050-
let _icx = ccx.insn_ctxt("data");
3051-
trans_constants(ccx, crate);
3052-
}
3041+
unsafe {
3042+
// FIXME(#6511): get LLVM building with --enable-threads so this
3043+
// function can be called
3044+
// if !llvm::LLVMRustStartMultithreading() {
3045+
// sess.bug("couldn't enable multi-threaded LLVM");
3046+
// }
3047+
let llcx = llvm::LLVMContextCreate();
3048+
set_task_llcx(llcx);
3049+
let llmod = str::as_c_str(llmod_id, |buf| {
3050+
llvm::LLVMModuleCreateWithNameInContext(buf, llcx)
3051+
});
3052+
let data_layout: &str = sess.targ_cfg.target_strs.data_layout;
3053+
let targ_triple: &str = sess.targ_cfg.target_strs.target_triple;
3054+
let _: () =
3055+
str::as_c_str(data_layout,
3056+
|buf| llvm::LLVMSetDataLayout(llmod, buf));
3057+
let _: () =
3058+
str::as_c_str(targ_triple,
3059+
|buf| llvm::LLVMSetTarget(llmod, buf));
3060+
let targ_cfg = sess.targ_cfg;
3061+
let td = mk_target_data(sess.targ_cfg.target_strs.data_layout);
3062+
let tn = mk_type_names();
3063+
let mut intrinsics = declare_intrinsics(llmod);
3064+
if sess.opts.extra_debuginfo {
3065+
declare_dbg_intrinsics(llmod, &mut intrinsics);
3066+
}
3067+
let int_type = T_int(targ_cfg);
3068+
let float_type = T_float(targ_cfg);
3069+
let tydesc_type = T_tydesc(targ_cfg);
3070+
lib::llvm::associate_type(tn, @"tydesc", tydesc_type);
3071+
let crate_map = decl_crate_map(sess, link_meta, llmod);
3072+
let dbg_cx = if sess.opts.debuginfo {
3073+
Some(debuginfo::mk_ctxt(copy llmod_id))
3074+
} else {
3075+
None
3076+
};
30533077
3054-
{
3055-
let _icx = ccx.insn_ctxt("text");
3056-
trans_mod(ccx, &crate.node.module);
3057-
}
3058-
3059-
decl_gc_metadata(ccx, llmod_id);
3060-
fill_crate_map(ccx, ccx.crate_map);
3061-
glue::emit_tydescs(ccx);
3062-
write_abi_version(ccx);
3063-
3064-
// Translate the metadata.
3065-
write_metadata(ccx, crate);
3066-
if ccx.sess.trans_stats() {
3067-
io::println("--- trans stats ---");
3068-
io::println(fmt!("n_static_tydescs: %u",
3069-
ccx.stats.n_static_tydescs));
3070-
io::println(fmt!("n_glues_created: %u",
3071-
ccx.stats.n_glues_created));
3072-
io::println(fmt!("n_null_glues: %u", ccx.stats.n_null_glues));
3073-
io::println(fmt!("n_real_glues: %u", ccx.stats.n_real_glues));
3074-
3075-
io::println(fmt!("n_fns: %u", ccx.stats.n_fns));
3076-
io::println(fmt!("n_monos: %u", ccx.stats.n_monos));
3077-
io::println(fmt!("n_inlines: %u", ccx.stats.n_inlines));
3078-
io::println(fmt!("n_closures: %u", ccx.stats.n_closures));
3079-
}
3080-
3081-
if ccx.sess.count_llvm_insns() {
3082-
for ccx.stats.llvm_insns.each |&k, &v| {
3083-
io::println(fmt!("%-7u %s", v, k));
3078+
let ccx = @CrateContext {
3079+
sess: sess,
3080+
llmod: llmod,
3081+
llcx: llcx,
3082+
td: td,
3083+
tn: tn,
3084+
externs: @mut HashMap::new(),
3085+
intrinsics: intrinsics,
3086+
item_vals: @mut HashMap::new(),
3087+
exp_map2: emap2,
3088+
reachable: reachable,
3089+
item_symbols: @mut HashMap::new(),
3090+
link_meta: link_meta,
3091+
enum_sizes: @mut HashMap::new(),
3092+
discrims: @mut HashMap::new(),
3093+
discrim_symbols: @mut HashMap::new(),
3094+
tydescs: @mut HashMap::new(),
3095+
finished_tydescs: @mut false,
3096+
external: @mut HashMap::new(),
3097+
monomorphized: @mut HashMap::new(),
3098+
monomorphizing: @mut HashMap::new(),
3099+
type_use_cache: @mut HashMap::new(),
3100+
vtables: @mut HashMap::new(),
3101+
const_cstr_cache: @mut HashMap::new(),
3102+
const_globals: @mut HashMap::new(),
3103+
const_values: @mut HashMap::new(),
3104+
extern_const_values: @mut HashMap::new(),
3105+
impl_method_cache: @mut HashMap::new(),
3106+
module_data: @mut HashMap::new(),
3107+
lltypes: @mut HashMap::new(),
3108+
llsizingtypes: @mut HashMap::new(),
3109+
adt_reprs: @mut HashMap::new(),
3110+
names: new_namegen(),
3111+
next_addrspace: new_addrspace_gen(),
3112+
symbol_hasher: symbol_hasher,
3113+
type_hashcodes: @mut HashMap::new(),
3114+
type_short_names: @mut HashMap::new(),
3115+
all_llvm_symbols: @mut HashSet::new(),
3116+
tcx: tcx,
3117+
maps: maps,
3118+
stats: @mut Stats {
3119+
n_static_tydescs: 0u,
3120+
n_glues_created: 0u,
3121+
n_null_glues: 0u,
3122+
n_real_glues: 0u,
3123+
n_fns: 0u,
3124+
n_monos: 0u,
3125+
n_inlines: 0u,
3126+
n_closures: 0u,
3127+
llvm_insn_ctxt: @mut ~[],
3128+
llvm_insns: @mut HashMap::new(),
3129+
fn_times: @mut ~[]
3130+
},
3131+
upcalls: upcall::declare_upcalls(targ_cfg, llmod),
3132+
tydesc_type: tydesc_type,
3133+
int_type: int_type,
3134+
float_type: float_type,
3135+
opaque_vec_type: T_opaque_vec(targ_cfg),
3136+
builder: BuilderRef_res(unsafe {
3137+
llvm::LLVMCreateBuilderInContext(llcx)
3138+
}),
3139+
shape_cx: mk_ctxt(llmod),
3140+
crate_map: crate_map,
3141+
uses_gc: @mut false,
3142+
dbg_cx: dbg_cx,
3143+
do_not_commit_warning_issued: @mut false
3144+
};
3145+
3146+
{
3147+
let _icx = ccx.insn_ctxt("data");
3148+
trans_constants(ccx, crate);
3149+
}
3150+
3151+
{
3152+
let _icx = ccx.insn_ctxt("text");
3153+
trans_mod(ccx, &crate.node.module);
3154+
}
3155+
3156+
decl_gc_metadata(ccx, llmod_id);
3157+
fill_crate_map(ccx, crate_map);
3158+
glue::emit_tydescs(ccx);
3159+
write_abi_version(ccx);
3160+
3161+
// Translate the metadata.
3162+
write_metadata(ccx, crate);
3163+
if ccx.sess.trans_stats() {
3164+
io::println("--- trans stats ---");
3165+
io::println(fmt!("n_static_tydescs: %u",
3166+
ccx.stats.n_static_tydescs));
3167+
io::println(fmt!("n_glues_created: %u",
3168+
ccx.stats.n_glues_created));
3169+
io::println(fmt!("n_null_glues: %u", ccx.stats.n_null_glues));
3170+
io::println(fmt!("n_real_glues: %u", ccx.stats.n_real_glues));
3171+
3172+
io::println(fmt!("n_fns: %u", ccx.stats.n_fns));
3173+
io::println(fmt!("n_monos: %u", ccx.stats.n_monos));
3174+
io::println(fmt!("n_inlines: %u", ccx.stats.n_inlines));
3175+
io::println(fmt!("n_closures: %u", ccx.stats.n_closures));
3176+
}
3177+
3178+
if ccx.sess.count_llvm_insns() {
3179+
for ccx.stats.llvm_insns.each |&k, &v| {
3180+
io::println(fmt!("%-7u %s", v, k));
3181+
}
30843182
}
3183+
unset_task_llcx();
3184+
return (llcx, llmod, link_meta);
30853185
}
3086-
return (llmod, link_meta);
30873186
}
30883187
30893188
fn task_local_llcx_key(_v: @ContextRef) {}

0 commit comments

Comments
 (0)