mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 19:19:30 +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:
parent
b2bd5132c4
commit
f91fa79fc5
Notes:
sideshowbarker
2024-07-18 17:19:48 +09:00
Author: https://github.com/alimpfard
Commit: f91fa79fc5
Pull-request: https://github.com/SerenityOS/serenity/pull/7482
Reviewed-by: https://github.com/ADKaster
3 changed files with 40 additions and 5 deletions
|
@ -36,6 +36,28 @@ public:
|
|||
auto& store() const { return m_store; }
|
||||
auto& store() { return m_store; }
|
||||
|
||||
struct CallFrameHandle {
|
||||
explicit CallFrameHandle(Configuration& configuration)
|
||||
: frame_index(configuration.m_current_frame_index)
|
||||
, stack_size(configuration.m_stack.size())
|
||||
, ip(configuration.ip())
|
||||
, configuration(configuration)
|
||||
{
|
||||
configuration.depth()++;
|
||||
}
|
||||
|
||||
~CallFrameHandle()
|
||||
{
|
||||
configuration.unwind({}, *this);
|
||||
}
|
||||
|
||||
size_t frame_index { 0 };
|
||||
size_t stack_size { 0 };
|
||||
InstructionPointer ip { 0 };
|
||||
Configuration& configuration;
|
||||
};
|
||||
|
||||
void unwind(Badge<CallFrameHandle>, const CallFrameHandle&);
|
||||
Result call(FunctionAddress, Vector<Value> arguments);
|
||||
Result execute();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue