Skip to content

"// special logic" hack in jsifier.js #8046

Closed

Description

@juj

Going through C++ exceptions code, there is this smelly looking hack in jsifier.js:

  // functionStub
  function functionStubHandler(item) {
    // special logic
    if (item.ident.startsWith('___cxa_find_matching_catch_')) {
      var num = +item.ident.split('_').slice(-1)[0];
      LibraryManager.library[item.ident.substr(1)] = function() {
        return ___cxa_find_matching_catch.apply(null, arguments);
      };
    }

I wonder what that is for? If I comment that out, things at least superficially seem to work fine. That code seems to somehow redirect e.g. a function ___cxa_find_matching_catch_1 to just ___cxa_find_matching_catch?

The code has a line var num = +item.ident.split('_').slice(-1)[0];, but num is not actually used anywhere.

Is this something to do with an infinite amount of redirects from ___cxa_find_matching_catch_<integer> each to ___cxa_find_matching_catch?

It would be good for jsifier.js to be generic without needing to encode actual functionality specific bits in there. I wonder if that is something old that is no longer needed? Can we get rid of this block?

Activity

  1. added 2 commits that reference this issue on Feb 9, 2019
    497b65a
    45ca734
  2. juj commented on Feb 9, 2019

    @juj
    CollaboratorAuthor

    Removed the above block in #8040, and replaced it with a fixed number number of redirections.

  3. added 2 commits that reference this issue on Feb 10, 2019
    7a40219
    20c0d6c
  4. added a commit that references this issue on Feb 25, 2019
    e6bb542
  5. added 3 commits that reference this issue on May 25, 2019
    2e2b6c3
    38f2999
    045bce1
  6. added a commit that references this issue on Dec 23, 2020
    819d123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions