spawn POC works, likely unsound, cleanup

This commit is contained in:
Per Lindgren 2020-10-05 22:02:04 +02:00
parent 6bd168d711
commit aac97a2109
3 changed files with 0 additions and 81 deletions

View file

@ -20,7 +20,6 @@ mod schedule_body;
mod software_tasks; mod software_tasks;
mod spawn; mod spawn;
mod spawn_body; mod spawn_body;
mod spawn_module;
mod timer_queue; mod timer_queue;
mod util; mod util;

View file

@ -2,7 +2,6 @@ use proc_macro2::TokenStream as TokenStream2;
use quote::quote; use quote::quote;
use rtic_syntax::{ast::App, Context}; use rtic_syntax::{ast::App, Context};
// use crate::{analyze::Analysis, check::Extra, codegen::spawn_module, codegen::util};
use crate::{analyze::Analysis, check::Extra, codegen::util}; use crate::{analyze::Analysis, check::Extra, codegen::util};
pub fn codegen( pub fn codegen(

View file

@ -1,79 +0,0 @@
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use rtic_syntax::{ast::App, Context};
use syn::Ident;
#[allow(unused_imports)]
use crate::{analyze::Analysis, check::Extra, codegen::util};
#[allow(dead_code)]
pub fn codegen(
_spawner: Context,
_name: &Ident,
_app: &App,
_analysis: &Analysis,
_extra: &Extra,
) -> TokenStream2 {
// let spawnee = &app.software_tasks[name];
// let priority = spawnee.args.priority;
// let write_instant = if app.uses_schedule() {
// let instants = util::instants_ident(name);
// Some(quote!(
// #instants.get_unchecked_mut(usize::from(index)).as_mut_ptr().write(instant);
// ))
// } else {
// None
// };
// let t = util::spawn_t_ident(priority);
// let fq = util::fq_ident(name);
// let rq = util::rq_ident(priority);
// let (dequeue, enqueue) = if spawner.is_init() {
// (
// quote!(#fq.dequeue()),
// quote!(#rq.enqueue_unchecked((#t::#name, index));),
// )
// } else {
// (
// quote!((#fq { priority }.lock(|fq| fq.split().1.dequeue()))),
// quote!((#rq { priority }.lock(|rq| {
// rq.split().0.enqueue_unchecked((#t::#name, index))
// }));),
// )
// };
// let device = extra.device;
// let enum_ = util::interrupt_ident();
// let interrupt = &analysis.interrupts.get(&priority);
// let pend = {
// quote!(
// rtic::pend(#device::#enum_::#interrupt);
// )
// };
// let (_, tupled, _, _) = util::regroup_inputs(&spawnee.inputs);
// let inputs = util::inputs_ident(name);
quote!(
// unsafe {
// use rtic::Mutex as _;
// let input = #tupled;
// // // if let Some(index) = #dequeue {
// // // #inputs.get_unchecked_mut(usize::from(index)).as_mut_ptr().write(input);
// // // #write_instant
// // // #enqueue
// // // #pend
// // // Ok(())
// // // } else {
// // // Err(input)
// // // }
// Ok(())
// }
)
}