fn write_materialized_instruction_into_bytestream(
    mut bytesteam: &mut Vec<u16>,
    entry: MaterializedInstruction,
    label_map: &mut HashMap<String, u16>,
) {
    let length = entry.len_estimate();
    match entry {
        MaterializedInstruction::Static {
            instruction,
            instruction_word,
            arg1,
            arg2,
        } => {
            trace!(
                "instruction {instruction:?}, len = {words}",
                instruction = instruction,
                words = length
            );
            write_instruction_word_into_bytestream(&mut bytesteam, instruction_word, arg1, arg2)
        }
        MaterializedInstruction::Flexible { instruction, .. } => {
            // We perform a final pass of baking the actual jump addresses
            // into the instructions.
            if let MaterializedInstruction::Flexible {
                instruction,
                instruction_word,
                arg1,
                arg2,
            } = instruction.materialize(&label_map)
            {
                trace!(
                    "instruction {instruction:?}, len = {words}",
                    instruction = instruction,
                    words = length
                );
                write_instruction_word_into_bytestream(&mut bytesteam, instruction_word, arg1, arg2)
            } else {
                unreachable!();
            }
        }
    }
}
/// Writes a materialized instruction into the bytestream.
/// A final pass of jump label address substitution is performed.
Writes a materialized instruction into the bytestream.
A final pass of jump label address substitution is performed.
Writes a materialized instruction into the bytestream . A final pass of jump label address substitution is performed .
fn write_materialized_instruction_into_bytestream(
    mut bytesteam: &mut Vec<u16>,
    entry: MaterializedInstruction,
    label_map: &mut HashMap<String, u16>,
) {
    let length = entry.len_estimate();
    match entry {
        MaterializedInstruction::Static {
            instruction,
            instruction_word,
            arg1,
            arg2,
        } => {
            trace!(
                "instruction {instruction:?}, len = {words}",
                instruction = instruction,
                words = length
            );
            write_instruction_word_into_bytestream(&mut bytesteam, instruction_word, arg1, arg2)
        }
        MaterializedInstruction::Flexible { instruction, .. } => {
            // We perform a final pass of baking the actual jump addresses
            // into the instructions.
            if let MaterializedInstruction::Flexible {
                instruction,
                instruction_word,
                arg1,
                arg2,
            } = instruction.materialize(&label_map)
            {
                trace!(
                    "instruction {instruction:?}, len = {words}",
                    instruction = instruction,
                    words = length
                );
                write_instruction_word_into_bytestream(&mut bytesteam, instruction_word, arg1, arg2)
            } else {
                unreachable!();
            }
        }
    }
}
fn write_materialized_instruction_into_bytestream ( mut bytesteam : & mut Vec < u16 > , entry : MaterializedInstruction , label_map : & mut HashMap < String , u16 > , ) { let length = entry . len_estimate ( ) ; match entry { MaterializedInstruction :: Static { instruction , instruction_word , arg1 , arg2 , } => { trace ! ( " " instruction instruction words length ) ; write_instruction_word_into_bytestream ( & mut bytesteam , instruction_word , arg1 , arg2 ) } MaterializedInstruction :: Flexible { instruction , .. } => { // We perform a final pass of baking the actual jump addresses // into the instructions. if let MaterializedInstruction :: Flexible { instruction , instruction_word , arg1 , arg2 , } = instruction . materialize ( & label_map ) { trace ! ( " " instruction instruction words length ) ; write_instruction_word_into_bytestream ( & mut bytesteam , instruction_word , arg1 , arg2 ) } else { unreachable ! ( ) ; } } } }
Writes a materialized instruction into the bytestream.
Writes a materialized instruction into the bytestream .
bytesteam
&mut Vec<u16>
entry
MaterializedInstruction
label_map
&mut HashMap<String, u16>