Skip to content

Commit

Permalink
jit(arm64): support call instruction (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathetake authored Feb 14, 2022
1 parent a6c7f96 commit e60eda6
Show file tree
Hide file tree
Showing 3 changed files with 675 additions and 226 deletions.
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

0 comments on commit e60eda6

Please sign in to comment.