Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute path support in the emulator #247

Open
greenhat opened this issue Jul 17, 2024 · 0 comments
Open

Absolute path support in the emulator #247

greenhat opened this issue Jul 17, 2024 · 0 comments

Comments

@greenhat
Copy link
Contributor

Extracted from #222 (comment)

We may need to extend our representation a bit, in order to allow importing MASM modules from source. In particular, we may want to have a variant of FunctionIdent called Callee used in our MASM representation, like so:

pub enum Callee {
    MastRoot(RpoDigest),
    Path {
        module: Option<Ident>,
        function: Ident,
        absolute: bool,
    }
}

When translating HIR FunctionIdent to Callee, it would become a path where the module would always be set, and absolute would always be true (since function identifiers in HIR are always absolute).

When translating MASM InvocationTarget to Callee, we'd convert InvocationTarget::AbsolutePath as an absolute callee, InvocationTarget::ProcedurePath as a relative path, InvocationTarget::ProcedureName as a relative path, and InvocationTarget::MastRoot, as a MAST root. Similar translations could be supported for other InvocationTarget-like procedure identifiers, but the MASM opcodes only use InvocationTarget.

The emulator then would need to resolve relative paths at runtime, but could treat absolute paths and MAST roots as, well, absolute references. The emulator currently does not track MAST roots at all, so that would be needed to have full compatibility, but would be a pretty simple thing to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant