Skip to content

Make InstructionContext that contains refs of Interpreter and Host #2359

@rakita

Description

@rakita
pub struct HostRef<'a, H: Host + ?Sized, ITy: InterpreterTypes> {
    pub host: &'a mut H,
    pub interp: &'a mut Interpreter<ITy>,
}

Add this structure and replace instruction signature from:

pub fn jump<WIRE: InterpreterTypes, H: Host + ?Sized>(
    interpreter: &mut Interpreter<WIRE>,
    _host: &mut H,
) {

To this:

pub fn jump<ITy: InterpreterTypes, H: Host + ?Sized>(
    context: &mut InstructionContext<'_, ITy, H>,
) {

This would require many line changes, but encapsulating types in InstructionContext would allow adding more types inside or moving SharedMemory from Interpreter to InstructionContext. Another interesting question would be whether this affects performance in any way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions