fn queue_compile_job(&self, trace: IRTrace, hl_ptr: *const HotLocation) {
        let hl_ptr = hl_ptr as usize;

        let do_compile = move || {
            let code_ptr = trace.compile();
            let ct = Box::new(CompiledTrace::new(code_ptr));
            // We can't lock a `HotLocation` directly as the `lock` method is on `Location`. We
            // thus need to create a "fake" / "temporary" `Location` so that we can `lock` it: note
            // that we *must not* `drop` this temporary `Location`, hence the later call to
            // `forget`.
            let tmp_ls = LocationInner::new().with_hotlocation(hl_ptr as *mut HotLocation);
            let tmp_loc = unsafe { Location::from_location_inner(tmp_ls) };
            tmp_loc.lock().unwrap();
            let hl = unsafe { tmp_ls.hot_location() };
            if let HotLocation::Compiling = hl {
                // FIXME: although we've now put the compiled trace into the `HotLocation`, there's
                // no guarantee that the `Location` for which we're compiling will ever be executed
                // again. In such a case, the memory has, in essence, leaked.
                *hl = HotLocation::Compiled(Box::into_raw(ct));
            } else if let HotLocation::Dropped = hl {
                // The Location pointing to this HotLocation was dropped. There's nothing we can do
                // with the compiled trace, so we let it it be implicitly dropped.
            } else {
                unreachable!();
            }
            tmp_loc.unlock();
            forget(tmp_loc);
        };

        #[cfg(feature = "c_testing")]
        if *SERIALISE_COMPILATION {
            do_compile();
            return;
        }

        self.queue_job(Box::new(do_compile));
    }
/// Add a compilation job for `sir` to the global work queue.
Add a compilation job for `sir` to the global work queue.
Add a compilation job for ` sir ` to the global work queue .
fn queue_compile_job(&self, trace: IRTrace, hl_ptr: *const HotLocation) {
        let hl_ptr = hl_ptr as usize;
        let do_compile = move || {
            let code_ptr = trace.compile();
            let ct = Box::new(CompiledTrace::new(code_ptr));
            // We can't lock a `HotLocation` directly as the `lock` method is on `Location`. We
            // thus need to create a "fake" / "temporary" `Location` so that we can `lock` it: note
            // that we *must not* `drop` this temporary `Location`, hence the later call to
            // `forget`.
            let tmp_ls = LocationInner::new().with_hotlocation(hl_ptr as *mut HotLocation);
            let tmp_loc = unsafe { Location::from_location_inner(tmp_ls) };
            tmp_loc.lock().unwrap();
            let hl = unsafe { tmp_ls.hot_location() };
            if let HotLocation::Compiling = hl {
                // FIXME: although we've now put the compiled trace into the `HotLocation`, there's
                // no guarantee that the `Location` for which we're compiling will ever be executed
                // again. In such a case, the memory has, in essence, leaked.
                *hl = HotLocation::Compiled(Box::into_raw(ct));
            } else if let HotLocation::Dropped = hl {
                // The Location pointing to this HotLocation was dropped. There's nothing we can do
                // with the compiled trace, so we let it it be implicitly dropped.
            } else {
                unreachable!();
            }
            tmp_loc.unlock();
            forget(tmp_loc);
        };
        #[cfg(feature = "c_testing")]
        if *SERIALISE_COMPILATION {
            do_compile();
            return;
        }
        self.queue_job(Box::new(do_compile));
    }
fn queue_compile_job ( & self , trace : IRTrace , hl_ptr : * const HotLocation ) { let hl_ptr = hl_ptr as usize ; let do_compile = move | | { let code_ptr = trace . compile ( ) ; let ct = Box :: new ( CompiledTrace :: new ( code_ptr ) ) ; // We can't lock a `HotLocation` directly as the `lock` method is on `Location`. We // thus need to create a "fake" / "temporary" `Location` so that we can `lock` it: note // that we *must not* `drop` this temporary `Location`, hence the later call to // `forget`. let tmp_ls = LocationInner :: new ( ) . with_hotlocation ( hl_ptr as * mut HotLocation ) ; let tmp_loc = unsafe { Location :: from_location_inner ( tmp_ls ) } ; tmp_loc . lock ( ) . unwrap ( ) ; let hl = unsafe { tmp_ls . hot_location ( ) } ; if let HotLocation :: Compiling = hl { // FIXME: although we've now put the compiled trace into the `HotLocation`, there's // no guarantee that the `Location` for which we're compiling will ever be executed // again. In such a case, the memory has, in essence, leaked. * hl = HotLocation :: Compiled ( Box :: into_raw ( ct ) ) ; } else if let HotLocation :: Dropped = hl { // The Location pointing to this HotLocation was dropped. There's nothing we can do // with the compiled trace, so we let it it be implicitly dropped. } else { unreachable ! ( ) ; } tmp_loc . unlock ( ) ; forget ( tmp_loc ) ; } ; # [ cfg ( feature " " ) ] if * SERIALISE_COMPILATION { do_compile ( ) ; return ; } self . queue_job ( Box :: new ( do_compile ) ) ; }
Add a compilation job for `sir` to the global work queue.
Add a compilation job for ` sir ` to the global work queue .
&self
trace
IRTrace
hl_ptr
*const HotLocation
&self
trace
IRTrace
hl_ptr
*const HotLocation