remove useless `rust_main` wrapper

the real entry point will now pass the user's main function directly to
the scheduler
This commit is contained in:
Daniel Micay 2013-09-18 00:54:08 -04:00
parent 4dc3a97698
commit c0cc37b963
1 changed files with 1 additions and 27 deletions

View File

@ -2388,38 +2388,12 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
let et = ccx.sess.entry_type.unwrap();
match et {
session::EntryMain => {
let llfn = create_main(ccx, main_llfn);
create_entry_fn(ccx, llfn, true);
create_entry_fn(ccx, main_llfn, true);
}
session::EntryStart => create_entry_fn(ccx, main_llfn, false),
session::EntryNone => {} // Do nothing.
}
fn create_main(ccx: @mut CrateContext, main_llfn: ValueRef) -> ValueRef {
let nt = ty::mk_nil();
let llfty = type_of_rust_fn(ccx, [], nt);
let llfdecl = decl_fn(ccx.llmod, "_rust_main",
lib::llvm::CCallConv, llfty);
let fcx = new_fn_ctxt(ccx, ~[], llfdecl, nt, None);
// the args vector built in create_entry_fn will need
// be updated if this assertion starts to fail.
assert!(!fcx.caller_expects_out_pointer);
let bcx = fcx.entry_bcx.unwrap();
// Call main.
let llenvarg = unsafe {
let env_arg = fcx.env_arg_pos();
llvm::LLVMGetParam(llfdecl, env_arg as c_uint)
};
let args = ~[llenvarg];
Call(bcx, main_llfn, args, []);
finish_fn(fcx, bcx);
return llfdecl;
}
fn create_entry_fn(ccx: @mut CrateContext,
rust_main: ValueRef,
use_start_lang_item: bool) {