Skip to content

Commit e000d3d

Browse files
committed
---
yaml --- r: 148167 b: refs/heads/try2 c: 587d0f5 h: refs/heads/master i: 148165: 1205bb9 148163: 4f92fa8 148159: 03e33c0 v: v3
1 parent 0974ad9 commit e000d3d

File tree

20 files changed

+213
-206
lines changed

20 files changed

+213
-206
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: 1ea3052f41aaed52429af43304a138e752920959
8+
refs/heads/try2: 587d0f5a3252355c8dd97eec9691e5b60af1cc2a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,11 +782,6 @@ do
782782
# target lib dir
783783
make_dir $h/stage$i/$LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/lib
784784
done
785-
786-
# Fix stage0:
787-
make_dir $h/stage0/$LIBDIR_RELATIVE/rustc/$t/bin
788-
make_dir $h/stage0/$LIBDIR_RELATIVE/rustc/$t/$LIBDIR_RELATIVE
789-
790785
done
791786

792787
make_dir $h/test/run-pass

branches/try2/mk/target.mk

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,14 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
5454
@$$(call E, cp: $$@)
5555
$$(Q)cp $$< $$@
5656

57-
# SNAP a5fa1d9 remove this after the stage0 snapshot from rules below
58-
ifeq ($(1),0)
59-
ifeq ($(3),$$(findstring $(3),$$(NON_BUILD_HOST)))
60-
LFLAGS_$(1)_$(2)_$(3) :=
61-
else
62-
LFLAGS_$(1)_$(2)_$(3) := -L $$(TLIB$(1)_T_$(2)_H_$(3))
63-
endif
64-
else
65-
LFLAGS_$(1)_$(2)_$(3) :=
66-
endif
67-
6857
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
6958
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
7059
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
7160
| $$(TLIB$(1)_T_$(2)_H_$(3))/
7261
@$$(call E, compile_and_link: $$@)
7362
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
7463
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_RGLOB_$(2)),$$(notdir $$@))
75-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $$(LFLAGS_$(1)_$(2)_$(3)) \
64+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
7665
--out-dir $$(@D) $$< && touch $$@
7766
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
7867
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_RGLOB_$(2)),$$(notdir $$@))
@@ -85,7 +74,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
8574
@$$(call E, compile_and_link: $$@)
8675
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
8776
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_RGLOB_$(2)),$$(notdir $$@))
88-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $$(LFLAGS_$(1)_$(2)_$(3)) \
77+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
8978
--out-dir $$(@D) $$< && touch $$@
9079
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
9180
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_RGLOB_$(2)),$$(notdir $$@))
@@ -103,7 +92,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTUV_$(2)): \
10392
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
10493
-L $$(UV_SUPPORT_DIR_$(2)) \
10594
-L $$(dir $$(LIBUV_LIB_$(2))) \
106-
$$(LFLAGS_$(1)_$(2)_$(3)) \
10795
--out-dir $$(@D) $$< && touch $$@
10896
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(2)),$$(notdir $$@))
10997
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(2)),$$(notdir $$@))
@@ -117,7 +105,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBGREEN_$(2)): \
117105
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_GLOB_$(2)),$$(notdir $$@))
118106
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_RGLOB_$(2)),$$(notdir $$@))
119107
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
120-
$$(LFLAGS_$(1)_$(2)_$(3)) \
121108
--out-dir $$(@D) $$< && touch $$@
122109
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_GLOB_$(2)),$$(notdir $$@))
123110
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_RGLOB_$(2)),$$(notdir $$@))
@@ -131,7 +118,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBNATIVE_$(2)): \
131118
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_GLOB_$(2)),$$(notdir $$@))
132119
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_RGLOB_$(2)),$$(notdir $$@))
133120
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
134-
$$(LFLAGS_$(1)_$(2)_$(3)) \
135121
--out-dir $$(@D) $$< && touch $$@
136122
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_GLOB_$(2)),$$(notdir $$@))
137123
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_RGLOB_$(2)),$$(notdir $$@))
@@ -146,7 +132,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
146132
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
147133
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
148134
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) \
149-
$$(LFLAGS_$(1)_$(2)_$(3)) \
150135
--out-dir $$(@D) $$< && touch $$@
151136
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
152137
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
@@ -174,7 +159,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
174159
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
175160
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
176161
-L "$$(LLVM_LIBDIR_$(2))" \
177-
$$(LFLAGS_$(1)_$(2)_$(3)) \
178162
--out-dir $$(@D) $$< && touch $$@
179163
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
180164
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
@@ -185,8 +169,7 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
185169
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
186170
| $$(TBIN$(1)_T_$(2)_H_$(3))/
187171
@$$(call E, compile_and_link: $$@)
188-
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$< \
189-
$$(LFLAGS_$(1)_$(2)_$(3))
172+
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
190173
ifdef CFG_ENABLE_PAX_FLAGS
191174
@$$(call E, apply PaX flags: $$@)
192175
@"$(CFG_PAXCTL)" -cm "$$@"

branches/try2/src/libgreen/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl Runtime for SimpleTask {
7575
fail!()
7676
}
7777
fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> { None }
78-
fn stack_bounds(&self) -> Option<(uint, uint)> { None }
78+
fn stack_bounds(&self) -> (uint, uint) { fail!() }
7979
fn wrap(~self) -> ~Any { fail!() }
8080
}
8181

branches/try2/src/libgreen/task.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,12 @@ impl Runtime for GreenTask {
454454
}
455455
}
456456

457-
fn stack_bounds(&self) -> Option<(uint, uint)> {
458-
self.coroutine.as_ref().map(|c| {
459-
(c.current_stack_segment.start() as uint,
460-
c.current_stack_segment.end() as uint)
461-
})
457+
fn stack_bounds(&self) -> (uint, uint) {
458+
let c = self.coroutine.as_ref()
459+
.expect("GreenTask.stack_bounds called without a coroutine");
460+
461+
(c.current_stack_segment.start() as uint,
462+
c.current_stack_segment.end() as uint)
462463
}
463464

464465
fn wrap(~self) -> ~Any { self as ~Any }

branches/try2/src/libnative/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ mod bookeeping;
3333
pub mod io;
3434
pub mod task;
3535

36+
#[cfg(windows)]
37+
#[cfg(android)]
38+
static OS_DEFAULT_STACK_ESTIMATE: uint = 1 << 20;
39+
#[cfg(unix, not(android))]
40+
static OS_DEFAULT_STACK_ESTIMATE: uint = 2 * (1 << 20);
41+
42+
3643
// XXX: this should not exist here
3744
#[cfg(stage0, nativestart)]
3845
#[lang = "start"]
@@ -66,10 +73,19 @@ pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
6673
/// This function will only return once *all* native threads in the system have
6774
/// exited.
6875
pub fn start(argc: int, argv: **u8, main: proc()) -> int {
76+
let something_around_the_top_of_the_stack = 1;
77+
let addr = &something_around_the_top_of_the_stack as *int;
78+
let my_stack_top = addr as uint;
79+
80+
// FIXME #11359 we just assume that this thread has a stack of a
81+
// certain size, and estimate that there's at most 20KB of stack
82+
// frames above our current position.
83+
let my_stack_bottom = my_stack_top + 20000 - OS_DEFAULT_STACK_ESTIMATE;
84+
6985
rt::init(argc, argv);
7086
let mut exit_code = None;
7187
let mut main = Some(main);
72-
task::new().run(|| {
88+
task::new((my_stack_bottom, my_stack_top)).run(|| {
7389
exit_code = Some(run(main.take_unwrap()));
7490
});
7591
unsafe { rt::cleanup(); }

branches/try2/src/libnative/task.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ use task;
3030
use bookeeping;
3131

3232
/// Creates a new Task which is ready to execute as a 1:1 task.
33-
pub fn new() -> ~Task {
33+
pub fn new(stack_bounds: (uint, uint)) -> ~Task {
3434
let mut task = ~Task::new();
35-
task.put_runtime(ops() as ~rt::Runtime);
35+
let mut ops = ops();
36+
ops.stack_bounds = stack_bounds;
37+
task.put_runtime(ops as ~rt::Runtime);
3638
return task;
3739
}
3840

@@ -41,7 +43,8 @@ fn ops() -> ~Ops {
4143
lock: unsafe { Mutex::new() },
4244
awoken: false,
4345
io: io::IoFactory::new(),
44-
stack_bounds: None,
46+
// these *should* get overwritten
47+
stack_bounds: (0, 0),
4548
}
4649
}
4750

@@ -95,7 +98,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc()) {
9598
stack::record_stack_bounds(my_stack - stack + 1024, my_stack);
9699
}
97100
let mut ops = ops;
98-
ops.stack_bounds = Some((my_stack - stack + 1024, my_stack));
101+
ops.stack_bounds = (my_stack - stack + 1024, my_stack);
99102

100103
let mut f = Some(f);
101104
let mut task = task;
@@ -115,7 +118,7 @@ struct Ops {
115118
// This field holds the known bounds of the stack in (lo, hi) form. Not all
116119
// native tasks necessarily know their precise bounds, hence this is
117120
// optional.
118-
stack_bounds: Option<(uint, uint)>,
121+
stack_bounds: (uint, uint),
119122
}
120123

121124
impl rt::Runtime for Ops {
@@ -137,7 +140,7 @@ impl rt::Runtime for Ops {
137140
self as ~Any
138141
}
139142

140-
fn stack_bounds(&self) -> Option<(uint, uint)> { self.stack_bounds }
143+
fn stack_bounds(&self) -> (uint, uint) { self.stack_bounds }
141144

142145
// This function gets a little interesting. There are a few safety and
143146
// ownership violations going on here, but this is all done in the name of

branches/try2/src/librustc/back/link.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ use syntax::attr::AttrMetaMethods;
4545
use syntax::crateid::CrateId;
4646

4747
#[deriving(Clone, Eq)]
48-
pub enum output_type {
49-
output_type_none,
50-
output_type_bitcode,
51-
output_type_assembly,
52-
output_type_llvm_assembly,
53-
output_type_object,
54-
output_type_exe,
48+
pub enum OutputType {
49+
OutputTypeNone,
50+
OutputTypeBitcode,
51+
OutputTypeAssembly,
52+
OutputTypeLlvmAssembly,
53+
OutputTypeObject,
54+
OutputTypeExe,
5555
}
5656

5757
pub fn llvm_err(sess: Session, msg: ~str) -> ! {
@@ -86,10 +86,10 @@ pub fn WriteOutputFile(
8686
pub mod write {
8787

8888
use back::lto;
89-
use back::link::{WriteOutputFile, output_type};
90-
use back::link::{output_type_assembly, output_type_bitcode};
91-
use back::link::{output_type_exe, output_type_llvm_assembly};
92-
use back::link::{output_type_object};
89+
use back::link::{WriteOutputFile, OutputType};
90+
use back::link::{OutputTypeAssembly, OutputTypeBitcode};
91+
use back::link::{OutputTypeExe, OutputTypeLlvmAssembly};
92+
use back::link::{OutputTypeObject};
9393
use driver::driver::CrateTranslation;
9494
use driver::session::Session;
9595
use driver::session;
@@ -107,7 +107,7 @@ pub mod write {
107107

108108
pub fn run_passes(sess: Session,
109109
trans: &CrateTranslation,
110-
output_type: output_type,
110+
output_type: OutputType,
111111
output: &Path) {
112112
let llmod = trans.module;
113113
let llcx = trans.context;
@@ -225,20 +225,20 @@ pub mod write {
225225

226226
time(sess.time_passes(), "codegen passes", (), |()| {
227227
match output_type {
228-
output_type_none => {}
229-
output_type_bitcode => {
228+
OutputTypeNone => {}
229+
OutputTypeBitcode => {
230230
output.with_c_str(|buf| {
231231
llvm::LLVMWriteBitcodeToFile(llmod, buf);
232232
})
233233
}
234-
output_type_llvm_assembly => {
234+
OutputTypeLlvmAssembly => {
235235
output.with_c_str(|output| {
236236
with_codegen(tm, llmod, |cpm| {
237237
llvm::LLVMRustPrintModule(cpm, llmod, output);
238238
})
239239
})
240240
}
241-
output_type_assembly => {
241+
OutputTypeAssembly => {
242242
with_codegen(tm, llmod, |cpm| {
243243
WriteOutputFile(sess, tm, cpm, llmod, output,
244244
lib::llvm::AssemblyFile);
@@ -248,7 +248,7 @@ pub mod write {
248248
// could be invoked specially with output_type_assembly,
249249
// so in this case we still want the metadata object
250250
// file.
251-
if sess.opts.output_type != output_type_assembly {
251+
if sess.opts.output_type != OutputTypeAssembly {
252252
with_codegen(tm, trans.metadata_module, |cpm| {
253253
let out = output.with_extension("metadata.o");
254254
WriteOutputFile(sess, tm, cpm,
@@ -257,7 +257,7 @@ pub mod write {
257257
})
258258
}
259259
}
260-
output_type_exe | output_type_object => {
260+
OutputTypeExe | OutputTypeObject => {
261261
with_codegen(tm, llmod, |cpm| {
262262
WriteOutputFile(sess, tm, cpm, llmod, output,
263263
lib::llvm::ObjectFile);

branches/try2/src/librustc/driver/driver.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
362362
outputs: &OutputFilenames) {
363363

364364
if sess.no_integrated_as() {
365-
let output_type = link::output_type_assembly;
365+
let output_type = link::OutputTypeAssembly;
366366
let asm_filename = outputs.obj_filename.with_extension("s");
367367

368368
time(sess.time_passes(), "LLVM passes", (), |_|
@@ -424,7 +424,7 @@ pub fn stop_after_phase_2(sess: Session) -> bool {
424424
}
425425

426426
pub fn stop_after_phase_5(sess: Session) -> bool {
427-
if sess.opts.output_type != link::output_type_exe {
427+
if sess.opts.output_type != link::OutputTypeExe {
428428
debug!("not building executable, returning early from compile_input");
429429
return true;
430430
}
@@ -765,17 +765,17 @@ pub fn build_session_options(binary: ~str,
765765

766766
let output_type =
767767
if parse_only || no_trans {
768-
link::output_type_none
768+
link::OutputTypeNone
769769
} else if matches.opt_present("S") &&
770770
matches.opt_present("emit-llvm") {
771-
link::output_type_llvm_assembly
771+
link::OutputTypeLlvmAssembly
772772
} else if matches.opt_present("S") {
773-
link::output_type_assembly
773+
link::OutputTypeAssembly
774774
} else if matches.opt_present("c") {
775-
link::output_type_object
775+
link::OutputTypeObject
776776
} else if matches.opt_present("emit-llvm") {
777-
link::output_type_bitcode
778-
} else { link::output_type_exe };
777+
link::OutputTypeBitcode
778+
} else { link::OutputTypeExe };
779779
let sysroot_opt = matches.opt_str("sysroot").map(|m| @Path::new(m));
780780
let target = matches.opt_str("target").unwrap_or(host_triple());
781781
let target_cpu = matches.opt_str("target-cpu").unwrap_or(~"generic");
@@ -1039,15 +1039,15 @@ pub fn build_output_filenames(input: &input,
10391039
let obj_path;
10401040
let out_path;
10411041
let sopts = sess.opts;
1042-
let stop_after_codegen = sopts.output_type != link::output_type_exe;
1042+
let stop_after_codegen = sopts.output_type != link::OutputTypeExe;
10431043

10441044
let obj_suffix = match sopts.output_type {
1045-
link::output_type_none => ~"none",
1046-
link::output_type_bitcode => ~"bc",
1047-
link::output_type_assembly => ~"s",
1048-
link::output_type_llvm_assembly => ~"ll",
1045+
link::OutputTypeNone => ~"none",
1046+
link::OutputTypeBitcode => ~"bc",
1047+
link::OutputTypeAssembly => ~"s",
1048+
link::OutputTypeLlvmAssembly => ~"ll",
10491049
// Object and exe output both use the '.o' extension here
1050-
link::output_type_object | link::output_type_exe => ~"o"
1050+
link::OutputTypeObject | link::OutputTypeExe => ~"o"
10511051
};
10521052

10531053
match *ofile {

0 commit comments

Comments
 (0)