1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibWasm: Use the current configuration to run call ops

This should make it easier to implement multiple types of interpreters
on top of a configuration, and also give a small speed boost in not
initialising as many Stack objects.
This commit is contained in:
Ali Mohammad Pur 2021-05-24 01:28:02 +04:30 committed by Ali Mohammad Pur
parent b2bd5132c4
commit f91fa79fc5
3 changed files with 40 additions and 5 deletions

View file

@ -125,11 +125,13 @@ void Interpreter::call_address(Configuration& configuration, FunctionAddress add
for (size_t i = 0; i < type->parameters().size(); ++i) {
args.prepend(move(configuration.stack().pop().get<Value>()));
}
Configuration function_configuration { configuration.store() };
function_configuration.pre_interpret_hook = pre_interpret_hook;
function_configuration.post_interpret_hook = post_interpret_hook;
function_configuration.depth() = configuration.depth() + 1;
auto result = function_configuration.call(address, move(args));
Result result { Trap {} };
{
Configuration::CallFrameHandle handle { configuration };
result = configuration.call(address, move(args));
}
if (result.is_trap()) {
m_do_trap = true;
return;