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: TThe 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>
impl<T> CompileTarget for SourceMap<T>
Source§type Location = <T as CompileTarget>::Location
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
fn create(symbol_table: SymbolTable) -> Self
Create an empty instance of itself.
fn symbol_table_mut(&mut self) -> &mut SymbolTable
Source§fn set_word(&mut self, loc: &Self::Location, word: i32)
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
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)
fn set_symbol(&mut self, id: SymbolId, loc: &Self::Location)
Declares a new symbol with label
label in location address.fn get_symbol_mut(&mut self, label: SymbolId) -> &mut SymbolInfo
Source§fn to_address(&self, loc: &Self::Location) -> u16
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
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
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 moreAuto Trait Implementations§
impl<T> Freeze for SourceMap<T>where
T: Freeze,
impl<T> RefUnwindSafe for SourceMap<T>
impl<T> Send for SourceMap<T>
impl<T> Sync for SourceMap<T>
impl<T> Unpin for SourceMap<T>
impl<T> UnwindSafe for SourceMap<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more