You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In python (and probably some other softwares), it is using function pointer casting to store the python method function pointers. This sometimes forcely changed the signature of the function. One example is dict_keys function, which has the signature of PyObject *dict_keys(PyDictObject *mp). It is forcely casted to PyObject *(*PyCFunction)(PyObject *, PyObject *) in python and python invokes the dict_keys in form of (*meth)(self, NULL). This causes wasm to raise function type mismatch error.
Calling a function pointer with extra argument is an undefined behavior according to c specification, but it looks like many developer does not care about this as long as this looks like working fine. But apparently wasm will not allow this behavior so we are facing some issues here. There is an article that also discussed exactly the same issue here. So looks like we currently have two options here:
Use emulated function pointer casting. This would basically rewrite every occurence of indirect_call instruction by making it always calling a function that takes 60 arguments. However, according to the article, this method could introduce a huge overhead to the wasm module
Another method would be just modifying the source code and fixing the undefined behavior here. This could be manually or automatically. Though having a general-purpose tool automatically fixing the function pointer casting would probably be pretty hard.
The text was updated successfully, but these errors were encountered:
In python (and probably some other softwares), it is using function pointer casting to store the python method function pointers. This sometimes forcely changed the signature of the function. One example is
dict_keys
function, which has the signature ofPyObject *dict_keys(PyDictObject *mp)
. It is forcely casted toPyObject *(*PyCFunction)(PyObject *, PyObject *)
in python and python invokes thedict_keys
in form of(*meth)(self, NULL)
. This causes wasm to raisefunction type mismatch error
.Calling a function pointer with extra argument is an undefined behavior according to c specification, but it looks like many developer does not care about this as long as this looks like working fine. But apparently wasm will not allow this behavior so we are facing some issues here. There is an article that also discussed exactly the same issue here. So looks like we currently have two options here:
indirect_call
instruction by making it always calling a function that takes 60 arguments. However, according to the article, this method could introduce a huge overhead to the wasm moduleThe text was updated successfully, but these errors were encountered: