ladybird/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.cpp
Ali Mohammad Pur 4d9246ac9d LibWasm: Add basic support for module instantiation and execution stubs
This adds very basic support for module instantiation/allocation, as
well as a stub for an interpreter (and executions APIs).
The 'wasm' utility is further expanded to instantiate, and attempt
executing the first non-imported function in the module.
Note that as the execution is a stub, the expected result is a zero.
Regardless, this will allow future commits to implement the JS
WebAssembly API. :^)
2021-05-13 19:44:32 +01:00

23 lines
595 B
C++

/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWasm/AbstractMachine/AbstractMachine.h>
#include <LibWasm/AbstractMachine/Configuration.h>
#include <LibWasm/AbstractMachine/Interpreter.h>
#include <LibWasm/Opcode.h>
namespace Wasm {
void Interpreter::interpret(Configuration& configuration)
{
// FIXME: Interpret stuff
dbgln("FIXME: Interpret stuff!");
// Push some dummy values
for (size_t i = 0; i < configuration.frame()->arity(); ++i)
configuration.stack().push(make<Value>(0));
}
}