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

Use InstructionPtr instead of a program counter (usize) #479

Closed
4 tasks
Robbepop opened this issue Sep 27, 2022 · 0 comments · Fixed by #482
Closed
4 tasks

Use InstructionPtr instead of a program counter (usize) #479

Robbepop opened this issue Sep 27, 2022 · 0 comments · Fixed by #482
Labels
optimization An performance optimization issue.

Comments

@Robbepop
Copy link
Member

This is a follow-up to #473.

An advantageous design is to change branch instructions to offset the program counter by a delta relative to the current program counter. This way we can avoid having the base pointer and only need to carry around a single pointer to the next instruction respectively per FuncFrame in the call stack.
Another implication with this proposed design is that returning from a function will no longer require to query the instructions of a FuncFrame via the CodeMap but only calling a function will have to do this, therefore call intense workloads will get faster due to having to do less in between function executions after returns.
Dropping the Instructions abstraction in the Executor will spare us 16 bytes there which probably improves cache friendliness of the Executor itself.

  • Implement InstructionPtr abstraction and CodeMap API to access those.
  • Embed new InstructionPtr into FuncFrame and replace pc: usize by it.
  • Make Executor properly use InstructionPtr and properly load from CodeMap only upon calls but no longer on returns.
  • Remove the Instructions type since it is of no use anymore.
@Robbepop Robbepop added wasmi-v1 optimization An performance optimization issue. labels Sep 27, 2022
@Robbepop Robbepop changed the title Use InstructionPtr instead of a program counter (usize) in FuncFrame Use InstructionPtr instead of a program counter (usize) Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization An performance optimization issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant