extensions
Volodymyr Shymanskyy 3 years ago
parent 8ecc645d50
commit ff4e49fcfd

@ -198,8 +198,8 @@ M3Result repl_invoke (const char* name, int argc, const char* argv[])
return "too many args";
}
uint64_t args[arg_count];
const void* argptrs[arg_count];
static uint64_t args[128];
static const void* argptrs[128];
memset(args, 0, sizeof(args));
memset(argptrs, 0, sizeof(argptrs));

@ -348,22 +348,6 @@ namespace wasm3 {
return ret;
}
/**
* Call the function which doesn't take any arguments.
* Note that the type of the return value must be explicitly specified as a template argument.
* @return the return value of the function.
*/
template<typename Ret>
Ret call() {
M3Result res = m3_Call(m_func);
detail::check_error(res);
Ret ret;
/* FIXME: there should be a public API to get the return value */
auto sp = (detail::stack_type) m_runtime->stack;
detail::arg_from_stack(ret, sp, nullptr);
return ret;
}
protected:
friend class runtime;

@ -130,13 +130,6 @@ M3_Runtime_get_memory(m3_runtime *runtime, PyObject *index)
return PyMemoryView_FromBuffer(&view);
}
static PyObject *
M3_Runtime_print_info(m3_runtime *runtime)
{
m3_PrintRuntimeInfo(runtime->r);
Py_RETURN_NONE;
}
static PyMethodDef M3_Runtime_methods[] = {
{"load", (PyCFunction)M3_Runtime_load, METH_O,
PyDoc_STR("load(module) -> None")},
@ -144,8 +137,6 @@ static PyMethodDef M3_Runtime_methods[] = {
PyDoc_STR("find_function(name) -> Function")},
{"get_memory", (PyCFunction)M3_Runtime_get_memory, METH_O,
PyDoc_STR("get_memory(index) -> memoryview")},
{"print_info", (PyCFunction)M3_Runtime_print_info, METH_NOARGS,
PyDoc_STR("print_info()")},
{NULL, NULL} /* sentinel */
};

@ -871,7 +871,7 @@ M3Result m3_CallWithArgs (IM3Function i_function, uint32_t i_argc, const char
switch (d_FuncArgType(ftype, i)) {
case c_m3Type_i32: *(i32*)(s) = strtoul(i_argv[i], NULL, 10); break;
case c_m3Type_i64: *(i64*)(s) = strtoull(i_argv[i], NULL, 10); break;
case c_m3Type_f32: *(f32*)(s) = strtof(i_argv[i], NULL); break;
case c_m3Type_f32: *(f32*)(s) = strtod(i_argv[i], NULL); break;
case c_m3Type_f64: *(f64*)(s) = strtod(i_argv[i], NULL); break;
default: return "unknown argument type";
}

Loading…
Cancel
Save