mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +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
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