zisk-executor 1.1.0-alpha

Execution engine that orchestrates witness generation across ZisK state machines
//! Non-x86_64 stub of [`EmulatorAsm`].
//!
//! Mirrors the inherent surface of the real [`super::emulator::EmulatorAsm`]
//! so [`crate::execution::ExecutionPhase`] can hold an
//! `EmulatorBackend::Asm(EmulatorAsm)` variant on every target without
//! `#[cfg]` gates in callers. Any method call panics with a clear
//! "Linux x86_64 only" message — the ASM emulator is genuinely
//! unavailable here, so failing fast is honest.

#![allow(missing_docs)]

use std::sync::Arc;

use proofman_fields::PrimeField64;
use zisk_asm_runner::HintsShmem;
use zisk_common::{
    io::{StreamSource, ZiskStdin},
    AsmExecutionInfo, ExecutorStatsHandle, StatsScope,
};
use zisk_core::ZiskRom;
use zisk_precomp_hints::HintsProcessor;

use super::AsmResources;
use crate::error::ExecutorResult;
use crate::execution::output::ExecutionOutput;

fn unsupported() -> ! {
    panic!("ASM emulator backend is only available on Linux x86_64");
}

/// Stub `EmulatorAsm` for targets without ASM support.
pub struct EmulatorAsm;

impl EmulatorAsm {
    pub fn new(_chunk_size: u64) -> Self {
        unsupported()
    }

    pub fn get_asm_execution_info(&self) -> ExecutorResult<Option<AsmExecutionInfo>> {
        unsupported()
    }

    pub fn set_asm_resources(&self, _: Arc<AsmResources>) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn submit_hint_direct(&self, _: &[u64]) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn append_raw_input(&self, _: &[u8]) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn set_hints_stream_src(&self, _: StreamSource) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn set_inputs_stream_src(&self, _: StreamSource) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn get_hints_processor(&self) -> ExecutorResult<Arc<HintsProcessor<HintsShmem>>> {
        unsupported()
    }

    pub fn set_active_services(&self, _: bool) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn reset(&self) -> ExecutorResult<()> {
        unsupported()
    }

    pub fn signal_cancellation(&self) -> ExecutorResult<()> {
        unsupported()
    }

    #[allow(clippy::too_many_arguments)]
    pub fn execute<F: PrimeField64>(
        &self,
        _zisk_rom: &ZiskRom,
        _stdin: &ZiskStdin,
        _is_first_process: bool,
        _use_hints: bool,
        _stats: &ExecutorStatsHandle,
        _caller_stats_scope: &StatsScope,
        _chunk_hook: crate::ChunkHook<'_>,
    ) -> ExecutorResult<ExecutionOutput> {
        unsupported()
    }
}