-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embind problems with val::as<T>() in wasm32 with MAXIMUM_MEMORY=4GB #19968
Comments
I have fix pending in 5fbde92 |
I merged 5fbde92 into my compiled version of tag 3.1.44 (I also replaced several additional relevant files that were changed after 3.1.44), It worked below 2GB, but above 2GB all three mentioned cases didn't work. I saw that |
I am working on a bunch of >4gb changes right now. I imagine once they all land this issue should be resolved. |
Do those changes include fixes in WebGL? #18744 fixes WebGL1 problems beyond 2GB, WebGL2 still crashes in many functions. |
The embind fixes have now landed and all the tests pass. If you example still fails perhaps you could come up with a small example of the failure code and we can turn that into a new test and fix it? |
@sbc100, I can try to test it tomorrow, but I saw #20077 and #20079. Should I either test without them or try to take them as well or wait until they have been merged? Are you planning to fix WebGL, too? #18744 is old (for 3.1.38) and it fixes only WebGL1 problems beyond 2GB, WebGL2 still crashes in many functions. |
Let me know when it is a good time to test embind and/or WebGL with wasm32 >2GB and I will update you about the results. I'll be very glad to test wasm64 >4GB when it is ready. But, TypedArrays with long indices are not supported yet by browsers, are they? |
For large typed arrays we now have a polyfil that allows us to get stuff running: #19737 |
My example still fails with 3.1.47. I will check which cases of the above-mentioned fail and will try to prepare small examples. |
I checked again my example with 3.1.57 and 3.1.60. Now it works! I think the issue can be closed. |
There is a problem with raw pointers previously returned from embind-wrapped C++ functions by
val(ptr)
and structs embind-registered asvalue_object
used later as in-parameters of typeval
of embind-wrapped C++ functions. Their conversion fromval
to native types byval::as<T>()
inside the C++ function produces garbage in case of memory locations above 2GB (in raw pointer when its$$.ptr
is negative; as forvalue_object
, I don't know when). On the other hand, when they are used in functions with parameters of their native types without the usage ofval
they are marshaled OK. The same is with JS string literals passed asval
and converted withval::as<std::string>()
.(I need to pass them as
val
in order to support variable-type and nullable parameters).I thought #19755 would fix this, but the problem still exists.
Version of emscripten/emsdk:
The text was updated successfully, but these errors were encountered: