Skip to content

Indirect call signature checks shouldn't be nominal #452

@AndrewScheidecker

Description

@AndrewScheidecker

The design and spec interpreter use an explicit signature table to check call_indirect signatures. This is effectively a nominal type system for function pointers: you can have two signature table entries with the same parameters and return type, and they are distinct types as far as call_indirect is concerned.

This rules out calling a pointer to a function in a different module, since you can't refer to the target module's signature for the function, and in general doesn't work with dynamic linking.

I think that call_indirect signature checks should be defined structurally: that if a call_indirect expects the same parameter types and return type as the function identified by its dynamic index, the signature check should succeed.

The signature table makes sense from an encoding and implementation perspective, but I don't think it's necessary to define WebAssembly semantics. So I think the design shouldn't mention a signature table, and should be explicit that the signature check is structural.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions