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

Example of TableType FUNC_REF #444

Open
prescod opened this issue Dec 26, 2020 · 4 comments
Open

Example of TableType FUNC_REF #444

prescod opened this issue Dec 26, 2020 · 4 comments
Assignees
Labels
📚 documentation Do you like to read? 🎉 enhancement New feature or request

Comments

@prescod
Copy link

prescod commented Dec 26, 2020

Thanks for proposing a new feature!

Motivation

I want to import a FUNC_REF table into my module.

Proposed solution

I would like to see an example like this in the docs and tests:

    table = Table(store, TableType(Type.FUNC_REF, minimum=0, maximum=10 ), INITIAL_VALUE)

What is INITIAL_VALUE?

@prescod prescod added the 🎉 enhancement New feature or request label Dec 26, 2020
@Hywan
Copy link
Contributor

Hywan commented Jan 7, 2021

All the elements in the table will be set to the initial_value value. We must update the documentation accordingly, sorry for missing this!

@Hywan Hywan self-assigned this Jan 7, 2021
@Hywan Hywan added the 📚 documentation Do you like to read? label Jan 7, 2021
@SNSTRUTHERS
Copy link

SNSTRUTHERS commented Jan 18, 2021

I think the question is what kind of Value is needed for initial_value? I've tried Value.i32 and all the others and every time it raises an exception saying that "val is not funcref".

Table(STORE, TableType(Type.FUNC_REF, 8, 8), Value.i64(8))
#                      what do we put here? ^

@xhlove
Copy link

xhlove commented Feb 23, 2021

I have the same problem, maybe it is self address?

class Table:
    def __init__(self, store, tabletype):
        self.initial_value = Value.i64(id(self))

or it can be ignored?

@bjxhx
Copy link

bjxhx commented May 10, 2022

I think the question is what kind of Value is needed for initial_value? I've tried Value.i32 and all the others and every time it raises an exception saying that "val is not funcref".

Table(STORE, TableType(Type.FUNC_REF, 8, 8), Value.i64(8))
#                      what do we put here? ^

I also have this problem,Have you reached a conclusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Do you like to read? 🎉 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants