[dart2wasm] Fix names of dynamic call entry functions

Currently all closure dynamic call entries have the same name. This
makes it difficult to find locations of crashes. Example:

    wasm-function[677]:0x1de1d: RuntimeError: illegal cast
    RuntimeError: illegal cast
        at dynamic call entry (wasm://wasm/000909b2:wasm-function[677]:0x1de1d)
        at method forwarder for 'call' (wasm://wasm/000909b2:wasm-function[583]:0x1b474)
        ...

With this we now add the function name before "dynamic call entry":

  wasm-function[677]:0x1de1d: RuntimeError: illegal cast
  RuntimeError: illegal cast
      at C.m1 tear-off dynamic call entry (wasm://wasm/000921c6:wasm-function[677]:0x1de1d)
      at method forwarder for 'call' (wasm://wasm/000921c6:wasm-function[583]:0x1b474)
      ...

Which makes it easy to find the function in .wat output as there is only
one function with the name "C.m1 tear-off dyamic call entry".

Change-Id: Iea726b695fc29b361a347b64194d5c09601a0999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315440
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This commit is contained in:
Ömer Sinan Ağacan 2023-07-21 17:48:38 +00:00 committed by Commit Queue
parent 6d0fb5094f
commit 37581cb79e

View file

@ -739,7 +739,7 @@ class Translator with KernelNodes {
w.DefinedFunction makeDynamicCallEntry() {
final w.DefinedFunction function = m.addFunction(
dynamicCallVtableEntryFunctionType, "dynamic call entry");
dynamicCallVtableEntryFunctionType, "$name dynamic call entry");
// Defer generation of the trampoline body to avoid cyclic dependency
// when a tear-off constant is used as default value in the torn-off