mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibWasm: Take call arguments as references and recycle the allocations
This opens the way for a allocated-at-start call frame optimisation (that will come in a future commit).
This commit is contained in:
committed by
Ali Mohammad Pur
parent
be9d8288ef
commit
70f839ccb2
Notes:
github-actions[bot]
2026-02-06 10:45:28 +00:00
Author: https://github.com/alimpfard Commit: https://github.com/LadybirdBrowser/ladybird/commit/70f839ccb29 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7477 Reviewed-by: https://github.com/Hendiadyoin1
@@ -291,13 +291,12 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
config.set_frame(IsTailcall::No,
|
||||
auxiliary_instance,
|
||||
{},
|
||||
{},
|
||||
Vector<Value, ArgumentsStaticSize> {},
|
||||
Vector<Value, 8> {},
|
||||
entry.expression(),
|
||||
1,
|
||||
});
|
||||
1);
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap())
|
||||
return InstantiationError { "Global instantiation trapped", move(result.trap()) };
|
||||
@@ -314,13 +313,12 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
config.set_frame(IsTailcall::No,
|
||||
main_module_instance,
|
||||
{},
|
||||
{},
|
||||
Vector<Value, ArgumentsStaticSize> {},
|
||||
Vector<Value, 8> {},
|
||||
entry,
|
||||
entry.instructions().size() - 1,
|
||||
});
|
||||
entry.instructions().size() - 1);
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap())
|
||||
return InstantiationError { "Element section initialisation trapped", move(result.trap()) };
|
||||
@@ -350,13 +348,12 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
config.set_frame(IsTailcall::No,
|
||||
main_module_instance,
|
||||
{},
|
||||
{},
|
||||
Vector<Value, ArgumentsStaticSize> {},
|
||||
Vector<Value, 8> {},
|
||||
active_ptr->expression,
|
||||
1,
|
||||
});
|
||||
1);
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap())
|
||||
return InstantiationError { "Element section initialisation trapped", move(result.trap()) };
|
||||
@@ -386,13 +383,12 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
Configuration config { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
config.enable_instruction_count_limit();
|
||||
config.set_frame(Frame {
|
||||
config.set_frame(IsTailcall::No,
|
||||
main_module_instance,
|
||||
{},
|
||||
{},
|
||||
Vector<Value, ArgumentsStaticSize> {},
|
||||
Vector<Value, 8> {},
|
||||
data.offset,
|
||||
1,
|
||||
});
|
||||
1);
|
||||
auto result = config.execute(interpreter);
|
||||
if (result.is_trap())
|
||||
return InstantiationError { "Data section initialisation trapped", move(result.trap()) };
|
||||
@@ -565,7 +561,9 @@ Result AbstractMachine::invoke(Interpreter& interpreter, FunctionAddress address
|
||||
Configuration configuration { m_store };
|
||||
if (m_should_limit_instruction_count)
|
||||
configuration.enable_instruction_count_limit();
|
||||
return configuration.call(interpreter, address, move(arguments));
|
||||
|
||||
Vector<Value, ArgumentsStaticSize> args = move(arguments);
|
||||
return configuration.call(interpreter, address, args);
|
||||
}
|
||||
|
||||
void Linker::link(ModuleInstance const& instance)
|
||||
|
||||
Reference in New Issue
Block a user