Skip to content

Commit 6822274

Browse files
committed
---
yaml --- r: 42994 b: refs/heads/try c: 739e5ba h: refs/heads/master v: v3
1 parent ae21d8f commit 6822274

File tree

5 files changed

+20
-31
lines changed

5 files changed

+20
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: a8c8bfc7b5525a83fab65f527345bb6ca46d4e25
5+
refs/heads/try: 739e5ba369cfe19da10d7adf1bcfcd14b80f52bb
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn log_fn_time(ccx: @crate_ctxt, +name: ~str, start: time::Timespec,
137137
ccx.stats.fn_times.push({ident: name, time: elapsed});
138138
}
139139

140-
pub fn decl_fn(llmod: ModuleRef, name: ~str, cc: lib::llvm::CallConv,
140+
pub fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
141141
llty: TypeRef) -> ValueRef {
142142
let llfn: ValueRef = str::as_c_str(name, |buf| {
143143
unsafe {
@@ -150,7 +150,7 @@ pub fn decl_fn(llmod: ModuleRef, name: ~str, cc: lib::llvm::CallConv,
150150
return llfn;
151151
}
152152

153-
pub fn decl_cdecl_fn(llmod: ModuleRef, +name: ~str, llty: TypeRef)
153+
pub fn decl_cdecl_fn(llmod: ModuleRef, name: &str, llty: TypeRef)
154154
-> ValueRef {
155155
return decl_fn(llmod, name, lib::llvm::CCallConv, llty);
156156
}
@@ -164,20 +164,19 @@ pub fn decl_internal_cdecl_fn(llmod: ModuleRef, +name: ~str, llty: TypeRef) ->
164164
return llfn;
165165
}
166166

167-
pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
167+
pub fn get_extern_fn(externs: ExternMap,
168168
llmod: ModuleRef,
169-
+name: ~str,
169+
name: @str,
170170
cc: lib::llvm::CallConv,
171171
ty: TypeRef) -> ValueRef {
172172
if externs.contains_key_ref(&name) { return externs.get(&name); }
173-
// XXX: Bad copy.
174-
let f = decl_fn(llmod, copy name, cc, ty);
173+
let f = decl_fn(llmod, name, cc, ty);
175174
externs.insert(name, f);
176175
return f;
177176
}
178177

179-
pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
180-
+name: ~str, ty: TypeRef) -> ValueRef {
178+
pub fn get_extern_const(externs: ExternMap, llmod: ModuleRef,
179+
name: @str, ty: TypeRef) -> ValueRef {
181180
unsafe {
182181
if externs.contains_key_ref(&name) { return externs.get(&name); }
183182
let c = str::as_c_str(name, |buf| {
@@ -189,9 +188,9 @@ pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
189188
}
190189

191190
fn get_simple_extern_fn(cx: block,
192-
externs: HashMap<~str, ValueRef>,
191+
externs: ExternMap,
193192
llmod: ModuleRef,
194-
+name: ~str,
193+
name: @str,
195194
n_args: int) -> ValueRef {
196195
let _icx = cx.insn_ctxt("get_simple_extern_fn");
197196
let ccx = cx.fcx.ccx;
@@ -201,8 +200,8 @@ pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
201200
return get_extern_fn(externs, llmod, name, lib::llvm::CCallConv, t);
202201
}
203202

204-
pub fn trans_foreign_call(cx: block, externs: HashMap<~str, ValueRef>,
205-
llmod: ModuleRef, +name: ~str, args: ~[ValueRef]) ->
203+
pub fn trans_foreign_call(cx: block, externs: ExternMap,
204+
llmod: ModuleRef, name: @str, args: ~[ValueRef]) ->
206205
ValueRef {
207206
let _icx = cx.insn_ctxt("trans_foreign_call");
208207
let n = args.len() as int;
@@ -474,6 +473,7 @@ pub fn get_res_dtor(ccx: @crate_ctxt, did: ast::def_id,
474473
let class_ty = ty::subst_tps(tcx, substs, None,
475474
ty::lookup_item_type(tcx, parent_id).ty);
476475
let llty = type_of_dtor(ccx, class_ty);
476+
let name = name.to_managed(); // :-(
477477
get_extern_fn(ccx.externs, ccx.llmod, name, lib::llvm::CCallConv,
478478
llty)
479479
}
@@ -766,7 +766,7 @@ pub fn null_env_ptr(bcx: block) -> ValueRef {
766766
767767
pub fn trans_external_path(ccx: @crate_ctxt, did: ast::def_id, t: ty::t)
768768
-> ValueRef {
769-
let name = csearch::get_symbol(ccx.sess.cstore, did);
769+
let name = csearch::get_symbol(ccx.sess.cstore, did).to_managed(); // Sad
770770
match ty::get(t).sty {
771771
ty::ty_fn(_) => {
772772
let llty = type_of_fn_from_ty(ccx, t);

branches/try/src/librustc/middle/trans/common.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,15 @@ pub fn BuilderRef_res(B: BuilderRef) -> BuilderRef_res {
152152
}
153153
}
154154

155+
type ExternMap = HashMap<@str, ValueRef>;
156+
155157
// Crate context. Every crate we compile has one of these.
156158
pub struct crate_ctxt {
157159
sess: session::Session,
158160
llmod: ModuleRef,
159161
td: target_data,
160162
tn: type_names,
161-
externs: HashMap<~str, ValueRef>,
163+
externs: ExternMap,
162164
intrinsics: HashMap<~str, ValueRef>,
163165
item_vals: HashMap<ast::node_id, ValueRef>,
164166
exp_map2: resolve::ExportMap2,

branches/try/src/rt/rust_sched_loop.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ struct rust_sched_loop
135135
void place_task_in_tls(rust_task *task);
136136

137137
static rust_task *get_task_tls();
138-
static rust_task *try_get_task_tls();
139138

140139
// Called by each task when they are ready to be destroyed
141140
void release_task(rust_task *task);
@@ -155,7 +154,7 @@ rust_sched_loop::get_log() {
155154
return _log;
156155
}
157156

158-
inline rust_task* rust_sched_loop::try_get_task_tls()
157+
inline rust_task* rust_sched_loop::get_task_tls()
159158
{
160159
if (!tls_initialized)
161160
return NULL;
@@ -166,12 +165,6 @@ inline rust_task* rust_sched_loop::try_get_task_tls()
166165
rust_task *task = reinterpret_cast<rust_task *>
167166
(pthread_getspecific(task_key));
168167
#endif
169-
return task;
170-
}
171-
172-
inline rust_task* rust_sched_loop::get_task_tls()
173-
{
174-
rust_task *task = try_get_task_tls();
175168
assert(task && "Couldn't get the task from TLS!");
176169
return task;
177170
}

branches/try/src/rt/rust_task.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,14 +619,14 @@ rust_task::record_stack_limit() {
619619
record_sp_limit(stk->data + LIMIT_OFFSET + RED_ZONE_SIZE);
620620
}
621621

622-
inline rust_task* rust_try_get_current_task() {
622+
inline rust_task* rust_get_current_task() {
623623
uintptr_t sp_limit = get_sp_limit();
624624

625625
// FIXME (#1226) - Because of a hack in upcall_call_shim_on_c_stack this
626626
// value is sometimes inconveniently set to 0, so we can't use this
627627
// method of retreiving the task pointer and need to fall back to TLS.
628628
if (sp_limit == 0)
629-
return rust_sched_loop::try_get_task_tls();
629+
return rust_sched_loop::get_task_tls();
630630

631631
// The stack pointer boundary is stored in a quickly-accessible location
632632
// in the TCB. From that we can calculate the address of the stack segment
@@ -642,12 +642,6 @@ inline rust_task* rust_try_get_current_task() {
642642
return stk->task;
643643
}
644644

645-
inline rust_task* rust_get_current_task() {
646-
rust_task* task = rust_try_get_current_task();
647-
assert(task != NULL && "no current task");
648-
return task;
649-
}
650-
651645
//
652646
// Local Variables:
653647
// mode: C++

0 commit comments

Comments
 (0)