diff --git a/language_spec.md b/language_spec.md index 0e45dbf4ac71ae535689eb6b144b172bfd766e79..bfe27ca03b681309b0fe025e69a98d80caf91ab0 100644 --- a/language_spec.md +++ b/language_spec.md @@ -73,7 +73,6 @@ int-hex-constant = "0x" int-hex-char (int-hex-char | "_")* // 0xFEFE_1337 int-constant = int-bin-constant | int-oct-constant | int-dec-constant | int-hex-constant // Floating point numbers -// TODO: Maybe support exponential notation? Seems silly for a networking // language, but might be useful? float-constant = DIGIT* "." DIGIT+ @@ -264,8 +263,6 @@ stmt = block | "new" cwb method-expr cw ";" | expr cw ";" -// TODO: Add all the other expressions -// TODO: Also: add struct construction and enum construction method-params-list = "(" cw (expr (cw "," cw expr)* )? cw ")" method-expr = method cw method-params-list diff --git a/src/collections/freelist.rs b/src/collections/freelist.rs index 11043c432b7d465abdfe5796570981706d5e23e0..cd96efc1d7cef04aaaaf558d579e121142566fdd 100644 --- a/src/collections/freelist.rs +++ b/src/collections/freelist.rs @@ -20,7 +20,6 @@ pub struct Key { /// Generic freelist structure. Item insertion/retrieval/deletion works like a /// HashMap through keys. -/// TODO: Use alloc::raw_vec::RawVec once stable and accessible pub struct FreeList { items: *mut Entry, capacity: usize, diff --git a/src/collections/mod.rs b/src/collections/mod.rs index dedba6bf5a17af413d57f54ac8858eebf0b38fbe..df772f4aea8eb0269a93012cd581299a8ebe9830 100644 --- a/src/collections/mod.rs +++ b/src/collections/mod.rs @@ -3,7 +3,6 @@ mod scoped_buffer; mod sets; mod raw_vec; -// TODO: Finish this later, use alloc::alloc and alloc::Layout // mod freelist; pub(crate) use string_pool::{StringPool, StringRef}; diff --git a/src/collections/string_pool.rs b/src/collections/string_pool.rs index 2b9f7856adfdc27897aa5027b8f5bbb8d55d1255..9d9996821f2ac58195c24b66cccccb664328fa42 100644 --- a/src/collections/string_pool.rs +++ b/src/collections/string_pool.rs @@ -107,9 +107,8 @@ impl StringPool { /// reallocate/deallocate until dropped (which only happens at the end of /// the program.) pub(crate) fn intern(&mut self, data: &[u8]) -> StringRef<'static> { - // TODO: Large string allocations, if ever needed. let data_len = data.len(); - assert!(data_len <= SLAB_SIZE, "string is too large for slab"); + assert!(data_len <= SLAB_SIZE, "string is too large for slab"); // if you hit this, create logic for large-string allocations debug_assert!(std::str::from_utf8(data).is_ok(), "string to intern is not valid UTF-8 encoded"); let mut last = unsafe{&mut *self.last}; diff --git a/src/protocol/ast.rs b/src/protocol/ast.rs index d13858742e9dfebef5e58077d83232985bbdd954..c9a3b7df8f7d7f790269307323008e0849b06bf0 100644 --- a/src/protocol/ast.rs +++ b/src/protocol/ast.rs @@ -1,6 +1,3 @@ -// TODO: @cleanup, rigorous cleanup of dead code and silly object-oriented -// trait impls where I deem them unfit. - use std::fmt; use std::fmt::{Debug, Display, Formatter}; use std::ops::{Index, IndexMut}; @@ -404,7 +401,6 @@ impl ParserTypeVariant { /// the compiler. #[derive(Debug, Clone)] pub struct ParserTypeElement { - // TODO: @Fix span pub element_span: InputSpan, // span of this element, not including the child types pub variant: ParserTypeVariant, } @@ -1433,7 +1429,6 @@ impl Expression { } } - // TODO: @cleanup pub fn parent(&self) -> &ExpressionParent { match self { Expression::Assignment(expr) => &expr.parent, @@ -1450,7 +1445,7 @@ impl Expression { Expression::Variable(expr) => &expr.parent, } } - // TODO: @cleanup + pub fn parent_expr_id(&self) -> Option { if let ExpressionParent::Expression(id, _) = self.parent() { Some(*id) diff --git a/src/protocol/ast_printer.rs b/src/protocol/ast_printer.rs index 6aff2810101c2a5143012ad83ec80eaa21cd852d..39b07471376447c480a689b14a1ab620e03163ca 100644 --- a/src/protocol/ast_printer.rs +++ b/src/protocol/ast_printer.rs @@ -887,7 +887,6 @@ fn write_parser_type(target: &mut String, heap: &Heap, t: &ParserType) { write_element(target, heap, t, 0); } -// TODO: @Cleanup, this is littered at three places in the codebase fn write_concrete_type(target: &mut String, heap: &Heap, def_id: DefinitionId, t: &ConcreteType) { use ConcreteTypePart as CTP; diff --git a/src/protocol/eval/value.rs b/src/protocol/eval/value.rs index 00d546ed6bc96ec19ea274d58225d0ea273773cf..a6fe4c77fe73edefead5449a99c6b78ca8bfc5f7 100644 --- a/src/protocol/eval/value.rs +++ b/src/protocol/eval/value.rs @@ -437,7 +437,6 @@ pub(crate) fn apply_binary_operator(store: &mut Store, lhs: &Value, op: BinaryOp let lhs_heap_pos = lhs_heap_pos as usize; let rhs_heap_pos = rhs_heap_pos as usize; - // TODO: I hate this, but fine... let mut concatenated = Vec::new(); let lhs_len = store.heap_regions[lhs_heap_pos].values.len(); let rhs_len = store.heap_regions[rhs_heap_pos].values.len(); diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index bdf9a9cb2b715ca4b6dc13ab5267ff845deac23b..1f2b33ede745d27fc1336470d05211b5532a8ccf 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -61,10 +61,7 @@ impl std::fmt::Debug for ProtocolDescription { } } impl ProtocolDescription { - // TODO: Allow for multi-file compilation pub fn parse(buffer: &[u8]) -> Result { - // TODO: @fixme, keep code compilable, but needs support for multiple - // input files. let source = InputSource::new(String::new(), Vec::from(buffer)); let mut parser = Parser::new(); parser.feed(source).expect("failed to feed source"); @@ -158,7 +155,7 @@ impl ProtocolDescription { let module_root = self.lookup_module_root(module_name).unwrap(); let root = &self.heap[module_root]; let def = root.get_definition_ident(&self.heap, identifier).unwrap(); - // TODO: Check for polymorph + ComponentState { prompt: Prompt::new(&self.types, &self.heap, def, 0, ValueGroup::new_stack(args)) } } @@ -291,7 +288,6 @@ impl ProtocolDescription { } } -// TODO: @temp Should just become a concrete thing that is passed in pub trait RunContext { fn performed_put(&mut self, port: PortId) -> bool; fn performed_get(&mut self, port: PortId) -> Option; // None if still waiting on message @@ -325,12 +321,10 @@ impl ComponentState { let step_result = self.prompt.step(&pd.types, &pd.heap, &pd.modules, ctx); match step_result { Err(reason) => { - // TODO: @temp println!("Evaluation error:\n{}", reason); todo!("proper error handling/bubbling up"); }, Ok(continuation) => match continuation { - // TODO: Probably want to remove this translation EC::Stepping => continue, EC::BranchInconsistent => return RR::BranchInconsistent, EC::ComponentTerminated => return RR::ComponentTerminated, @@ -376,7 +370,7 @@ impl ComponentState { // Not possible to end sync block if never entered one EvalContinuation::SyncBlockEnd => unreachable!(), EvalContinuation::NewComponent(definition_id, monomorph_idx, args) => { - // Look up definition (TODO for now, assume it is a definition) + // Look up definition let mut moved_ports = HashSet::new(); for arg in args.values.iter() { match arg { @@ -549,13 +543,6 @@ impl RunContext for EvalContext<'_> { // TODO: @remove once old runtime has disappeared impl EvalContext<'_> { - // fn random(&mut self) -> LongValue { - // match self { - // // EvalContext::None => unreachable!(), - // EvalContext::Nonsync(_context) => todo!(), - // EvalContext::Sync(_) => unreachable!(), - // } - // } fn new_component(&mut self, moved_ports: HashSet, init_state: ComponentState) -> () { match self { EvalContext::None => unreachable!(), diff --git a/src/protocol/parser/mod.rs b/src/protocol/parser/mod.rs index 396e9cbde8900e54e00332b8b224483e1430188d..5da7873cd080decd8d107c3d64530e7c129a254a 100644 --- a/src/protocol/parser/mod.rs +++ b/src/protocol/parser/mod.rs @@ -172,7 +172,6 @@ impl Parser { } pub fn feed(&mut self, mut source: InputSource) -> Result<(), ParseError> { - // TODO: @Optimize let mut token_buffer = TokenBuffer::new(); self.pass_tokenizer.tokenize(&mut source, &mut token_buffer)?; diff --git a/src/protocol/parser/pass_definitions.rs b/src/protocol/parser/pass_definitions.rs index a96d0f2df6f0cca3f62ea4f1017449ab885b0f2f..c35967df9b31f6f355d7c5793502e07fac428c8d 100644 --- a/src/protocol/parser/pass_definitions.rs +++ b/src/protocol/parser/pass_definitions.rs @@ -280,7 +280,6 @@ impl PassDefinitions { )?; let return_types = return_types.into_vec(); - // TODO: @ReturnValues match return_types.len() { 0 => return Err(ParseError::new_error_str_at_pos(&module.source, open_curly_pos, "expected a return type")), 1 => {}, diff --git a/src/protocol/parser/pass_tokenizer.rs b/src/protocol/parser/pass_tokenizer.rs index 86649664d3562b13ba6bf7e31a3c513dd9bc386c..d6f457a90a4963c90a0f36bb011df94335f6e695 100644 --- a/src/protocol/parser/pass_tokenizer.rs +++ b/src/protocol/parser/pass_tokenizer.rs @@ -157,36 +157,6 @@ impl PassTokenizer { self.add_code_range(target, 0, last_registered_idx, last_token_idx, NO_RELATION); } - // TODO: @remove once I'm sure the algorithm works. For now it is better - // if the debugging is a little more expedient - if cfg!(debug_assertions) { - // For each range make sure its children make sense - for parent_idx in 0..target.ranges.len() { - let cur_range = &target.ranges[parent_idx]; - if cur_range.num_child_ranges == 0 { - assert_eq!(cur_range.first_child_idx, NO_RELATION); - assert_eq!(cur_range.last_child_idx, NO_RELATION); - } else { - assert_ne!(cur_range.first_child_idx, NO_RELATION); - assert_ne!(cur_range.last_child_idx, NO_RELATION); - - let mut child_counter = 0u32; - let mut last_valid_child_idx = cur_range.first_child_idx; - let mut child_idx = cur_range.first_child_idx; - while child_idx != NO_RELATION { - let child_range = &target.ranges[child_idx as usize]; - assert_eq!(child_range.parent_idx, parent_idx as i32); - last_valid_child_idx = child_idx; - child_idx = child_range.next_sibling_idx; - child_counter += 1; - } - - assert_eq!(cur_range.last_child_idx, last_valid_child_idx); - assert_eq!(cur_range.num_child_ranges, child_counter); - } - } - } - Ok(()) } diff --git a/src/protocol/parser/pass_typing.rs b/src/protocol/parser/pass_typing.rs index 57d1fa8f05ffe09da37549dae45a3c87dbe2e662..268f0d7aed1853aa02b0ef081708c6f585bea0d0 100644 --- a/src/protocol/parser/pass_typing.rs +++ b/src/protocol/parser/pass_typing.rs @@ -917,8 +917,6 @@ impl PassTyping { } } - // TODO: @cleanup Unsure about this, maybe a pattern will arise after - // a while. pub(crate) fn queue_module_definitions(ctx: &mut Ctx, queue: &mut ResolveQueue) { debug_assert_eq!(ctx.module().phase, ModuleCompilationPhase::ValidatedAndLinked); let root_id = ctx.module().root_id; diff --git a/src/protocol/parser/token_parsing.rs b/src/protocol/parser/token_parsing.rs index f9cc693182f025fbfb9491ebd2fc4fc60a59ebca..86176ef6bf8a7a5d9982069c185d4feb5a0aa2f0 100644 --- a/src/protocol/parser/token_parsing.rs +++ b/src/protocol/parser/token_parsing.rs @@ -287,7 +287,6 @@ pub(crate) fn consume_comma_separated( /// Consumes an integer literal, may be binary, octal, hexadecimal or decimal, /// and may have separating '_'-characters. -/// TODO: @Cleanup, @Performance pub(crate) fn consume_integer_literal(source: &InputSource, iter: &mut TokenIter, buffer: &mut String) -> Result<(u64, InputSpan), ParseError> { if Some(TokenKind::Integer) != iter.next() { return Err(ParseError::new_error_str_at_pos(source, iter.last_valid_pos(), "expected an integer literal")); diff --git a/src/protocol/parser/tokens.rs b/src/protocol/parser/tokens.rs index 5b0e42b581f0bc867a38d59c27ebb4df34984482..107b6a34e08931bb5319971eb0f1f710b44cb668 100644 --- a/src/protocol/parser/tokens.rs +++ b/src/protocol/parser/tokens.rs @@ -300,7 +300,6 @@ impl<'a> TokenIter<'a> { /// Returns the token range belonging to the token returned by `next`. This /// assumes that we're not at the end of the range we're iterating over. - /// TODO: @cleanup Phase out? pub(crate) fn next_positions(&self) -> (InputPosition, InputPosition) { debug_assert!(self.cur < self.end); let token = &self.tokens[self.cur]; diff --git a/src/protocol/parser/type_table.rs b/src/protocol/parser/type_table.rs index 19721bb9ccb96028eb8f9d485923b417863b1995..4e0279c9ac6f3e228a758a9e12ecc5e6f38395fa 100644 --- a/src/protocol/parser/type_table.rs +++ b/src/protocol/parser/type_table.rs @@ -875,7 +875,7 @@ impl TypeTable { let root_id = definition.defined_in; // Check and construct return types and argument types. - debug_assert_eq!(definition.return_types.len(), 1, "not one return type"); // TODO: @ReturnValues + debug_assert_eq!(definition.return_types.len(), 1, "not one return type"); for return_type in &definition.return_types { Self::check_member_parser_type( modules, ctx, root_id, return_type, definition.builtin diff --git a/src/protocol/parser/visitor.rs b/src/protocol/parser/visitor.rs index 0de39881d984f3aee776587344ba09e114f8f21c..d4be7a7575dfc5c54745fa89036dfc7e6e30dde7 100644 --- a/src/protocol/parser/visitor.rs +++ b/src/protocol/parser/visitor.rs @@ -14,7 +14,6 @@ pub(crate) const STMT_BUFFER_INIT_CAPACITY: usize = 256; pub(crate) const EXPR_BUFFER_INIT_CAPACITY: usize = 256; /// General context structure that is used while traversing the AST. -/// TODO: Revise, visitor abstraction is starting to get in the way of programming pub(crate) struct Ctx<'p> { pub heap: &'p mut Heap, pub modules: &'p mut [Module], diff --git a/src/protocol/tests/parser_monomorphs.rs b/src/protocol/tests/parser_monomorphs.rs index a09c038446f1a6a9d08be59b83663768d8265558..21124795a872e9895890e26193f70e957ab9b853 100644 --- a/src/protocol/tests/parser_monomorphs.rs +++ b/src/protocol/tests/parser_monomorphs.rs @@ -88,8 +88,6 @@ fn test_union_monomorphs() { .assert_has_monomorph("Trinary"); }); - // TODO: Does this do what we want? Or do we expect the embedded monomorph - // Result to be instantiated as well? I don't think so. Tester::new_single_source_expect_ok( "polymorphs", " diff --git a/src/runtime2/branch.rs b/src/runtime2/branch.rs index af82ecc0c0e1e6c2f3604af3ca8672e599204a40..8d35090031d08c0ba205df2726d51cf4d9ad5be0 100644 --- a/src/runtime2/branch.rs +++ b/src/runtime2/branch.rs @@ -89,7 +89,7 @@ pub(crate) struct Branch { // Execution state pub code_state: Prompt, pub sync_state: SpeculativeState, - pub awaiting_port: PortIdLocal, // only valid if in "awaiting message" queue. TODO: Maybe put in enum + pub awaiting_port: PortIdLocal, // only valid if in "awaiting message" queue. pub next_in_queue: BranchId, // used by `ExecTree`/`BranchQueue` pub prepared: PreparedStatement, } diff --git a/src/runtime2/connector.rs b/src/runtime2/connector.rs index 4f5521f60edc808741ce681d6e54958fab1466c4..a81a34f5cf77982673af371d6ae6bc0cd04a8e82 100644 --- a/src/runtime2/connector.rs +++ b/src/runtime2/connector.rs @@ -77,7 +77,6 @@ pub(crate) struct ConnectorPDL { last_finished_handled: Option, } -// TODO: Remove remaining fields once 'fires()' is removed from language. struct ConnectorRunContext<'a> { branch_id: BranchId, consensus: &'a Consensus, diff --git a/src/runtime2/consensus.rs b/src/runtime2/consensus.rs index 3dcc486fd31924a0df5c3f1ae47caa13009fbb0f..d7b55d2fd9f7b83af9aa27c2cd7d2059da54efef 100644 --- a/src/runtime2/consensus.rs +++ b/src/runtime2/consensus.rs @@ -121,7 +121,6 @@ impl Consensus { return !self.branch_annotations.is_empty(); } - /// TODO: Remove this once multi-fire is in place #[deprecated] pub fn get_annotation(&self, branch_id: BranchId, channel_id: PortIdLocal) -> &ChannelAnnotation { let branch = &self.branch_annotations[branch_id.index as usize]; diff --git a/src/runtime2/inbox.rs b/src/runtime2/inbox.rs index d3d822a5121b0856daf4a64968aec3ec3b579487..083a4f6fbf0e76faa600e45c79325bd8b33e5d82 100644 --- a/src/runtime2/inbox.rs +++ b/src/runtime2/inbox.rs @@ -9,8 +9,6 @@ use super::ConnectorId; use super::consensus::{GlobalSolution, LocalSolution}; use super::port::PortIdLocal; -// TODO: Remove Debug derive from all types - #[derive(Debug, Copy, Clone)] pub(crate) struct ChannelAnnotation { pub channel_id: ChannelId, diff --git a/src/runtime2/mod.rs b/src/runtime2/mod.rs index 060feaa2aaff8b148d35d7ab0b554120895a197e..de82384c6a9ed35bbe0359ade150be249034e3e0 100644 --- a/src/runtime2/mod.rs +++ b/src/runtime2/mod.rs @@ -509,7 +509,6 @@ impl RuntimeInner { } } -// TODO: Come back to this at some point unsafe impl Send for RuntimeInner {} unsafe impl Sync for RuntimeInner {} diff --git a/src/runtime2/native.rs b/src/runtime2/native.rs index a7bdc3e614ad8ca78aa7ef7aee1d31e5afd455fd..de0d3d27cad4d730d8a1879cd229b9c63c88034d 100644 --- a/src/runtime2/native.rs +++ b/src/runtime2/native.rs @@ -463,7 +463,6 @@ impl ApplicationInterface { /// run the synchronous behaviour in blocking fashion. The results *must* be /// retrieved using `try_wait` or `wait` for the interface to be considered /// in non-sync mode. - // TODO: Maybe change API in the future. For now it does the job pub fn perform_sync_round(&mut self, actions: Vec) -> Result<(), ApplicationStartSyncError> { if self.is_in_sync { return Err(ApplicationStartSyncError::AlreadyInSync); diff --git a/src/runtime2/port.rs b/src/runtime2/port.rs index 428bc23ed5f86e69b08156121aa4b44a37f58c65..41d385c705aa7fe6c90a00e313062cd0f73d5aa1 100644 --- a/src/runtime2/port.rs +++ b/src/runtime2/port.rs @@ -58,7 +58,6 @@ pub struct Port { pub peer_connector: ConnectorId, // might be temporarily inconsistent while peer port is sent around in non-sync phase } -// TODO: Turn port ID into its own type pub struct Channel { pub putter_id: PortIdLocal, // can put on it, so from the connector's point of view, this is an output pub getter_id: PortIdLocal, // vice versa: can get on it, so an input for the connector diff --git a/src/runtime2/scheduler.rs b/src/runtime2/scheduler.rs index e4a3d4d6cefef1cf9392a792a80778a67e54a0fe..6f1e70631389c68c8e28119649d77b76aff2bceb 100644 --- a/src/runtime2/scheduler.rs +++ b/src/runtime2/scheduler.rs @@ -277,10 +277,7 @@ impl Scheduler { // may end up being rerouted. let port_desc = scheduled.ctx.get_port_by_id(content.data_header.sending_port).unwrap(); debug_assert_eq!(port_desc.peer_id, content.data_header.target_port); - - if port_desc.state == PortState::Closed { - todo!("handle sending over a closed port") - } + debug_assert_eq!(port_desc.state, PortState::Open); // checked when adding to context (port_desc.peer_connector, true) }, @@ -294,9 +291,7 @@ impl Scheduler { Message::SyncPort(content) => { let port_desc = scheduled.ctx.get_port_by_id(content.source_port).unwrap(); debug_assert_eq!(port_desc.peer_id, content.target_port); - if port_desc.state == PortState::Closed { - todo!("handle sending over a closed port") - } + debug_assert_eq!(port_desc.state, PortState::Open); // checked when adding to context (port_desc.peer_connector, true) }, @@ -415,7 +410,6 @@ impl Scheduler { } } - // TODO: Remove, this is debugging stuff fn debug(&self, message: &str) { println!("DEBUG [thrd:{:02} conn: ]: {}", self.scheduler_id, message); }