pub fn compile_fncs<'a>(
    entry: &'static str,
    fnc_names: Vec<&'static str>,
    build_fnc: &'a Fn() -> VM
) -> ll::Library {
    VM::start_logging_trace();

    let vm = Arc::new(build_fnc());
    let compiler = Compiler::new(CompilerPolicy::default(), &vm);

    for func in fnc_names.iter() {
        let func_id = vm.id_of(func);
        let funcs = vm.funcs().read().unwrap();
        let func = funcs.get(&func_id).unwrap().read().unwrap();
        let func_vers = vm.func_vers().read().unwrap();
        let mut func_ver = func_vers
            .get(&func.cur_ver.unwrap())
            .unwrap()
            .write()
            .unwrap();
        compiler.compile(&mut func_ver);
    }

    backend::emit_context(&vm);

    let libname = &get_dylib_name(entry);
    let dylib = aot::link_dylib(fnc_names.iter().map(|x| Mu(x)).collect(), libname, &vm);
    ll::Library::new(dylib.as_os_str()).unwrap()
}
/// builds a bundle (that contains several functions), compiles them,
/// links and loads it as a dynamic library
/// This function is used to test compiler.
//  TODO: should think about using make_boot_image() instead of this adhoc code (Issue #52)
builds a bundle (that contains several functions), compiles them,
links and loads it as a dynamic library
This function is used to test compiler.
TODO: should think about using make_boot_image() instead of this adhoc code (Issue #52)
builds a bundle ( that contains several functions ) compiles them links and loads it as a dynamic library This function is used to test compiler . TODO : should think about using make_boot_image () instead of this adhoc code ( Issue #52 )
pub fn compile_fncs<'a>(
    entry: &'static str,
    fnc_names: Vec<&'static str>,
    build_fnc: &'a Fn() -> VM
) -> ll::Library {
    VM::start_logging_trace();
    let vm = Arc::new(build_fnc());
    let compiler = Compiler::new(CompilerPolicy::default(), &vm);
    for func in fnc_names.iter() {
        let func_id = vm.id_of(func);
        let funcs = vm.funcs().read().unwrap();
        let func = funcs.get(&func_id).unwrap().read().unwrap();
        let func_vers = vm.func_vers().read().unwrap();
        let mut func_ver = func_vers
            .get(&func.cur_ver.unwrap())
            .unwrap()
            .write()
            .unwrap();
        compiler.compile(&mut func_ver);
    }
    backend::emit_context(&vm);
    let libname = &get_dylib_name(entry);
    let dylib = aot::link_dylib(fnc_names.iter().map(|x| Mu(x)).collect(), libname, &vm);
    ll::Library::new(dylib.as_os_str()).unwrap()
}
pub fn compile_fncs < ' a > ( entry : & ' static str , fnc_names : Vec < & ' static str > , build_fnc : & ' a Fn ( ) -> VM ) -> ll :: Library { VM :: start_logging_trace ( ) ; let vm = Arc :: new ( build_fnc ( ) ) ; let compiler = Compiler :: new ( CompilerPolicy :: default ( ) , & vm ) ; for func in fnc_names . iter ( ) { let func_id = vm . id_of ( func ) ; let funcs = vm . funcs ( ) . read ( ) . unwrap ( ) ; let func = funcs . get ( & func_id ) . unwrap ( ) . read ( ) . unwrap ( ) ; let func_vers = vm . func_vers ( ) . read ( ) . unwrap ( ) ; let mut func_ver = func_vers . get ( & func . cur_ver . unwrap ( ) ) . unwrap ( ) . write ( ) . unwrap ( ) ; compiler . compile ( & mut func_ver ) ; } backend :: emit_context ( & vm ) ; let libname = & get_dylib_name ( entry ) ; let dylib = aot :: link_dylib ( fnc_names . iter ( ) . map ( | x | Mu ( x ) ) . collect ( ) , libname , & vm ) ; ll :: Library :: new ( dylib . as_os_str ( ) ) . unwrap ( ) }
builds a bundle (that contains several functions), compiles them,
links and loads it as a dynamic library
This function is used to test compiler.
builds a bundle ( that contains several functions ) compiles them links and loads it as a dynamic library This function is used to test compiler .
entry
&'static str
fnc_names
Vec<&'static str>
build_fnc
&'a Fn() -> VM
entry
&'static str
fnc_names
Vec<&'static str>
build_fnc
&'a Fn() -> VM