go-interpreter / wagon

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

Part 1/2 #101 - implement partial compilation to native code #105

Closed twitchyliquid64 closed 5 years ago

twitchyliquid64 commented 5 years ago

This PR lays the boilerplate for supporting AOT & JIT compilation.

codecov-io commented 5 years ago

Codecov Report

Merging #105 into master will decrease coverage by 3.14%. The diff coverage is 63.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #105      +/-   ##
==========================================
- Coverage    68.9%   65.76%   -3.15%     
==========================================
  Files          33       40       +7     
  Lines        3345     3867     +522     
==========================================
+ Hits         2305     2543     +238     
- Misses        783     1058     +275     
- Partials      257      266       +9
Impacted Files Coverage Δ
exec/internal/compile/compile.go 0% <0%> (ø)
exec/internal/compile/scanner.go 0% <0%> (ø)
wasm/operators/op.go 75% <0%> (ø) :arrow_up:
exec/func.go 76% <100%> (+0.48%) :arrow_up:
exec/internal/compile/native_exec.go 100% <100%> (ø)
exec/native_compile_nogae.go 100% <100%> (ø)
exec/native_compile.go 65.9% <65.9%> (ø)
exec/vm.go 85.01% <71.42%> (-1.76%) :arrow_down:
exec/internal/compile/amd64.go 79.5% <79.5%> (ø)
exec/internal/compile/allocator.go 81.81% <81.81%> (ø)
... and 7 more

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 a76146c...b8b6d63. Read the comment docs.

twitchyliquid64 commented 5 years ago

On second thought, hold off on reviewing this. I need to think about a better way to structure this.

twitchyliquid64 commented 5 years ago

@sbinet, can you look at this and give me your thoughts? I'm not done, but getting close. This PR is mostly boilerplate, but usefully implements AOT compilation for i64.const, i64.add, & i64.sub.

twitchyliquid64 commented 5 years ago

Ive addressed the comments, PTAL.

twitchyliquid64 commented 5 years ago

Friendly ping @sbinet :)

twitchyliquid64 commented 5 years ago

Done :) PTAL.

twitchyliquid64 commented 5 years ago

Apologies for the additional commit - I was intending for that to be a different PR, but I found a few bugs that shouldn't be left out of this PR (off-by-one in the return instruction pointer, double-allocation/overrun for vm.context.stack).

twitchyliquid64 commented 5 years ago

Friendly ping @sbinet :)

twitchyliquid64 commented 5 years ago

Let me know if there's anything I can do to move this along. If you would like me to split some of this into separate PRs, (like the scanner in one and the execution in another) I can try. Let me know :)

sbinet commented 5 years ago

Apologies for the sluggish answers. (I am on the road to the dotGo conference...)

If you can split some PRs off, then yes, by all means: smaller bites are great :)

twitchyliquid64 commented 5 years ago

No worries at all :) I'm sorry for being pushy, just trying to get this in before my excitement shifts to other ideas.

I'll go ahead and split this into 2-3 different PRs, and close this one.

Thanks, and enjoy dotGo! Say hi to Dave for me :smile: