Skip to content

Commit cb8a231

Browse files
committed
auto merge of #8433 : brson/rust/rm-more-oldrt-crud, r=brson
Just deleting more stuff.
2 parents 7503396 + a4d171e commit cb8a231

21 files changed

+115
-716
lines changed

mk/rt.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ RUNTIME_CXXS_$(1)_$(2) := \
6868
rt/sync/rust_thread.cpp \
6969
rt/rust_builtin.cpp \
7070
rt/rust_run_program.cpp \
71-
rt/rust_env.cpp \
7271
rt/rust_rng.cpp \
73-
rt/rust_stack.cpp \
7472
rt/rust_upcall.cpp \
7573
rt/rust_uv.cpp \
7674
rt/rust_crate_map.cpp \

src/librustc/middle/lang_items.rs

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,27 @@ pub enum LangItem {
5757

5858
StrEqFnLangItem, // 19
5959
UniqStrEqFnLangItem, // 20
60-
AnnihilateFnLangItem, // 21
61-
LogTypeFnLangItem, // 22
62-
FailFnLangItem, // 23
63-
FailBoundsCheckFnLangItem, // 24
64-
ExchangeMallocFnLangItem, // 25
65-
ClosureExchangeMallocFnLangItem, // 26
66-
ExchangeFreeFnLangItem, // 27
67-
MallocFnLangItem, // 28
68-
FreeFnLangItem, // 29
69-
BorrowAsImmFnLangItem, // 30
70-
BorrowAsMutFnLangItem, // 31
71-
ReturnToMutFnLangItem, // 32
72-
CheckNotBorrowedFnLangItem, // 33
73-
StrDupUniqFnLangItem, // 34
74-
RecordBorrowFnLangItem, // 35
75-
UnrecordBorrowFnLangItem, // 36
76-
77-
StartFnLangItem, // 37
78-
79-
TyDescStructLangItem, // 38
80-
TyVisitorTraitLangItem, // 39
81-
OpaqueStructLangItem, // 40
60+
LogTypeFnLangItem, // 21
61+
FailFnLangItem, // 22
62+
FailBoundsCheckFnLangItem, // 23
63+
ExchangeMallocFnLangItem, // 24
64+
ClosureExchangeMallocFnLangItem, // 25
65+
ExchangeFreeFnLangItem, // 26
66+
MallocFnLangItem, // 27
67+
FreeFnLangItem, // 28
68+
BorrowAsImmFnLangItem, // 29
69+
BorrowAsMutFnLangItem, // 30
70+
ReturnToMutFnLangItem, // 31
71+
CheckNotBorrowedFnLangItem, // 32
72+
StrDupUniqFnLangItem, // 33
73+
RecordBorrowFnLangItem, // 34
74+
UnrecordBorrowFnLangItem, // 35
75+
76+
StartFnLangItem, // 36
77+
78+
TyDescStructLangItem, // 37
79+
TyVisitorTraitLangItem, // 38
80+
OpaqueStructLangItem, // 39
8281
}
8382

8483
pub struct LanguageItems {
@@ -122,28 +121,27 @@ impl LanguageItems {
122121

123122
19 => "str_eq",
124123
20 => "uniq_str_eq",
125-
21 => "annihilate",
126-
22 => "log_type",
127-
23 => "fail_",
128-
24 => "fail_bounds_check",
129-
25 => "exchange_malloc",
130-
26 => "closure_exchange_malloc",
131-
27 => "exchange_free",
132-
28 => "malloc",
133-
29 => "free",
134-
30 => "borrow_as_imm",
135-
31 => "borrow_as_mut",
136-
32 => "return_to_mut",
137-
33 => "check_not_borrowed",
138-
34 => "strdup_uniq",
139-
35 => "record_borrow",
140-
36 => "unrecord_borrow",
141-
142-
37 => "start",
143-
144-
38 => "ty_desc",
145-
39 => "ty_visitor",
146-
40 => "opaque",
124+
21 => "log_type",
125+
22 => "fail_",
126+
23 => "fail_bounds_check",
127+
24 => "exchange_malloc",
128+
25 => "closure_exchange_malloc",
129+
26 => "exchange_free",
130+
27 => "malloc",
131+
28 => "free",
132+
29 => "borrow_as_imm",
133+
30 => "borrow_as_mut",
134+
31 => "return_to_mut",
135+
32 => "check_not_borrowed",
136+
33 => "strdup_uniq",
137+
34 => "record_borrow",
138+
35 => "unrecord_borrow",
139+
140+
36 => "start",
141+
142+
37 => "ty_desc",
143+
38 => "ty_visitor",
144+
39 => "opaque",
147145

148146
_ => "???"
149147
}
@@ -226,9 +224,6 @@ impl LanguageItems {
226224
pub fn uniq_str_eq_fn(&self) -> Option<def_id> {
227225
self.items[UniqStrEqFnLangItem as uint]
228226
}
229-
pub fn annihilate_fn(&self) -> Option<def_id> {
230-
self.items[AnnihilateFnLangItem as uint]
231-
}
232227
pub fn log_type_fn(&self) -> Option<def_id> {
233228
self.items[LogTypeFnLangItem as uint]
234229
}
@@ -327,7 +322,6 @@ impl<'self> LanguageItemCollector<'self> {
327322

328323
item_refs.insert(@"str_eq", StrEqFnLangItem as uint);
329324
item_refs.insert(@"uniq_str_eq", UniqStrEqFnLangItem as uint);
330-
item_refs.insert(@"annihilate", AnnihilateFnLangItem as uint);
331325
item_refs.insert(@"log_type", LogTypeFnLangItem as uint);
332326
item_refs.insert(@"fail_", FailFnLangItem as uint);
333327
item_refs.insert(@"fail_bounds_check",

src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,24 +2906,12 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
29062906
}
29072907
subcrates.push(C_int(ccx, 0));
29082908

2909-
let llannihilatefn = match ccx.tcx.lang_items.annihilate_fn() {
2910-
Some(annihilate_def_id) => {
2911-
if annihilate_def_id.crate == ast::LOCAL_CRATE {
2912-
get_item_val(ccx, annihilate_def_id.node)
2913-
} else {
2914-
let annihilate_fn_type = csearch::get_type(ccx.tcx,
2915-
annihilate_def_id).ty;
2916-
trans_external_path(ccx, annihilate_def_id, annihilate_fn_type)
2917-
}
2918-
}
2919-
None => { C_null(Type::i8p()) }
2920-
};
2921-
29222909
unsafe {
29232910
let mod_map = create_module_map(ccx);
29242911
llvm::LLVMSetInitializer(map, C_struct(
29252912
[C_i32(1),
2926-
lib::llvm::llvm::LLVMConstPointerCast(llannihilatefn, Type::i8p().to_ref()),
2913+
// FIXME #8431 This used to be the annihilate function, now it's nothing
2914+
C_null(Type::i8p()),
29272915
p2i(ccx, mod_map),
29282916
C_array(ccx.int_type, subcrates)]));
29292917
}

src/libstd/unstable/lang.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ pub unsafe fn check_not_borrowed(a: *u8,
9292
borrowck::check_not_borrowed(a, file, line)
9393
}
9494

95-
#[lang="annihilate"]
96-
pub unsafe fn annihilate() {
97-
::cleanup::annihilate()
98-
}
99-
10095
#[lang="start"]
10196
pub fn start(main: *u8, argc: int, argv: **c_char,
10297
crate_map: *u8) -> int {

src/rt/boxed_region.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "memory_region.h"
1212
#include "boxed_region.h"
1313
#include "rust_globals.h"
14-
#include "rust_env.h"
1514
#include "rust_util.h"
1615

1716
// #define DUMP_BOXED_REGION

src/rt/rust_builtin.cpp

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,47 @@ rust_running_on_valgrind() {
571571
return RUNNING_ON_VALGRIND;
572572
}
573573

574-
extern int get_num_cpus();
574+
#if defined(__WIN32__)
575+
int
576+
get_num_cpus() {
577+
SYSTEM_INFO sysinfo;
578+
GetSystemInfo(&sysinfo);
579+
580+
return (int) sysinfo.dwNumberOfProcessors;
581+
}
582+
#elif defined(__BSD__)
583+
int
584+
get_num_cpus() {
585+
/* swiped from http://stackoverflow.com/questions/150355/
586+
programmatically-find-the-number-of-cores-on-a-machine */
587+
588+
unsigned int numCPU;
589+
int mib[4];
590+
size_t len = sizeof(numCPU);
591+
592+
/* set the mib for hw.ncpu */
593+
mib[0] = CTL_HW;
594+
mib[1] = HW_AVAILCPU; // alternatively, try HW_NCPU;
595+
596+
/* get the number of CPUs from the system */
597+
sysctl(mib, 2, &numCPU, &len, NULL, 0);
598+
599+
if( numCPU < 1 ) {
600+
mib[1] = HW_NCPU;
601+
sysctl( mib, 2, &numCPU, &len, NULL, 0 );
602+
603+
if( numCPU < 1 ) {
604+
numCPU = 1;
605+
}
606+
}
607+
return numCPU;
608+
}
609+
#elif defined(__GNUC__)
610+
int
611+
get_num_cpus() {
612+
return sysconf(_SC_NPROCESSORS_ONLN);
613+
}
614+
#endif
575615

576616
extern "C" CDECL uintptr_t
577617
rust_get_num_cpus() {
@@ -629,6 +669,28 @@ rust_get_task() {
629669
return 0;
630670
}
631671

672+
static lock_and_signal env_lock;
673+
674+
extern "C" CDECL void
675+
rust_take_env_lock() {
676+
env_lock.lock();
677+
}
678+
679+
extern "C" CDECL void
680+
rust_drop_env_lock() {
681+
env_lock.unlock();
682+
}
683+
684+
extern "C" CDECL unsigned int
685+
rust_valgrind_stack_register(void *start, void *end) {
686+
return VALGRIND_STACK_REGISTER(start, end);
687+
}
688+
689+
extern "C" CDECL void
690+
rust_valgrind_stack_deregister(unsigned int id) {
691+
VALGRIND_STACK_DEREGISTER(id);
692+
}
693+
632694
//
633695
// Local Variables:
634696
// mode: C++

0 commit comments

Comments
 (0)