Coder Social home page Coder Social logo

Comments (6)

sbc100 avatar sbc100 commented on May 29, 2024 1

Just the one. You can see it in the name of the test test_asyncify_indirect_lists_add (the paramaterized part of the name is the last part, so this the add verison.

You can run it locally to see it fail with ./test/runner lto2.test_asyncify_indirect_lists_add.

from emscripten.

curiousdannii avatar curiousdannii commented on May 29, 2024 1

Ah, thanks. I was looking in the stack trace and missed that at the top!

And thanks for the explanation @kripken. While disabling the test might be okay for now, I think we need a real permanent solution. Because I definitely intend to use this with LTO enabled!

But maybe this is actually okay, because if you're using ASYNCIFY_ADD then you should be using it after running ASYNCIFY_ADVISE, which will report the inlined function names. You just shouldn't be using it with function names that you assume are right from looking at the source code, you need to check the actual advise list first.

I kinda feel we really should strongly recommend (or even warn) that in non-optimised builds that ASYNCIFY_IGNORE_INDIRECT should not be enabled, and that ASYNCIFY_ADD should only be used in optimised builds after getting the actual asyncified list. Using these settings in debug builds is just setting you up for trouble when you eventually switch to release builds.

from emscripten.

sbc100 avatar sbc100 commented on May 29, 2024

I bisected this to an emscripten change: #21672

from emscripten.

kripken avatar kripken commented on May 29, 2024

It looks like in LTO the "noinline" function gets inlined by Binaryen. As a result we can't find it in the ADD list for asyncify, and the test fails. In general the ADD list is sensitive to this sort of thing, though it would be less so if we were aware of LLVM's "noinline" annotation in wasm-opt.

For now I'll open a PR to disable this test in LTO mode.

from emscripten.

curiousdannii avatar curiousdannii commented on May 29, 2024

I'm struggling to understand how it would fail.

Which parameterised test in particular failed? Or did they all?

from emscripten.

kripken avatar kripken commented on May 29, 2024

In more detail, the situation in the test is that main calls virt which then does an indirect call to something that calls an import,

main() -> virt() -[indirect]-> virtual method on a class -> import

The test ignores indirect calls in Asyncify, so only the virtual method and the import are automatically marked. We manually mark virt by putting it in the ADD list, and then thanks to propagation we also mark main, and then the entire callstack is instrumented and things work.

However, when virt is inlined into main then we end up not finding the function we wanted to mark, and so main does not get marked either, and we fail.

virt is marked noinline to prevent this, but that only prevents LLVM inlining. Binaryen happens later, and it happens to inline in this case.

from emscripten.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.