Skip to content
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

Import indices go before indices in other index spaces in what sense? #1481

Closed
hydroper opened this issue Jun 30, 2023 · 2 comments
Closed

Comments

@hydroper
Copy link

I'd like a clarification. Does this mean that if I've an import function, then...

  • Its index is 0?
  • The index of the first function in the code section (of the binary format) is 1?
  • The first function type in the function type section, the index 0, belongs to that import function?
  • The second function type in the function type section, the index 1, belongs to the first function (index 1 as I asked) in the code section?
@eqrion
Copy link

eqrion commented Jul 10, 2023

If you import N functions and have M functions defined in a module then the first N indices refer to those imported functions, and the following M refer to the ones defined in the modules. So to refer to the first defined function, you would index it at M. So your first two bullets are correct.

Every function specifies its type using an index into the type section. So there is no correlation between function indices and type indices.

@sunfishcode
Copy link
Member

Closing, as the questions have been answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants