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

jit(arm64): support call instruction #221

Merged
merged 32 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions wasm/jit/jit_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -4729,8 +4729,8 @@ func (c *amd64Compiler) callFunction(addr wasm.FunctionAddress, addrReg int16, f

// 2) Set engine.valueStackContext.stackBasePointer for the next function.
{
// At this point, tmpRegister holds the OLD stack base pointer. We could get the new frame's
// stack base pointer by "OLD stack base pointer + OLD stack pointer - # of function params"
// At this point, tmpRegister holds the old stack base pointer. We could get the new frame's
// stack base pointer by "old stack base pointer + old stack pointer - # of function params"
// See the comments in engine.pushCallFrame which does exactly the same calculation in Go.
calculateNextStackBasePointer := c.newProg()
calculateNextStackBasePointer.As = x86.AADDQ
Expand Down Expand Up @@ -4870,8 +4870,7 @@ func (c *amd64Compiler) returnFunction() error {
// Obtain the temporary registers to be used in the followings.
regs, found := c.locationStack.takeFreeRegisters(generalPurposeRegisterTypeInt, 3)
if !found {
// This in theory never happen as all the registers must be free except addrReg.
return fmt.Errorf("could not find enough free registers")
return fmt.Errorf("BUG: all the registers should be free at this point")
}
c.locationStack.markRegisterUsed(regs...)

Expand Down
Loading