bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
5k stars 628 forks source link

Instruction metering #3927

Open AlixANNERAUD opened 1 week ago

AlixANNERAUD commented 1 week ago

Feature

Similar to the Wasmer runtime, it would be beneficial to implement instruction metering, allowing control to be handed back to the caller after executing a specified number of instructions.

Benefit

This would enable on platform with a cooperative scheduler to manage how WASM code is executed, preventing system overload.

Implementation

Introduce a function like wasm_func_call_with_metering that returns an after a given number of executed instruction, a boolean indicating whether the function reached its end.

Alternatives

None identified.

lum1n0us commented 1 week ago

Link similar things together. https://github.com/bytecodealliance/wasm-micro-runtime/issues/2163