Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #200 from lrettig/stacktrace-location
Browse files Browse the repository at this point in the history
Fix location of stack trace
  • Loading branch information
axic authored Mar 27, 2018
2 parents 7fa0652 + 35fee8a commit 7867206
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ exports.evm2wast = function (evmCode, opts = {
segmentStackLow = segmentStackDeta
}

// creates a stack trace
if (opts.stackTrace) {
segment += `(call $stackTrace (i32.const ${pc}) (i32.const ${opint}) (i32.const ${gasCount}) (get_global $sp))\n`
}

switch (op.name) {
case 'JUMP':
jumpFound = true
Expand Down Expand Up @@ -316,11 +321,6 @@ exports.evm2wast = function (evmCode, opts = {
segment += `(set_global $sp (i32.add (get_global $sp) (i32.const ${stackDeta * 32})))\n`
}

// creates a stack trace
if (opts.stackTrace) {
segment += `(call $stackTrace (i32.const ${pc}) (i32.const ${opint}) (i32.const ${gasCount}) (get_global $sp))\n`
}

// adds the logic to save the stack pointer before exiting to wiat to for a callback
// note, this must be done before the sp is updated above^
if (opts.useAsyncAPI && callbackFuncs.has(op.name)) {
Expand Down

0 comments on commit 7867206

Please sign in to comment.