From aac97a2109f56784adf59cdeba25beef4f18a13a Mon Sep 17 00:00:00 2001 From: Per Lindgren Date: Mon, 5 Oct 2020 22:02:04 +0200 Subject: [PATCH] spawn POC works, likely unsound, cleanup --- macros/src/codegen.rs | 1 - macros/src/codegen/module.rs | 1 - macros/src/codegen/spawn_module.rs | 79 ------------------------------ 3 files changed, 81 deletions(-) delete mode 100644 macros/src/codegen/spawn_module.rs diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index cc173830c9..f230d3956d 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -20,7 +20,6 @@ mod schedule_body; mod software_tasks; mod spawn; mod spawn_body; -mod spawn_module; mod timer_queue; mod util; diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 7298356a48..bba64bb9ac 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -2,7 +2,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; 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}; pub fn codegen( diff --git a/macros/src/codegen/spawn_module.rs b/macros/src/codegen/spawn_module.rs deleted file mode 100644 index 5d3f465257..0000000000 --- a/macros/src/codegen/spawn_module.rs +++ /dev/null @@ -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(()) - // } - ) -}