Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Fix StoreN instruction compilation
Browse files Browse the repository at this point in the history
This instruction pops 2 values from the stack.
  • Loading branch information
satabin committed May 12, 2019
1 parent 7f2e95f commit fb2586d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class Compiler[F[_]: Effect](engine: Engine[F]) extends compiler.Compiler[F] {
false)
case If(tpe, tis, eis) =>
// when entering a new if, push a label with the same
// arity as the if and a target on break pointeing right
// arity as the if and a target on break pointing right
// after the end of the if body
// add a conditional jump to the then part, the else part comes first
val ctx1 = ctx.pop(1 /* the if condition */ )
Expand Down Expand Up @@ -377,7 +377,7 @@ class Compiler[F[_]: Effect](engine: Engine[F]) extends compiler.Compiler[F] {
builder += op.opcode.toByte
storeInt(builder, align)
storeInt(builder, offset)
loop(instIdx + 1, ctx.copy(offset = ctx.offset + 9), false)
loop(instIdx + 1, ctx.pop(2).copy(offset = ctx.offset + 9), false)
case MemoryGrow =>
builder += Asm.MemoryGrow.toByte
loop(instIdx + 1, ctx.copy(offset = ctx.offset + 1), false)
Expand Down

0 comments on commit fb2586d

Please sign in to comment.