pub fn compile_fnc<'a>(fnc_name: &'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);
    let func_id = vm.id_of(fnc_name);
    {
        let funcs = vm.funcs().read().unwrap();
        let func = match funcs.get(&func_id) {
            Some(func) => func.read().unwrap(),
            None => panic!("cannot find function {}", fnc_name)
        };

        let cur_ver = match func.cur_ver {
            Some(v) => v,
            None => {
                panic!(
                    "function {} does not have a defined current version",
                    fnc_name
                )
            }
        };

        let func_vers = vm.func_vers().read().unwrap();
        let mut func_ver = match func_vers.get(&cur_ver) {
            Some(fv) => fv.write().unwrap(),
            None => panic!("cannot find function version {}", cur_ver)
        };
        compiler.compile(&mut func_ver);
    }
    backend::emit_context(&vm);
    let libname = &get_dylib_name(fnc_name);
    let dylib = aot::link_dylib(vec![Mu(fnc_name)], libname, &vm);
    ll::Library::new(dylib.as_os_str()).unwrap()
}
/// builds a bundle (that contains a function), compiles it,
/// 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 a function), compiles it,
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 a function ) compiles it 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_fnc<'a>(fnc_name: &'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);
    let func_id = vm.id_of(fnc_name);
    {
        let funcs = vm.funcs().read().unwrap();
        let func = match funcs.get(&func_id) {
            Some(func) => func.read().unwrap(),
            None => panic!("cannot find function {}", fnc_name)
        };
        let cur_ver = match func.cur_ver {
            Some(v) => v,
            None => {
                panic!(
                    "function {} does not have a defined current version",
                    fnc_name
                )
            }
        };
        let func_vers = vm.func_vers().read().unwrap();
        let mut func_ver = match func_vers.get(&cur_ver) {
            Some(fv) => fv.write().unwrap(),
            None => panic!("cannot find function version {}", cur_ver)
        };
        compiler.compile(&mut func_ver);
    }
    backend::emit_context(&vm);
    let libname = &get_dylib_name(fnc_name);
    let dylib = aot::link_dylib(vec![Mu(fnc_name)], libname, &vm);
    ll::Library::new(dylib.as_os_str()).unwrap()
}
pub fn compile_fnc < ' a > ( fnc_name : & ' 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 ) ; let func_id = vm . id_of ( fnc_name ) ; { let funcs = vm . funcs ( ) . read ( ) . unwrap ( ) ; let func = match funcs . get ( & func_id ) { Some ( func ) => func . read ( ) . unwrap ( ) , None => panic ! ( " " fnc_name ) } ; let cur_ver = match func . cur_ver { Some ( v ) => v , None => { panic ! ( " " fnc_name ) } } ; let func_vers = vm . func_vers ( ) . read ( ) . unwrap ( ) ; let mut func_ver = match func_vers . get ( & cur_ver ) { Some ( fv ) => fv . write ( ) . unwrap ( ) , None => panic ! ( " " cur_ver ) } ; compiler . compile ( & mut func_ver ) ; } backend :: emit_context ( & vm ) ; let libname = & get_dylib_name ( fnc_name ) ; let dylib = aot :: link_dylib ( vec ! [ Mu ( fnc_name ) ] , libname , & vm ) ; ll :: Library :: new ( dylib . as_os_str ( ) ) . unwrap ( ) }
builds a bundle (that contains a function), compiles it,
links and loads it as a dynamic library
This function is used to test compiler.
builds a bundle ( that contains a function ) compiles it links and loads it as a dynamic library This function is used to test compiler .
fnc_name
&'static str
build_fnc
&'a Fn() -> VM
fnc_name
&'static str
build_fnc
&'a Fn() -> VM