diff --git a/src/protocol/eval/executor.rs b/src/protocol/eval/executor.rs index 950826a2f2cf5d4412098f768ba442675b0b27d7..2a77a1ebb0dcb357eb413cd626ea2b65a7abb639 100644 --- a/src/protocol/eval/executor.rs +++ b/src/protocol/eval/executor.rs @@ -27,7 +27,6 @@ pub(crate) enum ExprInstruction { #[derive(Debug, Clone)] pub(crate) struct Frame { pub(crate) definition: ProcedureDefinitionId, - pub(crate) monomorph_type_id: TypeId, pub(crate) monomorph_index: usize, pub(crate) position: StatementId, pub(crate) expr_stack: VecDeque, // hack for expression evaluation, evaluated by popping from back @@ -37,7 +36,7 @@ pub(crate) struct Frame { impl Frame { /// Creates a new execution frame. Does not modify the stack in any way. - pub fn new(heap: &Heap, definition_id: ProcedureDefinitionId, monomorph_type_id: TypeId, monomorph_index: u32) -> Self { + pub fn new(heap: &Heap, definition_id: ProcedureDefinitionId, _monomorph_type_id: TypeId, monomorph_index: u32) -> Self { let definition = &heap[definition_id]; let outer_scope_id = definition.scope; let first_statement_id = definition.body; @@ -62,7 +61,6 @@ impl Frame { Frame{ definition: definition_id, - monomorph_type_id, monomorph_index: monomorph_index as usize, position: first_statement_id.upcast(), expr_stack: VecDeque::with_capacity(128), diff --git a/src/protocol/parser/pass_rewriting.rs b/src/protocol/parser/pass_rewriting.rs index ccbfca20870bad54d815d7c84983fd2c025bb478..a9f869d38c905cdbbe880ecdbd4bc522a8bf5b82 100644 --- a/src/protocol/parser/pass_rewriting.rs +++ b/src/protocol/parser/pass_rewriting.rs @@ -267,7 +267,7 @@ impl Visitor for PassRewriting { // Now we transform each of the select block case's guard and code into // a chained if-else statement. - let mut relative_pos = transformed_stmts.len() as i32; + let relative_pos = transformed_stmts.len() as i32; if total_num_cases > 0 { let (if_stmt_id, end_if_stmt_id, scope_id) = transform_select_case_code(ctx, self.current_procedure_id, id, 0, select_variable_id, select_variable_type); link_existing_child_to_new_parent_scope(ctx, &mut self.scope_buffer, outer_scope_id, scope_id, relative_pos); diff --git a/src/protocol/parser/pass_validation_linking.rs b/src/protocol/parser/pass_validation_linking.rs index 697c6770543d5178b575178b9d5f84d83ac7556e..5490af080f9b8eec88f98caa0ec7b0be6ad14862 100644 --- a/src/protocol/parser/pass_validation_linking.rs +++ b/src/protocol/parser/pass_validation_linking.rs @@ -1293,11 +1293,11 @@ impl Visitor for PassValidationLinking { debug_assert_eq!(idx, 0); true } - Expression::Literal(lit_expr) => { + Expression::Literal(_lit_expr) => { // Only struct, unions, tuples and arrays can // have subexpressions, so we're always fine dbg_code!({ - match lit_expr.value { + match _lit_expr.value { Literal::Struct(_) | Literal::Union(_) | Literal::Array(_) | Literal::Tuple(_) => {}, _ => unreachable!(), } diff --git a/src/protocol/parser/type_table.rs b/src/protocol/parser/type_table.rs index 916ebf1f17a37369911fd8167247ac17c60a032f..97ee8c39d8258248411808abf16807bb44fa536f 100644 --- a/src/protocol/parser/type_table.rs +++ b/src/protocol/parser/type_table.rs @@ -57,6 +57,7 @@ use crate::protocol::parser::*; /// appear in the types associated types (function return argument, struct /// field, enum variant, etc.). Otherwise the polymorphic argument is just a /// marker and does not influence the bytesize of the type. +#[allow(unused)] pub struct DefinedType { pub(crate) ast_root: RootId, pub(crate) ast_definition: DefinitionId, @@ -1455,8 +1456,6 @@ impl TypeTable { breadcrumbs: &[TypeLoopBreadcrumb], definition_map: &DefinitionMap, mono_type_map: &MonoTypeMap, mono_key: &mut MonoSearchKey, concrete_type: &ConcreteType ) -> TypeLoopResult { - use ConcreteTypePart as CTP; - // Depending on the type, lookup if the type has already been visited // (i.e. either already has its memory layed out, or is part of a type // loop because we've already visited the type) diff --git a/src/runtime/scheduler.rs b/src/runtime/scheduler.rs index bab05fc9a171dd65bee3c1216149a2f73e299cf8..6b42182bc54689cd30602bba09ee2c84059ee3c4 100644 --- a/src/runtime/scheduler.rs +++ b/src/runtime/scheduler.rs @@ -410,11 +410,11 @@ impl Scheduler { } } - fn debug(&self, message: &str) { + fn debug(&self, _message: &str) { // println!("DEBUG [thrd:{:02} conn: ]: {}", self.scheduler_id, message); } - fn debug_conn(&self, conn: ConnectorId, message: &str) { + fn debug_conn(&self, _conn: ConnectorId, _message: &str) { // println!("DEBUG [thrd:{:02} conn:{:02}]: {}", self.scheduler_id, conn.index, message); } } diff --git a/src/runtime2/component/component_context.rs b/src/runtime2/component/component_context.rs index ecd0823e7b5b49bb3004d6273b0adc5c11692fbd..f419c322f5e4d68297549ccc137e412065c5c568 100644 --- a/src/runtime2/component/component_context.rs +++ b/src/runtime2/component/component_context.rs @@ -58,7 +58,7 @@ impl CompCtx { kind: PortKind::Putter, state: PortState::Open, peer_comp_id: self.id, - associated_with_peer: false, + #[cfg(debug_assertions)] associated_with_peer: false, }); self.ports.push(Port{ self_id: getter_id, @@ -66,7 +66,7 @@ impl CompCtx { kind: PortKind::Getter, state: PortState::Open, peer_comp_id: self.id, - associated_with_peer: false, + #[cfg(debug_assertions)] associated_with_peer: false, }); return Channel{ putter_id, getter_id }; @@ -86,7 +86,7 @@ impl CompCtx { pub(crate) fn remove_port(&mut self, port_handle: LocalPortHandle) -> Port { let port_index = self.must_get_port_index(port_handle); let port = self.ports.remove(port_index); - debug_assert!(!port.associated_with_peer); + dbg_code!(assert!(!port.associated_with_peer)); return port; } @@ -98,7 +98,7 @@ impl CompCtx { let self_id = self.id; let port = self.get_port_mut(port_handle); debug_assert_eq!(port.peer_comp_id, peer_comp_id); - debug_assert!(!port.associated_with_peer); + dbg_code!(assert!(!port.associated_with_peer)); if !Self::requires_peer_reference(port, self_id, false) { return; } @@ -132,7 +132,7 @@ impl CompCtx { return; } - debug_assert!(port.associated_with_peer); + dbg_code!(assert!(port.associated_with_peer)); dbg_code!(port.associated_with_peer = false); let peer_index = self.get_peer_index_by_id(peer_id).unwrap(); let peer = &mut self.peers[peer_index]; diff --git a/src/runtime2/runtime.rs b/src/runtime2/runtime.rs index f3c46ebbe11ba125623ae42974df250a3e758ddc..38fb4285d79bbf01c669157a3708ecefd83826a0 100644 --- a/src/runtime2/runtime.rs +++ b/src/runtime2/runtime.rs @@ -109,7 +109,7 @@ impl CompHandle { /// Returns the `CompKey` to the component if it should be destroyed pub(crate) fn decrement_users(&mut self) -> Option { - debug_assert!(!self.decremented, "illegal to 'decrement_users' twice"); + dbg_code!(assert!(self.decremented, "illegal to 'decrement_users' twice")); let old_count = self.num_handles.fetch_sub(1, Ordering::AcqRel); let new_count = old_count - 1; dbg_code!(self.decremented = true); @@ -123,7 +123,7 @@ impl CompHandle { impl Clone for CompHandle { fn clone(&self) -> Self { - debug_assert!(!self.decremented, "illegal to clone after 'decrement_users'"); + dbg_code!(assert!(!self.decremented, "illegal to clone after 'decrement_users'")); self.increment_users(); return CompHandle{ target: self.target, @@ -137,14 +137,14 @@ impl std::ops::Deref for CompHandle { type Target = CompPublic; fn deref(&self) -> &Self::Target { - debug_assert!(!self.decremented); // cannot access if control is relinquished + dbg_code!(assert!(!self.decremented)); // cannot access if control is relinquished return unsafe{ &*self.target }; } } impl Drop for CompHandle { fn drop(&mut self) { - debug_assert!(self.decremented, "need call to 'decrement_users' before dropping"); + dbg_code!(assert!(self.decremented, "need call to 'decrement_users' before dropping")); } } diff --git a/src/runtime2/scheduler.rs b/src/runtime2/scheduler.rs index b27cf5d06aa3b7636674263fd866508504b4317a..e7359488f13d940ccc259ceabb1cb744c0b6de23 100644 --- a/src/runtime2/scheduler.rs +++ b/src/runtime2/scheduler.rs @@ -33,13 +33,6 @@ impl<'a> SchedulerCtx<'a> { println!("[s:{:02}, c:{:03}] {}", self.id, self.comp, text); } } - - // TODO: Obviously remove, but useful for testing - pub(crate) fn log_special(&self, text: &str) { - if self.logging_enabled { - println!("[s:{:02}, c:{:03}] *** *** {}", self.id, self.comp, text); - } - } } impl Scheduler { diff --git a/src/runtime2/store/component.rs b/src/runtime2/store/component.rs index 65e0bbc75d1999b762b56ff7a78cc44f5cb36c2c..8288781e4e2b9402120206bf8246c3ef6d3d622c 100644 --- a/src/runtime2/store/component.rs +++ b/src/runtime2/store/component.rs @@ -86,7 +86,7 @@ impl ComponentReservation { impl Drop for ComponentReservation { fn drop(&mut self) { - debug_assert!(self.submitted); + dbg_code!( assert!(self.submitted) ); } } @@ -187,12 +187,15 @@ impl ComponentStore { loop { let preemptive_read = shared_lock.freelist[read_index & shared_lock.index_mask]; - if let Err(actual_read_index) = self.read_head.compare_exchange( + if let Err(_actual_read_index) = self.read_head.compare_exchange( read_index, (read_index + 1) & shared_lock.compare_mask, Ordering::AcqRel, Ordering::Acquire ) { // We need to try again - read_index = actual_read_index; + // TODO: Fix this update loop at some point. When update + // loop is disabled, popping the freelist index is not + // reliable. + // read_index = actual_read_index; continue 'attempt_read; }