go-interpreter / wagon

wagon, a WebAssembly-based Go interpreter, for Go.
BSD 3-Clause "New" or "Revised" License
903 stars 148 forks source link

Refactor amd64 backend into three passes in prep for register allocator. #137

Closed twitchyliquid64 closed 5 years ago

twitchyliquid64 commented 5 years ago

To get the next big margin of speedup we need to start storing results between ops in registers, instead of always spilling to the stack.

In preparation for this, this PR refactors the backend into three phases:

  1. Build rough instruction stream. This is the same as before, except anything where we want to do things differently based on register state is now represented in a symbolic instruction.
  2. Lowering. This phase converts all symbolic instructions into concrete amd64 instructions. It is this pass which will keep track of register liveness.
  3. Peephole optimization. As before.

Subsequent PRs will implement register allocation during the lowering phase.

codecov-io commented 5 years ago

Codecov Report

Merging #137 into master will increase coverage by 0.35%. The diff coverage is 91.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #137      +/-   ##
==========================================
+ Coverage   68.48%   68.83%   +0.35%     
==========================================
  Files          42       43       +1     
  Lines        4848     4903      +55     
==========================================
+ Hits         3320     3375      +55     
+ Misses       1254     1253       -1     
- Partials      274      275       +1
Impacted Files Coverage Δ
exec/internal/compile/backend_amd64.go 79.97% <78.74%> (-2.86%) :arrow_down:
exec/internal/compile/lower_amd64.go 98.24% <98.24%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2691113...abf74a5. Read the comment docs.