Skip to content

[mono][wasm] Fix the usage of function pointers in mixed mode. - #54098

Merged
vargaz merged 3 commits into
dotnet:mainfrom
vargaz:mixed-calli
Jun 16, 2021
Merged

[mono][wasm] Fix the usage of function pointers in mixed mode.#54098
vargaz merged 3 commits into
dotnet:mainfrom
vargaz:mixed-calli

Conversation

@vargaz

@vargaz vargaz commented Jun 12, 2021

Copy link
Copy Markdown
Contributor

The llvm compiled code expects function pointers to be a MonoFtnDesc*, while
the interpreter expects them to be a InterpMethod*. Use a MonoFtnDesc in
both cases.

@ghost

ghost commented Jun 12, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.

Issue Details

The llvm compiled code expects function pointers to be a MonoFtnDesc*, while
the interpreter expects them to be a InterpMethod*. Use a MonoFtnDesc in
both cases.

Author: vargaz
Assignees: -
Labels:

area-Codegen-Interpreter-mono

Milestone: -

@vargaz
vargaz marked this pull request as draft June 12, 2021 07:19
@vargaz
vargaz force-pushed the mixed-calli branch 2 times, most recently from 361687b to 9fd1df3 Compare June 13, 2021 11:11
@lewing
lewing requested a review from BrzVlad June 13, 2021 23:59
@vargaz
vargaz force-pushed the mixed-calli branch 4 times, most recently from fd16461 to a6357b2 Compare June 14, 2021 04:31
@vargaz
vargaz marked this pull request as ready for review June 15, 2021 00:01
@vargaz

vargaz commented Jun 15, 2021

Copy link
Copy Markdown
Contributor Author

Fixes #50965

vargaz added 2 commits June 14, 2021 22:43
The llvm compiled code expects function pointers to be a MonoFtnDesc*, while
the interpreter expects them to be a InterpMethod*. Use a MonoFtnDesc in
both cases.
Comment thread src/mono/mono/mini/interp/interp.c Outdated
Comment thread src/mono/mono/mini/interp/interp.c Outdated
@BrzVlad

BrzVlad commented Jun 15, 2021

Copy link
Copy Markdown
Member

It's ugly that passing function pointers between aot and interp would only work in llvmonly. Is it feasible, if we decide to care about it, to use function descriptors also in normal jit/aot mode when doing a ldftn ?

@vargaz

vargaz commented Jun 16, 2021

Copy link
Copy Markdown
Contributor Author

For non-llvmonly mode, the interpreter should use the same representation as the jitted code i.e. normal pointers to the method code, for interpreted code, that would be some kind of trampoline to enter the interpreter.

@BrzVlad

BrzVlad commented Jun 16, 2021

Copy link
Copy Markdown
Member

That would have problems on the interp side, since, instead of having direct access to the InterpMethod when doing a ldftn, we would have this native pointer that we have to call and enter the interpreter every time.

@vargaz

vargaz commented Jun 16, 2021

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@vargaz

vargaz commented Jun 16, 2021

Copy link
Copy Markdown
Contributor Author

/azp run runtime runtime-staging

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@vargaz
vargaz merged commit 5fd027c into dotnet:main Jun 16, 2021
@vargaz
vargaz deleted the mixed-calli branch June 16, 2021 09:52
@ghost ghost locked as resolved and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants