Struct SourceMap

Source
pub struct SourceMap<T: CompileTarget> {
    pub compiled: T,
    pub source_map: HashMap<u16, Span>,
    /* private fields */
}
Expand description

Captures line number information produced during the compilation process and produces a mapping from memory locations into source assembly line numbers.

Line numbers for both instructions and symbols are included.

Fields§

§compiled: T

The actual artifact of the compilation.

§source_map: HashMap<u16, Span>

Map from memory locations into source assembly line numbers.

Trait Implementations§

Source§

impl<T> CompileTarget for SourceMap<T>
where T: CompileTarget, T::Location: Hash + Eq + Clone,

Source§

type Location = <T as CompileTarget>::Location

Represents a position in the data structure. This should not change even if new instructions or data is pushed to the data structure. The actual address of this location in the produced memory dump can change.
Source§

fn create(symbol_table: SymbolTable) -> Self

Create an empty instance of itself.
Source§

fn symbol_table_mut(&mut self) -> &mut SymbolTable

Source§

fn set_word(&mut self, loc: &Self::Location, word: i32)

Sets the word in the location addr to value word.
Source§

fn push_word( &mut self, span: Option<Span>, word: i32, segment: SegmentType, ) -> Self::Location

Pushes a new word to the data structure. The only requirement for the location of the word is that words pushed with segment type SegmentType::Text need to be in consecutive addresses. Read more
Source§

fn set_symbol(&mut self, id: SymbolId, loc: &Self::Location)

Declares a new symbol with label label in location address.
Source§

fn get_symbol_mut(&mut self, label: SymbolId) -> &mut SymbolInfo

Source§

fn to_address(&self, loc: &Self::Location) -> u16

Translates the location loc into a word offset in the memory dump. The location can change after calls to push_word.
Source§

fn finish(self) -> Self

Finalize the compilation. The compiler will not modify the data structure after this.
Source§

fn with_capacity(symbol_table: SymbolTable, _size: u16) -> Self

Create an empty instance of itself with reserved capacity for size words of data. This is just a request or a hint, so this doesn’t need to be actually implemented if the data structure doesn’t support this. Read more

Auto Trait Implementations§

§

impl<T> Freeze for SourceMap<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SourceMap<T>

§

impl<T> Send for SourceMap<T>
where T: Send, <T as CompileTarget>::Location: Send,

§

impl<T> Sync for SourceMap<T>
where T: Sync, <T as CompileTarget>::Location: Sync,

§

impl<T> Unpin for SourceMap<T>
where T: Unpin, <T as CompileTarget>::Location: Unpin,

§

impl<T> UnwindSafe for SourceMap<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,