Skip to content

Commit

Permalink
Meta: update Rust toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinesfilmroellchen committed Sep 13, 2024
1 parent a69a9d2 commit b8cf126
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2024-07-29"
channel = "nightly-2024-09-12"
7 changes: 4 additions & 3 deletions src/assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ pub(crate) fn assemble_from_segments(
assemble_to_data(segments, source_code, options)?.combine_segments()
}

/// Runs the assembler, but does not combine data from different segments afterwards. Therefore, the assembler
/// effectively only runs inside segments. This function might modify the given segments during optimization, and it
/// returns the assembled segments.
/// Runs the assembler, but does not combine data from different segments afterwards.
///
/// Therefore, the assembler effectively only runs inside segments. This function might modify the given segments during
/// optimization, and it returns the assembled segments.
///
/// # Errors
/// Unencodeable instructions will cause errors.
Expand Down
1 change: 1 addition & 0 deletions src/assembler/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub enum TwoOperandEntry {
type Table = HashMap<Mnemonic, EntryOrFirstOperandTable>;

/// The [`ASSEMBLY_TABLE`] static data structure contains mappings from mnemonics and operands to the assembled data.
///
/// This data is given in the form of functions executed on a [`crate::segments::Segments`] instance.
pub static ASSEMBLY_TABLE: LazyLock<Table> = LazyLock::new(|| {
let mut table = HashMap::new();
Expand Down
10 changes: 6 additions & 4 deletions src/brr/dsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ pub fn apply_precise_treble_boost_filter(samples: &[DecodedSample]) -> Vec<Decod
apply_fir_filter(filter, samples)
}

/// Apply an FIR (finite impulse response) filter of arbitrary lookback to the input samples. The input filter only
/// provides one half of the filter coefficients; it is mirrored and used for lookahead the same as for lookback. For
/// example, the third coefficient is both used for `x[i-3]` as well as `x[i+3]` when processing sample number `i`. The
/// zeroth filter coefficient is applied to the sample `x[i]` itself and not involved in mirroring.
/// Apply an FIR (finite impulse response) filter of arbitrary lookback to the input samples.
///
/// The input filter only provides one half of the filter coefficients; it is mirrored and used for lookahead the same
/// as for lookback. For example, the third coefficient is both used for `x[i-3]` as well as `x[i+3]` when processing
/// sample number `i`. The zeroth filter coefficient is applied to the sample `x[i]` itself and not involved in
/// mirroring.
#[must_use]
#[allow(clippy::missing_panics_doc, clippy::range_minus_one)]
pub fn apply_fir_filter<const lookback: usize>(
Expand Down
10 changes: 6 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ use parking_lot::RwLock;

use crate::error::{AssemblyError, ErrorCodes};

/// Interface between the assembler backend and any kind of frontend. There currently are three main frontends: the
/// spcasm compiler command line program, the spcasm-web website in Wasm, and the sals language server. Each frontend
/// has different requirements for how the backend should react in various situations, especially error conditions. The
/// backend passes a reference to the frontend around and calls into it during assembly.
/// Interface between the assembler backend and any kind of frontend.
///
/// There currently are three main frontends: the spcasm compiler command line program, the spcasm-web website in Wasm,
/// and the sals language server. Each frontend has different requirements for how the backend should react in various
/// situations, especially error conditions. The backend passes a reference to the frontend around and calls into it
/// during assembly.
///
/// [`Frontend`] need to additionally implement Send and Sync (since it's used in multi-threaded contexts), and
/// provide debug output.
Expand Down
6 changes: 4 additions & 2 deletions src/directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ use crate::sema::value::{Size, SizedAssemblyTimeValue};
use crate::sema::{self, AssemblyTimeValue, ProgramElement};
use crate::{byte_vec_to_string, span_to_string, AssemblyCode, AssemblyError, Segments};

/// An assembly directive, often confusingly referred to as a "macro". spcasm uses the term "macro" to specifically mean
/// user-defined macros, and "directive" to mean builtin commands (i.e. directives) to the assembler.
/// An assembly directive, often confusingly referred to as a "macro".
///
/// spcasm uses the term "macro" to specifically mean user-defined macros, and "directive" to mean builtin commands
/// (i.e. directives) to the assembler.
#[derive(Clone, Debug)]
pub struct Directive {
/// Actual data of the directive.
Expand Down
10 changes: 6 additions & 4 deletions src/segments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ use crate::assembler::sample_table::SampleTable;
use crate::directive::DirectiveParameterTable;
use crate::sema::instruction::MemoryAddress;

/// Handles binary segments and assembler state. The type of data contained within each segment is the generic
/// parameter; the assembler uses memory values and other analysis passes use other kinds of information per assembled
/// element. Segments provide the datastructure representation of the segment state that the user can manipulate via
/// various segment-related directives. Segments also contain other global state which is modified via directives.
/// Handles binary segments and assembler state.
///
/// The type of data contained within each segment is the generic parameter; the assembler uses memory values and other
/// analysis passes use other kinds of information per assembled element. Segments provide the datastructure
/// representation of the segment state that the user can manipulate via various segment-related directives. Segments
/// also contain other global state which is modified via directives.
#[derive(Debug, Clone)]
pub struct Segments<Contained> {
/// The data segments. These are checked later when being combined into one.
Expand Down
8 changes: 5 additions & 3 deletions src/sema/addressing_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,11 @@ impl Display for AddressingMode {
}
}

/// The categories of addressing modes. This enum is mainly used for the main assembler lookup table to discern which
/// opcode to use. It is mostly just a list of the variants of the [`AddressingMode`] sum type, but it also factors out
/// all register addressing modes separately, as that is very important for opcode generation.
/// The categories of addressing modes.
///
/// This enum is mainly used for the main assembler lookup table to discern which opcode to use. It is mostly just a
/// list of the variants of the [`AddressingMode`] sum type, but it also factors out all register addressing modes
/// separately, as that is very important for opcode generation.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[allow(clippy::module_name_repetitions)]
pub enum AddressingModeCategory {
Expand Down

0 comments on commit b8cf126

Please sign in to comment.