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

Access reference objects in native function #3312

Closed
peter-jerry-ye opened this issue Apr 12, 2024 · 5 comments
Closed

Access reference objects in native function #3312

peter-jerry-ye opened this issue Apr 12, 2024 · 5 comments

Comments

@peter-jerry-ye
Copy link

Feature

I'd like to be able to access reference objects in native function with GC proposal (the apis in gc_export.h are great). Currently with signature (r) only if the type is between REF_TYPE_NULLREF and REF_TYPE_FUNCREF (btw I'm not sure if the comparison is correct ). It would be great if anything between REF_TYPE_HT_NULLABLE and REF_TYPE_NULLFUNCREF is supported.

Benefit

We can integrate better with gc proposal in terms of FFI (for example, no need to serialize/deserialize a structure just to modify a field

Implementation

I do not have a plan of implementation yet, and I'm not sure if it possible.

Alternatives

N.A.

@wenyongh
Copy link
Contributor

@peter-jerry-ye yes, thanks for pointing out. Seems it should be type >= REF_TYPE_HT_NULLABLE && type <= REF_TYPE_FUNCREF.

@peter-jerry-ye
Copy link
Author

peter-jerry-ye commented Apr 12, 2024

@peter-jerry-ye yes, thanks for pointing out. Seems it should be type >= REF_TYPE_HT_NULLABLE && type <= REF_TYPE_FUNCREF.

Maybe it should be type >= REF_TYPE_HT_NULLABLE && type <= REF_TYPE_NULLFUNCREF?

@wenyongh
Copy link
Contributor

@peter-jerry-ye yes, thanks for pointing out. Seems it should be type >= REF_TYPE_HT_NULLABLE && type <= REF_TYPE_FUNCREF.

Maybe it should be type >= REF_TYPE_HT_NULLABLE && type <= REF_TYPE_NULLFUNCREF?

OK, though the parameter type of native function is rarely set as (ref null? nofunc), (ref null? noextern) and (ref null? none). Please try #3317.

@peter-jerry-ye
Copy link
Author

It solves the issue. Thank you.

@wenyongh
Copy link
Contributor

Welcome.

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

2 participants