45
45
#pragma GCC diagnostic ignored "-Wunused-variable"
46
46
47
47
using namespace std ;
48
+ using namespace WAVM ;
48
49
49
50
namespace hera {
50
51
@@ -60,7 +61,7 @@ class WavmEthereumInterface : public EthereumInterface {
60
61
EthereumInterface(_context, _code, _msg, _result, _meterGas)
61
62
{}
62
63
63
- void setWasmMemory (Runtime::MemoryInstance * _wasmMemory) {
64
+ void setWasmMemory (Runtime::Memory * _wasmMemory) {
64
65
m_wasmMemory = _wasmMemory;
65
66
}
66
67
@@ -70,7 +71,7 @@ class WavmEthereumInterface : public EthereumInterface {
70
71
void memorySet (size_t offset, uint8_t value) override { (Runtime::memoryArrayPtr<U8>(m_wasmMemory, offset, 1 ))[0 ] = value; }
71
72
uint8_t memoryGet (size_t offset) override { return (Runtime::memoryArrayPtr<U8>(m_wasmMemory, offset, 1 ))[0 ]; }
72
73
73
- Runtime::MemoryInstance * m_wasmMemory;
74
+ Runtime::Memory * m_wasmMemory;
74
75
};
75
76
76
77
unique_ptr<WasmEngine> WavmEngine::create ()
@@ -181,7 +182,7 @@ namespace wavm_host_module {
181
182
182
183
bool resolve (const string& moduleName,
183
184
const string& exportName,
184
- IR::ObjectType type,
185
+ IR::ExternType type,
185
186
Runtime::Object*& outObject) override
186
187
{
187
188
outObject = nullptr ;
@@ -202,7 +203,8 @@ ExecutionResult WavmEngine::execute(
202
203
) {
203
204
ExecutionResult result = internalExecute (context, code, state_code, msg, meterInterfaceGas);
204
205
// And clean up mess left by this run.
205
- Runtime::collectGarbage ();
206
+ // TODO: enable this.
207
+ // Runtime::collectCompartmentGarbage(compartment);
206
208
return result;
207
209
}
208
210
@@ -255,7 +257,7 @@ ExecutionResult WavmEngine::internalExecute(
255
257
heraAssert (linkResult.success , " Couldn't link contract against host module." );
256
258
257
259
// compile the module from IR to LLVM bitcode
258
- Runtime::GCPointer<Runtime::Module> module = Runtime::compileModule (moduleIR);
260
+ Runtime::ModuleRef module = Runtime::compileModule (moduleIR);
259
261
260
262
// instantiate contract module
261
263
Runtime::GCPointer<Runtime::ModuleInstance> moduleInstance = Runtime::instantiateModule (compartment, module, move (linkResult.resolvedImports ), " <ewasmcontract>" );
@@ -265,7 +267,7 @@ ExecutionResult WavmEngine::internalExecute(
265
267
wavm_host_module::interface.top ()->setWasmMemory (asMemory (Runtime::getInstanceExport (moduleInstance, " memory" )));
266
268
267
269
// invoke the main function
268
- Runtime::GCPointer<Runtime::FunctionInstance > mainFunction = asFunctionNullable (Runtime::getInstanceExport (moduleInstance, " main" ));
270
+ Runtime::GCPointer<Runtime::Function > mainFunction = asFunctionNullable (Runtime::getInstanceExport (moduleInstance, " main" ));
269
271
ensureCondition (mainFunction, ContractValidationFailure, " \" main\" not found" );
270
272
271
273
// this is how WAVM's try/catch for exceptions
0 commit comments