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

Direct function invocation without instance #91

Open
florianhartung opened this issue Sep 25, 2024 · 2 comments
Open

Direct function invocation without instance #91

florianhartung opened this issue Sep 25, 2024 · 2 comments
Labels

Comments

@florianhartung
Copy link
Collaborator

A user of our interpreter might want an abstraction that allows to invoke FunctionsRefs without having to pass a &mut RuntimeInstance everytime:

let fibonacci: FunctionRef = instance.get_function_by_name("my_module", "fibonacci").unwrap();

// Current approach
let result: u32 = fibonacci.invoke(&mut instance, 5);

// We want this
let result: u32 = fibonacci.invoke(5);
@florianhartung
Copy link
Collaborator Author

I think we should provide this functionality as a layer on top of our interpreter, that the user can opt in to, as this layer may come with a slight performance penalty.

@cemonem
Copy link

cemonem commented Dec 10, 2024

What if the function is accessing stuff that have to be instantiated besides it? element segments, data segments etc. Is there API out there we could be inspired from?

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

No branches or pull requests

2 participants