Skip to content

Start on ByteCode interpreter - #854

Closed
jasonwilliams wants to merge 3 commits into
boa-dev:masterfrom
jasonwilliams:vm2
Closed

jasonwilliams wants to merge 3 commits into
boa-dev:masterfrom
jasonwilliams:vm2

Conversation

@jasonwilliams

@jasonwilliams jasonwilliams commented Oct 12, 2020 •

Copy link
Copy Markdown
Member

This does run!

Nodes implement CodeGen which generates instructions onto a stack held in Context.
The VM will interpret the instructions from Context.

There are some issues:

As most of this is behind a feature flag it would be good to merge parts of it so we can work on as the main interpreter is active. Then one day we can switch over.

for

2 + 2

The instructions generated are

[boa/src/context.rs:689] &self.instruction_stack = [
    Int32       2,
    Int32       2,
    Add,
]
4

We can optimize even further here and just do the addition at CodeGen level and throw 4 onto the stack

Fixes #167
@Razican @HalidOdat

@jasonwilliams jasonwilliams mentioned this pull request Oct 12, 2020
@codecov

codecov Bot commented Oct 12, 2020

Copy link
Copy Markdown

Codecov Report

Merging #854 into master will decrease coverage by 0.24%.
The diff coverage is 32.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #854      +/-   ##
==========================================
- Coverage   59.24%   58.99%   -0.25%     
==========================================
  Files         157      160       +3     
  Lines       10037    10132      +95     
==========================================
+ Hits         5946     5977      +31     
- Misses       4091     4155      +64     
Impacted Files Coverage Δ
boa/src/lib.rs 86.36% <ø> (ø)
boa/src/syntax/ast/node/operator/bin_op/mod.rs 66.08% <0.00%> (-4.29%) ⬇️
boa/src/syntax/ast/node/statement_list/mod.rs 42.22% <0.00%> (-6.50%) ⬇️
boa/src/vm/compilation.rs 0.00% <0.00%> (ø)
boa/src/vm/instructions.rs 0.00% <0.00%> (ø)
boa/src/vm/mod.rs 0.00% <0.00%> (ø)
boa_cli/src/main.rs 33.33% <ø> (ø)
boa/src/context.rs 57.38% <6.25%> (-3.71%) ⬇️
boa/src/builtins/object/mod.rs 64.86% <73.17%> (+3.18%) ⬆️
... and 2 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 36b7c31...72b8680. Read the comment docs.

@HalidOdat HalidOdat added A-Enhancement New feature or request A-Performance Performance related changes and issues labels Oct 13, 2020
@jasonwilliams

Copy link
Copy Markdown
Member Author

continuing here #860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Enhancement New feature or request A-Performance Performance related changes and issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate Bytecode

2 participants